Parcourir la source

```
feat(api): 添加订单相关接口和类型定义

- 添加xsb.orderList、xsb.orderInfo、xsb.cancelOrder等订单相关API接口
- 添加xsbOrderList、xsbOmsOrderItem等订单类型定义
- 添加shoppingCartOrderConfirm购物车确认订单类型
- 添加hybridPayment混合支付相关接口定义

refactor(api): 统一API响应数据结构

- 修改ApiResponse接口,统一data字段为必填项
- 调整listData接口结构,将list包装在data对象内
- 更新所有API方法的返回类型为apiResData包装格式
- 修改handleAlovaResponse函数,直接返回json数据

feat(order): 实现订单详情页面功能

- 新增订单详情页面,支持查看订单基本信息
- 实现订单商品列表展示功能
- 添加订单金额、运费、积分抵扣等信息显示
- 实现订单收货人地址和联系方式展示

refactor(address): 优化地址管理逻辑

- 移除未使用的confirmOrderStore
- 优化地址列表获取逻辑,使用Promise包装
- 修复地址编辑和删除后的数据同步问题
- 添加地址选择后的默认地址获取逻辑

fix(login): 修复登录流程和路由跳转问题

- 修复token获取路径,从data字段中获取access_token
- 优化登录后的路由跳转逻辑
- 修复重定向路径参数拼接问题
- 添加用户信息获取到登录成功后流程

feat(pagination): 修复积分列表分页数据获取

- 修复积分列表分页数据提取路径,从resp.data?.list获取
- 修复积分总数、可用积分等数据显示路径
- 调整积分类型索引计算,修正显示问题

style(components): 调整组件样式和交互细节

- 修复Zpopup组件z-index值设置
- 修复地址编辑页面点击事件冒泡问题
```

zhangtao il y a 4 jours
Parent
commit
4625930659

+ 242 - 4
src/api/api.type.d.ts

