Sfoglia il codice sorgente

奈雪、瑞辛、喜茶 品牌规格处理

DaMowang 2 anni fa
parent
commit
e5063da619
2 ha cambiato i file con 310 aggiunte e 200 eliminazioni
  1. 309 190
      src/pagesB/orderingfood/orderingfood.vue
  2. 1 10
      src/pagesB/orderingfood/payTheBill.vue

+ 309 - 190
src/pagesB/orderingfood/orderingfood.vue

@@ -13,7 +13,7 @@
                     <view v-else class="address">{{MerchantInfo.restaurant_address}}</view>
                 </view>
                 <view class="right flex_c flex_jc">
-					<span @click="openm" class="iconfont">&#xe634;</span>
+                    <span @click="openm" class="iconfont">&#xe634;</span>
                 </view>
             </view>
             <view style="height: 130rpx;"></view>
@@ -27,17 +27,17 @@
                 <view class="right">
                     <scroll-view scroll-y scroll-with-animation :scroll-into-view="goodsInto" class="goodList">
                         <!-- <view v-if="swiperList.length>0" class="swiperBpx">
-							<swiper class="swiper" circular autoplay interval="6000" duration="500" @change="swiperChange">
-								<swiper-item v-for="(item, index) in swiperList" :key="index" @click="getBannerTap(item.target_data)">
-									<image lazy-load="true" mode="aspectFill" :src="item.pic" />
-								</swiper-item>
-							</swiper>
-							<view class="swiperDots">
-								<block v-for="(item, index) in swiperList" :key="index">
-									<view class="dot" :class="swiperCurrent==index?'active':''"></view>
-								</block>
-							</view>
-						</view> -->
+                            <swiper class="swiper" circular autoplay interval="6000" duration="500" @change="swiperChange">
+                                <swiper-item v-for="(item, index) in swiperList" :key="index" @click="getBannerTap(item.target_data)">
+                                    <image lazy-load="true" mode="aspectFill" :src="item.pic" />
+                                </swiper-item>
+                            </swiper>
+                            <view class="swiperDots">
+                                <block v-for="(item, index) in swiperList" :key="index">
+                                    <view class="dot" :class="swiperCurrent==index?'active':''"></view>
+                                </block>
+                            </view>
+                        </view> -->
                         <view id="goodsQuery" v-for="(item, index) in goodsAllList" :key="index">
                             <view class="goodsList" :id="'gory-'+index">
                                 <view class="gheader" :style="'color:'+template.color.color2">{{item.title}}</view>
@@ -55,18 +55,8 @@
                                         <view class="box">
                                             <view class="price" :style="'color:'+template.color.color1">¥{{itm.product_price}}</view>
                                             <view class="button">
-                                                <block v-if="openStoreStatus">
-                                                    <block v-if="itm.product_choose">
-                                                        <view class="text" :style="'background-color:'+template.color.color5">选规格</view>
-                                                    </block>
-                                                    <block v-else>
-                                                        <icon type="jia" size="23" :color="template.color.color5"></icon>
-                                                    </block>
-                                                </block>
-                                                <block v-else>
-                                                    <view v-if="itm.product_choose" class="text" :style="'background-color:'+template.color.color5">选规格</view>
-                                                    <icon v-else type="jia" size="23" :color="template.color.color5"></icon>
-                                                </block>
+                                                <view v-if="itm.product_choose" class="text" :style="'background-color:'+template.color.color1">选规格</view>
+                                                <icon v-else type="jia" size="23" :color="template.color.color1"></icon>
                                             </view>
                                         </view>
                                     </view>
@@ -89,8 +79,8 @@
                     <view class="price" :style="'color:'+template.color.color2">¥{{cartTotal}}</view>
                 </view>
                 <view class="right">
-					<view v-if="cartNumber>0" class="button" @click="toPaypalTap()" :style="'background-color:'+template.color.color1">去结算</view>
-					<view v-else class="button none" :style="'background-color:'+template.color.color5">去结算</view>
+                    <view v-if="cartNumber>0" class="button" @click="toPaypalTap()" :style="'background-color:'+template.color.color1">去结算</view>
+                    <view v-else class="button none" :style="'background-color:'+template.color.color5">去结算</view>
                 </view>
             </view>
             <!-- 购物袋 - 弹窗列表 -->
@@ -102,7 +92,8 @@
                             <view class="text">共{{cartNumber}}件商品</view>
                         </view>
                         <view class="right">
