+
+
{{ textstatus }}
@@ -20,19 +20,20 @@
-
+
-
+
壳牌
- {{ hour }} : {{ minutes }}
- {{ seconds }}s
+ {{ hour }} : {{ minutes }}
+ {{ seconds }}s
提示:该二维码每隔3分钟自动刷新一次
@@ -41,18 +42,19 @@
请提醒加油员使用
- “{{showtitles}}”
+ “{{showtitles}}”
进行订单核销
{{errMsg}}
-
+
订单编号:
- {{order.orderSerialNumber?order.orderSerialNumber:''}}
+ {{order.orderSerialNumber?order.orderSerialNumber:''}}
@@ -63,7 +65,8 @@
油品油枪:
- {{order.oilsCode?order.oilsCode+' ':''}}&{{ order.gunName?order.gunName+'号枪': order.oilsBar?order.oilsBar+'号枪':'未选择油枪'}}
+ {{order.oilsCode?order.oilsCode+' ':''}}&{{ order.gunName?order.gunName+'号枪': order.oilsBar?order.oilsBar+'号枪':'未选择油枪'}}
+
加油升数:
@@ -92,16 +95,19 @@
星油优惠:
- {{order.oilDiscountAmount>0?order.oilDiscountAmount:'xxx.x'|moneyFormat}}
+ {{order.oilDiscountAmount>0?order.oilDiscountAmount:'xxx.x'|moneyFormat}}
优惠券:
- {{order.couponDiscountAmount>0?order.couponDiscountAmount:'xxx.x'|moneyFormat}}
+ {{order.couponDiscountAmount>0?order.couponDiscountAmount:'xxx.x'|moneyFormat}}
合计:
- {{order.realAmount>0?'¥'+order.realAmount:'xxx.x'}}
+ {{order.realAmount>0?'¥'+order.realAmount:'xxx.x'}}
@@ -121,13 +127,15 @@
+
-
+
@@ -139,23 +147,23 @@
export default {
components: {
ThirdPartyVoucher,
- tkiQrcode
+ tkiQrcode
},
data() {
const now = new Date()
return {
- foreground:'#000',
- oilItem:{},
- status:"",
- showtitles:"",
+ foreground: '#000',
+ oilItem: {},
+ status: "",
+ showtitles: "",
hour: now.getHours() < 10 ? '0' + now.getHours() : now.getHours(), //当小时为个为数时在在前加0(例:01),以下同理
minutes: now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes(),
seconds: now.getSeconds() < 10 ? '0' + now.getSeconds() : now.getSeconds(),
timer: null,
- showtext:true,
- showQr:false,
- val:'',
- textstatus:'正在支付中',
+ showtext: true,
+ showQr: false,
+ val: '',
+ textstatus: '正在支付中',
showThirdResult: false,
imgURL: this.global.imgURL,
status: 'fail',
@@ -167,96 +175,161 @@
tyPayMethod: null
}
},
+ onLoad(option) {
+ let _that = this
+ let oilItem = uni.getStorageSync('oilItem')
+ this.oilItem = oilItem
+ this.showtitles = oilItem.listTag
+ if (this.timer) {
+ clearInterval(this.timer)
+ }
+ setInterval(() => {
+ this.getTime()
+ }, 1000) //设置定时器,时时间每隔一秒钟走一次(即每秒)
+ this.timeinterval = setInterval(() => {
+ console.log('1')
+ _that.getOrderQrCode()
+ }, 1000 * 60 * 3);
+ // console.log(option)
+ this.getOrderQrCode()
+ if (option.payMethod == '1' && option.status == 'success') {
+ if (option.status == 'success') {
+ this.textstatus = '支付成功'
+ this.status = option.status
+ let oilItems = this.oilItem
+ let _that = this
+ if (oilItems.listTag == '万金油') {
+ _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/wanjinyou.mp3'
+ } else if (oilItems.listTag == '星油') {
+ _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/xingyouyunzhan.mp3'
+ } else if (oilItems.listTag == '壳牌') {
+ _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/qiaopainew.mp3'
+ } else if (oilItems.listTag == '上汽联名卡') {
+ _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/shangqi.mp3'
+ } else if (oilItems.listTag == '集卡加油') {
+ _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/shangqijika.mp3'
+ }
+ this.ContextAudio(this.audioUrl)
+ } else {
+ this.textstatus = '支付失败'
+ this.status = option.status
+ }
+ return
+ }
+ if (option.status == 'fail') {
+ this.textstatus = '支付失败'
+ this.status = option.status
+ this.errMsg = option.errMsg
+ return
+ }
+ if (this.order.payMethod && this.order.payMethod == 2) {
+ this.tyPayMethod = 2
+ this.queryOrderStatusSq()
+ return
+ }
+ },
methods: {
// 创建音频
- ContextAudio(url){
+ ContextAudio(url) {
this.innerAudioContext = uni.createInnerAudioContext();
this.innerAudioContext.autoplay = true;
this.innerAudioContext.src = url;
this.innerAudioContext.onPlay(() => {
- console.log('开始播放');
+ console.log('开始播放');
});
this.innerAudioContext.onError((res) => {
- console.log(res.errMsg);
- console.log(res.errCode);
+ console.log(res.errMsg);
+ console.log(res.errCode);
});
},
- getTime () {
- var date = new Date()
- this.hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
- this.minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
- this.seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
+ getTime() {
+ var date = new Date()
+ this.hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
+ this.minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
+ this.seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
},
newQrString() {
this.getOrderQrCode()
},
- getOrderQrCode(){
- console.log('这里是获取验证码')
- console.log(this.order.orderSerialNumber)
- oilSiteApi.getOrderQrCode(this.order.orderSerialNumber).then( (res)=>{
- console.log(res)
- if(res.code == 40000){
- console.log('34')
- this.showQr = false
- this.showtext=true
- }else if(res.code == 20000){
- console.log('12')
+ getOrderQrCode() {
+ oilSiteApi.getOrderQrCode(this.order.orderSerialNumber).then((res) => {
+ if (res.code == 40000) {
+ this.showQr = false
+ this.showtext = true
+ } else if (res.code == 20000) {
this.showQr = true
- this.showtext =false
- this.val =res.data.codeStr
- this.foreground = this.val.indexOf('SHLFC/V1')==-1?'#000':'#1A487E';
- console.log(this.foreground,'foreground')
+ this.showtext = false
+ this.val = res.data.codeStr
+ this.foreground = this.val.indexOf('SHLFC/V1') == -1 ? '#000' : '#1A487E';
}
- } )
+ })
},
// 三方支付结果弹窗开始
hideModal() {
this.showThirdResult = false
},
- getThirdStatus() {
- if (this.tyIntervalCount > 5 || this.tySqRes.otherOrderStatus != 0) {
- this.onShowThirdResult()
- } else {
- setTimeout(() => {
- this.queryOrderStatusSq()
- }, 500)
- }
- },
+
onShowThirdResult() {
this.showThirdResult = true
},
+ refresh() {
+ toilApi.getOrderInfoByOrderSerialNumber(this.order.orderSerialNumber).then(res => {
+ if (res.code === 20000) {
+ if (res.data.otherOrderStatus == 0) {
+ this.textstatus = '支付中'
+ } else if (res.data.otherOrderStatus == 1) {
+ this.textstatus = '支付成功'
+ this.status = "success"
+ if (this.oilItem.listTag == '万金油') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/wanjinyou.mp3'
+ } else if (this.oilItem.listTag == '星油') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/xingyouyunzhan.mp3'
+ } else if (this.oilItem.listTag == '壳牌') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/qiaopainew.mp3'
+ } else if (this.oilItem.listTag == '上汽联名卡') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/shangqi.mp3'
+ } else if (oilItems.listTag == '集卡加油') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/shangqijika.mp3'
+ }
+ this.ContextAudio(this.audioUrl)
+ } else if (res.data.otherOrderStatus == -1) {
+ this.textstatus = '三方支付失败,已退款'
+ }
+ }
+ })
+ },
// 上汽联名卡支付状态
queryOrderStatusSq() {
toilApi.queryOrderStatusSq(this.order.orderSerialNumber).then(res => {
- console.log(res)
if (res.code == 20000) {
this.tySqRes = res.data
this.tyIntervalCount++
- if (res.code == 20000) {
- console.log('进入')
- this.tySqRes = res.data
- this.tyIntervalCount++
- if(res.data.otherOrderStatus == 0){
- this.textstatus = '支付中'
- }else if(res.data.otherOrderStatus == 1){
- this.textstatus = '支付成功'
- this.status = "success"
- if(this.oilItem.listTag == '万金油'){
- this.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/wanjinyou.mp3'
- }else if(this.oilItem.listTag == '星油'){
- this.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/xingyouyunzhan.mp3'
- }else if(this.oilItem.listTag == '壳牌'){
- this.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/qiaopainew.mp3'
- }else if(this.oilItem.listTag == '上汽联名卡'){
- this.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/shangqi.mp3'
- }
- this.ContextAudio(this.audioUrl)
- }else if(res.data.otherOrderStatus == -1){
- this.textstatus = '三方支付失败,已退款'
+ if (res.data.otherOrderStatus == 0) {
+ this.textstatus = '支付中'
+ } else if (res.data.otherOrderStatus == 1) {
+ this.textstatus = '支付成功'
+ this.status = "success"
+ if (this.oilItem.listTag == '万金油') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/wanjinyou.mp3'
+ } else if (this.oilItem.listTag == '星油') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/xingyouyunzhan.mp3'
+ } else if (this.oilItem.listTag == '壳牌') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/qiaopainew.mp3'
+ } else if (this.oilItem.listTag == '上汽联名卡') {
+ this.audioUrl =
+ 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/shangqi.mp3'
}
- // otherOrderStatus //三方支付状态 0:待通知 1:通知成功 -1:通知失败
- // console.log('联名卡支付结果', res.data)
- this.getThirdStatus()
+ this.ContextAudio(this.audioUrl)
+ } else if (res.data.otherOrderStatus == -1) {
+ this.textstatus = '三方支付失败,已退款'
}
// otherOrderStatus //三方支付状态 0:待通知 1:通知成功 -1:通知失败
// console.log('联名卡支付结果', res.data)
@@ -264,7 +337,15 @@
}
})
},
-
+ getThirdStatus() {
+ if (this.tyIntervalCount > 5 || this.tySqRes.otherOrderStatus != 0) {
+ this.onShowThirdResult()
+ } else {
+ setTimeout(() => {
+ this.queryOrderStatusSq()
+ }, 500)
+ }
+ },
// 三方支付结果弹窗结束
backToIndex() {
uni.switchTab({
@@ -284,68 +365,10 @@
})
}
},
- onLoad(option) {
- let _that = this
- let oilItem = uni.getStorageSync('oilItem')
- this.oilItem = oilItem
- this.showtitles = oilItem.listTag
- if (this.timer) {
- clearInterval(this.timer)
- }
- setInterval(() => {
- this.getTime()
- },1000) //设置定时器,时时间每隔一秒钟走一次(即每秒)
- this.timeinterval = setInterval(() => {
- console.log('1')
- _that.getOrderQrCode()
- }, 1000 * 60 * 3);
- // this.status = option.status
- console.log('这里是op')
- console.log(option)
- this.getOrderQrCode()
- if(option.payMethod == '1' && option.status == 'success'){
- if(option.status == 'success') {
- console.log('这里是支付成功')
- this.textstatus = '支付成功'
- this.status = option.status
- console.log(this.oilItem)
- let oilItems = this.oilItem
- let _that = this
- if(oilItems.listTag == '万金油'){
- _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/wanjinyou.mp3'
- }else if(oilItems.listTag == '星油'){
- _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/xingyouyunzhan.mp3'
- }else if(oilItems.listTag == '壳牌'){
- _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/qiaopainew.mp3'
- }else if(oilItems.listTag == '上汽联名卡'){
- _that.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/shangqi.mp3'
- }
- this.ContextAudio(this.audioUrl)
- }else{
- console.log('这里是支付失败')
- this.textstatus = '支付失败'
- this.status = option.status
- }
- return
- }
- if(option.status == 'fail'){
- console.log('fail')
- this.textstatus = '支付失败'
- this.status = option.status
- this.errMsg = option.errMsg
- return
- }
- if (this.order.payMethod && this.order.payMethod == 2) {
- console.log('这里是则一')
- this.tyPayMethod = 2
- this.queryOrderStatusSq()
- return
- }
- },
+
filters: {
moneyFormath(value) {
- console.log(value)
- if (value != 'xxx.x') {
+ if (value != 'xxx.x') {
let number = value.toFixed(2)
return number
} else {
@@ -355,10 +378,10 @@
moneyFormat(value) {
if (value != 'xxx.x') {
// console.log('old:',value)
- let realAmount =(parseInt(value * 100) / 100).toFixed(2)
- // console.log('new:',realAmount)
+ let realAmount = (parseInt(value * 100) / 100).toFixed(2)
+ // console.log('new:',realAmount)
return realAmount
- } else {
+ } else {
return value
}
},
@@ -371,7 +394,7 @@
case 'WJY':
return '万金油'
case 'LV':
- return '其他'
+ return '其他'
case 'TY':
return '团油'
case 'YDJY':
@@ -379,35 +402,37 @@
}
}
},
- }
- ,
+ },
onHide() {
console.log('这里是hiden')
this.innerAudioContext.stop()
},
onUnload() {
console.log('这里是卸载页面')
- this.innerAudioContext.stop()
+ this.innerAudioContext.stop()
},
}