shish 3 лет назад
Родитель
Сommit
200f108b5a
1 измененных файлов с 63 добавлено и 19 удалено
  1. 63 19
      hdPad/src/pages/home/components/toPay.vue

+ 63 - 19
hdPad/src/pages/home/components/toPay.vue

@@ -4,8 +4,13 @@
             <view class="collect-code_box">
                 <image class="img" :src="`${constant.imgUrl}/icon/scan/scan.png`" mode="scaleToFill" />
                 <view style="margin-top:20upx;font-weight:bold;font-size:35upx;color:black;">¥{{price}}</view>
-                <view class="show-code">请出示付款码</view>
-                <view @click="cancelPayFn" class="btn-default result">关闭</view>
+                <view class="show-code" v-if="goPay == 0">请出示付款码</view>
+                <view class="paying" v-if="goPay == 1">付款中</view>
+                <image style="width:40upx;height:40upx;position:absolute;top:200upx;left:165upx;" :src="`${constant.imgUrl}/icon/loading.gif`" v-if="goPay == 1" mode="scaleToFill" />
+                <view style="margin-top:30upx;">
+                    <view @click="cancelPayFn" class="btn-default">取消</view>
+                    <view @click="manualCheck()" style="margin-left:20upx;background-color:#3385FF;color:white;" class="btn-default">手动查结果</view>
+                </view>
             </view>
         </view>
         <view v-else>
@@ -17,13 +22,13 @@
         </view>
 
         <uni-popup ref="cancelPayRef" type="dialog">
-            <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认关闭?" @confirm="confirmToCancel"></uni-popup-dialog>
+            <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认取消?" @confirm="confirmToCancel"></uni-popup-dialog>
         </uni-popup>
 
     </view>
 </template>
 <script>
-import { codePay,codePayCheck} from "@/api/order/index";
+import { codePay,codePayCheck,cancelOrderFn} from "@/api/order";
 export default {
     name:'toPayWay',
     components:{
@@ -31,7 +36,8 @@ export default {
     data(){
         return {
             showSuccess:false,
-            T:null
+            T:null,
+            goPay:0
         }
     },
 	props: {
@@ -53,6 +59,23 @@ export default {
         })
 	},
     methods:{
+        manualCheck(){
+            let that = this
+            codePayCheck({id:this.orderId}).then(res=>{
+                if(res.code == 1){
+                    if(res.data.returnStatus == 'SUCCESS'){
+                        uni.hideLoading()
+                        that.showSuccess = true
+                        clearInterval(that.T)
+                        setTimeout(function(){
+                            that.payFinish()
+                        },1500)
+                        return
+                    }
+                }
+                that.$msg('没有付款,请跟客户确认')
+            })
+        },
         //查询付款结果
         checkPay(){
             let that = this
@@ -73,12 +96,11 @@ export default {
         //付款
         requestCodePay(authCode){
             let that = this
-            uni.showLoading({title: '付款中'})
+            this.goPay = 1
             codePay({id:this.orderId,authCode:authCode}).then(res=>{
                 if(res.code == 1){
                     if(res.data.returnStatus == 'SUCCESS'){
                         that.showSuccess = true
-                        uni.hideLoading()
                         setTimeout(function(){
                             that.payFinish()
                         },1500)
@@ -102,8 +124,27 @@ export default {
             that.$refs.cancelPayRef.open('center')
         },
         confirmToCancel(){
-            clearInterval(this.T)
-            this.$emit('cancelPay')
+            let that = this
+            codePayCheck({id:this.orderId}).then(res=>{
+                if(res.code == 1){
+                    if(res.data.returnStatus == 'SUCCESS'){
+                        uni.hideLoading()
+                        that.showSuccess = true
+                        clearInterval(that.T)
+                        setTimeout(function(){
+                            that.payFinish()
+                        },1500)
+                        return
+                    }
+                }
+                clearInterval(that.T)
+                cancelOrderFn({id:this.orderId}).then(res=>{
+                    if(res.code == 1){
+                        that.$msg('已取消')
+                    }
+                })
+                that.$emit('cancelPay')
+            })
         }
     }
 }
@@ -144,27 +185,30 @@ export default {
         align-items: center;
         justify-content: center;
         flex-direction: column;
-        padding-top:30upx;
+        padding-top:20upx;
         & > .img {
             width: 100upx;
             height: 100upx;
         }
         & .show-code{
-            font-size: 14upx;
-            margin: 20upx 0 20upx 0;
+            font-size: 19upx;
+            margin: 55upx 0 10upx 0;
+            font-weight:bold;
+        }
+        & .paying{
+            font-size: 19upx;
+            margin: 55upx 0 10upx 0;
             font-weight:bold;
         }
         & .btn-default {
-            height: 40upx;
-            width: 100upx;
+            height: 60upx;
+            width: 120upx;
             text-align: center;
-            line-height: 40upx;
+            line-height: 60upx;
             border: 1px solid #eee;
-            font-size: 14upx;
+            font-size: 16upx;
             color: #333333;
-        }
-        & > .result {
-            margin: 20upx 0 0 0;
+            display:inline-block;
         }
     }
 	.result-view {