|
@@ -209,6 +209,7 @@
|
|
payStatus==2 ? '生成订单生成成功,请点击调取扫码盒子' :
|
|
payStatus==2 ? '生成订单生成成功,请点击调取扫码盒子' :
|
|
payStatus==4 ? '扫码支付失败!!!' :
|
|
payStatus==4 ? '扫码支付失败!!!' :
|
|
payStatus==5 ? '请出示付款码!!!' :
|
|
payStatus==5 ? '请出示付款码!!!' :
|
|
|
|
+ payStatus==5.5 ? '扫码失败,请刷新付款码,再进行扫码!!!' :
|
|
payStatus==6 ? '连接扫码器失败!!!' :
|
|
payStatus==6 ? '连接扫码器失败!!!' :
|
|
payStatus==7 ? '用户支付失败或未支付,请重新连接支付!!!' :
|
|
payStatus==7 ? '用户支付失败或未支付,请重新连接支付!!!' :
|
|
payStatus==8 ? '用户支付成功,请点击打印票!!!' :
|
|
payStatus==8 ? '用户支付成功,请点击打印票!!!' :
|
|
@@ -348,6 +349,9 @@ import {
|
|
|
|
|
|
balance: null, // 授信额度
|
|
balance: null, // 授信额度
|
|
grantQuota: null, // 授信使用额度
|
|
grantQuota: null, // 授信使用额度
|
|
|
|
+
|
|
|
|
+ code: null, // 支付code
|
|
|
|
+ codeTime: null // 检测是websocket是否还在连接
|
|
};
|
|
};
|
|
|
|
|
|
},
|
|
},
|
|
@@ -488,6 +492,8 @@ import {
|
|
},
|
|
},
|
|
/** 取消订单 */
|
|
/** 取消订单 */
|
|
async orderInfoCancelFun(type){
|
|
async orderInfoCancelFun(type){
|
|
|
|
+ // let payStatus = this.payStatus
|
|
|
|
+ // this.payStatus = null
|
|
try {
|
|
try {
|
|
this.loading = true
|
|
this.loading = true
|
|
this.loadingText = "取消订单中..."
|
|
this.loadingText = "取消订单中..."
|
|
@@ -496,6 +502,11 @@ import {
|
|
}).then((res)=>{
|
|
}).then((res)=>{
|
|
if(res.code==200) {
|
|
if(res.code==200) {
|
|
if(type){ // 关闭弹窗
|
|
if(type){ // 关闭弹窗
|
|
|
|
+ if(this.codeTime) {
|
|
|
|
+ clearInterval(this.codeTime)
|
|
|
|
+ }
|
|
|
|
+ this.orderId = null
|
|
|
|
+ this.payStatus = null
|
|
this.$emit('clearDialogVisible')
|
|
this.$emit('clearDialogVisible')
|
|
this.dialogVisible = false
|
|
this.dialogVisible = false
|
|
}else {
|
|
}else {
|
|
@@ -503,6 +514,8 @@ import {
|
|
this.loading = false
|
|
this.loading = false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ }else {
|
|
|
|
+
|
|
}
|
|
}
|
|
}).catch(()=>{
|
|
}).catch(()=>{
|
|
this.$message.error('订单关闭失败!!!');
|
|
this.$message.error('订单关闭失败!!!');
|
|
@@ -975,6 +988,7 @@ import {
|
|
this.loading = true
|
|
this.loading = true
|
|
this.loadingText = "连接扫码盒子中!!!"
|
|
this.loadingText = "连接扫码盒子中!!!"
|
|
this.payStatus = null
|
|
this.payStatus = null
|
|
|
|
+ this.code = null
|
|
this.websocketClear()
|
|
this.websocketClear()
|
|
console.log('sdfdsfsd')
|
|
console.log('sdfdsfsd')
|
|
if (!this.websocket_connected) {
|
|
if (!this.websocket_connected) {
|
|
@@ -982,7 +996,7 @@ import {
|
|
this.websocketCtrl = new WebSocket(host,'ctrl');
|
|
this.websocketCtrl = new WebSocket(host,'ctrl');
|
|
this.websocketData = new WebSocket(host,'data');
|
|
this.websocketData = new WebSocket(host,'data');
|
|
this.websocketData.onopen = (evt) => {
|
|
this.websocketData.onopen = (evt) => {
|
|
- console.log('sdasdasd====',evt)
|
|
|
|
|
|
+ console.log('连接结果====',evt)
|
|
this.loading = false
|
|
this.loading = false
|
|
this.payStatus = 5
|
|
this.payStatus = 5
|
|
this.websocket_connected = true;
|
|
this.websocket_connected = true;
|
|
@@ -993,7 +1007,11 @@ import {
|
|
this.payStatus = 6
|
|
this.payStatus = 6
|
|
//this.vbar_open()
|
|
//this.vbar_open()
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ this.websocketData.onclose = (evt) => {
|
|
|
|
+ console.log('关闭 ==== ',evt)
|
|
|
|
+ // this.payStatus = 6
|
|
|
|
+ //this.vbar_open()
|
|
|
|
+ }
|
|
this.websocketData.onmessage = (evt) => {
|
|
this.websocketData.onmessage = (evt) => {
|
|
console.log("接受消息====",evt)
|
|
console.log("接受消息====",evt)
|
|
this.websocket_decode(evt.data);
|
|
this.websocket_decode(evt.data);
|
|
@@ -1004,17 +1022,32 @@ import {
|
|
},
|
|
},
|
|
/** 连接结果 */
|
|
/** 连接结果 */
|
|
websocket_open_state(message){
|
|
websocket_open_state(message){
|
|
|
|
+ console.log("连接结果 ===== ",message)
|
|
|
|
+ this.codeTime = setInterval(()=>{
|
|
|
|
+ console.log("检测是否连接")
|
|
|
|
+ if(this.websocketData.readyState != WebSocket.OPEN) {
|
|
|
|
+ this.payStatus = 6
|
|
|
|
+ }
|
|
|
|
+ },3000)
|
|
//document.getElementById('wsocket').value = "已连接";
|
|
//document.getElementById('wsocket').value = "已连接";
|
|
},
|
|
},
|
|
//接收扫码结果处理
|
|
//接收扫码结果处理
|
|
websocket_decode(code){
|
|
websocket_decode(code){
|
|
- console.log()
|
|
|
|
- if(this.orderId && this.payStatus==5 &&code) {
|
|
|
|
|
|
+ console.log("code=========",this.orderId , code)
|
|
|
|
+ if(this.orderId && (this.payStatus==5 ||this.payStatus == 5.5) &&code) {
|
|
|
|
+ if(this.codeTime) {
|
|
|
|
+ clearInterval(this.codeTime)
|
|
|
|
+ }
|
|
this.gotoMicroPayFun(this.orderId,code)
|
|
this.gotoMicroPayFun(this.orderId,code)
|
|
|
|
+ }else if(!code){
|
|
|
|
+ this.payStatus = 5.5
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/** 关闭通讯 */
|
|
/** 关闭通讯 */
|
|
websocketClear(){
|
|
websocketClear(){
|
|
|
|
+ if(this.codeTime) {
|
|
|
|
+ clearInterval(this.codeTime)
|
|
|
|
+ }
|
|
if(this.websocketCtrl){
|
|
if(this.websocketCtrl){
|
|
this.websocketCtrl.close()
|
|
this.websocketCtrl.close()
|
|
}
|
|
}
|