瀏覽代碼

feat(member): 优化会员权益展示与订单确认逻辑

- 计算并显示赠品订单商品总价
- 用户头像展示尊贵会员名称,代替固定文本
- 商品价格区分会员价与渠道价,支持会员价展示
- 订单确认页增加单SKU订单判断,优化配送确认流程
- 订单详情页新增会员权益折扣显示及赠品标识
- 用户会员页面动态渲染多种会员权益与优惠券信息
- 重构会员权益使用函数,统一跳转至相关页面
- 修复订单详情页售后按钮显示逻辑,避免赠品订单误触发
- 修正 manifest.json 末尾格式问题,确保文件结构正确
zouzexu 1 周之前
父節點
當前提交
045013e35e

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

@@ -62,8 +62,8 @@ function handleGo(item: { name: string, status: string }) {
             <view class="relative">
               <image v-if="userMemberInfo.active" :src="`${StaticUrl}/user-head-vip.png`" class="absolute right-[-20rpx] top-[-20rpx] h-50rpx w-50rpx" />
               <image :src="getUserAvatar" alt="" class="h-100rpx w-100rpx flex-shrink-0 rounded-full" />
-              <view v-if="userMemberInfo.active" class="absolute left-[-6rpx] top-90rpx h-40rpx w-112rpx rounded-22rpx bg-[linear-gradient(132deg,#F0C568_0%,#FFF3B2_20.02%,#EBBA5E_44.19%,#FFF3B2_71.13%,#F0C26C_100%)] text-center text-24rpx text-#7F5935 line-height-40rpx">
-                尊贵会员
+              <view v-if="userMemberInfo.active" class="absolute left-50% top-90rpx h-40rpx whitespace-nowrap rounded-22rpx bg-[linear-gradient(132deg,#F0C568_0%,#FFF3B2_20.02%,#EBBA5E_44.19%,#FFF3B2_71.13%,#F0C26C_100%)] px-16rpx text-center text-24rpx text-#7F5935 line-height-40rpx -translate-x-50%">
+                {{ userMemberInfo.memberTypeName }}
               </view>
             </view>
             <view class="ml-20rpx flex-1">

+ 5 - 2
src/subPack-smqjh/giveawaysVip/giveawaysVip.vue

@@ -61,12 +61,15 @@ async function pickUp() {
         channelId: item.channelId!,
       }
     })
