|
|
@@ -4,7 +4,7 @@
|
|
|
<view class="collect-code_box">
|
|
|
<image class="img" :src="`${constant.imgUrl}/icon/scan/scan.png`" mode="scaleToFill" />
|
|
|
<view class="show-code">请出示付款码</view>
|
|
|
- <view class="btn-default result">查询结果</view>
|
|
|
+ <view class="btn-default result" @click="checkPay()">查询结果</view>
|
|
|
<view @click="cancelPay" class="btn-default result">取消</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -13,14 +13,14 @@
|
|
|
<view class="result-view">
|
|
|
<view class="iconfont iconchenggong"></view>
|
|
|
<view class="result-title">付款成功</view>
|
|
|
- <button class="admin-button-com mini-btn default">返回</button>
|
|
|
+ <button class="admin-button-com mini-btn default" @click="payFinish()">返回</button>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { codePay} from "@/api/order/index";
|
|
|
+import { codePay,codePayCheck} from "@/api/order/index";
|
|
|
export default {
|
|
|
name:'toPayWay',
|
|
|
components:{
|
|
|
@@ -39,13 +39,30 @@ export default {
|
|
|
mounted(){
|
|
|
let that = this
|
|
|
//避免重复,每次进来先移除全局自定义事件监听器
|
|
|
- uni.$off('listenGetScanCode')
|
|
|
+ uni.$off('listenGetScanCode')
|
|
|
uni.$on('listenGetScanCode',function(data){
|
|
|
that.requestCodePay(data.code)
|
|
|
})
|
|
|
},
|
|
|
methods:{
|
|
|
- //付款码付款
|
|
|
+ //查询付款结果
|
|
|
+ checkPay(){
|
|
|
+ let that = this
|
|
|
+ uni.showLoading({title: '查询中',mask:true})
|
|
|
+ codePayCheck({id:this.orderId}).then(res=>{
|
|
|
+ uni.hideLoading()
|
|
|
+ console.log(res)
|
|
|
+ if(res.code == 1){
|
|
|
+ if(res.data.returnStatus == 'SUCCESS'){
|
|
|
+ that.showSuccess = true
|
|
|
+ setTimeout(function(){
|
|
|
+ that.payFinish()
|
|
|
+ },1500)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //付款
|
|
|
requestCodePay(authCode){
|
|
|
let that = this
|
|
|
uni.showLoading({title: '正在付款',mask:true})
|
|
|
@@ -53,11 +70,17 @@ export default {
|
|
|
uni.hideLoading()
|
|
|
if(res.code == 1){
|
|
|
if(res.data.returnStatus == 'SUCCESS'){
|
|
|
-
|
|
|
+ that.showSuccess = true
|
|
|
+ setTimeout(function(){
|
|
|
+ that.payFinish()
|
|
|
+ },1500)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ payFinish(){
|
|
|
+ this.$emit('payFinish')
|
|
|
+ },
|
|
|
cancelPay(){
|
|
|
this.$emit('cancelPay')
|
|
|
}
|