Procházet zdrojové kódy

feat(config): 更新开发环境API地址配置

- 将开发环境API地址从测试服务器切换到正式域名
- 注释掉旧的测试服务器地址 'http://47.109.84.152:8081'
- 启用新的正式域名 'https://smqjh.api.zswlgz.com'

fix(cart): 添加库存不足验证逻辑

- 在购物车结算前检查商品库存
- 如果库存不足则显示错误提示信息
- 防止用户在库存不足的情况下提交订单

fix(commonTab): 修复分类页面布局和库存验证

- 调整分类页面侧边栏高度从0px改为260rpx
- 添加控制台日志用于调试滚动索引
- 在滚动到底部时防止越界操作
- 实现支付前的库存验证功能
- 替换原生sidebar为自定义滚动视图组件
- 添加底部占位视图避免内容被遮挡
- 修复页面高度计算,增加底部安全区域适配

feat(order): 优化订单列表页面样式

- 将订单金额文本居中显示
- 提升视觉效果和用户体验

fix(orderDetaile): 修复订单详情页面UI

- 调整联系商家按钮样式和间距
- 修复删除订单按钮的样式类
- 添加联系商家按钮的CSS样式覆盖

fix(goods): 添加商品详情页库存验证

- 在商品详情页添加库存不足的验证逻辑
- 防止用户选择超出库存数量的商品
- 确保确认订单和加入购物车功能的安全性

refactor(store): 移除商店列表缓存逻辑

- 移除商店列表的缓存检查逻辑
- 确保每次都能获取最新的商店列表数据

docs(commonTab): 更新页面导航逻辑

- 在我的页面添加订单列表跳转功能
- 更新分页逻辑从refresh改为reload
- 修复页面重新加载和数据刷新的问题
zhangtao před 1 týdnem
rodič
revize
5d33a595b7

+ 2 - 2
src/config/index.ts

@@ -16,8 +16,8 @@ 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:88',
+  // develop: 'http://47.109.84.152:8081',
+  develop: 'https://smqjh.api.zswlgz.com',
   /**
    * 体验版
    */

+ 1 - 1
src/pages/my/index.vue