+    const totalGoodsPrice = giveawaysList.value.reduce((sum, item) => {
+      return sum + Number(item.price || 0) * Number(item.quantity || 1)
+    }, 0)
     const orderInfo = {
       totalPrice: 0,
       transfee: 0,
       offsetPoints: 0,
       shopName: firstGift.shopName || '',
-      price: 0,
+      price: totalGoodsPrice,
       amount: 0,
       coupon: 0,
       couponName: '',
@@ -78,7 +81,7 @@ async function pickUp() {
           prodId: item.spuId || 0,
           num: Number(item.quantity || 1),
           pic: item.picUrl,
-          price: '0',
+          price: item.price ?? '0',
           shopId: item.shopId!,
           shopSkuStocks: String(item.stock ?? ''),
           skuId: item.skuId!,

+ 95 - 20
src/subPack-smqjh/userVip/userVip.vue

@@ -1,5 +1,4 @@
 <script setup lang="ts">
-import { rightsList } from './vip-data'
 import router from '@/router'
 import { StaticUrl } from '@/config'
 
@@ -13,27 +12,23 @@ definePage({
   },
 
 })
+const { userMemberInfo } = storeToRefs(useUserStore())
+const rightsInfo = ref()
 onMounted(() => {
   opcity.value = 0
+  rightsInfo.value = JSON.parse(userMemberInfo.value.benefitConfigJson || '')
+  console.log(JSON.parse(userMemberInfo.value.benefitConfigJson || ''), '解析出的json')
 })
-const { userMemberInfo } = storeToRefs(useUserStore())
+
 onPageScroll((e) => {
   const calculatedOpacity = e.scrollTop / 100
   opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
 })
 
-function toUse(value: any) {
-  if (value.id === 1) {
-    wx.openOfficialAccountArticle({
-      url: 'https://mp.weixin.qq.com/s/lxpdZ6DUhgqg00AT9klu5Q',
-    })
-  }
-  if (value.route === '') {
-    useGlobalToast().show('该权益正在快马加鞭赶来~')
-  }
-  else {
-    router.push({ name: value.route })
-  }
+function toUse() {
+  wx.openOfficialAccountArticle({
+    url: 'https://mp.weixin.qq.com/s/lxpdZ6DUhgqg00AT9klu5Q',
+  })
 }
 </script>
 
@@ -98,21 +93,101 @@ function toUse(value: any) {
           </view>
         </view>
       </view>
-      <view class="mt-44rpx flex flex-wrap gap-20rpx">
-        <view v-for="value in rightsList" :key="value.id" class="w-304rpx border-[1rpx_solid_#F4E5BD] rounded-32rpx bg-[rgba(255,255,255,0.3)] p-20rpx">
+      <view class="mt-44rpx flex flex-wrap gap-14rpx">
+        <view v-if="rightsInfo?.oilPerLiterDiscount" class="w-304rpx border-[1rpx_solid_#F4E5BD] rounded-32rpx bg-[rgba(255,255,255,0.3)] p-20rpx">
+          <view class="text-28rpx text-#FEE3AD font-bold">
+            全省中石化优惠
+          </view>
+          <view class="mt-20rpx flex items-center justify-between">
+            <view>
+              <view class="text-28rpx text-#b5b5b5">
+                每升立减{{ rightsInfo?.oilPerLiterDiscount }}元
+              </view>
+              <view class="mt-16rpx h-42rpx w-108rpx rounded-22rpx bg-#F4E5BD text-center text-24rpx text-#7F5935 line-height-42rpx" @click="toUse">
+                去使用
+              </view>
+            </view>
+            <image :src="rightsInfo?.oilIcon" class="h-80rpx w-80rpx" />
+          </view>
+        </view>
+        <view v-if="rightsInfo?.mallDiscountRate" class="w-304rpx border-[1rpx_solid_#F4E5BD] rounded-32rpx bg-[rgba(255,255,255,0.3)] p-20rpx">
+          <view class="text-28rpx text-#FEE3AD font-bold">
+            市民请集合平台快消品
+          </view>
+          <view class="mt-20rpx flex items-center justify-between">
+            <view>
+              <view class="text-28rpx text-#b5b5b5">
+                折扣率{{ rightsInfo?.mallDiscountRate }}折
+              </view>
+              <view class="mt-16rpx h-42rpx w-108rpx rounded-22rpx bg-#F4E5BD text-center text-24rpx text-#7F5935 line-height-42rpx" @click="router.push({ name: 'xsb-homeTabbar' })">
+                去使用
+              </view>
+            </view>
+            <image :src="rightsInfo?.mallIcon" class="h-80rpx w-80rpx" />
+          </view>
+        </view>
+        <view v-if="rightsInfo?.chargePerKwhDiscount" class="w-304rpx border-[1rpx_solid_#F4E5BD] rounded-32rpx bg-[rgba(255,255,255,0.3)] p-20rpx">
+          <view class="text-28rpx text-#FEE3AD font-bold">
+            全省贵阳城投充电桩优惠
+          </view>
+          <view class="mt-20rpx flex items-center justify-between">
+            <view>
+              <view class="text-28rpx text-#b5b5b5">
+                每度电立减{{ rightsInfo?.chargePerKwhDiscount }}元
+              </view>
+              <view class="mt-16rpx h-42rpx w-108rpx rounded-22rpx bg-#F4E5BD text-center text-24rpx text-#7F5935 line-height-42rpx" @click="router.push({ name: 'charge-index' })">
+                去使用
+              </view>
+            </view>
+            <image :src="rightsInfo?.chargeIcon" class="h-80rpx w-80rpx" />
+          </view>
+        </view>
+        <view v-if="rightsInfo?.parkingDiscountRate" class="w-304rpx border-[1rpx_solid_#F4E5BD] rounded-32rpx bg-[rgba(255,255,255,0.3)] p-20rpx">
           <view class="text-28rpx text-#FEE3AD font-bold">
-            {{ value.title }}
+            贵阳城投停车场优惠
           </view>
           <view class="mt-20rpx flex items-center justify-between">
             <view>
               <view class="text-28rpx text-#b5b5b5">
-                {{ value.desc }}
+                折扣率{{ rightsInfo?.parkingDiscountRate }}折
               </view>
-              <view class="mt-16rpx h-42rpx w-108rpx rounded-22rpx bg-#F4E5BD text-center text-24rpx text-#7F5935 line-height-42rpx" @click="toUse(value)">
+              <view class="mt-16rpx h-42rpx w-108rpx rounded-22rpx bg-#F4E5BD text-center text-24rpx text-#7F5935 line-height-42rpx" @click="router.push({ name: rightsInfo?.parkingRoutePath })">
                 去使用
               </view>
             </view>
-            <image :src="value.icon" class="h-80rpx w-80rpx" />
+            <image :src="rightsInfo?.parkingIcon" class="h-80rpx w-80rpx" />
+          </view>
+        </view>
+        <view v-if="userMemberInfo?.couponConfig.length > 0" class="w-304rpx border-[1rpx_solid_#F4E5BD] rounded-32rpx bg-[rgba(255,255,255,0.3)] p-20rpx">
+          <view class="text-28rpx text-#FEE3AD font-bold">
+            优惠券
+          </view>
+          <view class="mt-20rpx flex items-center justify-between">
+            <view>
+              <view class="text-28rpx text-#b5b5b5">
+                优惠券{{ userMemberInfo?.couponCount }}张
+              </view>
+              <view class="mt-16rpx h-42rpx w-108rpx rounded-22rpx bg-#F4E5BD text-center text-24rpx text-#7F5935 line-height-42rpx" @click="router.push({ name: 'xsb-coupon' })">
+                去查看
+              </view>
+            </view>
+            <image :src="userMemberInfo?.couponConfig[0].icon" class="h-80rpx w-80rpx" />
+          </view>
+        </view>
+        <view v-if="userMemberInfo?.giftConfig.length > 0" class="w-304rpx border-[1rpx_solid_#F4E5BD] rounded-32rpx bg-[rgba(255,255,255,0.3)] p-20rpx">
+          <view class="text-28rpx text-#FEE3AD font-bold">
+            自选赠品
+          </view>
+          <view class="mt-20rpx flex items-center justify-between">
+            <view>
+              <view class="text-28rpx text-#b5b5b5">
+                自选赠品{{ userMemberInfo?.giftCount }}个
+              </view>
+              <view class="mt-16rpx h-42rpx w-108rpx rounded-22rpx bg-#F4E5BD text-center text-24rpx text-#7F5935 line-height-42rpx" @click="router.push({ name: 'smqjh-giveaways-vip' })">
+                {{ userMemberInfo?.giftCount > 0 ? '待领取' : '已领取' }}
+              </view>
+            </view>
+            <image :src="userMemberInfo?.giftConfig[0].icon" class="h-80rpx w-80rpx" />
           </view>
         </view>
       </view>

+ 17 - 1
src/subPack-xsb/components/goodsItem/index.vue

@@ -33,7 +33,23 @@ defineProps<{ itemGoods: Api.xsbCategoryProductList }>()
 
         <view class="mt10rpx flex items-center justify-between">
           <view>
-            <view class="mt20rpx flex items-end text-#FF4D3A font-semibold">
+            <view v-if="itemGoods.isMember" class="mt-20rpx flex items-center gap-16rpx">
+              <view class="flex items-end text-[#FF4D3A]">
+                <view class="text-24rpx">
+                  ¥
+                </view>
+                <view class="text-36rpx line-height-[36rpx]">
+                  {{ itemGoods.memberPrice }}
+                </view>
+                <view class="text-24rpx">
+                  元
+                </view>
+              </view>
+              <view class="text-24rpx text-#AAA line-through">
+                ¥{{ itemGoods.channelProdPrice }}
+              </view>
+            </view>
+            <view v-else class="mt20rpx flex items-end text-#FF4D3A font-semibold">
               <view class="text-24rpx">
               </view>

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

@@ -34,6 +34,7 @@ const mobilePattern = /^1[3-9]\d{9}$/
 const mobileRules = [{ required: true, pattern: mobilePattern, message: '请输入正确的手机号' }]
 const deliveryType = ref(1)
 const isMemberGiftOrder = computed(() => !!orderInfo.value?.memberGiftItems?.length)
+const isSingleSkuOrder = computed(() => (orderInfo.value?.skuList?.length || 0) <= 1)
 const isSelfPickup = computed(() => current.value === '自提')
 const shopAddressInfo = computed(() => orderInfo.value?.shopAddressDTO)
 const shopDistanceText = computed(() => {
@@ -98,14 +99,14 @@ onLoad((options: any) => {
 })
 onShow(() => {
   useUserStore().getuserAddresslist()
-  if (orderInfo.value && current.value === '即时配送') {
+  if (orderInfo.value && current.value === '即时配送' && isSingleSkuOrder.value) {
     getConfirmOrder()
   }
 })
 
 watch(current, async (value) => {
   deliveryType.value = value === '自提' ? 2 : 3
-  if (orderInfo.value) {
+  if (orderInfo.value && isSingleSkuOrder.value) {
     await getConfirmOrder()
   }
 })
@@ -360,6 +361,9 @@ async function handlePay() {
           <view class="flex-1">
             <view class="w-full flex items-center justify-between font-semibold">
               <view class="text-28rpx">
+                <text v-if="isMemberGiftOrder" class="mr-8rpx rounded-8rpx bg-#FF4D3A px-12rpx py-4rpx text-22rpx text-#FFF">
+                  赠品
+                </text>
                 {{ item.skuName }}
               </view>
               <view class="text-32rpx text-#FF4D3A">

+ 13 - 2
src/subPack-xsb/goods/index.vue

@@ -174,9 +174,20 @@ function handleClick() {
           </view>
         </template>
       </wd-swiper>
-      <view class="view-0 header relative z-3 rounded-t-32rpx px24rpx pt24rpx -mt30rpx">
+      <view class="header view-0 relative z-3 rounded-t-32rpx px24rpx pt24rpx -mt30rpx">
         <view class="flex items-center justify-between">
-          <view class="flex items-end text-#FF4D3A font-semibold">
+          <view v-if="goodsInfo?.isMember" class="flex items-end text-#FF4D3A font-semibold">
+            <view class="text-24rpx">
+              ¥
+            </view>
+            <view class="text-36rpx line-height-[36rpx]">
+              {{ goodsInfo?.memberPrice }}
+            </view>
+            <view class="ml-14rpx text-24rpx text-#AAA line-through">
+              ¥{{ goodsInfo?.channelProdPrice }}
+            </view>
+          </view>
+          <view v-else class="flex items-end text-#FF4D3A font-semibold">
             <view class="text-24rpx">
             </view>

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

@@ -39,7 +39,7 @@ const mapTextShop = {
   [OrderStatus.OrderDelivering]: orderInfo.value?.dvyType === 3 ? '骑手配送中' : '待收货',
   [OrderStatus.OrderArrived]: '已送达',
 }
-
+const { userMemberInfo } = storeToRefs(useUserStore())
 const mapLation = computed(() => {
   const lation = {
     latitude: mapInfo.value?.shopLatitude,
@@ -385,7 +385,7 @@ function handleRefundDetail(item: any) {
             </Zcontact>
           </view>
           <view
-            v-if="orderInfo.refundStatus != 2 && [OrderStatus.OrderWaitDelivery, OrderStatus.OrderAccepted].includes(orderInfo.hbOrderStatus)"
+            v-if="!orderInfo?.giftOrder && orderInfo.refundStatus != 2 && [OrderStatus.OrderWaitDelivery, OrderStatus.OrderAccepted].includes(orderInfo.hbOrderStatus)"
             class="flex flex-col items-center" @click="handleAfterSale"
           >
             <image :src="`${StaticUrl}/orderDetaile-shou.png`" class="h-40rpx w-40rpx" />
@@ -512,7 +512,7 @@ function handleRefundDetail(item: any) {
         </view>
         <view v-if="orderInfo?.giftOrder" class="mt-24rpx flex items-center justify-between">
           <view class="text-28rpx">
-            会员权益(9.5折)
+            会员权益({{ userMemberInfo?.benefitConfig.mallDiscountRate }}折)
           </view>
           <view class="text-[#FF4A39] font-semibold">
             ¥{{ orderInfo?.memberDiscountAmount }}