shish %!s(int64=2) %!d(string=hai) anos
pai
achega
b7061bc823
Modificáronse 2 ficheiros con 101 adicións e 100 borrados
  1. 99 94
      ghsApp/src/admin/billing/toPay.vue
  2. 2 6
      hdApp/src/admin/order/detail.vue

+ 99 - 94
ghsApp/src/admin/billing/toPay.vue

@@ -14,31 +14,25 @@
             <span class="app-size-36 app-bold">¥{{ parseFloat(actPrice)}}</span>
             <span class="app-size-36 app-bold">¥{{ parseFloat(actPrice)}}</span>
           </view>
           </view>
         </block>
         </block>
-        <view v-if="isCashier">
-          <view class="balance">请出示付款码</view>
-          <view class="call-one-btn">
-              <button class="button-com default" @click="checkResult()">查询支付结果</button>
-          </view>
-          <view style="margin-top:35upx;">
-              <button style="width:25vh;" @click="changePayWay(2)" class="admin-button-com big default">赊账</button>
-          </view>
-        </view>
-        <view v-else>
+        <view>
           <view style="text-align:center;margin:10upx auto 10upx auto;">
           <view style="text-align:center;margin:10upx auto 10upx auto;">
-          <view class="balance" style="margin-bottom:25upx;">扫二维码付款</view>
-          <view style="margin-bottom:20upx;">
-              <button @click="changePayWay(0)" class="admin-button-com big" :class="payWay == 0 ? 'blue' : 'default'">微信</button>
-              <button @click="changePayWay(1)" style="margin-left:40upx;" class="admin-button-com big" :class="payWay == 1 ? 'blue' : 'default'">支付宝</button>
-              <button @click="changePayWay(2)" style="margin-left:40upx;" class="admin-button-com big" :class="payWay == 2 ? 'blue' : 'default'">赊账</button>
-          </view>
-
-          <image mode="widthFix" v-if="expire == 0" style="width:350upx;margin:0 auto;" :src="payQrCodeUrl"></image>
-          <view style="font-size:32upx;color:red;font-weight:bold;padding-top:50upx;padding-bottom:50upx;" v-if="expire == 1">订单已过期,请重新创建</view>
-
+            <view class="balance" style="margin-bottom:25upx;">扫客户二维码收款</view>
+            <view style="margin-bottom:20upx;">
+                <button style="width:25vh;" @click="beginScan()" class="admin-button-com big blue">点击扫码</button>
+            </view>
+            <view style="margin-top:20upx;">
+                <button style="width:25vh;" class="admin-button-com big default" @click="checkResult()">查询支付结果</button>
+            </view>
+            <view style="margin-top:20upx;">
+                <button style="width:25vh;" @click="changePayWay(2)" class="admin-button-com big default">记赊账</button>
+            </view>
+            <view style="margin-top:20upx;">
+                <button style="width:25vh;" @click="toCancel()" class="admin-button-com big default">取消</button>
+            </view>
           </view>
           </view>
         </view>
         </view>
-        <view style="margin-top:35upx;">
-            <button style="width:28vh;" @click="goBack()" class="admin-button-com big default">返回首页</button>
+        <view style="margin-top:20upx;">
+            <button style="width:25vh;" @click="goBack()" class="admin-button-com big default">返回首页</button>
         </view>
         </view>
         <view style="color:#CCCCCC;margin-top:20upx;">10分钟后未付款自动取消</view>
         <view style="color:#CCCCCC;margin-top:20upx;">10分钟后未付款自动取消</view>
       </view>
       </view>
@@ -46,7 +40,7 @@
   </view>
   </view>
 </template>
 </template>
 <script>
 <script>
