📖 code review:秒杀列表

pull/34/head
YunaiV 2023-12-27 19:22:55 +08:00
parent 74b450ec3c
commit ccb5796468
3 changed files with 25 additions and 27 deletions

View File

@ -1,3 +1,4 @@
<!-- 秒杀活动列表 -->
<template>
<s-layout navbar="inner" :bgStyle="{ color: 'rgb(245,28,19)' }">
<!--顶部背景图-->
@ -20,7 +21,8 @@
<view class="flex align-center justify-between ss-p-25">
<!-- 左侧图标 -->
<view class="time-icon">
<image class="ss-w-100 ss-h-100" src="http://mall.yudao.iocoder.cn/static/images/priceTag.png"></image>
<!-- TODO 芋艿图片统一维护 -->
<image class="ss-w-100 ss-h-100" src="http://mall.yudao.iocoder.cn/static/images/priceTag.png" />
</view>
<scroll-view class="time-list" :scroll-into-view="activeTimeElId" scroll-x scroll-with-animation>
<view v-for="(config, index) in timeConfigList" :key="index"
@ -34,6 +36,7 @@
</view>
</scroll-view>
</view>
<!-- 内容区 -->
<view class="list-content">
<!-- 活动倒计时 -->
@ -52,6 +55,7 @@
<view v-else> {{ activeTimeConfig?.status }} </view>
</view>
</view>
<!-- 活动列表 -->
<scroll-view
class="scroll-box"
@ -118,13 +122,9 @@
//
const goodsFields = {
//
name: { show: true },
//
introduction: { show: true },
//
price: { show: true },
//
marketPrice: { show: true },
};
@ -156,18 +156,15 @@
scrollToTimeConfig(activeTimeIndex.value)
}
// ID
const activeTimeElId = ref('')
//
const activeTimeElId = ref('') // ID
const scrollToTimeConfig = (index) => {
nextTick(() => activeTimeElId.value = `timeItem${index}`)
}
//
const activeTimeIndex = ref(0)
//
const activeTimeConfig = computed(() => timeConfigList.value[activeTimeIndex.value])
//
const activeTimeIndex = ref(0) //
const activeTimeConfig = computed(() => timeConfigList.value[activeTimeIndex.value]) //
const handleChangeTimeConfig = (index) => {
activeTimeIndex.value = index
@ -189,22 +186,15 @@
//#region
//
const activityPageParams = reactive({
// ID
id: 0,
//
pageNo: 1,
//
pageSize: 5,
})
//
const activityTotal = ref(0)
//
const activityList = ref([])
//
const loadStatus = ref('')
//
const activityPageParams = reactive({
id: 0, // ID
pageNo: 1, //
pageSize: 5, //
})
const activityTotal = ref(0) //
const activityList = ref([]) //
const loadStatus = ref('') //
async function getActivityList() {
loadStatus.value = 'loading';
const { data } = await SeckillApi.getSeckillActivityPage(activityPageParams)
@ -227,6 +217,7 @@
}
//
onReachBottom(() => loadMore());
//#endregion
//

View File

@ -1,3 +1,4 @@
<!-- 秒杀商品详情 -->
<template>
<s-layout :onShareAppMessage="shareInfo" navbar="goods">
<!-- 标题栏 -->
@ -110,9 +111,11 @@
:class="
state.goodsInfo.stock === 0 || activity.status != 'ing' ? '' : ''
"
>秒杀价</view
>
秒杀价
</view>
</button>
<!-- TODO @疯狂status 判断不太对 -->
<button
class="ss-reset-button btn-box ss-flex-col"
@tap="state.showSelectSku = true"

View File

@ -1,3 +1,4 @@
<!-- 秒杀商品的 SKU 选择 s-select-sku.vue 类似 -->
<template>
<!-- 规格弹窗 -->
<su-popup :show="show" round="10" @close="emits('close')">
@ -157,6 +158,7 @@
state.selectedSku.count = buyCount;
}
}
//
const changeDisabled = (isChecked = false, propertyId = 0, valueId = 0) => {
let newSkus = []; // sku
@ -230,6 +232,7 @@
}
}
};
// SKU
const getCanUseSkuList = () => {
let newSkus = [];
@ -250,6 +253,7 @@
}
return newSkus;
};
//
const onSelectSku = (propertyId, valueId) => {
//