Explorar o código

feat(mall): 优化余额明细与售后申请流程

- 余额变动页切换为客户付款明细接口,展示对应店铺的资金记录
- 支持已撤销售后重新填写并提交,同时透传订单店铺账号上下文
- 个人首页每次回到前台时刷新花店列表,及时同步余额与营业状态
shizhongqi hai 14 horas
pai
achega
d29ffe6bae

+ 4 - 0
mallApp/src/api/custom/index.js

@@ -6,4 +6,8 @@ export const initCustom = data => {
 
 export const getBalanceChangeList = data => {
 	return https.get('/balance-change/list', data)
+}
+
+export const getBalancePayChangeDetail = data => {
+	return https.get('/balance-change/balance-pay-change', data)
 }

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

@@ -9,7 +9,7 @@ export const getRefundData = data => {
 	return https.get('/refund/get-refund-data', data)
 }
 
-/** 顾客提交售后申请(待审核) */
+/** 顾客提交售后申请;若上次已取消则把该记录改回待审核 */
 export const createRefund = data => {
 	return https.post('/refund/create-order', data)
 }

+ 2 - 2
mallApp/src/pages/balance/changeList.vue

@@ -40,7 +40,7 @@
     </template>
     <script>
     import AppWrapperEmpty from "@/components/app-wrapper-empty";
-    import { getBalanceChangeList } from '@/api/custom'
+    import { getBalanceChangeList, getBalancePayChangeDetail } from '@/api/custom'
     import list from '@/mixins/list'
     export default {
         name: "balanceChange",
@@ -70,7 +70,7 @@
             },
             async init(){
                 let hdId = this.option.hdId ? this.option.hdId : 0
-                const res = await getBalanceChangeList({ page:this.list.page,hdId:hdId })
+                const res = await getBalancePayChangeDetail({ page:this.list.page, hdId:hdId})
                 if (this.$util.isEmpty(res.data.list)){
                     this.completes(res)
                     return

+ 15 - 13
mallApp/src/pages/home/recent.vue

@@ -1,6 +1,7 @@
 <!--
   个人首页
   未登录展示服务说明与登录引导(符合审核可先浏览);已登录管理真实花店,并在列表加载后接收尚未通知的红包到账提醒。
+  已登录时每次打开或回到前台都会重新请求花店列表,保证余额、休店状态与列表本身是最新的。
 -->
 <template>
   <view class="page-container">
@@ -259,14 +260,11 @@ export default {
     } else {
       this.loginStyle = 0;
     }
-    if (this.pageAction.refresh == 1) {
-      this.resetList();
-      this.init();
-      this.pageAction.refresh = 0;
-    }
-    if (this.loginStyle == 1 && !this.$util.isEmpty(this.list.data)) {
-      this.checkHbArrival();
+    // 切 Tab、从子页返回、App 回前台都会进 onShow,已登录则立刻重拉花店列表
+    if (this.loginStyle == 1) {
+      this.refreshMyHdList();
     }
+    this.pageAction.refresh = 0;
   },
   onPullDownRefresh() {
     this.resetList();
@@ -284,6 +282,9 @@ export default {
     this.toBottom();
   },
   methods: {
+    init() {
+      this.getLoginInfo()
+    },
     /**
      * 未登录引导页点击登录:自愿进入授权页,登录成功后可按 needBack 返回本页。
      */
@@ -351,8 +352,13 @@ export default {
     hasDelHd(){
       this.pageTo({ url: "/pages/hd/hasDel" });
     },
-    init() {
-      this.getLoginInfo()
+    /**
+     * 从第 1 页重新请求花店列表。
+     * 不清空现有 list.data,避免切回本页时先闪「暂无花店」;completes 在 page=1 时会整表替换。
+     */
+    refreshMyHdList() {
+      this.list.page = 1;
+      this.list.finished = false;
       this.getMyHdList()
     },
     /**
@@ -946,10 +952,6 @@ page {
         border-bottom: none;
       }
 
-      /* &:active {
-        background-color: #f8f9fa;
-      } */
-
       &.cancel {
         color: #999;
       }

+ 1 - 1
mallApp/src/pages/order/detail.vue

@@ -222,7 +222,7 @@ export default {
         uni.showToast({ title: "分销佣金已结算,无法申请售后", icon: "none" });
         return;
       }
-      this.$util.pageTo({ url: "/pages/order/refund?id=" + this.data.id });
+      this.$util.pageTo({ url: "/pages/order/refund?account=" + this.option.account + "&id=" + this.data.id });
     },
     init() {
       this.getDetail().then(() => {

+ 50 - 4
mallApp/src/pages/order/refund.vue

@@ -1,11 +1,12 @@
 <!--
   商城订单申请售后页
   供订单详情「申请售后」进入;顾客勾选商品/金额后提交待审核申请,商家在 hdApp 审核
+  撤销后仍可重新申请:把已取消记录改回待审核
 -->
 <template>
 	<view class="refund-page">
-		<!-- 已有申请:展示进度 -->
-		<template v-if="apply && apply.id">
+		<!-- 已有申请:展示进度(点「重新申请」后切到表单) -->
+		<template v-if="showApplyProgress">
 			<view class="card-section">
 				<view class="section-title">
 					<text class="title-text">申请进度</text>
@@ -33,6 +34,10 @@
 			<view class="bottom-actions" v-if="apply.status == 0">
 				<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>
 			</view>
@@ -184,7 +189,7 @@
 			</view>
 
 			<view class="bottom-actions">
-				<button class="action-btn cancel-btn" @tap="goBack">取消</button>
+				<button class="action-btn cancel-btn" @tap="onFormCancel">取消</button>
 				<button class="action-btn confirm-btn" @tap="askSubmit">提交申请</button>
 			</view>
 		</template>
@@ -207,10 +212,29 @@ export default {
 			apply: null,
 			canApply: 0,
 			refundDeadlineTip: '',
-			submitting: false
+			submitting: false,
+			// 已取消后点「重新申请」进入表单,提交时把原记录改回待审核
+			reapplying: 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
+		},
 		/** 是否展示已退金额行(避免模板里写 > 比较,兼容小程序 WXML) */
 		hasTkPrice() {
 			return Number(this.orderInfo.tkPrice) > 0
@@ -267,11 +291,33 @@ 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('缺少订单信息')