소스 검색

feat(common): 新增threePay页面并调整pages配置

- 新增subPack-common/threePay页面实现下单支付功能
- 调整pages.json中pages和subPackages结构,规范页面配置
- 修正src/subPack-xsb/store-xsb/sys.ts中SelectShopInfo赋值逻辑
- 修改配置文件config/index.ts中develop接口地址切换
- 更新uni-pages.d.ts以兼容threePay新页面声明
zhangtao 5 일 전
부모
커밋
4e6e347754
5개의 변경된 파일41개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 2
      src/config/index.ts
  2. 8 0
      src/pages.json
  3. 29 0
      src/subPack-common/threePay/index.vue
  4. 1 1
      src/subPack-xsb/store-xsb/sys.ts
  5. 1 0
      src/uni-pages.d.ts

+ 2 - 2
src/config/index.ts

@@ -11,9 +11,9 @@ const mapEnvVersion = {
   // develop: 'http://192.168.0.11:8080', // 王
   // develop: 'http://192.168.1.21:8080', // 田
   // develop: 'http://74949mkfh190.vicp.fun', // 付
-  // develop: 'http://47.109.84.152:8081',
+  develop: 'http://47.109.84.152:8081',
   // develop: 'https://5ed0f7cc.r9.vip.cpolar.cn',
-  develop: 'https://smqjh.api.zswlgz.com',
+  // develop: 'https://smqjh.api.zswlgz.com',
   /**
    * 体验版
    */

+ 8 - 0
src/pages.json

@@ -273,6 +273,14 @@
             "disableScroll": true
           }
         },
+        {
+          "path": "threePay/index",
+          "name": "smqjh-threePay",
+          "islogin": false,
+          "style": {
+            "navigationBarTitleText": "下单"
+          }
+        },
         {
           "path": "user-center/index",
           "name": "common-user-center",

+ 29 - 0
src/subPack-common/threePay/index.vue

@@ -0,0 +1,29 @@
+<script setup lang="ts">
+definePage({ name: 'smqjh-threePay', islogin: false, style: { navigationBarTitleText: '下单' } })
+
+const orderNumber = ref()
+onLoad((options: any) => {
+  orderNumber.value = options.orderNumber
+  handlePay()
+})
+async function handlePay() {
+  const res = await useUserStore().handleCommonPayMent(orderNumber.value)
+  if (res.payType !== 1) {
+    try {
+      await useUserStore().getWxCommonPayment(res)
+      await useUserStore().paySuccess('xsb-order', 'subPack-xsb/commonTab/index')
+    }
+    catch {
+      await useUserStore().payError('xsb-order', 'subPack-xsb/commonTab/index')
+    }
+  }
+}
+</script>
+
+<template>
+  <view class="">
+    view
+  </view>
+</template>
+
+<style lang="scss" scoped></style>

+ 1 - 1
src/subPack-xsb/store-xsb/sys.ts

@@ -94,7 +94,7 @@ export const useSysXsbStore = defineStore('system-xsb', {
         Apis.xsb.nearestShop({ data: { longitude, latitude } }).then((res) => {
           const newShop = this.xsbShopList.find(it => it.shopId === res.data.nearestShopId)
           if (newShop) {
-            this.SelectShopInfo = this.SelectShopInfo || newShop
+            this.SelectShopInfo = this.SelectShopInfo.shopId ? this.SelectShopInfo : newShop
           }
           resolve(res)
         }).catch((err) => { reject(err) })

+ 1 - 0
src/uni-pages.d.ts

@@ -24,6 +24,7 @@ interface NavigateToOptions {
        "/subPack-common/paySuccess/index" |
        "/subPack-common/revalue/index" |
        "/subPack-common/revalueSuccess/index" |
+       "/subPack-common/threePay/index" |
        "/subPack-common/user-center/index" |
        "/subPack-smqjh/bannerDetaile/index" |
        "/subPack-smqjh/order/index" |