-                            <view class="text" @click="delNoneCartTap()"><icon type="shanchu" size="14"/>清空购物袋</view>
+                            <view class="text" @click="delNoneCartTap()">
+                                <icon type="shanchu" size="14" />清空购物袋</view>
                         </view>
                     </view>
                     <view class="sconten">
@@ -116,7 +107,7 @@
                             <view class="right">
                                 <view class="price">¥{{$h.Add(item.product_price, item.spec_price)}}</view>
                                 <view class="buy">
-                                    <icon type="jian" @click="editGoods(item, 'jian')" size="23" :color="item.number==1?'#cccccc':'#d3aa79'"></icon>
+                                    <icon type="jian" @click="editGoods(item, 'jian')" size="23" :color="item.number==1?'#ccc':'#d3aa79'"></icon>
                                     <input type="number" :value="item.number" disabled />
                                     <icon type="jia" @click="editGoods(item, 'jia')" size="23" color="#d3aa79"></icon>
                                 </view>
@@ -126,24 +117,63 @@
                 </view>
             </view>
             <view v-if="!openStoreStatus" class="footer" :class="ios>=0?'footerX':''" style="overflow: hidden;">
-                <view class="label" :style="'background-color:'+template.color.color2">本店已休息,<block v-if="MerchantInfo.open_time">营业时间{{MerchantInfo.open_time}}</block></view>
+                <view class="label" :style="'background-color:'+template.color.color2">本店已休息,<block v-if="MerchantInfo.open_time">营业时间{{MerchantInfo.open_time}}</block>
+                </view>
             </view>
-			<!-- 选规格-看详情 -->
+            <!-- 选规格-看详情 -->
             <view v-if="goodShow" class="showPopBox" style="display: flex;align-items: center;justify-content: center;">
                 <view class="bg" @click="goodShow=false"></view>
                 <view class="goodsConten">
                     <view class="image">
-                        <img :src="goodsOneData.product_img" class="img" />
+                        <image :src="goodsOneData.product_img" class="img" mode="aspectFill" />
                         <icon @click="goodShow=false" type="close" size="25" :color="template.color.color5" style="top: 10rpx; right: 10rpx;"></icon>
                     </view>
                     <view class="title" :style="'color:'+template.color.color2">{{goodsOneData.product_name}}</view>
                     <scroll-view scroll-y class="moreBox" style="max-height: 500rpx;">
-                        <view class="label" v-for="(item, index) in goodsOneData.details.optional" :key="index">
-                            <view class="stitle"><text>{{item.name}}</text></view>
-                            <view class="specBox">
-                                <view class="spec" :style="itm.active?'background-color:'+template.color.color1+';border-color:'+template.color.color1:''" :class="itm.active?'active':''" @click="selectSpecsTap(index, idx)" v-for="(itm, idx) in item.sku_infos" :key="idx">{{itm.name + (itm.price ? ` +${itm.price}` : "")}}</view>
+
+                        <!-- 奈雪规格 -->
+                        <template v-if="mda.brand_id == 2">
+                            <view class="label" v-for="(item, index) in goodsOneData.details.spu_specs" :key="index">
+                                <view class="stitle"><text>{{item.name}}</text></view>
+                                <view class="specBox">
+                                    <view class="spec" :class="{active:itm.checked}" @click="naixues(index, idx)" v-for="(itm, idx) in item.values" :key="idx">{{itm.name + (itm.price ? ` +${itm.price}` : "")}}</view>
+                                </view>
                             </view>
