소스 검색

售后跳转

MS-IOHQJGHXZHQD\Administrator 4 달 전
부모
커밋
6c1d1c6f2e
1개의 변경된 파일66개의 추가작업 그리고 52개의 파일을 삭제
  1. 66 52
      src/points/order/orderDetails.vue

+ 66 - 52
src/points/order/orderDetails.vue

@@ -1,15 +1,15 @@
 <script>
-import {getPointOrderInfo,confirmReceipt,cancelReturn,orderLogisticsNo} from '@/api/pointOrder'
+import { getPointOrderInfo, confirmReceipt, cancelReturn, orderLogisticsNo } from '@/api/pointOrder'
 import ImageItem from "@/components/swiper/components/image.vue";
 export default {
   name: "orderDetails",
-  components: {ImageItem},
+  components: { ImageItem },
   data() {
     return {
       orderInfo: {},
-      afterSaleInfo:{},
-      productInfo:{},
-      refundType:'',
+      afterSaleInfo: {},
+      productInfo: {},
+      refundType: '',
       // 图片加载状态
       imageErrorMap: {},
       // 设备信息
@@ -61,7 +61,7 @@ export default {
         orderNo: this.orderNo,
         openId: uni.getStorageSync('wx_copenid')
       })
-      let {afterSaleInfo,orderInfo,productInfo} = res.data.data;
+      let { afterSaleInfo, orderInfo, productInfo } = res.data.data;
 
       let skuspecStr = '';
       try {
@@ -69,7 +69,7 @@ export default {
         if (skuspec && skuspec !== 'undefined' && skuspec !== 'null') {
           const parsedSpec = JSON.parse(skuspec);
           if (Array.isArray(parsedSpec)) {
-            skuspecStr = parsedSpec.map(t=>t?.specValue).filter(Boolean).toString();
+            skuspecStr = parsedSpec.map(t => t?.specValue).filter(Boolean).toString();
           }
         }
       } catch (error) {
@@ -82,11 +82,11 @@ export default {
       this.afterSaleInfo = afterSaleInfo;
       this.orderInfo = orderInfo;
     },
-    orderTitle(info){
+    orderTitle(info) {
       let orderTitleName = ''
-      if(this.orderInfo.orderStatus == 4){
+      if (this.orderInfo.orderStatus == 4) {
         orderTitleName = this.afterSaleInfo.afterSaleStatusName
-      }else{
+      } else {
         orderTitleName = this.orderInfo.orderStatusName
       }
       return orderTitleName
@@ -94,11 +94,11 @@ export default {
     // 处理退货操作
     handleRefund(val) {
       this.refundType = val;
-      if(val === 'receipt'){
+      if (val === 'receipt') {
         this.title = '确认收货';
         this.content = '为了保障您的权益,请收到商品确认无误后再确认收货'
       }
-      if(val === 'cancel'){
+      if (val === 'cancel') {
         this.title = '取消申请';
         this.content = '您确认取消发出的申请么'
       }
@@ -109,12 +109,12 @@ export default {
       var _this = this;
       let apiUrl = this.refundType === 'receipt' ? confirmReceipt : this.refundType === 'cancel' ? cancelReturn : '';
       apiUrl({
-        orderId:_this.orderInfo.id
+        orderId: _this.orderInfo.id
       }).then(res => {
-          if(res.data.code == 200){
-            _this.show = false;
-            _this.getOrderInfo();
-          }
+        if (res.data.code == 200) {
+          _this.show = false;
+          _this.getOrderInfo();
+        }
       })
     },
     // 提交物流单号
@@ -124,7 +124,7 @@ export default {
         orderId: _this.orderInfo.id,
         logisticsNo: _this.logisticsNumber
       }).then(res => {
-        if(res.data.code == 200){
+        if (res.data.code == 200) {
           _this.showLogistics = false;
           _this.logisticsNumber = '';
           _this.getOrderInfo();
@@ -146,21 +146,33 @@ export default {
         afterSalesType: this.afterSalesType
       });
       // 这里可以调用售后API
-      
+
       //订单状态(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}`
         });
-      } else if (this.orderInfo.orderStatus == 3) {
-        uni.navigateTo({
-          url: `/points/productDetails/applyExchange?orderNo=${this.orderInfo.orderNo}&orderId=${this.orderInfo.id}&orderStatus=${this.orderInfo.orderStatus}`
-        });
       }
+
+      // if (this.receiptStatus == 'notReceived') {
+
+      // } else if (this.receiptStatus == "received" && this.afterSalesType == "refund") {
+
+      // }
+
+
+      
     },
     //获取售后时间
-    getafterTime(){
+    getafterTime() {
       let date = new Date("2026-04-22 09:38:54");
       date.setDate(date.getDate() + 10); // 直接在“日期”上加10
       return this.formatDate(date);
@@ -185,12 +197,10 @@ export default {
     <view class="product-info">
       <view class="product-image">
         <view v-if="!imageErrorMap[productInfo.productId]" class="product-image">
-          <ImageItem
-              :src="getImageUrl(productInfo.skuImage)"
-              @image-error="handleImageError(productInfo.productId)"
-          />
+          <ImageItem :src="getImageUrl(productInfo.skuImage)" @image-error="handleImageError(productInfo.productId)" />
         </view>
-        <view v-else style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 120rpx; background-color: #f5f5f5; border-radius: 8rpx;">
+        <view v-else
+          style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 120rpx; background-color: #f5f5f5; border-radius: 8rpx;">
           <uni-icons type="image" size="54rpx" color="#999" @click="resetImageError(productInfo.productId)"></uni-icons>
           <text style="font-size: 20rpx; color: #999; margin-top: 13rpx;">加载失败</text>
         </view>
@@ -200,7 +210,8 @@ export default {
         <text class="product-spec">已选 {{ productInfo.skuSpec }}</text>
         <text class="product-price" v-if="productInfo.paymentType == 1">{{ orderInfo.pointsUsed }}积分</text>
         <text class="product-price" v-if="productInfo.paymentType == 2">¥{{ orderInfo.totalAmount }}</text>
-        <text class="product-price" v-if="productInfo.paymentType == 3">¥{{ orderInfo.totalAmount }}+{{ orderInfo.pointsUsed }}积分</text>
+        <text class="product-price" v-if="productInfo.paymentType == 3">¥{{ orderInfo.totalAmount }}+{{
+          orderInfo.pointsUsed }}积分</text>
       </view>
     </view>
 
@@ -242,7 +253,7 @@ export default {
         <text class="info-label">退货原因</text>
         <text class="info-value">{{ afterSaleInfo.applyReason }}</text>
       </view>
-      <view class="info-item" v-if="[0,2,3].includes(afterSaleInfo.afterSaleStatus)">
+      <view class="info-item" v-if="[0, 2, 3].includes(afterSaleInfo.afterSaleStatus)">
         <text class="info-label">申请时间</text>
         <text class="info-value">{{ afterSaleInfo.createTime }}</text>
       </view>
@@ -252,16 +263,17 @@ export default {
         <text class="info-value">{{ afterSaleInfo.refund_time }}</text>
       </view>
 
-      <view class="info-item" v-if="[1,3].includes(afterSaleInfo.afterSaleStatus)">
+      <view class="info-item" v-if="[1, 3].includes(afterSaleInfo.afterSaleStatus)">
         <text class="info-label">物流单号</text>
-         <text class="info-value">{{ afterSaleInfo.logisticsNo }}</text>
+        <text class="info-value">{{ afterSaleInfo.logisticsNo }}</text>
       </view>
 
       <view class="info-item" v-if="afterSaleInfo.afterSaleStatus == 1">
         <text class="info-label">退款成功</text>
         <text class="info-value" v-if="productInfo.paymentType == 1">{{ orderInfo.pointsUsed }}积分</text>
         <text class="info-value" v-if="productInfo.paymentType == 2">¥{{ orderInfo.totalAmount }}</text>
-        <text class="info-value" v-if="productInfo.paymentType == 3">¥{{ orderInfo.totalAmount }}+{{ orderInfo.pointsUsed }}积分</text>
+        <text class="info-value" v-if="productInfo.paymentType == 3">¥{{ orderInfo.totalAmount }}+{{
+          orderInfo.pointsUsed }}积分</text>
       </view>
     </view>
 
@@ -271,7 +283,7 @@ export default {
         <text class="info-label">退货原因</text>
         <text class="info-value">{{ afterSaleInfo.applyReason }}</text>
       </view>
-      <view class="info-item" v-if="[0,2,3,4].includes(afterSaleInfo.afterSaleStatus)">
+      <view class="info-item" v-if="[0, 2, 3, 4].includes(afterSaleInfo.afterSaleStatus)">
         <text class="info-label">申请时间</text>
         <text class="info-value">{{ afterSaleInfo.createTime }}</text>
       </view>
@@ -302,7 +314,8 @@ export default {
         <text class="info-label">退款成功</text>
         <text class="info-value" v-if="productInfo.paymentType == 1">{{ orderInfo.pointsUsed }}积分</text>
         <text class="info-value" v-if="productInfo.paymentType == 2">¥{{ orderInfo.totalAmount }}</text>
-        <text class="info-value" v-if="productInfo.paymentType == 3">¥{{ orderInfo.totalAmount }}+{{ orderInfo.pointsUsed }}积分</text>
+        <text class="info-value" v-if="productInfo.paymentType == 3">¥{{ orderInfo.totalAmount }}+{{
+          orderInfo.pointsUsed }}积分</text>
       </view>
     </view>
 
@@ -311,19 +324,20 @@ export default {
       <button class="detail-button" @click="handleAfterSales" v-if="afterSaleInfo == null">退款\售后</button>
       <button class="action-button" @click="handleRefund('receipt')">确认收货</button>
     </view>
-    <view class="action-buttons" :class="{ 'safe-area': hasSafeArea }" v-if="orderInfo.orderStatus == 4 && ([0,2].includes(afterSaleInfo.afterSaleStatus))">
+    <view class="action-buttons" :class="{ 'safe-area': hasSafeArea }"
+      v-if="orderInfo.orderStatus == 4 && ([0, 2].includes(afterSaleInfo.afterSaleStatus))">
       <button class="action-button" @click="handleRefund('cancel')">取消申请</button>
       <button class="action-button" @click="handleLogistics" v-if="afterSaleInfo.afterSaleStatus == 2">填写物流单号</button>
     </view>
     <!-- 弹出层 -->
     <u-modal :show="show" :title="title" :content='content' :show-cancel="false">
-        <view slot="default" class="modal-content">
-            <text class="modal-text">{{content}}</text>
-        </view>
-        <view slot="confirmButton" class="modal-footer">
-            <button class="modal-cancel" @click="show = false">取消</button>
-            <button class="modal-confirm" @click="confirmReceive">确认收货</button>
-        </view>
+      <view slot="default" class="modal-content">
+        <text class="modal-text">{{ content }}</text>
+      </view>
+      <view slot="confirmButton" class="modal-footer">
+        <button class="modal-cancel" @click="show = false">取消</button>
+        <button class="modal-confirm" @click="confirmReceive">确认收货</button>
+      </view>
     </u-modal>
     <!-- 填写物流单号 -->
     <u-popup :show="showLogistics" mode="bottom" @close="showLogistics = false" round="20rpx">
@@ -381,18 +395,18 @@ export default {
         <view class="popup-section">
           <text class="section-title">
             请选择商品
-            <text v-if="receiptStatus === 'received'" class="time-limit">({{ getafterTime() }}  24时之前可申请)</text>
+            <text v-if="receiptStatus === 'received'" class="time-limit">({{ getafterTime() }} 24时之前可申请)</text>
           </text>
           <view class="product-item">
             <view class="product-image">
               <view v-if="!imageErrorMap[productInfo.productId]" class="product-image">
-                <ImageItem
-                    :src="getImageUrl(productInfo.skuImage)"
-                    @image-error="handleImageError(productInfo.productId)"
-                />
+                <ImageItem :src="getImageUrl(productInfo.skuImage)"
+                  @image-error="handleImageError(productInfo.productId)" />
               </view>
-              <view v-else style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100rpx; background-color: #f5f5f5; border-radius: 8rpx;">
-                <uni-icons type="image" size="44rpx" color="#999" @click="resetImageError(productInfo.productId)"></uni-icons>
+              <view v-else
+                style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100rpx; background-color: #f5f5f5; border-radius: 8rpx;">
+                <uni-icons type="image" size="44rpx" color="#999"
+                  @click="resetImageError(productInfo.productId)"></uni-icons>
                 <text style="font-size: 20rpx; color: #999; margin-top: 3rpx;">加载失败</text>
               </view>
             </view>