Просмотр исходного кода

Merge branch 'redesign‌-260706' of http://git.huaml.com/zhh/front-end into redesign‌-260706

ouyang 13 часов назад
Родитель
Сommit
2c4b0c1612

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

@@ -21,7 +21,7 @@ export const getList = data => {
 
 /** *
  * 订单详情 m
- * canApplyRefund:可否新开售后;refundApplyId:最新顾客申请,有值则详情页展示「查看申请」
+ * canApplyRefund:可否新开售后;现金为 0 时需 hbId>0 且 hbAmount>实付;refundApplyId:最新顾客申请,有值则详情页展示「查看申请」
  */
 export const getDetail = data => {
 	return https.get('/order/detail', data)

+ 4 - 2
mallApp/src/pages/order/detail.vue

@@ -149,7 +149,7 @@
 <script>
 /**
  * 商城订单详情
- * 底部「申请售后」看 canApplyRefund;待审核/已有申请用 get-refund-data 的 apply 展示「查看申请」
+ * 底部「申请售后」看 canApplyRefund(现金为 0 时需红包未退回且红包金额大于实付);待审核/已有申请用 get-refund-data 的 apply 展示「查看申请」
  */
 import { mapGetters } from "vuex";
 import orderItem from "@/components/module/app-order-item";
@@ -178,6 +178,7 @@ export default {
     ...mapGetters({ shopUser: "getShopUser" }),
     /**
      * 是否展示申请售后:优先用详情 canApplyRefund,与后端 RefundController 一致
+     * 现金为 0 时:红包仍挂单且红包金额大于订单实付才展示
      */
     showRefundBtn() {
       const d = this.data || {};
@@ -199,7 +200,8 @@ export default {
       }
       const could = Number(d.orderPrice || 0) - Number(d.tkPrice || 0);
       if (could <= 0) {
-        return false;
+        const payAmount = Number(d.mainPay != null ? d.mainPay : d.orderPrice) || 0;
+        return Number(d.hbId || 0) > 0 && Number(d.hbAmount || 0) > payAmount;
       }
       return true;
     },

+ 23 - 3
mallApp/src/pages/order/refund.vue

@@ -1,8 +1,9 @@
-<!--
+	<!--
   商城订单申请售后页
   供订单详情「申请售后」进入;顾客勾选商品/金额后提交待审核申请,商家在 hdApp 审核
   撤销后仍可重新申请:把已取消记录改回待审核
   退货并退款金额:普通商品按勾选原价分摊会员折/满减;秒杀、团购按活动单价退,不再叠整单优惠
+  红包全额抵扣导致实付为 0 时仍可申请:提交 0 元,审核通过后退回红包
 -->
 <template>
 	<view class="refund-page">
@@ -286,6 +287,21 @@ export default {
 				return 0
 			}
 			return parseFloat(capped.toFixed(2))
+		},
+		/**
+		 * 现金为 0 仍可提交:红包未退回,且红包金额大于订单实付(与后端 canApplyRefund 一致)
+		 */
+		allowZeroCashRefund() {
+			if (!(Number(this.orderInfo.hbId) > 0)) {
+				return false
+			}
+			if (Number(this.couldRefundPrice) > 0) {
+				return false
+			}
+			const payAmount = Number(
+				this.orderInfo.mainPay != null ? this.orderInfo.mainPay : this.orderInfo.orderPrice
+			) || 0
+			return Number(this.orderInfo.hbAmount || 0) > payAmount
 		}
 	},
 	methods: {
@@ -554,7 +570,7 @@ export default {
 					return
 				}
 			}
-			if (Number(this.refundMoney) <= 0) {
+			if (!(Number(this.refundMoney) > 0) && !this.allowZeroCashRefund) {
 				this.$msg('退款金额必须大于0')
 				return
 			}
@@ -562,9 +578,13 @@ export default {
 				this.$msg('退款金额超过可退金额')
 				return
 			}
+			const money = Number(this.refundMoney) || 0
+			const content = money > 0
+				? '申请退款 ¥' + this.refundMoney + ',提交后需商家审核'
+				: '订单实付为0,提交后将申请退回红包,需商家审核'
 			uni.showModal({
 				title: '确认提交',
-				content: '申请退款 ¥' + this.refundMoney + ',提交后需商家审核',
+				content: content,
 				success: res => {
 					if (res.confirm) {
 						this.doSubmit(selectProduct)