-import { codePayCheck,scanPay,scanPayCheck,cancel,debtPay,getDetail} from "@/api/order/index";
+import { cancel,debtPay,getDetail,codePay,codePayCheck} from "@/api/order";
 export default {
 export default {
   name: "toPay",
   name: "toPay",
   components: {
   components: {
@@ -64,14 +58,16 @@ export default {
       isCashier:false,
       isCashier:false,
       INT:null,
       INT:null,
       orderInfo:{orderType:0},
       orderInfo:{orderType:0},
-      expire:0
+      expire:0,
+      T:null
     };
     };
   },
   },
   mounted() {
   mounted() {
   },
   },
   onLoad(option) {
   onLoad(option) {
     this.orderId = option.orderId
     this.orderId = option.orderId
-
+    this.actPrice = option.actPrice
+    this.orderSn = option.orderSn
     if(!this.$util.isEmpty(option.orderId)){
     if(!this.$util.isEmpty(option.orderId)){
       getDetail({ id: option.orderId }).then(res=>{
       getDetail({ id: option.orderId }).then(res=>{
         if(res.code == 1){
         if(res.code == 1){
@@ -79,48 +75,60 @@ export default {
         }
         }
       })
       })
     }
     }
-
-    uni.setStorageSync('globalCodePayId',option.orderId)
-    this.actPrice = option.actPrice
-    this.orderSn = option.orderSn
-
-    // #ifdef MP-WEIXIN
-    this.isCashier = false
-    // #endif
-    if(this.isCashier == false){
-      this.toScanPay()
-      this.checkPayInfo()
-    }
-
-  },
-  onShow() {
-  },
-  onUnload() {
-    uni.removeStorageSync('globalCodePayId')
-    if(!this.$util.isEmpty(this.INT)){
-      clearInterval(this.INT)
-    }
   },
   },
   methods: {
   methods: {
-    init(){
-
-    },
-    checkPayInfo(){
+    beginScan(){
       let that = this
       let that = this
-      this.INT = setInterval(function(){ 
-          scanPayCheck({id:that.orderId}).then(res=>{
+      uni.scanCode({
+        onlyFromCamera: true,
+        success: function (res) {
+          that.requestCodePay(res.result)
+        }
+      })
+    },
+    //付款
+    requestCodePay(authCode){
+        let that = this
+        codePay({id:this.orderId,authCode:authCode}).then(res=>{
             if(res.code == 1){
             if(res.code == 1){
+                if(res.data.returnStatus == 'SUCCESS'){
+                    that.showSuccess = true
+                    setTimeout(function(){
+                        that.payFinish()
+                    },1200)
+                }else{
+                    that.T = setInterval(function(){
+                        that.checkPay()
+                    }, 1000);      
+                }
+            }else{
+                that.T = setInterval(function(){
+                    that.checkPay()
+                }, 1000);
+            }
+        })
+    },
+    //查询付款结果
+    checkPay(){
+      let that = this
+      codePayCheck({id:this.orderId}).then(res=>{
+          if(res.code == 1){
               if(res.data.returnStatus == 'SUCCESS'){
               if(res.data.returnStatus == 'SUCCESS'){
-                that.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:that.orderId,orderSn:that.orderSn,title:'支付成功'}})
+                  uni.hideLoading()
+                  clearInterval(that.T)
+                  setTimeout(function(){
+                      that.payFinish()
+                  },1500)
+                  return
               }
               }
-              //订单过期
-              if(res.data.returnStatus == 'EXPIRE'){
-                clearInterval(that.INT)
-                that.expire = 1
-              }
-            }
-          })
-       }, 4000);
+          }
+      })
+    },
+    init(){
+
+    },
+    payFinish(){
+      this.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:this.orderId,orderSn:this.orderSn,title:'支付成功'}})
     },
     },
     changePayWay(payWay){
     changePayWay(payWay){
       this.payWay = payWay
       this.payWay = payWay
@@ -137,52 +145,49 @@ export default {
               }
               }
             })
             })
         })
         })
-      }else{
-        this.toScanPay()
       }
       }
     },
     },
