Browse Source

no message

linwenxin 6 months ago
parent
commit
17b66270e2
1 changed files with 25 additions and 2 deletions
  1. 25 2
      src/pages/index/index.vue

+ 25 - 2
src/pages/index/index.vue

@@ -7,6 +7,7 @@
       :refresherTriggered="refresherTriggered"
       @refresherrefresh="refresherrefresh"
     >
+      <view style="color: #fff; background: red; height: 50px" @click="quzhifu">支付</view>
       <Loading v-if="isError || !isLogin" :type="3" :loadStatus="2" :showText="'加载失败,请下拉重新加载'" />
 
       <view class="all-container" v-else>
@@ -356,8 +357,7 @@
 </template>
 
 <script>
-import { getNoticeNum, getOrderNum, selectionChange } from '@/common/utils/util.js'
-
+import { getNoticeNum, getOrderNum, selectionChange, mini_env } from '@/common/utils/util.js'
 export default {
   data() {
     return {
@@ -659,6 +659,29 @@ export default {
   },
 
   methods: {
+    quzhifu() {
+      mini_env(bool => {
+        this.$api
+          .postJson('/order/buytest', {
+            orderId: Date.now(),
+            amount: 0.01
+          })
+          .then(res => {
+            // 小程序环境
+            if (bool) {
+              uniWebview.navigateTo({
+                url: `/pages/pay/pay?${Object.entries({
+                  ...res.data,
+                  payPackage: res.data.payPackage.split('=')[0] || '',
+                  payPackageVal: res.data.payPackage.split('=')[1] || ''
+                })
+                  .map(item => item.join('='))
+                  .join('&')}`
+              })
+            }
+          })
+      })
+    },
     // 获取公告栏
     getNoticebar() {
       this.$api.get('/shpping/cart/notice').then(res => {