Parcourir la source

fix(order): 修复优惠券和购物车相关功能的显示与交互问题

- 修正优惠券展示条件,兼容isUsed字段逻辑
- 优化优惠券选择过滤条件,确保正确识别已使用状态
- 调整订单详情中优惠券信息显示,避免空值异常
- 优化库存不足时购物车弹窗逻辑,新增打开和关闭函数
- 修改购物车图标点击事件绑定,支持自定义打开函数
- 调整优惠券弹窗样式,修正宽度布局问题
- 注释并切换开发环境接口地址配置
zhangtao il y a 1 semaine
Parent
commit
1a306419f0

+ 2 - 2
src/config/index.ts

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

+ 8 - 1
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -379,8 +379,15 @@ function handlePay() {
     useGlobalToast().show({ msg: `${shopSkuStock[0].skuName}库存不足` })
     return
   }
+  cartPopup.value = false
   router.push({ name: 'xsb-confirmOrder', params: { data: JSON.stringify(totalProduct.value) } })
 }
+function handleOpen() {
+  if (!getTotalNum.value)
+    return
+  cartPopup.value = true
+  priceDetailPopup.value = false
+}
 </script>
 
 <script lang="ts">
@@ -643,7 +650,7 @@ export default {
     >
       <view class="ios w-full flex items-center justify-between">
         <view class="flex items-center">
-          <view class="flex items-center" @click="cartPopup = true, priceDetailPopup = false">
+          <view class="flex items-center" @click="handleOpen">
             <wd-badge :model-value="getTotalNum" :top="20">
               <image v-if="getTotalNum" :src="`${StaticUrl}/cart-lanzi.png`" class="cart-box h100rpx w100rpx" />
               <image v-else :src="`${StaticUrl}/xsb-cart-disabled.png`" class="cart-box h100rpx w100rpx" />

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

@@ -50,7 +50,7 @@ tryShowCouponArrivalPopup()
             <view v-for="coupon in couponList" :key="coupon.id || coupon.allowanceId" :style="{ backgroundImage: `url(${StaticUrl}/xsb-coupon-idx-bg-popup.png)` }" class="relative mb-20rpx h-164rpx w450rpx bg-contain bg-no-repeat">
               <view class="absolute left-0 top-0 box-border h-full w-full flex items-center px12rpx py24rpx">
                 <view class="h-full w-full flex items-center">
-                  <view class="box-border flex-shrink-0 px20rpx text-center">
+                  <view class="box-border w115rpx flex-shrink-0 text-center">
                     <view class="absolute left-0 top-0 inline-flex rounded-br-10rpx rounded-tl-10rpx bg-[#FF5A36] px-16rpx py-6rpx text-20rpx text-white">
                       {{ Number(coupon.amountMoney) > 0 ? '满减券' : '无门槛' }}
                     </view>

+ 2 - 2
src/subPack-xsb/components/coupon/index.vue

@@ -19,7 +19,7 @@ function handleUseCoupon() {
   <view class="relative">
     <view class="relative box-border h164rpx w-full flex overflow-hidden rounded-16rpx">
       <image
-        v-if="itemcoupon.useStatus !== 2"
+        v-if="itemcoupon.useStatus !== 2 || itemcoupon.isUsed === 1"
         :src="`${StaticUrl}/xsb-coupon-bg-un.png`"
         class="h-full w-full"
       />
@@ -30,7 +30,7 @@ function handleUseCoupon() {
       />
       <view class="absolute left-0 top-0 h-full w-full flex items-center">
         <view class="w-184rpx flex flex-shrink-0 flex-col items-center justify-center py-36rpx">
-          <view class="flex items-end leading-none" :class="[itemcoupon.useStatus == 2 ? 'text-[#FF4A39]' : 'text-[#AAAAAA]']">
+          <view class="flex items-end leading-none" :class="[itemcoupon.useStatus == 2 || itemcoupon.isUsed == 2 ? 'text-[#FF4A39]' : 'text-[#AAAAAA]']">
             <text class="mb-6rpx text-24rpx font-semibold">
               ¥
             </text>

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

@@ -25,8 +25,8 @@ const deliveryType = ref(1)
 const couponPopup = ref(false)
 const couponList = ref<Api.AppMemberCouponVO[]>([])
 const couponTabActive = ref(0)
-const availableCoupons = computed(() => couponList.value.filter(it => it.useStatus === 2))
-const unavailableCoupons = computed(() => couponList.value.filter(it => it.useStatus !== 2))
+const availableCoupons = computed(() => couponList.value.filter(it => it.isUsed === 2))
+const unavailableCoupons = computed(() => couponList.value.filter(it => it.isUsed !== 2))
 const displayCoupons = computed(() => couponTabActive.value === 0 ? availableCoupons.value : unavailableCoupons.value)
 const confirmedCoupon = computed(() => couponList.value.find(it => it.allowanceId === confirmedCouponId.value))
 const draftCoupon = computed(() => couponList.value.find(it => it.allowanceId === draftCouponId.value))
@@ -102,7 +102,7 @@ async function openCouponPopup() {
 }
 
 function handleSelectCoupon(item: Api.AppMemberCouponVO) {
-  if (item.useStatus !== 2 || !item.allowanceId) {
+  if (item.isUsed !== 2 || !item.allowanceId) {
     return
   }
   draftCouponId.value = item.allowanceId

+ 3 - 3
src/subPack-xsb/orderDetaile/index.vue

@@ -477,8 +477,8 @@ function handleRefundDetail(item: any) {
           </view>
         </view>
         <view v-if="orderInfo.refundOrderList" class="mt10rpx rounded-16rpx bg-#ccc p24rpx text-24rpx">
-          <view v-if="orderInfo.couponBaseInfoDTO.isAll">
-            已退还优惠券:{{ orderInfo.couponBaseInfoDTO.activityName }}
+          <view v-if="orderInfo?.isAll">
+            已退还优惠券:{{ orderInfo.couponBaseInfoDTO?.activityName }}
             <view>优惠券已退回您的账户,可在“我的-优惠券”中查看</view>
           </view>
           <view v-else>
@@ -496,7 +496,7 @@ function handleRefundDetail(item: any) {
         <view class="my-24rpx h-2rpx w-full bg-[#F0F0F0]" />
         <view class="flex items-center justify-end">
           <view class="text-28rpx">
-            总计{{ orderInfo.orderMoney }} 共减 {{ Number(orderInfo.offsetPoints) / 100 + Number(orderInfo.couponBaseInfoDTO.discountMoney) }}
+            总计{{ orderInfo.orderMoney }} 共减 {{ Number(orderInfo.offsetPoints) / 100 + Number(orderInfo.couponBaseInfoDTO?.discountMoney) }}
           </view>
           <view class="ml-20rpx text-28rpx text-[#FF4D3A] font-semibold">
             {{ [OrderStatus.PaddingPay, OrderStatus.OrderCancel].includes(Number(orderInfo.hbOrderStatus)) ? '需' : '实'