Style(商品足迹):界面细节调整

This commit is contained in:
lifizer
2024-09-14 21:45:34 +08:00
parent 24d2b6f96a
commit cfd333cffa
+122 -40
View File
@@ -1,36 +1,75 @@
<template>
<view>
<view class="v12-justify-around v12-pa-2 v12-white">
<view v-for="(day, i) in currentWeek" :key="i" class="v12-font-26">
<view
v-for="(day, i) in currentWeek"
:key="i"
class="v12-font-26"
>
<view style="color:#BCBCBC" class="day-wrap">{{ getDate(day) }}</view>
<view class="v12-dark-text day-wrap" :class="{'active': actived === i}">{{ getDay(day) }}</view>
</view>
</view>
<view class="v12-mt-3 v12-px-3 " v-for="(item, index) in items" :key="index">
<view>
<text class="v12-font-bold v12-font-32">{{ item.historyDate }}</text>
<view class="wrapper">
<view @click="goodsDetail(ite)" v-for="(ite, key) in item.histories" :key="key" class="v12-white v12-radius-20 v12-pa-2 history-card">
<view>
<image class="goods-img" :src="ite.image" mode="scaleToFill"></image>
</view>
<view :style="{opacity: !ite.couponName ? 0 : 1}" class="v12-align-center v12-mt-2">
<view class="v12-primary-text v12-primary-border v12-radius-6 v12-font-22 v12-px-1"></view>
<view class="v12-primary-text v12-primary-border v12-radius-6 v12-font-22 v12-px-1">{{ ite.couponName }}</view>
</view>
<view class="v12-justify-between v12-mt-2">
<view class="v12-font-bold v12-primary-text">
<text class="v12-font-16"></text>
<text class="v12-font-24">{{ ite.price }}</text>
</view>
<view class="">
<image class="logo" :src="webUrl+'/orderIcon/组 355.png'" mode="" style="margin-right:0; width: 28rpx; height:28rpx"/>
<view v-if="isLoad" class="history-wrap">
<view
v-for="(item, index) in items"
:key="index"
class="v12-mt-3"
>
<view>
<text class="v12-font-bold v12-font-32">{{ item.historyDate }}</text>
<view class="wrapper">
<view
v-for="(historyItem, historyKey) in item.histories"
:key="historyKey"
class="v12-white v12-radius-20 history-card"
@click="goodsDetail(historyItem)"
>
<image
class="goods-img"
:src="historyItem.image"
mode="scaleToFill"
/>
<view class="good-info">
<view
:style="{
opacity: !historyItem.couponName ? 0 : 1
}"
class="v12-align-center v12-mt-2"
>
<view class="v12-primary-text v12-primary-border v12-radius-6 v12-font-22 v12-px-1"></view>
<view class="v12-primary-text v12-primary-border v12-radius-6 v12-font-22 v12-px-1">{{ historyItem.couponName }}</view>
</view>
<view class="v12-justify-between v12-mt-2 price">
<view class="v12-font-bold v12-primary-text">
<text class="v12-font-16"></text>
<text class="v12-font-24">{{ historyItem.price }}</text>
<text class="v12-grey-text ot-price">
<text class="v12-font-16"></text>
<text class="v12-font-24">{{ historyItem.otPrice }}</text>
</text>
</view>
<image
:src="webUrl+'/orderIcon/组 355.png'"
class="icon"
/>
</view>
</view>
</view>
</view>
</view>
</view>
<image
v-if="items.length === 0"
:src="webUrl + '/orderIcon/nodata.png'"
class="img-nodata v12-mt-16"
mode="widthFix"
/>
</view>
<goo-skeleton
v-else
:show-avatar="false"
/>
</view>
</template>
@@ -42,6 +81,7 @@ export default {
currentWeek: [],
actived: 0,
webUrl: this.$VUE_APP_RESOURCES_URL,
isLoad: false,
items: []
}
},
@@ -50,7 +90,7 @@ export default {
},
mounted() {
this.currentWeek = this.getWeek()
this.getActived()
this.actived = this.getActived()
},
methods: {
getActived() {
@@ -59,23 +99,25 @@ export default {
return weekMap.indexOf(today)
},
getWeek() {
let dates = [];
let now = new Date();
let dayOfWeek = now.getDay(); // 0-6, 0是周日
let numDate = now.getDate(); // 当前日
let numDaysToMonday = dayOfWeek ? dayOfWeek - 1 : 6;
const dates = []
const now = new Date();
// 0-6, 0是周日
const dayOfWeek = now.getDay()
// 当前日
const numDate = now.getDate()
const numDaysToMonday = dayOfWeek ? dayOfWeek - 1 : 6
// 得到本周周一的日期
let monday = new Date(now);
monday.setDate(numDate - numDaysToMonday);
const monday = new Date(now)
monday.setDate(numDate - numDaysToMonday)
// 生成本周剩余的日期
for (let i = 0; i < 7; i++) {
dates.push(new Date(monday).toISOString().slice(0, 10));
monday.setDate(monday.getDate() + 1);
dates.push(new Date(monday).toISOString().slice(0, 10))
monday.setDate(monday.getDate() + 1)
}
return dates;
return dates
},
getDay(date) {
return new Date(date).getDate()
@@ -106,8 +148,21 @@ export default {
})
},
queryHistory() {
this.items = []
this.isLoad = false
getHistory().then(res => {
this.items = res.data
const { data = [] } = res
if (data.length > 0) {
data.map(item => {
if (item.histories) {
if (item.histories.length > 0) {
this.items.push(item)
}
}
})
}
}).finally(() => {
this.isLoad = true
})
}
@@ -116,21 +171,48 @@ export default {
</script>
<style lang="less" scoped>
.history-wrap {
padding: 0 20rpx;
.img-nodata {
width: 100%;
}
}
.wrapper{
display: flex;
flex-wrap: wrap;
align-content: space-around !important;
}
.goods-img{
width: 168rpx;
height: 168rpx;
border-radius: 8rpx;
margin-right: 8rpx;
width: 710rpx;
margin: 0 auto;
}
.history-card{
width: 178rpx;
width: 226rpx;
box-sizing: border-box;
margin-top: 16rpx;
margin-right: 16rpx;
border-radius: 20rpx;
overflow: hidden;
&:nth-child(3n) {
margin-right: 0;
}
.goods-img {
display: block;
width: 226rpx;
height: 226rpx;
}
.good-info {
padding: 12rpx 12rpx 20rpx 12rpx;
.price {
line-height: 34rpx;
.ot-price {
margin: 0 0 0 10rpx;
text-decoration: line-through;
}
}
.icon {
display: block;
width: 34rpx;
height: 34rpx;
}
}
}
.active{
background: #C52733;