Commit da03144e authored by chenwei's avatar chenwei

Merge branch 'feature' into 'dev'

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

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