diff --git a/pages/goods/index.vue b/pages/goods/index.vue index 710bcff2..11a45958 100644 --- a/pages/goods/index.vue +++ b/pages/goods/index.vue @@ -146,7 +146,8 @@ formatSales, formatGoodsSwiper, fen2yuan, - handList + handList, + handListPrice } from '@/sheep/hooks/useGoods'; import detailNavbar from './components/detail/detail-navbar.vue'; import detailCellSku from './components/detail/detail-cell-sku.vue'; @@ -185,7 +186,14 @@ // 规格变更 function onSkuChange(e) { - state.selectedSku = e; + console.log('传来的规格改变',e) + if(e.type == 4){ + settleData.value = e + setShow.value = true + }else{ + state.selectedSku = e; + setShow.value = false + } } // 添加购物车 @@ -271,21 +279,23 @@ async function getSettlementByIds(ids) { const { data } = await SpuApi.getSettlementProduct(ids); settleData.value = handle(data) - console.log('结算信息',data) console.log('处理后数据',settleData.value) + state.goodsInfo.skus = handListPrice(state.goodsInfo.skus,data[0].skus) + console.log('要传递的数据',state.goodsInfo) } //判断是否有限时折扣信息 function handle(array){ let setList = {} - array.forEach(item => { - item.skus.forEach(items => { - if(items.type == 4){ - setShow.value = true - setList = items - return; - } - }) - }) + array.some(item => { + return item.skus.some(items => { + if (items.type === 4) { + setShow.value = true; + setList = items; + return true; // 返回true以结束some循环 + } + return false; // 继续遍历 + }); + }); // 将库存信息加入 state.goodsInfo.skus.forEach(item =>{ if(item.id == setList.skuId){ diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue index 227790e4..10689713 100644 --- a/pages/order/confirm.vue +++ b/pages/order/confirm.vue @@ -121,8 +121,7 @@ v-if="state.orderInfo.price.discountPrice > 0" > 活动优惠 - - + -¥{{ fen2yuan(state.orderInfo.price.discountPrice) }} diff --git a/sheep/components/s-activity-pop/s-activity-pop.vue b/sheep/components/s-activity-pop/s-activity-pop.vue index 47ec0486..b13b139b 100644 --- a/sheep/components/s-activity-pop/s-activity-pop.vue +++ b/sheep/components/s-activity-pop/s-activity-pop.vue @@ -5,15 +5,61 @@ 优惠 促销 - - - + + + - - {{ formatRewardActivityRule(state.activityMap[item.id], rule) }} + + 满{{fen2yuan(item.discountPrice)}}元减{{fen2yuan(item.limit)}}元; - {{formatDateRange(item.startTime,item.endTime)}} + {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}} + + + + + + + + + + + 满{{fen2yuan(item.discountPrice)}}元包邮; + + + {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}} + + + + + + + + + + + 满{{fen2yuan(item.discountPrice)}}元送{{item.value}}积分; + + + {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}} + + + + + + + + + + + 满{{fen2yuan(item.discountPrice)}}元送{{item.value}}张优惠券; + + + {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}} @@ -61,9 +107,9 @@ } from 'vue'; import RewardActivityApi from '@/sheep/api/promotion/rewardActivity'; import { - formatRewardActivityRule, fen2yuan, - formatDateRange + formatDateRange, + handActitList } from '@/sheep/hooks/useGoods'; const props = defineProps({ modelValue: { @@ -92,7 +138,8 @@ if (res.code !== 0) { return; } - state.activityMap[activity.id] = res.data; + state.activityMap[activity.id] = handActitList(res.data.rules); + console.log('最终数据', state) }) }); } diff --git a/sheep/components/s-discount-list/s-discount-list.vue b/sheep/components/s-discount-list/s-discount-list.vue index 22fbd43c..62360016 100644 --- a/sheep/components/s-discount-list/s-discount-list.vue +++ b/sheep/components/s-discount-list/s-discount-list.vue @@ -1,23 +1,12 @@ + .model-box { + height: 60vh; + } + + .model-content { + height: 54vh; + } + + .modal-footer { + width: 100%; + height: 120rpx; + background: #fff; + } + + .confirm-btn { + width: 710rpx; + margin-left: 20rpx; + height: 80rpx; + background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); + border-radius: 40rpx; + color: #fff; + } + + .content-img { + width: 140rpx; + height: 140rpx; + margin-right: 20rpx; + margin-bottom: 20rpx; + } + + .subtitle { + font-size: 28rpx; + font-weight: 500; + color: #333333; + } + + .price-text { + color: #ff3000; + } + \ No newline at end of file diff --git a/sheep/components/s-select-sku/s-select-sku.vue b/sheep/components/s-select-sku/s-select-sku.vue index 4a48e0dc..283f88eb 100644 --- a/sheep/components/s-select-sku/s-select-sku.vue +++ b/sheep/components/s-select-sku/s-select-sku.vue @@ -13,6 +13,8 @@ {{ fen2yuan( state.selectedSku.price || goodsInfo.price) }} + 会员价 + 限时优惠 @@ -96,6 +98,7 @@ () => state.selectedSku, (newVal) => { emits('change', newVal); + console.log('选中的sku信息',state.selectedSku) }, { immediate: true, // 立即执行 deep: true, // 深度监听 @@ -403,4 +406,13 @@ } } } + .iconBox { + width: fit-content; + height: fit-content; + padding: 2rpx 10rpx; + background-color: rgb(255, 242, 241); + color: #ff2621; + font-size: 24rpx; + margin-left: 5rpx; + } \ No newline at end of file diff --git a/sheep/hooks/useGoods.js b/sheep/hooks/useGoods.js index 05bdf7f7..a1133c92 100644 --- a/sheep/hooks/useGoods.js +++ b/sheep/hooks/useGoods.js @@ -1,7 +1,11 @@ -import { ref } from 'vue'; +import { + ref +} from 'vue'; import dayjs from 'dayjs'; import $url from '@/sheep/url'; -import { formatDate } from '@/sheep/util'; +import { + formatDate +} from '@/sheep/util'; /** * 格式化销量 @@ -10,8 +14,8 @@ import { formatDate } from '@/sheep/util'; * @return {string} 格式化后的销量字符串 */ export function formatSales(type, num) { - let prefix = type !== 'exact' && num < 10 ? '销量' : '已售'; - return formatNum(prefix, type, num) + let prefix = type !== 'exact' && num < 10 ? '销量' : '已售'; + return formatNum(prefix, type, num) } /** @@ -21,7 +25,7 @@ export function formatSales(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatExchange(type, num) { - return formatNum('已兑换', type, num) + return formatNum('已兑换', type, num) } @@ -32,7 +36,7 @@ export function formatExchange(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatStock(type, num) { - return formatNum('库存', type, num) + return formatNum('库存', type, num) } /** @@ -43,27 +47,27 @@ export function formatStock(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatNum(prefix, type, num) { - num = (num || 0); - // 情况一:精确数值 - if (type === 'exact') { - return prefix + num; - } - // 情况二:小于等于 10 - if (num < 10) { - return `${prefix}≤10`; - } - // 情况三:大于 10,除第一位外,其它位都显示为0 - // 例如:100 - 199 显示为 100+ - // 9000 - 9999 显示为 9000+ - const numStr = num.toString(); - const first = numStr[0]; - const other = '0'.repeat(numStr.length - 1); - return `${prefix}${first}${other}+`; + num = (num || 0); + // 情况一:精确数值 + if (type === 'exact') { + return prefix + num; + } + // 情况二:小于等于 10 + if (num < 10) { + return `${prefix}≤10`; + } + // 情况三:大于 10,除第一位外,其它位都显示为0 + // 例如:100 - 199 显示为 100+ + // 9000 - 9999 显示为 9000+ + const numStr = num.toString(); + const first = numStr[0]; + const other = '0'.repeat(numStr.length - 1); + return `${prefix}${first}${other}+`; } // 格式化价格 export function formatPrice(e) { - return e.length === 1 ? e[0] : e.join('~'); + return e.length === 1 ? e[0] : e.join('~'); } // 视频格式后缀列表 @@ -76,12 +80,15 @@ const VIDEO_SUFFIX_LIST = ['.avi', '.mp4'] * @return {{src: string, type: 'video' | 'image' }[]} 转换后的链接列表 */ export function formatGoodsSwiper(urlList) { - return urlList?.filter(url => url).map((url, key) => { - const isVideo = VIDEO_SUFFIX_LIST.some(suffix => url.includes(suffix)); - const type = isVideo ? 'video' : 'image' - const src = $url.cdn(url); - return { type, src } - }) || []; + return urlList?.filter(url => url).map((url, key) => { + const isVideo = VIDEO_SUFFIX_LIST.some(suffix => url.includes(suffix)); + const type = isVideo ? 'video' : 'image' + const src = $url.cdn(url); + return { + type, + src + } + }) || []; } /** @@ -91,18 +98,18 @@ export function formatGoodsSwiper(urlList) { * @return {string} 颜色的 class 名称 */ export function formatOrderColor(order) { - if (order.status === 0) { - return 'info-color'; - } - if (order.status === 10 - || order.status === 20 - || (order.status === 30 && !order.commentStatus)) { - return 'warning-color'; - } - if (order.status === 30 && order.commentStatus) { - return 'success-color'; - } - return 'danger-color'; + if (order.status === 0) { + return 'info-color'; + } + if (order.status === 10 || + order.status === 20 || + (order.status === 30 && !order.commentStatus)) { + return 'warning-color'; + } + if (order.status === 30 && order.commentStatus) { + return 'success-color'; + } + return 'danger-color'; } /** @@ -111,25 +118,25 @@ export function formatOrderColor(order) { * @param order 订单 */ export function formatOrderStatus(order) { - if (order.status === 0) { - return '待付款'; - } - if (order.status === 10 && order.deliveryType === 1) { - return '待发货'; - } - if (order.status === 10 && order.deliveryType === 2) { - return '待核销'; - } - if (order.status === 20) { - return '待收货'; - } - if (order.status === 30 && !order.commentStatus) { - return '待评价'; - } - if (order.status === 30 && order.commentStatus) { - return '已完成'; - } - return '已关闭'; + if (order.status === 0) { + return '待付款'; + } + if (order.status === 10 && order.deliveryType === 1) { + return '待发货'; + } + if (order.status === 10 && order.deliveryType === 2) { + return '待核销'; + } + if (order.status === 20) { + return '待收货'; + } + if (order.status === 30 && !order.commentStatus) { + return '待评价'; + } + if (order.status === 30 && order.commentStatus) { + return '已完成'; + } + return '已关闭'; } /** @@ -138,22 +145,22 @@ export function formatOrderStatus(order) { * @param order 订单 */ export function formatOrderStatusDescription(order) { - if (order.status === 0) { - return `请在 ${ formatDate(order.payExpireTime) } 前完成支付`; - } - if (order.status === 10) { - return '商家未发货,请耐心等待'; - } - if (order.status === 20) { - return '商家已发货,请耐心等待'; - } - if (order.status === 30 && !order.commentStatus) { - return '已收货,快去评价一下吧'; - } - if (order.status === 30 && order.commentStatus) { - return '交易完成,感谢您的支持'; - } - return '交易关闭'; + if (order.status === 0) { + return `请在 ${ formatDate(order.payExpireTime) } 前完成支付`; + } + if (order.status === 10) { + return '商家未发货,请耐心等待'; + } + if (order.status === 20) { + return '商家已发货,请耐心等待'; + } + if (order.status === 30 && !order.commentStatus) { + return '已收货,快去评价一下吧'; + } + if (order.status === 30 && order.commentStatus) { + return '交易完成,感谢您的支持'; + } + return '交易关闭'; } /** @@ -162,26 +169,26 @@ export function formatOrderStatusDescription(order) { * @param order 订单 */ export function handleOrderButtons(order) { - order.buttons = [] - if (order.type === 3) { // 查看拼团 - order.buttons.push('combination'); - } - if (order.status === 20) { // 确认收货 - order.buttons.push('confirm'); - } - if (order.logisticsId > 0) { // 查看物流 - order.buttons.push('express'); - } - if (order.status === 0) { // 取消订单 / 发起支付 - order.buttons.push('cancel'); - order.buttons.push('pay'); - } - if (order.status === 30 && !order.commentStatus) { // 发起评价 - order.buttons.push('comment'); - } - if (order.status === 40) { // 删除订单 - order.buttons.push('delete'); - } + order.buttons = [] + if (order.type === 3) { // 查看拼团 + order.buttons.push('combination'); + } + if (order.status === 20) { // 确认收货 + order.buttons.push('confirm'); + } + if (order.logisticsId > 0) { // 查看物流 + order.buttons.push('express'); + } + if (order.status === 0) { // 取消订单 / 发起支付 + order.buttons.push('cancel'); + order.buttons.push('pay'); + } + if (order.status === 30 && !order.commentStatus) { // 发起评价 + order.buttons.push('comment'); + } + if (order.status === 40) { // 删除订单 + order.buttons.push('delete'); + } } /** @@ -190,31 +197,31 @@ export function handleOrderButtons(order) { * @param afterSale 售后 */ export function formatAfterSaleStatus(afterSale) { - if (afterSale.status === 10) { - return '申请售后'; - } - if (afterSale.status === 20) { - return '商品待退货'; - } - if (afterSale.status === 30) { - return '商家待收货'; - } - if (afterSale.status === 40) { - return '等待退款'; - } - if (afterSale.status === 50) { - return '退款成功'; - } - if (afterSale.status === 61) { - return '买家取消'; - } - if (afterSale.status === 62) { - return '商家拒绝'; - } - if (afterSale.status === 63) { - return '商家拒收货'; - } - return '未知状态'; + if (afterSale.status === 10) { + return '申请售后'; + } + if (afterSale.status === 20) { + return '商品待退货'; + } + if (afterSale.status === 30) { + return '商家待收货'; + } + if (afterSale.status === 40) { + return '等待退款'; + } + if (afterSale.status === 50) { + return '退款成功'; + } + if (afterSale.status === 61) { + return '买家取消'; + } + if (afterSale.status === 62) { + return '商家拒绝'; + } + if (afterSale.status === 63) { + return '商家拒收货'; + } + return '未知状态'; } /** @@ -223,31 +230,31 @@ export function formatAfterSaleStatus(afterSale) { * @param afterSale 售后 */ export function formatAfterSaleStatusDescription(afterSale) { - if (afterSale.status === 10) { - return '退款申请待商家处理'; - } - if (afterSale.status === 20) { - return '请退货并填写物流信息'; - } - if (afterSale.status === 30) { - return '退货退款申请待商家处理'; - } - if (afterSale.status === 40) { - return '等待退款'; - } - if (afterSale.status === 50) { - return '退款成功'; - } - if (afterSale.status === 61) { - return '退款关闭'; - } - if (afterSale.status === 62) { - return `商家不同意退款申请,拒绝原因:${afterSale.auditReason}`; - } - if (afterSale.status === 63) { - return `商家拒绝收货,不同意退款,拒绝原因:${afterSale.auditReason}`; - } - return '未知状态'; + if (afterSale.status === 10) { + return '退款申请待商家处理'; + } + if (afterSale.status === 20) { + return '请退货并填写物流信息'; + } + if (afterSale.status === 30) { + return '退货退款申请待商家处理'; + } + if (afterSale.status === 40) { + return '等待退款'; + } + if (afterSale.status === 50) { + return '退款成功'; + } + if (afterSale.status === 61) { + return '退款关闭'; + } + if (afterSale.status === 62) { + return `商家不同意退款申请,拒绝原因:${afterSale.auditReason}`; + } + if (afterSale.status === 63) { + return `商家拒绝收货,不同意退款,拒绝原因:${afterSale.auditReason}`; + } + return '未知状态'; } /** @@ -256,13 +263,13 @@ export function formatAfterSaleStatusDescription(afterSale) { * @param afterSale 售后 */ export function handleAfterSaleButtons(afterSale) { - afterSale.buttons = []; - if ([10, 20, 30].includes(afterSale.status)) { // 取消订单 - afterSale.buttons.push('cancel'); - } - if (afterSale.status === 20) { // 退货信息 - afterSale.buttons.push('delivery'); - } + afterSale.buttons = []; + if ([10, 20, 30].includes(afterSale.status)) { // 取消订单 + afterSale.buttons.push('cancel'); + } + if (afterSale.status === 20) { // 退货信息 + afterSale.buttons.push('delivery'); + } } /** @@ -272,28 +279,28 @@ export function handleAfterSaleButtons(afterSale) { * @return {{s: string, ms: number, h: string, m: string}} 持续时间 */ export function useDurationTime(toTime, fromTime = '') { - toTime = getDayjsTime(toTime); - if (fromTime === '') { - fromTime = dayjs(); - } - let duration = ref(toTime - fromTime); - if (duration.value > 0) { - setTimeout(() => { - if (duration.value > 0) { - duration.value -= 1000; - } - }, 1000); - } + toTime = getDayjsTime(toTime); + if (fromTime === '') { + fromTime = dayjs(); + } + let duration = ref(toTime - fromTime); + if (duration.value > 0) { + setTimeout(() => { + if (duration.value > 0) { + duration.value -= 1000; + } + }, 1000); + } - let durationTime = dayjs.duration(duration.value); - return { - h: (durationTime.months() * 30 * 24 + durationTime.days() * 24 + durationTime.hours()) - .toString() - .padStart(2, '0'), - m: durationTime.minutes().toString().padStart(2, '0'), - s: durationTime.seconds().toString().padStart(2, '0'), - ms: durationTime.$ms, - }; + let durationTime = dayjs.duration(duration.value); + return { + h: (durationTime.months() * 30 * 24 + durationTime.days() * 24 + durationTime.hours()) + .toString() + .padStart(2, '0'), + m: durationTime.minutes().toString().padStart(2, '0'), + s: durationTime.seconds().toString().padStart(2, '0'), + ms: durationTime.$ms, + }; } /** @@ -302,19 +309,19 @@ export function useDurationTime(toTime, fromTime = '') { * @return {dayjs.Dayjs} */ function getDayjsTime(time) { - time = time.toString(); - if (time.indexOf('-') > 0) { - // 'date' - return dayjs(time); - } - if (time.length > 10) { - // 'timestamp' - return dayjs(parseInt(time)); - } - if (time.length === 10) { - // 'unixTime' - return dayjs.unix(parseInt(time)); - } + time = time.toString(); + if (time.indexOf('-') > 0) { + // 'date' + return dayjs(time); + } + if (time.length > 10) { + // 'timestamp' + return dayjs(parseInt(time)); + } + if (time.length === 10) { + // 'unixTime' + return dayjs.unix(parseInt(time)); + } } /** @@ -324,7 +331,7 @@ function getDayjsTime(time) { * @returns {string} 元,例如说 1.00 元 */ export function fen2yuan(price) { - return (price / 100.0).toFixed(2) + return (price / 100.0).toFixed(2) } /** @@ -342,33 +349,33 @@ export function fen2yuan(price) { * @param skus 商品 SKU 数组 */ export function convertProductPropertyList(skus) { - let result = []; - for (const sku of skus) { - if (!sku.properties) { - continue - } - for (const property of sku.properties) { - // ① 先处理属性 - let resultProperty = result.find(item => item.id === property.propertyId) - if (!resultProperty) { - resultProperty = { - id: property.propertyId, - name: property.propertyName, - values: [] - } - result.push(resultProperty) - } - // ② 再处理属性值 - let resultValue = resultProperty.values.find(item => item.id === property.valueId) - if (!resultValue) { - resultProperty.values.push({ - id: property.valueId, - name: property.valueName - }) - } - } - } - return result; + let result = []; + for (const sku of skus) { + if (!sku.properties) { + continue + } + for (const property of sku.properties) { + // ① 先处理属性 + let resultProperty = result.find(item => item.id === property.propertyId) + if (!resultProperty) { + resultProperty = { + id: property.propertyId, + name: property.propertyName, + values: [] + } + result.push(resultProperty) + } + // ② 再处理属性值 + let resultValue = resultProperty.values.find(item => item.id === property.valueId) + if (!resultValue) { + resultProperty.values.push({ + id: property.valueId, + name: property.valueName + }) + } + } + } + return result; } /** @@ -379,53 +386,100 @@ export function convertProductPropertyList(skus) { * @returns {string} 规格字符串 */ export function formatRewardActivityRule(activity, rule) { - if (activity.conditionType === 10) { - return `满 ${fen2yuan(rule.limit)} 元减 ${fen2yuan(rule.discountPrice)} 元`; - } - if (activity.conditionType === 20) { - return `满 ${rule.limit} 件减 ${fen2yuan(rule.discountPrice)} 元`; - } - return ''; + if (activity.conditionType === 10) { + return `满 ${fen2yuan(rule.limit)} 元减 ${fen2yuan(rule.discountPrice)} 元`; + } + if (activity.conditionType === 20) { + return `满 ${rule.limit} 件减 ${fen2yuan(rule.discountPrice)} 元`; + } + return ''; } // 新增将时间搓转换为开始时间-结束时间的格式 export function formatDateRange(startTimestamp, endTimestamp) { - // 定义一个辅助函数来格式化时间戳为 YYYY.MM.DD 格式 - const formatDate = (timestamp) => { - const date = new Date(timestamp); - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1 - const day = String(date.getDate()).padStart(2, '0'); - return `${year}.${month}.${day}`; - }; + // 定义一个辅助函数来格式化时间戳为 YYYY.MM.DD 格式 + const formatDate = (timestamp) => { + const date = new Date(timestamp); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1 + const day = String(date.getDate()).padStart(2, '0'); + return `${year}.${month}.${day}`; + }; - // 格式化开始和结束时间 - const start = formatDate(startTimestamp); - const end = formatDate(endTimestamp); + // 格式化开始和结束时间 + const start = formatDate(startTimestamp); + const end = formatDate(endTimestamp); - // 返回格式化的日期范围 - return `${start}-${end}`; + // 返回格式化的日期范围 + return `${start}-${end}`; } //处理活动信息 export function handList(orders) { - const typeMap = { - '1':'秒杀活动', - '2':'砍价活动', - '3':'拼团活动', - '4':'限时折扣', - '5':'满减送', - '6':'会员折扣', - '7':'优惠券', - '8':'积分' - }; - - // 给每个订单对象添加 typeName 属性 - // console.log('函数',orders) - let updatedOrders = orders.map(order => { - return { - ...order, // 展开现有的订单对象属性 - typeName: typeMap[order.type] // 添加 typeName 属性 - }; - }); - return updatedOrders + const typeMap = { + '1': '秒杀活动', + '2': '砍价活动', + '3': '拼团活动', + '4': '限时折扣', + '5': '满减送', + '6': '会员折扣', + '7': '优惠券', + '8': '积分' }; + + // 给每个订单对象添加 typeName 属性 + // console.log('函数',orders) + let updatedOrders = orders.map(order => { + return { + ...order, // 展开现有的订单对象属性 + typeName: typeMap[order.type] // 添加 typeName 属性 + }; + }); + return updatedOrders +}; +//根据skuid来修改价格并添加时间 +export function handListPrice(array,array2) { + // 将 array2 转换为一个以 skuId 为键的对象,以便于快速查找 + const array2Map = array2.reduce((acc, item) => { + acc[item.skuId] = { price: item.price, type: item.type,endTime:item.endTime }; + return acc; + }, {}); + + // 遍历 array 数组并更新 price 和 type + array.forEach(item => { + if (array2Map[item.id]) { + // 如果在 array2Map 中找到了对应的 skuId(即 id) + item.price = array2Map[item.id].price; + item.type = array2Map[item.id].type; + item.endTime = array2Map[item.id].endTime; + } + }); + + // 返回更新后的 array + return array; +}; + +//处理活动数据 +export function handActitList(rules) { + const rules2 = { + reduc: rules.map(item => ({ + discountPrice: item.discountPrice, + limit: item.limit, + bull: true // 默认为 true + })), + cou: rules.map(item => ({ + discountPrice: item.discountPrice, + value: item.couponCounts.reduce((acc, count) => acc + count, 0), // 计算 couponCounts 中各项之和 + bull: item.givePoint // 对应 givePoint + })), + ship: rules.map(item => ({ + discountPrice: item.discountPrice, + bull: item.freeDelivery // 对应 freeDelivery + })), + scor: rules.map(item => ({ + discountPrice: item.discountPrice, + value: item.point, // 直接使用 point + bull: item.givePoint // 对应 givePoint + })) + }; + return rules2 +}; \ No newline at end of file