Commit aa0e9f51 authored by chenwei's avatar chenwei

Merge branch 'feature' into 'release'

积分日志兑换日志 时间展示

See merge request !31
parents 0375725d dd79d7c3
<template> <template>
<div class="container"> <div class="container">
<div v-for="item in list" :key="item.id" class="item" @click="toDetail(item.id)"> <div
<div class="item-title">{{ $t('log.redeemGifts') }}</div> v-for="item in list"
:key="item.id"
class="item"
@click="toDetail(item.id)"
>
<div class="item-title">{{ $t("log.redeemGifts") }}</div>
<div class="item-box"> <div class="item-box">
<div class="box-img"> <div class="box-img">
<img <img
class="imgs" class="imgs"
:src="locale === 'zh_CN' ? item.imgZh : item.imgEn" :src="locale === 'zh_CN' ? item.imgZh : item.imgEn"
> />
</div> </div>
<div class="box-content"> <div class="box-content">
<div class="content-text"> <div class="content-text">
{{ locale === 'zh_CN' ? item.rewardTitleZh : item.rewardTitleEn }} {{ locale === "zh_CN" ? item.rewardTitleZh : item.rewardTitleEn }}
</div> </div>
<div class="content-time">{{ formatDate(item.createTime) }}</div> <div class="content-time">{{ formatDate(item.createTime) }}</div>
</div> </div>
...@@ -25,50 +30,53 @@ ...@@ -25,50 +30,53 @@
</template> </template>
<script> <script>
import { exchangeLogList } from '@/api/log' import { exchangeLogList } from "@/api/log";
export default { export default {
data() { data() {
return { return {
list: [] list: [],
} };
}, },
computed: { computed: {
locale() { locale() {
return this.$store.getters.language return this.$store.getters.language;
} },
}, },
created() { created() {
this.getList() this.getList();
}, },
methods: { methods: {
async getList() { async getList() {
try { try {
const memberId = this.$store.getters.id const memberId = this.$store.getters.id;
const { code, data } = await exchangeLogList({ memberId }) const { code, data } = await exchangeLogList({ memberId });
if (code === 0) { if (code === 0) {
this.list = data this.list = data;
} }
} catch (err) { } catch (err) {
console.log(err) console.log(err);
} }
}, },
// 时间戳转换为YYYY-MM-DD HH:mm:ss // 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(time) { formatDate(time) {
const date = new Date(time) const date = new Date(time);
const Y = date.getFullYear() + '-' const Y = date.getFullYear() + "-";
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' const M =
const D = date.getDate() + ' ' (date.getMonth() + 1 < 10
const h = date.getHours() + ':' ? "0" + (date.getMonth() + 1)
const m = date.getMinutes() + ':' : date.getMonth() + 1) + "-";
const s = date.getSeconds() const D = `${date.getDate()}`.padStart(2, "0") + " ";
return Y + M + D + h + m + s const h = `${date.getHours()}`.padStart(2, "0") + ":";
const m = `${date.getMinutes()}`.padStart(2, "0") + ":";
const s = `${date.getSeconds()}`.padStart(2, "0");
return Y + M + D + h + m + s;
}, },
// 跳转详情 // 跳转详情
toDetail(id) { toDetail(id) {
this.$router.push({ path: `/jiedao/jd-exchange-details`, query: { id }}) this.$router.push({ path: `/jiedao/jd-exchange-details`, query: { id } });
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<template> <template>
<div class="container"> <div class="container">
<div v-for="(item, index) in list" :key="index" class="item"> <div v-for="(item, index) in list" :key="index" class="item">
<div class="item-title">{{ locale == 'zh_CN' ? item.sourceTypeZh : item.sourceTypeEn }}</div> <div class="item-title">
{{ locale == "zh_CN" ? item.sourceTypeZh : item.sourceTypeEn }}
</div>
<div class="item-box"> <div class="item-box">
<div class="box-img"> <div class="box-img">
<img <img class="imgs" :src="imgArr[item.sourceType]" />
class="imgs"
:src="imgArr[item.sourceType]"
>
</div> </div>
<div class="box-content"> <div class="box-content">
<div class="content-text"> <div class="content-text">
{{ locale == 'zh_CN' ? item.descZh : item.descEn }} {{ locale == "zh_CN" ? item.descZh : item.descEn }}
</div> </div>
<div class="content-time">{{ formatDate(item.createTime) }}</div> <div class="content-time">{{ formatDate(item.createTime) }}</div>
</div> </div>
<div class="box-right"> <div class="box-right">
<div v-if="item.rewardCount" class="box-right-num">X{{ item.rewardCount }}</div> <div v-if="item.rewardCount" class="box-right-num">
X{{ item.rewardCount }}
</div>
<div v-if="item.expired" class="box-right-img"> <div v-if="item.expired" class="box-right-img">
<img class="imgs" src="@/assets/log/overdue.png" alt> <img class="imgs" src="@/assets/log/overdue.png" alt />
</div>
<div class="box-right-text">
{{ item.operateType }}&ensp;{{ item.scoreCount }}
</div> </div>
<div class="box-right-text">{{ item.operateType }}&ensp;{{ item.scoreCount }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -28,57 +31,60 @@ ...@@ -28,57 +31,60 @@
</template> </template>
<script> <script>
import { logList } from '@/api/log' import { logList } from "@/api/log";
export default { export default {
data() { data() {
return { return {
list: [] list: [],
} };
}, },
computed: { computed: {
locale() { locale() {
return this.$store.getters.language return this.$store.getters.language;
}, },
imgArr() { imgArr() {
return { return {
'1': require('@/assets/log/log_type1.png'), 1: require("@/assets/log/log_type1.png"),
'2': require('@/assets/log/log_type2.png'), 2: require("@/assets/log/log_type2.png"),
'4': require('@/assets/log/log_type4.png'), 4: require("@/assets/log/log_type4.png"),
'5': require('@/assets/log/log_type5.png'), 5: require("@/assets/log/log_type5.png"),
'6': require('@/assets/log/log_type6.png'), 6: require("@/assets/log/log_type6.png"),
'7': require('@/assets/log/log_type7.png'), 7: require("@/assets/log/log_type7.png"),
'8': require('@/assets/log/log_type8.png') 8: require("@/assets/log/log_type8.png"),
} };
} },
}, },
created() { created() {
this.getList() this.getList();
}, },
methods: { methods: {
async getList() { async getList() {
try { try {
const id = this.$store.getters.id const id = this.$store.getters.id;
const { code, data } = await logList({ id }) const { code, data } = await logList({ id });
if (code === 0) { if (code === 0) {
this.list = data this.list = data;
} }
} catch (err) { } catch (err) {
console.log(err) console.log(err);
} }
}, },
// 时间戳转换为YYYY-MM-DD HH:mm:ss // 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(time) { formatDate(time) {
const date = new Date(time) const date = new Date(time);
const Y = date.getFullYear() + '-' const Y = date.getFullYear() + "-";
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' const M =
const D = date.getDate() + ' ' (date.getMonth() + 1 < 10
const h = date.getHours() + ':' ? "0" + (date.getMonth() + 1)
const m = date.getMinutes() + ':' : date.getMonth() + 1) + "-";
const s = date.getSeconds() const D = `${date.getDate()}`.padStart(2, "0") + " ";
return Y + M + D + h + m + s const h = `${date.getHours()}`.padStart(2, "0") + ":";
} const m = `${date.getMinutes()}`.padStart(2, "0") + ":";
} const s = `${date.getSeconds()}`.padStart(2, "0");
} return Y + M + D + h + m + s;
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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