Commit 2a8a8e12 authored by 彭佳妮(贵阳日报)'s avatar 彭佳妮(贵阳日报)
parents f2682c79 379cb7d4
......@@ -45,11 +45,15 @@ onMounted(async () => {
getStartDateList();
});
const selectItem = (index, item) => {
console.log(item, 323);
const datePart = timestampToDateBasic(value.value);
if (index === selectedItem.value) {
selectedItem.value = null;
delete item.key;
emit('dataParams', item, datePart);
} else {
selectedItem.value = index;
emit('dataParams', item, datePart);
console.log(datePart, 'datePart');
}
};
const getStartDateList = () => {
getStartDate(params).then((res) => {
......
......@@ -11,7 +11,7 @@
{{ item.startDate }}
</li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm">
<li @tap="selectItem(index, item)">选择日期</li>
<li>选择日期</li>
</wd-calendar>
</ul>
</view>
......@@ -37,15 +37,23 @@ const props = defineProps({
},
});
const reset = () => {
selectedItem.value = null;
};
defineExpose({ reset });
onMounted(async () => {
getStartDateList();
});
const selectItem = (index, item) => {
console.log(item, 323);
const datePart = timestampToDateBasic(value.value);
if (index === selectedItem.value) {
selectedItem.value = null;
delete item.key;
emit('dataParams', item, datePart);
} else {
selectedItem.value = index;
emit('dataParams', item, datePart);
console.log(datePart, 'datePart');
}
};
const getStartDateList = () => {
getStartDate(params).then((res) => {
......@@ -54,8 +62,7 @@ const getStartDateList = () => {
};
function handleConfirm({ value }) {
const datePart = timestampToDateBasic(value);
console.log(datePart, 'datePart---111');
selectItem(undefined, undefined);
emit('dataParams', null, datePart);
}
function timestampToDateBasic(timestamp) {
const date = new Date(timestamp);
......@@ -64,10 +71,6 @@ function timestampToDateBasic(timestamp) {
const day = date.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`;
}
const reset = () => {
selectedItem.value = null;
};
defineExpose({ reset });
</script>
<style lang="scss" scoped>
......
......@@ -90,6 +90,9 @@ defineExpose({ reset });
padding-left: 20rpx;
display: flex;
flex-flow: wrap;
overflow: hidden;
height: 160rpx;
overflow-y: auto;
li {
width: 154rpx;
border-radius: 8rpx;
......
......@@ -328,15 +328,28 @@ const sortParams = (sortMode) => {
getProd();
};
// 出发日期
// const dataParams = (item, datePart) => {
// if (item !== undefined) {
// dateType.value = item.key;
// getProd();
// } else if (item === undefined) {
// dateType.value = 8;
// allocateDate.value = datePart;
// getProd();
// }
// };
const dataParams = (item, datePart) => {
if (item !== undefined) {
if (item) {
dateType.value = item.key;
getProd();
} else if (item === undefined) {
} else {
dateType.value = 8;
if (datePart && datePart !== 'NaN/NaN/NaN') {
allocateDate.value = datePart;
rotate2.value = false;
getProd();
}
}
};
// 景点
const placeParams = (item) => {
......
......@@ -22,6 +22,48 @@
height="512rpx"
></wd-swiper>
</view>
<view class="countDown">
<img
src="/static/assistingAgriculture/detail/img5.png"
style="width: 750rpx; height: 122rpx; position: absolute"
/>
<img
src="/static/assistingAgriculture/detail/img1.png"
style="width: 368rpx; height: 122rpx; position: absolute; z-index: 99; margin-left: 380rpx"
/>
<view class="count-info">
<view class="flex-center">
<view style="color: #fa5151">{{ dataDetails.prod.price }}</view>
<text style="margin-left: -30rpx">/只</text>
<view style="z-index: 9999; color: #ffffff; margin-left: 320rpx; font-size: 28rpx">
距离结束仅剩
</view>
</view>
<view class="flex-center">
<view style="font-size: 28rpx">
已销售{{ dataDetails.prod.soldNum || 0 }}件 | 仅剩{{
dataDetails.skus[0].stocks || 0
}}
</view>
<wd-count-down
:time="timeLeft"
style="position: absolute; z-index: 999; left: 440rpx; margin-top: 10rpx"
>
<template #default="{ current }">
<span class="custom-count-down">{{ current.days }}</span>
<span class="custom-count-down-colon">:</span>
<span class="custom-count-down">{{ current.hours }}</span>
<span class="custom-count-down-colon">:</span>
<span class="custom-count-down">{{ current.minutes }}</span>
<span class="custom-count-down-colon">:</span>
<span class="custom-count-down">{{ current.seconds }}</span>
</template>
</wd-count-down>
</view>
</view>
</view>
<!--详情-->
<view class="detail">
<view class="detail-title">{{ dataDetails.prod.prodName }}</view>
......@@ -129,6 +171,8 @@ const storeList = ref([
{ img: '/static/assistingAgriculture/detail/img8.png', text: '客服' },
{ img: '/static/assistingAgriculture/detail/img6.png', text: '购物车' },
]);
const format = ref('DD:HH:mm');
const time = ref('');
let prodId;
const dataDetails = ref({});
const commentData = ref({});
......@@ -145,12 +189,29 @@ function handleClick(e) {
}
function jumpPjPgae() {
xma.navigateTo({
url: `/pages/assistingAgriculture/detail/comment?shopId=${dataDetails.value.prod.shopId}`,
url: `/pages/assistingAgriculture/detail/comment?shopId=${dataDetails.value.prod.shopId}&prodId=${dataDetails.value.prodPresale.prodId}`,
});
}
function onChange(e) {
console.log(e);
}
const currentTime = ref(Date.now()); // 当前时间
// 每隔一秒更新当前时间
setInterval(() => {
currentTime.value = Date.now();
}, 1000);
// 计算属性:剩余时间
const timeLeft = computed(() => {
if (dataDetails.value.prodPresale && dataDetails.value.prodPresale.presaleEndTime) {
const endTime = new Date(dataDetails.value.prodPresale.presaleEndTime).getTime();
const timeDiff = endTime - currentTime.value;
return timeDiff > 0 ? timeDiff : 0;
}
return 0;
});
// 获取商品详情
const getProdDetailFn = () => {
getProdDetail(prodId).then((res) => {
......@@ -191,6 +252,7 @@ const addOrderFn = () => {
duration: 1500,
icon: 'none',
});
getshoppingCartListFn();
});
};
// 获取购物车列表
......@@ -286,7 +348,6 @@ page {
border-radius: 16rpx;
background: #ffffff;
position: relative;
top: 10px;
}
.detail-title {
width: 277 * 2rpx;
......@@ -301,6 +362,7 @@ page {
color: #3d3d3d;
padding-top: 20rpx;
padding-left: 20rpx;
padding-bottom: 40rpx;
}
.detail-int {
width: 336 * 2rpx;
......@@ -313,8 +375,8 @@ page {
font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on;
color: #abaaaa;
padding-top: 10rpx;
padding-left: 20rpx;
padding-bottom: 20rpx;
}
.share-img {
float: right;
......@@ -342,7 +404,7 @@ page {
height: 88rpx;
border-radius: 16rpx;
background: #ffffff;
margin-top: 30rpx;
margin-top: 10rpx;
}
.evaluate {
display: flex;
......@@ -395,7 +457,9 @@ page {
padding-bottom: 120rpx;
.content {
margin-top: 30rpx;
padding: 20rpx;
.desc {
padding-bottom: 20rpx;
img {
width: 100%;
}
......@@ -458,4 +522,36 @@ page {
margin-top: -90rpx;
margin-left: 400rpx;
}
.countDown {
height: 122rpx;
}
.count-info {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
padding: 20rpx 30rpx;
}
.flex-center {
display: flex;
justify-content: space-between;
width: 100%;
padding: 0 20px;
}
.custom-count-down {
display: inline-block;
width: 56rpx;
color: #fa5151;
font-size: 24rpx;
text-align: center;
background-color: #ffffff;
border-radius: 4rpx;
}
.custom-count-down-colon {
display: inline-block;
margin: 0 8rpx;
color: #ffffff;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment