shish 23 часов назад
Родитель
Сommit
db9f92a019

+ 2 - 2
mallApp/src/api/refund/index.js

@@ -14,12 +14,12 @@ export const createRefund = data => {
 	return https.post('/refund/create-order', data)
 }
 
-/** 顾客撤销待审核申请;列表「修改申请」会先撤销再重新填写 */
+/** 顾客撤销待审核申请;列表/详情「取消申请」调用 */
 export const cancelRefund = data => {
 	return https.post('/refund/cancel-order', data)
 }
 
-/** 顾客售后申请列表;status: all|0|1|closed */
+/** 顾客售后申请列表;status: all|0|1|closed;可选 orderId 只看本单 */
 export const refundList = data => {
 	return https.get('/refund/list', data)
 }

+ 9 - 8
mallApp/src/components/refund/refund-card.vue

@@ -47,7 +47,7 @@
       <text class="tip-text" :class="'tone-' + statusTone">{{ info.statusTip }}</text>
     </view>
 
-    <!-- 操作按钮:列表看详情,详情看原订单 -->
+    <!-- 操作按钮:列表看详情,详情看原订单;待审核可取消申请(无底色,不突出) -->
     <view class="action-row" @click.stop>
       <!-- 联系客服与订单列表 order-item 一致 -->
       <view class="action-btn action-btn--ghost" @click.stop="onContact">联系客服</view>
@@ -64,16 +64,16 @@
       >查看订单</view>
       <view
         v-if="info.canModify"
