差满减活动时间外
parent
d1eea3280c
commit
26a18e7e9a
|
|
@ -1,207 +1,315 @@
|
|||
<!-- 指定满减送的活动列表 -->
|
||||
<template>
|
||||
<s-layout class="activity-wrap" :title="state.activityInfo.title">
|
||||
<!-- 活动信息 -->
|
||||
<su-sticky bgColor="#fff">
|
||||
<view class="ss-flex ss-col-top tip-box">
|
||||
<view class="type-text ss-flex ss-row-center">满减:</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="tip-content" v-for="item in state.activityInfo.rules" :key="item">
|
||||
{{ formatRewardActivityRule(state.activityInfo, item) }}
|
||||
</view>
|
||||
</view>
|
||||
<image class="activity-left-image" src="/static/activity-left.png" />
|
||||
<image class="activity-right-image" src="/static/activity-right.png" />
|
||||
</view>
|
||||
</su-sticky>
|
||||
<s-layout class="activity-wrap" :title="state.activityInfo.title">
|
||||
<!-- 活动信息 -->
|
||||
<su-sticky bgColor="#fff">
|
||||
<view class="ss-flex ss-col-top tip-box">
|
||||
<view class="type-text ss-flex ss-row-center">满减:</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="tip-content" v-for="item in state.activityInfo.rules" :key="item">
|
||||
{{ formatRewardActivityRule(state.activityInfo, item) }}
|
||||
</view>
|
||||
</view>
|
||||
<image class="activity-left-image" src="/static/activity-left.png" />
|
||||
<image class="activity-right-image" src="/static/activity-right.png" />
|
||||
</view>
|
||||
</su-sticky>
|
||||
|
||||
<!-- 商品信息 -->
|
||||
<view class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top">
|
||||
<view class="goods-list-box">
|
||||
<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
|
||||
<s-goods-column
|
||||
class="goods-md-box"
|
||||
size="md"
|
||||
:data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'left')"
|
||||
>
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn"> </button>
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-list-box">
|
||||
<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
|
||||
<s-goods-column
|
||||
class="goods-md-box"
|
||||
size="md"
|
||||
:data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'right')"
|
||||
>
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn" />
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品信息 -->
|
||||
<view class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top">
|
||||
<view class="goods-list-box">
|
||||
<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
|
||||
<s-goods-column class="goods-md-box" size="md" :data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'left')">
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn"> </button>
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-list-box">
|
||||
<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
|
||||
<s-goods-column class="goods-md-box" size="md" :data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'right')">
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn" />
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</s-layout>
|
||||
}" @tap="loadMore" />
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import _ from 'lodash-es';
|
||||
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
|
||||
import { formatRewardActivityRule } from '@/sheep/hooks/useGoods';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import {
|
||||
reactive,
|
||||
toRaw,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onReachBottom
|
||||
} from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import _ from 'lodash-es';
|
||||
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
|
||||
import {
|
||||
formatRewardActivityRule
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
|
||||
const state = reactive({
|
||||
activityId: 0, // 获得编号
|
||||
activityInfo: {}, // 获得信息
|
||||
const state = reactive({
|
||||
activityId: 0, // 获得编号
|
||||
activityInfo: {}, // 获得信息
|
||||
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 1,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
loadStatus: '',
|
||||
leftGoodsList: [],
|
||||
rightGoodsList: [],
|
||||
});
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 1,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
loadStatus: '',
|
||||
leftGoodsList: [],
|
||||
rightGoodsList: [],
|
||||
});
|
||||
|
||||
// 加载瀑布流
|
||||
let count = 0;
|
||||
let leftHeight = 0;
|
||||
let rightHeight = 0;
|
||||
// 加载瀑布流
|
||||
let count = 0;
|
||||
let leftHeight = 0;
|
||||
let rightHeight = 0;
|
||||
|
||||
function mountMasonry(height = 0, where = 'left') {
|
||||
if (!state.pagination.list[count]) return;
|
||||
function mountMasonry(height = 0, where = 'left') {
|
||||
if (!state.pagination.list[count]) return;
|
||||
|
||||
if (where === 'left') {
|
||||
leftHeight += height;
|
||||
} else {
|
||||
rightHeight += height;
|
||||
}
|
||||
if (leftHeight <= rightHeight) {
|
||||
state.leftGoodsList.push(state.pagination.list[count]);
|
||||
} else {
|
||||
state.rightGoodsList.push(state.pagination.list[count]);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
if (where === 'left') {
|
||||
leftHeight += height;
|
||||
} else {
|
||||
rightHeight += height;
|
||||
}
|
||||
if (leftHeight <= rightHeight) {
|
||||
state.leftGoodsList.push(state.pagination.list[count]);
|
||||
} else {
|
||||
state.rightGoodsList.push(state.pagination.list[count]);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
// 加载商品信息
|
||||
async function getList() {
|
||||
// 处理拓展参数
|
||||
const params = {};
|
||||
if (state.activityInfo.productScope === 2) {
|
||||
params.ids = state.activityInfo.productSpuIds.join(',');
|
||||
} else if (state.activityInfo.productScope === 3) {
|
||||
params.categoryIds = state.activityInfo.productSpuIds.join(',');
|
||||
}
|
||||
// 请求数据
|
||||
state.loadStatus = 'loading';
|
||||
const { code, data } = await SpuApi.getSpuPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
...params,
|
||||
});
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
console.log('nibuhao ')
|
||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
||||
state.pagination.total = data.total;
|
||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||
mountMasonry();
|
||||
}
|
||||
// 加载商品信息
|
||||
async function getList() {
|
||||
// state.loadStatus = 'loading';
|
||||
// 处理拓展参数
|
||||
const params = {}
|
||||
if (state.activityInfo.productScope === 2) {
|
||||
// const params = toRaw(state.activityInfo.productScopeValues)
|
||||
// 请求数据
|
||||
const {
|
||||
code,
|
||||
data
|
||||
} = await SpuApi.getSpuListByIds(state.activityInfo.productScopeValues.join(','));
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 使用 map 提取每个对象的 id 属性
|
||||
const ids = data.map(item => item.id);
|
||||
// 使用 join 方法将 id 数组连接成一个用逗号分隔的字符串
|
||||
const idsString = ids.join(',');
|
||||
// 获取结算信息
|
||||
settleData.value = await getSettlementByIds(idsString)
|
||||
// 处理获得的数据
|
||||
const ms = enrichDataWithSkus(data, settleData.value)
|
||||
state.pagination.list = ms;
|
||||
// state.pagination.total = data.total;
|
||||
// state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||
} else if (state.activityInfo.productScope === 3) {
|
||||
params.categoryIds = state.activityInfo.productScopeValues.join(',');
|
||||
state.loadStatus = 'loading';
|
||||
const {
|
||||
code,
|
||||
data
|
||||
} = await SpuApi.getSpuPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
...params,
|
||||
});
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 使用 map 提取每个对象的 id 属性
|
||||
const ids = data.list.map(item => item.id);
|
||||
// 使用 join 方法将 id 数组连接成一个用逗号分隔的字符串
|
||||
const idsString = ids.join(',');
|
||||
// 获取结算信息
|
||||
settleData.value = await getSettlementByIds(idsString)
|
||||
// 处理获得的数据
|
||||
const ms = enrichDataWithSkus(data.list, settleData.value)
|
||||
state.pagination.list = _.concat(state.pagination.list, ms);
|
||||
state.pagination.total = data.total;
|
||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||
} else {
|
||||
state.loadStatus = 'loading';
|
||||
const {
|
||||
code,
|
||||
data
|
||||
} = await SpuApi.getSpuPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
});
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 使用 map 提取每个对象的 id 属性
|
||||
const ids = data.list.map(item => item.id);
|
||||
// 使用 join 方法将 id 数组连接成一个用逗号分隔的字符串
|
||||
const idsString = ids.join(',');
|
||||
// 获取结算信息
|
||||
settleData.value = await getSettlementByIds(idsString)
|
||||
// 处理获得的数据
|
||||
const ms = enrichDataWithSkus(data.list, settleData.value)
|
||||
state.pagination.list = _.concat(state.pagination.list, ms);
|
||||
state.pagination.total = data.total;
|
||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||
}
|
||||
mountMasonry();
|
||||
}
|
||||
//获取结算信息
|
||||
const settleData = ref()
|
||||
async function getSettlementByIds(ids) {
|
||||
const {
|
||||
data
|
||||
} = await SpuApi.getSettlementProduct(ids);
|
||||
return data;
|
||||
}
|
||||
//计算展示价格的函数
|
||||
function enrichDataWithSkus(data, array) {
|
||||
// 创建一个映射,以 id 为键,存储 data 数组中的对象
|
||||
const dataMap = new Map(data.map(item => [item.id, {
|
||||
...item
|
||||
}]));
|
||||
|
||||
// 加载活动信息
|
||||
async function getActivity(id) {
|
||||
const { code, data } = await RewardActivityApi.getRewardActivity(id);
|
||||
if (code === 0) {
|
||||
state.activityInfo = data;
|
||||
}
|
||||
}
|
||||
// 遍历 array 数组
|
||||
array.forEach(item => {
|
||||
// 初始化 discountPrice 和 vipPrice 为 null
|
||||
let discountPrice = null;
|
||||
let vipPrice = null;
|
||||
let foundType4 = false;
|
||||
let foundType6 = false;
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getList();
|
||||
}
|
||||
// 遍历 skus 数组,寻找 type 为 4 和 6 的首个条目
|
||||
item.skus.forEach(sku => {
|
||||
if (!foundType4 && sku.type === 4) {
|
||||
discountPrice = sku.price;
|
||||
foundType4 = true;
|
||||
}
|
||||
if (!foundType6 && sku.type === 6) {
|
||||
vipPrice = sku.price;
|
||||
foundType6 = true;
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
// 如果已经找到 type 为 4 和 6 的条目,则不需要继续遍历
|
||||
if (foundType4 && foundType6) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
onLoad(async (options) => {
|
||||
state.activityId = options.activityId;
|
||||
await getActivity(state.activityId);
|
||||
await getList(state.activityId);
|
||||
});
|
||||
// 更新 dataMap 中对应的对象
|
||||
if (dataMap.has(item.id)) {
|
||||
dataMap.get(item.id).discountPrice = discountPrice;
|
||||
dataMap.get(item.id).vipPrice = vipPrice;
|
||||
dataMap.get(item.id).reward = item.reward;
|
||||
}
|
||||
});
|
||||
|
||||
// 返回更新后的数据数组
|
||||
return Array.from(dataMap.values());
|
||||
}
|
||||
// 加载活动信息
|
||||
async function getActivity(id) {
|
||||
const {
|
||||
code,
|
||||
data
|
||||
} = await RewardActivityApi.getRewardActivity(id);
|
||||
if (code === 0) {
|
||||
state.activityInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
|
||||
onLoad(async (options) => {
|
||||
state.activityId = options.activityId;
|
||||
await getActivity(state.activityId);
|
||||
await getList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.goods-list-box {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
.left-list {
|
||||
margin-right: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.right-list {
|
||||
margin-left: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
.tip-box {
|
||||
background: #fff0e7;
|
||||
padding: 20rpx;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
.activity-left-image {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 58rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
.activity-right-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 72rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
.type-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
.tip-content {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.goods-list-box {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.left-list {
|
||||
margin-right: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.right-list {
|
||||
margin-left: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tip-box {
|
||||
background: #fff0e7;
|
||||
padding: 20rpx;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
||||
.activity-left-image {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 58rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
.activity-right-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 72rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.type-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.tip-content {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -149,7 +149,6 @@
|
|||
const now = dayjs();
|
||||
const today = now.format('YYYY-MM-DD')
|
||||
const select = ref([])
|
||||
console.log('数据', data)
|
||||
// 判断时间段的状态
|
||||
data.forEach((config, index) => {
|
||||
const startTime = dayjs(`${today} ${config.startTime}`)
|
||||
|
|
@ -158,20 +157,16 @@
|
|||
if (now.isBefore(startTime)) {
|
||||
config.status = TimeStatusEnum.WAIT_START;
|
||||
// select.value[index] = config.id;
|
||||
console.log('未开始',select.value,activeTimeIndex.value)
|
||||
} else if (now.isAfter(endTime)) {
|
||||
config.status = TimeStatusEnum.END;
|
||||
// select.value[index] = config.id;
|
||||
console.log('已结束',select.value,activeTimeIndex.value)
|
||||
} else {
|
||||
config.status = TimeStatusEnum.STARTED;
|
||||
// select.value[index] = config.id;
|
||||
activeTimeIndex.value = index
|
||||
console.log('进行中',select.value,activeTimeIndex.value)
|
||||
}
|
||||
})
|
||||
timeConfigList.value = data
|
||||
console.log('传递',select.value,activeTimeIndex.value)
|
||||
// 默认选中进行中的活动
|
||||
handleChangeTimeConfig(activeTimeIndex.value, select.value[activeTimeIndex.value]);
|
||||
// 滚动到进行中的时间段
|
||||
|
|
@ -188,7 +183,6 @@
|
|||
const activeTimeIndex = ref(0) // 当前选中的时间段的索引
|
||||
const activeTimeConfig = computed(() => timeConfigList.value[activeTimeIndex.value]) // 当前选中的时间段
|
||||
const handleChangeTimeConfig = (index, id) => {
|
||||
console.log('点击',index + '+' + id)
|
||||
activeTimeIndex.value = index
|
||||
|
||||
// 查询活动列表
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@
|
|||
id: id
|
||||
});
|
||||
bargainInfo.value = data
|
||||
console.log('shuju', bargainInfo.value)
|
||||
}
|
||||
//获得砍价记录分页
|
||||
const recordPageParams = ref({
|
||||
|
|
@ -119,7 +118,6 @@
|
|||
bargainRecord.value = bargainRecord.value.concat(...data.list);
|
||||
bargainRecordTotal.value = data.total;
|
||||
loadStatus.value = bargainRecord.value.length < bargainRecordTotal.value ? 'more' : 'noMore';
|
||||
console.log('jilu',data)
|
||||
}
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@
|
|||
} = await BargainApi.getActivitySuccess();
|
||||
bargainSuccessList.value = data.successList
|
||||
bargainTotal.value = data.successUserCount
|
||||
console.log(bargainSuccessList.value)
|
||||
}
|
||||
// 查询活动列表
|
||||
const activityTotal = ref(0) // 活动总数
|
||||
|
|
@ -94,7 +93,6 @@
|
|||
activityList.value = activityList.value.concat(...data.list);
|
||||
activityTotal.value = data.total;
|
||||
loadStatus.value = activityList.value.length < activityTotal.value ? 'more' : 'noMore';
|
||||
// console.log('shuju',data)
|
||||
}
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
|
|
|
|||
|
|
@ -186,7 +186,6 @@
|
|||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
console.log('传来的规格改变',e)
|
||||
if(e.type == 4){
|
||||
settleData.value = e
|
||||
setShow.value = true
|
||||
|
|
@ -270,7 +269,6 @@
|
|||
} = await CouponApi.getCouponTemplateList(state.goodsId, 2, 10);
|
||||
if (code === 0) {
|
||||
state.couponInfo = data;
|
||||
console.log('优惠券',state)
|
||||
}
|
||||
}
|
||||
//获取结算信息
|
||||
|
|
@ -279,9 +277,7 @@
|
|||
async function getSettlementByIds(ids) {
|
||||
const { data } = await SpuApi.getSettlementProduct(ids);
|
||||
settleData.value = handle(data)
|
||||
console.log('处理后数据',settleData.value)
|
||||
state.goodsInfo.skus = handListPrice(state.goodsInfo.skus,data[0].skus)
|
||||
console.log('要传递的数据',state.goodsInfo)
|
||||
}
|
||||
//判断是否有限时折扣信息
|
||||
function handle(array){
|
||||
|
|
@ -322,7 +318,6 @@
|
|||
// 加载到商品
|
||||
state.skeletonLoading = false;
|
||||
state.goodsInfo = res.data;
|
||||
console.log('sku',res.data)
|
||||
// 加载是否收藏
|
||||
if (isLogin.value) {
|
||||
FavoriteApi.isFavoriteExists(state.goodsId, 'goods').then((res) => {
|
||||
|
|
|
|||
|
|
@ -277,7 +277,6 @@
|
|||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
console.log('数据流',data)
|
||||
// 使用 map 提取每个对象的 id 属性
|
||||
const ids = data.list.map(item => item.id);
|
||||
// 使用 join 方法将 id 数组连接成一个用逗号分隔的字符串
|
||||
|
|
@ -304,7 +303,6 @@
|
|||
const settleData = ref()
|
||||
async function getSettlementByIds(ids) {
|
||||
const { data } = await SpuApi.getSettlementProduct(ids);
|
||||
// console.log('结算信息',data)
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,6 @@
|
|||
} = await SeckillApi.getSeckillActivity(id);
|
||||
activity.value = data;
|
||||
timeStatusEnum.value = getTimeStatusEnum(activity.value.startTime, activity.value.endTime);
|
||||
console.log('处理后',timeStatusEnum.value)
|
||||
state.percent = 100 - data.stock / data.totalStock * 100;
|
||||
// 查询商品
|
||||
await getSpu(data.spuId);
|
||||
|
|
@ -255,7 +254,6 @@
|
|||
});
|
||||
|
||||
state.skeletonLoading = false;
|
||||
console.log('shuju', state)
|
||||
};
|
||||
|
||||
onLoad((options) => {
|
||||
|
|
|
|||
|
|
@ -307,7 +307,6 @@
|
|||
state.orderPayload = JSON.parse(options.data);
|
||||
await getOrderInfo();
|
||||
await getCoupons();
|
||||
console.log('数据', state)
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@
|
|||
activityMap: {},
|
||||
couponInfo: computed(() => props.modelValue.couponInfo)
|
||||
});
|
||||
console.log('shuju', state)
|
||||
watch(
|
||||
() => props.show,
|
||||
() => {
|
||||
|
|
@ -143,7 +142,6 @@
|
|||
return;
|
||||
}
|
||||
state.activityMap[activity.id] = handActitList(res.data.rules);
|
||||
console.log('最终数据', state)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@
|
|||
});
|
||||
return goodsImg;
|
||||
};
|
||||
console.log('shuju', props)
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.model-box {
|
||||
|
|
|
|||
|
|
@ -202,8 +202,6 @@
|
|||
*/
|
||||
function calculateGoodsColumn(height = 0, where = 'left') {
|
||||
// 处理完
|
||||
console.log('用来处理的数据',state.goodsList)
|
||||
console.log(11111)
|
||||
if (!state.goodsList[count]) return;
|
||||
// 增加列的高度
|
||||
if (where === 'left') leftHeight += height;
|
||||
|
|
@ -226,14 +224,12 @@
|
|||
*/
|
||||
async function getGoodsListByIds(ids) {
|
||||
const { data } = await SpuApi.getSpuListByIds(ids);
|
||||
// console.log('商品信息',data)
|
||||
return data;
|
||||
}
|
||||
//获取结算信息
|
||||
const settleData = ref()
|
||||
async function getSettlementByIds(ids) {
|
||||
const { data } = await SpuApi.getSettlementProduct(ids);
|
||||
// console.log('结算信息',data)
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
@ -284,11 +280,9 @@
|
|||
const ms = await getGoodsListByIds(spuIds.join(','));
|
||||
settleData.value = await getSettlementByIds(spuIds.join(','))
|
||||
state.goodsList = await enrichDataWithSkus(ms,settleData.value)
|
||||
// console.log('计算后',state.goodsList)
|
||||
// 只有双列布局时需要
|
||||
if (layoutType === LayoutTypeEnum.TWO_COL){
|
||||
// 分列
|
||||
console.log('用来分流的数据',state.goodsList)
|
||||
calculateGoodsColumn();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -397,7 +397,6 @@
|
|||
const iconShow = handle()
|
||||
|
||||
function handle() {
|
||||
console.log('传来的数据',props.data)
|
||||
if (props.data.discountPrice === null && props.data.vipPrice === null) {
|
||||
// 如果两个值都为 null,则不展示任何内容
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@
|
|||
});
|
||||
|
||||
const propertyList = convertProductPropertyList(props.goodsInfo.skus);
|
||||
console.log('传递来的sku信息', props.goodsInfo.skus)
|
||||
// SKU 列表
|
||||
const skuList = computed(() => {
|
||||
let skuPrices = props.goodsInfo.skus;
|
||||
|
|
@ -108,7 +107,6 @@
|
|||
() => state.selectedSku,
|
||||
(newVal) => {
|
||||
emits('change', newVal);
|
||||
console.log('选中的sku信息', state.selectedSku)
|
||||
}, {
|
||||
immediate: true, // 立即执行
|
||||
deep: true, // 深度监听
|
||||
|
|
@ -124,7 +122,6 @@
|
|||
|
||||
// 加入购物车
|
||||
function onAddCart() {
|
||||
console.log('购物车',state.selectedSku)
|
||||
if (state.selectedSku.id <= 0) {
|
||||
sheep.$helper.toast('请选择规格');
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue