xuqiang-97 4 ani în urmă
părinte
comite
ce8c2e576a
7 a modificat fișierele cu 281 adăugiri și 100 ștergeri
  1. 3 0
      package.json
  2. 12 0
      project.config.json
  3. 112 58
      src/pages/Home.vue
  4. 16 12
      src/pages/details.vue
  5. 1 1
      src/pages/order.vue
  6. 112 27
      src/pages/receiving.vue
  7. 25 2
      yarn.lock

+ 3 - 0
package.json

@@ -39,9 +39,12 @@
     "@megalo/api": "latest",
     "@megalo/vhtml-plugin": "latest",
     "@vant/weapp": "^1.6.8",
+    "axios": "^0.21.1",
+    "babel-loader": "^8.2.2",
     "dayjs": "^1.10.4",
     "megalo": "latest",
     "octoparse": "^0.4.2",
+    "qs": "^6.10.1",
     "style-resources-loader": "^1.4.1",
     "vuex": "^3.1.0"
   }

+ 12 - 0
project.config.json

@@ -125,6 +125,18 @@
                     "name": "常见问题",
                     "pathName": "/pages/questions",
                     "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "新增地址",
+                    "pathName": "/pages/receiving",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "首页",
+                    "pathName": "/pages/Home",
+                    "scene": null
                 }
             ]
         }

+ 112 - 58
src/pages/Home.vue

@@ -35,79 +35,88 @@
                 </div>
             </div>
         </div>
+        <!-- 进行中 -->
         <div class="box-con" v-if="conduct">
-            <div class="box-con-Cards">
-                <img src="../static/imgs/2.jpeg" alt="" />
-                <div class="box-con-right">
-                    <p class="box-con-tit">DP20 简中 传说之决斗者编3</p>
-                    <div class="box-con-today">
-                        <p>距离结束</p>
-                        <p class="box-con-p2">1天 20:35:06</p>
-                    </div>
-                    <div class="box-con-today">
-                        <p>已拼箱</p>
-                        <p class="box-con-p2">10/24</p>
-                    </div>
-                    <div class="box-con-money">
-                        <div class="box-con-num">
-                            <img src="../static/imgs/icon_jiage.png" alt="" />
-                            <p>320</p>
+            <div v-for="(item, index) in conductList" :key="index + 2">
+                <div class="box-con-Cards">
+                    <img :src="item.image" alt="" />
+                    <div class="box-con-right">
+                        <p class="box-con-tit">{{ item.caseName }}</p>
+                        <div class="box-con-today">
+                            <p>距离结束</p>
+                            <p class="box-con-p2">{{ item.endTime }}</p>
+                        </div>
+                        <div class="box-con-today">
+                            <p>已拼箱</p>
+                            <p class="box-con-p2">{{ item.preorder }}</p>
+                        </div>
+                        <div class="box-con-money">
+                            <div class="box-con-num">
+                                <img src="../static/imgs/icon_jiage.png" alt="" />
+                                <p>{{ item.price }}</p>
+                            </div>
+                            <van-button type="warning" @click="Details(item)">立即拼箱</van-button>
                         </div>
-                        <van-button type="warning" @click="Details">立即拼箱</van-button>
                     </div>
                 </div>
+                <div class="box-border"></div>
             </div>
-            <div class="box-border"></div>
         </div>
+        <!-- 已完成 -->
         <div class="box-con" v-if="complete">
-            <div class="box-con-Cards">
-                <img src="../native/imgs/marker.png" alt="" />
-                <div class="box-con-right">
-                    <p class="box-con-tit">DP20 简中 传说之决斗者编3</p>
-                    <div class="box-con-today">
-                        <p>距离结束</p>
-                        <p class="box-con-p2">1天 20:35:06</p>
-                    </div>
-                    <div class="box-con-today">
-                        <p>已拼箱</p>
-                        <p class="box-con-p2">10/24</p>
-                    </div>
-                    <div class="box-con-money">
-                        <div class="box-con-num">
-                            <img src="../static/imgs/icon_jiage.png" alt="" />
-                            <p>320</p>
+            <div v-for="(item, index) in completeList" :key="index + 4">
+                <div class="box-con-Cards">
+                    <img :src="item.image" alt="" />
+                    <div class="box-con-right">
+                        <p class="box-con-tit">{{ item.caseName }}</p>
+                        <div class="box-con-today">
+                            <p>距离结束</p>
+                            <p class="box-con-p2">{{ item.endTime }}</p>
+                        </div>
+                        <div class="box-con-today">
+                            <p>已拼箱</p>
+                            <p class="box-con-p2">{{ item.preorder }}</p>
+                        </div>
+                        <div class="box-con-money">
+                            <div class="box-con-num">
+                                <img src="../static/imgs/icon_jiage.png" alt="" />
+                                <p>{{ item.price }}</p>
+                            </div>
+                            <van-button type="warning" @click="Details(item)">立即拼箱</van-button>
                         </div>