-                        </view>
+                            <view class="label">
+                                <view class="stitle"><text>加料</text></view>
+                                <view class="specBox">
+                                    <view class="spec" :class="{active:itm.checked}" @click="naixue(idx,itm.checked)" v-for="(itm, idx) in goodsOneData.details.accessories" :key="idx">{{itm.name + (itm.price ? ` +${itm.price}` : "")}}</view>
+                                </view>
+                            </view>
+                        </template>
+                        <!-- 瑞辛规格 -->
+                        <template v-else-if="mda.brand_id == 13">
+                            <view class="label" v-for="(item, index) in goodsOneData.details.specifications" :key="index">
+                                <view class="stitle"><text>{{item.name}}</text></view>
+                                <view class="specBox">
+                                    <view class="spec" :class="{active:itm.checked}" @click="ruixins(index, idx)" v-for="(itm, idx) in item.ingredients" :key="idx">{{itm.name + (itm.price ? ` +${itm.price}` : "")}}</view>
+                                </view>
+                            </view>
+                        </template>
+                        <!-- 喜茶规格 -->
+                        <template v-else-if="mda.brand_id == 19">
+                            <view class="label" v-for="(item, index) in goodsOneData.details.specifications" :key="index">
+                                <view class="stitle"><text>{{item.name}}</text></view>
+                                <view class="specBox">
+                                    <view class="spec" :class="{active:itm.checked}" @click="xichas(index, idx)" v-for="(itm, idx) in item.values" :key="idx">{{itm.name + (itm.price ? ` +${itm.price}` : "")}}</view>
+                                </view>
+                            </view>
+                        </template>
+                        <!-- 其他规格 -->
+                        <template v-else>
+                            <view class="label" v-for="(item, index) in goodsOneData.details.optional" :key="index">
+                                <view class="stitle"><text>{{item.name}}</text></view>
+                                <view class="specBox">
+                                    <view class="spec" :class="{active:itm.checked}" @click="selectSpecsTap(index, idx)" v-for="(itm, idx) in item.sku_infos" :key="idx">{{itm.name + (itm.price ? ` +${itm.price}` : "")}}</view>
+                                </view>
+                            </view>
+                        </template>
+
                         <view class="more" v-if="goodsOneData.product_description">
                             <view class="labtit" :style="'color:'+template.color.color3">产品介绍</view>
                             <view class="intro" :style="'color:'+template.color.color3">{{goodsOneData.product_description}}</view>
@@ -160,18 +190,13 @@
                             </view>
                             <view class="right">
                                 <view class="buy">
-                                    <icon type="jian" @click="editGoodsOne('jian')" size="23" :color="buyNumber<=1?template.color.color5:template.color.color1"></icon>
+                                    <icon type="jian" @click="editGoodsOne('jian')" size="23" :color="template.color.color1"></icon>
                                     <input type="number" :value="buyNumber" disabled :style="'color:'+template.color.color2" />
-                                    <icon type="jia" @click="editGoodsOne('jia')" size="23" :color="template.color.color5"></icon>
+                                    <icon type="jia" @click="editGoodsOne('jia')" size="23" :color="template.color.color1"></icon>
                                 </view>
                             </view>
                         </view>
-                        <block v-if="openStoreStatus">
-                                <view class="button" @click="addShopCar()" :style="'background-color:'+template.color.color1">加入购物袋</view>
-                        </block>
-                        <block v-else>
-                            <view class="button none" :style="'background-color:'+template.color.color5">本店已休息</view>
-                        </block>
+                        <view class="button" @click="addShopCar()" :style="'background-color:'+template.color.color1">加入购物袋</view>
                     </view>
                 </view>
             </view>
@@ -181,7 +206,6 @@
 <script>
 import Icon from "@/pagesB/components/icon/icon.vue";
 import { post } from "@/request/api.js";
