| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734 |
- <template>
- <view style="background-color: whitesmoke;">
- <customNav :shownav="true" :title="posName" titledetl=""></customNav>
- <view style="width: 100%;height: 80rpx;background-color: #40AE36;"></view>
- <view class="nodetail">
- <view class="contentInRowS" style="width: 100%;" @click="gengduozx">
- <netImage style="margin-left: 12rpx;margin-top: -20rpx;" width="140" height="140" bradius="70" :mysrc="mendianMs.logo" mymode="scaleToFill"></netImage>
- <view class="contentColumn" style="width: 500rpx;margin-right: 20rpx;margin-top: 4rpx;">
- <view class="contentColumn">
- <text class="dianpuming">{{mendianMs.posName}}</text>
- <text class="peisongsuoming">{{$t('index.manX')}} {{$formPr(mendianMs.posPrice)}} {{$t('locale.huobidw')}}</text>
- <text v-if="mendianMs.state==1" style="margin-top: 10rpx;color: darkgreen;font-size: 28rpx;padding-right: 40rpx;">{{$t('mend.statedy')}}</text>
- </view>
- </view>
- </view>
- <view class="contentInRowL" style="margin-left: 40rpx;margin-top: 10rpx;margin-right: 40rpx;">
- <view class="contentColumnC" style="width: 24%;">
- <image class="actimge" :src="shouchangIcon" mode="aspectFit"></image>
- <text class="textfontS3">{{$t('index.shouchang')}}</text>
- </view>
- <view class="contentColumnC" style="width: 24%;">
- <image class="actimge" src="/static/images/daipinglun@3x.png" mode="aspectFit" @click="pinglunList"></image>
- <text class="textfontS3">{{$t('index.pinglun')}}</text>
- </view>
-
- <view class="contentColumnC" style="width: 24%;">
- <image class="actimge" src="/static/images/kefufuwu.png" mode="aspectFit" @click="callPhone"></image>
- <text class="textfontS3">{{$t('mend.kefudianhua')}}</text>
- </view>
- </view>
- <view style="height: 20rpx;"></view>
- </view>
- <view v-if="cuxiaoImge.length==0">
- <netImage style="margin-top:20rpx;margin-left: 25rpx;" width="700" height="400" bradius="6" :mysrc="mendianMs.image" mymode="scaleToFill"></netImage>
- </view>
-
- <view v-if="cuxiaoImge.length>0"><!-- 促销活动 -->
- <swiperImgs style="margin-top: 20rpx;" width="750" height="400" :imageList="cuxiaoImge"></swiperImgs>
- </view>
- <view style="margin-top: 40rpx;" >
- <view class="menuBox" :style="{height: statickH+'rpx'}">
- <view class="menuContent" :style="{height: statickH-120+'rpx'}">
- <scroll-view scroll-y="true" class="menuLeft">
- <view class="menuType" @click="changeCurrent(index)" v-for="(item,index) in prdList"
- :class="{currentMenu:currentIndex==index}">
- <text class="text2row">{{item.name}}</text>
- </view>
- <view class="line" :style="{top:currentIndex*100 +'rpx'}"></view>
- <view style="height: 120rpx;"></view>
- </scroll-view>
-
- <scroll-view :scroll-top="scrollTop" @scroll="scrollRight" class="menuRight" scroll-y="true">
- <div class="menuDetailBox" v-for="(item,index) in prdList" :key="index">
- <div class="title">{{item.name}}</div>
- <div class="menu" v-for="(menu,index) in item.children" :key="index">
- <div class="d2" @click="shangpinsl(menu.shangpin)">
- <netImage style="margin-top: 10rpx;" width="180" height="180" :mysrc="menu.shangpin.image" mymode="scaleToFill"></netImage>
- </div>
- <div class="menuName" >
- <view class="contentColumnS" style="height: 200rpx;">
- <view class="contentColumn" style="width: 100%;" @click="shangpinsl(menu.shangpin)">
- <text class="pdName text2row">{{menu.shangpin.name}}</text>
- <text class="pdDetail text2row">{{menu.shangpin.introduce}}</text>
- </view>
- <view class="contentColumn" style="width: 100%;">
- <!-- <view class="contentInRowL">
- <text class="redktext">特价</text>
- <text class="greedKtext" style="margin-left: 10rpx;">24H发货</text>
- </view> -->
- <view class="contentInRowS">
- <view class="">
- <text class="pricetext">{{menu.shangpin.price}}</text>
- <text class="pricedw">{{$t("locale.huobidw")}}</text>
- <text class="yuanjia">{{menu.shangpin.price}}{{$t("locale.huobidw")}}</text>
- </view>
-
- </view>
- </view>
- </view>
-
- </div>
- </div>
- </div>
- <view style="height: 120rpx;"></view>
- </scroll-view>
-
- </view>
- </view>
-
- </view>
- <view class="bottomfloatV">
- <view class="buyBT">
- <text class="qjsact" style="background-color:darkmagenta" @click="addfenlei">{{$t('comp.guanlifenl')}}</text>
- <text class="qjsact" style="background-color:darkgreen" @click="addshangpin">{{$t('comp.xinzengsp')}}</text>
- <text class="qjsact" style="background-color:darkred" @click="bianjimendian">{{$t('comp.bianjidp')}}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import api from "@/pages/api/api.js";
- export default {
- data() {
- return {
- //------------------------------
- newData:[], // 拿到右侧所有的商品列表元素
- scrollTop: 0,
- currentIndex: 0,
- prdList:[],
- //-----========
- cuxiaoImge:[],
- id:1,
- userid:0,
- mendianMs:[],
- posName:'',
- isfirstShow:0,
- isShouchang:0,
- shouchangIcon:'/static/images/faver@3x.png',
- option: {},
- login:false,
- showpop:false,
- shangpinfenlei:[],
- startX:0,
- startY:0,
- lang:'3',
- statickH:0,
- }
- },
- onShow() {
- this.getmendianDetail(this.id);
-
- var that =this;
- try {//读取
- that.token = uni.getStorageSync("token");
- //console.log('2222',that.token)
- if(that.token == '' || that.token == undefined || that.token == null){
- that.login=false;
- return;
- }
- else{
- that.login=true;
- return;
- }
- } catch(e){//错误
- return;
- }
- },
- onLoad(option) {
- var language = uni.getStorageSync('language');
- if(language=='yuenan'){
- this.lang='0';
- }
- if(language=='zh-Hans'){
- this.lang='2';
- }
- if(language=='zh-Hant'){
- this.lang='3';
- }
- this.id=option.id;
- uni.pageScrollTo({
- scrollTop:0,
- duration:0
- })
-
- var info = uni.getSystemInfoSync();
- var isAndroid = info.platform.toLowerCase() === 'android';
- console.log(info);
- if(isAndroid){
- this.statickH=info.screenHeight*2-140-60;
- }
- else{
- this.statickH=info.screenHeight*2-180-60;
- }
- },
-
-
- methods: {
-
- //----------------------------------
- changeCurrent(index) {
- this.currentIndex = index
- this.scrollTop = this.newData[index-1]?.offsetHeight || 0
- },
- scrollRight(e) {
- // console.log(e.detail.scrollTop,'scrollRight');
- const query = uni.createSelectorQuery().in(this);
- for (let i = 0; i < this.newData.length; i++) {
- let el = this.newData[i]
- if (e.detail.scrollTop < el.offsetHeight) {
- this.currentIndex = i
- return true
- }
- }
- },
-
- getmendianshangpinFL(id){
- api('getmendianshangpinFL',{
- id:id,
- language:this.lang
- },res=>{
-
- this.shangpinfenlei=res.data.data;
- console.log(this.shangpinfenlei)
- this.initFenlei();
- },failc=>{
- uni.hideLoading();
- //console.log('getadvertis----',failc)
- })
- },
- initFenlei(){
- this.prdList=[];
- if(this.shangpinfenlei&&this.shangpinfenlei.length>0){
- for (var i = 0; i < this.shangpinfenlei.length; i++) {
- var el = this.shangpinfenlei[i];
- var temp = {
- "id": el.id,
- "index": i+1,
- "name": el.name,
- "children": [
- ]
- }
- this.prdList.push(temp);
- }
- }
- this.initproduct();
- },
- initproduct(){
- if(this.prdList.length==0){
- uni.hideLoading();
- return;
- }
- this.getmendianshangpinList(0);
-
- },
- getmendianshangpinList(index){
-
- var obj = this.prdList[index];
-
- api('getmendianshangpinList',{
- id:obj.id,
- language:this.lang
- },r=>{
- console.log(r);
- this.prdList[index].children= this.dowithshangpinList(r.data.data);
- if(index+1<this.prdList.length){
- this.getmendianshangpinList(index+1);
- }
- else{
- console.log(this.prdList);
- this.initNewData();
- uni.hideLoading();
- }
- },failc=>{
- uni.hideLoading();
- //console.log('getadvertis----',failc)
- })
- },
- dowithshangpinList(shangpinlist){
- var tempList = [];
- if(shangpinlist){
- for(var j=0;j<shangpinlist.length;j++){
- var shuliang = 0;
- var otherPrice = this.getotherPrice(shangpinlist[j].foodSku);
- var tempSKU = this.gettempSKU(shangpinlist[j].foodSku);
- var tempsp={
- "shangpin":shangpinlist[j],
- "sku":tempSKU,
- "otherPrice":otherPrice,
- "shuliang":shuliang
- }
- tempList.push(tempsp);
- }
- }
- return tempList;
- },
- initNewData(){
- const query = uni.createSelectorQuery().in(this);
- query.selectAll('.menuDetailBox').boundingClientRect(data => {
- console.log('所有分类项:', data);
- this.newData = data.map((item, index) => {
- function fgfg(total) {
- let sum = 0
- for (var i = 0; i <= total; i++) {
- sum += data[i].height
- }
- return sum
- }
- item.offsetHeight = fgfg(index)
- return item
- })
-
- }).exec();
- },
-
-
- //------------------------------------------------------------------------------
-
- fanhui(){
- uni.navigateBack();
- },
- shareToggle() {
- this.$refs.share.open()
- },
- chooseCancel(){
- this.showpop=false;
- },
- fenxiang(item,index){
- this.option={
- //绘制海报内容
- //codeUrl: 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg', //小程序太阳码
- codeUrl: '/static/defimages/erweim.png', //小程序太阳码
- coverUrl: '/static/defimages/ddd.png', //题库图片
- headUrl: '/static/logo.png', //头像
- //bgUrl: 'https://pic3.zhimg.com/v2-8fbde0f9ac6a19a23aa839e73394618a_b.jpg', //图片背景填充,和 fillStyle 只能传一个,bgUrl 优先级高于 fillStyle
- fillStyle: '#00A6FF', //纯色背景填充颜色
- nickName: '美食达', //授权登录的用户名
- miniName: '不出门吃遍全世界', //小程序名称
- tkName:this.posName, //题库名称
- tkAuthor:'门店介绍', //题库作者
- tkType: '外送', //题库类型
- cost: '自取', //是否需要收费 免费/付费
- isPub: '堂食' //公开 还是 私有
- };
- this.$refs.draw.share_qrcode(this.option);
- },
-
- callPhone(){
- var that = this;
- uni.showModal({
- title: that.$t('api.message'),
- content: that.$t('api.nqdbddh'),
- cancelText:that.$t('order.quxiao'),
- confirmText:that.$t('comp.queren'),
- success: function (res) {
- if (res.confirm) { //这里是点击了确定以后
- console.log(that.mendianMs.telephone)
- plus.device.dial(that.mendianMs.telephone, false );
- } else { //这里是点击了取消以后
- console.log('用户点击取消')
- }
- }
- })
- },
- gengduozx(){
- uni.navigateTo({
- url:'/pages/shanpinxungou/shangjia/gengduozhixun?mendid='+this.id
- })
- },
- pinglunList(){
- uni.navigateTo({
- url:'/pages/pinglun/pingLunList?mendid='+this.id
- })
-
- },
-
- shangpinsl(obj){
- //选择商品
- // uni.navigateTo({
- // url:'/pages/shanpinxungou/shangpin/shangpinxiangqing?id='+id
- // })
- //编辑商品
- console.log('bianjishangpin',obj)
- this.isbjsp=true;
- uni.navigateTo({
- url:'/pages/UserCenter/mendian/addmendianSP?spid='+obj.id+'&sh='+obj.toExamine
- })
- },
-
- //------------------------------------
- getmendianDetail(id){
- //console.log('getmendianDetail:id',id);
- uni.showLoading({
- mask:true
- })
- api('getmendianDetail',{
- id:id
- },r=>{
- console.log(r.data.data);
- this.mendianMs=r.data.data;
- this.userid=this.mendianMs.userId;
- this.posName=this.mendianMs.posName;
- this.isShouchang=this.mendianMs.Collect;
- if(this.isShouchang==1){
- this.shouchangIcon='/static/images/faverr@3x.png'
- }
- else{
- this.shouchangIcon='/static/images/faver@3x.png'
- }
- this.getmendianshangpinFL(id);
- this.cuxiaoList();
-
- },failc=>{
- uni.hideLoading();
- //console.log('getadvertis----',failc)
- })
- },
- cuxiaoList(){
- api('cuxiaoList',{
- mdId:this.id,
- price:''
- },r=>{
- //console.log('-----------',r)
- if(r.data.code==200){
- this.cuxiaoImge=[];
- var objs = r.data.data;
- for(var i=0;i<objs.length;i++){
- var obj=objs[i];
- if(obj.poster&&obj.poster.length>0){
- this.cuxiaoImge.push(obj.poster);
- }
- }
- }
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
-
- //------------------------------------------------------
- addfenlei(){
- uni.navigateTo({
- url:'/pages/UserCenter/mendian/mendianSPFenlei?mendid='+this.id
- })
- },
- addshangpin(){
- uni.navigateTo({
- url:'/pages/UserCenter/mendian/addmendianSP?mendid='+this.id
- })
- },
- bianjimendian(){
- this.isfirstShow=0;
- uni.navigateTo({
- url:'/pages/UserCenter/mendian/addmendian?id='+this.id
- })
- },
-
- //--------------------------------------
-
- gettempSKU(foodSku){
- var selectsku=[];
- for(var i=0;i<foodSku.length;i++){
- if(foodSku[i].objects.length>0){
- for(var j=0;j<foodSku[i].objects.length;j++){
- if(foodSku[i].objects[j].state==1){
- selectsku.push(foodSku[i].objects[j].name);
- }
- }
- }
- }
- return selectsku;
- },
- getotherPrice(foodSku){
- var jiner=0;
- for(var i=0;i<foodSku.length;i++){
- if(foodSku[i].objects.length>0){
- for(var j=0;j<foodSku[i].objects.length;j++){
- if(foodSku[i].objects[j].state==1){
- jiner=jiner+parseFloat(foodSku[i].objects[j].price);
- }
- }
- }
- }
- return parseFloat(jiner);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- background-color: #F2F3F7;
- }
-
- .box{
- height: 100upx;
- line-height: 100upx;
- text-align: center;
- background-color:white;
- }
- .fixedTop{
- position: fixed;
- top:140rpx;
- left: 0;
- right: 0;
- z-index: 9999999;
- }
- .fixedTopios{
- position: fixed;
- top:180rpx;
- left: 0;
- right: 0;
- z-index: 9999999;
- }
- //-----------------------------
- .nodetail{
- width: 94%;
- margin-left: 3%;
- margin-top: -40rpx;
- background-color: white;
- border-radius: 10rpx;
- }
-
- .fenleiTitle{
- padding-left: 16rpx;
- padding-right: 16rpx;
- line-height: 36rpx;
- font-size: 28rpx;
- border-radius: 20rpx;
- color: darkgray;
- background-color: white;
- border: 1rpx solid darkgray;
- }
- .page-view {
- background-color:#F2F3F7;
- }
-
- .actimgeCT{
- position: fixed;
- width: 94%;
- left: 3%;
- top: 100rpx;
- z-index: 9;
- }
- .actimge{
- width: 60rpx;
- height: 60rpx;
- }
- .buyBT{
- display:flex;
- flex-direction: row;
- justify-content:center;
- align-items: center;
- width: 100%;
- margin-top: 10rpx;
- }
-
- .dianpuming{
- font-size: 30rpx;
- line-height: 32rpx;
- height: 32rpx;
- font-weight: bold;
- overflow: hidden;
- text-overflow: ellipsis;
- /* #ifndef APP-PLUS-NVUE */
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- /* #endif */
- }
- .peisongsuoming{
- font-size: 26rpx;
- line-height: 38rpx;
- height: 38rpx;
- color: dimgray;
- }
- .bottomfloatV{
- position: fixed;
- flex-direction: row;
- align-items: center;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 999;
- background-color: whitesmoke;
- height: 120rpx;
- }
- .qjs{
- border-radius: 30rpx;
- padding-left: 26rpx;
- padding-right: 26rpx;
- margin-left: auto;
- margin-right: 30rpx;
- font-size: 32rpx;
- height: 60rpx;
- line-height: 60rpx;
- }
- .fenleiitem{
- text-align:center;
- margin-top: 12rpx;
- margin-bottom: 12rpx;
- width:660upx;
- border-radius: 10rpx;
- color: darkblue;
- line-height: 54rpx;
- font-size: 28rpx;
- border: solid lavender;
- border-width: 0px 0px 1rpx 0px;
- }
- //-----------------------------
- .menuBox {
- // height: calc(100vh);
- display: flex;
- flex-direction: column;
- // border: 1px solid #ccc;
- margin: 0 10rpx;
- .menuContent {
- height: 100%;
- overflow: auto;
- position: relative;
- display: flex;
- position: sticky;
- top: 0rpx;
- .menuLeft {
- float: left;
- position: relative;
- width: 200rpx;
- background-color: #f5f5f5;
-
- .menuType {
- transition: all 0.4s;
- position: relative;
- z-index: 999999999;
- height: 100rpx;
- display: flex;
- align-items: center;
- padding-left: 20rpx;
-
- &.currentMenu {
- font-weight: 700;
- }
- }
-
- }
-
- .menuRight {
- flex: 1;
- background-color:lavender;
-
- .menuDetailBox {
- .title {
- height: 60rpx;
- display: flex;
- align-items: center;
- }
-
- .menu {
- background-color: #fff;
- height: 200rpx;
- display: flex;
- justify-content: center;
-
- &:not(:nth-last-of-type(1)) {
- margin-bottom: 20rpx;
- }
-
- .d2 {
- width: 180rpx;
- height: 180rpx;
- }
-
- .menuName {
- flex: 1;
- margin-left: 20rpx;
- }
-
- }
- }
- }
- }
- }
-
- .line {
- position: absolute;
- left: 0;
- top: 0;
- height: 100rpx;
- width: 100%;
- background-color: #fff;
- z-index: 999;
- transition: all 0.4s;
-
- &::before {
- content: '';
- position: absolute;
- left: 0;
- top: 0;
- height: 100rpx;
- width: 4rpx;
- background-color: red;
- z-index: 999;
- transition: all 0.4s
- }
- }
-
- .pdName{
- font-size: 30rpx;
- font-weight: bold;
- color: black;
- }
- .pdDetail{
- font-size: 26rpx;
- color: darkgray;
- }
- .redktext{
- color: brown;
- border-radius: 4rpx;
- border: 1px solid brown;
- font-size: 26rpx;
- }
- .greedKtext{
- color: darkgreen;
- border-radius: 4rpx;
- border: 1px solid darkgreen;
- font-size: 26rpx;
- }
- .pricetext{
- color: firebrick;
- font-size: 28rpx;
- font-weight: bold;
- }
- .pricedw{
- font-size: 24rpx;
- color: darkgray;
- }
- .yuanjia{
- font-size: 24rpx;
- color: darkgray;
- text-decoration: line-through;
- }
- .qjsact{
- margin-top: 10rpx;
- margin-left: 40rpx;
- border-radius: 8rpx;
- padding: 10rpx;
- font-size: 30rpx;
- line-height: 30rpx;
- color: white;
- text-align: center;
- }
- </style>
|