xuqiang 4 anni fa
parent
commit
731e0711dc

+ 0 - 2
src/pages/chooseAddress.vue

@@ -87,8 +87,6 @@ export default {
     --button-primary-background-color: @prim;
     --button-primary-border-color: @prim;
 }
-.container {
-}
 
 .list {
     background-color: @bg;

+ 11 - 15
src/pages/merchantorders.vue

@@ -71,7 +71,7 @@
                                 <img :src="item.image" alt="" />
                                 <div>
                                     <div class="text1">{{ item.name }}</div>
-                                    <div class="text2">月销{{ item.num }}&nbsp;&nbsp; 赞60</div>
+                                    <div class="text2">月销{{ item.num }}&nbsp;&nbsp; 赞{{ item.fabulous }}</div>
                                     <div class="bottom" @click.stop>
                                         <div class="price">¥{{ item.price }}.00</div>
                                         <div v-if="count == 0">
@@ -80,6 +80,7 @@
                                         <van-stepper
                                             v-else
                                             :min="min"
+                                            disable-input
                                             @minus="minus(item.price)"
                                             @plus="add(item.price)"
                                             @change="onChange"
@@ -234,24 +235,16 @@
                 <div class="text2">(包装费&nbsp;&nbsp;</div>
                 <div class="text3">¥5)</div>
             </div>
-            <div
-                @click="navigateTo('/pages/storedetails')"
-                class="popup"
-                v-for="(item, index) in merchantorLists"
-                :key="index"
-            >
+            <div class="popup" v-for="(item, index) in merchantorLists" :key="index">
                 <div class="merchantroCon">
                     <img :src="item.image" alt="" />
                     <div>
                         <div class="text1">{{ item.name }}</div>
                         <div class="bottom" @click.stop>
                             <div class="price">¥{{ item.price }}.00</div>
-                            <div v-if="count == 0">
-                                <div class="add" @click="falgs(item.price)">+</div>
-                            </div>
                             <van-stepper
-                                v-else
                                 :min="min"
+                                disable-input
                                 @minus="minus(item.price)"
                                 @plus="add(item.price)"
                                 @change="onChange"
@@ -325,13 +318,15 @@ export default {
                     name: '寿司',
                     image: 'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-54-36URxMKUXs.jpg',
                     num: '226',
-                    price: 20
+                    fabulous: '40',
+                    price: 20.0
                 },
                 {
-                    name: '八宝粥',
+                    name: '冒菜',
                     image: 'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-56-45UCHrCoTS.gif',
-                    num: '226',
-                    price: 10
+                    num: '12',
+                    fabulous: '6',
+                    price: 10.0
                 }
             ],
             merchantorListss: [
@@ -339,6 +334,7 @@ export default {
                     name: '油条',
                     image: 'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-56-45UCHrCoTS.gif',
                     num: '226',
+                    fabulous: '6',
                     price: '2'
                 }
             ]

+ 14 - 2
src/pages/shoppingCart.vue

@@ -22,6 +22,18 @@
 
                 <div class="box">
                     <div class="tit">
+                        <img
+                            style="width:24px;height:24px;margin:0;"
+                            :src="
+                                `https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/${
+                                    list.length == merchantorLists.length
+                                        ? '2021-09-02-15-24-13nwVzJqXX.png'
+                                        : '2021-09-02-14-49-00OrkCuHPB.png'
+                                }`
+                            "
+                            alt=""
+                            @click="all"
+                        />
                         <div class="tit1">益禾堂(一食堂)</div>
                         <img
                             src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-02-16-00-34HfjfViyv.png"
