panhui 4 tahun lalu
induk
melakukan
076285e0cd
5 mengubah file dengan 138 tambahan dan 114 penghapusan
  1. 1 1
      project.config.json
  2. 121 94
      src/components/CardCase.vue
  3. 0 3
      src/pages/changeText.vue
  4. 16 16
      src/pages/details.vue
  5. TEMPAT SAMPAH
      src/static/.DS_Store

+ 1 - 1
project.config.json

@@ -142,7 +142,7 @@
                     "id": -1,
                     "name": "拼箱详情",
                     "pathName": "/pages/details",
-                    "query": "id=217"
+                    "query": "id=209"
                 },
                 {
                     "id": -1,

+ 121 - 94
src/components/CardCase.vue

@@ -1,44 +1,58 @@
 <template>
-    <van-popup :show="show" round position="bottom" @close="show = false">
-        <div class="box">
-            <div class="top">
-                <span>选择卡包</span>
-                <div class="right">
-                    <div class="tool-item">
-                        可选
-                    </div>
-                    <div class="tool-item used">
-                        已售
-                    </div>
+    <div class="case">
+        <van-cell :border="false" class="bottom-show" @click="init" is-link>
+            <div slot="title">
+                <div class="text1" v-if="chooseIds.length > 0">
+                    已选<span>{{ chooseIds.length }}</span
+                    >包,共<span>{{ money }}</span
+                    >元,邮费0元
                 </div>
+                <div v-else>请选择卡包</div>
             </div>
+        </van-cell>
+        <van-popup :show="show" round position="bottom" @close="show = false">
+            <div class="box">
+                <div class="top">
+                    <span>选择卡包</span>
+                    <div class="right">
+                        <div class="tool-item">
+                            可选
+                        </div>
+                        <div class="tool-item used">
+                            已售
+                        </div>
+                    </div>
+                </div>
 
-            <div class="content">
-                <div class="card" v-for="(card, index) in cardList" :key="index">
-                    <div class="card-title">卡包{{ index }}</div>
-                    <div class="card-list">
-                        <div
-                            v-for="item in card"
-                            :key="item.id"
-                            class="card-item"
-                            :class="{
-                                used: item.caseStatus !== 'WAIT' || item.userId,
-                                active: chooseIds.includes(item.id)
-                            }"
-                            @click="choose(item.id)"
-                        >
-                            {{ item.boxCode }}
+                <div class="content">
+                    <div class="card" v-for="(card, index) in cardList" :key="index">
+                        <div class="card-title">卡包{{ getNumStr(index + 1) }}</div>
+                        <div class="card-list">
+                            <div
+                                v-for="(item, itemIndex) in card"
+                                :key="item.id"
+                                class="card-item"
+                                :class="{
+                                    used: item.caseStatus !== 'WAIT' || item.userId,
+                                    active: nowChoose.includes(item.id)
+                                }"
+                                @click="choose(item.id, item.caseStatus !== 'WAIT' || item.userId)"
+                            >
+                                {{ getChart(itemIndex) }}
+                            </div>
                         </div>
                     </div>
                 </div>
-            </div>
 
-            <div class="van-btn">
-                <span class="van-cat">已选{{ chooseIds.length }}包,共{{ money }}元,邮费10元</span>
-                <div class="van-buy" type="primary" @click="confirm">确认购买</div>
+                <div class="bottom">
+                    <span class="text">已选{{ nowChoose.length }}包,共{{ money }}元,邮费0元</span>
+                    <van-button size="medium" @click="submit" class="submit" :radius="0" type="primary"
+                        >确认购买</van-button
+                    >
+                </div>
             </div>
-        </div>
-    </van-popup>
+        </van-popup>
+    </div>
 </template>
 
 <script>
