MS-IOHQJGHXZHQD\Administrator 4 місяців тому
батько
коміт
03eefe4e62

+ 5 - 18
src/points/order/orderDetails.vue

@@ -149,27 +149,14 @@ export default {
 
       //订单状态(0:待付款 1:待发货 2:待收货 3:已收货 4:售后中  11:取消订单)
       if (this.receiptStatus == "received" && this.afterSalesType == "exchange") {
-        if (this.orderInfo.orderStatus == 3) {
-          uni.navigateTo({
-            url: `/points/productDetails/applyExchange?orderNo=${this.orderInfo.orderNo}&orderId=${this.orderInfo.id}&orderStatus=${this.orderInfo.orderStatus}`
-          });
-        }
-        return
-      }
-      if (this.orderInfo.orderStatus == 1 || this.orderInfo.orderStatus == 2) {
         uni.navigateTo({
-          url: `/points/productDetails/applyRefund?orderNo=${this.orderInfo.orderNo}&orderId=${this.orderInfo.id}&orderStatus=${this.orderInfo.orderStatus}`
+          url: `/points/productDetails/applyExchange?afterSalesType=${this.afterSalesType}&receiptStatus=${this.receiptStatus}&orderNo=${this.orderInfo.orderNo}&orderId=${this.orderInfo.id}&orderStatus=${this.orderInfo.orderStatus}`
         });
+        return
       }
-
-      // if (this.receiptStatus == 'notReceived') {
-
-      // } else if (this.receiptStatus == "received" && this.afterSalesType == "refund") {
-
-      // }
-
-
-      
+      uni.navigateTo({
+        url: `/points/productDetails/applyRefund?afterSalesType=${this.afterSalesType}&receiptStatus=${this.receiptStatus}&orderNo=${this.orderInfo.orderNo}&orderId=${this.orderInfo.id}&orderStatus=${this.orderInfo.orderStatus}`
+      });
     },
     //获取售后时间
     getafterTime() {

+ 62 - 31
src/points/productDetails/applyExchange.vue

@@ -11,21 +11,26 @@
 
             <view class="content">
                 <view class="productPrice">
-                    <view style="display:flex;">
+                    <view style="display:flex;" v-if="orderInfo">
                         <view>
-                            <image style="width: 120rpx;height: 120rpx;" src="@/static/points/closeIcon.png" mode="">
+                            <image style="width: 120rpx;height: 120rpx;"
+                                :src="$globalData.publicUrl + productInfo.skuImage" mode="">
                             </image>
                         </view>
                         <view
                             style="margin-left: 24rpx;display: flex;flex-direction: column;justify-content: space-between;">
-                            <view class="name">实付价 ¥10元+1000积分 </view>
-                            <view class="spec">已选:大号,白色 </view>
+                            <view class="name">实付价{{ productInfo.paymentType == 1 ? orderInfo.pointsUsed + '积分' :
+                                productInfo.paymentType == 2 ? '¥' + orderInfo.payAmount + '元' :
+                                    productInfo.paymentType == 3 ? '¥' + orderInfo.payAmount + '元' + '+' +
+                                        orderInfo.pointsUsed + '积分' : null }} </view>
+                            <view class="spec">已选:{{ skuSpecFun(productInfo.skuSpec) }} </view>
+
                         </view>
                     </view>
                 </view>
                 <view class="mustInput">
                     <u--form>
-                        <u-form-item required label="申请原因" label-width="58" prop="selectReasonValue">
+                        <u-form-item required label="申请原因" label-width="120rpx" prop="selectReasonValue">
                             <view class="tip">
                                 <view :style="{ color: selectReasonValue ? '#333' : '#999' }">{{
                                     selectReasonValue !== null ? selectReasonValue : '请选择申请原因' }}</view>
@@ -35,9 +40,10 @@
                             </view>
                         </u-form-item>
 
-                        <u-form-item required label="问题描述/凭证" label-width="86" prop="selectReasonValue">
+                        <u-form-item required label="问题描述/凭证" label-width="181rpx" prop="selectReasonValue">
                             <view class="tip">
-                                <view :style="{ color: questionOrDiscribeValue ? '#333' : '#999' }" class="questionOrDiscribeValue">
+                                <view :style="{ color: questionOrDiscribeValue ? '#333' : '#999' }"
+                                    class="questionOrDiscribeValue">
                                     {{ questionOrDiscribeValue ? questionOrDiscribeValue : '请您务必上传描述和凭证' }}</view>
                                 <image style="width: 28rpx;height: 28rpx;margin-left: 8rpx;"
                                     @click="selectApplyReasonFun('2')" src="@/static/points/Keyboard_arrow_rifht.png"
@@ -77,32 +83,39 @@
 </template>
 
 <script>
-import { afterSaleOrder} from '@/api/pointOrder'
-
+import { afterSaleOrder, getPointOrderInfo } from '@/api/pointOrder'
 export default {
     components: {},
     data() {
         return {
-            orderNo:null,
-            orderId:null,
-            orderStatus:null,
+            orderNo: null,
+            orderId: null,
+            orderStatus: null,
+            afterSalesType: null,
+            receiptStatus: null,
             fileList: [],
             questionOrDiscribeValue: null,
             selectReasonValue: null,
             isTop: 0,
             redemptionRulesShowPopup: false,
             selectProductShowPopup: false,
+            orderInfo: null,
+            productInfo: null,
 
 
         }
     },
     onLoad(data) {
         if (data) {
-            console.log(data,'66666666')
+            console.log(data, '66666666')
             //decodeURIComponent (data) 
-            if(data.orderId)this.orderId=data.orderId
-            if(data.orderNo)this.orderNo=data.orderNo
-            if(data.orderStatus)this.orderStatus=data.orderStatus 
+            if (data.orderId) this.orderId = data.orderId
+            if (data.orderNo) this.orderNo = data.orderNo
+            this.getOrderInfo();
+            if (data.orderStatus) this.orderStatus = data.orderStatus
+            if (data.receiptStatus) this.receiptStatus = data.receiptStatus
+            if (data.afterSalesType) this.afterSalesType = data.afterSalesType
+
             if (data.questionOrDiscribeValue && data.questionOrDiscribeValue !== "null" && data.questionOrDiscribeValue !== "") {
                 this.questionOrDiscribeValue = data.questionOrDiscribeValue
             }
@@ -114,9 +127,6 @@ export default {
             if (data.selectReasonValue && data.selectReasonValue !== "null") {
                 this.selectReasonValue = data.selectReasonValue
             }
-
-
-
         }
     },
     onShow() {
@@ -128,21 +138,41 @@ export default {
     },
 
     methods: {
+        //规则组装
+        skuSpecFun(skuSpec) {
+            if (!skuSpec) return ''
+            return JSON.parse(skuSpec).map(e => e.specValue).join(',')
+
+        },
+        async getOrderInfo() {
+            const res = await getPointOrderInfo({
+                orderNo: this.orderNo,
+                openId: uni.getStorageSync('wx_copenid')
+            })
+            this.orderInfo = res.data.data.orderInfo
+            this.productInfo = res.data.data.productInfo
+        },
         //提交
         async goSubmit() {
             if (!this.selectReasonValue || !this.questionOrDiscribeValue || this.fileList.length === 0) {
-                uni.$u.toast('请选择申请原因\n或\n请上传描述/凭证')  
+                uni.$u.toast('请选择申请原因\n或\n请上传描述/凭证')
                 return
             }
-            
             afterSaleOrder({ //换货
-                orderId:this.orderId,
-                orderNo:this.orderNo,
-                applyReason:this.selectReasonValue,
-                afterSaleType:2,//1:退货 2:换  3:未收到货
-                applyDesc:this.questionOrDiscribeValue,
-                applyImages:this.fileList.map(m=>m.url).join(','),
-            }).then(res=>{
+                orderId: this.orderId,
+                orderNo: this.orderNo,
+                applyReason: this.selectReasonValue,
+                afterSaleType: 2,//1:退货 2:换  3:未收到货
+                applyDesc: this.questionOrDiscribeValue,
+                applyImages: this.fileList.map(m => m.url).join(','),
+            }).then(res => {
+                if (res.data.code == 200) {
+                    uni.navigateTo({
+                        url: '/points/order/orderDetails?orderNo=' + this.orderNo,
+                    });
+                } else {
+                    uni.$u.toast(res.data.msg)
+                }
 
             })
 
@@ -155,7 +185,7 @@ export default {
         //选择申请原因--换货
         selectApplyReasonFun(tab) {
             uni.navigateTo({
-                url: `/points/productDetails/applyRefund?tab=${tab}&selectReasonValue=${encodeURIComponent(this.selectReasonValue)}&questionOrDiscribeValue=${encodeURIComponent(this.questionOrDiscribeValue)}&fileList=${JSON.stringify(this.fileList)}&orderNo=${this.orderNo}&orderId=${this.orderId}&orderStatus=${this.orderStatus}`
+                url: `/points/productDetails/applyRefund?afterSalesType=${this.afterSalesType}&receiptStatus=${this.receiptStatus}&tab=${tab}&selectReasonValue=${encodeURIComponent(this.selectReasonValue)}&questionOrDiscribeValue=${encodeURIComponent(this.questionOrDiscribeValue)}&fileList=${JSON.stringify(this.fileList)}&orderNo=${this.orderNo}&orderId=${this.orderId}&orderStatus=${this.orderStatus}`
             })
 
         },
@@ -258,9 +288,10 @@ export default {
         .u-form-item__body__right {
             flex: none;
         }
-        .questionOrDiscribeValue{
+
+        .questionOrDiscribeValue {
             width: 400rpx;
-            white-space:nowrap;
+            white-space: nowrap;
             overflow: hidden;
             text-overflow: ellipsis;
             text-align: right;

+ 42 - 46
src/points/productDetails/applyRefund.vue

@@ -13,7 +13,7 @@
 
             <view class="content">
                 <view>
-                    <view class="contentDetail" v-if="orderStatus && tab==1">
+                    <view class="contentDetail" v-if="tab == 1">
                         <view class="tip">请选择取消订单的原因(必选):</view>
                         <u-radio-group v-model="selectReason" @change="groupChange">
                             <view>
@@ -38,7 +38,7 @@
                         </view>
                     </view>
                 </view>
-                <view v-if="orderStatus == 3 && tab==2">
+                <view v-if="receiptStatus == 'received' && afterSalesType == 'exchange' && tab == 2">
                     <view class="Box">
                         <view class="questionOrDiscribe">
                             <view>问题与描述:</view>
@@ -92,6 +92,8 @@ export default {
             orderNo: null,
             orderId: null,
             orderStatus: null,
+            afterSalesType: null,
+            receiptStatus: null,
             fileList: [],
             headPhotoImg: [],
             questionOrDiscribeValue: '',
@@ -158,28 +160,28 @@ export default {
     },
     computed: {
         filteredList() {
-            if (this.orderStatus == 1) return this.list1;
-            if (this.orderStatus == 2) return this.list2;
-            return this.list3;
+            if (this.receiptStatus == 'notReceived') {
+                return this.list1
+            } else if (this.receiptStatus == "received" && this.afterSalesType == "refund") {
+                return this.list2
+            } else if (this.receiptStatus == "received" && this.afterSalesType == "exchange") {
+                return this.list3;
+            }
         }
     },
     onLoad(data) {
         //订单状态(0:待付款 1:待发货 2:待收货 3:已收货 4:售后中  11:取消订单)
         console.log(data, 'onLoad-applyRefund')
         if (data) {
+            uni.setNavigationBarTitle({
+                title: '申请换货66666'
+            });
             if (data.tab) this.tab = data.tab
             if (data.orderId) this.orderId = data.orderId
             if (data.orderNo) this.orderNo = data.orderNo
             if (data.orderStatus) this.orderStatus = data.orderStatus
-            if (this.orderStatus == 1 || this.orderStatus == 2) {
-                uni.setNavigationBarTitle({
-                    title: '申请退款'
-                });
-            } else if (this.orderStatus == 3) {
-                uni.setNavigationBarTitle({
-                    title: '申请换货'
-                });
-            }
+            if (data.receiptStatus) this.receiptStatus = data.receiptStatus
+            if (data.afterSalesType) this.afterSalesType = data.afterSalesType
 
             if (data.servicePromise) this.servicePromise = data.servicePromise
             if (data.questionOrDiscribeValue && data.questionOrDiscribeValue !== "null") {
@@ -204,9 +206,21 @@ export default {
         }
 
 
+    },
+    onReady() {
+        // 页面渲染完成后再设置标题
+        if (this.receiptStatus == 'notReceived' || (this.receiptStatus == "received" && this.afterSalesType == "refund")) {
+            uni.setNavigationBarTitle({
+                title: '申请退款'
+            });
+        } else if (this.receiptStatus && this.afterSalesType == "exchange") {
+            uni.setNavigationBarTitle({
+                title: '申请换货'
+            });
+        }
     },
     onShow(data) {
-        console.log(this.orderStatus,this.filteredList)
+        console.log(this.orderStatus, this.filteredList)
         let flag = this.servicePromise.some(f => {
             return f.indexOf('7天无理由退') !== -1
         })
@@ -263,52 +277,33 @@ export default {
         //提交
         goSubmit() {
             console.log('提交 applyRefund')
-            if (this.orderStatus == 0 || this.orderStatus == 1) { //待支付、待发货 走订单取消接口
-                let params = {
-                    openId: uni.getStorageSync('wx_copenid'),
-                    orderNo: this.orderNo,
-                    cancelReason: this.selectReasonValue,
-                }
-                productOrderCancel(params).then(res => {
-                    if (res.data.code == 200) {
-                        clearInterval(this.timer);
-                        this.cancelOrderShowPopup = false
-                        uni.navigateTo({
-                            url: `/points/productDetails/pendingPayment?orderNo=${this.orderNo}`
-                        });
-                    } else {
-                        //alert(res.data.msg)
-                        uni.showToast({
-                            title: res.data.msg,
-                            icon: 'none'
-                        })
-                    }
-
-                })
-                return
-            }
-
-            //订单状态(2:待收货 3:已收货 4:售后中)
-            if (this.orderStatus == 2) {
+            if (this.receiptStatus == 'notReceived' || (this.receiptStatus == "received" && this.afterSalesType == "refund")) {
                 afterSaleOrder({ // 未收到-申请退款,已收到货-申请退款
                     orderId: this.orderId,
                     orderNo: this.orderNo,
                     applyReason: this.selectReasonValue,
-                    afterSaleType: this.orderStatus == 2 ? 3 : null, // afterSaleType  1:退货 2:换  3:未收到货
+                    afterSaleType: this.receiptStatus == 'notReceived' ? 3 : 1, // afterSaleType  1:退货 2:换  3:未收到货
                     //applyDesc:'',
                     //applyImages:'',
                 }).then(res => {
+                    if (res.data.code == 200) {
+                        uni.navigateTo({
+                            url: '/points/order/orderDetails?orderNo=' + this.orderNo,
+                        });
+                    }else{
+                        uni.$u.toast(res.data.msg)
+                    }
 
                 })
             }
 
-            if (this.orderStatus == 3) { //换货
+            if (this.receiptStatus == "received" && this.afterSalesType == "exchange") {
                 uni.navigateTo({
-                    url: `/points/productDetails/applyExchange?selectReasonValue=${encodeURIComponent(this.selectReasonValue)}&questionOrDiscribeValue=${encodeURIComponent(this.questionOrDiscribeValue)}&fileList=${JSON.stringify(this.fileList)}&orderNo=${this.orderNo}&orderId=${this.orderId}&orderStatus=${this.orderStatus}`
+                    url: `/points/productDetails/applyExchange?afterSalesType=${this.afterSalesType}&receiptStatus=${this.receiptStatus}&selectReasonValue=${encodeURIComponent(this.selectReasonValue)}&questionOrDiscribeValue=${encodeURIComponent(this.questionOrDiscribeValue)}&fileList=${JSON.stringify(this.fileList)}&orderNo=${this.orderNo}&orderId=${this.orderId}&orderStatus=${this.orderStatus}`
                 });
-
             }
 
+
         },
         //返回上一页
         autoBackFun() {
@@ -353,6 +348,7 @@ export default {
     //height: 658rpx;
     border-radius: 20rpx 20rpx 20rpx 20rpx;
 
+
     ::v-deep .Box {
         background: #FFFFFF;
         border-radius: 20rpx 20rpx 20rpx 20rpx;

+ 1 - 1
src/points/productDetails/components/selectProduct.vue

@@ -239,7 +239,7 @@ export default {
     background-color: #F5F8F8;
     padding: 24rpx 32rpx 0 32rpx;
     font-family: PingFang SC, PingFang SC;
-    height: 1350rpx;
+    height: 1250rpx;
     border-radius: 20rpx 20rpx 0 0;
 
     .addressBox {