@@ -1,5 +1,9 @@
 namespace Api {
   interface userInfo {
+    /**
+     * 运费(单位:分)
+     */
+    freightFee?: number
     /**
      * 企业名称
      */
@@ -518,6 +522,227 @@ namespace Api {
     userId?: string
     [property: string]: any
   }
+  interface xsbOrderList {
+    /**
+     * 实际总值(用户实付)
+     */
+    actualTotal?: number
+    /**
+     * 业务类型
+     */
+    businessType?: string
+    /**
+     * 取消原因
+     */
+    cancelReason?: string
+    /**
+     * 取消时间
+     */
+    cancelTime?: string
+    /**
+     * 企业ID
+     */
+    channelId?: number
+    /**
+     * 企业名称
+     */
+    channelName?: string
+    /**
+     * 订单关闭原因 1-超时未支付 2-退款关闭 4-买家取消 15-已通过货到付款交易
+     */
+    closeType?: number
+    /**
+     * 收货人地址
+     */
+    consigneeAddress?: string
+    /**
+     * 收货人电话
+     */
+    consigneeMobile?: string
+    /**
+     * 收货人姓名
+     */
+    consigneeName?: string
+    createTime?: string
+    /**
+     * 用户订单删除状态
+     */
+    deleteStatus?: number
+    /**
+     * 物流单号
+     */
+    dvyFlowId?: string
+    /**
+     * 配送方式ID
+     */
+    dvyId?: number
+    /**
+     * 发货时间
+     */
+    dvyTime?: string
+    /**
+     * 配送类型 1:快递 2:自提 3:及时配送
+     */
+    dvyType?: number
+    /**
+     * 订单运费
+     */
+    freightAmount?: number
+    /**
+     * 门店名称
+     */
+    goodsTotal?: number
+    /**
+     * 是否存在退款单 0不存在 1存在
+     */
+    hasRefund?: number
+    /**
+     * 海博物流状态(20:已抢单,30:配送员到店,40:取货完成,50:配送单取消,100:已送达)
+     */
+    hbLogisticStatus?: number
+    /**
+     * 海博订单状态:0-待支付,1-待发货(快递使用),20-订单已接单(待拣货),30-订单待配送(拣货完成/自提类订单为待自提),40-订单配送中
+     * ,50-订单取消待审核,60-订单已取消,70-订单已送达,80-订单已完成
+     */
+    hbOrderStatus?: number
+    /**
+     * 是否已经支付,1:已经支付过,0:,没有支付过
+     */
+    isPayed?: number
+    /**
+     * 用户ID
+     */
+    memberId?: number
+    /**
+     * 企业用户用积分抵扣,后台充值积分
+     */
+    offsetPoints?: number
+    /**
+     * 子订单
+     */
+    orderItemList?: xsbOmsOrderItem[]
+    /**
+     * 订单总额
+     */
+    orderMoney?: number
+    /**
+     * 订购流水号
+     */
+    orderNumber?: string
+    /**
+     * 订单类型 0-微信订单 1-积分订单 2-混合订单
+     */
+    orderType?: number
+    /**
+     * 微信订单号
+     */
+    outTradeNo?: string
+    /**
+     * 付款时间
+     */
+    payTime?: string
+    /**
+     * 支付方式 0-微信 1-积分 2-混合
+     */
+    payType?: number
+    /**
+     * 买家备注
+     */
+    remarks?: string
+    /**
+     * 门店地址
+     */
+    shopAddress?: string
+    /**
+     * 店铺id
+     */
+    shopId?: number
+    /**
+     * 门店名称
+     */
+    shopName?: string
+    /**
+     * 卖家备注
+     */
+    shopRemarks?: string
+    /**
+     * 门店电话
+     */
+    tel?: string
+    /**
+     * 商品总值
+     */
+    total?: number
+    /**
+     * 微信交易号
+     */
+    transactionId?: string
+    updateTime?: string
+    [property: string]: any
+  }
+  interface xsbOmsOrderItem {
+    /**
+     * 获得积分
+     */
+    gainScore?: number
+    /**
+     * 用户Id
+     */
+    memberId?: number
+    /**
+     * 订单order_number
+     */
+    orderNumber?: string
+    /**
+     * 产品主图片路径
+     */
+    pic?: string
+    /**
+     * 产品价格
+     */
+    price?: number
+    /**
+     * 购物车产品个数
+     */
+    prodCount?: number
+    /**
+     * 产品ID
+     */
+    prodId?: number
+    /**
+     * 产品名称
+     */
+    prodName?: string
+    /**
+     * 商品小计
+     */
+    productTotalAmount?: number
+    /**
+     * 购物时间
+     */
+    recTime?: string
+    /**
+     * 店铺id
+     */
+    shopId?: number
+    /**
+     * 产品SkuID
+     */
+    skuId?: number
+    /**
+     * sku名称
+     */
+    skuName?: string
+    /**
+     * spec
+     */
+    spec?: string
+    /**
+     * 使用积分
+     */
+    useScore?: number
+    [property: string]: any
+  }
   interface myShoppingCart {
     /**
      * 平台
@@ -542,7 +767,7 @@ namespace Api {
     /**
      * skuList
      */
-    skuList?: CartSkuVo[]
+    skuList: CartSkuVo[]
     [property: string]: any
   }
   interface CartSkuVo {
@@ -562,7 +787,7 @@ namespace Api {
     /**
      * 数量
      */
-    num?: number
+    num: number
     /**
      * pic
      */
@@ -578,7 +803,7 @@ namespace Api {
     /**
      * 门店
      */
-    shopId?: number
+    shopId: number
     /**
      * 门店库存
      */
@@ -586,7 +811,7 @@ namespace Api {
     /**
      * sku_id
      */
-    skuId?: number
+    skuId: number
     /**
      * 门店
      */
@@ -598,5 +823,18 @@ namespace Api {
     updateTime?: string
     [property: string]: any
   }
+  interface shoppingCartOrderConfirm {
+    offsetPoints: number
+    shopName: string
+    /**
+     * price
+     */
+    price?: number
+    /**
+     * skuList
+     */
+    skuList: CartSkuVo[]
+    [property: string]: any
+  }
 
 }

+ 6 - 0
src/api/apiDefinitions.ts

@@ -42,7 +42,13 @@ export default {
   'xsb.appAdvertInfo':['GET', '/smqjh-system/app-api/v1/appAdvertInfo'],
   'xsb.SearchTerm':['GET', '/smqjh-system/app-api/v1/SearchTerm/find'],
   'xsb.shopList':['GET', '/smqjh-pms/app-api/v1/shop/list'],
+  'xsb.orderList':['GET', '/smqjh-oms/api/v1/order/orderList'],
+  'xsb.orderInfo':['GET', '/smqjh-oms/api/v1/order/orderInfo'],
+  'xsb.cancelOrder':['GET', '/smqjh-oms/api/v1/order/cancelOrder'],
   'common.myShoppingCart':['GET', '/smqjh-oms/app-api/v1/shoppingCart/myShoppingCart'],
   'common.addShoppingCart':['POST', '/smqjh-oms/app-api/v1/shoppingCart/addShoppingCart'],
   'common.deleteShoppingCart':['DELETE', '/smqjh-oms/app-api/v1/shoppingCart/{ids}'],
+  'common.shoppingCartOrderConfirm':['GET', '/smqjh-oms/app-api/v1/shoppingCart/shoppingCartOrderConfirm/{ids}'],
+  'common.addOrder':['POST', '/smqjh-oms/api/v1/order/addOrder'],
+  'common.hybridPayment':['POST', '/smqjh-oms/service/pay/hybridPayment'],
 };

+ 1 - 1
src/api/core/handlers.ts

@@ -62,7 +62,7 @@ export async function handleAlovaResponse(
   if (typeof json == 'string') {
     return JSON.parse(json).data
   }
-  return json.data
+  return json
 }
 
 // Handle request errors

+ 150 - 32
src/api/globals.d.ts

@@ -100,26 +100,34 @@ export interface ApiResponse {
   code?: number;
   type?: string;
   msg?: string;
+  data: any
 }
 
 interface listData<T> {
-  list: T[];
+  data?: {
+    list: T[]
+  }
+}
+interface apiResData<T> {
+  data: T;
+  code: string
+  msg: string
 }
 declare global {
   interface Apis {
     sys: {
       auth<
-        Config extends Alova2MethodConfig<logoinToken> & {
+        Config extends Alova2MethodConfig<apiResData<logoinToken>> & {
           params: loginModel;
         }
       >(
         config: Config
-      ): Alova2Method<logoinToken, 'sys.auth', Config>;
+      ): Alova2Method<apiResData<logoinToken>, 'sys.auth', Config>;
       userInfo<
-        Config extends Alova2MethodConfig<userInfo>
+        Config extends Alova2MethodConfig<apiResData<userInfo>>
       >(
         config: Config
-      ): Alova2Method<userInfo, 'sys.userInfo', Config>;
+      ): Alova2Method<apiResData<userInfo>, 'sys.userInfo', Config>;
       updateUserInfo<
         Config extends Alova2MethodConfig<any> & {
           pathParams: { memberId: number };
@@ -139,12 +147,12 @@ declare global {
         config: Config
       ): Alova2Method<{ url: string }, 'sys.uploadFile', Config>;
       addresses<
-        Config extends Alova2MethodConfig<Api.addressList[]> & {
+        Config extends Alova2MethodConfig<apiResData<Api.addressList[]>> & {
 
         }
       >(
         config: Config
-      ): Alova2Method<Api.addressList[], 'sys.addresses', Config>;
+      ): Alova2Method<apiResData<Api.addressList[]>, 'sys.addresses', Config>;
       Addaddresses<
         Config extends Alova2MethodConfig<any> & {
           data: Api.addressList;
@@ -167,16 +175,16 @@ declare global {
         config: Config
       ): Alova2Method<any, 'sys.updateAddresses', Config>;
       addressesDetail<
-        Config extends Alova2MethodConfig<Api.addressList> & {
+        Config extends Alova2MethodConfig<apiResData<Api.addressList>> & {
           pathParams: { addressId: number };
         }
       >(
         config: Config
-      ): Alova2Method<Api.addressList, 'sys.addressesDetail', Config>;
+      ): Alova2Method<apiResData<Api.addressList>, 'sys.addressesDetail', Config>;
     }
     xsb: {
       categories<
-        Config extends Alova2MethodConfig<Api.xsbCategories[]> & {
+        Config extends Alova2MethodConfig<apiResData<Api.xsbCategories[]>> & {
           data: {
             channelId: number;
             shopId: number
@@ -184,9 +192,9 @@ declare global {
         }
       >(
         config: Config
-      ): Alova2Method<Api.xsbCategories[], 'xsb.categories', Config>;
+      ): Alova2Method<apiResData<Api.xsbCategories[]>, 'xsb.categories', Config>;
       getCategoryProductList<
-        Config extends Alova2MethodConfig<Api.xsbCategoryProductList[]> & {
+        Config extends Alova2MethodConfig<apiResData<Api.xsbCategoryProductList[]>> & {
           data: {
             categoryId: number;
             shopId: number
@@ -195,9 +203,9 @@ declare global {
         }
       >(
         config: Config
-      ): Alova2Method<Api.xsbCategoryProductList[], 'xsb.getCategoryProductList', Config>;
+      ): Alova2Method<apiResData<Api.xsbCategoryProductList[]>, 'xsb.getCategoryProductList', Config>;
       getProductDetail<
-        Config extends Alova2MethodConfig<Api.xsbProductDetail> & {
+        Config extends Alova2MethodConfig<apiResData<Api.xsbProductDetail>> & {
           data: {
             id: number;
             shopId: number
@@ -206,14 +214,14 @@ declare global {
         }
       >(
         config: Config
-      ): Alova2Method<Api.xsbProductDetail, 'xsb.getProductDetail', Config>;
+      ): Alova2Method<apiResData<Api.xsbProductDetail>, 'xsb.getProductDetail', Config>;
       findUserPoints<
-        Config extends Alova2MethodConfig<Api.xsbFindUserPoints> & {
+        Config extends Alova2MethodConfig<apiResData<Api.xsbFindUserPoints>> & {
 
         }
       >(
         config: Config
-      ): Alova2Method<Api.xsbFindUserPoints, 'xsb.findUserPoints', Config>;
+      ): Alova2Method<apiResData<Api.xsbFindUserPoints>, 'xsb.findUserPoints', Config>;
       findUserPointsPage<
         Config extends Alova2MethodConfig<listData<Api.xsbFindUserPointsPage>> & {
           data: {
@@ -255,40 +263,71 @@ declare global {
         config: Config
       ): Alova2Method<listData<Api.xsbCategoryProductList>, 'xsb.getSearchProductList', Config>;
       appAdvertInfo<
-        Config extends Alova2MethodConfig<Api.xsbAdvertInfo[]> & {
+        Config extends Alova2MethodConfig<apiResData<Api.xsbAdvertInfo[]>> & {
         }
       >(
         config: Config
-      ): Alova2Method<Api.xsbAdvertInfo[], 'xsb.appAdvertInfo', Config>;
+      ): Alova2Method<apiResData<Api.xsbAdvertInfo[]>, 'xsb.appAdvertInfo', Config>;
       SearchTerm<
-        Config extends Alova2MethodConfig<Api.xsbSearchTerm[]> & {
+        Config extends Alova2MethodConfig<apiResData<Api.xsbSearchTerm[]>> & {
           data: {
             type: number
           }
         }
       >(
         config: Config
-      ): Alova2Method<Api.xsbSearchTerm[], 'xsb.SearchTerm', Config>;
+      ): Alova2Method<apiResData<Api.xsbSearchTerm[]>, 'xsb.SearchTerm', Config>;
       shopList<
-        Config extends Alova2MethodConfig<Api.xsbShopList[]> & {
+        Config extends Alova2MethodConfig<apiResData<Api.xsbShopList[]>> & {
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<Api.xsbShopList[]>, 'xsb.shopList', Config>;
+      orderList<
+        Config extends Alova2MethodConfig<listData<Api.xsbOrderList>> & {
+          data: {
+            businessType?: string;
+            orderStatus?: string;
+            pageNum?: number;
+            pageSize?: number;
+            dvyType:number|string;
+          }
+        }
+      >(
+        config: Config
+      ): Alova2Method<listData<Api.xsbOrderList>, 'xsb.orderList', Config>;
+      orderInfo<
+        Config extends Alova2MethodConfig<apiResData<Api.xsbOrderList>> & {
+          data: {
+            orderNo: string;
+          }
         }
       >(
         config: Config
-      ): Alova2Method<Api.xsbShopList[], 'xsb.shopList', Config>;
+      ): Alova2Method<apiResData<Api.xsbOrderList>, 'xsb.orderInfo', Config>;
+      cancelOrder<
+        Config extends Alova2MethodConfig<any> & {
+          data: {
+            orderNo: string;
+          }
+        }
+      >(
+        config: Config
+      ): Alova2Method<any, 'xsb.cancelOrder', Config>;
     }
     common: {
       myShoppingCart<
-        Config extends Alova2MethodConfig<Api.myShoppingCart> & {
-          data:{
-            businessType:string;
-            channelId:number;
+        Config extends Alova2MethodConfig<apiResData<Api.myShoppingCart[]>> & {
+          data: {
+            businessType: string;
+            channelId: number;
           }
         }
       >(
         config: Config
-      ): Alova2Method<Api.myShoppingCart, 'common.myShoppingCart', Config>;
+      ): Alova2Method<apiResData<Api.myShoppingCart[]>, 'common.myShoppingCart', Config>;
       addShoppingCart<
-        Config extends Alova2MethodConfig<Api.addShoppingCart> & {
+        Config extends Alova2MethodConfig<apiResData<Api.addShoppingCart>> & {
           data: {
             /**
               * 业务类型
@@ -314,14 +353,81 @@ declare global {
         }
       >(
         config: Config
-      ): Alova2Method<Api.addShoppingCart, 'common.addShoppingCart', Config>;
+      ): Alova2Method<apiResData<Api.addShoppingCart>, 'common.addShoppingCart', Config>;
       deleteShoppingCart<
-        Config extends Alova2MethodConfig<Api.deleteShoppingCart> & {
+        Config extends Alova2MethodConfig<apiResData<Api.deleteShoppingCart>> & {
           pathParams: { ids: string };
         }
       >(
         config: Config
-      ): Alova2Method<Api.deleteShoppingCart, 'common.deleteShoppingCart', Config>;
+      ): Alova2Method<apiResData<Api.deleteShoppingCart>, 'common.deleteShoppingCart', Config>;
+      shoppingCartOrderConfirm<
+        Config extends Alova2MethodConfig<apiResData<Api.shoppingCartOrderConfirm>> & {
+          pathParams: { ids: string };
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<Api.shoppingCartOrderConfirm>, 'common.shoppingCartOrderConfirm', Config>;
+      addOrder<
+        Config extends Alova2MethodConfig<any> & {
+          data: {
+            /**
+       * 收货人地址id
+       */
+            addressId: number;
+            /**
+             * 业务类型
+             */
+            businessType: string;
+            /**
+             * 企业ID
+             */
+            channelId: number;
+            /**
+             * 配送类型 1:快递 2:自提 3:及时配送
+             */
+            dvyType: number;
+            /**
+             * 订单运费
+             */
+            freightAmount: number;
+            /**
+             * 商品信息
+             */
+            orderItemList: {
+              /**
+               * 数量
+               */
+              prodCount?: number;
+              /**
+               * 产品SkuID
+               */
+              skuId?: number;
+              [property: string]: any;
+            }[];
+            /**
+             * 买家备注
+             */
+            remarks?: string;
+            /**
+             * 店铺id
+             */
+            shopId: number;
+            [property: string]: any;
+          }
+        }
+      >(
+        config: Config
+      ): Alova2Method<any, 'common.addOrder', Config>;
+      hybridPayment<
+        Config extends Alova2MethodConfig<apiResData<wxpay>> & {
+          data: {
+            orderNumber: string;
+          }
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<wxpay>, 'common.hybridPayment', Config>;
     }
 
   }
@@ -348,3 +454,15 @@ export interface logoinToken {
   token_type: string
 }
 
+export interface wxpay {
+  appId: string
+  nonceStr: string
+  package: string
+  paySign: string
+  signType: string
+  timeStamp: string
+  /**
+   * 支付方式 0-微信 1-积分 2-混合
+   */
+  payType: number
+}

+ 0 - 1
src/auto-imports.d.ts

@@ -694,7 +694,6 @@ declare module 'vue' {
     readonly useWindowScroll: UnwrapRef<typeof import('@vueuse/core')['useWindowScroll']>
     readonly useWindowSize: UnwrapRef<typeof import('@vueuse/core')['useWindowSize']>
     readonly useXsbCartStore: UnwrapRef<typeof import('./subPack-xsb/store-xsb/cart')['useXsbCartStore']>
-    readonly useconfirmOrderStore: UnwrapRef<typeof import('./store/confirmOrder')['useconfirmOrderStore']>
     readonly watch: UnwrapRef<typeof import('vue')['watch']>
     readonly watchArray: UnwrapRef<typeof import('@vueuse/core')['watchArray']>
     readonly watchAtMost: UnwrapRef<typeof import('@vueuse/core')['watchAtMost']>

+ 1 - 1
src/components/Zpopup.vue

@@ -10,7 +10,7 @@ const show = defineModel({ default: false })
 </script>
 
 <template>
-  <wd-popup v-model="show" lock-scroll custom-style="border-radius:32rpx;32rpx 0rpx 0rpx" :z-index="999999" position="bottom">
+  <wd-popup v-model="show" lock-scroll custom-style="border-radius:32rpx;32rpx 0rpx 0rpx" :z-index="99" position="bottom">
     <view :style="{ background: bg }">
       <slot />
       <view class="h150rpx" />

+ 6 - 6
src/pages/login/index.vue

@@ -24,19 +24,19 @@ async function handleGetPhone(e: UniHelper.ButtonOnGetphonenumberDetail) {
     success: async (res) => {
       uni.hideLoading()
       await send(res.code, e.code)
-      token.value = `Bearer ${data.value.access_token}`
+      token.value = `Bearer ${data.value.data.access_token}`
       useGlobalToast().show({ msg: '登录成功' })
-      const path = redirectName.value.split('-')
-      console.log(path, '路劲')
+      useUserStore().getUserInfo()
 
       setTimeout(() => {
         if (tabList.includes(redirectName.value)) {
-          router.pushTab({ path: path[0] })
+          router.pushTab({ path: redirectName.value })
         }
         else {
-          router.replace({ path: path[0], params: path[1] as unknown as Record<string, string> })
+          console.log(redirectName.value, 'JSON.parse(path[1])')
+
+          router.replace({ path: redirectName.value })
         }
-        useUserStore().getUserInfo()
       }, 2000)
     },
   })

+ 25 - 1
src/router/index.ts

@@ -33,7 +33,8 @@ router.beforeEach((to, from, next) => {
   console.log('🚀 beforeEach 守卫触发:', { to, from }, '')
   const { token, redirectName } = storeToRefs(useUserStore())
   if (to.name === 'smqjh-login') {
-    redirectName.value = `${String(from.path)}-${to.params}`
+    redirectName.value = appendParamsToPath(String(from.path), from.params as any)
+    console.log(redirectName.value, ' redirectName.value')
   }
   if (!whitePathName().includes(to.name) && !token.value) {
     const { confirm: showConfirm } = useGlobalMessage()
@@ -77,3 +78,26 @@ router.afterEach((to, from) => {
 })
 
 export default router
+/**
+ * 将 params 参数拼接到 path 路径后面
+ * @param path 基础路径
+ * @param params 参数对象
+ * @returns 拼接后的完整路径
+ */
+function appendParamsToPath(path: string, params: Record<string, any>): string {
+  if (!params || Object.keys(params).length === 0) {
+    return path
+  }
+  const queryParams: string[] = []
+  Object.entries(params).forEach(([key, value]) => {
+    if (value !== undefined && value !== null) {
+      // 对参数进行 URL 编码
+      const encodedKey = encodeURIComponent(key)
+      const encodedValue = encodeURIComponent(String(value))
+      queryParams.push(`${encodedKey}=${encodedValue}`)
+    }
+  })
+
+  const queryString = queryParams.join('&')
+  return queryString ? `${path}?${queryString}` : path
+}

+ 0 - 16
src/store/confirmOrder.ts

@@ -1,16 +0,0 @@
-import { defineStore } from 'pinia'
-
-interface confirmState {
-  /**
-   * 下单信息统一字段
-   */
-  orderList: Api.xsbCategoryProductList[]
-}
-export const useconfirmOrderStore = defineStore('confirmOrder', {
-  state: (): confirmState => ({
-    orderList: [],
-  }),
-  actions: {
-
-  },
-})

+ 11 - 6
src/store/user.ts

@@ -44,8 +44,8 @@ export const useUserStore = defineStore('user', {
   actions: {
     async getUserInfo() {
       if (this.token) {
-        const res = await api.sys.userInfo({})
-        this.userInfo = res
+        const { data } = await api.sys.userInfo({})
+        this.userInfo = data
       }
     },
     async updataUserInfo(data: Api.userInfo) {
@@ -54,15 +54,20 @@ export const useUserStore = defineStore('user', {
       uni.hideLoading()
       useGlobalToast().show({ msg: '修改成功' })
       this.getUserInfo()
+      this.getuserAddresslist()
+      this.getSelectedAddress()
     },
     /**
      * 获取用户收货地址列表
      */
     async getuserAddresslist() {
-      uni.showLoading({ mask: true })
-      const res = await Apis.sys.addresses({})
-      this.addresses = res || []
-      uni.hideLoading()
+      return new Promise((resolve, reject) => {
+        uni.showLoading({ mask: true })
+        Apis.sys.addresses({}).then((res) => {
+          this.addresses = res.data || []
+          resolve(res)
+        }).catch(err => reject(err)).finally(() => uni.hideLoading())
+      })
     },
     /**
      * 更新用户选择的收货地址

+ 4 - 3
src/subPack-common/addressList/index.vue

@@ -17,8 +17,9 @@ const { send: updateData } = useRequest(data => Apis.sys.updateAddresses({
   data,
 }), { middleware: createGlobalLoadingMiddleware({ loadingText: '设置中。。。' }), immediate: false })
 
-onShow(() => {
-  useUserStore().getuserAddresslist()
+onShow(async () => {
+  await useUserStore().getuserAddresslist()
+  useUserStore().getSelectedAddress()
 })
 watch(() => addresses.value, () => {
   defaultId.value = addresses.value.find(item => item.defaulted === 1)?.id
@@ -50,7 +51,7 @@ function handleSelectAddress(item: Api.addressList) {
             <image
               :src="`${StaticUrl}/edit-address.png`"
               class="h40rpx w40rpx"
-              @click="router.push({ name: 'common-editAddress', params: { type: '2', id: `${item.id}` } })"
+              @click.stop="router.push({ name: 'common-editAddress', params: { type: '2', id: `${item.id}` } })"
             />
           </view>
           <view class="mt24rpx text-24rpx text-#AAAAAA">

+ 2 - 0
src/subPack-common/editAddress/index.vue

@@ -69,6 +69,7 @@ async function handleSubmit() {
   }
   if (Number(route.query?.type) === 1) {
     await Apis.sys.Addaddresses({ data: modelForm.value })
+
     useGlobalToast().show({ msg: '添加成功' })
   }
   else {
@@ -85,6 +86,7 @@ async function handleDel() {
     msg: '确定要删除该地址吗?',
     success: async () => {
       await Apis.sys.deleteAddresses({ pathParams: { ids: route.query?.id } })
+      useUserStore().getSelectedAddress()
       router.back()
     },
   })

+ 8 - 6
src/subPack-common/integral/index.vue

@@ -11,9 +11,11 @@ const { data: info } = useRequest(() =>
   Apis.xsb.findUserPoints({}),
 )
 const type = ['充值', '下单', '退款', '过期积分', '退款过期积分']
-const { data: pointList, isLastPage, page } = usePagination((pageNum, pageSize) => Apis.xsb.findUserPointsPage({ data: { pageNum, pageSize } }), { data: resp => resp.list, initialPage: 1, initialPageSize: 10, immediate: true, append: true })
+const { data: pointList, isLastPage, page } = usePagination((pageNum, pageSize) => Apis.xsb.findUserPointsPage({ data: { pageNum, pageSize } }), { data: resp => resp.data?.list, initialPage: 1, initialPageSize: 10, immediate: true, append: true })
 
 function handleScrollBottom() {
+  console.log(isLastPage.value, '=====')
+
   if (!isLastPage.value) {
     page.value++
   }
@@ -28,7 +30,7 @@ function handleScrollBottom() {
           总充值积分
         </view>
         <view class="text-36rpx text-#222 font-semibold">
-          {{ info?.pointsTotal || 0 }}
+          {{ info?.data?.pointsTotal || 0 }}
         </view>
       </view>
       <view class="flex flex-col items-center justify-center">
@@ -36,7 +38,7 @@ function handleScrollBottom() {
           当前可用积分
         </view>
         <view class="text-36rpx text-#222 font-semibold">
-          {{ info?.availablePointsTotal || 0 }}
+          {{ info?.data?.availablePointsTotal || 0 }}
         </view>
       </view>
       <view class="flex flex-col items-center justify-center">
@@ -44,7 +46,7 @@ function handleScrollBottom() {
           已过期积分
         </view>
         <view class="text-36rpx text-#222 font-semibold">
-          {{ info?.expiryPointsTotal || 0 }}
+          {{ info?.data?.expiryPointsTotal || 0 }}
         </view>
       </view>
       <view class="flex flex-col items-center justify-center">
@@ -52,7 +54,7 @@ function handleScrollBottom() {
           已消耗积分
         </view>
         <view class="text-36rpx text-#222 font-semibold">
-          {{ info?.consumePointsTotal || 0 }}
+          {{ info?.data?.consumePointsTotal || 0 }}
         </view>
       </view>
     </view>
@@ -63,7 +65,7 @@ function handleScrollBottom() {
       <view v-for="item, index in pointList" :key="item.pointsId" class="bg-white p24rpx">
         <view class="flex items-center justify-between text-32rpx font-semibold">
           <view class="text-#222">
-            {{ type[Number(item.pointsType)] || '未知状态' }}
+            {{ type[Number(item.pointsType) - 1] || '未知状态' }}
           </view>
           <view class="text-#FF4A39">
             {{ item?.variablePoints || 0 }}

+ 29 - 16
src/subPack-common/orderDetaile/index.vue

@@ -10,6 +10,19 @@ definePage({
   },
 })
 const collapse = ref(false)
+const orderInfo = ref<Api.xsbOrderList>()
+onLoad((options: any) => {
+  getDetail(options.id)
+})
+async function getDetail(id: string) {
+  const { data } = await Apis.xsb.orderInfo({
+    data: {
+      orderNo: id,
+    },
+  })
+  orderInfo.value = data
+}
+
 function handleCollapse() {
   collapse.value = !collapse.value
 }
@@ -111,11 +124,11 @@ function handleCollapse() {
               class="mr20rpx h40rpx w40rpx"
             />
             <view class="text-32rpx text-#222 font-semibold">
-              杨先生 152****4972
+              {{ orderInfo?.consigneeName }} {{ orderInfo?.consigneeMobile }}
             </view>
           </view>
           <view class="mt20rpx text-28rpx text-#AAAAAA">
-            贵州省贵阳市观山湖区富力中心A7座
+            {{ orderInfo?.consigneeAddress }}
           </view>
         </view>
       </wd-card>
@@ -129,33 +142,33 @@ function handleCollapse() {
               class="h36rpx w36rpx"
             />
             <view class="ml20rpx text-32rpx font-semibold">
-              中数超市(富力中心店)
+              {{ orderInfo?.shopName }}
             </view>
           </view>
           <view class="mt24rpx h2rpx w-full bg-#F0F0F0" />
         </template>
         <CollapsePanel :line-height="150">
-          <view v-for="item in 5" :key="item" class="mb20rpx w-full flex items-center">
+          <view v-for="item in orderInfo?.orderItemList" :key="item.skuId" class="mb20rpx w-full flex items-center">
             <view class="mr20rpx w120rpx flex-shrink-0">
               <image
-                :src="`${StaticUrl}/shu.png`"
+                :src="item.pic"
                 class="h120rpx w120rpx"
               />
             </view>
             <view class="flex-1">
               <view class="w-full flex items-center justify-between font-semibold">
                 <view class="text-28rpx">
-                  赶海季生鲜大闸蟹
+                  {{ item.skuName }}
                 </view>
                 <view class="text-32rpx text-#FF4D3A">
-                  ¥103.95
+                  ¥{{ item.price }}
                 </view>
               </view>
               <view class="text-24rpx text-#AAAAAA">
-                规格:5kg,盒
+                规格:{{ item.spec }}
               </view>
               <view class="text-24rpx text-#AAAAAA">
-                ×1
+                ×{{ item.prodCount }}
               </view>
             </view>
           </view>
@@ -167,7 +180,7 @@ function handleCollapse() {
             商品金额
           </view>
           <view class="text-#FF4A39 font-semibold">
-            ¥54.00
+            ¥{{ orderInfo?.total }}
           </view>
         </view>
         <view class="mt24rpx flex items-center justify-between">
@@ -175,15 +188,15 @@ function handleCollapse() {
             配送费(即时配送)
           </view>
           <view class="text-#FF4A39 font-semibold">
-            ¥54.00
+            ¥{{ orderInfo?.freightAmount }}
           </view>
         </view>
         <view class="mt24rpx flex items-center justify-between">
           <view class="text-28rpx">
-            积分(1400)
+            积分
           </view>
           <view class="text-#FF4A39 font-semibold">
-            ¥54.00
+            -¥{{ Number(orderInfo?.offsetPoints) / 100 }}
           </view>
         </view>
         <view class="mt24rpx h2rpx w-full bg-#F0F0F0" />
@@ -208,7 +221,7 @@ function handleCollapse() {
             </view>
             <view class="flex items-center">
               <text class="text-#222">
-                1867402054587256856
+                {{ orderInfo?.orderNumber }}
               </text>
               <view class="ml10rpx">
                 <wd-icon name="file-copy" size="22px" />
@@ -228,7 +241,7 @@ function handleCollapse() {
               下单时间
             </view>
             <view class="text-#222">
-              2024-12-13 11:12:30
+              {{ orderInfo?.createTime }}
             </view>
           </view>
           <view class="mb28rpx flex items-center justify-between">
@@ -236,7 +249,7 @@ function handleCollapse() {
               备注信息
             </view>
             <view class="text-#222">
-              无
+              {{ orderInfo?.remarks || '' }}
             </view>
           </view>
         </view>

+ 1 - 1
src/subPack-common/paySuccess/index.vue

@@ -48,7 +48,7 @@ function handleBackIndex() {
         </view>
         <view class="mt60rpx flex items-center">
           <wd-button
-            type="info" block size="large" @click=" router.push({ name: unref(paySuccessPath) })"
+            type="info" block size="large" @click=" router.push({ name: paySuccessPath })"
           >
             <text class="text-32rpx font-semibold">
               查看订单

+ 121 - 35
src/subPack-xsb/commonTab/components/cart.vue

@@ -1,5 +1,6 @@
 <script setup lang="ts">
 import { StaticUrl } from '@/config'
+import router from '@/router'
 
 definePage({
   name: 'xsb-cart',
@@ -10,21 +11,91 @@ definePage({
     disableScroll: true,
   },
 })
-const { userInfo, token } = storeToRefs(useUserStore())
-const { data: cartList, send } = useRequest(() => Apis.common.myShoppingCart({
-  data: {
-    channelId: unref(userInfo).channelId,
-    businessType: 'XSB',
-  },
-}), { immediate: false })
+
+const { cartList } = storeToRefs(useXsbCartStore())
+const totalProduct = ref<Api.shoppingCartOrderConfirm>()
 const isAll = ref(false)
-const selectCatrt = ref()
-onMounted(() => {
-  if (unref(token)) {
-    send()
+function handleChangeAllShop(e: { value: boolean }) {
+  if (e.value) {
+    cartList.value = cartList.value.map((it) => {
+      return {
+        ...it,
+        allGoods: it.skuList.map(it => it.id),
+      }
+    })
+    console.log(e, cartList.value)
   }
-  console.log(cartList.value)
-})
+  else {
+    cartList.value = cartList.value.map((it) => {
+      return {
+        ...it,
+        allGoods: [],
+      }
+    })
+  }
+}
+async function handleChangShopGoods(e: { value: number[] }, shop: Api.myShoppingCart) {
+  if (e.value.length === shop.skuList.length) {
+    const res = await useXsbCartStore().getCartAddGoodsPrice(e.value.join(','))
+    totalProduct.value = res
+    shop.AllShopGoods = true
+  }
+  else {
+    totalProduct.value = undefined
+    shop.AllShopGoods = false
+  }
+}
+function handleAllShopGoods(e: { value: boolean }) {
+  if (e.value) {
+    cartList.value = cartList.value.map((it) => {
+      return {
+        ...it,
+        AllShopGoods: true,
+        allGoods: it.skuList.map(it => it.id),
+      }
+    })
+  }
+  else {
+    cartList.value = cartList.value.map((it) => {
+      return {
+        ...it,
+        AllShopGoods: false,
+        allGoods: [],
+      }
+    })
+  }
+}
+async function handleDel() {
+  const delGoods = cartList.value.filter(it => it.allGoods?.length > 0)
+  if (delGoods.length) {
+    await Apis.common.deleteShoppingCart({
+      pathParams: {
+        ids: delGoods.map(it => it.allGoods).join(','),
+      },
+    })
+    await useXsbCartStore().getCartList()
+    useGlobalToast().show({ msg: '删除成功!' })
+  }
+  else {
+    useGlobalToast().show({ msg: '请选择要删除的商品' })
+  }
+}
+async function handleSub(item: Api.CartSkuVo) {
+  await useXsbCartStore().addCart(item.skuId, -1, item.shopId)
+}
+async function handleAdd(item: Api.CartSkuVo) {
+  await useXsbCartStore().addCart(item.skuId, 1, item.shopId)
+}
+function handelPay() {
+  if (!unref(totalProduct)) {
+    useGlobalToast().show({ msg: '请选择商品' })
+    return
+  }
+  router.push({
+    name: 'xsb-confirmOrder',
+    params: { data: JSON.stringify(unref(totalProduct)) },
+  })
+}
 </script>
 
 <template>
@@ -37,43 +108,58 @@ onMounted(() => {
     <view class="-mt220rpx">
       <view class="content px24rpx">
         <scroll-view scroll-y class="content">
-          <view class="rounded-16rpx bg-white px24rpx pb18rpx pt28rpx">
-            <wd-checkbox v-model="isAll" size="large">
+          <view v-for="shop in cartList" :key="shop.shopId" class="rounded-16rpx bg-white px24rpx pb18rpx pt28rpx">
+            <wd-checkbox v-model="shop.AllShopGoods" size="large" @change="handleChangeAllShop">
               <view class="text-28rpx font-semibold">
-                市民请集合官方旗舰店
+                {{ shop.shopName }}
               </view>
             </wd-checkbox>
             <view class="mt20rpx h2rpx w-full bg-#F0F0F0" />
-            <wd-checkbox-group v-model="selectCatrt" size="large">
+            <wd-checkbox-group v-model="shop.allGoods" size="large" @change="handleChangShopGoods($event, shop)">
               <view
-                v-for="item in 10" :key="item" class="mt20rpx flex items-center"
+                v-for="item in shop.skuList" :key="item.id" class="mt20rpx flex items-center"
               >
                 <view class="mr20rpx h32rpx w32rpx">
-                  <wd-checkbox model-value="jingmai" />
+                  <wd-checkbox :model-value="item.id" />
                 </view>
                 <view class="flex flex-1">
                   <image
-                    :src="`${StaticUrl}/shu.png`"
+                    :src="item.pic"
                     class="h206rpx w200rpx flex-shrink-0"
+                    @click.stop="router.push({ name: 'xsb-goods', params: { id: String(item.skuId) } })"
                   />
-                  <view class="ml20rpx">
+                  <view class="ml20rpx flex-1">
                     <view class="text-left text-28rpx font-semibold">
-                      <view v-for="i in 2" :key="i" class="mr5px inline-block">
+                      <!-- <view v-for="i in 2" :key="i" class="mr5px inline-block">
                         <wd-tag type="danger">
                           惊喜回馈
                         </wd-tag>
-                      </view>
-                      秋季应季水果纯甜
-                      柿子
+                      </view> -->
+                      {{ item.skuName }}
                     </view>
-                    <view class="mt14tpx text-24rpx text-#AAAAAA">
-                      规格:5kg,盒
+                    <view class="mt14rpx text-24rpx text-#AAAAAA">
+                      规格:{{ item.spec }}
                     </view>
                     <view class="mt14rpx flex items-center justify-between">
                       <view class="text-36rpx text-#FF4A39 font-semibold">
-                        ¥13.95
+                        ¥{{ item.price }}
+                      </view>
+                      <!-- <wd-input-number v-model="item.num" disable-input @change="handleChangeNum($event, item)" /> -->
+                      <view class="flex items-center">
+                        <image
+                          :src="` ${StaticUrl}/sub-cart.png`"
+                          class="h44rpx w44rpx"
+                          @click.stop="handleSub(item)"
+                        />
+                        <view class="box-border h44rpx w84rpx flex items-center justify-center border border-#F0F0F0 border-solid text-24rpx text-#AAAAAA">
+                          {{ item.num }}
+                        </view>
+                        <image
+                          :src="` ${StaticUrl}/add-cart.png`"
+                          class="h44rpx w44rpx"
+                          @click.stop="handleAdd(item)"
+                        />
                       </view>
-                      <wd-input-number />
                     </view>
                   </view>
                 </view>
@@ -81,7 +167,7 @@ onMounted(() => {
             </wd-checkbox-group>
           </view>
 
-          <view v-if="false" class="box-border w-full flex items-center justify-center">
+          <view v-if="!cartList.length" class="box-border w-full flex items-center justify-center">
             <view class="mt220rpx flex flex-col items-center">
               <image :src="`${StaticUrl}/cart.png`" class="h110rpx w110rpx" />
               <view class="mb20rpx mt20rpx text-24rpx">
@@ -96,7 +182,7 @@ onMounted(() => {
         </scroll-view>
       </view>
     </view>
-    <view class="fixedShadow fixed bottom-60rpx left-0 z-99 box-border w-full flex items-center justify-between rounded-t-16rpx bg-white px24rpx pb60rpx pt10rpx">
+    <view v-if="cartList.length" class="fixedShadow fixed bottom-60rpx left-0 z-99 box-border w-full flex items-center justify-between rounded-t-16rpx bg-white px24rpx pb60rpx pt10rpx">
       <view class="ios w-full flex items-center justify-between">
         <view class="flex items-center">
           <image
@@ -104,10 +190,10 @@ onMounted(() => {
             class="h100rpx w100rpx"
           />
           <view class="ml16rpx flex items-center">
-            <wd-checkbox v-model="isAll" size="large">
+            <wd-checkbox v-model="isAll" size="large" @change="handleAllShopGoods">
               全选
             </wd-checkbox>
-            <view class="ml10rpx text-24rpx text-#FF4A39">
+            <view class="ml10rpx text-24rpx text-#FF4A39" @click="handleDel">
               删除
             </view>
           </view>
@@ -120,12 +206,12 @@ onMounted(() => {
             <view class="flex items-baseline text-24rpx text-#FF4A39">
               <text class="text-36rpx">
-                8.9
+                {{ totalProduct?.price || '0.00' }}
               </text>
             </view>
           </view>
           <view class="ml20rpx w160rpx">
-            <wd-button block size="large">
+            <wd-button block size="large" @click="handelPay">
               结算
             </wd-button>
           </view>

+ 38 - 16
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -6,6 +6,7 @@ import router from '@/router'
 const props = defineProps<{ categoryList: Api.xsbCategories[], hotText: Api.xsbSearchTerm[] }>()
 const { statusBarHeight, MenuButtonHeight } = storeToRefs(useSysStore())
 const { topNavActive, leftActive, SelectShopInfo } = storeToRefs(useSysXsbStore())
+const { cartList } = storeToRefs(useXsbCartStore())
 const classfiylist = computed(() => props.categoryList)
 const sortClassBtn = ref(1)
 const show = ref(false)
@@ -20,6 +21,7 @@ definePage({
   },
 })
 const isTopLoading = ref(false)
+const cartPopup = ref(false)
 const basllObj = ref({
   left: 0,
   top: 0,
@@ -30,6 +32,12 @@ const x = computed(() => `${basllObj.value.x}px`)
 const y = computed(() => `${basllObj.value.y}px`)
 const left = computed(() => `${basllObj.value.left}px`)
 const top = computed(() => `${basllObj.value.top}px`)
+const hasCartData = computed(() => {
+  if (cartList.value.length) {
+    return '390rpx'
+  }
+  return '0px'
+})
 const productList = ref<Api.xsbCategoryProductList[]>([])
 const topScrollView = ref()
 const scrollTop = ref(0)
@@ -37,6 +45,7 @@ const goodsLoading = ref<LoadMoreState>()
 const navHeight = computed(() => {
   return (`${Number(MenuButtonHeight.value) + Number(statusBarHeight.value)}px`)
 })
+const totalProduct = ref<Api.shoppingCartOrderConfirm>()
 function handleTopNavChange(item: Api.xsbCategoriesChildren) {
   topNavActive.value = item.code
   leftActive.value = item.children[0].code
@@ -71,7 +80,7 @@ async function getProductList() {
       channelId: 1,
     },
   })
-  productList.value = res
+  productList.value = res.data
   goodsLoading.value = 'finished'
   isTopLoading.value = false
 }
@@ -106,7 +115,7 @@ function handleAddCart(event: WechatMiniprogram.TouchEvent, item: Api.xsbCategor
     showball.value = false
   }, 500)
 }
-onMounted(() => {
+onMounted(async () => {
   if (leftActive.value) {
     handleChange({ value: leftActive.value })
   }
@@ -116,14 +125,19 @@ onMounted(() => {
       topScrollView.value = topNavActive.value
     })
   }
-  const query = uni.createSelectorQuery().in(getCurrentInstance())
-  query.select('.cart-box').boundingClientRect()
-  query.exec((res) => {
-    basllObj.value.y = res[0].top
-    uni.getSystemInfo().then((info) => {
-      basllObj.value.x = -(info.screenWidth - res[0].left - 15)
+  useXsbCartStore().getCartList()
+  if (cartList.value.length) {
+    const query = uni.createSelectorQuery().in(getCurrentInstance())
+    query.select('.cart-box').boundingClientRect()
+    query.exec((res) => {
+      basllObj.value.y = res[0].top
+      uni.getSystemInfo().then((info) => {
+        basllObj.value.x = -(info.screenWidth - res[0].left - 15)
+      })
     })
-  })
+    const ids = cartList.value.map(it => it.skuList.map(its => its.id)).flat()
+    totalProduct.value = await useXsbCartStore().getCartAddGoodsPrice(ids.join(','))
+  }
 })
 </script>
 
@@ -309,10 +323,11 @@ onMounted(() => {
       </view>
     </view>
     <view
-      class="fixedShadow fixed bottom-60rpx left-0 z-99 box-border w-full flex items-center justify-between rounded-t-16rpx bg-white px24rpx pb60rpx pt10rpx"
+      v-if="cartList.length"
+      class="fixedShadow fixed bottom-60rpx left-0 z-100 box-border w-full flex items-center justify-between rounded-t-16rpx bg-white px24rpx pb60rpx pt10rpx"
     >
       <view class="ios w-full flex items-center justify-between">
-        <view class="flex items-center">
+        <view class="flex items-center" @click="cartPopup = true">
           <image :src="`${StaticUrl}/cart-lanzi.png`" class="cart-box h100rpx w100rpx" />
         </view>
         <view class="flex items-center">
@@ -323,18 +338,25 @@ onMounted(() => {
             <view class="flex items-baseline text-24rpx text-#FF4A39">
               <text class="text-36rpx">
-                8.9
+                {{ totalProduct?.price || '0.00' }}
               </text>
             </view>
           </view>
           <view class="ml20rpx w160rpx">
-            <wd-button block size="large">
+            <wd-button block size="large" @click="totalProduct?.price && router.push({ name: 'xsb-confirmOrder', params: { data: JSON.stringify(totalProduct) } })">
               结算
             </wd-button>
           </view>
         </view>
       </view>
     </view>
+    <Zpopup v-model="cartPopup">
+      <view class="ios h800rpx">
+        <view class="p24rpx">
+          1212
+        </view>
+      </view>
+    </Zpopup>
     <view v-if="showball" class="ball">
       <image :src="`${StaticUrl}/cart-yes.png`" class="cart-img h52rpx w52rpx" />
     </view>
@@ -352,9 +374,9 @@ onMounted(() => {
 
 .wraper {
   display: flex;
-  height: calc(100vh - var(--window-top) - v-bind(navHeight) - 390rpx);
-  height: calc(100vh - var(--window-top) - constant(safe-area-inset-bottom) - v-bind(navHeight) - 390rpx);
-  height: calc(100vh - var(--window-top) - env(safe-area-inset-bottom) - v-bind(navHeight) - 390rpx);
+  height: calc(100vh - var(--window-top) - v-bind(navHeight) - v-bind(hasCartData));
+  height: calc(100vh - var(--window-top) - constant(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData));
+  height: calc(100vh - var(--window-top) - env(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData));
 }
 
 .content {

+ 15 - 9
src/subPack-xsb/commonTab/index.vue

@@ -27,7 +27,7 @@ const { userInfo } = storeToRefs(useUserStore())
 const commonCategoryData = ref<Api.xsbCategories[]>([])
 const { data: goodsList, isLastPage, page, error, refresh } = usePagination((pageNum, pageSize) =>
   Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', shopId: Number(SelectShopInfo.value?.shopId) || 1, channelId: userInfo.value.channelId || 1 } }), {
-  data: resp => resp.list,
+  data: resp => resp.data?.list,
   initialData: [],
   initialPage: 1,
   initialPageSize: 10,
@@ -70,28 +70,33 @@ onLoad((options: any) => {
 const loading = ref(true)
 async function getCategories() {
   const res = await Apis.xsb.categories({ data: { shopId: unref(SelectShopInfo).shopId, channelId: unref(userInfo).channelId || 1 } })
-  commonCategoryData.value = res
-  topNavActive.value = res[0].code
-  leftActive.value = res[0].children[0].code
+  console.log(res, 'dassdad')
+
+  commonCategoryData.value = res.data
+  topNavActive.value = res.data[0].code
+  leftActive.value = res.data[0].children[0].code
   loading.value = false
 }
 async function getCurrentImg() {
   const res = await Apis.xsb.appAdvertInfo({})
-  swiperList.value = res
+  swiperList.value = res.data
 }
 async function getSearchData(type: number) {
-  return await Apis.xsb.SearchTerm({ data: { type } })
+  const { data } = await Apis.xsb.SearchTerm({ data: { type } })
+  return data
 }
 
 onMounted(async () => {
+
+})
+onShow(async () => {
   await useSysXsbStore().getAllShopList()
   getCurrentImg()
   getCategories()
   hotText.value = await getSearchData(2)
   recommendText.value = await getSearchData(3)
-})
-onShow(() => {
   refresh()
+  useXsbCartStore().getCartList()
 })
 onShareAppMessage(() => {
   return {
@@ -127,9 +132,10 @@ function handleScrollBottom() {
     <classfiy v-if="tabbarName == 'xsb-classfiy'" :category-list="commonCategoryData" :hot-text="hotText" />
     <my v-if="tabbarName == 'xsb-my'" />
     <wd-tabbar
-      :model-value="tabbarName" safe-area-inset-bottom placeholder fixed :bordered="false"
+      :model-value="tabbarName" placeholder safe-area-inset-bottom fixed :bordered="false"
       custom-class="custom-tab"
       :custom-style="`box-shadow:${tabbarName == 'xsb-cart' || tabbarName == 'xsb-classfiy' ? '' : ' 0rpx -6rpx 12rpx 2rpx rgba(0, 0, 0, 0.09)'}`"
+      :z-index="99999"
       @change="handleTabbarChange"
     >
       <wd-tabbar-item

+ 100 - 0
src/subPack-xsb/confirmOrder/index.ts

@@ -0,0 +1,100 @@
+import type { wxpay } from '@/api/globals'
+import router from '@/router'
+
+export function handleCommonPayMent(orderNumber: string): Promise<wxpay> {
+  return new Promise((resolve, reject) => {
+    if (!orderNumber) {
+      useGlobalToast().show({ msg: '订单号为空!请联系管理员' })
+      reject(new Error('订单号为空!请联系管理员'))
+      return
+    }
+    uni.showLoading({ mask: true })
+    Apis.common.hybridPayment({ data: { orderNumber } }).then((res) => {
+      resolve(res.data)
+    }).finally(() => uni.hideLoading()).catch(err => reject(err))
+  })
+}
+const { selectedAddress, userInfo } = storeToRefs(useUserStore())
+
+/**
+ *
+ * @param businessType
+ * @param dvyType  配送类型 1:快递 2:自提 3:及时配送
+ * @param remarks
+ * @param shopId
+ * @param orderItemList
+ * @returns 下单获取待支付订单号
+ */
+export function getOrderPayMent(businessType: string, dvyType: number, shopId: number, orderItemList: {
+  prodCount?: number
+  skuId?: number
+}[], remarks?: string): Promise<string> {
+  uni.showLoading({ mask: true })
+  return new Promise((resolve, reject) => {
+    if (!selectedAddress.value) {
+      reject(new Error('请选择收货地址'))
+      return
+    }
+    Apis.common.addOrder({
+      data: {
+        channelId: unref(userInfo).channelId,
+        businessType,
+        addressId: selectedAddress.value.id,
+        dvyType,
+        freightAmount: Number(userInfo.value.freightFee),
+        shopId,
+        orderItemList,
+        remarks,
+      },
+    }).then(res => resolve(res.data)).catch(err => reject(err)).finally(() => uni.hideLoading())
+  })
+}
+/**
+ *
+ * @param orderInfo
+ * @returns 统一拉起微信支付
+ */
+
+export function getWxCommonPayment(orderPay: wxpay) {
+  console.log(orderPay, 'orderInfo')
+
+  uni.showLoading({ mask: true })
+  return new Promise((resolve, reject) => {
+    const orderInfo = {
+      appid: orderPay.appId,
+      timeStamp: orderPay.timeStamp,
+      nonceStr: orderPay.nonceStr,
+      package: orderPay.package,
+      signType: orderPay.signType,
+      paySign: orderPay.paySign,
+    }
+    uni.requestPayment({
+      provider: 'wxpay',
+      orderInfo,
+      ...orderInfo,
+      success(res) {
+        paySuccess()
+        resolve(res)
+      },
+      fail(e) {
+        console.log(e, '失败')
+
+        reject(e)
+      },
+      complete() {
+        uni.hideLoading()
+      },
+    })
+  })
+}
+
+/**
+ * 星闪豹
+ * 支付成功统一跳转
+ */
+export function paySuccess() {
+  const { paySuccessPath, payBackIndexPath } = storeToRefs(useSysStore())
+  paySuccessPath.value = 'xsb-order'
+  payBackIndexPath.value = 'subPack-xsb/commonTab/index'
+  router.replace({ name: 'common-paySuccess' })
+}

+ 64 - 22
src/subPack-xsb/confirmOrder/index.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { StaticUrl } from '@/config'
+import { getOrderPayMent, getWxCommonPayment, handleCommonPayMent, paySuccess } from '.'
 import router from '@/router'
 
 definePage({
@@ -9,14 +9,56 @@ definePage({
     navigationBarTitleText: '提交订单',
   },
 })
-const { selectedAddress } = storeToRefs(useUserStore())
-onLoad(() => {
-  if (!selectedAddress.value) {
-    useUserStore().getSelectedAddress()
+const { selectedAddress, userInfo } = storeToRefs(useUserStore())
+const orderInfo = ref<Api.shoppingCartOrderConfirm>()
+const isPay = ref(false)
+const remarks = ref('')
+
+const offsetPoints = computed(() => {
+  const money = (Number(unref(userInfo).freightFee) * 100) + (Number(unref(orderInfo)?.price) * 100)
+  if (Number(unref(orderInfo)?.offsetPoints) > money) {
+    return money
   }
+  return Number(unref(orderInfo)?.offsetPoints)
+})
+const totalMoney = computed(() => {
+  return unref(offsetPoints) > (Number(unref(orderInfo)?.price) * 100) ? '0.00' : ((Number(unref(orderInfo)?.price) * 100) - unref(offsetPoints) + (Number(unref(userInfo)?.freightFee)) * 100) / 100
+})
+onLoad((options: any) => {
+  console.log(options.data)
+  orderInfo.value = JSON.parse(options.data)
 })
-function handlePay() {
-  router.replace({ name: 'common-paySuccess' })
+onShow(() => {
+  useUserStore().getuserAddresslist()
+})
+async function handlePay() {
+  if (!orderInfo.value) {
+    useGlobalToast().show({ msg: '网络异常!请联系客服' })
+    return
+  }
+  isPay.value = true
+  try {
+    const orderItemList = orderInfo.value?.skuList.map((it) => {
+      return {
+        prodCount: it.num,
+        skuId: it.skuId,
+      }
+    })
+
+    const orderNumber = await getOrderPayMent('XSB', 1, Number(orderInfo.value?.skuList[0].shopId), orderItemList, unref(remarks))
+    const res = await handleCommonPayMent(orderNumber)
+    if (res.payType !== 1) {
+      await getWxCommonPayment(res)
+    }
+    else {
+      paySuccess()
+    }
+    isPay.value = false
+  }
+  catch {
+    isPay.value = false
+  }
+  // router.replace({ name: 'common-paySuccess' })
 }
 </script>
 
@@ -58,27 +100,27 @@ function handlePay() {
       </view>
       <view class="my24rpx h2rpx w-full bg-#F0F0F0" />
       <CollapsePanel :line-height="150">
-        <view v-for="item in 5" :key="item" class="mb20rpx w-full flex items-center">
+        <view v-for="item in orderInfo?.skuList" :key="item.id" class="mb20rpx w-full flex items-center">
           <view class="mr20rpx w120rpx flex-shrink-0">
             <image
-              :src="`${StaticUrl}/shu.png`"
+              :src="item.pic"
               class="h120rpx w120rpx"
             />
           </view>
           <view class="flex-1">
             <view class="w-full flex items-center justify-between font-semibold">
               <view class="text-28rpx">
-                赶海季生鲜大闸蟹
+                {{ item.skuName }}
               </view>
               <view class="text-32rpx text-#FF4D3A">
-                ¥103.95
+                ¥{{ item.price }}
               </view>
             </view>
             <view class="text-24rpx text-#AAAAAA">
-              规格:5kg,盒
+              规格:{{ item.spec }}
             </view>
             <view class="text-24rpx text-#AAAAAA">
-              ×1
+              ×{{ item.num }}
             </view>
           </view>
         </view>
@@ -88,19 +130,19 @@ function handlePay() {
       <view class="mb28rpx flex items-center justify-between text-28rpx">
         <view>商品金额</view>
         <view class="text-#FF4D3A font-semibold">
-          ¥54.00
+          ¥{{ orderInfo?.price }}
         </view>
       </view>
       <view class="mb28rpx flex items-center justify-between text-28rpx">
         <view>配送费(即时配送)</view>
         <view class="text-#FF4D3A font-semibold">
-          ¥54.00
+          ¥{{ userInfo.freightFee }}
         </view>
       </view>
       <view class="flex items-center justify-between text-28rpx">
-        <view>积分(1400)</view>
+        <view>积分({{ orderInfo?.offsetPoints }})</view>
         <view class="text-#FF4D3A font-semibold">
-          ¥54.00
+          - ¥{{ offsetPoints / 100 }}
         </view>
       </view>
       <view class="my24rpx h2rpx w-full bg-#F0F0F0" />
@@ -109,7 +151,7 @@ function handlePay() {
           总计:
         </view>
         <view class="text-#FF4D3A font-semibold">
-          ¥54.00
+          ¥ {{ totalMoney }}
         </view>
       </view>
     </view>
@@ -118,7 +160,7 @@ function handlePay() {
         备注
       </view>
       <view class="flex-1">
-        <wd-input placeholder="选填,请先和商家协商一致,付款后商家可见" no-border clearable />
+        <wd-input v-model="remarks" placeholder="选填,请先和商家协商一致,付款后商家可见" no-border clearable />
       </view>
     </view>
     <view class="ios footer fixed bottom-0 left-0 box-border w-full rounded-t-16rpx bg-white px24rpx">
@@ -127,14 +169,14 @@ function handlePay() {
           <view class="font-semibold10 flex items-baseline text-36rpx">
             <text class="text-24rpx">
-            </text> 230.95
+            </text> {{ totalMoney }}
           </view>
           <view class="ml20rpx text-22rpx">
-            共减¥15
+            共减¥{{ offsetPoints / 100 }}
           </view>
         </view>
         <view class="w180rpx">
-          <wd-button size="large" @click="handlePay">
+          <wd-button size="large" :loading="isPay" @click="handlePay">
             立即支付
           </wd-button>
         </view>

+ 20 - 10
src/subPack-xsb/goods/index.vue

@@ -16,6 +16,7 @@ const SelectGoodsNum = ref(1)
 const specId = ref()
 const { userInfo } = storeToRefs(useUserStore())
 const { SelectShopInfo } = storeToRefs(useSysXsbStore())
+const { getTotalNum } = storeToRefs(useXsbCartStore())
 // const goodsTab = ref(0)
 const current = ref<number>(0)
 const currentDetaile = ref(0)
@@ -98,8 +99,14 @@ function handleConfimOrder() {
   router.push({ name: 'xsb-confirmOrder' })
 }
 async function handleAddCart() {
-  await useXsbCartStore().addCart(specId.value, unref(SelectGoodsNum))
-  selectGoods.value = false
+  try {
+    await useXsbCartStore().addCart(specId.value, unref(SelectGoodsNum), unref(SelectShopInfo.value.shopId))
+    selectGoods.value = false
+    useGlobalToast().show('添加成功')
+  }
+  catch (error) {
+    console.log(error)
+  }
 }
 </script>
 
@@ -305,15 +312,18 @@ async function handleAddCart() {
               </view>
             </button>
           </view>
-          <view @click="router.replace({ name: 'xsb-homeTabbar', animationType: 'fade-out', params: { name: 'xsb-cart' } })">
-            <image
-              :src="`${StaticUrl}/goods-cart.png`"
-              class="h44rpx w44rpx"
-            />
-            <view class="text-20rpx">
-              购物车
+          <wd-badge :model-value="getTotalNum">
+            <view @click="router.replace({ name: 'xsb-homeTabbar', animationType: 'fade-out', params: { name: 'xsb-cart' } })">
+              <image
+                :src="`${StaticUrl}/goods-cart.png`"
+                class="h44rpx w44rpx"
+              />
+              <view class="text-20rpx">
+                购物车
+              </view>
             </view>
-          </view>
+          </wd-badge>
+
           <view class="flex items-center">
             <view class="w220rpx">
               <wd-button plain hairline block @click="selectGoods = true">

+ 38 - 13
src/subPack-xsb/order/index.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { handleCommonOrderStatusText, navTabTypeList, orderStatusList } from './order-data'
+import { navTabTypeList, orderStatusList } from './order-data'
 import { StaticUrl } from '@/config'
 import router from '@/router'
 
@@ -10,18 +10,42 @@ definePage({
     navigationBarTitleText: '订单列表',
   },
 })
+
 const navActiveTab = ref(0)
-const orderStatusActive = ref(0)
+const orderStatusActive = ref('all') // 我的订单 all-全部 paddingPay-待支付 ing-进行中 completed-已完成 cancel-已取消
+
+const { data: orderList, refresh, isLastPage, page } = usePagination((pageNum, pageSize) => Apis.xsb.orderList({ data: {
+  businessType: 'XSB',
+  orderStatus: unref(orderStatusActive),
+  pageNum,
+  pageSize,
+  dvyType: unref(navActiveTab) === 0 ? '' : unref(navActiveTab),
+} }), {
+  immediate: true,
+  pageNum: 1,
+  pageSize: 10,
+  initialData: [],
+  data: res => res.data?.list,
+})
 function handleChangeTypeNav(value: number) {
+  orderList.value = []
+
   navActiveTab.value = value
+  refresh()
 }
-function handleChangeStatus(value: number) {
+function handleChangeStatus(value: string) {
+  orderList.value = []
   orderStatusActive.value = value
+  refresh()
 }
-function handleClick() {
-  console.log(12)
-  router.push({ name: 'common-orderDetaile' })
+function handleClick(item: Api.xsbOrderList) {
+  router.push({ name: 'common-orderDetaile', params: { id: String(item.orderNumber) } })
 }
+onReachBottom(() => {
+  if (!isLastPage.value) {
+    page.value++
+  }
+})
 </script>
 
 <template>
@@ -51,18 +75,18 @@ function handleClick() {
         </view>
       </view>
     </view>
-    <view v-for="item in 20" :key="item" class="mt20rpx" @click="handleClick">
+    <view v-for="item in orderList" :key="item.shopId" class="mt20rpx" @click="handleClick(item)">
       <wd-card>
         <template #title>
           <view class="flex items-center justify-between">
             <view class="flex items-center">
               <image :src="`${StaticUrl}/order-icon.png`" class="h36rpx w36rpx" />
               <view class="ml20rpx text-32rpx font-semibold">
-                海马购官方旗舰店
+                {{ item.shopName }}
               </view>
             </view>
             <view class="text-24rpx text-#FF4D3A">
-              {{ handleCommonOrderStatusText(item) }}
+              <!-- {{ handleCommonOrderStatusText(item) }} -->
             </view>
           </view>
           <view class="mt24rpx h2rpx w-full bg-#F0F0F0" />
@@ -87,18 +111,18 @@ function handleClick() {
             <view class="box-border h-full w480rpx py28rpx pl20rpx">
               <scroll-view scroll-x class="h-full w-full whitespace-nowrap">
                 <view class="flex items-center">
-                  <view v-for="item in 20" :key="item" class="mr50rpx">
-                    <image :src="`${StaticUrl}/shu.png`" class="h120rpx w120rpx" />
+                  <view v-for="goods in item.orderItemList" :key="goods.skuId" class="mr50rpx">
+                    <image :src="goods.pic" class="h120rpx w120rpx" />
                   </view>
                 </view>
               </scroll-view>
             </view>
             <view class="box-shadow box-border h-full flex-1 flex-shrink-0 px14rpx py40rpx">
               <view class="text-32rpx text-#FF4D3A font-semibold">
-                ¥13.95
+                ¥{{ item.actualTotal }}
               </view>
               <view class="text-center text-28rpx text-#AAAAAA">
-                共5
+                共{{ item.goodsTotal }}
               </view>
             </view>
           </view>
@@ -117,6 +141,7 @@ function handleClick() {
         </template>
       </wd-card>
     </view>
+    <wd-status-tip v-if="!orderList.length" image="content" tip="暂无内容" />
     <view class="h-20rpx" />
   </view>
 </template>

+ 5 - 4
src/subPack-xsb/order/order-data.ts

@@ -5,10 +5,11 @@ export const navTabTypeList = [
 ]
 
 export const orderStatusList = [
-  { name: '待支付', value: 0 },
-  { name: '待收获', value: 1 },
-  { name: '已完成', value: 5 },
-  { name: '已取消', value: 6 },
+  { name: '全部', value: 'all' },
+  { name: '待支付', value: 'paddingPay' },
+  { name: '进行中', value: 'ing' },
+  { name: '已完成', value: 'completed' },
+  { name: '已取消', value: 'cancel' },
 ]
 
 /**

+ 3 - 2
src/subPack-xsb/search/index.vue

@@ -29,7 +29,7 @@ const { data, send, isLastPage, page, error } = usePagination((pageNum, pageSize
   channelId: userInfo.value.channelId,
 } }), {
   immediate: false,
-  data: resp => resp.list,
+  data: resp => resp.data?.list,
   initialPage: 1,
   initialPageSize: 10,
   append: true,
@@ -84,7 +84,8 @@ function handleClearnSeachLocaData() {
   })
 }
 async function getSearchData() {
-  hotText.value = await Apis.xsb.SearchTerm({ data: { type: 2 } })
+  const { data } = await Apis.xsb.SearchTerm({ data: { type: 2 } })
+  hotText.value = data
 }
 getSearchData()
 const state = computed(() => {

+ 48 - 4
src/subPack-xsb/store-xsb/cart.ts

@@ -2,19 +2,29 @@ import { defineStore } from 'pinia'
 import router from '@/router'
 
 interface cartState {
-  cartList: Api.xsbCategoryProductList[]
+  cartList: Api.myShoppingCart[]
 }
 export const useXsbCartStore = defineStore('xsb-cart', {
   state: (): cartState => ({
     cartList: [],
   }),
+  getters: {
+    /**
+     * 计算星闪豹购物车商品总数量
+     * @returns 购物车商品总数量
+     */
+    getTotalNum(): number {
+      return this.cartList.map(it => it.skuList.map(its => its.num)).reduce((a, b) => a.concat(b), []).reduce((a, b) => a + b, 0)
+    },
+  },
   actions: {
     /**
      * 星闪豹加入购物车逻辑
      * @param skuId 商品skuId
      * @param num 商品数量
+     * @param shopId 门店id
      */
-    async addCart(skuId: number, num: number) {
+    async addCart(skuId: number, num: number, shopId: number) {
       return new Promise((resolve, reject) => {
         if (!skuId) {
           useGlobalToast().show({ msg: '请选择商品规格' })
@@ -28,19 +38,53 @@ export const useXsbCartStore = defineStore('xsb-cart', {
           }, 2000)
           return reject(new Error('请先登录'))
         }
-        const { SelectShopInfo } = storeToRefs(useSysXsbStore())
         Apis.common.addShoppingCart({
           data: {
             businessType: 'XSB',
             skuId,
             num,
-            shopId: SelectShopInfo.value?.shopId,
+            shopId,
             channelId: userInfo.value.channelId,
           },
         }).then((res) => {
+          this.getCartList()
           resolve(res)
         })
       })
     },
+    /**
+     * 星闪豹获取购物车列表
+     */
+    async getCartList() {
+      const { userInfo, token } = storeToRefs(useUserStore())
+      if (!unref(token)) {
+        return
+      }
+      const res = await Apis.common.myShoppingCart({
+        data: {
+          channelId: unref(userInfo).channelId,
+          businessType: 'XSB',
+        },
+      })
+      this.cartList = res.data
+    },
+    /**
+     *
+     * @param ids
+     * @returns 计算选中商品总价
+     */
+    async getCartAddGoodsPrice(ids: string): Promise<Api.shoppingCartOrderConfirm> {
+      return new Promise((resolve, reject) => {
+        uni.showLoading({ mask: true })
+        Apis.common.shoppingCartOrderConfirm({
+          pathParams: {
+            ids,
+          },
+        }).then((res) => {
+          resolve(res.data)
+        }).catch(err => reject(err)).finally(() => uni.hideLoading())
+      })
+    },
+
   },
 })

+ 40 - 37
src/subPack-xsb/store-xsb/sys.ts

@@ -38,47 +38,50 @@ export const useSysXsbStore = defineStore('system-xsb', {
   }),
   actions: {
     getTabbarItemValue(name: string) {
-      console.log(name)
-
-      return 0
+      if (name === 'xsb-cart') {
+        const { getTotalNum } = storeToRefs(useXsbCartStore())
+        return getTotalNum.value
+      }
     },
     async getAllShopList() {
-      const { Location } = storeToRefs(useAddressStore())
-      if (Location.value.latitude == null || Location.value.longitude == null) {
-        useAddressStore().getLocation()
-        return
-      }
-      const res = await Apis.xsb.shopList({})
-      this.xsbShopList = res
-
-      const getDistance = (lat1: number, lng1: number, lat2: number, lng2: number): number => {
-        const R = 6371 // 地球半径(公里)
-        const dLat = (lat2 - lat1) * Math.PI / 180
-        const dLng = (lng2 - lng1) * Math.PI / 180
-        const a
-      = Math.sin(dLat / 2) * Math.sin(dLat / 2)
-        + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180)
-        * Math.sin(dLng / 2) * Math.sin(dLng / 2)
-        const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
-        return R * c // 距离(公里)
-      }
-      let minDistance = Infinity
-      for (const shop of res) {
-        if (shop.shopLat && shop.shopLng) {
-          const distance = getDistance(
-            Location.value.latitude,
-            Location.value.longitude,
-            Number(shop.shopLat),
-            Number(shop.shopLng),
-          )
+      return new Promise((resolve, reject) => {
+        Apis.xsb.shopList({}).then((res) => {
+          this.xsbShopList = res.data
+          const { Location } = storeToRefs(useAddressStore())
+          if (Location.value.latitude == null || Location.value.longitude == null) {
+            useAddressStore().getLocation()
+            return
+          }
+          const getDistance = (lat1: number, lng1: number, lat2: number, lng2: number): number => {
+            const R = 6371 // 地球半径(公里)
+            const dLat = (lat2 - lat1) * Math.PI / 180
+            const dLng = (lng2 - lng1) * Math.PI / 180
+            const a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
+              + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180)
+              * Math.sin(dLng / 2) * Math.sin(dLng / 2)
+            const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
+            return R * c // 距离(公里)
+          }
+          let minDistance = Infinity
+          for (const shop of res.data) {
+            if (shop.shopLat && shop.shopLng) {
+              const distance = getDistance(
+                Location.value.latitude,
+                Location.value.longitude,
+                Number(shop.shopLat),
+                Number(shop.shopLng),
+              )
 
-          if (distance < minDistance) {
-            minDistance = distance
-            // nearbyAddress.value = { ...shop, distance: Number(distance.toFixed(2)) }
-            this.SelectShopInfo = { ...shop, distance: Number(distance.toFixed(2)) }
+              if (distance < minDistance) {
+                minDistance = distance
+                // nearbyAddress.value = { ...shop, distance: Number(distance.toFixed(2)) }
+                this.SelectShopInfo = { ...shop, distance: Number(distance.toFixed(2)) }
+              }
+            }
           }
-        }
-      }
+          resolve(res)
+        }).catch((err) => { reject(err) })
+      })
     },
 
   },