Browse Source

支付时间

shish 3 days ago
parent
commit
8e75e21d29
2 changed files with 21 additions and 6 deletions
  1. 15 6
      ghsApp/src/pagesOrder/refund.vue
  2. 6 0
      hdApp/src/pagesPurchase/refund.vue

+ 15 - 6
ghsApp/src/pagesOrder/refund.vue

@@ -338,6 +338,11 @@ export default {
 					return false
 				}
 			}
+			// 只用支付时间;无支付时间不能售后
+			if (!this.hasValidPayTime()) {
+				uni.showToast({ title: '订单无支付时间,不能售后', icon: 'none' })
+				return
+			}
 			this._pendingRefundParams = {
 				id:this.option.id,
 				product:JSON.stringify(product),
@@ -374,12 +379,20 @@ export default {
 				that.submitRefund(that._pendingRefundParams)
 			})
 		},
+		/** 是否有有效支付时间(与后端 hasValidPayTime 一致) */
+		hasValidPayTime() {
+			const payTime = (this.orderInfo && this.orderInfo.payTime) || ''
+			return !!payTime && payTime !== '0000-00-00 00:00:00'
+		},
 		/**
 		 * 本地判断是否必须隔天售后:非当天支付 / 已结账单 / 挂账已结清
-		 * 与后端 NextDayRefundService::mustUseNextDay 对齐,预检接口失败时仍能拦住
+		 * 仅用 payTime;无支付时间由 hasValidPayTime 先行拦截
 		 */
 		isMustNextDayOrder() {
 			const info = this.orderInfo || {}
+			if (!this.hasValidPayTime()) {
+				return false
+			}
 			if (Number(info.clearId) > 0) {
 				return true
 			}
@@ -388,11 +401,7 @@ export default {
 			if (debtPrice > 0 && remainDebt === 0) {
 				return true
 			}
-			const payTime = info.payTime || info.addTime || ''
-			if (!payTime || payTime === '0000-00-00 00:00:00') {
-				return false
-			}
-			const payDay = String(payTime).substr(0, 10)
+			const payDay = String(info.payTime).substr(0, 10)
 			const now = new Date()
 			const m = now.getMonth() + 1
 			const d = now.getDate()

+ 6 - 0
hdApp/src/pagesPurchase/refund.vue

@@ -266,6 +266,12 @@ export default {
 			uni.navigateBack({delta: 1});
 		},
 		confirmRefund(){
+			// 无支付时间的订单不允许售后(与后端 assertCanRefund 一致,仅认 payTime)
+			const payTime = (this.orderInfo && this.orderInfo.payTime) || ''
+			if (!payTime || payTime === '0000-00-00 00:00:00') {
+				uni.showToast({ title: '该订单无支付时间,不能售后', icon: 'none' })
+				return
+			}
 			let hasError = false
 			let product = []
 			let that = this