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> <template>
<view> <view>
<view class="v12-justify-around v12-pa-2 v12-white"> <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 style="color:#BCBCBC" class="day-wrap">{{ getDate(day) }}</view>
<view class="v12-dark-text day-wrap" :class="{'active': actived === i}">{{ getDay(day) }}</view> <view class="v12-dark-text day-wrap" :class="{'active': actived === i}">{{ getDay(day) }}</view>
</view> </view>
</view> </view>
<view class="v12-mt-3 v12-px-3 " v-for="(item, index) in items" :key="index"> <view v-if="isLoad" class="history-wrap">
<view> <view
<text class="v12-font-bold v12-font-32">{{ item.historyDate }}</text> v-for="(item, index) in items"
<view class="wrapper"> :key="index"
<view @click="goodsDetail(ite)" v-for="(ite, key) in item.histories" :key="key" class="v12-white v12-radius-20 v12-pa-2 history-card"> class="v12-mt-3"
<view> >
<image class="goods-img" :src="ite.image" mode="scaleToFill"></image> <view>
</view> <text class="v12-font-bold v12-font-32">{{ item.historyDate }}</text>
<view :style="{opacity: !ite.couponName ? 0 : 1}" class="v12-align-center v12-mt-2"> <view class="wrapper">
<view class="v12-primary-text v12-primary-border v12-radius-6 v12-font-22 v12-px-1"></view> <view
<view class="v12-primary-text v12-primary-border v12-radius-6 v12-font-22 v12-px-1">{{ ite.couponName }}</view> v-for="(historyItem, historyKey) in item.histories"
</view> :key="historyKey"
<view class="v12-justify-between v12-mt-2"> class="v12-white v12-radius-20 history-card"
<view class="v12-font-bold v12-primary-text"> @click="goodsDetail(historyItem)"
<text class="v12-font-16"></text> >
<text class="v12-font-24">{{ ite.price }}</text> <image
</view> class="goods-img"
<view class=""> :src="historyItem.image"
<image class="logo" :src="webUrl+'/orderIcon/组 355.png'" mode="" style="margin-right:0; width: 28rpx; height:28rpx"/> 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> </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> </view>
<goo-skeleton
v-else
:show-avatar="false"
/>
</view> </view>
</template> </template>
@@ -42,6 +81,7 @@ export default {
currentWeek: [], currentWeek: [],
actived: 0, actived: 0,
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
isLoad: false,
items: [] items: []
} }
}, },
@@ -50,7 +90,7 @@ export default {
}, },
mounted() { mounted() {
this.currentWeek = this.getWeek() this.currentWeek = this.getWeek()
this.getActived() this.actived = this.getActived()
}, },
methods: { methods: {
getActived() { getActived() {
@@ -59,23 +99,25 @@ export default {
return weekMap.indexOf(today) return weekMap.indexOf(today)
}, },
getWeek() { getWeek() {
let dates = []; const dates = []
let now = new Date(); const now = new Date();
let dayOfWeek = now.getDay(); // 0-6, 0是周日 // 0-6, 0是周日
let numDate = now.getDate(); // 当前日 const dayOfWeek = now.getDay()
let numDaysToMonday = dayOfWeek ? dayOfWeek - 1 : 6; // 当前日
const numDate = now.getDate()
const numDaysToMonday = dayOfWeek ? dayOfWeek - 1 : 6
// 得到本周周一的日期 // 得到本周周一的日期
let monday = new Date(now); const monday = new Date(now)
monday.setDate(numDate - numDaysToMonday); monday.setDate(numDate - numDaysToMonday)
// 生成本周剩余的日期 // 生成本周剩余的日期
for (let i = 0; i < 7; i++) { for (let i = 0; i < 7; i++) {
dates.push(new Date(monday).toISOString().slice(0, 10)); dates.push(new Date(monday).toISOString().slice(0, 10))
monday.setDate(monday.getDate() + 1); monday.setDate(monday.getDate() + 1)
} }
return dates; return dates
}, },
getDay(date) { getDay(date) {
return new Date(date).getDate() return new Date(date).getDate()
@@ -106,8 +148,21 @@ export default {
}) })
}, },
queryHistory() { queryHistory() {
this.items = []
this.isLoad = false
getHistory().then(res => { 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> </script>
<style lang="less" scoped> <style lang="less" scoped>
.history-wrap {
padding: 0 20rpx;
.img-nodata {
width: 100%;
}
}
.wrapper{ .wrapper{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-content: space-around !important; width: 710rpx;
} margin: 0 auto;
.goods-img{
width: 168rpx;
height: 168rpx;
border-radius: 8rpx;
margin-right: 8rpx;
} }
.history-card{ .history-card{
width: 178rpx; width: 226rpx;
box-sizing: border-box;
margin-top: 16rpx; margin-top: 16rpx;
margin-right: 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{ .active{
background: #C52733; background: #C52733;