Commit a27180e3 authored by 刘玉宏's avatar 刘玉宏
parents e8eb48d0 2a8a8e12
...@@ -45,11 +45,15 @@ onMounted(async () => { ...@@ -45,11 +45,15 @@ onMounted(async () => {
getStartDateList(); getStartDateList();
}); });
const selectItem = (index, item) => { const selectItem = (index, item) => {
console.log(item, 323);
const datePart = timestampToDateBasic(value.value); const datePart = timestampToDateBasic(value.value);
selectedItem.value = index; if (index === selectedItem.value) {
emit('dataParams', item, datePart); selectedItem.value = null;
console.log(datePart, 'datePart'); delete item.key;
emit('dataParams', item, datePart);
} else {
selectedItem.value = index;
emit('dataParams', item, datePart);
}
}; };
const getStartDateList = () => { const getStartDateList = () => {
getStartDate(params).then((res) => { getStartDate(params).then((res) => {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
{{ item.startDate }} {{ item.startDate }}
</li> </li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm"> <wd-calendar use-default-slot v-model="value" @confirm="handleConfirm">
<li @tap="selectItem(index, item)">选择日期</li> <li>选择日期</li>
</wd-calendar> </wd-calendar>
</ul> </ul>
</view> </view>
...@@ -37,15 +37,23 @@ const props = defineProps({ ...@@ -37,15 +37,23 @@ const props = defineProps({
}, },
}); });
const reset = () => {
selectedItem.value = null;
};
defineExpose({ reset });
onMounted(async () => { onMounted(async () => {
getStartDateList(); getStartDateList();
}); });
const selectItem = (index, item) => { const selectItem = (index, item) => {
console.log(item, 323);
const datePart = timestampToDateBasic(value.value); const datePart = timestampToDateBasic(value.value);
selectedItem.value = index; if (index === selectedItem.value) {
emit('dataParams', item, datePart); selectedItem.value = null;
console.log(datePart, 'datePart'); delete item.key;
emit('dataParams', item, datePart);
} else {
selectedItem.value = index;
emit('dataParams', item, datePart);
}
}; };
const getStartDateList = () => { const getStartDateList = () => {
getStartDate(params).then((res) => { getStartDate(params).then((res) => {
...@@ -54,8 +62,7 @@ const getStartDateList = () => { ...@@ -54,8 +62,7 @@ const getStartDateList = () => {
}; };
function handleConfirm({ value }) { function handleConfirm({ value }) {
const datePart = timestampToDateBasic(value); const datePart = timestampToDateBasic(value);
console.log(datePart, 'datePart---111'); emit('dataParams', null, datePart);
selectItem(undefined, undefined);
} }
function timestampToDateBasic(timestamp) { function timestampToDateBasic(timestamp) {
const date = new Date(timestamp); const date = new Date(timestamp);
...@@ -64,10 +71,6 @@ function timestampToDateBasic(timestamp) { ...@@ -64,10 +71,6 @@ function timestampToDateBasic(timestamp) {
const day = date.getDate().toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`; return `${year}/${month}/${day}`;
} }
const reset = () => {
selectedItem.value = null;
};
defineExpose({ reset });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -90,6 +90,9 @@ defineExpose({ reset }); ...@@ -90,6 +90,9 @@ defineExpose({ reset });
padding-left: 20rpx; padding-left: 20rpx;
display: flex; display: flex;
flex-flow: wrap; flex-flow: wrap;
overflow: hidden;
height: 160rpx;
overflow-y: auto;
li { li {
width: 154rpx; width: 154rpx;
border-radius: 8rpx; border-radius: 8rpx;
......
...@@ -328,14 +328,27 @@ const sortParams = (sortMode) => { ...@@ -328,14 +328,27 @@ const sortParams = (sortMode) => {
getProd(); 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) => { const dataParams = (item, datePart) => {
if (item !== undefined) { if (item) {
dateType.value = item.key; dateType.value = item.key;
getProd(); getProd();
} else if (item === undefined) { } else {
dateType.value = 8; dateType.value = 8;
allocateDate.value = datePart; if (datePart && datePart !== 'NaN/NaN/NaN') {
getProd(); allocateDate.value = datePart;
rotate2.value = false;
getProd();
}
} }
}; };
// 景点 // 景点
......
...@@ -22,6 +22,48 @@ ...@@ -22,6 +22,48 @@
height="512rpx" height="512rpx"
></wd-swiper> ></wd-swiper>
</view> </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">
<view class="detail-title">{{ dataDetails.prod.prodName }}</view> <view class="detail-title">{{ dataDetails.prod.prodName }}</view>
...@@ -129,6 +171,8 @@ const storeList = ref([ ...@@ -129,6 +171,8 @@ const storeList = ref([
{ img: '/static/assistingAgriculture/detail/img8.png', text: '客服' }, { img: '/static/assistingAgriculture/detail/img8.png', text: '客服' },
{ img: '/static/assistingAgriculture/detail/img6.png', text: '购物车' }, { img: '/static/assistingAgriculture/detail/img6.png', text: '购物车' },
]); ]);
const format = ref('DD:HH:mm');
const time = ref('');
let prodId; let prodId;
const dataDetails = ref({}); const dataDetails = ref({});
const commentData = ref({}); const commentData = ref({});
...@@ -145,12 +189,29 @@ function handleClick(e) { ...@@ -145,12 +189,29 @@ function handleClick(e) {
} }
function jumpPjPgae() { function jumpPjPgae() {
xma.navigateTo({ 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) { function onChange(e) {
console.log(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 = () => { const getProdDetailFn = () => {
getProdDetail(prodId).then((res) => { getProdDetail(prodId).then((res) => {
...@@ -191,6 +252,7 @@ const addOrderFn = () => { ...@@ -191,6 +252,7 @@ const addOrderFn = () => {
duration: 1500, duration: 1500,
icon: 'none', icon: 'none',
}); });
getshoppingCartListFn();
}); });
}; };
// 获取购物车列表 // 获取购物车列表
...@@ -286,7 +348,6 @@ page { ...@@ -286,7 +348,6 @@ page {
border-radius: 16rpx; border-radius: 16rpx;
background: #ffffff; background: #ffffff;
position: relative; position: relative;
top: 10px;
} }
.detail-title { .detail-title {
width: 277 * 2rpx; width: 277 * 2rpx;
...@@ -301,6 +362,7 @@ page { ...@@ -301,6 +362,7 @@ page {
color: #3d3d3d; color: #3d3d3d;
padding-top: 20rpx; padding-top: 20rpx;
padding-left: 20rpx; padding-left: 20rpx;
padding-bottom: 40rpx;
} }
.detail-int { .detail-int {
width: 336 * 2rpx; width: 336 * 2rpx;
...@@ -313,8 +375,8 @@ page { ...@@ -313,8 +375,8 @@ page {
font-variation-settings: 'opsz' auto; font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on; font-feature-settings: 'kern' on;
color: #abaaaa; color: #abaaaa;
padding-top: 10rpx;
padding-left: 20rpx; padding-left: 20rpx;
padding-bottom: 20rpx;
} }
.share-img { .share-img {
float: right; float: right;
...@@ -342,7 +404,7 @@ page { ...@@ -342,7 +404,7 @@ page {
height: 88rpx; height: 88rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #ffffff; background: #ffffff;
margin-top: 30rpx; margin-top: 10rpx;
} }
.evaluate { .evaluate {
display: flex; display: flex;
...@@ -395,7 +457,9 @@ page { ...@@ -395,7 +457,9 @@ page {
padding-bottom: 120rpx; padding-bottom: 120rpx;
.content { .content {
margin-top: 30rpx; margin-top: 30rpx;
padding: 20rpx;
.desc { .desc {
padding-bottom: 20rpx;
img { img {
width: 100%; width: 100%;
} }
...@@ -458,4 +522,36 @@ page { ...@@ -458,4 +522,36 @@ page {
margin-top: -90rpx; margin-top: -90rpx;
margin-left: 400rpx; 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> </style>
...@@ -195,8 +195,7 @@ const stateList = ref({}); ...@@ -195,8 +195,7 @@ const stateList = ref({});
const orderDic = ref(); const orderDic = ref();
onLoad(async (options) => { onLoad(async (options) => {
// await signIn(); // await signIn();
if (!getToken()) await signIn(); if (!getToken()) await signIn2();
// if (!getToken()) await signIn2();
if (!getOrderDic()) await orderStatus(); if (!getOrderDic()) await orderStatus();
orderDic.value = getOrderDic(); orderDic.value = getOrderDic();
orderDic.value.baseOrder[0].value = 'all'; orderDic.value.baseOrder[0].value = 'all';
......
...@@ -131,7 +131,8 @@ const fileDomain = import.meta.env.VITE_APP_IMG_URL; ...@@ -131,7 +131,8 @@ const fileDomain = import.meta.env.VITE_APP_IMG_URL;
const contentHeight = ref('88rpx'); const contentHeight = ref('88rpx');
onLoad(async () => { onLoad(async () => {
if (!getToken()) await signIn(); // await signIn();
if (!getToken()) await signIn2();
xma.xh.getMenuButtonBoundingClientRect({ xma.xh.getMenuButtonBoundingClientRect({
success(res) { success(res) {
contentHeight.value = res.bottom * 2 + 10 + 'rpx'; // 左边界坐标,单位:px contentHeight.value = res.bottom * 2 + 10 + 'rpx'; // 左边界坐标,单位:px
......
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