xuqiang 4 лет назад
Родитель
Сommit
30bf128a3c
1 измененных файлов с 128 добавлено и 38 удалено
  1. 128 38
      src/pages/allselldetails.vue

+ 128 - 38
src/pages/allselldetails.vue

@@ -9,13 +9,19 @@
     <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
                 v-if="
                     status.orderStatus !== 'CREATED' &&
                         status.orderStatus !== 'PAYED' &&
+                        status.orderStatus !== 'REFUND' &&
+                        status.orderStatus !== 'REFUNDED' &&
                         status.orderStatus !== 'CANCELED'
                 "
             >
@@ -41,18 +47,24 @@
                 </div>
             </div>
             <div class="box-border"></div>
-            <div class="message">
+            <div class="message" v-if="status.orderStatus !== 'REFUND' && status.orderStatus !== 'REFUNDED'">
                 <p>买家留言:</p>
                 <span>{{ status.remark }}</span>
             </div>
         </div>
         <div class="box-bg"></div>
-        <div class="box-tit">
+        <div class="box-tit" v-if="status.orderStatus !== 'REFUND' && status.orderStatus !== 'REFUNDED'">
             <div>
                 <img :src="store.logo" alt="" />
                 <p>{{ store.storeName }}</p>
             </div>
-            <div class="box-tit-seller" @click="seller">共{{ status.length }}件商品</div>
+            <!-- <div class="box-tit-seller">共{{ status.cardBoxList.length }}件商品</div> -->
+        </div>
+        <div class="box-tit2" v-if="status.orderStatus == 'REFUND' || status.orderStatus == 'REFUNDED'">
+            <div>
+                <p>退款商品</p>
+            </div>
+            <div class="box-tit-seller">共{{ status.cardBoxList.length }}件商品</div>
         </div>
         <div v-for="(item, index) in Boxes" :key="index.id">
             <div class="box-con">
@@ -83,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 || 0 }}</p>
             </div>
         </div>
         <div class="box-buttom">
@@ -92,7 +104,18 @@
                 <p class="box-buttom-p3">¥{{ total }}</p>
             </div>
         </div>
-        <div v-if="status.orderStatus !== 'CREATED'" class="box-buttom">
+        <div class="box-buttom" v-if="status.orderStatus == 'REFUND' || status.orderStatus == 'REFUNDED'">
+            <div class="box-buttom-con">
+                <p>退款金额</p>
+                <p class="box-buttom-p3">¥{{ total }}</p>
+            </div>
+        </div>
+        <div
+            v-if="
+                status.orderStatus !== 'CREATED' && status.orderStatus !== 'REFUND' && status.orderStatus !== 'REFUNDED'
+            "
+            class="box-buttom"
+        >
             <div class="box-buttom-con">
                 <p>支付方式</p>
                 <p class="box-buttom-p">微信支付</p>
@@ -100,7 +123,7 @@
         </div>
         <div class="box-border-but"></div>
         <!-- 下单时间 -->
-        <div class="box-footer">
+        <div class="box-footer" v-if="status.orderStatus !== 'CANCELED' && status.orderStatus !== 'CREATED'">
             <div class="box-footer-con">
                 <p>订单编号</p>
                 <div class="box-footer-cr">
@@ -121,7 +144,7 @@
                 <p class="box-footer-p">{{ status.paidTime }}</p>
             </div>
         </div>
-        <div class="box-footer">
+        <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>
@@ -147,6 +170,15 @@
                     <img src="/native/imgs/btn_01@3x.png" alt="" />
                     <span>联系买家</span>
                 </div>
+                <!-- 售后中 -->
+                <div v-if="status.orderStatus === 'REFUND'" class="box-btn-left2" @click="Buyers">
+                    <img src="/native/imgs/btn_04@3x.png" alt="" />
+                    <span>联系买家</span>
+                </div>
+                <div v-if="status.orderStatus === 'REFUND'" class="box-btn-right">
+                    <img src="/native/imgs/btn_01@3x.png" alt="" />
+                    <span>同意退款</span>
+                </div>
                 <!-- 待发货 -->
                 <div v-if="status.orderStatus === 'PAYED'" class="box-btn-left2" @click="cancel">
                     <img src="/native/imgs/btn_04@3x.png" alt="" />
@@ -218,13 +250,70 @@ export default {
             logisTics: [],
             stepsList: [],
             stepsShow: [],
-            store: []
+            store: {},
+            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
@@ -232,20 +321,30 @@ export default {
                 .then(res => {
                     this.hideLoading();
                     this.status = res;
+                    this.user = res.user;
                     this.addressList = res.address;
                     this.total = res.total;
                     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 = '交易关闭';
                         this.status.name = '很遗憾,订单已取消';
                     }
+                    if (this.status.orderStatus === 'REFUND') {
+                        this.status.label = '买家申请退款';
+                        this.status.name = '请尽快处理';
+                    }
+                    if (this.status.orderStatus === 'REFUNDED') {
+                        this.status.label = '退款成功';
+                        this.status.name = '退款成功,72小时内退还';
+                    }
                     if (this.status.orderStatus === 'PAYED') {
                         this.status.label = '待发货';
                         this.status.name = '订单支付成功,处理发货';
@@ -286,17 +385,8 @@ export default {
             //     }
             // }, 1000);
         },
-        deliver() {
-            wx.showToast({
-                title: '敬请开放',
-                icon: 'none'
-            });
-        },
         Buyers() {
-            wx.showToast({
-                title: '敬请开放',
-                icon: 'none'
-            });
+            this.navigateTo('/pages/chat?toUserId=' + this.store.userId + '&toName=' + this.user.nickname);
         },
         logistics() {
             this.showLoading();
@@ -325,24 +415,6 @@ export default {
                     });
                 });
         },
-        sales() {
-            wx.showToast({
-                title: '敬请开放',
-                icon: 'none'
-            });
-        },
-        seller() {
-            wx.showToast({
-                title: '敬请开放',
-                icon: 'none'
-            });
-        },
-        Apply() {
-            wx.showToast({
-                title: '敬请开放',
-                icon: 'none'
-            });
-        },
         cancel() {
             wx.showModal({
                 title: '提示',
@@ -553,6 +625,24 @@ export default {
             line-height: 22px;
         }
     }
+    .box-tit2 {
+        .flex();
+        justify-content: space-between;
+        margin: 20px 20px 0 20px;
+        p {
+            height: 22px;
+            font-size: 14px;
+            font-weight: bold;
+            color: #000000;
+            line-height: 22px;
+        }
+        .box-tit-seller {
+            height: 22px;
+            font-size: 14px;
+            font-weight: 400;
+            line-height: 22px;
+        }
+    }
     .box-con {
         height: 90px;
         background: #ffffff;