-    toScanPay(){
-      let that = this
-      scanPay({id:this.orderId,payWay:this.payWay}).then(res=>{
-        if(res.code == 1){
-          if(res.data.returnStatus == 'SUCCESS'){
-            let url = res.data.url || ''
-            that.payQrCodeUrl = url
-            that.showQrCode = true
-          }
-        }
-      })
-    },
     checkResult(){
     checkResult(){
       let that = this
       let that = this
-      uni.showLoading({title: '查询中',mask:true})
       codePayCheck({id:this.orderId}).then(res=>{
       codePayCheck({id:this.orderId}).then(res=>{
-          uni.hideLoading()
           if(res.code == 1){
           if(res.code == 1){
-            if(res.data.returnStatus == 'SUCCESS'){
-              this.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:this.orderId,orderSn:this.orderSn,title:'支付成功'}})
-              return
-            }
+              if(res.data.returnStatus == 'SUCCESS'){
+                  uni.hideLoading()
+                  clearInterval(that.T)
+                  setTimeout(function(){
+                      that.payFinish()
+                  },1500)
+                  return
+              }
           }
           }
-          that.$msg(res.msg)
-      })
-    },
-    mobileScan(){
-      let that = this
-      uni.scanCode({
-        success:function(res){
-          let code = res.result
-          that.requestCodePay(code)
-        }
+          that.$msg('没有付款,请跟客户确认')
       })
       })
     },
     },
-    handPay(){
-      this.requestCodePay('123')
+    confirmToCancel(){
+        let that = this
+        codePayCheck({id:this.orderId}).then(res=>{
+            if(res.code == 1){
+                if(res.data.returnStatus == 'SUCCESS'){
+                    uni.hideLoading()
+                    clearInterval(that.T)
+                    setTimeout(function(){
+                        that.payFinish()
+                    },1500)
+                    return
+                }
+            }
+            clearInterval(that.T)
+            cancel({id:this.orderId}).then(res=>{
+                if(res.code == 1){
+                    that.$msg('已取消')
+                }
+            })
+        })
     },
     },
     goBack(){
     goBack(){
       uni.navigateBack()
       uni.navigateBack()
     },
     },
-    cancelOrder(){
+    toCancel(){
       let that = this
       let that = this
       that.$util.confirmModal({content:'确认取消?'},() => {
       that.$util.confirmModal({content:'确认取消?'},() => {
           clearInterval(this.INT)
           clearInterval(this.INT)

+ 2 - 6
hdApp/src/admin/order/detail.vue

@@ -80,8 +80,8 @@
         <view class="module-tit">
         <view class="module-tit">
           <text>订单信息</text>
           <text>订单信息</text>
           <block v-if="orderInfo.payStatus == 1">
           <block v-if="orderInfo.payStatus == 1">
-            <text style="float:right;color: #3385ff;font-weight:normal;" v-if="orderInfo.onlinePay ==2 || orderInfo.payWay == 3" @click.stop="goRefund()">发起退款</text>
-            <text style="float:right;color: #3385ff;font-weight:normal;" v-else @click.stop="goRefund()">发起退款</text>
+            <text style="float:right;color: #3385ff;font-weight:normal;" v-if="orderInfo.onlinePay ==2 || orderInfo.payWay == 3" @click.stop="goRefund()">发起售后</text>
+            <text style="float:right;color: #3385ff;font-weight:normal;" v-else @click.stop="goRefund()">发起售后</text>
           </block>
           </block>
         </view>
         </view>
         <view class="module-det">
         <view class="module-det">
@@ -255,10 +255,6 @@ export default {
       this.$util.pageTo({url:'/admin/order/modify?id='+item.id})
       this.$util.pageTo({url:'/admin/order/modify?id='+item.id})
     },
     },
 		goRefund(){
 		goRefund(){
-			if(this.orderInfo.payWay == 1 && this.orderInfo.onlinePay == 2){
-				this.$msg('支付宝付款暂不支持退款')
-				return false
-			}
 			this.$util.pageTo({url:'/admin/order/refund?id='+this.option.id})
 			this.$util.pageTo({url:'/admin/order/refund?id='+this.option.id})
 		},
 		},
     init() {
     init() {