-// import { deepEqual,CompareJsonObj } from "@/utils/myfun.js";
 export default {
     components: { Icon },
     props: {
@@ -199,26 +223,18 @@ export default {
                     color1: "#d3aa79",
                     color2: "#323232",
                     color3: "#999",
-                    color5: "#d3aa79"
+                    color5: "#bbb"
                 }
             },
-            goodsHeight: 812,
             menuCurrent: 0,
             menuList: [],
             swiperCurrent: 0,
             swiperList: [],
-            page: 1,
-            goodsListData: {
-                page: 1,
-                total: 0,
-                list: []
-            },
             cartTotal: 0,
             cartNumber: 0,
             cartList: [],
             goodsOneData: '',
             buyNumber: 1,
-            buyNumMax: 100,
             canSubmit: false,
             childProductData: {},
             // buyActive: false,
@@ -227,46 +243,41 @@ export default {
             goodShow: false,
             goodsInto: '',
             goodsAllList: [],
-            heightArr: [],
             distance: 0,
-            haibaoStu: false,
-            haibaoImg: '',
-            shareShow: false,
             openStoreStatus: true,
             openStoreTime: '',
-            couponsList: [],
-            couponsShow: false,
             MerchantInfo: uni.getStorageSync("MerchantItem"),
+            mda: {},
         }
     },
     onReady() {
-		this.distance = this.MerchantInfo.distance;
+        this.distance = this.MerchantInfo.distance;
         uni.setNavigationBarTitle({ title: this.MerchantInfo.restaurant_name });
         this.getCartList();
 
         let that = this;
         uni.getSystemInfo({
             success: function(e) {
-                console.log('e',e);
-                // that.ios = e.model.search("iPhone");
-                that.ios = -1;
+                that.ios = e.model.search("iPhone");
             }
         })
     },
     onLoad(da) {
         this.getGoodsAllList(da)
+        this.mda = da
     },
     methods: {
-		// 获取当下店铺所有商品
+        // 获取当下店铺所有商品
         getGoodsAllList(da) {
             post("local/getMerchantMenu", da).then(res => {
                 this.loading = false;
                 if (res.code == 0) {
-                    if(res.data.error_code == 200){
+                    if (res.data.error_code == 200) {
                         let da = res.data.data.products;
-                        let arr = [], obj = [];
+                        let arr = [],
+                            obj = [];
                         for (const it of da) {
-                            if([2,13,19].includes(res.data.data.brand_id)) it.product_choose = false
+                            // if ([2, 13, 19].includes(res.data.data.brand_id)) it.product_choose = false
                             if (!arr.includes(it.category_name)) arr.push(it.category_name)
                         }
                         for (const i of arr) {
@@ -277,28 +288,37 @@ export default {
                         }
                         this.goodsAllList = obj
                     }
-                }
-                else if (res.code == -1) {
+                } else if (res.code == -1) {
                     this.openStoreStatus = false
                 }
             })
         },
-		// 获取商品详情 - 展开规格选择
+        // 商品类别导航跳转
+        selectMenuTap(index) {
+            this.menuCurrent = index;
+            this.goodsInto = 'gory-' + index;
+        },
+        // 获取商品详情 - 展开规格选择
         getDteailsTap(index, idx) {
-            let data = this.goodsAllList[index].goods[idx];
             this.childProductData = {};
-            let info = this.MerchantInfo;
-            if (![2,13,19].includes(data.brand_id) && data.product_choose) {
-                post("local/getProduct", {
-                    brand_id: info.brand_id,
-                    restaurant_id: info.restaurant_id,
-                    product_id: data.product_id
-                }).then(res => {
+            let data = this.goodsAllList[index].goods[idx];
+            // if (![2,13,19].includes(data.brand_id) && data.product_choose) {
+            if (data.product_choose) {
+                post("local/getProduct", { ...this.mda, product_id: data.product_id }).then(res => {
                     if (res.code === 0) {
                         let da = res.data.data
+
+                        // if(da.brand_id==19){
+                        //     details.optional
+                        // }
+
                         this.goodsOneData = da;
-                        this.buyNumber = 1;
                         this.goodShow = true;
+
+                        if(this.mda.brand_id == 2) this.naixueSpec()
+                        else if(this.mda.brand_id == 13) this.ruixinSpec()
+                        else if(this.mda.brand_id == 19) this.xichasSpec()
+                        else this.selectSpec()
                     }
                 })
             } else {
@@ -306,50 +326,155 @@ export default {
                 this.goodShow = true;
             }
         },
-		// 商品类别导航跳转
-        selectMenuTap(index) {
-            this.menuCurrent = index;
-            this.goodsInto = 'gory-' + index;
+        // 选择规格标签 奈雪
+        naixues(index, key) {
+            let da = this.goodsOneData.details.spu_specs;
+			da[index].values.forEach(value => this.$set(value, 'checked', 0))
+			da[index].values[key].checked = 1
+            this.naixueSpec();
         },
-		// 选择规格标签
-        selectSpecsTap(index, idx) {
-            let specification = this.goodsOneData.details.optional;
-            for (let i = 0; i < specification.length; i++) {
-                if (i == index) {
-                    specification[i].active = true;
-                    for (let s = 0; s < specification[i].sku_infos.length; s++) {
-                        if (s == idx) {
-                            specification[i].sku_infos[s].active = true;
-                        } else {
-                            specification[i].sku_infos[s].active = false
+        naixueSpec(){
+            let da = this.goodsOneData.details.spu_specs;
+            let arr = [], obj = this.childProductData.selectSpecification || {};
+            let arrs = [];
+            for (let it of da) {
+                for (let i of it.values) {
+                    if(i.checked) {
+                        arr.push(i);
+                        obj[it.name] = i.name
+                        let arrb = []
+                        if(arr.length == 1) arrs = this.goodsOneData.details.sku_infos
+                        for (const a of arrs) {
+                            for (const b of a.specs) {
+                                if(i.code == b.spec_code) arrb.push(a)
+                            }
                         }
+                        arrs = arrb
                     }
                 }
             }
-            this.$set(this.goodsOneData.details.optional, index, this.goodsOneData.details.optional[index])
-            let curSelectNum = 0;
-			let spec_price = 0;
-            let selectSpecArr = [];
-            let selectSpecification = {};
-            for (let i = 0; i < specification.length; i++) {
-                if (specification[i].active) {
-                    curSelectNum++
-                    for (let s = 0; s < specification[i].sku_infos.length; s++) {
-                        if (specification[i].sku_infos[s].active) {
-                            selectSpecification[specification[i].name] = specification[i].sku_infos[s].name;
-                            let pid = specification[i].id;
-                            let { id, name, price, amount } = specification[i].sku_infos[s];
-                            selectSpecArr.push({ id, name, price, amount, pid });
-                            spec_price += price;
+            let sku = {
+                sku_code : arrs[0].code
+            }
+            this.childProductData.selectSpecArr = arr
+            this.childProductData.selectSpecification = obj
+            this.childProductData.product_details = sku
+        },
+        naixue(key,r) {
+            let selectSpecification = this.childProductData.selectSpecification || {};
+            let da = this.goodsOneData.details.accessories;
+			da.forEach(value => this.$set(value, 'checked', 0))
+			da[key].checked = r ? 0 : 1;
+            this.childProductData.spec_price = !r ? da[key].price : 0
+            if(!r) selectSpecification['加料'] = da[key].name
+            else delete selectSpecification['加料']
+            this.childProductData.selectSpecification = selectSpecification
+            let sku = {
+                accessories_code: da[key].code
+            }
+            this.childProductData.product_details = sku
+        },
+        // 选择规格标签 瑞辛
+        ruixins(index, key) {
+            let da = this.goodsOneData.details.specifications;
+			da[index].ingredients.forEach(value => this.$set(value, 'checked', false))
+			da[index].ingredients[key].checked = true
+            this.ruixinSpec();
+        },
+        ruixinSpec(){
+            let da = this.goodsOneData.details.specifications;
+            let arr = [], obj = this.childProductData.selectSpecification || {};
+            let arrs = [];
+            for (let it of da) {
+                for (let i of it.ingredients) {
+                    if(i.checked) {
+                        arr.push(i);
+                        obj[it.name] = i.name
+                        let arrb = []
+                        if(arr.length == 1) arrs = this.goodsOneData.details.sku_infos
+                        for (const a of arrs) {
+                            for (const b of a.values) {
+                                if(i.name == b.spec_name) arrb.push(a)
+                            }
                         }
+                        arrs = arrb
                     }
                 }
             }
-            if (curSelectNum == specification.length) this.canSubmit = true
-            else this.canSubmit = false;
-            this.childProductData = { selectSpecArr, selectSpecification, spec_price };
+            let sku = {
+                sku_code : arrs[0].code
+            }
+            this.childProductData = {
+                selectSpecArr: arr,
+                selectSpecification: obj,
+                product_details: sku
+            }
+        },
+        xichas(index, key){
+            let da = this.goodsOneData.details.specifications;
+			da[index].values.forEach(value => this.$set(value, 'checked', 0))
+			da[index].values[key].checked = 1
+            this.xichasSpec();
+        },
+        xichasSpec(){
+            let spec_price = 0;
+            let da = this.goodsOneData.details.specifications;
+            let arr = [], obj = this.childProductData.selectSpecification || {};
+            let accessories_id = [], sku_id = [];
+            for (let it of da) {
+                for (let i of it.values) {
+                    if(i.checked) {
+                        arr.push(i);
+                        obj[it.name] = i.name
+                        spec_price = this.$h.Add(spec_price,i.price)
+                        if(i.mandatory) sku_id.push(i.id)
+                        else accessories_id.push(i.id)
+                    }
+                }
+            }
+            let product_details = {
+                accessories_id: accessories_id.join(),
+                sku_id: sku_id.join()
+            }
+            this.childProductData = {
+                selectSpecArr: arr,
+                selectSpecification: obj,
+                spec_price,
+                product_details
+            }
+        },
+        // 选择规格标签
+        selectSpecsTap(index, key) {
+            let da = this.goodsOneData.details.optional;
+			da[index].sku_infos.forEach(value => this.$set(value, 'checked', false))
+			da[index].sku_infos[key].checked = true
+            this.selectSpec();
         },
-		// 添加购物袋前  修改购买数量
+        selectSpec(){
+            let spec_price = 0, product_details = [];
+            let da = this.goodsOneData.details.optional;
+            let arr = [], obj = this.childProductData.selectSpecification || {};
+            for (let it of da) {
+                for (let i of it.sku_infos) {
+                    if(i.checked) {
+                        arr.push(i);
+                        obj[it.name] = i.name
+                        spec_price = this.$h.Add(spec_price,i.price)
+                        product_details.push({
+                            specification_id: it.id,
+                            sku_id: i.id
+                        })
+                    }
+                }
+            }
+            this.childProductData = {
+                selectSpecArr: arr,
+                selectSpecification: obj,
+                spec_price,
+                product_details
+            }
+        },
+        // 添加购物袋前  修改购买数量
         editGoodsOne(type) {
             let self = this;
             if (type == 'jian') {
@@ -360,37 +485,22 @@ export default {
                 self.buyNumber++
             }
         },
-		// 添加进购物袋
+        // 添加进购物袋
         addShopCar() {
             let data = this.goodsOneData;
-
-            if(![2,13,19].includes(data.brand_id)){
-                if (data.product_choose) {
-                    if (this.canSubmit) {
-                        this.addCartGoods(data, this.buyNumber, this.childProductData);
-                    } else {
-                        uni.showToast({ title: '请选择规格', icon: 'none' });
-                        return
-                    }
-                } else {
-                    this.addCartGoods(data, this.buyNumber);
-                }
-            }
-            else{
-                this.addCartGoods(data, this.buyNumber, this.childProductData);
-            }
-            
+            this.addCartGoods(data, this.buyNumber, this.childProductData);
         },
-		// 添加购物袋
+        // 添加购物袋
         addCartGoods(da, num, spec = []) {
             let json = {
-                brand_id: this.MerchantInfo.brand_id,
-                restaurant_id: this.MerchantInfo.restaurant_id,
+                // brand_id: this.MerchantInfo.brand_id,
+                // restaurant_id: this.MerchantInfo.restaurant_id,
+                ...this.mda,
                 product_id: da.product_id,
                 product_img: da.product_img,
                 product_name: da.product_name,
                 product_price: da.product_price,
-				spec_price: spec.spec_price,
+                spec_price: spec.spec_price,
                 number: num,
                 spec: JSON.stringify(spec)
             }
@@ -403,36 +513,36 @@ export default {
                 }
             })
         },
-		// 编辑购物袋中商品数量
+        // 编辑购物袋中商品数量
         editGoods(data, type) {
             let self = this;
             if (type == 'jian') {
-				data.number--
+                data.number--
             } else if (type == 'jia') {
-				data.number++
+                data.number++
+            }
+            let url = "local/editMyCart",
+                da = {};
+            if (data.number < 1) {
+                data.number = 1;
+                url = "local/delMyCart";
+                da = { cart_id: data.id }
+            } else {
+                url = "local/editMyCart";
+                da = { cart_id: data.id, number: data.number }
             }
-			let url = "local/editMyCart",da = {};
-			if(data.number < 1) {
-				data.number = 1;
-				url = "local/delMyCart";
-				da = { cart_id: data.id }
-			}
-			else {
-				url = "local/editMyCart";
-				da = { cart_id: data.id, number: data.number }
-			}
-			post(url, da).then(res => {
-				if (res.code == 0) {
-					setTimeout(() => {
-						this.getCartList();
-					}, 100)
-				}
-			})
+            post(url, da).then(res => {
+                if (res.code == 0) {
+                    setTimeout(() => {
+                        this.getCartList();
+                    }, 100)
+                }
+            })
         },
-		// 购物袋列表 获取当前店铺
+        // 购物袋列表 获取当前店铺
         getCartList() {
             post("local/myCart", {
-                restaurant_id: this.MerchantInfo.restaurant_id,
+                restaurant_id: this.mda.restaurant_id,
             }).then(res => {
                 if (res.code == 0) {
                     let data = res.data;
@@ -449,7 +559,7 @@ export default {
                 }
             })
         },
-		// 清空购物袋
+        // 清空购物袋
         delNoneCartTap() {
             let self = this;
             if (self.cartList.length > 0) {
@@ -458,14 +568,14 @@ export default {
                     content: '是否清空已经加入购物袋的商品?',
                     success(res) {
                         if (res.confirm) {
-							post("local/cleanCart", {
-								restaurant_id: self.MerchantInfo.restaurant_id,
-							}).then(res => {
-								if (res.code == 0) {
-									self.cartShow = false;
-									self.cartList = [];
-								}
-							})
+                            post("local/cleanCart", {
+                                restaurant_id: self.mda.restaurant_id,
+                            }).then(res => {
+                                if (res.code == 0) {
+                                    self.cartShow = false;
+                                    self.cartList = [];
+                                }
+                            })
                         }
                     }
                 })
@@ -473,20 +583,24 @@ export default {
         },
 
         // 去结算页
-        toPaypalTap(){
-            this.goto("/pagesB/orderingfood/payTheBill",{
-                restaurant_id: this.MerchantInfo.restaurant_id,
-                brand_id: this.MerchantInfo.brand_id,
+        toPaypalTap() {
+            this.goto("/pagesB/orderingfood/payTheBill", {
+                restaurant_id: this.mda.restaurant_id,
+                brand_id: this.mda.brand_id,
             })
         },
-        openm(){
+        openm() {
             let latitude = parseFloat(this.MerchantInfo.latitude);
             let longitude = parseFloat(this.MerchantInfo.longitude);
             let name = this.MerchantInfo.brand_name;
             let address = this.MerchantInfo.restaurant_address;
             uni.openLocation({
-                latitude, longitude, scale: 18, name, address,
-                success: function () {
+                latitude,
+                longitude,
+                scale: 18,
+                name,
+                address,
+                success: function() {
                     console.log('success');
                 }
             });
@@ -512,6 +626,7 @@ page {
 
     .left {
         width: calc(100% - 60rpx);
+
         .title {
             width: 90%;
             color: #343434;
@@ -529,10 +644,12 @@ page {
             overflow: hidden;
         }
     }
-    .right{
+
+    .right {
         width: 60rpx;
         text-align: right;
-        .iconfont{
+
+        .iconfont {
             font-size: 50rpx;
             color: #666;
         }
@@ -727,7 +844,7 @@ page {
     }
 }
 
-.hahaha{
+.hahaha {
     text-align: center;
     margin-top: calc(30vh - 150rpx);
 }
@@ -904,7 +1021,7 @@ page {
                 display: flex;
                 align-items: center;
                 border-bottom: 1px dashed #f5f5f5;
-				padding: 15rpx 0;
+                padding: 15rpx 0;
 
                 .left {
                     flex: 0 0 60%;
@@ -1017,14 +1134,14 @@ page {
         box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, .06);
 
         .image {
-            width: 100%;
-            height: 100%;
             display: flex;
             align-items: center;
             justify-content: center;
             position: relative;
-            .img{
-                object-fit: cover;
+
+            .img {
+                width: 100%;
+                height: 320rpx;
                 border-radius: 10rpx 10rpx 0 0;
             }
 
@@ -1072,6 +1189,8 @@ page {
 
                     .active {
                         color: #FFFFFF;
+                        background-color: #d3aa79;
+                        border-color: #d3aa79;
                     }
                 }
             }
@@ -1173,17 +1292,17 @@ page {
 }
 
 .good_spec {
-	color: #999;
-	font-size: 22rpx;
-	margin-right: 12rpx;
+    color: #999;
+    font-size: 22rpx;
+    margin-right: 12rpx;
 
-	&:last-child {
-		margin-right: 0;
-	}
+    &:last-child {
+        margin-right: 0;
+    }
 }
 
-.loadingBox{
-    .loading{
+.loadingBox {
+    .loading {
         width: 100%;
         height: 100vw;
     }

+ 1 - 10
src/pagesB/orderingfood/payTheBill.vue

@@ -108,17 +108,8 @@ export default {
         payBill(){
             let Arr = []
             for (const it of this.cartList) {
-                let product_details = []
                 let spec = JSON.parse(it.spec)
-                if(spec.selectSpecArr){
-                    for (const i of spec.selectSpecArr) {
-                        product_details.push({
-                            specification_id: i.pid,
-                            sku_id: i.id
-                        })
-                    }
-                }
-                console.log('product_details',product_details);
+                let product_details = spec.product_details
                 Arr.push({
                     product_id: it.product_id,
                     amount: it.number,