@@ -62,12 +76,6 @@ export default {
             default: () => {
                 return [];
             }
-        },
-        name: {
-            type: Array,
-            default: () => {
-                return [];
-            }
         }
     },
     computed: {
@@ -81,8 +89,9 @@ export default {
             return [...this.cardList].flat();
         },
         money() {
+            let choose = this.show ? this.nowChoose : this.chooseIds;
             let list = [...this.allCards].filter(item => {
-                return [...this.chooseIds].includes(item.id);
+                return [...choose].includes(item.id);
             });
 
             return list.reduce((prev, cur) => {
@@ -93,19 +102,20 @@ export default {
     data() {
         return {
             show: false,
-            list: []
+            nowChoose: []
         };
     },
-    mounted() {
-        setTimeout(() => {
-            console.log(this.detailsList);
-            console.log(this.cardList);
-        }, 2000);
-    },
     methods: {
-        choose(id) {
+        init() {
+            this.nowChoose = [...this.chooseIds];
+            this.show = true;
+        },
+        choose(id, used = false) {
+            if (used) {
+                return;
+            }
             console.log(id);
-            let list = [...this.chooseIds];
+            let list = [...this.nowChoose];
             if (list.includes(id)) {
                 list.splice(list.indexOf(id), 1);
             } else if (list.length < 6) {
@@ -113,56 +123,48 @@ export default {
             } else {
                 this.toast('最多选择六张');
             }
-
-            console.log(list);
-            this.$emit('update:chooseIds', list);
+            this.nowChoose = list;
         },
-        confirm() {
-            this.$emit('update:name', `已选${this.chooseIds.length}包,共${this.money}元,邮费10元`);
+        submit() {
+            this.$emit('update:chooseIds', this.nowChoose);
             this.show = false;
+        },
+        getChart(index) {
+            const list = ['A', 'B', 'C', 'D', 'E', 'F'];
+            return list[index];
         }
     }
 };
 </script>
 
 <style lang="less" scoped>
+/deep/ .van-cell {
+    --cell-horizontal-padding: 0px;
+    --cell-vertical-padding: 22px;
+
+    .van-cell__title {
+        font-size: 16px;
+        font-weight: bold;
+        color: #000000;
+        line-height: 28px;
+
+        span {
+            color: @prim;
+        }
+    }
+}
 .box {
     max-height: 70vh;
     min-height: 50vh;
 
     padding: 0 20px 0;
     .flex-col();
-    .van-btn {
-        display: flex;
-        .van-cat {
-            width: 237px;
-            height: 48px;
-            background: #ff6c00;
-            opacity: 0.7;
-            border-radius: 12px 0px 0px 12px;
-            font-size: 13px;
-            font-weight: 500;
-            color: #ffffff;
-            text-align: center;
-            line-height: 48px;
-        }
-        .van-buy {
-            width: 98px;
-            height: 48px;
-            background: #ff6c00;
-            border-radius: 0px 12px 12px 0px;
-            font-size: 16px;
-            font-weight: 400;
-            color: #ffffff;
-            text-align: center;
-            line-height: 48px;
-        }
-    }
 }
 
 .content {
     flex-grow: 1;
     overflow: auto;
+    padding: 0 0 12px;
 }
 
 .top {
@@ -206,24 +208,22 @@ export default {
         }
     }
 }
+.card + .card {
+    margin-top: 12px;
+}
 
+.card-title {
+    font-size: 14px;
+    color: #939599;
+    line-height: 24px;
+}
+.card-list {
+    margin: 5px;
+}
 .card {
-    width: 335px;
-    height: 100px;
-    background: #f5f7fa;
+    background-color: @bg;
+    padding: 12px 16px;
     border-radius: 8px;
-    margin: 10px 0;
-    .card-title {
-        height: 24px;
-        font-size: 14px;
-        font-weight: 400;
-        color: #939599;
-        line-height: 24px;
-        padding: 12px 0 6px 16px;
-    }
-    .card-list {
-        margin-left: 16px;
-    }
     .card-list {
         .flex();
 
@@ -258,4 +258,31 @@ export default {
         }
     }
 }
+
+.bottom {
+    padding: 6px 0;
+    border-radius: 12px;
+    overflow: hidden;
+    .flex();
+    .text {
+        padding: 0 16px;
+        flex-grow: 1;
+        font-size: 13px;
+        font-family: PingFangSC-Medium, PingFang SC;
+        font-weight: 500;
+        color: #ffffff;
+        line-height: 48px;
+        height: 48px;
+        background-color: lighten(@prim, 10);
+    }
+}
+
+/deep/ .submit {
+    .van-button {
+        height: 48px;
+        border-radius: 0px;
+        min-width: 98px;
+        max-width: 98px;
+    }
+}
 </style>

+ 0 - 3
src/pages/changeText.vue

@@ -40,9 +40,6 @@ export default {
         submit() {
             let pages = getCurrentPages();
             let prevPage = pages[pages.length - 2];
-            prevPage.rootVM.updateInfo({
-                nickname: this.message
-            });
 
             wx.navigateBack({
                 success: res => {

+ 16 - 16
src/pages/details.vue

@@ -63,10 +63,12 @@
             3.拼箱商品支付成功后不支持退款退货,请谨慎、理智购买
         </div>
         <div class="box-footer">
-            <div class="box-cat" @click="$refs.cardCase.show = true">
-                <div>{{ name ? name : '请选择卡包' }}</div>
-                <div>></div>
-            </div>
+            <card-case
+                ref="cardCase"
+                :chooseIds.sync="chooseIds"
+                :detailsList="detailsList"
+                :cardCaseInfo="cardCaseInfo"
+            ></card-case>
             <div class="box-footer-con">
                 <div class="box-footer-left">
                     <div class="contact">
@@ -89,14 +91,6 @@
                 </div>
             </div>
         </div>
-
-        <card-case
-            ref="cardCase"
-            :chooseIds.sync="chooseIds"
-            :name.sync="name"
-            :detailsList="detailsList"
-            :cardCaseInfo="cardCaseInfo"
-        ></card-case>
     </div>
 </template>
 <script>
@@ -165,7 +159,7 @@ export default {
         width: 210px;
         height: 48px;
         background: #ff6c00;
-        border-radius: 12px;
+        // border-radius: 12px;
         font-size: 16px;
         font-weight: 400;
         color: #ffffff;
@@ -347,15 +341,20 @@ export default {
         border-radius: 12px;
     }
     .box-footer {
-        .bottom();
+        right: 0;
+        // height: 82px;
         background: #ffffff;
         position: fixed;
         bottom: 0;
         left: 0;
-        padding: 22px 20px;
+        padding: 0 20px;
+        box-shadow: 0px -4px 8px 0px rgba(0, 0, 0, 0.04);
+        border-radius: 20px 20px 0px 0px;
+        .bottom();
         .box-cat {
             display: flex;
             justify-content: space-between;
+            margin-right: 44px;
             div {
                 height: 28px;
                 font-size: 16px;
@@ -374,7 +373,8 @@ export default {
         }
         .box-footer-con {
             display: flex;
-            margin-top: 22px;
+            // margin-top: 22px;
+            padding: 6px 0;
             .box-footer-left {
                 display: flex;
                 text-align: center;

TEMPAT SAMPAH
src/static/.DS_Store