shish 4 лет назад
Родитель
Сommit
d652f048ec
2 измененных файлов с 50 добавлено и 7 удалено
  1. 47 7
      ghsApp/src/admin/billing/toPay.vue
  2. 3 0
      ghsApp/src/api/order/index.js

+ 47 - 7
ghsApp/src/admin/billing/toPay.vue

@@ -14,20 +14,28 @@
             <span class="app-size-36 app-bold">¥{{ parseFloat(actPrice)}}</span>
           </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 class="mobile-scan" @click="mobileScan()">手机扫码</view> -->
-              <!-- <view class="mobile-scan" @click="handPay()">手动</view> -->
           </view>
-        </block>
+        </view>
+        <view v-else>
+          <view style="text-align:center;margin:20upx auto 10upx auto;">
+          <view class="balance" style="margin-bottom:30upx;">扫二维码付款</view>
+          <view style="margin-bottom:20upx;">
+              <button @click="changePayWay(0)" class="admin-button-com mini-btn" :class="payWay == 0 ? 'blue' : 'default'">微信</button>
+              <button @click="changePayWay(1)" style="margin-left:20upx;" class="admin-button-com mini-btn" :class="payWay == 1 ? 'blue' : 'default'">支付宝</button>
+          </view>
+          <image mode="widthFix" style="width:400upx;margin:0 auto;" :src="payQrCodeUrl"></image>
+          </view>
+        </view>
       </view>
     </view>
   </view>
 </template>
 <script>
-import { codePayCheck} from "@/api/order/index";
+import { codePayCheck,scanPay} from "@/api/order/index";
 export default {
   name: "toPay",
   components: {
@@ -38,7 +46,11 @@ export default {
     return {
       orderId:0,
       actPrice:0,
-      orderSn:''
+      orderSn:'',
+      showQrCode:false,
+      payQrCodeUrl:'',
+      payWay:0,
+      isCashier:true
     };
   },
   mounted() {
@@ -48,6 +60,19 @@ export default {
     uni.setStorageSync('globalCodePayId',option.orderId)
     this.actPrice = option.actPrice
     this.orderSn = option.orderSn
+
+    // #ifdef MP-WEIXIN
+    this.isCashier = false
+    // #endif
+    // #ifdef APP-PLUS
+    if(plus.device.vendor != 'SUNMI'){
+      this.isCashier = false
+    }
+    // #endif
+    if(this.isCashier == false){
+      this.toScanPay()
+    }
+
   },
   onShow() {
   },
@@ -55,6 +80,20 @@ export default {
     uni.removeStorageSync('globalCodePayId')
   },
   methods: {
+    changePayWay(payWay){
+      this.payWay = payWay
+      this.toScanPay()
+    },
+    toScanPay(){
+      let that = this
+      scanPay({id:this.orderId,payWay:this.payWay}).then(res=>{
+        if(res.code == 1){
+          let url = res.data.url || ''
+          that.payQrCodeUrl = url
+          that.showQrCode = true
+        }
+      })
+    },
     checkResult(){
       let that = this
       uni.showLoading({title: '查询中',mask:true})
@@ -157,6 +196,7 @@ export default {
 }
 .balance{
   margin-top:40upx;
-  font-size:38upx;
+  font-size:36upx;
+  font-weight: bold;
 }
 </style>

+ 3 - 0
ghsApp/src/api/order/index.js

@@ -194,3 +194,6 @@ export const codePayCheck = data => https.get("/order/code-pay-check", data);
 
 //收款语音播报
 export const getPayVoice = data => https.get("/order/get-pay-voice", data);
+
+//扫码付款
+export const scanPay = data => https.get("/order/scan-pay", data);