|
@@ -58,7 +58,7 @@
|
|
|
* 扫码支付组件(供货商收银机端)
|
|
* 扫码支付组件(供货商收银机端)
|
|
|
* 解决客户扫码后转圈状态被卡住、钱未到账的问题,支持网络异常降级和自动后台复查
|
|
* 解决客户扫码后转圈状态被卡住、钱未到账的问题,支持网络异常降级和自动后台复查
|
|
|
*/
|
|
*/
|
|
|
-import { codePay,codePayCheck,cancelOrderFn,getDetail} from "@/api/order";
|
|
|
|
|
|
|
+import { codePay,codePayCheck,codePayVerify,cancelOrderFn,getDetail} from "@/api/order";
|
|
|
export default {
|
|
export default {
|
|
|
name:'toPayWay',
|
|
name:'toPayWay',
|
|
|
components:{
|
|
components:{
|
|
@@ -164,7 +164,7 @@ export default {
|
|
|
this.remindText = ''
|
|
this.remindText = ''
|
|
|
this.returnCode = ''
|
|
this.returnCode = ''
|
|
|
this.clearPolling() // 每次开始扫码前,确保清除旧的定时器
|
|
this.clearPolling() // 每次开始扫码前,确保清除旧的定时器
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
codePay({id:this.orderId,authCode:authCode}).then(res=>{
|
|
codePay({id:this.orderId,authCode:authCode}).then(res=>{
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|
|
|
if(res.data.returnStatus == 'SUCCESS'){
|
|
if(res.data.returnStatus == 'SUCCESS'){
|
|
@@ -201,7 +201,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 启动自动后台付款复查定时器
|
|
* 启动自动后台付款复查定时器
|
|
|
- * 职责:降低轮询频率至4秒,且将次数限为5次(总计20秒),极大地减轻服务器压力的同时保证业务完整
|
|
|
|
|
|
|
+ * 职责:降低轮询频率至4秒,且将次数限为4次(总计16秒),极大地减轻服务器压力的同时保证业务完整
|
|
|
*/
|
|
*/
|
|
|
startPolling(){
|
|
startPolling(){
|
|
|
this.clearPolling()
|
|
this.clearPolling()
|
|
@@ -212,7 +212,7 @@ export default {
|
|
|
let that = this
|
|
let that = this
|
|
|
this.pollingTimer = setInterval(() => {
|
|
this.pollingTimer = setInterval(() => {
|
|
|
that.pollingCount++
|
|
that.pollingCount++
|
|
|
- if (that.pollingCount > 5) {
|
|
|
|
|
|
|
+ if (that.pollingCount > 4) {
|
|
|
// 超时未确认,停止轮询,允许商户手动操作或重新扫码
|
|
// 超时未确认,停止轮询,允许商户手动操作或重新扫码
|
|
|
that.clearPolling()
|
|
that.clearPolling()
|
|
|
that.isPaymentProcessing = false
|
|
that.isPaymentProcessing = false
|
|
@@ -222,9 +222,9 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 界面上展示当前自动复查的进度,提升收银员体验
|
|
// 界面上展示当前自动复查的进度,提升收银员体验
|
|
|
- that.remindText = `正在自动复查支付结果 (第 ${that.pollingCount}/5 次)...`
|
|
|
|
|
-
|
|
|
|
|
- codePayCheck({id:that.orderId}).then(res=>{
|
|
|
|
|
|
|
+ that.remindText = `正在自动复查支付结果 (第 ${that.pollingCount}/4 次)...`
|
|
|
|
|
+
|
|
|
|
|
+ codePayVerify({id:that.orderId}).then(res=>{
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|
|
|
if(res.data && res.data.returnStatus == 'SUCCESS'){
|
|
if(res.data && res.data.returnStatus == 'SUCCESS'){
|
|
|
// 复查确认成功,停止轮询并显示成功界面
|
|
// 复查确认成功,停止轮询并显示成功界面
|