|
|
@@ -94,7 +94,19 @@ export default {
|
|
|
onReady() {
|
|
|
uni.$on(this.typescan,(data)=>{
|
|
|
if (!this.$util.isEmpty(data.result)){
|
|
|
- this.requestCodePay(data.result)
|
|
|
+
|
|
|
+ let payCode = res.result
|
|
|
+ let newPayCode = payCode.replace(/\s+/g, "")
|
|
|
+ if(that.$util.isEmpty(newPayCode)){
|
|
|
+ that.$msg('没扫到,请重新扫哦')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(!that.isAllDigits(newPayCode)){
|
|
|
+ that.$msg('没扫到,请重新扫')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ this.requestCodePay(newPayCode)
|
|
|
}else{
|
|
|
this.$msg('扫码没有成功')
|
|
|
}
|
|
|
@@ -125,10 +137,24 @@ export default {
|
|
|
uni.scanCode({
|
|
|
onlyFromCamera: true,
|
|
|
success: function (res) {
|
|
|
- that.requestCodePay(res.result)
|
|
|
+ let payCode = res.result
|
|
|
+ let newPayCode = payCode.replace(/\s+/g, "")
|
|
|
+ if(that.$util.isEmpty(newPayCode)){
|
|
|
+ that.$msg('没扫到,请重新扫哦')
|
|
|
+ return false
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(!that.isAllDigits(newPayCode)){
|
|
|
+ that.$msg('没扫到,请重新扫')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ that.requestCodePay(newPayCode)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ isAllDigits(str) {
|
|
|
+ return /^\d+$/.test(str)
|
|
|
+ },
|
|
|
//付款
|
|
|
requestCodePay(authCode){
|
|
|
let that = this
|