feat(store): 新增门店中心及VIP会员升级功能
- 个人信息页新增门店名称和门店地址展示,支持异步加载与只读显示 - 用户信息卡片整体改为绿色渐变背景,添加光晕和白色边框样式 - 新增升级VIP会员入口,突出展示并添加推荐标签 - 新建VIP会员升级页面,包含门店信息表单和VIP权益预览 - 提交升级申请调用新增api,支持状态检测表单只读 - 门店中心页面重构,简化订单管理,新增功能卡片及VIP审核入口 - 页面加载校验店员身份,非店员拒绝访问并提示 - 购物相关页面和组件全面支持VIP会员价格优先显示dealerPrice - 新增ShopDealerApply模型门店相关字段,丰富会员申请数据记录
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import React, { createContext, useContext, useState, useCallback, type ReactNode } from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { listShopCart, addToCart, updateCartNum, removeShopCart, removeBatchShopCart, updateCartAllChecked } from '@/api/shop/shopCart'
|
||||
import { listShopCart, addToCart, updateCartNum, removeShopCart, removeBatchShopCart, updateCartAllChecked, updateCartChecked } from '@/api/shop/shopCart'
|
||||
import type { ShopGoods, ShopGoodsSku } from '@/api/shop/shopGoods/model'
|
||||
import { isVipMember } from '@/utils/vip'
|
||||
|
||||
export interface CartItem {
|
||||
id?: number
|
||||
@@ -194,8 +195,15 @@ export const CartProvider: React.FC<{ children: ReactNode }> = ({ children }) =>
|
||||
return items.find(i => i.goodsId === goodsId && i.skuId === skuId)?.quantity || 0
|
||||
}, [items])
|
||||
|
||||
const calcPrice = (list: CartItem[]) =>
|
||||
list.reduce((sum, i) => sum + Number(i.skuPrice || i.sku?.price || i.product?.salePrice || i.product?.price || 0) * i.quantity, 0).toFixed(2)
|
||||
const calcPrice = (list: CartItem[]) => {
|
||||
const vip = isVipMember()
|
||||
return list.reduce((sum, i) => {
|
||||
// VIP 会员优先使用 dealerPrice
|
||||
const dealerPrice = vip ? (i.product as any)?.dealerPrice : null
|
||||
const unitPrice = dealerPrice || i.skuPrice || i.sku?.price || i.product?.salePrice || i.product?.price || 0
|
||||
return sum + Number(unitPrice) * i.quantity
|
||||
}, 0).toFixed(2)
|
||||
}
|
||||
|
||||
const selectedItems = items.filter(i => i.checked)
|
||||
const selectedCount = selectedItems.reduce((s, i) => s + i.quantity, 0)
|
||||
|
||||
Reference in New Issue
Block a user