@@ -91,7 +91,7 @@ function handleGo(item: { name: string }) {
             <view class="text-32rpx font-semibold">
               订单列表
             </view>
-            <view class="flex items-center">
+            <view class="flex items-center" @click="router.push({ name: 'smqjh-order' })">
               <view class="text-28rpx">
                 查看全部
               </view>

+ 10 - 4
src/store/cart.ts

@@ -224,10 +224,16 @@ export const useSmqjhCartStore = defineStore('smqjh-cart', {
         useGlobalToast().show({ msg: '不能同时选中两个店铺的商品' })
         return
       }
-      router.push({
-        name: 'xsb-confirmOrder',
-        params: { data: JSON.stringify(this.totalProduct) },
-      })
+      const shopSkuStock = this.totalProduct.skuList.filter(it => it.num > Number(it.shopSkuStocks))
+      if (shopSkuStock.length) {
+        useGlobalToast().show({ msg: `${shopSkuStock[0].skuName}库存不足` })
+      }
+      else {
+        router.push({
+          name: 'xsb-confirmOrder',
+          params: { data: JSON.stringify(this.totalProduct) },
+        })
+      }
     },
     /**
      * 统一获取价格逻辑

+ 1 - 1
src/subPack-smqjh/order/index.vue

@@ -161,7 +161,7 @@ async function handleSubmitOrder(order: Api.xsbOrderList) {
               </scroll-view>
             </view>
             <view class="box-shadow box-border h-full flex-1 flex-shrink-0 px14rpx py40rpx">
-              <view class="text-32rpx text-#FF4D3A font-semibold">
+              <view class="text-center text-32rpx text-#FF4D3A font-semibold">
                 ¥{{ item.actualTotal }}
               </view>
               <view class="text-center text-28rpx text-#AAAAAA">

+ 27 - 12
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -45,7 +45,7 @@ const hasCartData = computed(() => {
   if (cartList.value.length) {
     return '390rpx'
   }
-  return '0px'
+  return '260rpx'
 })
 const productList = ref<Api.xsbCategoryProductList[]>([])
 const topScrollView = ref()
@@ -112,6 +112,9 @@ async function getProductList() {
 function handlScrollBottom() {
   goodsLoading.value = 'loading'
   const index = categories?.value.findIndex(it => it.code === leftActive.value)
+  console.log(index, '-================')
+  if (index + 1 === categories.value.length)
+    return
   if (index !== -1) {
     handleChange({ value: categories.value[index + 1].code })
   }
@@ -295,6 +298,18 @@ async function handleSkuAddCart() {
   getGoodsPrice()
   await getCartCategorList()
 }
+function handlePay() {
+  if (!totalProduct.value) {
+    useGlobalToast().show('请选择商品')
+    return
+  }
+  const shopSkuStock = totalProduct.value.skuList.filter(it => it.num > Number(it.shopSkuStocks))
+  if (shopSkuStock.length) {
+    useGlobalToast().show({ msg: `${shopSkuStock[0].skuName}库存不足` })
+    return
+  }
+  router.push({ name: 'xsb-confirmOrder', params: { data: JSON.stringify(totalProduct) } })
+}
 </script>
 
 <template>
@@ -398,13 +413,12 @@ async function handleSkuAddCart() {
       </wd-popup>
     </view>
     <view class="wraper">
-      <wd-sidebar v-model="leftActive" @change="handleChange">
-        <wd-sidebar-item
-          v-for="(item) in categories" :key="item.code"
-          custom-style="font-size:28rpx; white-space: nowrap;text-overflow: ellipsis;overflow: hidden;"
-          :value="item.code" :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${leftActive}`">
+        <view v-for="item in categories" :id="`id${item.code}`" :key="item.code" :class="[item.code == leftActive ? 'bg-white' : '']" class="relative h100rpx flex items-center justify-center whitespace-nowrap text-28rpx" @click="handleChange({ value: item.code })">
+          {{ item.name }}
+          <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">
         <view class="p20rpx">
           <image :src="`${StaticUrl}/class.png`" class="h144rpx w-full" />
@@ -494,6 +508,7 @@ async function handleSkuAddCart() {
             <wd-loadmore :state="goodsLoading" />
           </view>
           <wd-status-tip v-else image="content" tip="暂无内容" />
+          <view v-if="goodsLoading == 'finished'" class="h-50vh" />
         </scroll-view>
       </view>
     </view>
@@ -518,7 +533,7 @@ async function handleSkuAddCart() {
             </view>
           </view>
           <view class="ml20rpx w160rpx">
-            <wd-button block size="large" @click="totalProduct?.price && router.push({ name: 'xsb-confirmOrder', params: { data: JSON.stringify(totalProduct) } })">
+            <wd-button block size="large" @click="handlePay">
               结算
             </wd-button>
           </view>
@@ -622,9 +637,9 @@ async function handleSkuAddCart() {
 
 .wraper {
   display: flex;
-  height: calc(100vh - var(--window-top) - v-bind(navHeight) - v-bind(hasCartData));
-  height: calc(100vh - var(--window-top) - constant(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData));
-  height: calc(100vh - var(--window-top) - env(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData));
+  height: calc(100vh - var(--window-top) - v-bind(navHeight) - v-bind(hasCartData) - var(--window-bottom));
+  height: calc(100vh - var(--window-top) - constant(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData) - var(--window-bottom));
+  height: calc(100vh - var(--window-top) - env(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData) - var(--window-bottom));
 }
 
 .content {

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

@@ -77,7 +77,7 @@ function handleGo(item: { name: string }) {
             <view class="text-32rpx font-semibold">
               订单列表
             </view>
-            <view class="flex items-center">
+            <view class="flex items-center" @click="router.push({ name: 'xsb-order' })">
               <view class="text-28rpx">
                 查看全部
               </view>

+ 5 - 4
src/subPack-xsb/commonTab/index.vue

@@ -25,7 +25,7 @@ definePage({
 const { ScrollDown, backTop, SelectShopInfo } = storeToRefs(useSysXsbStore())
 const { userInfo } = storeToRefs(useUserStore())
 const commonCategoryData = ref<Api.xsbCategories[]>([])
-const { data: goodsList, isLastPage, page, error, refresh } = usePagination((pageNum, pageSize) =>
+const { data: goodsList, isLastPage, page, error, reload } = usePagination((pageNum, pageSize) =>
   Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', shopId: Number(SelectShopInfo.value?.shopId) || 1, channelId: userInfo.value.channelId || 1 } }), {
   data: resp => resp.data?.list,
   initialData: [],
@@ -88,13 +88,14 @@ onMounted(async () => {
   hotText.value = await getSearchData(2)
   recommendText.value = await getSearchData(3)
   getCurrentImg()
-  refresh()
+  // reload()
   getCategories()
 })
-onShow(() => refresh())
+onShow(() => reload())
 
 watch(() => SelectShopInfo.value.shopId, () => {
   getCategories()
+  reload()
 })
 
 onShareAppMessage(() => {
@@ -104,7 +105,7 @@ onShareAppMessage(() => {
 })
 function handleScrollBottom() {
   if (error.value) {
-    refresh()
+    reload()
     return
   }
   if (!isLastPage.value) {

+ 1 - 1
src/subPack-xsb/confirmOrder/index.vue

@@ -76,7 +76,6 @@ async function handlePay() {
     payError()
     isPay.value = false
   }
-  // router.replace({ name: 'common-paySuccess' })
 }
 </script>
 
@@ -186,6 +185,7 @@ async function handlePay() {
         <wd-input v-model="remarks" placeholder="选填,请先和商家协商一致,付款后商家可见" no-border clearable />
       </view>
     </view>
+    <view class="h250rpx" />
     <view class="ios footer fixed bottom-0 left-0 box-border w-full rounded-t-16rpx bg-white px24rpx">
       <view class="box-border w-full flex items-center justify-between py20rpx">
         <view class="flex items-center text-#FF4D3A">

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

@@ -96,6 +96,7 @@ async function getGoodsDetaile() {
 async function handleConfimOrder() {
   if (Number(unref(goodsInfo)?.spuStock) < unref(SelectGoodsNum)) {
     useGlobalToast().show('库存不足,请调整购买数量')
+    return
   }
   isLoging.value = true
   const res = await Apis.xsb.skuOrderConfirm({
@@ -106,14 +107,22 @@ async function handleConfimOrder() {
       shopId: unref(goodsInfo)?.shopId,
     },
   })
+  if (Number(res.data.sku?.shopSkuStocks) < unref(SelectGoodsNum)) {
+    useGlobalToast().show('库存不足,请调整购买数量')
+    isLoging.value = false
+    return
+  }
   router.push({
     name: 'xsb-confirmOrder',
     params: { data: JSON.stringify({ ...res.data, skuList: [{ ...res.data.sku, num: SelectGoodsNum.value }] }) },
   })
   isLoging.value = false
-  console.log(res, '数据')
 }
 async function handleAddCart() {
+  if (Number(unref(goodsInfo)?.spuStock) < unref(SelectGoodsNum)) {
+    useGlobalToast().show('库存不足,请调整购买数量')
+    return
+  }
   isLoging.value = true
   try {
     await useSmqjhCartStore().addCart(specId.value, unref(SelectGoodsNum), unref(SelectShopInfo.value.shopId), 'XSB')

+ 1 - 1
src/subPack-xsb/order/index.vue

@@ -148,7 +148,7 @@ async function handleSubmitOrder(order: Api.xsbOrderList) {
               </scroll-view>
             </view>
             <view class="box-shadow box-border h-full flex-1 flex-shrink-0 px14rpx py40rpx">
-              <view class="text-32rpx text-#FF4D3A font-semibold">
+              <view class="text-center text-32rpx text-#FF4D3A font-semibold">
                 ¥{{ item.actualTotal }}
               </view>
               <view class="text-center text-28rpx text-#AAAAAA">

+ 18 - 14
src/subPack-xsb/orderDetaile/index.vue

@@ -135,51 +135,49 @@ function handleCopy() {
         </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">
+        <view class="flex flex-col items-center" @click="handelDel">
           <image
             :src="`${StaticUrl}/orderDetaile-del.png`"
             class="h40rpx w40rpx"
           />
-          <view class="mt20rpx">
+          <view class="mt40rpx">
             删除订单
           </view>
         </view>
-        <view class="flex flex-col items-center overflow-hidden">
+        <view class="contact flex flex-col items-center overflow-hidden">
           <image
             :src="`${StaticUrl}/orderDetaile-wx.png`"
             class="h40rpx w40rpx"
           />
-          <wd-button class="zbutton" open-type="contact" type="text">
-            <view class="mt15rpx text-28rpx text-#222">
-              联系商家
-            </view>
-          </wd-button>
+          <button open-type="contact" class="zbutton mt40rpx">
+            联系商家
+          </button>
         </view>
 
-        <!-- <view class="flex flex-col items-center" @click="router.push({ name: 'common-afterSales' })">
+        <!-- <view class="flex  flex-col items-center " @click="router.push({ name: 'common-afterSales' })">
           <image
             :src="`${StaticUrl}/orderDetaile-shou.png`"
             class="h40rpx w40rpx"
           />
-          <view class="mt20rpx">
+          <view class="mt40rpx">
             申请售后
           </view>
         </view> -->
-        <!-- <view class="flex flex-col items-center" @click="router.push({ name: 'common-revalue' })">
+        <!-- <view class="flex  flex-col items-center " @click="router.push({ name: 'common-revalue' })">
           <image
             :src="`${StaticUrl}/orderDetaile-pj.png`"
             class="h40rpx w40rpx"
           />
-          <view class="mt20rpx">
+          <view class="mt40rpx">
             评价晒单
           </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"
           />
-          <view class="mt20rpx">
+          <view class="mt40rpx">
             再次购买
           </view>
         </view> -->
@@ -337,6 +335,12 @@ function handleCopy() {
       color: #FF4D3A  !important;
       font-size: 36rpx !important;
     }
+    .contact .wd-button{
+      font-size: 28rpx !important;
+      height: 40rpx !important;
+      padding: 0 !important;
+      margin-top: 40rpx !important;
+    }
   }
 }
 </style>

+ 0 - 4
src/subPack-xsb/store-xsb/sys.ts

@@ -45,10 +45,6 @@ export const useSysXsbStore = defineStore('system-xsb', {
     },
     async getAllShopList() {
       return new Promise((resolve, reject) => {
-        if (this.xsbShopList.length) {
-          resolve(1)
-          return
-        }
         Apis.xsb.shopList({}).then((res) => {
           this.xsbShopList = res.data
           const { Location } = storeToRefs(useAddressStore())