From cfd333cffa2cea6a766c5ab9812a31256b5ceec3 Mon Sep 17 00:00:00 2001
From: lifizer <913626195@qq.com>
Date: Sat, 14 Sep 2024 21:45:34 +0800
Subject: [PATCH] =?UTF-8?q?Style(=E5=95=86=E5=93=81=E8=B6=B3=E8=BF=B9):?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/user/History/index.vue | 162 ++++++++++++++++++++++++++---------
1 file changed, 122 insertions(+), 40 deletions(-)
diff --git a/pages/user/History/index.vue b/pages/user/History/index.vue
index 11ed76c..1697e24 100644
--- a/pages/user/History/index.vue
+++ b/pages/user/History/index.vue
@@ -1,36 +1,75 @@
-
+
{{ getDate(day) }}
{{ getDay(day) }}
-
-
- {{ item.historyDate }}
-
-
-
-
-
-
- 券
- {{ ite.couponName }}
-
-
-
- ¥
- {{ ite.price }}
-
-
-
+
+
+
+ {{ item.historyDate }}
+
+
+
+
+
+ 券
+ {{ historyItem.couponName }}
+
+
+
+ ¥
+ {{ historyItem.price }}
+
+ ¥
+ {{ historyItem.otPrice }}
+
+
+
+
+
+
@@ -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 {