-                        <van-button type="warning" @click="Details">立即拼箱</van-button>
                     </div>
                 </div>
+                <div class="box-border"></div>
             </div>
-            <div class="box-border"></div>
         </div>
+        <!-- 已过期 -->
         <div class="box-con" v-if="overdue">
-            <div class="box-con-Cards">
-                <img src="../static/imgs/megalo_logo.png" alt="" />
-                <div class="box-con-right">
-                    <p class="box-con-tit">DP20 简中 传说之决斗者编3</p>
-                    <div class="box-con-today">
-                        <p>距离结束</p>
-                        <p class="box-con-p2">1天 20:35:06</p>
-                    </div>
-                    <div class="box-con-today">
-                        <p>已拼箱</p>
-                        <p class="box-con-p2">10/24</p>
-                    </div>
-                    <div class="box-con-money">
-                        <div class="box-con-num">
-                            <img src="../static/imgs/icon_jiage.png" alt="" />
-                            <p>320</p>
+            <div v-for="(item, index) in overdueList" :key="index + 6">
+                <div class="box-con-Cards">
+                    <img :src="item.image" alt="" />
+                    <div class="box-con-right">
+                        <p class="box-con-tit">{{ item.caseName }}</p>
+                        <div class="box-con-today">
+                            <p>距离结束</p>
+                            <p class="box-con-p2">{{ item.endTime }}</p>
+                        </div>
+                        <div class="box-con-today">
+                            <p>已拼箱</p>
+                            <p class="box-con-p2">{{ item.preorder }}</p>
+                        </div>
+                        <div class="box-con-money">
+                            <div class="box-con-num">
+                                <img src="../static/imgs/icon_jiage.png" alt="" />
+                                <p>{{ item.price }}</p>
+                            </div>
+                            <van-button type="warning" @click="Details(item)">立即拼箱</van-button>
                         </div>
-                        <van-button type="warning" @click="Details">立即拼箱</van-button>
                     </div>
                 </div>
+                <div class="box-border"></div>
             </div>
-            <div class="box-border"></div>
         </div>
-        <van-popup :show="show" position="top" custom-style="height: 20%;" bind:close="onClose">内容</van-popup>
+        <van-popup :show="show" position="buttom" custom-style="height: 20%;" bind:close="onClose">内容</van-popup>
     </div>
 </template>
 
