【修复】服务商品倒计时错误的问题,调整首页组件显示效果。

This commit is contained in:
大灰灰
2022-10-22 21:11:46 +08:00
parent c8175d1090
commit 3aacf52dbb
9 changed files with 212 additions and 94 deletions

View File

@@ -5,10 +5,6 @@
<u-toast ref="uToast" />
<view class="head-box coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-margin-bottom-10">
<view class="head-title u-ellipsis-1">领券专区</view>
<!--<view class="head-more coreshop-flex coreshop-align-center coreshop-flex-direction-row u-col-center" @tap="$Router.push('/pages/app/coupon/list')">
<text class="more-text coreshop-margin-right-10">查看更多</text>
<text class="iconfont icon-youjiantou-tianchong more-icon"></text>
</view>-->
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="$u.route('/pages/coupon/coupon')"></u-icon>
</view>
<scroll-view class="groupon-scroll" enable-flex scroll-anchoring scroll-x scroll-with-animation>

View File

@@ -1,40 +1,85 @@
<template>
<view>
<view class="coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-top-10 coreshop-margin-bottom-10">
<coreshop-section font-size="15" :title="coreshopdata.parameters.title" @click="goServicesList()" sub-title="查看更多"></coreshop-section>
</view>
<view class="coreshop-margin-left-15 coreshop-margin-right-15" v-if="coreshopdata.parameters.list && count">
<view class="img-list-item coreshop-flex-direction-row" v-if="item.id !== 'undefined' && item.id" v-for="(item, key) in coreshopdata.parameters.list" :key="key" @click="goServicesDetail(item.id)">
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-tr-24 coreshop-border-radius-bl-24" v-if="listData && count">
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopdata.parameters.title}}</view>
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="goServicesList()"></u-icon>
</view>
<view class="coreshop-divider">
<view class="left"></view>
<text class="dot"></text>
<view class="right"></view>
</view>
<view class="img-list-item coreshop-flex-direction-row coreshop-margin-bottom-10 bg-main coreshop-text-black" v-for="(item, key) in listData" :key="key" @click="goServicesDetail(item.id)">
<view class="img-list-item-l">
<u--image :src="item.thumbnail" :index="item.id" width="100px" height="100px"></u--image>
</view>
<view class="img-list-item-r">
<view class="coreshop-font-14 coreshop-text-bold u-line-1">{{item.title}}</view>
<view class="coreshop-font-14 coreshop-text-bold u-line-1 title">{{item.title}}</view>
<view class="coreshop-font-12 u-line-2 coreshop-margin-top-10 coreshop-margin-bottom-10">{{item.description}}</view>
<view class="item-c coreshop-flex coreshop-justify-between">
<view class="red-price coreshop-justify-between">
{{item.money}}
</view>
<view class="coreshop-flex coreshop-flex-direction-row coreshop-justify-between">
<view class="red-price coreshop-font-15 coreshop-flex-direction-row" v-if="item.status == 0 && item.lastTime > 0">
<u-count-down :time="item.lastTime" format="HH:mm:ss"></u-count-down>
</view>
<!--<u-count-down :time="item.lastTime" format="HH:mm:ss"></u-count-down>-->
<view class="coreshop-text-right coreshop-time-right" v-if="item.openStatus == 1 && item.lastTime > 0">
<u-count-down :time="item.lastTime*1000" :autoStart="true" format="DD天HHmmss" @change="onChange($event,key)">
<view class="time coreshop-font-11">
<view class="coreshop-font-12">仅剩</view>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.days }}</text>
</view>
<text class="time__doc"></text>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.hours>10?item.timeData.hours:'0'+item.timeData.hours}}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.minutes }}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.seconds }}</text>
</view>
</view>
</u-count-down>
</view>
<view class="coreshop-text-right coreshop-time-right" v-if="item.openStatus == 2 && item.lastTime > 0">
<u-count-down :time="item.lastTime*1000" :autoStart="true" format="DD天HH时mm秒ss" @change="onChange($event,key)">
<view class="time">
<view class="coreshop-font-12">即将开始</view>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.days }}</text>
</view>
<text class="time__doc"></text>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.hours>10?item.timeData.hours:'0'+item.timeData.hours}}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.minutes }}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text class="time__custom__item">{{ item.timeData.seconds }}</text>
</view>
</view>
</u-count-down>
</view>
<view class="coreshop-font-12 red-price" v-if="item.openStatus == 3">已结束</view>
<!--<view class="coreshop-flex coreshop-flex-direction-row coreshop-justify-between">
<view class="coreshop-font-12 red-price" v-if="item.status == 3">已结束</view>
<view class="coreshop-font-12 red-price" v-if="item.status == 2">即将开始</view>
<u-icon name="shopping-cart" color="#2979ff" size="25" class="btnCart"></u-icon>
</view>
</view>
</view>
</view>
<view class="img-list-item" v-if="!item.id" v-for="(item, key) in coreshopdata.parameters.list" :key="key">
<image class="img-list-item-l" :src="item.image== '/images/empty-banner.png'? '/static/images/common/empty-banner.png':item.image" mode='aspectFill'></image>
<view class="img-list-item-r">
<view class="goods-name list-goods-name">{{item.name}}</view>
<view class="item-c">
<view class=" red-price">{{item.price}}</view>
</view>-->
</view>
</view>
</view>
</view>
</view>
@@ -43,30 +88,50 @@
<script>
export default {
name: "coreshopservice",
data() {
return {
listData: [],
}
},
props: {
coreshopdata: {
// type: Array,
required: false,
}
},
mounted() {
this.listData = uni.$u.deepClone(this.coreshopdata.parameters.list);
},
computed: {
count() {
return (this.coreshopdata.parameters.list.length > 0)
return (this.listData.length > 0)
}
},
methods: {
onChange(e, key) {
//this.item.timeData = uni.$u.deepClone(e);
this.$set(this.listData[key], 'timeData', e)
// this.$forceUpdate();
},
},
}
</script>
<style lang="scss" scoped>
.img-list-item { border-radius: 8px; margin: 2.5px 2.5px 10px 2.5px; background-color: #ffffff; padding: 5px; position: relative; overflow: hidden;
.img-list-item { position: relative; overflow: hidden;
.img-list-item-l { width: 100px; height: 100px; display: inline-block; float: left; }
.img-list-item-r { width: calc(100% - 120px); display: inline-block; margin-left: 7.5px; float: left; position: relative;
.title { line-height: 24px; }
.item-c { width: 100%; margin-top: 0;
.red-price { color: #FF7159 !important; }
.btnCart { float: right; }
}
}
}
.time { display: flex; align-items: center;
.time__custom { min-width: 18px; height: 18px; background-color: #3c9cff; border-radius: 4px; display: flex; justify-content: center; align-items: center;
.time__custom__item { color: #fff; font-size: 10px; text-align: center; }
}
}
</style>

View File

@@ -48,7 +48,7 @@
</u-count-down>
</view>
<view class="coreshop-text-right coreshop-time-right" v-if="goodsInfo.pinTuanRule && goodsInfo.pinTuanRule.pinTuanStartStatus == 2">
<u-count-down :time="goodsInfo.pinTuanRule.lastTime*1000" :autoStart="true" :millisecond="true" format="DD天HH时mm秒ss">
<u-count-down :time="goodsInfo.pinTuanRule.lastTime*1000" :autoStart="true" :millisecond="true" format="DD天HH时mm秒ss" @change="onChange">
<view class="time">
<view class="coreshop-font-12">即将开团</view>
<view class="time__custom">

View File

@@ -23,8 +23,8 @@
<text class="coreshop-font-24">{{ info.money || '0.00' }}</text>
</view>
<view class="coreshop-flex-sub coreshop-flex coreshop-text-left coreshop-justify-end coreshop-align-center">
<view class="coreshop-text-right coreshop-time-right">
<u-count-down :time="timestamp" :autoStart="true" :millisecond="true" format="DD天HH时mm秒ss" @change="onChange">
<view class="coreshop-text-right coreshop-time-right" v-if="timer.openStatus == 1 && timer.lastTime > 0">
<u-count-down :time="timer.lastTime * 1000" :autoStart="true" :millisecond="true" format="DD天HH时mm秒ss" @change="onChange">
<view class="time">
<view class="coreshop-font-12">仅剩</view>
<view class="time__custom">
@@ -45,6 +45,29 @@
</view>
</u-count-down>
</view>
<view class="coreshop-text-right coreshop-time-right" v-if="timer.openStatus == 2 && timer.lastTime > 0">
<u-count-down :time="timer.lastTime * 1000" :autoStart="true" :millisecond="true" format="DD天HH时mm秒ss" @change="onChange">
<view class="time">
<view class="coreshop-font-12">仅剩</view>
<view class="time__custom">
<text class="time__custom__item">{{ timeData.days }}</text>
</view>
<text class="time__doc"></text>
<view class="time__custom">
<text class="time__custom__item">{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text class="time__custom__item">{{ timeData.minutes }}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text class="time__custom__item">{{ timeData.seconds }}</text>
</view>
</view>
</u-count-down>
</view>
<view class="coreshop-font-12 red-price" v-if="timer.openStatus == 3">已结束</view>
</view>
</view>
<view class="coreshop-margin-top-12 coreshop-multiple-line-clamp">
@@ -266,9 +289,9 @@
return {
id: 0,
info: {},
timestamp: 86400,
orderType: this.$globalConstVars.paymentType.serviceOrder, // 订单类型
shopRecommendData: [], // 其他数据
timer: {},
timeData: {},
}
},
@@ -295,8 +318,8 @@
};
this.$u.api.getServiceDetail(data).then(res => {
if (res.status) {
this.info = res.data;
this.timestamp = res.data.timestamp;
this.info = res.data.serviceInfo;
this.timer = res.data.timer;
} else {
this.$u.toast(res.msg);
}

View File

@@ -1,5 +1,5 @@
/*page { background: #f6f7f9; }*/
page, .bg-page { background: #f7f7f7; }
page, .bg-page, .bg-main { background: #f7f7f7; }
// nvue不能用标签命名样式不能放在微信组件中否则微信开发工具会报警告无法使用标签名当做选择器

View File

@@ -712,3 +712,12 @@ u-icon { line-height: 0; }
.index-goods .goods { -webkit-column-break-inside: avoid; border-radius: 18rpx; break-inside: avoid; margin-bottom: 24rpx; width: 326rpx; }
.coreshop-title-294 { width: 294rpx; }
.coreshop-image-price-tags { height: 32rpx; margin-bottom: 4rpx; margin-right: 12rpx; vertical-align: middle; width: 98rpx; }
/*分割线*/
.coreshop-divider { display: flex; flex-direction: row; flex-direction: row; align-items: center; margin: 5px 0 15px 0;
.left { margin: 0; border-bottom-width: 1px; border-bottom-style: solid; width: 100%; transform: scaleY(0.5); border-color: #dcdfe6; flex: 1; vertical-align: middle; }
.dot { font-size: 12px; margin: 0 12px; color: #c0c4cc; }
.right { margin: 0; border-bottom-width: 1px; border-bottom-style: solid; width: 100%; transform: scaleY(0.5); border-color: #dcdfe6; flex: 1; vertical-align: middle; }
}