@@ -251,7 +263,7 @@ export default {
             border-radius: 12px;
             .tit {
                 .flex();
-                margin-left: 43px;
+                margin-left: 12px;
                 img {
                     width: 24px;
                     height: 24px;
@@ -259,7 +271,7 @@ export default {
                 .tit1 {
                     .span();
                     font-weight: 400;
-                    margin-right: 5px;
+                    margin: 0 5px 0 8px;
                 }
             }
             .merchantroCon {

+ 75 - 30
src/pages/storedetails.vue

@@ -26,20 +26,24 @@
                     <div class="text1">已售 238</div>
                     <div class="text1">赞 60</div>
                 </div>
-                <div class="buttom">
+                <div class="buttom" v-for="(item, index) in merchantorLists" :key="index">
                     <div class="text">
                         <img
                             src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-02-16-03-40cShzZQEk.png"
                             alt=""
                         />
-                        <div class="text1">20</div>
+                        <div class="text1">{{ item.price }}</div>
                         <div class="text3">.00</div>
                         <div class="text2">另外配送费2元</div>
                     </div>
                     <div class="calculationCon">
-                        <div class="calculation" @click="calculation">-</div>
-                        <div class="num">{{ count }}</div>
-                        <div class="add" @click="count++">+</div>
+                        <van-stepper
+                            :min="0"
+                            disable-input
+                            @minus="minus(item.price)"
+                            @plus="add(item.price)"
+                            @change="onChange"
+                        />
                     </div>
                 </div>
             </div>
@@ -108,7 +112,11 @@
         <div class="box-total">
             <div class="ImgBox">
                 <img
-                    src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-06-16-47-32IOmXLZXX.png"
+                    :src="
+                        `https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/${
+                            tal ? '2021-09-01-16-30-24QYDxYMzU.png' : '2021-09-01-16-30-03wvZqsAeX.png'
+                        }`
+                    "
                     alt=""
                 />
                 <div>
@@ -117,13 +125,13 @@
                             src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-02-16-03-40cShzZQEk.png"
                             alt=""
                         />
-                        <p>22</p>
+                        <p>{{ tal }}</p>
                         <div class="text1">.00</div>
                     </div>
                     <div class="text1">另外配送费2元</div>
                 </div>
             </div>
-            <van-button type="warning" @click="order">结算</van-button>
+            <van-button :disabled="!canSubmit" type="warning" @click="order">结算</van-button>
         </div>
     </div>
 </template>
@@ -136,6 +144,7 @@ export default {
         return {
             swiperCurrent: 0,
             count: 1,
+            tal: 0,
             banners: [
                 {
                     image: 'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-54-36URxMKUXs.jpg'
@@ -144,6 +153,15 @@ export default {
                     image: 'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-56-45UCHrCoTS.gif'
                 }
             ],
+            merchantorLists: [
+                {
+                    name: '寿司',
+                    image: 'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-54-36URxMKUXs.jpg',
+                    num: '226',
+                    fabulous: '40',
+                    price: 20.0
+                }
+            ],
             lists: [
                 {
                     price: '11',
@@ -163,22 +181,46 @@ export default {
         };
     },
     computed: {
-        ...mapState(['userInfo'])
+        ...mapState(['userInfo']),
+        canSubmit() {
+            if (this.tal) {
+                return true;
+            } else {
+                return false;
+            }
+        }
     },
     methods: {
         change(e) {
             this.active = e;
         },
         order() {
-            this.navigateTo('/pages/confirmorder');
-        },
-        calculation() {
-            if (this.count != 0) {
-                this.count--;
+            if (!this.tal) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '请选择商品'
+                });
+                return;
             }
+            this.navigateTo('/pages/confirmorder');
         },
         swiperChange(e) {
             this.swiperCurrent = e.detail.current;
+        },
+        falgs(price) {
+            this.tal = price * 1;
+            this.count = 1;
+            this.min = 1;
+        },
+        add(price) {
+            this.tal = this.tal + price + this.count;
+        },
+        onChange(e) {
+            this.count = e.detail;
+        },
+        minus(price) {
+            this.min = 0;
+            this.tal = price * this.count;
         }
     }
 };
@@ -190,6 +232,25 @@ export default {
     /deep/ .van-button {
         .button();
     }
+    /deep/ .van-stepper__minus {
+        width: 28px;
+        height: 24px;
+        background: @prim;
+        color: #fff;
+    }
+    /deep/ .van-stepper__plus {
+        width: 28px;
+        height: 24px;
+        background: @prim;
+        color: #fff;
+    }
+    /deep/ .van-stepper__input {
+        width: 28px;
+        height: 24px;
+        background: #f5f7fa;
+        border-radius: 2px;
+        margin: 0 2px;
+    }
     .swiper {
         height: 375px;
         img {
@@ -290,22 +351,6 @@ export default {
                     font-weight: bold;
                     color: #fff;
                 }
-                .num {
-                    width: 28px;
-                    height: 24px;
-                    line-height: 24px;
-                    background: #f5f7fa;
-                    border-radius: 2px;
-                    margin: 0 4px;
-                }
-                .add {
-                    width: 24px;
-                    height: 24px;
-                    background: @prim;
-                    line-height: 24px;
-                    font-weight: bold;
-                    color: #fff;
-                }
             }
         }
     }

+ 2 - 1
src/styles/common.less

@@ -90,13 +90,14 @@
      line-height: 24px;
 }
 .add(){
-     width: 24px;
+     width: 28px;
      height: 24px;
      background: @prim;
      line-height: 24px;
      text-align: center;
      font-weight: bold;
      color: #fff;
+     border-radius: 0 4px 4px 0;
 }
 .mytest(){
     position: absolute;