Browse Source

feat(api): 添加字典接口类型定义和API配置

- 新增sysDict接口类型定义
- 添加sys.dictPage API配置
- 扩展全局类型定义

refactor(config): 移除未使用的配置常量

- 删除ZSWLXSB_APPID和ZSWLZSDD_APPID常量
- 移除VITE_OSS_BASE_URL常量
- 简化静态资源URL配置

feat(classfiy): 优化分类页面UI和交互

- 修改侧边栏为滚动视图组件
- 添加选中项高亮显示
- 调整页面布局结构

feat(index): 首页功能增强和审核状态控制

- 添加在线审核状态管理
- 根据审核状态控制功能模块显示
- 集成字典接口获取审核状态
- 添加页面显示时获取审核状态逻辑

refactor(sysStore): 添加审核状态管理

- 在系统状态中添加isOnlineAudit字段
- 实现getAudit方法获取审核状态
- 初始化默认审核状态为true

fix(confirmOrder): 调整购物车清空时机

- 将清空购物车操作移至支付成功后
- 避免支付过程中购物车被提前清空

fix(search): 修复搜索页面布局问题

- 添加搜索项底部边距
- 改善热门搜索项布局

feat(utils): 添加购物车清空加载状态

- 在清空购物车时显示加载提示
- 确保操作完成后隐藏加载提示
zhangtao 1 week ago
parent
commit
ffcef6b48c

+ 9 - 0
src/api/api.type.d.ts

@@ -1047,5 +1047,14 @@ namespace Api {
     updateTime?: string
     [property: string]: any
   }
+  interface sysDict {
+    createTime: string
+    id: number
+    name: string
+    remark: string
+    status: number
+    typeCode: string
+    value: string
+  }
 
 }

+ 1 - 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}'],

+ 9 - 0
src/api/globals.d.ts

@@ -181,6 +181,15 @@ 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: {
       categories<

+ 1 - 24
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 = {
   /**
    * 开发版
@@ -31,20 +22,6 @@ const mapEnvVersion = {
   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 +32,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'

+ 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>

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

@@ -1,6 +1,6 @@
 <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,7 +17,7 @@ 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())
@@ -35,6 +35,7 @@ const state = computed(() => {
   return error.value ? 'error' : !isLastPage.value ? 'loading' : 'finished'
 })
 onShow(() => {
+  useSysStore().getAudit()
   useSmqjhCartStore().getCartList('XSB')
   useTabbar().setTabbarItem('smqjh-cart', getTotalNum.value)
   refresh()
@@ -45,19 +46,20 @@ onReachBottom(() => {
   }
 })
 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: '' },
+  { icon: `${StaticUrl}/xsb.png`, title: '星闪豹', name: 'xsb-homeTabbar', show: true },
+  { icon: `${StaticUrl}/smqjh-index-cd.png`, title: '充电', name: '', show: !unref(isOnlineAudit) },
+  { icon: `${StaticUrl}/smqjh-sp.png`, title: '电影演出', name: '', show: !unref(isOnlineAudit) },
+  { icon: `${StaticUrl}/smqjh-vip.png`, title: '视频权益', name: '', show: !unref(isOnlineAudit) },
+  { icon: `${StaticUrl}/smqjh-diancan.png`, title: '大牌点餐', name: '', show: !unref(isOnlineAudit) },
+  { icon: `${StaticUrl}/smqjh-jiayou.png`, title: '加油', name: '', show: !unref(isOnlineAudit) },
+  { icon: `${StaticUrl}/smqjh-jiudian.png`, title: '酒店民宿', name: '', show: !unref(isOnlineAudit) },
+  { icon: `${StaticUrl}/smqjh-daijia.png`, title: '代驾', name: '', show: !unref(isOnlineAudit) },
 ])
 onMounted(() => {
   addressStore.getLocation()
   opcity.value = 0
 })
+
 onPageScroll((e) => {
   const calculatedOpacity = e.scrollTop / 100
   opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
@@ -120,23 +122,25 @@ function handleGo() {
     </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="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"
-            >
-              敬请期待
+        <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>
-          <view class="text-24rpx">
-            {{ item.title }}
-          </view>
-        </view>
+        </template>
       </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" />

+ 9 - 0
src/store/sys.ts

@@ -27,6 +27,10 @@ interface SysState {
    * 透明度
    */
   opcity: number
+  /**
+   * 是否上线审核
+   */
+  isOnlineAudit: boolean
 
 }
 export const useSysStore = defineStore('system', {
@@ -37,6 +41,7 @@ export const useSysStore = defineStore('system', {
     payBackIndexPath: '',
     payFailPath: '',
     opcity: 0,
+    isOnlineAudit: true,
   }),
   actions: {
     getSystemData() {
@@ -55,5 +60,9 @@ 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'
+    },
   },
 })

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

@@ -64,10 +64,11 @@ 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()

+ 2 - 2
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>

+ 3 - 0
src/subPack-xsb/utils/confirm-order.ts

@@ -121,6 +121,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 +132,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()
     }
   })
 }