|
@@ -1,22 +1,23 @@
|
|
import {
|
|
import {
|
|
createAndroidOrder,
|
|
createAndroidOrder,
|
|
- payQrCode
|
|
|
|
|
|
+ payQrCode,
|
|
|
|
+ pollingOrder
|
|
} from '~/api/global'
|
|
} from '~/api/global'
|
|
|
|
+let polling
|
|
Component({
|
|
Component({
|
|
properties: {
|
|
properties: {
|
|
|
|
|
|
},
|
|
},
|
|
data: {
|
|
data: {
|
|
- show: true,
|
|
|
|
qrCode: '',
|
|
qrCode: '',
|
|
product: {}
|
|
product: {}
|
|
},
|
|
},
|
|
lifetimes: {
|
|
lifetimes: {
|
|
attached() {
|
|
attached() {
|
|
- /* this.selectComponent("#popUp").showModal()
|
|
|
|
- this.getTabBar().setData({
|
|
|
|
- show: false
|
|
|
|
- }) */
|
|
|
|
|
|
+ /* this.selectComponent("#popUp").showModal()
|
|
|
|
+ this.getTabBar().setData({
|
|
|
|
+ show: false
|
|
|
|
+ }) */
|
|
},
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -33,17 +34,29 @@ Component({
|
|
show: false
|
|
show: false
|
|
})
|
|
})
|
|
this.setData({
|
|
this.setData({
|
|
- show: true,
|
|
|
|
product,
|
|
product,
|
|
qrCode
|
|
qrCode
|
|
})
|
|
})
|
|
this.selectComponent("#popUp").showModal()
|
|
this.selectComponent("#popUp").showModal()
|
|
|
|
+ polling = setInterval(async () => {
|
|
|
|
+ let res = await pollingOrder(orderId)
|
|
|
|
+ if (res.payStatus == 'SUCCESS') {
|
|
|
|
+ this.triggerEvent('paySuccess')
|
|
|
|
+ this.close()
|
|
|
|
+ }
|
|
|
|
+ }, 2000);
|
|
},
|
|
},
|
|
- close() {
|
|
|
|
- this.setData({
|
|
|
|
- show: false,
|
|
|
|
|
|
+ closeEvent() {
|
|
|
|
+ this.getTabBar().setData({
|
|
|
|
+ show: true
|
|
})
|
|
})
|
|
|
|
+ clearInterval(polling)
|
|
|
|
+ },
|
|
|
|
+ close() {
|
|
this.selectComponent("#popUp").hideModal()
|
|
this.selectComponent("#popUp").hideModal()
|
|
|
|
+ this.getTabBar().setData({
|
|
|
|
+ show: true
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|