@@ -119,15 +128,55 @@ export default {
             conduct: true,
             complete: false,
             overdue: false,
-            show: false
+            show: false,
+            PROGRESS: 'PROGRESS',
+            FINISH: 'FINISH',
+            SOLDOUT: 'SOLDOUT',
+            conductList: [],
+            completeList: [],
+            overdueList: []
         };
     },
     methods: {
-        Details() {
+        Details(item) {
+            console.log(item.cardCaseId);
             wx.redirectTo({
-                url: './details'
+                url: './details?id=' + item.cardCaseId
             });
         },
+        // 进行中
+        conDucts() {
+            this.$http
+                .get('/cardCase/showCasesMA', {
+                    caseStatus: this.PROGRESS
+                })
+                .then(res => {
+                    console.log(res);
+                    this.conductList = res;
+                });
+        },
+        // 已完成
+        compLetes() {
+            this.$http
+                .get('/cardCase/showCasesMA', {
+                    caseStatus: this.SOLDOUT
+                })
+                .then(res => {
+                    console.log(res);
+                    this.completeList = res;
+                });
+        },
+        // 已过期
+        overDues() {
+            this.$http
+                .get('/cardCase/showCasesMA', {
+                    caseStatus: this.FINISH
+                })
+                .then(res => {
+                    console.log(res);
+                    this.overdueList = res;
+                });
+        },
         conducts() {
             this.conduct = true;
             this.complete = false;
@@ -143,6 +192,11 @@ export default {
             this.complete = false;
             this.overdue = true;
         }
+    },
+    created() {
+        this.conDucts();
+        this.compLetes();
+        this.overDues();
     }
 };
 </script>

+ 16 - 12
src/pages/details.vue

@@ -2,17 +2,10 @@
 {
     "navigationBarTitleText": "拼箱详情",
     "navigationBarBackgroundColor": "#ffffff",
-    "navigationBarTextStyle": "black",
-    "backgroundTextStyle":"light"
 }
 </config>
 <template>
     <div class="container">
-        <!-- <swiper class="cover">
-            <swiper-item v-for="item in packageInfo.img" :key="item">
-                <img class="cover-img" mode="aspectFill" :src="item" />
-            </swiper-item>
-        </swiper> -->
         <swiper style="height:335px;" :autoplay="true" :indicator-dots="true">
             <swiper-item>
                 <img src="../static/imgs/1.jpeg" alt="" />
@@ -24,23 +17,23 @@
                 <img src="../static/imgs/3.jpeg" alt="" />
             </swiper-item>
         </swiper>
-        <div class="box-tit">1105皇权破晓 卡包拼箱 全80种</div>
+        <div class="box-tit">{{ detailsList.cardCaseInfo.caseName }}</div>
         <div class="box-live">
             <img src="../native/imgs/icon_kapai_zhibo@3x.png" alt="" />
             <p>直播未开始</p>
         </div>
         <div class="box-money">
             <img src="../static/imgs/icon_jiage@3x.png" alt="" />
-            <p>320</p>
+            <p>{{ detailsList.cardCaseInfo.price }}</p>
         </div>
         <div class="box-con">
             <div class="box-con-left">
                 <p>距拼箱结束</p>
-                <span>1天 20:35:06</span>
+                <span>{{ detailsList.cardCaseInfo.endTime }}</span>
             </div>
             <div class="box-con-right">
                 <p>拼箱进度</p>
-                <span>10/24</span>
+                <span>{{ detailsList.cardCaseInfo.preorder }}</span>
             </div>
         </div>
         <div class="box-con2">
@@ -116,11 +109,13 @@ export default {
         return {
             show: false,
             selman: '',
-            list: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
+            list: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],
+            detailsList: []
         };
     },
     methods: {
         address() {
+            console.log(666);
             wx.redirectTo({
                 url: './address'
             });
@@ -138,7 +133,16 @@ export default {
             wx.redirectTo({
                 url: './follow'
             });
+        },
+        details() {
+            this.$http.get('/cardCase/showInfoMA?caseId=' + this.$mp.query.id).then(res => {
+                console.log(res);
+                this.detailsList = res;
+            });
         }
+    },
+    created() {
+        this.details();
     }
 };
 </script>

+ 1 - 1
src/pages/order.vue

@@ -83,7 +83,7 @@
         <div class="box-buttom">
             <div class="box-buttom-con">
                 <p>订单留言</p>
-                <form class="box-buttom-p2" action="">选填,备注对本次交易的说明</form>
+                <div class="box-buttom-p2">选填,备注对本次交易的说明</div>
             </div>
         </div>
         <div class="box-border-but"></div>

+ 112 - 27
src/pages/receiving.vue

@@ -9,60 +9,145 @@
 <template>
     <div class="container">
         <van-cell-group>
-            <van-field :value="value" custom-style label="联系人" placeholder="请填写您的姓名" />
-            <van-field :phone="phone" label="手机号" placeholder="请填写您的手机号码" />
-            <van-field :city="city" label="地区" placeholder="请填写您的城市" />
-            <van-field :detailed="detailed" label="详细地址" placeholder="请填写您的详细地址" />
+            <van-field
+                :value="form.name"
+                @input="form.name = $event.detail"
+                placeholder="请填写您的姓名"
+                :border="false"
+                label="联系人"
+            />
+            <van-field
+                type="number"
+                :value="form.phone"
+                @input="form.phone = $event.detail"
+                placeholder="请填写您的手机号码"
+                :border="false"
+                label="手机号"
+            />
+            <van-field
+                @click="$refs.area.init()"
+                :value="showCity"
+                readonly
+                placeholder="请选择省市区"
+                :border="false"
+                label="地区"
+            />
+            <van-field
+                :value="form.address"
+                @input="form.address = $event.detail"
+                placeholder="请填写您的详细地址"
+                :border="false"
+                label="详细地址"
+                type="textarea"
+                :autosize="{ maxHeight: 100, minHeight: 56 }"
+            />
         </van-cell-group>
         <div class="box-but">
             <div class="box-img">
                 <img src="/native/tabbar/icon_weixuanzhong@2x.png" alt="" />
                 <p>设为默认地址</p>
             </div>
+            <!-- <div class="default">
+                <div class="label">设为默认地址</div>
+                <van-switch active-color="#FF7F1F" :checked="form.isDefault" @change="form.isDefault = $event.detail" />
+            </div> -->
             <div class="box-but-con">
                 <div class="container-but" @click="address">确认</div>
                 <div class="container-cancel">获取微信地址</div>
             </div>
         </div>
