Browse Source

Merge branch 'zhangtao'

zhangtao 3 days ago
parent
commit
1fd211626a

+ 1 - 0
async-import.d.ts

@@ -7,6 +7,7 @@ export {}
 interface ModuleMap {
   '@/subPack-xsb/utils/order-data': typeof import('@/subPack-xsb/utils/order-data')
   '@/subPack-xsb/utils/confirm-order': typeof import('@/subPack-xsb/utils/confirm-order')
+  '@/subPack-xsb/store-xsb/sys': typeof import('@/subPack-xsb/store-xsb/sys')
   [path: string]: any
 }
 

+ 81 - 1
src/api/api.type.d.ts

@@ -385,6 +385,10 @@ namespace Api {
     [property: string]: any
   }
   interface xsbShopList {
+    /**
+     * 是否有权限 1-有权限 0-无权限
+     */
+    isPermiss?: number
     /**
      * 店铺所在区域(描述)
      * 店铺所在区域
@@ -534,6 +538,14 @@ namespace Api {
     [property: string]: any
   }
   interface xsbOrderList {
+    /**
+     *  经度
+     */
+    longitude: number
+    /**
+     *  纬度
+     */
+    latitude: number
     /**
      * 实际总值(用户实付)
      */
@@ -615,7 +627,7 @@ namespace Api {
      * 海博订单状态:0-待支付,1-待发货(快递使用),20-订单已接单(待拣货),30-订单待配送(拣货完成/自提类订单为待自提),40-订单配送中
      * ,50-订单取消待审核,60-订单已取消,70-订单已送达,80-订单已完成
      */
-    hbOrderStatus?: number
+    hbOrderStatus: number
     /**
      * 是否已经支付,1:已经支付过,0:,没有支付过
      */
@@ -752,6 +764,10 @@ namespace Api {
      * 使用积分
      */
     useScore?: number
+    /**
+     * 前端使用字段
+     */
+    num: number
     [property: string]: any
   }
   interface myShoppingCart {
@@ -790,6 +806,10 @@ namespace Api {
     [property: string]: any
   }
   interface CartSkuVo {
+    /**
+     * 商品ID
+     */
+    prodId: number
     createTime?: string
     /**
      * 主键
@@ -1047,5 +1067,65 @@ namespace Api {
     updateTime?: string
     [property: string]: any
   }
+  interface sysDict {
+    createTime: string
+    id: number
+    name: string
+    remark: string
+    status: number
+    typeCode: string
+    value: string
+  }
+  interface RiderInfo {
+    /**
+     * 骑手姓名
+     */
+    courierName?: string
+    /**
+     * 骑手电话
+     */
+    courierPhone?: string
+    /**
+     * 骑手纬度
+     */
+    riderLatitude?: number
+    /**
+     * 骑手经度
+     */
+    riderLongitude?: number
+    /**
+     * 门店纬度
+     */
+    shopLatitude?: number
+    /**
+     * 门店经度
+     */
+    shopLongitude?: number
+    [property: string]: any
+  }
+  interface DeliveryNode {
+    id: number
+    /**
+     * 内容
+     */
+    content?: string
+    /**
+     * 创建时间
+     */
+    createTime?: string
+    /**
+     * 订单号
+     */
+    orderNumber?: string
+    /**
+     * 订单备注
+     */
+    remark?: string
+    /**
+     * 修改时间
+     */
+    updateTime?: string
+    [property: string]: any
+  }
 
 }

+ 7 - 0
src/api/apiDefinitions.ts

@@ -28,6 +28,7 @@ export default {
   'sys.userInfo': ['GET', '/smqjh-system/app-api/v1/members/me'],
   'sys.addresses': ['GET', '/smqjh-system/app-api/v1/addresses'],
   'sys.Addaddresses': ['POST', '/smqjh-system/app-api/v1/addresses'],
+  'sys.dictPage': ['GET', '/smqjh-system/api/v1/dict/page'],
   'sys.updateAddresses': ['PUT', '/smqjh-system/app-api/v1/addresses/updateAddress'],
   'sys.deleteAddresses': ['DELETE', '/smqjh-system/app-api/v1/addresses/{ids}'],
   'sys.addressesDetail': ['GET', '/smqjh-system/app-api/v1/addresses/{addressId}'],
@@ -42,6 +43,7 @@ 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.nearestShop':['GET', '/smqjh-pms//app-api/v1/shop/nearestShop'],
   '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'],
@@ -50,6 +52,11 @@ export default {
   'xsb.myShoppingCartCategory':['GET', '/smqjh-oms/app-api/v1/shoppingCart/myShoppingCartCategory'],
   'xsb.delivery':['GET', '/smqjh-system/app-api/v1/delivery'],
   'xsb.confirmReceipt':['GET', '/smqjh-oms/api/v1/order/confirmReceipt'],
+  'xsb.applyRefund':['POST', '/smqjh-oms/app-api/v1/refund/applyRefund'],
+  'xsb.calculateMoney':['POST', '/smqjh-oms/app-api/v1/refund/calculateMoney'],
+  'xsb.riderInfo':['GET', '/smqjh-oms/api/v1/order/riderInfo'],
+  'xsb.deliveryNode':['GET', '/smqjh-oms/api/v1/order/deliveryNode'],
+  'xsb.findByOrderNumber':['GET', '/smqjh-oms/app-api/v1/refund/findByOrderNumber'],
 
   'common.myShoppingCart':['GET', '/smqjh-oms/app-api/v1/shoppingCart/myShoppingCart'],
   'common.addShoppingCart':['POST', '/smqjh-oms/app-api/v1/shoppingCart/addShoppingCart'],

+ 20 - 16
src/api/core/handlers.ts

@@ -1,5 +1,4 @@
 import type { Method } from 'alova'
-import router from '@/router'
 
 // Custom error class for API errors
 export class ApiError extends Error {
@@ -33,16 +32,18 @@ export async function handleAlovaResponse(
   const { statusCode, data } = response as UniNamespace.RequestSuccessCallbackResult
   // 处理401/403错误(如果不是在handleAlovaResponse中处理的)
   if ((statusCode === 401 || statusCode === 403)) {
-    const { redirectName, token } = storeToRefs(useUserStore())
-    // 如果是未授权错误,清除用户信息并跳转到登录页
-    token.value = ''
+    const { redirectName } = storeToRefs(useUserStore())
     useSmqjhCartStore().$reset()
-    globalToast.error({ msg: '登录已过期,请重新登录!', duration: 2000 })
+    // 如果是未授权错误,清除用户信息并跳转到登录页
+    useUserStore().$reset()
     redirectName.value = getCurrentPath()
-    const timer = setTimeout(() => {
-      clearTimeout(timer)
-      router.replace({ name: 'smqjh-login' })
-    }, 2000)
+    // useGlobalMessage().confirm({
+    //   title: '提示',
+    //   msg: '登录已过期,请重新登录!',
+    //   success: () => {
+    //     router.replace({ name: 'smqjh-login' })
+    //   },
+    // })
 
     throw new ApiError('登录已过期,请重新登录!', statusCode, data)
   }
@@ -79,15 +80,18 @@ export function handleAlovaError(error: any, method: Method) {
   // 处理401/403错误(如果不是在handleAlovaResponse中处理的)
   if (error instanceof ApiError && (error.code === 401 || error.code === 403)) {
     // 如果是未授权错误,清除用户信息并跳转到登录页
-    const { redirectName, token } = storeToRefs(useUserStore())
+    const { redirectName } = storeToRefs(useUserStore())
+    useSmqjhCartStore().$reset()
     // 如果是未授权错误,清除用户信息并跳转到登录页
-    token.value = ''
-    globalToast.error({ msg: '登录已过期,请重新登录!', duration: 2000 })
+    useUserStore().$reset()
     redirectName.value = getCurrentPath()
-    const timer = setTimeout(() => {
-      clearTimeout(timer)
-      router.replace({ name: 'smqjh-login' })
-    }, 2000)
+    // useGlobalMessage().confirm({
+    //   title: '提示',
+    //   msg: '登录已过期,请重新登录!',
+    //   success: () => {
+    //     router.replace({ name: 'smqjh-login' })
+    //   },
+    // })
     throw new ApiError('登录已过期,请重新登录!', error.code, error.data)
   }
 

+ 126 - 1
src/api/globals.d.ts

@@ -181,8 +181,133 @@ declare global {
       >(
         config: Config
       ): Alova2Method<apiResData<Api.addressList>, 'sys.addressesDetail', Config>;
+      dictPage<
+        Config extends Alova2MethodConfig<listData<Api.sysDict>> & {
+          data: {
+            typeCode: string;
+          };
+        }
+      >(
+        config: Config
+      ): Alova2Method<listData<Api.sysDict>, 'sys.dictPage', Config>;
     }
     xsb: {
+      findByOrderNumber<
+        Config extends Alova2MethodConfig<apiResData<Api.xsbOmsOrderItem[]>> & {
+          data: {
+            orderNumber: string;
+          };
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<Api.xsbOmsOrderItem[]>, 'xsb.findByOrderNumber', Config>;
+      deliveryNode<
+        Config extends Alova2MethodConfig<apiResData<Api.DeliveryNode[]>> & {
+          data: {
+            orderNumber: string;
+          };
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<Api.DeliveryNode[]>, 'xsb.deliveryNode', Config>;
+      riderInfo<
+        Config extends Alova2MethodConfig<apiResData<Api.RiderInfo>> & {
+          data: {
+            orderNumber: string
+          };
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<Api.RiderInfo>, 'xsb.riderInfo', Config>;
+      calculateMoney<
+        Config extends Alova2MethodConfig<apiResData<any>> & {
+          data: {
+            orderRefundSkuList: { orderItemId: number, productCount: number }[];
+            orderNumber: string
+          };
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<any>, 'xsb.applyRefund', Config>;
+      applyRefund<
+        Config extends Alova2MethodConfig<apiResData<any>> & {
+          data: {
+            /**
+    * 退款类型 1,仅退款,2退款退货,5差价退款
+    */
+            applyType?: number;
+            /**
+             * 退款订单业务类型 1-星闪豹
+             */
+            businessType?: number;
+            /**
+             * 备注说明
+             */
+            buyerDesc?: string;
+            /**
+             * 手机号码(默认当前订单手机号码)
+             */
+            buyerMobile?: string;
+            /**
+             * 仅退款-未收到货申请原因
+             * 11(质量问题)
+             * 12(拍错/多拍/不喜欢)
+             * 3(商品描述不符)
+             * 14(假货), 15(商家发错货)
+             * 16(商品破损/少件)
+             * 17(其他)
+             * 仅退款-已收到货申请原因
+             * 51(多买/买错/不想要)
+             * 52(快递无记录)
+             * 53(少货/空包裹)
+             * 54(未按约定时间发货)
+             * 55(快递一直未送达)
+             * 56(其他)
+             * 退货退款-申请原因
+             * 101(商品破损/少件)
+             * 102(商家发错货)
+             * 103(商品描述不符)
+             * 104(拍错/多拍/不喜欢)
+             * 105(质量问题)
+             * 107(其他)
+             */
+            buyerReason?: string;
+            /**
+             * 订单编号
+             */
+            orderNumber?: string;
+            /**
+             * 退款商品详情
+             */
+            orderRefundSkuList?: AppOrderRefundSkuVo[];
+            /**
+             * 凭证图片列表使用,分割
+             */
+            photoFiles?: string;
+            /**
+             * 退款金额
+             */
+            refundAmount?: number;
+            /**
+             * 退款单类型(1:整单退款,2:单个物品退款)
+             */
+            refundType?: number;
+            [property: string]: any;
+          };
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<any>, 'xsb.applyRefund', Config>;
+      nearestShop<
+        Config extends Alova2MethodConfig<apiResData<{ nearestShopId: number }>> & {
+          data: {
+            latitude: number;
+            longitude: number
+          };
+        }
+      >(
+        config: Config
+      ): Alova2Method<apiResData<{ nearestShopId: number }>, 'xsb.nearestShop', Config>;
       categories<
         Config extends Alova2MethodConfig<apiResData<Api.xsbCategories[]>> & {
           data: {
@@ -356,7 +481,7 @@ declare global {
         }
       >(
         config: Config
-      ): Alova2Method<apiResData<{deliveryType:number}>, 'xsb.delivery', Config>;
+      ): Alova2Method<apiResData<{ deliveryType: number }>, 'xsb.delivery', Config>;
       confirmReceipt<
         Config extends Alova2MethodConfig<any> & {
           data: {

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

@@ -16,6 +16,7 @@ declare global {
   const apiDefinitions: typeof import('./api/apiDefinitions')['default']
   const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
   const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
+  const calculateCenterPointSpherical: typeof import('./utils/index')['calculateCenterPointSpherical']
   const computed: typeof import('vue')['computed']
   const computedAsync: typeof import('@vueuse/core')['computedAsync']
   const computedEager: typeof import('@vueuse/core')['computedEager']
@@ -63,6 +64,7 @@ declare global {
   const isReactive: typeof import('vue')['isReactive']
   const isReadonly: typeof import('vue')['isReadonly']
   const isRef: typeof import('vue')['isRef']
+  const isWxMiniProgram: typeof import('./utils/index')['isWxMiniProgram']
   const makeDestructurable: typeof import('@vueuse/core')['makeDestructurable']
   const mapActions: typeof import('pinia')['mapActions']
   const mapGetters: typeof import('pinia')['mapGetters']
@@ -391,6 +393,7 @@ declare module 'vue' {
     readonly apiDefinitions: UnwrapRef<typeof import('./api/apiDefinitions')['default']>
     readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
     readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
+    readonly calculateCenterPointSpherical: UnwrapRef<typeof import('./utils/index')['calculateCenterPointSpherical']>
     readonly computed: UnwrapRef<typeof import('vue')['computed']>
     readonly computedAsync: UnwrapRef<typeof import('@vueuse/core')['computedAsync']>
     readonly computedEager: UnwrapRef<typeof import('@vueuse/core')['computedEager']>
@@ -432,6 +435,7 @@ declare module 'vue' {
     readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
     readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
     readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
+    readonly isWxMiniProgram: UnwrapRef<typeof import('./utils/index')['isWxMiniProgram']>
     readonly makeDestructurable: UnwrapRef<typeof import('@vueuse/core')['makeDestructurable']>
     readonly mapActions: UnwrapRef<typeof import('pinia')['mapActions']>
     readonly mapGetters: UnwrapRef<typeof import('pinia')['mapGetters']>
@@ -440,7 +444,6 @@ declare module 'vue' {
     readonly mapWritableState: UnwrapRef<typeof import('pinia')['mapWritableState']>
     readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
     readonly mountApis: UnwrapRef<typeof import('./api/createApis')['mountApis']>
-    readonly navCommonMiniProgram: UnwrapRef<typeof import('./utils/index')['navCommonMiniProgram']>
     readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
     readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
     readonly onAddToFavorites: UnwrapRef<typeof import('@dcloudio/uni-app')['onAddToFavorites']>

+ 0 - 2
src/components.d.ts

@@ -35,8 +35,6 @@ declare module 'vue' {
     WdRadio: typeof import('wot-design-uni/components/wd-radio/wd-radio.vue')['default']
     WdRadioGroup: typeof import('wot-design-uni/components/wd-radio-group/wd-radio-group.vue')['default']
     WdRate: typeof import('wot-design-uni/components/wd-rate/wd-rate.vue')['default']
-    WdSidebar: typeof import('wot-design-uni/components/wd-sidebar/wd-sidebar.vue')['default']
-    WdSidebarItem: typeof import('wot-design-uni/components/wd-sidebar-item/wd-sidebar-item.vue')['default']
     WdSkeleton: typeof import('wot-design-uni/components/wd-skeleton/wd-skeleton.vue')['default']
     WdSortButton: typeof import('wot-design-uni/components/wd-sort-button/wd-sort-button.vue')['default']
     WdStatusTip: typeof import('wot-design-uni/components/wd-status-tip/wd-status-tip.vue')['default']

+ 1 - 8
src/components/CollapsePanel.vue

@@ -25,12 +25,10 @@ const emit = defineEmits<{
 
 const _this = getCurrentInstance()
 
-// 响应式数据
 const isExpanded = ref(props.defaultExpanded)
 const contentHeight = ref(0)
 const showToggle = ref(false)
 
-// 计算属性
 const toggleText = computed(() =>
   isExpanded.value ? props.collapseText : props.expandText,
 )
@@ -38,7 +36,6 @@ const toggleText = computed(() =>
 const contentStyle = computed(() => {
   const style: Record<string, string> = {}
   if (isExpanded.value) {
-    // 展开状态,不限制高度
     style.overflow = 'visible'
   }
   else {
@@ -50,13 +47,11 @@ const contentStyle = computed(() => {
   return style
 })
 
-// 方法
 function handleToggle() {
   isExpanded.value = !isExpanded.value
   emit('toggle', isExpanded.value)
 }
 
-// 获取内容高度
 function getContentHeight() {
   return new Promise<number>((resolve) => {
     const query = uni.createSelectorQuery().in(_this)
@@ -72,7 +67,6 @@ function getContentHeight() {
   })
 }
 
-// 检查是否需要显示展开按钮
 async function checkNeedToggle() {
   await nextTick()
 
@@ -110,7 +104,6 @@ watch(() => props.inline, () => {
 })
 
 onMounted(() => {
-  // 使用setTimeout确保DOM已渲染
   setTimeout(() => {
     checkNeedToggle()
   }, 100)
@@ -120,7 +113,7 @@ onMounted(() => {
 <template>
   <view class="collapse-panel">
     <view
-      class="collapse-panel__content"
+      class="collapse-panel__content pb20rpx"
       :class="{
         'collapse-panel__content--collapsed': !isExpanded,
         'collapse-panel__content--expanded': isExpanded,

+ 2 - 0
src/composables/useTabbar.ts

@@ -35,6 +35,8 @@ export function useTabbar() {
   }
 
   const setTabbarItem = (name: string, value: number) => {
+    console.log('设置市民请集合购物车数量===========================')
+
     const tabbarItem = tabbarItems.value.find(item => item.name === name)
     if (tabbarItem) {
       tabbarItem.value = value

+ 6 - 28
src/config/index.ts

@@ -1,12 +1,3 @@
-/**
- * 星闪豹appid
- */
-export const ZSWLXSB_APPID = 'wxbc64403830bb13c5'
-
-export const ZSWLZSDD_APPID = 'wx9894a01b9e92c368'
-
-export const VITE_OSS_BASE_URL = 'https://zswl-shop.oss-cn-chengdu.aliyuncs.com/'
-
 const mapEnvVersion = {
   /**
    * 开发版
@@ -16,35 +7,22 @@ const mapEnvVersion = {
   // develop: 'http://192.168.0.157:8080',
   // develop: 'http://192.168.1.253:8080',
   // develop: 'http://192.168.1.89:8080', // 田
-  // develop: 'http://47.109.84.152:8081',
-  develop: 'https://smqjh.api.zswlgz.com',
+  develop: 'http://47.109.84.152:8081',
+  // develop: 'https://smqjh.api.zswlgz.com',
   /**
    * 体验版
    */
   // trial: "http://192.168.1.166:8080/jeecg-boot",
   // trial: 'http://192.168.0.157:8080',
-  trial: 'http://47.109.84.152:8081',
-  // trial: 'https://smqjh.api.zswlgz.com',
+  // trial: 'http://47.109.84.152:8081',
+  // trial: 'http://192.168.1.166:8080',
+  trial: 'https://smqjh.api.zswlgz.com',
   /**
    * 正式版
    */
   release: 'https://smqjh.api.zswlgz.com',
 }
 
-const mapEnvStaticVersion = {
-  /**
-   * 测试环境
-   */
-  develop: 'https://zswl-smqjh.oss-cn-chengdu.aliyuncs.com/static/static',
-  /**
-   * 体验环境
-   */
-  trial: 'https://zswl-smqjh.oss-cn-chengdu.aliyuncs.com/static/static',
-  /**
-   * 正式环境
-   */
-  release: 'https://zswl-smqjh.oss-cn-chengdu.aliyuncs.com/static/static',
-}
 /**
  * Base URL请求基本url
  */
@@ -55,4 +33,4 @@ export const BASE_URL
  * 静态资源服务
  */
 
-export const StaticUrl = mapEnvStaticVersion[uni.getAccountInfoSync().miniProgram.envVersion]
+export const StaticUrl = 'https://zswl-smqjh.oss-cn-chengdu.aliyuncs.com/static/static'

+ 0 - 12
src/pages.json

@@ -296,18 +296,6 @@
     {
       "root": "subPack-smqjh",
       "pages": [
-        {
-          "path": "goodsList/index",
-          "type": "page",
-          "name": "smqjh-goodsList",
-          "islogin": false,
-          "style": {
-            "navigationBarTitleText": "商品列表",
-            "navigationStyle": "custom",
-            "backgroundColor": "#F4FFD1",
-            "backgroundColorTop": "#F4FFD1"
-          }
-        },
         {
           "path": "order/index",
           "type": "page",

+ 4 - 7
src/pages/cart/index.vue

@@ -15,7 +15,7 @@ definePage({
   },
 })
 const { cartList, isCartAllChecked, totalProduct } = storeToRefs(useSmqjhCartStore())
-const { smqjhSelectedAddress, token } = storeToRefs(useUserStore())
+const { smqjhSelectedAddress } = storeToRefs(useUserStore())
 const cartStore = useSmqjhCartStore()
 const tab = ref(0)
 const selectAddress = ref(false)
@@ -36,11 +36,8 @@ watch(() => cartList.value, async () => {
   deep: true,
 })
 
-function handleSelectAddress() {
-  if (!token.value) {
-    useGlobalToast().show({ msg: '请先登录!' })
-    return
-  }
+async function handleSelectAddress() {
+  await useUserStore().checkLogin()
   selectAddress.value = true
 }
 </script>
@@ -96,7 +93,7 @@ function handleSelectAddress() {
                 <image
                   :src="item.pic"
                   class="h206rpx w200rpx flex-shrink-0"
-                  @click.stop="router.push({ name: 'xsb-goods', params: { id: String(item.skuId) } })"
+                  @click.stop="router.push({ name: 'xsb-goods', params: { id: String(item.prodId) } })"
                 />
                 <view class="ml20rpx flex-1">
                   <view class="text-left text-28rpx font-semibold">

+ 14 - 11
src/pages/classfiy/index.vue

@@ -22,12 +22,12 @@ async function getCategories() {
   active.value = classfiylist.value[0].id
 }
 getCategories()
-const rightList = computed(() => {
-  return classfiylist.value.find(item => item.id === active.value)?.children
-})
-function handleClick() {
-  useGlobalToast().show('此功能暂未开放!')
-}
+// const rightList = computed(() => {
+//   return classfiylist.value.find(item => item.id === active.value)?.children
+// })
+// function handleClick() {
+//   useGlobalToast().show('暂无数据!')
+// }
 </script>
 
 <template>
@@ -46,15 +46,18 @@ function handleClick() {
     </wd-navbar>
     <view class="h176rpx bg-#F4FFD1" />
     <view class="wraper">
-      <wd-sidebar v-model="active">
-        <wd-sidebar-item v-for="item in classfiylist" :key="item.id" :value="item.id" :label="item.name" />
-      </wd-sidebar>
+      <scroll-view class="w200rpx" :scroll-into-view-offset="-150" enable-passive scroll-with-animation scroll-y :scroll-into-view="`id${active}`">
+        <view v-for="item in classfiylist" :id="`id${item.id}`" :key="item.id" :class="[item.id == active ? 'bg-white' : '']" class="relative h100rpx flex items-center justify-center whitespace-nowrap text-28rpx">
+          {{ item.name }}
+          <view v-if="item.id == active" class="absolute left-0 top-20rpx h60rpx w8rpx rounded-4rpx bg-[var(--them-color)]" />
+        </view>
+      </scroll-view>
       <view class="content p20rpx">
         <image
           :src="`${StaticUrl}/class.png`"
           class="h144rpx w-full"
         />
-        <view class="mt24rpx">
+        <!-- <view class="mt24rpx">
           <view class="text-28rpx font-semibold">
             外卖外送
           </view>
@@ -78,7 +81,7 @@ function handleClick() {
               {{ item.name }}
             </view>
           </view>
-        </view>
+        </view> -->
       </view>
     </view>
   </view>

+ 71 - 35
src/pages/index/index.vue

@@ -1,6 +1,5 @@
 <script setup lang="ts">
-import { createGlobalLoadingMiddleware } from '@/api/core/middleware'
-import { StaticUrl, VITE_OSS_BASE_URL } from '@/config'
+import { StaticUrl } from '@/config'
 import router from '@/router'
 
 definePage({
@@ -17,47 +16,60 @@ definePage({
 const { show } = useGlobalToast()
 
 const addressStore = useAddressStore()
-const { statusBarHeight, MenuButtonHeight, opcity } = storeToRefs(useSysStore())
+const { statusBarHeight, MenuButtonHeight, opcity, isOnlineAudit } = storeToRefs(useSysStore())
 const { name } = storeToRefs(addressStore)
 const { userInfo } = storeToRefs(useUserStore())
-const { getTotalNum } = storeToRefs(useSmqjhCartStore())
-const { data: goodsList, isLastPage, page, reload, error, loading, refresh } = usePagination((pageNum, pageSize) =>
-  Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', shopId: 1, channelId: userInfo.value.channelId || 1 } }), {
+const xsbStore = ref<typeof import('@/subPack-xsb/store-xsb/sys')>()
+const { data: goodsList, isLastPage, page, reload, error, refresh } = usePagination((pageNum, pageSize) =>
+  Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', shopId: xsbStore.value?.useSysXsbStore().SelectShopInfo.shopId || 2, channelId: userInfo.value.channelId || 1 } }), {
   data: resp => resp.data?.list,
   initialData: [],
   initialPage: 1,
   initialPageSize: 10,
   append: true,
-  middleware: createGlobalLoadingMiddleware(),
   immediate: false,
 })
 const state = computed(() => {
   return error.value ? 'error' : !isLastPage.value ? 'loading' : 'finished'
 })
-onShow(() => {
+const loading = ref(true)
+
+onShow(async () => {
+  useSysStore().getAudit()
   useSmqjhCartStore().getCartList('XSB')
-  useTabbar().setTabbarItem('smqjh-cart', getTotalNum.value)
+
+  xsbStore.value = await AsyncImport('@/subPack-xsb/store-xsb/sys')
   refresh()
 })
+onMounted(() => {
+  setTimeout(() => {
+    loading.value = false
+  }, 1000)
+})
 onReachBottom(() => {
   if (!isLastPage.value) {
     page.value++
   }
 })
-const navList = ref([
-  { icon: `${VITE_OSS_BASE_URL}2025/11/4dabcf9b8d794d3c99aa6b49be34f205.png`, title: '星闪豹', name: 'xsb-homeTabbar' },
-  { icon: `${VITE_OSS_BASE_URL}2025/11/40cb38e287234a83885d68f30c9c39bc.png`, title: '充电', name: '' },
-  { icon: `${VITE_OSS_BASE_URL}2025/11/9981d979739b4ae6b4eec941b7d2c9b0.png`, title: '电影演出', name: '' },
-  { icon: `${VITE_OSS_BASE_URL}2025/11/f2b15ec1048e4b5689fe1ba26f6058e1.png`, title: '视频权益', name: '' },
-  { icon: `${VITE_OSS_BASE_URL}2025/11/0e971577095c406a88c5ea10af419246.png`, title: '大牌点餐', name: '' },
-  { icon: `${VITE_OSS_BASE_URL}2025/11/95e2ea622dbd498a8a36ab74f00209f3.png`, title: '加油', name: '' },
-  { icon: `${VITE_OSS_BASE_URL}2025/11/f5178ca02e3e4ebb9072d9e129bb3fd4.png`, title: '酒店民宿', name: '' },
-  { icon: `${VITE_OSS_BASE_URL}2025/11/d1f4d36d6fcc442a841f4f4f4927df19.png`, title: '代驾', name: '' },
-])
+
+const navList = computed(() => {
+  const list = [
+    { icon: `${StaticUrl}/xsb.png`, title: '星闪豹', name: 'xsb-homeTabbar', show: true },
+    { icon: `${StaticUrl}/smqjh-index-cd.png`, title: '充电', name: '', show: !isOnlineAudit.value },
+    { icon: `${StaticUrl}/smqjh-sp.png`, title: '电影演出', name: '', show: !isOnlineAudit.value },
+    { icon: `${StaticUrl}/smqjh-vip.png`, title: '视频权益', name: '', show: !isOnlineAudit.value },
+    { icon: `${StaticUrl}/smqjh-diancan.png`, title: '大牌点餐', name: '', show: !isOnlineAudit.value },
+    { icon: `${StaticUrl}/smqjh-jiayou.png`, title: '加油', name: '', show: !isOnlineAudit.value },
+    { icon: `${StaticUrl}/smqjh-jiudian.png`, title: '酒店民宿', name: '', show: !isOnlineAudit.value },
+    { icon: `${StaticUrl}/smqjh-daijia.png`, title: '代驾', name: '', show: !isOnlineAudit.value },
+  ]
+  return list
+})
 onMounted(() => {
   addressStore.getLocation()
   opcity.value = 0
 })
+
 onPageScroll((e) => {
   const calculatedOpacity = e.scrollTop / 100
   opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
@@ -119,25 +131,49 @@ function handleGo() {
       </view>
     </view>
     <view class="px24rpx -mt260rpx">
-      <view class="grid grid-cols-4 mt24rpx gap12rpx rounded-16rpx bg-white py24rpx">
-        <view
-          v-for="item in navList" :key="item.icon" class="flex flex-col items-center justify-center"
-          @click="handleClick(String(item.name))"
+      <view class="mt24rpx rounded-16rpx bg-white py24rpx" :class="[loading ? 'px24rpx' : '']">
+        <wd-skeleton
+          :loading="loading"
+          theme="image" :row-col="[
+            [
+              { width: '120rpx', height: '120rpx' },
+              { width: '120rpx', height: '120rpx' },
+              { width: '120rpx', height: '120rpx' },
+              { width: '120rpx', height: '120rpx' },
+            ],
+            [
+              { width: '120rpx', height: '120rpx' },
+              { width: '120rpx', height: '120rpx' },
+              { width: '120rpx', height: '120rpx' },
+              { width: '120rpx', height: '120rpx' },
+            ],
+
+          ]"
         >
-          <view class="relative h120rpx w120rpx">
-            <image :src="item.icon" class="h120rpx w120rpx" />
-            <view
-              v-if="item.title != '星闪豹'"
-              class="linebg absolute left-0 top-0 h-full w-full flex items-center justify-center rounded-32rpx text-24rpx text-white font-semibold"
-            >
-              敬请期待
-            </view>
-          </view>
-          <view class="text-24rpx">
-            {{ item.title }}
+          <view class="grid grid-cols-4 gap12rpx">
+            <template v-for="item in navList" :key="item.icon">
+              <view
+                v-if="item.show" class="flex flex-col items-center justify-center"
+                @click="handleClick(String(item.name))"
+              >
+                <view class="relative h120rpx w120rpx">
+                  <image :src="item.icon" class="h120rpx w120rpx" />
+                  <view
+                    v-if="item.title != '星闪豹'"
+                    class="linebg absolute left-0 top-0 h-full w-full flex items-center justify-center rounded-32rpx text-24rpx text-white font-semibold"
+                  >
+                    敬请期待
+                  </view>
+                </view>
+                <view class="text-24rpx">
+                  {{ item.title }}
+                </view>
+              </view>
+            </template>
           </view>
-        </view>
+        </wd-skeleton>
       </view>
+
       <view class="mt20rpx w-full flex items-center justify-between" @click="handleGo">
         <image :src="`${StaticUrl}/smqjh-fl.png`" class="h346rpx w344rpx flex-shrink-0" />
         <view class="flex flex-1 flex-col items-end justify-center">

+ 2 - 0
src/store/address.ts

@@ -51,6 +51,8 @@ export const useAddressStore = defineStore('address', {
     fetchActualLocation() {
       uni.getLocation({
         type: 'wgs84',
+        isHighAccuracy: true,
+        altitude: true,
         success: (res) => {
           console.log('位置获取成功', res)
           this.Location.latitude = res.latitude

+ 18 - 23
src/store/cart.ts

@@ -43,29 +43,24 @@ export const useSmqjhCartStore = defineStore('smqjh-cart', {
           useGlobalToast().show({ msg: '请选择商品规格' })
           return reject(new Error('请选择商品规格'))
         }
-        const { userInfo, token } = storeToRefs(useUserStore())
-        if (!token.value) {
-          useGlobalToast().show({ msg: '请先登录' })
-          setTimeout(() => {
-            router.replace({ name: 'smqjh-login' })
-          }, 2000)
-          return reject(new Error('请先登录'))
-        }
-        this.isAddingCart = true
-        Apis.common.addShoppingCart({
-          data: {
-            businessType,
-            skuId,
-            num,
-            shopId,
-            channelId: Number(userInfo.value.channelId),
-          },
-        }).then((res) => {
-          this.getCartList('XSB')
-          resolve(res)
-        }).finally(() => {
-          this.isAddingCart = false
-        })
+        const { userInfo } = storeToRefs(useUserStore())
+        useUserStore().checkLogin().then(() => {
+          this.isAddingCart = true
+          Apis.common.addShoppingCart({
+            data: {
+              businessType,
+              skuId,
+              num,
+              shopId,
+              channelId: Number(userInfo.value.channelId),
+            },
+          }).then((res) => {
+            this.getCartList('XSB')
+            resolve(res)
+          }).finally(() => {
+            this.isAddingCart = false
+          })
+        }).catch(err => reject(err))
       })
     },
     /**

+ 33 - 0
src/store/sys.ts

@@ -1,4 +1,5 @@
 import { defineStore } from 'pinia'
+import router from '@/router'
 
 interface SysState {
 
@@ -27,6 +28,10 @@ interface SysState {
    * 透明度
    */
   opcity: number
+  /**
+   * 是否上线审核
+   */
+  isOnlineAudit: boolean
 
 }
 export const useSysStore = defineStore('system', {
@@ -37,6 +42,7 @@ export const useSysStore = defineStore('system', {
     payBackIndexPath: '',
     payFailPath: '',
     opcity: 0,
+    isOnlineAudit: true,
   }),
   actions: {
     getSystemData() {
@@ -55,5 +61,32 @@ export const useSysStore = defineStore('system', {
       this.paySuccessPath = paySuccessPath
       this.payBackIndexPath = payBackIndexPath
     },
+    async getAudit() {
+      const res = await Apis.sys.dictPage({ data: { typeCode: 'sys_applet' } })
+      this.isOnlineAudit = res.data?.list[0].value === '0'
+    },
+
+    /**
+     * 申请退款获取退款订单信息
+     * @param orderNumber
+     * @returns
+     */
+    async getRefunOrder(orderNumber: string) {
+      uni.showLoading({ mask: true })
+      return new Promise((resolve, reject) => {
+        Apis.xsb.findByOrderNumber({
+          data: {
+            orderNumber,
+          },
+        }).then((res) => {
+          // resolve(res.data)
+          router.push({ name: 'common-afterSales', params: { order: JSON.stringify(res.data) } })
+          uni.hideLoading()
+        }).catch((err) => {
+          reject(err)
+          uni.hideLoading()
+        })
+      })
+    },
   },
 })

+ 29 - 2
src/store/user.ts

@@ -1,5 +1,6 @@
 import { defineStore } from 'pinia'
 import { StaticUrl } from '@/config'
+import router from '@/router'
 
 interface userStroe {
   token: string
@@ -54,8 +55,6 @@ export const useUserStore = defineStore('user', {
         await this.getuserAddresslist()
         this.getSelectedAddress()
         await useSmqjhCartStore().getCartList('XSB')
-        const { getTotalNum } = storeToRefs(useSmqjhCartStore())
-        useTabbar().setTabbarItem('smqjh-cart', getTotalNum.value)
       }
     },
     async updataUserInfo(data: Api.userInfo) {
@@ -104,6 +103,34 @@ export const useUserStore = defineStore('user', {
     updateSmqjhSelectedAddress(address: Api.addressList) {
       this.smqjhSelectedAddress = address
     },
+    /**
+     * 检测当前用户是否登录,如果没有登录弹窗提示未登录
+     */
+    checkLogin() {
+      return new Promise((resolve, reject) => {
+        if (!this.token) {
+          useGlobalMessage().confirm({
+            title: '提示',
+            msg: '检测到当前状态未登录,是否登录',
+            confirmButtonText: '登录',
+            cancelButtonText: '取消',
+            zIndex: 99999999999,
+            success() {
+              router.replace({ name: 'smqjh-login' })
+              setTimeout(() => { // 延迟1秒后抛错,防止立马抛错之后用户立即点击按钮会重复跳转登录页面
+                reject(new Error('未登录'))
+              }, 1000)
+            },
+            fail() {
+              reject(new Error('未登录'))
+            },
+          })
+        }
+        else {
+          resolve(1)
+        }
+      })
+    },
 
   },
 })

+ 11 - 2
src/subPack-common/addressList/index.vue

@@ -37,6 +37,15 @@ function handleSelectAddress(item: Api.addressList) {
   useUserStore().updateSelectedAddress(item)
   router.back()
 }
+async function handleAddAddress() {
+  await isWxMiniProgram()
+  router.push({ name: 'common-editAddress', params: { type: '1' } })
+}
+
+async function handleEditAddress(item: Api.addressList) {
+  await isWxMiniProgram()
+  router.push({ name: 'common-editAddress', params: { type: '2', id: `${item.id}` } })
+}
 </script>
 
 <template>
@@ -51,7 +60,7 @@ function handleSelectAddress(item: Api.addressList) {
             <image
               :src="`${StaticUrl}/edit-address.png`"
               class="h40rpx w40rpx"
-              @click.stop="router.push({ name: 'common-editAddress', params: { type: '2', id: `${item.id}` } })"
+              @click.stop="handleEditAddress(item)"
             />
           </view>
           <view class="mt24rpx text-24rpx text-#AAAAAA">
@@ -69,7 +78,7 @@ function handleSelectAddress(item: Api.addressList) {
 
     <view class="ios fixed bottom-0 left-0 box-border w-full rounded-t-32rpx bg-white px24rpx">
       <view class="w-full py20rpx">
-        <wd-button size="large" block @click="router.push({ name: 'common-editAddress', params: { type: '1' } })">
+        <wd-button size="large" block @click="handleAddAddress">
           新增收货地址
         </wd-button>
       </view>

+ 132 - 28
src/subPack-common/afterSales/index.vue

@@ -1,7 +1,4 @@
 <script setup lang="ts">
-import { StaticUrl } from '@/config'
-import router from '@/router'
-
 definePage({
   name: 'common-afterSales',
   islogin: true,
@@ -11,8 +8,8 @@ definePage({
 })
 const afterSalesType = ref(1)
 const isSeletAllGoods = ref(false)
-const selectGoods = ref([])
-const fileList = ref([])
+const selectGoods = ref<number[]>([])
+const fileList = ref<{ url: string }[]>([])
 const showReson = ref(false)
 const resonId = ref()
 const resonName = ref('请选择退款原因')
@@ -23,17 +20,123 @@ const resonList = [
   { id: 4, name: '商品斤两不足' },
   { id: 5, name: '商品临期到期' },
   { id: 6, name: '商品破损/包装破损' },
+  { id: 7, name: '其他' },
 ]
-function handleSubmit() {
+const orderList = ref<Api.xsbOmsOrderItem[]>([])
+const remark = ref('')
+onLoad((options: any) => {
+  orderList.value = JSON.parse(options.order)
+  orderList.value = orderList.value.map((item: Api.xsbOmsOrderItem) => {
+    item.num = 1
+    return item
+  })
+})
+const refunMoney = ref(0)
+const isSubmit = ref(false)
+
+async function handleSubmit() {
   console.log(fileList.value, 'fileList')
-  router.push({ name: 'xsb-afterSalesDetail' })
+  if (!selectGoods.value.length) {
+    useGlobalToast().show({ msg: '请选择需要退款的商品' })
+    return
+  }
+  if (!resonId.value) {
+    useGlobalToast().show({ msg: '请选择退款原因' })
+    return
+  }
+  if (!orderList.value[0].orderNumber) {
+    useGlobalToast().show({ msg: '订单数据异常' })
+    return
+  }
+  isSubmit.value = true
+  try {
+    await cathcApplRefund()
+    isSubmit.value = false
+  }
+  catch (e) {
+    isSubmit.value = false
+    console.log(e)
+  }
+  // router.push({ name: 'common-afterSalesDetail' })
+}
+
+function cathcApplRefund() {
+  uni.showLoading({ mask: true })
+  return new Promise((resolve, reject) => {
+    const filerData = orderList.value.filter(it => selectGoods.value.includes(Number(it.skuId)))
+    Apis.xsb.applyRefund({
+      data: {
+        orderNumber: orderList.value[0].orderNumber,
+        businessType: 1,
+        applyType: afterSalesType.value,
+        refundType: 2,
+        buyerReason: resonName.value,
+        buyerDesc: remark.value,
+        photoFiles: fileList.value.map(it => it.url).join(','),
+        orderRefundSkuList: filerData.map((it) => {
+          return {
+            orderItemId: it.orderItemId,
+            productCount: it.num,
+          }
+        }),
+      },
+    }).then((res) => { resolve(res) }).catch((err) => {
+      reject(err)
+    }).finally(() => { uni.hideLoading() })
+  })
 }
+
 function handleSelectReson() {
   if (!resonId.value)
     return uni.showToast({ title: '请选择退款原因', icon: 'none' })
   showReson.value = false
   resonName.value = resonList.find(item => item.id === resonId.value)?.name || '请选择退款原因'
 }
+
+function handleSelectGoods() {
+  console.log(orderList.value, 'orderList', selectGoods.value)
+  if (selectGoods.value.length === orderList.value.length) {
+    isSeletAllGoods.value = true
+  }
+  else {
+    isSeletAllGoods.value = false
+    refunMoney.value = 0
+  }
+}
+function handleChangeAll() {
+  console.log(isSeletAllGoods.value, 'isSeletAllGoods')
+  if (isSeletAllGoods.value) {
+    selectGoods.value = orderList.value.map(it => it.skuId) as number[]
+  }
+  else {
+    selectGoods.value = []
+    refunMoney.value = 0
+  }
+}
+watch(() => [selectGoods.value, orderList.value], () => {
+  if (selectGoods.value.length) {
+    getReufndMoney()
+  }
+})
+async function getReufndMoney() {
+  console.log(orderList.value[0].orderNumber, 'orderList.value')
+  const filerData = orderList.value.filter(it => selectGoods.value.includes(Number(it.skuId)))
+  const res = await Apis.xsb.calculateMoney({ data: {
+    orderNumber: String(orderList.value[0].orderNumber),
+    orderRefundSkuList: filerData.map((it) => {
+      return {
+        orderItemId: it.orderItemId,
+        productCount: it.num,
+      }
+    }),
+  } })
+  refunMoney.value = res.data
+}
+function handleChangeMoney() {
+  if (selectGoods.value.length) {
+    getReufndMoney()
+  }
+}
 </script>
 
 <template>
@@ -81,47 +184,48 @@ function handleSelectReson() {
             退款商品
           </view>
           <view class="text-28rpx text-#FF4D3A font-semibold">
-            退款金额:¥21
+            退款金额:¥{{ refunMoney }}
           </view>
         </view>
         <view class="mt24rpx">
-          <wd-checkbox v-model="isSeletAllGoods">
+          <wd-checkbox v-model="isSeletAllGoods" @change="handleChangeAll">
             全选
           </wd-checkbox>
         </view>
         <view class="mt24rpx h2rpx w-full bg-#F0F0F0" />
         <view class="goods mt24rpx">
           <CollapsePanel :line-height="150">
-            <wd-checkbox-group v-model="selectGoods">
-              <view v-for="item in 10" :key="item" class="mb20rpx">
-                <wd-checkbox :model-value="item">
-                  <view class="w-full flex items-center">
-                    <image :src="`${StaticUrl}/shu.png`" class="h120rpx w120rpx flex-shrink-0" />
-                    <view class="ml20rpx flex-1">
-                      <view class="flex items-center justify-between">
-                        <view class="text-28rpx">
-                          赶海季生鲜大闸蟹
+            <wd-checkbox-group v-model="selectGoods" @change="handleSelectGoods">
+              <template v-for="item in orderList" :key="item.skuId">
+                <view class="flex items-center justify-between">
+                  <wd-checkbox :model-value="item.skuId" />
+                  <view class="box-border w-full flex items-center">
+                    <image :src="item.pic" class="h120rpx w120rpx flex-shrink-0" />
+                    <view class="ml20rpx box-border flex-1">
+                      <view class="w-full flex justify-between">
+                        <view class="max-w-320rpx whitespace-pre-wrap break-words break-all text-28rpx">
+                          {{ item.prodName }}
                         </view>
-                        <view class="text-32rpx text-#FF4D3A font-semibold">
-                          ¥103.95
+                        <view class="w30% flex-shrink-0 text-32rpx text-#FF4D3A font-semibold">
+                          ¥{{ item.productTotalAmount }}
                         </view>
                       </view>
                       <view class="text-24rpx text-#AAAAAA">
-                        规格:5kg,盒
+                        规格:{{ item.spec }}
                       </view>
                       <view class="flex items-center justify-between">
                         <view class="text-24rpx text-#AAAAAA">
-                          单价:¥1.8
+                          单价:¥{{ item.price }}
                         </view>
                         <view>
-                          <wd-input-number />
+                          <wd-input-number v-model="item.num" :max="item.prodCount" :min="1" @change="handleChangeMoney" />
                         </view>
                       </view>
                     </view>
                   </view>
-                </wd-checkbox>
-                <view class="mt20rpx h2rpx w-full bg-#F0F0F0" />
-              </view>
+                </view>
+                <view class="my20rpx h2rpx w-full bg-#F0F0F0" />
+              </template>
             </wd-checkbox-group>
           </CollapsePanel>
         </view>
@@ -138,7 +242,7 @@ function handleSelectReson() {
           </view>
         </view>
         <view class="mt20rpx rounded-16rpx bg-#F6F6F6 p24rpx">
-          <wd-textarea placeholder="请填写退款原因" show-word-limit :maxlength="200" />
+          <wd-textarea v-model="remark" placeholder="请填写退款原因" show-word-limit :maxlength="200" />
           <view class="upload mt18rpx">
             <Zupload v-model:value="fileList" />
           </view>
@@ -181,7 +285,7 @@ function handleSelectReson() {
     <view
       class="ios fixed bottom-0 z-10 box-border w-full w-full rounded-t-32rpx bg-white px32rpx pt-16rpx"
     >
-      <wd-button block @click="handleSubmit">
+      <wd-button block :loading="isSubmit" @click="handleSubmit">
         提交
       </wd-button>
     </view>

+ 0 - 135
src/subPack-smqjh/goodsList/index.vue

@@ -1,135 +0,0 @@
-<script setup lang="ts">
-import { StaticUrl } from '@/config'
-import router from '@/router'
-import selectAddressTemplate from '@/subPack-smqjh/components/selectAddress/index.vue?async'
-
-definePage({
-  name: 'smqjh-goodsList',
-  islogin: false,
-  style: {
-    navigationBarTitleText: '商品列表',
-    navigationStyle: 'custom',
-    backgroundColor: '#F4FFD1',
-    backgroundColorTop: '#F4FFD1',
-  },
-})
-const { name } = storeToRefs(useAddressStore())
-const selectAddress = ref(false)
-const { statusBarHeight, MenuButtonHeight } = storeToRefs(useSysStore())
-
-const classfiylist = ref([
-  { title: '全部', icon: `${StaticUrl}/smqjh-class-all.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-  { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
-])
-const topNavActive = ref(0)
-const sortList = [
-  { title: '距离优先', id: 1 },
-  { title: '销量', id: 2 },
-  { title: '价格', id: 3 },
-]
-const sortActive = ref(1)
-function handleTopNavChange(idx: number) {
-  topNavActive.value = idx
-}
-function handleSortList(id: number) {
-  sortActive.value = id
-}
-</script>
-
-<template>
-  <view class="pages pb20rpx">
-    <wd-navbar
-      title="" custom-style="background-color:transparent !important" :bordered="false" :z-index="99"
-      safe-area-inset-top fixed
-    >
-      <template #left>
-        <view class="h-full flex items-center">
-          <wd-icon name="arrow-left" size="22px" @click="router.back()" />
-          <view class="ml10rpx flex items-center" @click.stop="selectAddress = true">
-            <image :src="`${StaticUrl}/location-green.png`" class="h33.8rpx w29rpx" />
-            <view class="ml10rpx max-w-280rpx truncate text-32rpx text-#222 font-semibold">
-              {{ name }}
-            </view>
-          </view>
-        </view>
-      </template>
-    </wd-navbar>
-    <view class="sticky left-0 top-0 z-9 box-border bg-#F4FFD1 pt20rpx" :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }">
-      <scroll-view scroll-x class="scrollx box-border w-full flex-shrink-0 whitespace-nowrap pl24rpx">
-        <view class="flex items-end pb10rpx">
-          <view v-for="item, idx in classfiylist" :key="idx" class="mr24rpx flex flex-col items-center justify-center" @click="handleTopNavChange(idx)">
-            <image
-              :src="item.icon"
-              :class="[topNavActive == idx ? 'overflow-hidden border-solid border-[var(--them-color)] border-2rpx rounded-26rpx h84rpx w-84rpx' : 'h72rpx w-72rpx']"
-            />
-            <view class="mt16rpx text-22rpx" :class="[topNavActive == idx ? 'bg-[var(--them-color)] rounded-18rpx px-8rpx py2rpx text-white text-24rpx' : '']">
-              {{ item.title }}
-            </view>
-          </view>
-        </view>
-      </scroll-view>
-      <view class="box-border w-full flex items-center bg-white p24rpx">
-        <view v-for="item in sortList" :key="item.id" :class="[sortActive == item.id ? 'bg-[var(--them-color)] text-white' : 'bg-#F6F6F6 text-#222']" class="mr32rpx rounded-24rpx px16rpx py6rpx text-24rpx" @click="handleSortList(item.id)">
-          {{ item.title }}
-        </view>
-      </view>
-    </view>
-    <view v-for="item in 10" :key="item" class="mb20rpx box-border w-full flex justify-between overflow-hidden bg-white p24rpx">
-      <image
-        :src="`${StaticUrl}/shu.png`"
-        class="h160rpx w160rpx flex-shrink-0 rounded-32rpx"
-      />
-      <view class="ml20rpx box-border flex-1">
-        <view class="flex items-center justify-between">
-          <view class="text-32rpx font-semibold">
-            花林兰州拉面(观山湖店)
-          </view>
-          <view class="text-24rpx text-#AAAAAA">
-            月售104
-          </view>
-        </view>
-        <view class="mt20rpx text-24rpx text-#AAAAAA">
-          起送¥20  配送¥4
-        </view>
-        <view class="mt20rpx flex items-center justify-between">
-          <view class="flex items-center text-#FFB639">
-            <wd-icon name="star-on" size="22px" />
-            <view class="ml8rpx text-32rpx font-semibold">
-              4.4分
-            </view>
-          </view>
-          <view class="text-24rpx">
-            15分钟 330m
-          </view>
-        </view>
-        <scroll-view scroll-x class="mt24rpx w-528rpx whitespace-nowrap">
-          <view class="flex items-center">
-            <view v-for="items in 10" :key="items" class="mr20rpx">
-              <image
-                :src="`${StaticUrl}/shu.png`"
-                class="h132rpx w132rpx flex-shrink-0 rounded-32rpx"
-              />
-              <view class="mt16rpx max-w-132rpx truncate text-24rpx">
-                番茄鸡蛋4545
-              </view>
-            </view>
-          </view>
-        </scroll-view>
-      </view>
-    </view>
-    <selectAddressTemplate v-model="selectAddress" />
-  </view>
-</template>
-
-<style scoped>
-
-</style>

+ 49 - 14
src/subPack-smqjh/order/index.vue

@@ -11,8 +11,8 @@ definePage({
     navigationBarTitleText: '订单列表',
   },
 })
-const subPackOrder = ref()
-const subPackComfirm = ref()
+const subPackOrder = ref<typeof import('@/subPack-xsb/utils/order-data')>()
+const subPackComfirm = ref<typeof import('@/subPack-xsb/utils/confirm-order')>()
 
 const navActiveTab = ref(0)
 const scrollViewId = ref()
@@ -45,6 +45,7 @@ function handleChangeTypeNav(value: number) {
   reload()
 }
 onShow(() => {
+  orderList.value = []
   refresh()
 })
 function handleChangeStatus(value: string) {
@@ -62,22 +63,33 @@ onReachBottom(() => {
   }
 })
 async function handleCancel(order: Api.xsbOrderList) {
-  await subPackOrder.value.handleCommonCancelOrder(order)
+  await subPackOrder.value?.handleCommonCancelOrder(order)
   reload()
 }
 async function handlePay(orderNumber: string) {
-  const res = await subPackComfirm.value.handleCommonPayMent(orderNumber)
-  if (res.payType !== 1) {
-    await subPackComfirm.value.getWxCommonPayment(res)
+  const res = await subPackComfirm.value?.handleCommonPayMent(orderNumber)
+  if (res?.payType !== 1 && res) {
+    await subPackComfirm.value?.getWxCommonPayment(res)
   }
   else {
     reload()
   }
 }
 async function handleSubmitOrder(order: Api.xsbOrderList) {
-  await subPackOrder.value.handleCommonOrderReceive(order)
+  await subPackOrder.value?.handleCommonOrderReceive(order)
+  reload()
+}
+async function handleDel(order: Api.xsbOrderList) {
+  await subPackOrder.value?.handleCommonDeleteOrder(order)
   reload()
 }
+async function handleAfterSale(item: Api.xsbOrderList) {
+  if (!item.orderItemList) {
+    useGlobalToast().show('商品异常!')
+    return
+  }
+  await useSysStore().getRefunOrder(item.orderNumber as string)
+}
 </script>
 
 <template>
@@ -174,19 +186,42 @@ async function handleSubmitOrder(order: Api.xsbOrderList) {
         </view>
         <view class="my24rpx flex items-center justify-end">
           <template v-if="item.hbOrderStatus === subPackOrder?.OrderStatus.PaddingPay">
-            <wd-button size="small" plain type="info" @click.stop="handleCancel(item)">
-              取消订单
-            </wd-button>
-            <view class="ml20rpx">
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleCancel(item)">
+                取消订单
+              </wd-button>
+            </view>
+            <view class="mr20rpx">
               <wd-button size="small" plain type="error" @click.stop="handlePay(item.orderNumber as string)">
                 付款
               </wd-button>
             </view>
           </template>
+          <template v-if="[subPackOrder?.OrderStatus.OrderCancel, subPackOrder?.OrderStatus.OrderCompleted].includes(item.hbOrderStatus) ">
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleDel(item)">
+                删除订单
+              </wd-button>
+            </view>
+            <!-- <view class="ml20rpx">
+              <wd-button size="small" plain type="error" >
+                再次购买
+              </wd-button>
+            </view> -->
+          </template>
           <template v-if="item.hbOrderStatus === subPackOrder?.OrderStatus.OrderArrived">
-            <wd-button size="small" plain type="info" @click.stop="handleSubmitOrder(item)">
-              确认收货
-            </wd-button>
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleSubmitOrder(item)">
+                确认收货
+              </wd-button>
+            </view>
+          </template>
+          <template v-if="[subPackOrder?.OrderStatus.OrderCompleted, subPackOrder?.OrderStatus.OrderWaitDelivery, subPackOrder?.OrderStatus.OrderAccepted].includes(item.hbOrderStatus) ">
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleAfterSale(item)">
+                申请售后
+              </wd-button>
+            </view>
           </template>
         </view>
       </view>

+ 31 - 24
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -53,6 +53,9 @@ const navHeight = computed(() => {
 const totalProduct = ref<Api.shoppingCartOrderConfirm>()
 function handleTopNavChange(item: Api.xsbCategoriesChildren) {
   topNavActive.value = item.code
+  if (!item.children)
+    return
+  goodsLoading.value = 'loading'
   leftActive.value = item.children[0].code
   show.value = false
   topScrollView.value = null
@@ -114,13 +117,15 @@ async function getProductList() {
   if (!isTopLoading.value) {
     goodsInTo.value = null
     nextTick(() => {
-      goodsInTo.value = res.data.length ? res.data[0].prodId : null
+      goodsInTo.value = res.data.length > 3 ? res.data[0].prodId : null
     })
   }
   else {
     goodsInTo.value = null
+
     nextTick(() => {
-      goodsInTo.value = res.data.length ? res.data[res.data.length - 4].prodId : null
+      goodsInTo.value = res.data.length > 4 ? res.data[res.data.length - 4].prodId : null
+      console.log(goodsInTo.value, 'goodsInTo.value=============')
     })
   }
   goodsLoading.value = 'finished'
@@ -154,10 +159,7 @@ function handleSrollTop() {
   }
 }
 async function handleAddCart(event: WechatMiniprogram.TouchEvent, item: Api.xsbCategoryProductList) {
-  if (!token.value) {
-    useGlobalToast().show('请先登录!')
-    return
-  }
+  await useUserStore().checkLogin()
   if (item.skuList.length > 1) {
     goodsInfo.value = item
     selectGoods.value = true
@@ -203,8 +205,8 @@ async function handleSubCart(event: WechatMiniprogram.TouchEvent, item: Api.xsbC
 
 onMounted(async () => {
   if (!topNavActive.value || !leftActive.value) {
-    topNavActive.value = props.categoryList[0].code || ''
-    leftActive.value = props.categoryList[0].children[0].code || ''
+    topNavActive.value = props.categoryList && props.categoryList[0].code
+    leftActive.value = props.categoryList[0].children && props.categoryList[0].children[0].code
   }
 
   if (leftActive.value) {
@@ -216,12 +218,10 @@ onMounted(async () => {
       topScrollView.value = topNavActive.value
     })
   }
+  getCartBox()
   if (token.value) {
-    goodsLoading.value = 'loading'
+    // goodsLoading.value = 'loading'
     await getCartCategorList()
-    if (cartList.value.length) {
-      getCartBox()
-    }
   }
 })
 
@@ -382,10 +382,18 @@ function handlePay() {
             v-for="item in classfiylist" :id="`id${item.code}`" :key="item.code"
             class="mr24rpx flex flex-col items-center justify-center" @click="handleTopNavChange(item)"
           >
-            <image
-              :src="item.icon"
-              :class="[topNavActive == item.code ? 'overflow-hidden border-solid border-[var(--them-color)] border-2rpx rounded-26rpx h84rpx w-84rpx' : 'h72rpx w-72rpx']"
-            />
+            <view class="relative">
+              <view class="box-border" :class="[topNavActive == item.code ? 'overflow-hidden border-solid border-[var(--them-color)] border-2rpx rounded-26rpx h84rpx w-84rpx' : 'h72rpx w-72rpx']">
+                <image
+                  :src="item.icon"
+                  class="h-full w-full"
+                />
+              </view>
+              <view v-if="!item.children" class="absolute left-0 top-0 h-full w-full flex items-center justify-center rounded-26rpx bg-[rgba(0,0,0,0.6)] text-16rpx text-white">
+                敬请期待
+              </view>
+            </view>
+
             <view
               class="mt16rpx text-22rpx"
               :class="[topNavActive == item.code ? 'bg-[var(--them-color)] rounded-18rpx px-8rpx py2rpx text-white text-24rpx' : '']"
@@ -446,7 +454,7 @@ function handlePay() {
           <view v-if="item.code == leftActive" class="absolute left-0 top-20rpx h60rpx w8rpx rounded-4rpx bg-[var(--them-color)]" />
         </view>
       </scroll-view>
-      <view class="content relative">
+      <view class="content">
         <view class="p20rpx">
           <image :src="`${StaticUrl}/class.png`" class="h144rpx w-full" @click="useGlobalToast().show('敬请期待 !')" />
           <view class="my20rpx flex items-center justify-end rounded-16rpx bg-#F6F6F6 px20rpx py8rpx">
@@ -457,10 +465,11 @@ function handlePay() {
           </view>
         </view>
         <scroll-view
-          :lower-threshold="10"
+          :lower-threshold="100"
           :refresher-triggered="isTopLoading" :scroll-top="scrollTop"
           :style="{ height: `calc(100vh - ${navHeight} - 700rpx)` }" enable-passive scroll-y scroll-anchoring refresher-enabled :throttle="false"
           :scroll-into-view="`class${goodsInTo}`"
+          class="relative"
           @refresherrefresh="handleSrollTop"
           @scrolltolower="handlScrollBottom"
         >
@@ -534,15 +543,13 @@ function handlePay() {
                 </view>
               </view>
             </view>
-            <!-- <wd-loadmore :state="goodsLoading" :loading-props="{ color: '#9ED605', size: 20 }" /> -->
           </view>
-
           <wd-status-tip v-else image="content" tip="暂无内容" />
-          <view v-if="!productList.length" class="h-50vh" />
+          <view v-if="goodsLoading == 'finished' || isTopLoading" class="h-30vh" />
+          <view v-if="goodsLoading == 'loading' || isTopLoading" class="absolute left-0 top-0 z-10 h-full w-full flex items-center justify-center bg-white">
+            <wd-loading color="#9ED605" :size="20" />
+          </view>
         </scroll-view>
-        <view v-if="goodsLoading == 'loading' || isTopLoading" class="absolute left-0 top-0 z-10 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,.6)]">
-          <wd-loading color="#9ED605" :size="20" />
-        </view>
       </view>
     </view>
     <view

+ 1 - 1
src/subPack-xsb/commonTab/components/index.vue

@@ -40,7 +40,7 @@ function handleCommonClass(item: Api.xsbCategories) {
   console.log(item, '===================')
 
   topNavActive.value = item.code
-  leftActive.value = item.children[0].code
+  leftActive.value = item.children && item.children[0].code
   emit('changeNav')
 }
 function handleSwiperClick(e: { index: number, item: Api.xsbCategories }) {

+ 18 - 1
src/subPack-xsb/commonTab/index.vue

@@ -22,7 +22,7 @@ definePage({
     disableScroll: true,
   },
 })
-const { opcity, backTop, SelectShopInfo } = storeToRefs(useSysXsbStore())
+const { opcity, backTop, SelectShopInfo, allShopHasPermission, xsbShopList } = storeToRefs(useSysXsbStore())
 const { userInfo } = storeToRefs(useUserStore())
 const commonCategoryData = ref<Api.xsbCategories[]>([])
 const { data: goodsList, isLastPage, page, error, reload, refresh } = usePagination((pageNum, pageSize) =>
@@ -83,6 +83,7 @@ async function getSearchData(type: number) {
 }
 
 onMounted(async () => {
+  allShopHasPermission.value = false
   await useSysXsbStore().getAllShopList()
   hotText.value = await getSearchData(2)
   recommendText.value = await getSearchData(3)
@@ -174,6 +175,22 @@ function beforeleave() {
         </template>
       </wd-tabbar-item>
     </wd-tabbar>
+    <wd-popup v-model="allShopHasPermission" custom-style="border-radius:32rpx;" :close-on-click-modal="false" :z-index="99999">
+      <view class="p28rpx">
+        <view class="text-center text-24rpx text-#AAAAAA">
+          你没有该门店的商品数据查看权限,请切
+          换其他门店
+        </view>
+        <view class="mt30rpx w420rpx">
+          <view v-for="item in xsbShopList" :key="item.shopId" class="mb20rpx flex items-center text-28rpx" :class="[item.isPermiss ? 'text-[var(--them-color)] font-semibold' : 'text-#AAAAAA ']">
+            {{ item.shopName }}
+            <view v-if="!item.isPermiss" class="ml20rpx rounded-22rpx bg-#aaa px16rpx text-24rpx text-white">
+              无权限
+            </view>
+          </view>
+        </view>
+      </view>
+    </wd-popup>
   </view>
 </template>
 

+ 9 - 8
src/subPack-xsb/confirmOrder/index.vue

@@ -64,22 +64,23 @@ async function handlePay() {
         skuId: it.skuId,
       }
     })
-    await clearCart(orderInfo.value.skuList)
-    totalProduct.value = null
+
     const orderNumber = await getOrderPayMent(orderInfo.value.transfee, 'XSB', deliveryType.value, Number(orderInfo.value?.skuList[0].shopId || SelectShopInfo.value.shopId), orderItemList, unref(remarks))
     const res = await handleCommonPayMent(orderNumber)
+    await clearCart(orderInfo.value.skuList)
+    totalProduct.value = null
     if (res.payType !== 1) {
       await getWxCommonPayment(res)
-      paySuccess()
+      await paySuccess()
+      isPay.value = false
     }
     else {
-      paySuccess()
+      await paySuccess()
+      isPay.value = false
     }
-
-    isPay.value = false
   }
   catch {
-    payError()
+    await payError()
     isPay.value = false
   }
 }
@@ -205,7 +206,7 @@ async function handlePay() {
           </view>
         </view>
         <view class="w180rpx">
-          <wd-button size="large" :loading="isPay" @click="handlePay">
+          <wd-button size="large" :loading="isPay" :disabled="isPay" @click="handlePay">
             立即支付
           </wd-button>
         </view>

+ 7 - 6
src/subPack-xsb/goods/index.vue

@@ -88,7 +88,7 @@ function handleGoCurren(id: number) {
 }
 
 async function getGoodsDetaile() {
-  const res = await Apis.xsb.getProductDetail({ data: { id: goodsId.value, shopId: Number(SelectShopInfo.value?.shopId) || 1, channelId: userInfo.value.channelId || 1 } })
+  const res = await Apis.xsb.getProductDetail({ data: { id: goodsId.value, shopId: Number(SelectShopInfo.value?.shopId) || 2, channelId: userInfo.value.channelId || 1 } })
   console.log(res, '请求')
   if (!res.data) {
     useGlobalToast().show('暂无该商品查看权限!')
@@ -102,13 +102,14 @@ async function handleConfimOrder() {
     useGlobalToast().show('库存不足,请调整购买数量')
     return
   }
+  await useUserStore().checkLogin()
   isLoging.value = true
   const res = await Apis.xsb.skuOrderConfirm({
     data: {
       skuId: specId.value,
       num: SelectGoodsNum.value,
       channelId: unref(userInfo).channelId,
-      shopId: unref(goodsInfo)?.shopId,
+      shopId: unref(goodsInfo)?.shopId || 2,
     },
   })
   if (Number(res.data.sku?.shopSkuStocks) < unref(SelectGoodsNum)) {
@@ -129,14 +130,14 @@ async function handleAddCart() {
   }
   isLoging.value = true
   try {
-    await useSmqjhCartStore().addCart(specId.value, unref(SelectGoodsNum), unref(SelectShopInfo.value.shopId), 'XSB')
+    await useSmqjhCartStore().addCart(specId.value, unref(SelectGoodsNum), unref(SelectShopInfo.value.shopId || 2), 'XSB')
     selectGoods.value = false
     useGlobalToast().show('添加成功')
     isLoging.value = false
   }
   catch (error) {
+    isLoging.value = false
     console.log(error)
-    useGlobalToast().show(String(error))
   }
 }
 </script>
@@ -373,12 +374,12 @@ async function handleAddCart() {
         <template #footer>
           <view class="box-border w-full flex items-center justify-between py20rpx">
             <view class="w-48%">
-              <wd-button plain hairline block :loading="isLoging" @click="handleAddCart">
+              <wd-button plain hairline block :loading="isLoging" :disabled="isLoging" @click="handleAddCart">
                 加入购物车
               </wd-button>
             </view>
             <view class="w-48%">
-              <wd-button block :loading="isLoging" @click="handleConfimOrder">
+              <wd-button block :loading="isLoging" :disabled="isLoging" @click="handleConfimOrder">
                 立即购买
               </wd-button>
             </view>

+ 31 - 11
src/subPack-xsb/order/index.vue

@@ -75,6 +75,13 @@ async function handleSubmitOrder(order: Api.xsbOrderList) {
   await handleCommonOrderReceive(order)
   reload()
 }
+async function handleAfterSale(item: Api.xsbOrderList) {
+  if (!item.orderItemList) {
+    useGlobalToast().show('商品异常!')
+    return
+  }
+  await useSysStore().getRefunOrder(item.orderNumber as string)
+}
 </script>
 
 <template>
@@ -162,19 +169,23 @@ async function handleSubmitOrder(order: Api.xsbOrderList) {
         </view>
         <view class="mt24rpx flex items-center justify-end">
           <template v-if="item.hbOrderStatus === OrderStatus.PaddingPay">
-            <wd-button size="small" plain type="info" @click.stop="handleCancel(item)">
-              取消订单
-            </wd-button>
-            <view class="ml20rpx">
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleCancel(item)">
+                取消订单
+              </wd-button>
+            </view>
+            <view class="mr20rpx">
               <wd-button size="small" plain type="error" @click.stop="handlePay(item.orderNumber as string)">
                 付款
               </wd-button>
             </view>
           </template>
-          <template v-if="item.hbOrderStatus === OrderStatus.OrderCancel">
-            <wd-button size="small" plain type="info" @click.stop="handleDel(item)">
-              删除订单
-            </wd-button>
+          <template v-if="[OrderStatus.OrderCancel, OrderStatus.OrderCompleted].includes(item.hbOrderStatus) ">
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleDel(item)">
+                删除订单
+              </wd-button>
+            </view>
             <!-- <view class="ml20rpx">
               <wd-button size="small" plain type="error" @click.stop="handleDel(item)">
                 再次购买
@@ -182,9 +193,18 @@ async function handleSubmitOrder(order: Api.xsbOrderList) {
             </view> -->
           </template>
           <template v-if="item.hbOrderStatus === OrderStatus.OrderArrived">
-            <wd-button size="small" plain type="info" @click.stop="handleSubmitOrder(item)">
-              确认收货
-            </wd-button>
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleSubmitOrder(item)">
+                确认收货
+              </wd-button>
+            </view>
+          </template>
+          <template v-if="[OrderStatus.OrderCompleted, OrderStatus.OrderWaitDelivery, OrderStatus.OrderAccepted].includes(item.hbOrderStatus) ">
+            <view class="mr20rpx">
+              <wd-button size="small" plain type="info" @click.stop="handleAfterSale(item)">
+                申请售后
+              </wd-button>
+            </view>
           </template>
         </view>
       </view>

+ 406 - 206
src/subPack-xsb/orderDetaile/index.vue

@@ -1,19 +1,58 @@
 <script setup lang="ts">
+import type { MapMarker, MapPolyline } from '@uni-helper/uni-types'
 import { OrderStatus, handleCommonCancelOrder, handleCommonDeleteOrder, handleCommonOrderStatusText } from '../utils/order-data'
 import { StaticUrl } from '@/config'
 import router from '@/router'
 import { getWxCommonPayment, handleCommonPayMent } from '@/subPack-xsb/utils/confirm-order'
 
+const { statusBarHeight, MenuButtonHeight } = storeToRefs(useSysStore())
+const { userInfo } = storeToRefs(useUserStore())
 definePage({
   name: 'xsb-orderDetaile',
   islogin: true,
   style: {
     navigationBarTitleText: '订单详情',
+    navigationStyle: 'custom',
   },
 })
 const collapse = ref(false)
 const orderInfo = ref<Api.xsbOrderList>()
+const orderNum = ref()
+const mapInfo = ref<Api.RiderInfo>()
+const mapMarkers = ref<MapMarker[]>([])
+const mapPolyLine = ref<MapPolyline[]>([])
+const showNode = ref(false)
+const NodeList = ref<Api.DeliveryNode[]>([])
+const showMapStatus = [OrderStatus.OrderAccepted, OrderStatus.OrderWaitDelivery, OrderStatus.OrderDelivering, OrderStatus.OrderArrived]
+const mapStaticShopImg = {
+  [OrderStatus.OrderAccepted]: `${StaticUrl}/order-map-jian.png`,
+  [OrderStatus.OrderWaitDelivery]: `${StaticUrl}/order-map-wait.png`,
+  [OrderStatus.OrderDelivering]: `${StaticUrl}/order-map-qishou.png`,
+  [OrderStatus.OrderArrived]: `${StaticUrl}/order-map-qishou.png`,
+}
+const mapTextShop = {
+  [OrderStatus.OrderAccepted]: '商家拣货中',
+  [OrderStatus.OrderWaitDelivery]: '等待骑手配送',
+  [OrderStatus.OrderDelivering]: '骑手配送中',
+  [OrderStatus.OrderArrived]: '已送达',
+}
+
+const mapLation = computed(() => {
+  const lation = {
+    latitude: mapInfo.value?.shopLatitude,
+    longitude: mapInfo.value?.shopLongitude,
+    scale: 16,
+  }
+  if (orderInfo.value && mapInfo.value) {
+    const lations = calculateCenterPointSpherical({ lat: orderInfo.value.latitude, lng: orderInfo.value.longitude }, { lat: mapInfo.value.shopLatitude as number, lng: mapInfo.value.shopLongitude as number })
+    lation.latitude = lations.lat
+    lation.longitude = lations.lng
+    lation.scale = 6
+  }
+  return lation
+})
 onLoad((options: any) => {
+  orderNum.value = options.id
   getDetail(options.id)
 })
 async function getDetail(id: string) {
@@ -23,6 +62,10 @@ async function getDetail(id: string) {
     },
   })
   orderInfo.value = data
+  if (showMapStatus.includes(data.hbOrderStatus)) {
+    getOrderMapInf()
+  }
+  getOrderNode()
 }
 
 function handleCollapse() {
@@ -59,113 +102,252 @@ function handleCopy() {
     showToast: true,
   })
 }
+async function handleAfterSale() {
+  if (!orderInfo.value?.orderItemList) {
+    useGlobalToast().show('商品异常!')
+    return
+  }
+  await useSysStore().getRefunOrder(orderInfo.value.orderNumber as string)
+}
+async function getOrderMapInf() {
+  const res = await Apis.xsb.riderInfo({ data: { orderNumber: orderNum.value } })
+  mapInfo.value = res.data
+  mapMarkers.value.push({
+    id: 1,
+    latitude: Number(mapInfo.value?.shopLatitude),
+    longitude: Number(mapInfo.value?.shopLongitude),
+    iconPath: mapStaticShopImg[orderInfo.value?.hbOrderStatus as keyof typeof mapStaticShopImg],
+    width: 70,
+    height: 80,
+    label: {
+      content: mapTextShop[orderInfo.value?.hbOrderStatus as keyof typeof mapTextShop],
+      color: '#333',
+      fontSize: 14,
+      x: 0,
+      y: 0,
+      anchorX: 40,
+      anchorY: -120,
+      borderRadius: 8,
+      borderWidth: 0,
+      borderColor: '',
+      bgColor: '#fff',
+      padding: 5,
+      display: 'BYCLICK',
+      textAlign: 'left',
+      customCallout: {
+        display: 'BYCLICK',
+        anchorX: 0,
+        anchorY: 0,
+      },
+      ariaLabel: '',
+      joinCluster: false,
+    },
+  }, {
+    id: 2,
+    longitude: Number(orderInfo.value?.longitude),
+    latitude: Number(orderInfo.value?.latitude),
+    iconPath: userInfo.value.avatarUrl || `${StaticUrl}/9.png`,
+    width: 50,
+    height: 50,
+  })
+
+  if (mapInfo.value?.riderLatitude && mapInfo.value?.riderLongitude) {
+    mapMarkers.value.push({
+      id: 3,
+      longitude: Number(mapInfo.value?.riderLongitude),
+      latitude: Number(mapInfo.value?.riderLatitude),
+      iconPath: `${StaticUrl}/order-map-qishou.png`,
+      width: 70,
+      height: 80,
+      label: {
+        content: '骑手正在送货',
+        color: '#333',
+        fontSize: 14,
+        x: 0,
+        y: 0,
+        anchorX: 40,
+        anchorY: -120,
+        borderRadius: 8,
+        borderWidth: 0,
+        borderColor: '',
+        bgColor: '#fff',
+        padding: 5,
+        display: 'BYCLICK',
+        textAlign: 'left',
+        customCallout: {
+          display: 'BYCLICK',
+          anchorX: 0,
+          anchorY: 0,
+        },
+        ariaLabel: '',
+        joinCluster: false,
+      },
+    })
+    mapPolyLine.value.push({
+      points: [
+        {
+          longitude: Number(mapInfo.value?.riderLongitude),
+          latitude: Number(mapInfo.value?.riderLatitude),
+        },
+        {
+          longitude: Number(orderInfo.value?.longitude),
+          latitude: Number(orderInfo.value?.latitude),
+        },
+      ],
+      color: '#9ED605',
+      width: 3,
+    })
+    // 绘制路径骑手和店家只能存在一个
+    return
+  }
+  else {
+    mapPolyLine.value.push({
+      points: [
+        {
+          longitude: Number(orderInfo.value?.longitude),
+          latitude: Number(orderInfo.value?.latitude),
+        },
+        {
+          longitude: Number(mapInfo.value?.shopLongitude),
+          latitude: Number(mapInfo.value?.shopLatitude),
+        },
+      ],
+      color: '#9ED605',
+      width: 3,
+    })
+  }
+
+  console.log(mapPolyLine.value, 'mapPolyLine')
+}
+async function getOrderNode() {
+  const res = await Apis.xsb.deliveryNode({
+    data: {
+      orderNumber: String(orderInfo.value?.orderNumber),
+    },
+  })
+  NodeList.value = res.data
+}
+
+function handleMarkerTap(e: UniHelper.MapOnMarkertapEvent) {
+  console.log(e, 'sadada')
+  showNode.value = true
+}
 </script>
 
 <template>
-  <view v-if="orderInfo" class="page-xsb px24rpx">
-    <view class="pt20rpx">
-      <view class="text-36rpx font-semibold">
-        <view v-if="orderInfo.hbOrderStatus === OrderStatus.PaddingPay">
-          <view class="flex items-center">
-            请在
-            <wd-count-down format="mm:ss" :time="handleCommonOrderStatusText(orderInfo)" @finish="handleFinish">
-              <template #default="{ current }">
-                <view class="flex items-center">
-                  <view> {{ current.minutes }} 分</view>
-                  <view> {{ current.seconds }} 秒</view>
-                </view>
-              </template>
-            </wd-count-down>
-            内支付
-          </view>
-          <view class="mt20rpx text-28rpx text-#AAAAAA">
-            现在支付:预计10:40-10:55送达
-          </view>
-          <view class="btn mt20rpx flex items-center justify-between">
-            <view class="info-btn mr20rpx w226rpx">
-              <wd-button type="info" @click="handleCancel">
-                取消订单
-              </wd-button>
+  <view v-if="orderInfo" class="page-xsb" :class="[collapse ? 'pt850rpx' : ``]" :style="{ paddingTop: `${collapse ? '850rpx' : (`${Number(statusBarHeight) + Number(MenuButtonHeight) + 10}px`)}` }">
+    <wd-navbar
+      title="订单详情" :bordered="false" :z-index="99"
+      safe-area-inset-top left-arrow fixed
+      @click-left="router.back()"
+    />
+    <view v-if="showMapStatus.includes(orderInfo?.hbOrderStatus)">
+      <map id="orderMap" :polyline="mapPolyLine" :scale="mapLation.scale" :markers="mapMarkers" :latitude="mapLation.latitude" :longitude="mapLation.longitude" class="fixed top-0 z80 h-900rpx w-screen" @markertap="handleMarkerTap" />
+    </view>
+
+    <view class="relative z-90 box-border bg-#f6f6f6 px24rpx">
+      <view class="pt20rpx">
+        <view class="text-36rpx font-semibold">
+          <view v-if="orderInfo.hbOrderStatus === OrderStatus.PaddingPay">
+            <view class="flex items-center">
+              请在
+              <wd-count-down format="mm:ss" :time="handleCommonOrderStatusText(orderInfo)" @finish="handleFinish">
+                <template #default="{ current }">
+                  <view class="flex items-center">
+                    <view> {{ current.minutes }} 分</view>
+                    <view> {{ current.seconds }} 秒</view>
+                  </view>
+                </template>
+              </wd-count-down>
+              内支付
             </view>
-            <view class="ml20rpx flex-1">
-              <wd-button @click="handlePay">
-                立即支付¥{{ orderInfo.actualTotal }}
-              </wd-button>
+            <view class="mt20rpx text-28rpx text-#AAAAAA">
+              现在支付:预计10:40-10:55送达
+            </view>
+            <view class="btn mt20rpx flex items-center justify-between">
+              <view class="info-btn mr20rpx w226rpx">
+                <wd-button type="info" @click="handleCancel">
+                  取消订单
+                </wd-button>
+              </view>
+              <view class="ml20rpx flex-1">
+                <wd-button @click="handlePay">
+                  立即支付¥{{ orderInfo.actualTotal }}
+                </wd-button>
+              </view>
             </view>
           </view>
-        </view>
-        <view v-if="orderInfo.hbOrderStatus !== OrderStatus.PaddingPay" class="flex items-center" @click="handleCollapse">
-          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderAccepted" class="mr10rpx">
-            商家拣货中
-          </view>
-          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderWaitDelivery" class="mr10rpx">
-            订单待配送
-          </view>
-          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderDelivering" class="mr10rpx">
-            订单配送中
-          </view>
-          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCancelAudit" class="mr10rpx">
-            订单取消审核
-          </view>
-          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCancel" class="mr10rpx">
-            订单取消
-          </view>
-          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderArrived" class="mr10rpx">
-            订单已送达
-          </view>
-          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCompleted" class="mr10rpx">
-            订单已完成
+          <view v-if="orderInfo.hbOrderStatus !== OrderStatus.PaddingPay" class="flex items-center" @click="handleCollapse">
+            <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderAccepted" class="mr10rpx">
+              商家拣货中
+            </view>
+            <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderWaitDelivery" class="mr10rpx">
+              订单待配送
+            </view>
+            <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderDelivering" class="mr10rpx">
+              订单配送中
+            </view>
+            <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCancelAudit" class="mr10rpx">
+              订单取消审核
+            </view>
+            <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCancel" class="mr10rpx">
+              订单取消
+            </view>
+            <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderArrived" class="mr10rpx">
+              订单已送达
+            </view>
+            <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCompleted" class="mr10rpx">
+              订单已完成
+            </view>
+            <view :class="[collapse ? 'rotate-90' : '']">
+              <wd-icon name="arrow-right" size="22px" />
+            </view>
           </view>
-          <view :class="[collapse ? 'rotate-90' : '']">
-            <wd-icon name="arrow-right" size="22px" />
+          <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCancel" class="mt20rpx text-28rpx text-#AAAAAA">
+            取消原因:{{ orderInfo.cancelReason }}
           </view>
         </view>
-        <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCancel" class="mt20rpx text-28rpx text-#AAAAAA">
-          取消原因:{{ orderInfo.cancelReason }}
-        </view>
       </view>
-    </view>
-    <view class="mt20rpx rounded-16rpx bg-white p24rpx">
-      <view v-if="orderInfo.dvyFlowId" class="mb24rpx text-24rpx">
-        <view class="mb20rpx">
-          快递单号
-        </view>
-        <view class="text-48rpx font-semibold">
-          {{ orderInfo.dvyFlowId }}
-        </view>
-      </view>
-      <view class="grid grid-cols-5 text-28rpx text-#222">
-        <view v-if="[OrderStatus.OrderCancel, OrderStatus.OrderCompleted].includes(Number(orderInfo.hbOrderStatus))" class="flex flex-col items-center" @click="handelDel">
-          <image
-            :src="`${StaticUrl}/orderDetaile-del.png`"
-            class="h40rpx w40rpx"
-          />
-          <view class="mt40rpx">
-            删除订单
+      <view class="mt20rpx rounded-16rpx bg-white p24rpx">
+        <view v-if="orderInfo.dvyFlowId" class="mb24rpx text-24rpx">
+          <view class="mb20rpx">
+            快递单号
+          </view>
+          <view class="text-48rpx font-semibold">
+            {{ orderInfo.dvyFlowId }}
           </view>
         </view>
-        <view class="contact relative flex flex-col items-center">
-          <image
-            :src="`${StaticUrl}/orderDetaile-wx.png`"
-            class="h40rpx w40rpx"
-          />
-          <button open-type="contact" class="zbutton mt40rpx">
-            <view class="text-28rpx">
-              联系商家
+        <view class="grid grid-cols-5 text-28rpx text-#222">
+          <view v-if="[OrderStatus.OrderCancel, OrderStatus.OrderCompleted].includes(Number(orderInfo.hbOrderStatus))" class="flex flex-col items-center" @click="handelDel">
+            <image
+              :src="`${StaticUrl}/orderDetaile-del.png`"
+              class="h40rpx w40rpx"
+            />
+            <view class="mt40rpx">
+              删除订单
             </view>
-          </button>
-        </view>
-
-        <!-- <view class="flex  flex-col items-center " @click="router.push({ name: 'common-afterSales' })">
-          <image
-            :src="`${StaticUrl}/orderDetaile-shou.png`"
-            class="h40rpx w40rpx"
-          />
-          <view class="mt40rpx">
-            申请售后
           </view>
-        </view> -->
-        <!-- <view class="flex  flex-col items-center " @click="router.push({ name: 'common-revalue' })">
+          <view class="contact relative flex flex-col items-center">
+            <image
+              :src="`${StaticUrl}/orderDetaile-wx.png`"
+              class="h40rpx w40rpx"
+            />
+            <button open-type="contact" class="zbutton mt40rpx">
+              <view class="text-28rpx">
+                联系商家
+              </view>
+            </button>
+          </view>
+          <view v-if="[OrderStatus.OrderCompleted, OrderStatus.OrderWaitDelivery, OrderStatus.OrderAccepted].includes(orderInfo.hbOrderStatus) " class="flex flex-col items-center" @click="handleAfterSale">
+            <image
+              :src="`${StaticUrl}/orderDetaile-shou.png`"
+              class="h40rpx w40rpx"
+            />
+            <view class="mt40rpx">
+              申请售后
+            </view>
+          </view>
+          <!-- <view class="flex  flex-col items-center " @click="router.push({ name: 'common-revalue' })">
           <image
             :src="`${StaticUrl}/orderDetaile-pj.png`"
             class="h40rpx w40rpx"
@@ -174,7 +356,7 @@ function handleCopy() {
             评价晒单
           </view>
         </view> -->
-        <!-- <view class="flex  flex-col items-center">
+          <!-- <view class="flex  flex-col items-center">
           <image
             :src="`${StaticUrl}/orderDetaile-bao.png`"
             class="h40rpx w40rpx"
@@ -183,143 +365,161 @@ function handleCopy() {
             再次购买
           </view>
         </view> -->
-      </view>
-    </view>
-    <view class="mt20rpx rounded-16rpx bg-white p24rpx">
-      <view class="flex items-center">
-        <image
-          :src="`${StaticUrl}/orderDetaile-user.png`"
-          class="mr20rpx h40rpx w40rpx"
-        />
-        <view class="text-32rpx text-#222 font-semibold">
-          {{ orderInfo?.consigneeName }} {{ orderInfo?.consigneeMobile }}
         </view>
       </view>
-      <view class="mt20rpx text-28rpx text-#AAAAAA">
-        {{ orderInfo?.consigneeAddress }}
-      </view>
-    </view>
-    <view class="mt20rpx rounded-16rpx bg-white p24rpx">
-      <view class="flex items-center">
-        <image
-          :src="`${StaticUrl}/order-icon.png`"
-          class="h36rpx w36rpx"
-        />
-        <view class="ml20rpx text-32rpx font-semibold">
-          {{ orderInfo?.shopName }}
+      <view class="mt20rpx rounded-16rpx bg-white p24rpx">
+        <view class="flex items-center">
+          <image
+            :src="`${StaticUrl}/orderDetaile-user.png`"
+            class="mr20rpx h40rpx w40rpx"
+          />
+          <view class="text-32rpx text-#222 font-semibold">
+            {{ orderInfo?.consigneeName }} {{ orderInfo?.consigneeMobile }}
+          </view>
+        </view>
+        <view class="mt20rpx text-28rpx text-#AAAAAA">
+          {{ orderInfo?.consigneeAddress }}
         </view>
       </view>
-      <view class="my24rpx h2rpx w-full bg-#F0F0F0" />
-      <CollapsePanel :line-height="150">
-        <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="item.pic"
-              class="h120rpx w120rpx"
-            />
+      <view class="mt20rpx rounded-16rpx bg-white p24rpx">
+        <view class="flex items-center">
+          <image
+            :src="`${StaticUrl}/order-icon.png`"
+            class="h36rpx w36rpx"
+          />
+          <view class="ml20rpx text-32rpx font-semibold">
+            {{ orderInfo?.shopName }}
           </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="my24rpx h2rpx w-full bg-#F0F0F0" />
+        <CollapsePanel :line-height="150">
+          <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="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">
+                  ¥{{ item.price }}
+                </view>
               </view>
-              <view class="text-32rpx text-#FF4D3A">
-                ¥{{ item.price }}
+              <view class="text-24rpx text-#AAAAAA">
+                规格:{{ item.spec }}
+              </view>
+              <view class="text-24rpx text-#AAAAAA">
+                ×{{ item.prodCount }}
               </view>
-            </view>
-            <view class="text-24rpx text-#AAAAAA">
-              规格:{{ item.spec }}
-            </view>
-            <view class="text-24rpx text-#AAAAAA">
-              ×{{ item.prodCount }}
             </view>
           </view>
-        </view>
-      </CollapsePanel>
+        </CollapsePanel>
 
-      <view class="mt24rpx h2rpx w-full bg-#F0F0F0" />
-      <view class="mt24rpx flex items-center justify-between">
-        <view class="text-28rpx">
-          商品金额
-        </view>
-        <view class="text-#FF4A39 font-semibold">
-          ¥{{ orderInfo?.total }}
-        </view>
-      </view>
-      <view class="mt24rpx flex items-center justify-between">
-        <view v-if="orderInfo.dvyType == 3">
-          配送费(即时配送)
-        </view>
-        <view v-if="orderInfo.dvyType == 1">
-          快递
-        </view>
-        <view class="text-#FF4A39 font-semibold">
-          ¥{{ orderInfo?.freightAmount }}
-        </view>
-      </view>
-      <view class="mt24rpx flex items-center justify-between">
-        <view class="text-28rpx">
-          积分
-        </view>
-        <view class="text-#FF4A39 font-semibold">
-          -¥{{ Number(orderInfo?.offsetPoints) / 100 }}
-        </view>
-      </view>
-      <view class="my24rpx h2rpx w-full bg-#F0F0F0" />
-      <view class="flex items-center justify-end">
-        <view class="text-28rpx">
-          总计{{ orderInfo.orderMoney }} 共减 {{ Number(orderInfo.offsetPoints) / 100 }}
-        </view>
-        <view class="ml20rpx text-28rpx text-#FF4D3A font-semibold">
-          {{ [OrderStatus.PaddingPay, OrderStatus.OrderCancel].includes(Number(orderInfo.hbOrderStatus)) ? '需' : '实' }}付款¥{{ orderInfo.actualTotal }}
+        <view class="mt24rpx h2rpx w-full bg-#F0F0F0" />
+        <view class="mt24rpx flex items-center justify-between">
+          <view class="text-28rpx">
+            商品金额
+          </view>
+          <view class="text-#FF4A39 font-semibold">
+            ¥{{ orderInfo?.total }}
+          </view>
         </view>
-      </view>
-    </view>
-    <view class="mt20rpx rounded-16rpx bg-white p24rpx">
-      <view class="mb24rpx text-28rpx font-semibold">
-        订单信息
-      </view>
-      <view class="pb20rpx">
-        <view class="mb28rpx flex items-center justify-between">
-          <view class="text-28rpx text-#AAAAAA">
-            订单编号
+        <view class="mt24rpx flex items-center justify-between">
+          <view v-if="orderInfo.dvyType == 3">
+            配送费(即时配送)
           </view>
-          <view class="flex items-center">
-            <text class="text-#222">
-              {{ orderInfo?.orderNumber }}
-            </text>
-            <view class="ml10rpx" @click="handleCopy">
-              <wd-icon name="file-copy" size="22px" />
-            </view>
+          <view v-if="orderInfo.dvyType == 1">
+            快递
+          </view>
+          <view class="text-#FF4A39 font-semibold">
+            ¥{{ orderInfo?.freightAmount }}
           </view>
         </view>
-        <view class="mb28rpx flex items-center justify-between">
-          <view class="text-28rpx text-#AAAAAA">
-            支付方式
+        <view class="mt24rpx flex items-center justify-between">
+          <view class="text-28rpx">
+            积分
           </view>
-          <view class="text-#222">
-            微信支付
+          <view class="text-#FF4A39 font-semibold">
+            -¥{{ Number(orderInfo?.offsetPoints) / 100 }}
           </view>
         </view>
-        <view class="mb28rpx flex items-center justify-between">
-          <view class="text-28rpx text-#AAAAAA">
-            下单时间
+        <view class="my24rpx h2rpx w-full bg-#F0F0F0" />
+        <view class="flex items-center justify-end">
+          <view class="text-28rpx">
+            总计{{ orderInfo.orderMoney }} 共减 {{ Number(orderInfo.offsetPoints) / 100 }}
           </view>
-          <view class="text-#222">
-            {{ orderInfo?.createTime }}
+          <view class="ml20rpx text-28rpx text-#FF4D3A font-semibold">
+            {{ [OrderStatus.PaddingPay, OrderStatus.OrderCancel].includes(Number(orderInfo.hbOrderStatus)) ? '需' : '实' }}付款¥{{ orderInfo.actualTotal }}
           </view>
         </view>
-        <view class="mb28rpx flex items-center justify-between">
-          <view class="text-28rpx text-#AAAAAA">
-            备注信息
+      </view>
+      <view class="mt20rpx rounded-16rpx bg-white p24rpx">
+        <view class="mb24rpx text-28rpx font-semibold">
+          订单信息
+        </view>
+        <view class="pb20rpx">
+          <view class="mb28rpx flex items-center justify-between">
+            <view class="text-28rpx text-#AAAAAA">
+              订单编号
+            </view>
+            <view class="flex items-center">
+              <text class="text-#222">
+                {{ orderInfo?.orderNumber }}
+              </text>
+              <view class="ml10rpx" @click="handleCopy">
+                <wd-icon name="file-copy" size="22px" />
+              </view>
+            </view>
+          </view>
+          <view class="mb28rpx flex items-center justify-between">
+            <view class="text-28rpx text-#AAAAAA">
+              支付方式
+            </view>
+            <view class="text-#222">
+              微信支付
+            </view>
+          </view>
+          <view class="mb28rpx flex items-center justify-between">
+            <view class="text-28rpx text-#AAAAAA">
+              下单时间
+            </view>
+            <view class="text-#222">
+              {{ orderInfo?.createTime }}
+            </view>
           </view>
-          <view class="text-#222">
-            {{ orderInfo?.remarks || '无' }}
+          <view class="mb28rpx flex items-center justify-between">
+            <view class="text-28rpx text-#AAAAAA">
+              备注信息
+            </view>
+            <view class="text-#222">
+              {{ orderInfo?.remarks || '无' }}
+            </view>
           </view>
         </view>
       </view>
+      <view class="h80rpx" />
     </view>
-    <view class="h30rpx" />
+    <Zpopup v-model="showNode" :showfooter="false">
+      <view class="p24rpx">
+        <view class="text-center text-32rpx font-semibold">
+          订单追踪
+        </view>
+        <wd-steps :active="0" vertical dot>
+          <wd-step v-for="item in NodeList" :key="item.id">
+            <template #title>
+              {{ item.content }}
+            </template>
+            <template #description>
+              {{ item.createTime }}
+            </template>
+          </wd-step>
+        </wd-steps>
+      </view>
+    </Zpopup>
   </view>
 </template>
 

+ 19 - 12
src/subPack-xsb/search/index.vue

@@ -125,7 +125,7 @@ function handleSearchText(text: string) {
             <wd-icon name="delete-thin" size="22px" @click="handleClearnSeachLocaData" />
           </view>
           <view class="mt20rpx flex flex-wrap items-center">
-            <view v-for="item in searchList" :key="item" class="mr16rpx box-border flex items-center justify-center rounded-30rpx bg-#F6F6F6 px24rpx py10rpx text-28rpx" @click="handleSearchText(item)">
+            <view v-for="item in searchList" :key="item" class="mb20rpx mr16rpx box-border flex items-center justify-center rounded-30rpx bg-#F6F6F6 px24rpx py10rpx text-28rpx" @click="handleSearchText(item)">
               {{ item }}
             </view>
           </view>
@@ -135,7 +135,7 @@ function handleSearchText(text: string) {
             热门搜索
           </view>
           <view class="mt20rpx flex flex-wrap items-center">
-            <view v-for="item in hotText" :key="item.id" class="mr16rpx box-border flex items-center justify-center rounded-30rpx bg-#F6F6F6 px24rpx py10rpx text-28rpx" @click="handleSearchText(item.searchName)">
+            <view v-for="item in hotText" :key="item.id" class="mb20rpx mr16rpx box-border flex items-center justify-center rounded-30rpx bg-#F6F6F6 px24rpx py10rpx text-28rpx" @click="handleSearchText(item.searchName)">
               {{ item.searchName }}
             </view>
           </view>
@@ -150,17 +150,24 @@ function handleSearchText(text: string) {
       </view>
     </view>
     <view v-if="isSearch" class="px24rpx pt20rpx">
-      <view v-for="item in data" :key="item.id" class="mb20rpx box-border flex items-center justify-between rounded-16rpx bg-white p24rpx" @click="router.push({ name: 'xsb-goods', params: { id: String(item.prodId) } })">
-        <image
-          :src="item.pic"
-          class="h200rpx w200rpx flex-shrink-0 rounded-16rpx"
-        />
-        <view class="ml20rpx flex-1">
-          <view class="text-32rpx font-semibold">
-            {{ item.prodName }}
+      <view v-for="item in data" :key="item.id" class="relative mb20rpx rounded-16rpx bg-white p24rpx">
+        <view class="box-border flex items-center justify-between" @click="router.push({ name: 'xsb-goods', params: { id: String(item.prodId) } })">
+          <image
+            :src="item.pic"
+            class="h200rpx w200rpx flex-shrink-0 rounded-16rpx"
+          />
+          <view class="ml20rpx flex-1">
+            <view class="text-32rpx font-semibold">
+              {{ item.prodName }}
+            </view>
+            <view class="mt14rpx text-36rpx text-#FF4A39 font-semibold">
+              ¥{{ item.channelProdPrice }}
+            </view>
           </view>
-          <view class="mt14rpx text-36rpx text-#FF4A39 font-semibold">
-            ¥{{ item.channelProdPrice }}
+        </view>
+        <view v-if="!item.spuStock" class="absolute left-0 top-0 z10 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,0.6)]">
+          <view class="flex items-center justify-center rounded-16rpx bg-[rgba(0,0,0,.6)] p8rpx text-28rpx text-white">
+            商品已售罄
           </view>
         </view>
       </view>

+ 18 - 25
src/subPack-xsb/selectAddress/index.vue

@@ -10,7 +10,7 @@ definePage({
   },
 })
 const { SelectShopInfo, xsbShopList: shopList, selectAddressId } = storeToRefs(useSysXsbStore())
-const { name, Location } = storeToRefs(useAddressStore())
+const { name } = storeToRefs(useAddressStore())
 const { addresses } = storeToRefs(useUserStore())
 
 const allShopList = computed(() => {
@@ -24,27 +24,11 @@ watch(() => SelectShopInfo.value, () => {
   router.back()
 })
 
-function handelChange(e: { value: number }) {
+async function handelChange(e: { value: number }) {
   const address = addresses.value.find(it => it.id === e.value)
   if (!address)
     return
-  Location.value.latitude = Number(address.latitude)
-  Location.value.longitude = Number(address.longitude)
-  let minDistance = Infinity
-  for (const shop of shopList.value) {
-    if (shop.shopLat && shop.shopLng) {
-      const distance = useSysXsbStore().getDistance(
-        Location.value.latitude,
-        Location.value.longitude,
-        Number(shop.shopLat),
-        Number(shop.shopLng),
-      )
-      if (distance < minDistance) {
-        minDistance = distance
-        handleClick({ ...shop, distance: Number(distance.toFixed(2)) })
-      }
-    }
-  }
+  await useSysXsbStore().getnNearestShop(Number(address.latitude), Number(address.longitude))
 }
 </script>
 
@@ -73,7 +57,9 @@ function handelChange(e: { value: number }) {
           <view class="text-#AAAAAA">
             我的收获地址
           </view>
-          <view>管理</view>
+          <view @click="router.push({ name: 'common-addressList' })">
+            管理
+          </view>
         </view>
         <view class="radio mt24rpx">
           <wd-radio-group v-model="selectAddressId" shape="dot" size="large" @change="handelChange">
@@ -93,20 +79,27 @@ function handelChange(e: { value: number }) {
           </wd-radio-group>
         </view>
       </view>
-      <view v-if="SelectShopInfo" class="mt20rpx rounded-16rpx bg-white px24rpx py28rpx" @click="handleClick(SelectShopInfo)">
+      <view v-if="SelectShopInfo.shopId" class="mt20rpx rounded-16rpx bg-white px24rpx py28rpx" @click="SelectShopInfo.isPermiss && handleClick(SelectShopInfo)">
         <view class="text-24rpx text-#AAAAAA">
           附近的门店
         </view>
-        <view class="mt24rpx text-28rpx font-semibold">
-          {{ SelectShopInfo?.shopName }}
+        <view class="mt24rpx flex items-center text-28rpx font-semibold">
+          {{ SelectShopInfo?.shopName }} <view v-if="!SelectShopInfo.isPermiss" class="ml20rpx rounded-22rpx bg-#aaa px16rpx text-24rpx text-white">
+            无权限
+          </view>
         </view>
         <view class="mt16rpx text-24rpx text-#AAAAAA">
           以为您选择距离最近的可配送店
         </view>
       </view>
       <view v-if="allShopList" class="mt20rpx rounded-16rpx bg-white px24rpx py28rpx">
-        <view v-for="item, idx in allShopList" :key="item.shopId" class="text-28rpx font-semibold" @click="handleClick(item)">
-          {{ item.shopName }}
+        <view v-for="item, idx in allShopList" :key="item.shopId" :class="[item.isPermiss ? '' : 'text-#AAAAAA']" class="text-28rpx font-semibold" @click="item.isPermiss && handleClick(item)">
+          <view class="flex items-center">
+            {{ item.shopName }}
+            <view v-if="!item.isPermiss" class="ml20rpx rounded-22rpx bg-#aaa px16rpx text-24rpx text-white">
+              无权限
+            </view>
+          </view>
           <view v-if="idx < allShopList.length - 1" class="mb24rpx mt20rpx h2rpx w-full bg-#F0F0F0" />
         </view>
       </view>

+ 33 - 35
src/subPack-xsb/store-xsb/sys.ts

@@ -1,4 +1,5 @@
 import { defineStore } from 'pinia'
+import type { apiResData } from '@/api/globals'
 
 interface SysState {
   opcity: number
@@ -28,6 +29,10 @@ interface SysState {
    * 用户选中我的地址id
    */
   selectAddressId: number | undefined
+  /**
+   * 是否所有门店都有权限
+   */
+  allShopHasPermission: boolean
 
 }
 export const useSysXsbStore = defineStore('system-xsb', {
@@ -39,8 +44,8 @@ export const useSysXsbStore = defineStore('system-xsb', {
     SelectShopInfo: { shopId: 0 },
     xsbShopList: [],
     opcity: 0,
-
     selectAddressId: undefined,
+    allShopHasPermission: false,
   }),
   actions: {
     getTabbarItemValue(name: string) {
@@ -51,47 +56,40 @@ export const useSysXsbStore = defineStore('system-xsb', {
     },
     async getAllShopList() {
       return new Promise((resolve, reject) => {
-        Apis.xsb.shopList({}).then((res) => {
+        Apis.xsb.shopList({}).then(async (res) => {
           this.xsbShopList = res.data
-          const { Location } = storeToRefs(useAddressStore())
-          let minDistance = Infinity
-          for (const shop of res.data) {
-            if (shop.shopLat && shop.shopLng) {
-              const distance = this.getDistance(
-                Location.value.latitude || 113.264435,
-                Location.value.longitude || 23.129163,
-                Number(shop.shopLat),
-                Number(shop.shopLng),
-              )
-              if (distance < minDistance) {
-                minDistance = distance
-                if (!this.SelectShopInfo.shopId) {
-                  this.SelectShopInfo = { ...shop, distance: Number(distance.toFixed(2)) }
-                }
-              }
-            }
+          const hasPermission = res.data.every(it => !it.isPermiss)
+          if (hasPermission) {
+            // 所有门店都没有权限
+            this.allShopHasPermission = true
+            this.SelectShopInfo = { shopId: 0 }
+            reject(new Error('所有门店都没有权限'))
+          }
+          else {
+            this.allShopHasPermission = false
+            const { Location } = storeToRefs(useAddressStore())
+            await this.getnNearestShop(Location.value.latitude || 26.648327, Location.value.longitude || 106.620256)
+            resolve(res)
           }
-          resolve(res)
         }).catch((err) => { reject(err) })
       })
     },
     /**
-     * 计算距离
-     * @param lat1
-     * @param lng1
-     * @param lat2
-     * @param lng2
-     * @returns 计算距离
+     *  获取最近的门店
+     * @param latitude 纬度
+     * @param longitude 经度
+     * @returns Promise<apiResData<{ nearestShopId: number }>>
      */
-    getDistance(lat1: number, lng1: number, lat2: number, lng2: 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 // 距离(公里)
+    async getnNearestShop(latitude: number, longitude: number): Promise<apiResData<{ nearestShopId: number }>> {
+      return new Promise((resolve, reject) => {
+        Apis.xsb.nearestShop({ data: { longitude, latitude } }).then((res) => {
+          const newShop = this.xsbShopList.find(it => it.shopId === res.data.nearestShopId)
+          if (newShop) {
+            this.SelectShopInfo = newShop
+          }
+          resolve(res)
+        }).catch((err) => { reject(err) })
+      })
     },
 
   },

+ 21 - 8
src/subPack-xsb/utils/confirm-order.ts

@@ -100,20 +100,30 @@ export function getWxCommonPayment(orderPay: wxpay) {
  * 支付成功统一跳转
  */
 export function paySuccess() {
-  const { paySuccessPath, payBackIndexPath } = storeToRefs(useSysStore())
-  paySuccessPath.value = 'xsb-order'
-  payBackIndexPath.value = 'subPack-xsb/commonTab/index'
-  router.replace({ name: 'common-paySuccess' })
+  return new Promise((resolve) => {
+    const { paySuccessPath, payBackIndexPath } = storeToRefs(useSysStore())
+    paySuccessPath.value = 'xsb-order'
+    payBackIndexPath.value = 'subPack-xsb/commonTab/index'
+    router.replace({ name: 'common-paySuccess' })
+    setTimeout(() => {
+      resolve(1)
+    }, 2000)
+  })
 }
 /**
  * 星闪豹
  * 支付成功统一跳转
  */
 export function payError() {
-  const { paySuccessPath, payBackIndexPath } = storeToRefs(useSysStore())
-  paySuccessPath.value = 'xsb-order'
-  payBackIndexPath.value = 'subPack-xsb/commonTab/index'
-  router.replace({ name: 'common-payError' })
+  return new Promise((resolve) => {
+    const { paySuccessPath, payBackIndexPath } = storeToRefs(useSysStore())
+    paySuccessPath.value = 'xsb-order'
+    payBackIndexPath.value = 'subPack-xsb/commonTab/index'
+    router.replace({ name: 'common-payError' })
+    setTimeout(() => {
+      resolve(1)
+    }, 2000)
+  })
 }
 
 /**
@@ -121,6 +131,7 @@ export function payError() {
  */
 
 export async function clearCart(skuList: Api.CartSkuVo[]) {
+  uni.showLoading({ mask: true })
   return new Promise((resolve) => {
     const skuids = skuList.map(item => item.id).join(',')
     if (skuids.length) {
@@ -131,10 +142,12 @@ export async function clearCart(skuList: Api.CartSkuVo[]) {
       }).then(async (res) => {
         resolve(res)
         await useSmqjhCartStore().getCartList('XSB')
+        uni.hideLoading()
       }).finally(() => resolve(1))
     }
     else {
       resolve(1)
+      uni.hideLoading()
     }
   })
 }

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

@@ -28,7 +28,6 @@ type _LocationUrl =
   "/subPack-common/revalue/index" |
   "/subPack-common/revalueSuccess/index" |
   "/subPack-common/user-center/index" |
-  "/subPack-smqjh/goodsList/index" |
   "/subPack-smqjh/order/index";
 
 interface NavigateToOptions {

+ 63 - 6
src/utils/index.ts

@@ -9,12 +9,69 @@ export function getCurrentPath() {
 }
 
 /**
- * 统一跳转小程序方法
- * @param appid
- *
+ * 检测当前环境是否为微信小程序
  */
-export function navCommonMiniProgram(appid: string) {
-  uni.navigateToMiniProgram({
-    appId: appid,
+export function isWxMiniProgram() {
+  return new Promise((resolve, reject) => {
+    const apltInfo = uni.getDeviceInfo()
+    console.log(apltInfo, '当前环境=======================')
+
+    if (apltInfo.platform === 'windows') {
+      useGlobalToast().show('不支持电脑操作地址,请使用手机打开')
+      reject(new Error('不支持电脑操作地址,请使用手机打开'))
+    }
+    resolve(1)
   })
 }
+/**
+ * 将角度转换为弧度
+ */
+function toRadians(degrees: number): number {
+  return degrees * Math.PI / 180
+}
+
+/**
+ * 将弧度转换为角度
+ */
+function toDegrees(radians: number): number {
+  return radians * 180 / Math.PI
+}
+
+/**
+ * 计算两个经纬度的中心点(球面插值法)
+ * 适用于任意距离,考虑地球曲率,更精确
+ *
+ * @param pointA 第一个经纬度坐标
+ * @param pointB 第二个经纬度坐标
+ * @returns 中心点经纬度坐标
+ */
+export function calculateCenterPointSpherical(
+  pointA: { lat: number, lng: number },
+  pointB: { lat: number, lng: number },
+): { lat: number, lng: number } {
+  // 将经纬度转换为弧度
+  const lat1 = toRadians(pointA.lat)
+  const lng1 = toRadians(pointA.lng)
+  const lat2 = toRadians(pointB.lat)
+  const lng2 = toRadians(pointB.lng)
+
+  // 计算纬度的差值
+  const dLng = lng2 - lng1
+
+  // 使用球面插值公式计算中心点
+  const Bx = Math.cos(lat2) * Math.cos(dLng)
+  const By = Math.cos(lat2) * Math.sin(dLng)
+
+  const centerLat = Math.atan2(
+    Math.sin(lat1) + Math.sin(lat2),
+    Math.sqrt((Math.cos(lat1) + Bx) * (Math.cos(lat1) + Bx) + By * By),
+  )
+
+  const centerLng = lng1 + Math.atan2(By, Math.cos(lat1) + Bx)
+
+  // 将结果转换回角度
+  return {
+    lat: toDegrees(centerLat),
+    lng: toDegrees(centerLng),
+  }
+}