-        class="action-btn action-btn--primary"
-        @click.stop="onModify"
-      >修改申请</view>
+        class="action-btn action-btn--ghost"
+        @click.stop="onCancel"
+      >取消申请</view>
     </view>
   </view>
 </template>
 
 <script>
 /**
- * 售后卡片:列表点卡片/查看详情进详情页;处理中可撤销后重新申请
+ * 售后卡片:列表点卡片/查看详情进详情页;待审核可取消申请
  */
 export default {
   name: 'RefundCard',
@@ -137,8 +137,9 @@ export default {
     onOrder() {
       this.$emit('order', this.info)
     },
-    onModify() {
-      this.$emit('modify', this.info)
+    /** 待审核取消申请,交给列表/详情页调撤销接口 */
+    onCancel() {
+      this.$emit('cancel', this.info)
     }
   }
 }
@@ -331,7 +332,7 @@ export default {
   min-width: 140upx;
   height: 56upx;
   padding: 0 22upx;
-  margin-left: 12upx;
+  margin-left: 20upx;
   border-radius: 28upx;
   font-size: 24upx;
   display: flex;

+ 25 - 95
mallApp/src/pages/order/detail.vue

@@ -117,6 +117,10 @@
               <view class="label">创建时间</view>
               <view class="value">{{ data.addTime ? data.addTime.substr(0,13) : ''}}</view>
             </view>
+            <view class="msg-list">
+              <view class="label">支付渠道</view>
+              <view class="value">{{ payChannelInfo }}</view>
+            </view>
             <view class="msg-list">
               <view class="label">支付方式</view>
               <view class="value">{{ payWayInfo }}</view>
@@ -136,11 +140,11 @@
       <template v-if="data.status == 1">
         <button class="button-com green big" @click="payFn">立即支付</button>
       </template>
-      <!-- 待审核不可再申请,但仍展示「查看申请」;可申请时保留「申请售后」 -->
+      <!-- 非待支付:申请记录 + 申请售后始终同时展示;有待审时进申请页只能看进度不能再提交 -->
       <template v-else>
-        <view v-if="showViewRefundBtn || showRefundBtn" class="refund-actions" :class="{ 'is-double': showBothRefundBtns }">
-          <button v-if="showViewRefundBtn" class="button-com default big refund-btn" @click="goViewRefund">查看申请</button>
-          <button v-if="showRefundBtn" class="button-com default big refund-btn" @click="goRefund">申请售后</button>
+        <view class="refund-actions">
+          <button class="button-com default big refund-btn" @click="goViewRefund">申请记录</button>
+          <button class="button-com default big refund-btn" @click="goRefund">申请售后</button>
         </view>
       </template>
     </view>
@@ -149,14 +153,13 @@
 <script>
 /**
  * 商城订单详情
- * 底部「申请售后」看 canApplyRefund(现金为 0 时需红包未退回且红包金额大于实付);待审核/已有申请用 get-refund-data 的 apply 展示「查看申请」
+ * 底栏「申请记录」进本单售后列表;「申请售后」进申请页(有待审核时只展示进度,不可再提交)
  */
 import { mapGetters } from "vuex";
 import orderItem from "@/components/module/app-order-item";
 import ListModule from "@/components/module/app-order-list";
 import AppCouponSel from "@/components/app-coupon-sel";
 import { getDetail } from "@/api/order";
-import { getRefundData } from "@/api/refund";
 import { getShopUser } from "@/utils/auth";
 export default {
   name: "detail",
@@ -167,64 +170,15 @@ export default {
       data: {},
       discountArr: false,
       payWayInfo: "微信支付",
+      /** 支付渠道:onlinePay 2=线上 1=线下 */
+      payChannelInfo: "线下",
       reachPeriodInfo: "上午",
       /** 首次 init 完成后再在 onShow 里重拉,避免进页连打两次 */
-      detailInited: false,
-      /** get-refund-data 的最新申请;待审核 status=0 也要能进查看 */
-      refundApply: null
+      detailInited: false
     };
   },
   computed: {
     ...mapGetters({ shopUser: "getShopUser" }),
-    /**
-     * 是否展示申请售后:优先用详情 canApplyRefund,与后端 RefundController 一致
-     * 现金为 0 时:红包仍挂单且红包金额大于订单实付才展示
-     */
-    showRefundBtn() {
-      const d = this.data || {};
-      if (d.canApplyRefund !== undefined && d.canApplyRefund !== null && d.canApplyRefund !== "") {
-        return Number(d.canApplyRefund) === 1;
-      }
-      // 接口未返回时的兜底(含分销已结算)
-      if (Number(d.payStatus) !== 1) {
-        return false;
-      }
-      if (Number(d.forward) === 1) {
-        return false;
-      }
-      if ([1, 5, 6].indexOf(Number(d.status)) !== -1) {
-        return false;
-      }
-      if (Number(d.distOrderSettled) === 1) {
-        return false;
-      }
-      const could = Number(d.orderPrice || 0) - Number(d.tkPrice || 0);
-      if (could <= 0) {
-        const payAmount = Number(d.mainPay != null ? d.mainPay : d.orderPrice) || 0;
-        return Number(d.hbId || 0) > 0 && Number(d.hbAmount || 0) > payAmount;
-      }
-      return true;
-    },
-    /**
-     * 最新顾客申请 id:详情 refundApplyId 或补拉的 apply;待审核 status=0 仍有效
-     */
-    currentRefundApplyId() {
-      const fromDetail = Number((this.data && this.data.refundApplyId) || 0);
-      if (fromDetail) {
-        return fromDetail;
-      }
-      return Number((this.refundApply && this.refundApply.id) || 0);
-    },
-    /**
-     * 是否展示查看申请:有申请记录就展示,含待审核
-     */
-    showViewRefundBtn() {
-      return !!this.currentRefundApplyId;
-    },
-    /** 同时有查看与申请时收窄按钮,避免底栏挤出 */
-    showBothRefundBtns() {
-      return this.showViewRefundBtn && this.showRefundBtn;
-    },
     statusImg() {
       let img = "";
       if (this.data.status == 0) {
@@ -240,7 +194,7 @@ export default {
     }
   },
   /**
-   * 从申请页返回后重拉详情,才能把「申请售后」换成「查看申请」
+   * 从申请页返回后重拉详情,刷新金额与状态
    */
   onShow() {
     if (!this.detailInited) {
@@ -253,21 +207,20 @@ export default {
       this.$util.pageTo({url:'/pages/order/detail?id='+info.shOrderId})
     },
     /**
-     * 查看本单最新售后申请(含待审核);有申请 id 进详情,否则进申请进度页
+     * 本单售后申请记录:进售后列表(orderId 只看本单),列表再点进详情
      */
     goViewRefund() {
-      const applyId = this.currentRefundApplyId;
-      const account = (this.option && this.option.account) || "";
-      if (applyId) {
-        this.$util.pageTo({ url: "/pages/order/refund-detail?account=" + account + "&id=" + applyId });
-        return;
-      }
       if (!this.data || !this.data.id) {
         return;
       }
-      this.$util.pageTo({ url: "/pages/order/refund?account=" + account + "&id=" + this.data.id });
+      const account = (this.option && this.option.account) || "";
+      this.$util.pageTo({
+        url: "/pages/order/refund-list?account=" + account + "&orderId=" + this.data.id
+      });
     },
-    /** 跳转申请售后;分销已结算时兜底提示 */
+    /**
+     * 进申请售后页;有待审核时申请页锁进度不可再提交(后端也会拦)
+     */
     goRefund() {
       if (!this.data.id) {
         return;
@@ -313,6 +266,8 @@ export default {
         } else {
           this.payWayInfo = "其它";
         }
+        // onlinePay:字典 yes=2 线上,not=1 线下
+        this.payChannelInfo = Number(res.data.onlinePay) === 2 ? "线上" : "线下";
 
         if (res.data.reachPeriod == 0) {
           this.reachPeriodInfo = "上午";
@@ -323,28 +278,6 @@ export default {
         } else {
           this.reachPeriodInfo = "上午";
         }
-        // 待审核申请详情接口可能还不带 id,补拉 get-refund-data 才能露出查看入口
-        return this.syncRefundApply();
-      });
-    },
-    /**
-     * 补拉本单最新售后申请;待审核 status=0 也必须留下记录
-     */
-    syncRefundApply() {
-      const orderId = (this.data && this.data.id) || (this.option && this.option.id);
-      if (!orderId) {
-        this.refundApply = null;
-        return Promise.resolve();
-      }
-      return getRefundData({ id: orderId }).then(res => {
-        if (!res || res.code != 1) {
-          this.refundApply = null;
-          return;
-        }
-        const apply = res.data ? res.data.apply : null;
-        this.refundApply = apply && apply.id ? apply : null;
-      }).catch(() => {
-        this.refundApply = null;
       });
     },
     payFn() {
@@ -458,7 +391,7 @@ export default {
   .default {
     width: 300upx;
   }
-  /* 申请售后 / 查看申请:描边主色,与「立即支付」实心区分 */
+  /* 申请记录 / 申请售后:描边主色,与「立即支付」实心区分;两钮并排收窄 */
   .refund-btn {
     color: $mainColor !important;
     border: 1upx solid $mainColor !important;
@@ -471,12 +404,9 @@ export default {
   }
   .refund-actions .refund-btn {
     margin-left: 0;
-  }
-  /* 两个按钮同时出现时收窄,避免和金额抢宽度 */
-  .refund-actions.is-double .refund-btn {
     width: 200upx;
   }
-  .refund-actions.is-double .refund-btn + .refund-btn {
+  .refund-actions .refund-btn + .refund-btn {
     margin-left: 16upx;
   }
 }

+ 10 - 6
mallApp/src/pages/order/refund-detail.vue

@@ -1,6 +1,6 @@
 <!--
   商城售后详情
-  从退款售后列表「查看详情」进入;展示申请快照,处理中可修改申请
+  从退款售后列表「查看详情」进入;展示申请快照,待审核可取消申请
 -->
 <template>
   <view class="refund-detail-page">
@@ -10,7 +10,7 @@
         scene="detail"
         @contact="contactService"
         @order="goOrder"
-        @modify="modifyApply"
+        @cancel="cancelApply"
       />
       <view class="extra-card">
         <view class="extra-row extra-row--first">
@@ -150,14 +150,17 @@ export default {
         url: '/pages/order/detail?id=' + item.orderId + '&account=' + (item.shopId || 0) + '&hdId=' + (item.hdId || 0)
       })
     },
-    modifyApply() {
+    /**
+     * 取消待审核申请:只撤销并刷新详情,不再跳去重新填写
+     */
+    cancelApply() {
       const item = this.detail
       if (!item || !item.id) {
         return
       }
       uni.showModal({
-        title: '修改申请',
-        content: '修改需先撤销当前申请,再重新填写。是否继续?',
+        title: '取消申请',
+        content: '确认取消该售后申请?',
         success: (res) => {
           if (!res.confirm) {
             return
@@ -166,7 +169,8 @@ export default {
           cancelRefund({ id: item.id }).then((resp) => {
             uni.hideLoading()
             if (resp.code == 1) {
-              this.pageTo({ url: '/pages/order/refund?id=' + item.orderId, type: 2 })
+              this.$msg(resp.msg || '已取消申请')
+              this.loadDetail()
             }
           }).catch(() => {
             uni.hideLoading()

+ 26 - 11
mallApp/src/pages/order/refund-list.vue

@@ -1,6 +1,7 @@
 <!--
   商城「退款售后」列表
-  从「我的」退款/售后进入;按全部/处理中/已退款/已关闭筛选 xhHdRefund 顾客申请
+  从「我的」退款/售后进入看全部;订单详情「申请记录」带 orderId 只看本单
+  列表点卡片/查看详情进入 refund-detail
 -->
 <template>
   <view class="refund-list-page">
@@ -30,7 +31,7 @@
           scene="list"
           @detail="goDetail"
           @contact="contactService"
-          @modify="modifyApply"
+          @cancel="cancelApply"
         />
         <view class="load-more">
           <text v-if="list.loading">加载中...</text>
@@ -47,6 +48,7 @@
 <script>
 /**
  * 退款售后列表:Tab 对应申请 status;处理中角标来自 pendingCount
+ * 路由带 orderId 时只拉该订单申请(订单详情「申请记录」)
  */
 import RefundCard from '@/components/refund/refund-card.vue'
 import AppWrapperEmpty from '@/components/app-wrapper-empty'
@@ -67,6 +69,8 @@ export default {
       pendingCount: 0,
       /** 首次 onLoad 完成前不在 onShow 里重拉,避免进页连打两次 */
       inited: false,
+      /** 订单详情进入时收窄为本单;「我的」入口为 0 */
+      orderId: 0,
       user: { name: '', smallAvatar: '', id: 0 },
       tabs: [
         { name: '全部', key: 'all' },
@@ -76,7 +80,13 @@ export default {
       ]
     }
   },
-  onLoad() {
+  onLoad(options) {
+    const orderId = Number((options && options.orderId) || 0)
+    this.orderId = orderId > 0 ? orderId : 0
+    // 订单详情「申请记录」:标题与「我的-退款/售后」区分
+    if (this.orderId > 0) {
+      uni.setNavigationBarTitle({ title: '申请记录' })
+    }
     this.loadUserInfo()
     this.reload().then(() => {
       this.inited = true
@@ -109,14 +119,18 @@ export default {
     },
     /**
      * 按当前 Tab 拉取申请列表
-     * status=all 不筛选;closed 为驳回+取消
+     * status=all 不筛选;closed 为驳回+取消;有 orderId 时只看本单
      */
     fetchList() {
       const tab = this.tabs[this.tabIndex] || this.tabs[0]
-      return refundList({
+      const params = {
         status: tab.key,
         page: this.list.page
-      }).then((res) => {
+      }
+      if (this.orderId > 0) {
+        params.orderId = this.orderId
+      }
+      return refundList(params).then((res) => {
         if (res.code == 1) {
           if (!res.data) {
             res.data = {}
@@ -190,15 +204,15 @@ export default {
       })
     },
     /**
-     * 修改申请:待审核记录只能先撤销再重新提交,没有单独的改单接口
+     * 取消待审核申请:只撤销,不跳转重新填写(再申从订单详情「申请售后」进)
      */
-    modifyApply(item) {
+    cancelApply(item) {
       if (!item || !item.id) {
         return
       }
       uni.showModal({
-        title: '修改申请',
-        content: '修改需先撤销当前申请,再重新填写。是否继续?',
+        title: '取消申请',
+        content: '确认取消该售后申请?',
         success: (res) => {
           if (!res.confirm) {
             return
@@ -207,7 +221,8 @@ export default {
           cancelRefund({ id: item.id }).then((resp) => {
             uni.hideLoading()
             if (resp.code == 1) {
-              this.pageTo({ url: '/pages/order/refund?id=' + item.orderId })
+              this.$msg(resp.msg || '已取消申请')
+              this.reload()
             }
           }).catch(() => {
             uni.hideLoading()

+ 17 - 61
mallApp/src/pages/order/refund.vue

@@ -1,13 +1,13 @@
 	<!--
   商城订单申请售后页
   供订单详情「申请售后」进入;顾客勾选商品/金额后提交待审核申请,商家在 hdApp 审核
-  撤销后仍可重新申请:把已取消记录改回待审核
+  仅当存在待审核申请时锁进度页不可再提交;无待审核则直接进表单(含已取消/通过/驳回后再申)
   退货并退款金额:普通商品按勾选原价分摊会员折/满减;秒杀、团购按活动单价退,不再叠整单优惠
   红包全额抵扣导致实付为 0 时仍可申请:提交 0 元,审核通过后退回红包
 -->
 <template>
 	<view class="refund-page">
-		<!-- 已有申请:展示进度(点「重新申请」后切到表单) -->
+		<!-- 仅待审核锁进度,不可并行再开一笔 -->
 		<template v-if="showApplyProgress">
 			<view class="card-section">
 				<view class="section-title">
@@ -33,15 +33,9 @@
 					</view>
 				</view>
 			</view>
-			<view class="bottom-actions" v-if="apply.status == 0">
+			<view class="bottom-actions">
 				<button class="action-btn cancel-btn" @tap="doCancel">撤销申请</button>
-			</view>
-			<view class="bottom-actions" v-else-if="canReapply">
-				<button class="action-btn cancel-btn" @tap="goBack">返回</button>
-				<button class="action-btn confirm-btn" @tap="startReapply">重新申请</button>
-			</view>
-			<view class="bottom-actions" v-else>
-				<button class="action-btn cancel-btn" @tap="goBack">返回</button>
+				<button class="action-btn confirm-btn" @tap="goBack">返回</button>
 			</view>
 		</template>
 
@@ -185,14 +179,6 @@
 				</view>
 			</view>
 
-			<!-- 退款方式提示:对齐采购售后,按原单 onlinePay / payWay 说明审核后资金去向 -->
-			<view class="tip-section">
-				<text v-if="Number(orderInfo.onlinePay) == 2" class="tip-text online-tip">此单线上付款,审核通过后钱将原路退回</text>
-				<text v-else-if="Number(orderInfo.payWay) == 2" class="tip-text online-tip">此单余额付款,审核通过后钱将退回账户余额</text>
-				<text v-else-if="Number(orderInfo.payWay) == 3 || Number(orderInfo.debt) == 1" class="tip-text debt-tip">此单挂账,审核通过后挂账金额会相应减少</text>
-				<text v-else class="tip-text offline-tip">此单线下付款,审核通过后需商家确认退回方式</text>
-			</view>
-
 			<!-- 备注 -->
 			<view class="card-section">
 				<view class="section-title">
@@ -232,28 +218,16 @@ export default {
 			apply: null,
 			canApply: 0,
 			refundDeadlineTip: '',
-			submitting: false,
-			// 已取消后点「重新申请」进入表单,提交时把原记录改回待审核
-			reapplying: false
+			submitting: false
 		}
 	},
 	computed: {
-		/** 是否展示申请进度;重新申请中不锁在进度页 */
+		/**
+		 * 仅有待审核申请时展示进度页并禁止再提交
+		 * 已取消/通过/驳回都不锁表单,可直接填写提交(后端无待审才放行)
+		 */
 		showApplyProgress() {
-			if (!this.apply || !this.apply.id) {
-				return false
-			}
-			if (this.reapplying) {
-				return false
-			}
-			return true
-		},
-		/** 已取消且订单仍可售后时允许重新申请 */
-		canReapply() {
-			if (!this.apply || !this.apply.id) {
-				return false
-			}
-			return Number(this.apply.status) === 3 && Number(this.canApply) === 1
+			return !!(this.apply && this.apply.id && Number(this.apply.status) === 0)
 		},
 		/** 是否展示已退金额行(避免模板里写 > 比较,兼容小程序 WXML) */
 		hasTkPrice() {
@@ -455,33 +429,15 @@ export default {
 		goBack() {
 			uni.navigateBack({ delta: 1 })
 		},
-		/**
-		 * 表单取消:重新申请中退回已取消进度页,首次申请则离开本页
-		 */
+		/** 表单取消:离开本页 */
 		onFormCancel() {
-			if (this.reapplying) {
-				this.reapplying = false
-				return
-			}
 			this.goBack()
 		},
-		/**
-		 * 已取消后重新申请:切到表单,提交时后端把该记录改回待审核
-		 */
-		startReapply() {
-			if (!this.canReapply) {
-				return
-			}
-			this.reapplying = true
-			this.remark = ''
-			this.refundType = 1
-		},
 		/** 切换为只退款 */
 		onOnlyRefund() {
 			this.refundType = 2
 		},
 		init() {
-			this.reapplying = false
 			const id = this.option.id
 			if (!id) {
 				this.$msg('缺少订单信息')
@@ -589,19 +545,19 @@ export default {
 			const money = Number(this.refundMoney) || 0
 			let title = '确认提交'
 			let content = money > 0
-				? '申请退款 ¥' + this.refundMoney + ',提交后需商家审核'
-				: '订单实付为0,提交后将申请退回红包,需商家审核'
+				? '确认申请退款 ¥' + this.refundMoney
+				: '订单实付为0,提交后将申请退回红包'
 			// 按支付方式补充去向说明(对齐采购售后确认弹窗)
 			if (money > 0) {
 				if (Number(this.orderInfo.onlinePay) == 2) {
-					content = '此单线上付款,审核通过后钱将原路退回。申请退款 ¥' + this.refundMoney + '?'
+					content = '确认申请退款 ¥' + this.refundMoney + '?'
 				} else if (Number(this.orderInfo.payWay) == 2) {
-					content = '此单余额付款,审核通过后钱将退回余额。申请退款 ¥' + this.refundMoney + '?'
+					content = '确认申请退款 ¥' + this.refundMoney + '?'
 				} else if (Number(this.orderInfo.payWay) == 3 || Number(this.orderInfo.debt) == 1) {
-					content = '此单挂账,审核通过后挂账金额会减少。申请退款 ¥' + this.refundMoney + '?'
+					content = '确认申请退款 ¥' + this.refundMoney + '?'
 				} else {
 					title = '特别注意'
-					content = '此单线下付款,审核通过后需商家确认退回方式。申请退款 ¥' + this.refundMoney + '?'
+					content = '确认申请退款 ¥' + this.refundMoney + '?'
 				}
 			}
 			uni.showModal({