Commit 1b53d301 authored by chenwei's avatar chenwei

修改积分记录兑换记录时间展示的格式

parent 80b01c69
...@@ -2,23 +2,15 @@ ...@@ -2,23 +2,15 @@
<view> <view>
<dHeader :title="$lang.lang.log.logExchange"></dHeader> <dHeader :title="$lang.lang.log.logExchange"></dHeader>
<view class="container"> <view class="container">
<view <view class="item" v-for="item in list" :key="item.id" @click="toDetail(item.id)">
class="item"
v-for="item in list"
:key="item.id"
@click="toDetail(item.id)"
>
<div class="item-title">{{ $lang.lang.log.redeemGifts }}</div> <div class="item-title">{{ $lang.lang.log.redeemGifts }}</div>
<div class="item-box"> <div class="item-box">
<div class="box-img"> <div class="box-img">
<image <image class="imgs" :src="locale === 'zh' ? item.imgZh : item.imgEn"></image>
class="imgs"
:src="locale === 'zh' ? item.imgZh : item.imgEn"
></image>
</div> </div>
<div class="box-content"> <div class="box-content">
<div class="content-text"> <div class="content-text">
{{ locale === "zh" ? item.rewardTitleZh : item.rewardTitleEn }} {{ locale === 'zh' ? item.rewardTitleZh : item.rewardTitleEn }}
</div> </div>
<div class="content-time">{{ formatDate(item.createTime) }}</div> <div class="content-time">{{ formatDate(item.createTime) }}</div>
</div> </div>
...@@ -33,63 +25,57 @@ ...@@ -33,63 +25,57 @@
</template> </template>
<script> <script>
import dHeader from "../../components/dHeader/index.vue"; import dHeader from '../../components/dHeader/index.vue'
export default { export default {
components: { components: {
dHeader, dHeader
}, },
data() { data() {
return { return {
list: [], list: []
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
computed: { computed: {
locale() { locale() {
return this.$lang.locale; return this.$lang.locale
}, }
}, },
methods: { methods: {
toDetail(id) { toDetail(id) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/exchange_detail/exchange_detail?id=" + id, url: '/pages/exchange_detail/exchange_detail?id=' + id
}); })
}, },
// 获取礼品列表 // 获取礼品列表
async getList() { async getList() {
try { try {
const memberId = this.$store.getters.id; const memberId = this.$store.getters.id
const { code, data } = await this.$request.post( const { code, data } = await this.$request.post('/app-api/reward/redeem/record/list', {
"/app-api/reward/redeem/record/list", memberId
{ })
memberId,
}
);
if (code == 0 && data) { if (code == 0 && data) {
this.list = data; this.list = data
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error)
} }
}, },
// 时间戳转换为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 = const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
(date.getMonth() + 1 < 10 const D = `${date.getDate()}`.padStart(2, '0') + ' '
? "0" + (date.getMonth() + 1) const h = `${date.getHours()}`.padStart(2, '0') + ':'
: date.getMonth() + 1) + "-"; const m = `${date.getMinutes()}`.padStart(2, '0') + ':'
const D = date.getDate() + " "; const s = `${date.getSeconds()}`.padStart(2, '0')
const h = date.getHours() + ":"; return Y + M + D + h + m + s
const m = date.getMinutes() + ":"; }
const s = date.getSeconds(); }
return Y + M + D + h + m + s; }
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="container"> <view class="container">
<view class="item" v-for="(item, index) in list" :key="index"> <view class="item" v-for="(item, index) in list" :key="index">
<div class="item-title"> <div class="item-title">
{{ locale == "zh" ? item.sourceTypeZh : item.sourceTypeEn }} {{ locale == 'zh' ? item.sourceTypeZh : item.sourceTypeEn }}
</div> </div>
<div class="item-box"> <div class="item-box">
<div class="box-img"> <div class="box-img">
...@@ -12,20 +12,16 @@ ...@@ -12,20 +12,16 @@
</div> </div>
<div class="box-content"> <div class="box-content">
<div class="content-text"> <div class="content-text">
{{ locale == "zh" ? item.descZh : item.descEn }} {{ locale == 'zh' ? 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">
<view class="box-right-num" v-if="item.rewardCount" <view class="box-right-num" v-if="item.rewardCount">X{{ item.rewardCount }}</view>
>X{{ item.rewardCount }}</view
>
<view class="box-right-img" v-if="item.expired"> <view class="box-right-img" v-if="item.expired">
<image src="../../static/img/overdue.png"></image> <image src="../../static/img/overdue.png"></image>
</view> </view>
<view class="box-right-text" <view class="box-right-text">{{ item.operateType }}&ensp;{{ item.scoreCount }}</view>
>{{ item.operateType }}&ensp;{{ item.scoreCount }}</view
>
</div> </div>
</div> </div>
</view> </view>
...@@ -34,68 +30,62 @@ ...@@ -34,68 +30,62 @@
</template> </template>
<script> <script>
import dHeader from "../../components/dHeader/index.vue"; import dHeader from '../../components/dHeader/index.vue'
export default { export default {
components: { components: {
dHeader, dHeader
}, },
data() { data() {
return { return {
list: [], list: []
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
computed: { computed: {
locale() { locale() {
return this.$lang.locale; return this.$lang.locale
}, },
// 图片数组 // 图片数组
imgArr() { imgArr() {
return { return {
1: "../../static/img/log_type1.png", 1: '../../static/img/log_type1.png',
2: "../../static/img/log_type2.png", 2: '../../static/img/log_type2.png',
4: "../../static/img/log_type4.png", 4: '../../static/img/log_type4.png',
5: "../../static/img/log_type5.png", 5: '../../static/img/log_type5.png',
6: "../../static/img/log_type6.png", 6: '../../static/img/log_type6.png',
7: "../../static/img/log_type7.png", 7: '../../static/img/log_type7.png',
8: "../../static/img/log_type8.png", 8: '../../static/img/log_type8.png'
}; }
}, }
}, },
methods: { methods: {
// 获取列表 // 获取列表
async getList() { async getList() {
try { try {
const id = this.$store.getters.id; const id = this.$store.getters.id
const { code, data } = await this.$request.post( const { code, data } = await this.$request.post('/app-api/member/user-score/log', {
"/app-api/member/user-score/log", id
{ })
id,
}
);
if (code == 0 && data) { if (code == 0 && data) {
this.list = data; this.list = data
} }
} catch (err) {} } catch (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 = const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
(date.getMonth() + 1 < 10 const D = `${date.getDate()}`.padStart(2, '0') + ' '
? "0" + (date.getMonth() + 1) const h = `${date.getHours()}`.padStart(2, '0') + ':'
: date.getMonth() + 1) + "-"; const m = `${date.getMinutes()}`.padStart(2, '0') + ':'
const D = date.getDate() + " "; const s = `${date.getSeconds()}`.padStart(2, '0')
const h = date.getHours() + ":"; return Y + M + D + h + m + s
const m = date.getMinutes() + ":"; }
const s = date.getSeconds(); }
return Y + M + D + h + m + s; }
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
......
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