xuqiang 4 năm trước cách đây
mục cha
commit
0bc345baa3

+ 1 - 1
.env.development

@@ -1 +1 @@
-VUE_APP_BASE_URL=http://192.168.50.212:8080
+VUE_APP_BASE_URL=http://localhost:8080

+ 67 - 6
src/pages/allselldetails.vue

@@ -9,7 +9,11 @@
     <div class="container">
         <div class="box-top">
             <p>{{ status.label }}</p>
-            <h3>{{ status.name }}</h3>
+            <h3 v-if="status.orderStatus !== 'CREATED'">{{ status.name }}</h3>
+            <h3 v-if="status.orderStatus == 'CREATED'">
+                未支付将在,<span v-if="minters < 10">0</span>{{ minters }}分<span v-if="seconds < 10">0</span
+                >{{ seconds }} 后自动取消订单
+            </h3>
         </div>
         <div class="box-adderss">
             <div
@@ -91,7 +95,7 @@
         <div class="box-buttom">
             <div class="box-buttom-con">
                 <p>邮费</p>
-                <p class="box-buttom-p">¥10</p>
+                <p class="box-buttom-p">¥{{ postage }}</p>
             </div>
         </div>
         <div class="box-buttom">
@@ -119,7 +123,7 @@
         </div>
         <div class="box-border-but"></div>
         <!-- 下单时间 -->
-        <div class="box-footer" v-if="status.orderStatus !== 'CANCELED'">
+        <div class="box-footer" v-if="status.orderStatus !== 'CANCELED' && status.orderStatus !== 'CREATED'">
             <div class="box-footer-con">
                 <p>订单编号</p>
                 <div class="box-footer-cr">
@@ -140,7 +144,7 @@
                 <p class="box-footer-p">{{ status.paidTime }}</p>
             </div>
         </div>
-        <div class="box-footer" v-if="status.orderStatus !== 'CANCELED'">
+        <div class="box-footer" v-if="status.orderStatus !== 'CANCELED' && status.orderStatus !== 'CREATED'">
             <div class="box-footer-con">
                 <p>成交时间</p>
                 <p class="box-footer-p">{{ status.paidTime }}</p>
@@ -247,13 +251,69 @@ export default {
             stepsList: [],
             stepsShow: [],
             store: {},
-            user: {}
+            postage: {},
+            user: {},
+            minters: 0,
+            seconds: 0,
+            allTime: 5 * 60 - 1,
+            closeTime: ''
         };
     },
     methods: {
         logisticShow() {
             this.show = false;
         },
+        initTime(dingdanId, initTime) {
+            let oldTime = new Date(initTime).valueOf();
+            let newTime = new Date().valueOf();
+            let matchedTime = undefined;
+            let matchedTime1 = undefined;
+            if (oldTime) {
+                matchedTime = newTime - oldTime;
+                matchedTime1 = this.allTime - parseInt(matchedTime / 1000);
+                if (matchedTime1 > 0) {
+                    this.timeout(matchedTime1);
+                } else {
+                    // this.getFn();
+                }
+            } else {
+                if (dingdanId) {
+                    this.timeout(this.allTime);
+                }
+            }
+        },
+        timeout(time) {
+            let _this = this;
+            _this.minters = parseInt(time / 60) > 0 ? parseInt(time / 60) : 0;
+            _this.seconds = parseInt(time - _this.minters * 60);
+            try {
+                if (_this.minters > 0) {
+                    _this.closeTime = setInterval(() => {
+                        _this.seconds--;
+                        if (_this.seconds <= 0) {
+                            _this.minters--;
+                            if (_this.minters == -1) {
+                                _this.minters = 0;
+                                _this.seconds = 0;
+                                clearInterval(_this.closeTime);
+                            } else {
+                                _this.seconds = 60;
+                            }
+                        }
+                    }, 1000);
+                } else {
+                    _this.closeTime = setInterval(() => {
+                        _this.seconds--;
+                        if (_this.seconds <= 0) {
+                            _this.seconds = 0;
+                            clearInterval(_this.closeTime);
+                        }
+                    }, 1000);
+                }
+            } catch (err) {
+                console.log(err);
+            }
+        },
         getFn() {
             this.showLoading();
             this.$http
@@ -267,10 +327,11 @@ export default {
                     this.store = res.store;
                     this.Boxes = res.cardBoxList;
                     this.orderInfoId = res.id;
+                    this.postage = res.cardCase.postage;
                     this.cardCaseInfo = res.cardCase.collection;
                     if (this.status.orderStatus === 'CREATED') {
                         this.status.label = '买家待支付';
-                        this.status.name = '未支付将自动取消订单';
+                        this.initTime(this.orderInfoId, this.status.createdAt);
                     }
                     if (this.status.orderStatus === 'CANCELED') {
                         this.status.label = '交易关闭';

+ 5 - 2
src/pages/confirmorder.vue

@@ -63,7 +63,7 @@
         <div class="box-buttom">
             <div class="box-buttom-con">
                 <p>邮费</p>
-                <p class="box-buttom-p">¥10</p>
+                <p class="box-buttom-p">¥{{ postage }}</p>
             </div>
         </div>
         <div class="box-buttom">
@@ -105,6 +105,7 @@ export default {
             Boxes: [],
             store: {},
             cardCaseInfo: {},
+            postage: {},
             total: '',
             message: ''
         };
@@ -139,7 +140,6 @@ export default {
                     userAddressId: this.userAddressId
                 })
                 .then(res => {
-                    console.log(res);
                     this.hideLoading();
                     this.id = res.id;
                     this.navigateTo('/pages/orderdetails?id=' + this.id);
@@ -163,9 +163,12 @@ export default {
                 })
                 .then(res => {
                     this.hideLoading();
+                    console.log(res);
                     this.total = res.total;
                     this.store = res.store;
                     this.Boxes = res.selectedBoxes;
+                    this.postage = res.selectedCase.postage;
+                    console.log(this.postage);
                     this.cardCaseInfo = res.selectedCase.collection;
                 })
                 .catch(e => {

+ 2 - 1
src/pages/orderdetails.vue

@@ -82,7 +82,7 @@
         <div class="box-buttom">
             <div class="box-buttom-con">
                 <p>邮费</p>
-                <p class="box-buttom-p">¥10</p>
+                <p class="box-buttom-p">¥{{ postage }}</p>
             </div>
         </div>
         <div class="box-buttom">
@@ -311,6 +311,7 @@ export default {
                     this.total = res.total;
                     this.Boxes = res.cardBoxList;
                     this.orderInfoId = res.id;
+                    this.postage = res.cardCase.postage;
                     this.cardCaseInfo = res.cardCase.collection;
                     if (this.status.orderStatus === 'CREATED') {
                         this.status.label = '待支付';

+ 7 - 3
src/pages/store/productEdit.vue

@@ -441,12 +441,16 @@ export default {
                 });
                 return;
             }
+            if (this.form.groupDTOS.length == 0) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '请添加卡包'
+                });
+                return;
+            }
             let cardCaseInputDTO = { ...this.form };
             let images = this.imageUrls.join(',');
             cardCaseInputDTO.images = images;
-            // console.log(this.form.groupDTOS);
-            // console.log('=========');
-            // console.log(cardCaseInputDTO);
             this.showLoading();
             this.$http
                 .post('/cardCase/save', cardCaseInputDTO, {