+        <area-select
+            ref="area"
+            :province.sync="form.province"
+            :city.sync="form.city"
+            :region.sync="form.district"
+        ></area-select>
     </div>
 </template>
 <script>
+import areaSelect from '../components/areaSelect.vue';
 export default {
+    name: 'detail',
+    components: { areaSelect },
     data() {
         return {
-            value: '',
-            phone: '',
-            city: '',
-            detailed: ''
+            form: {
+                name: '',
+                phone: '',
+                city: '',
+                address: '',
+                province: '',
+                district: ''
+            }
         };
     },
+    computed: {
+        showCity() {
+            return this.form.province + this.form.city + this.form.district;
+        }
+    },
     methods: {
         address() {
-            wx.redirectTo({
-                url: './add'
-            });
+            if (!this.form.name) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '收货人不能为空'
+                });
+                return;
+            }
+            if (!this.form.phone) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '手机号码不能为空'
+                });
+                return;
+            }
+            if (!this.form.city) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '地区不能为空'
+                });
+                return;
+            }
+            if (!this.form.address) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '详细地址不能为空'
+                });
+                return;
+            }
+            let form = { ...this.form };
+            console.log(form);
+            if (!form.id) {
+                form.userId = this.$store.state.userInfo.id;
+            }
+            this.$http
+                .post('/address/save', form, { body: 'json' })
+                .then(res => {
+                    console.log(res);
+                    // wx.hideLoading();
+                    wx.showToast({
+                        title: '保存成功'
+                    });
+                    setTimeout(() => {
+                        wx.redirectTo({
+                            url: './add'
+                        });
+                    }, 1500);
+                })
+                .catch(e => {
+                    // wx.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
         }
     }
 };
 </script>
 <style lang="less" scoped>
 .container {
-    .van-field__label {
-        height: 70px;
-        line-height: 70px;
-        font-size: 14px;
-        font-weight: 500;
-        color: #000000;
-        // line-height: 24px;
-    }
-    // .van-cell__value {
-    //     height: 70px;
-    //     line-height: 70px;
-    //     font-size: 14px;
-    //     font-family: PingFangSC-Medium, PingFang SC;
-    //     font-weight: 500;
-    //     color: #000000;
-    // }
     .box-but {
         background: #f5f7fa;
         width: 100%;

+ 25 - 2
yarn.lock

@@ -1718,6 +1718,13 @@ axios@^0.19.0:
   dependencies:
     follow-redirects "1.5.10"
 
+axios@^0.21.1:
+  version "0.21.1"
+  resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
+  integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
+  dependencies:
+    follow-redirects "^1.10.0"
+
 babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
   version "6.26.0"
   resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
@@ -1786,7 +1793,7 @@ babel-helpers@^6.24.1:
     babel-runtime "^6.22.0"
     babel-template "^6.24.1"
 
-babel-loader@^8.0.5:
+babel-loader@^8.0.5, babel-loader@^8.2.2:
   version "8.2.2"
   resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.2.tgz#9363ce84c10c9a40e6c753748e1441b60c8a0b81"
   integrity sha512-JvTd0/D889PQBtUXJ2PXaKU/pjZDMtHA9V2ecm+eNRmmBCMR09a+fmpGTNwnJtFmFl5Ei7Vy47LjBb+L0wQ99g==
@@ -4313,7 +4320,7 @@ follow-redirects@1.5.10:
   dependencies:
     debug "=3.1.0"
 
-follow-redirects@^1.0.0:
+follow-redirects@^1.0.0, follow-redirects@^1.10.0:
   version "1.14.0"
   resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.0.tgz#f5d260f95c5f8c105894491feee5dc8993b402fe"
   integrity sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==
@@ -7450,6 +7457,13 @@ qs@6.7.0:
   resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
   integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==
 
+qs@^6.10.1:
+  version "6.10.1"
+  resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.1.tgz#4931482fa8d647a5aab799c5271d2133b981fb6a"
+  integrity sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==
+  dependencies:
+    side-channel "^1.0.4"
+
 qs@~6.5.2:
   version "6.5.2"
   resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
@@ -8138,6 +8152,15 @@ shell-quote@^1.6.1:
   resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
   integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==
 
+side-channel@^1.0.4:
+  version "1.0.4"
+  resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
+  integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==
+  dependencies:
+    call-bind "^1.0.0"
+    get-intrinsic "^1.0.2"
+    object-inspect "^1.9.0"
+
 signal-exit@^3.0.0, signal-exit@^3.0.2:
   version "3.0.3"
   resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"