Kaynağa Gözat

功能完善

rong air 4 yıl önce
ebeveyn
işleme
68eab704a2

+ 2 - 1
src/app.json

@@ -24,7 +24,8 @@
     "pages/agent/invite_card_inventory/main",
     "pages/agent/settlement_center/index/main",
     "pages/agent/settlement_center/withdraw/detail/main",
-    "pages/agent/settlement_center/withdraw/list/main"
+    "pages/agent/settlement_center/withdraw/list/main",
+    "pages/only_pay/main"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 4 - 0
src/components/device/device.vue

@@ -293,6 +293,10 @@ export default {
       wx.onBluetoothDeviceFound((res) => {
         res.devices.forEach((device) => {
           if (!device.name && !device.localName) {
+            $this.stopBluetoothDevicesDiscovery();
+            $this.device_status = 0;
+            $this.connect_show = false;
+            Toast.fail("未连接到设备");
             return;
           }
           if (device.localName && (device.localName != '')) {

+ 2 - 0
src/components/user_center/order_list.vue

@@ -3,6 +3,7 @@
     <van-card
       v-for="(order,index) in orders"
       :key="index"
+      v-if="orders.length > 0"
     >
       <!--      抬头部分-->
       <div slot="title" class="flex justify-between">
@@ -49,6 +50,7 @@
 
       </div>
     </van-card>
+    <van-empty description="暂时没有数据"  v-else/>
   </div>
 </template>
 

+ 4 - 0
src/pages/index/index.vue

@@ -105,6 +105,10 @@ export default {
     },
     //跳转页面
     to_page($page) {
+      if ($page == 'agent/index'){
+        Toast.fail("暂未开通")
+        return false
+      }
       if (!this.is_login) {
         Toast.fail("请先登录")
         return false

+ 64 - 0
src/pages/only_pay/index.vue

@@ -0,0 +1,64 @@
+<template>
+  <div id="index_login_container" class="animation-slide-right">
+    <form action="">
+      <view class="cu-form-group">
+        <view class="title">金额</view>
+        <input placeholder="输入金额" name="input" v-model="price"></input>
+      </view>
+      <van-button @click="wx_pay" block class="padding">支付</van-button>
+    </form>    <van-toast id="van-toast"/>
+
+  </div>
+</template>
+<script>
+import {testPay} from "../../requests/orders";
+import Toast from '../../../static/vant/toast/toast';
+
+var $this
+export default {
+  name: 'scan_container',
+  data() {
+    return {
+      price: ""
+    }
+  },
+  methods: {
+    wx_pay() {
+      let $params = {
+        total_fee: $this.price
+      }
+      testPay($params).then((res) => {
+        let $res = res.data
+        let $payment = $res.data
+        $this.payment_info = $payment
+        wx.requestPayment({
+          timeStamp: $payment.timeStamp,
+          nonceStr: $payment.nonceStr,
+          package: $payment.package,
+          signType: $payment.signType,
+          paySign: $payment.sign,
+          success(res) {
+            //支付成功
+            console.log('success', res)
+            Toast.success("支付成功")
+          },
+          fail(res) {
+            console.log('fail', res)
+            Toast.fail('支付失败')
+          }
+        })
+      })
+    }
+  },
+  created() {
+    $this = this
+  }
+}
+</script>
+<style scoped>
+#index_login_container {
+  height: 812px;
+  background-color: #31295B;
+}
+
+</style>

+ 12 - 0
src/pages/only_pay/main.js

@@ -0,0 +1,12 @@
+import Vue from 'vue'
+import App from './index'
+
+// add this to handle exception
+Vue.config.errorHandler = function (err) {
+  if (console && console.error) {
+    console.error(err)
+  }
+}
+
+const app = new Vue(App)
+app.$mount()

+ 7 - 0
src/pages/only_pay/main.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "van-field": "../../../static/vant/field/index",
+    "van-button": "../../../static/vant/button/index",
+    "van-toast": "../../../static/vant/toast/index"
+  }
+}

+ 2 - 0
src/pages/start/index.vue

@@ -265,6 +265,7 @@ export default {
       })
     },
     start_game() {
+
       wx.onBLECharacteristicValueChange((characteristic) => {
         console.log('监听蓝牙时间获取数据')
         // console.log("收到" + $this.ab2hex(characteristic.value));
@@ -408,6 +409,7 @@ export default {
       $this.mode_item['time'] = $origin_time - ($played_time * 1000)
       $this.start_game()
 
+      //打开蓝牙监听
       bluetooth.watch_bluetooth_status($this)
     }
 

+ 1 - 0
src/pages/user_center/orders/main.json

@@ -3,6 +3,7 @@
     "van-tab": "../../../static/vant/tab/index",
     "van-tabs": "../../../static/vant/tabs/index",
     "van-card": "../../../static/vant/card/index",
+    "van-empty": "../../../static/vant/empty/index",
     "van-button": "../../../static/vant/button/index"
   }
 }

+ 6 - 0
src/requests/orders.js

@@ -30,3 +30,9 @@ export function deleteOrder($sn) {
   $params['access_token'] = wx.getStorageSync('token')
   return fly.post('order/order-delete', $params)
 }
+
+//支付订单
+export function testPay($params) {
+  $params['access_token'] = wx.getStorageSync('token')
+  return fly.post('order/test-pay', $params)
+}

+ 7 - 3
src/utils/bluetooth.js

@@ -386,9 +386,13 @@ export default {
       // 该方法回调中可以用于处理连接意外断开等异常情况
       if (res.connected == false) {
         //断开玩具连接
-        $that.change_toy_connect_status(0)
-        //断开蓝牙连接
-        $that.change_device_status(0)
+        try {
+          $that.change_toy_connect_status(0)
+          //断开蓝牙连接
+          $that.change_device_status(0)
+        } catch (e) {
+          console.log('方法不存在')
+        }
 
         //判断游戏是否游戏中
         let $game_status = game_store.getters.getGameStatus();