Commit 9aa24dd2 authored by chenwei's avatar chenwei

inital commit

parent 72c3329a
...@@ -12,21 +12,44 @@ ...@@ -12,21 +12,44 @@
<view class="activity-title">{{ <view class="activity-title">{{
locale === 'zh' ? detailInfo.titleZh : detailInfo.titleEn locale === 'zh' ? detailInfo.titleZh : detailInfo.titleEn
}}</view> }}</view>
<view class="activity-remark" v-if="detailInfo.extraRecommend"> <view class="activity-remark" v-if="detailInfo.type == 4" v-html="
{{ locale === 'zh_CN'
locale === 'zh' ? detailInfo.extraShare.activityDescZh
? detailInfo.extraRecommend.shareContentZh : detailInfo.extraShare.activityDescEn
: detailInfo.extraRecommend.shareContentEn ">
}}
</view> </view>
<view class="activity-cell"> <view class="activity-cell">
<view class="cell-label">{{ detail.illustrate }}</view> <view class="cell-label">{{ detail.illustrate }}</view>
<view class="cell-content"> <view class="cell-content">
<image class="cell-image" src="../../static/img/score_b.png"></image> <image class="cell-image" src="../../static/img/score_b.png"></image>
<view class="cell-text">{{ detailInfo.getScoreOnce }}</view> <span v-if="detailInfo.type == 4">{{
detail.shareLabel(detailInfo.getScoreOnce)
}}</span>
<span v-if="detailInfo.type == 3">{{
detail.referralCodeLabel(detailInfo.getScoreOnce)
}}</span>
<view class="cell-text" v-if="detailInfo.type == '2'">{{detail.registerLabel(detailInfo.getScoreOnce)}}</view>
<view v-if="detailInfo.type == 1">
<view
class="rule"
v-for="ruleItem in detailInfo.extraOrderV.orderVRule"
:key="ruleItem.low"
>
{{
detail.orderRuleLabel( {
low: ruleItem.low,
high: ruleItem.high,
score: ruleItem.score,
unit:
detailInfo.extraOrderVtransportType == 1 ? "" : "kg",
})
}}
</view> </view>
</view> </view>
<view class="activity-cell"> </view>
</view>
<view class="activity-cell" v-if="detailInfo.type!=2">
<view class="cell-label">{{ detail.maxIntegral }}</view> <view class="cell-label">{{ detail.maxIntegral }}</view>
<view class="cell-content"> <view class="cell-content">
<image class="cell-image" src="../../static/img/score_b.png"></image> <image class="cell-image" src="../../static/img/score_b.png"></image>
...@@ -96,9 +119,9 @@ export default { ...@@ -96,9 +119,9 @@ export default {
const hours = String(date.getHours()).padStart(2, '0') const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0') const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0') const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}:${month}:${day} ${hours}:${minutes}:${seconds}` return `${year}:${month}:${day}`
} }
return `${formatDate(start)}${formatDate(end)}` return `${formatDate(start)}${this.detail.to}${formatDate(end)}`
} }
} }
} }
...@@ -156,7 +179,6 @@ page { ...@@ -156,7 +179,6 @@ page {
color: #7f7f7f; color: #7f7f7f;
} }
.cell-content { .cell-content {
max-width: 60%;
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
......
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
<dHeader :title="$lang.lang.addressInfo.addInfo"></dHeader> <dHeader :title="$lang.lang.addressInfo.addInfo"></dHeader>
<view class="container"> <view class="container">
<uni-forms ref="form" :model="form" :label-width="80" :rules="rules"> <uni-forms ref="form" :model="form" :label-width="80" :rules="rules">
<uni-forms-item :label="$lang.lang.addressInfo.consignee" required name="name"> <uni-forms-item
:label="$lang.lang.addressInfo.consignee"
required
name="name"
>
<uni-easyinput <uni-easyinput
class="input" class="input"
:trim="true" :trim="true"
...@@ -12,7 +16,11 @@ ...@@ -12,7 +16,11 @@
:placeholder="$lang.lang.notices.consignee" :placeholder="$lang.lang.notices.consignee"
/> />
</uni-forms-item> </uni-forms-item>
<uni-forms-item :label="$lang.lang.addressInfo.phone" required name="phone"> <uni-forms-item
:label="$lang.lang.addressInfo.phone"
required
name="phone"
>
<view class="phone-box"> <view class="phone-box">
<picker :value="areaIndex" :range="areaName" @change="areaChange"> <picker :value="areaIndex" :range="areaName" @change="areaChange">
<view class="phone-code"> <view class="phone-code">
...@@ -47,60 +55,73 @@ ...@@ -47,60 +55,73 @@
:placeholder="$lang.lang.notices.fullAddress" :placeholder="$lang.lang.notices.fullAddress"
> >
</uni-easyinput> </uni-easyinput>
<view class="placeholder">{{ $lang.lang.notices.fullAddressLength }}</view> <view class="placeholder">{{
$lang.lang.notices.fullAddressLength
}}</view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<view class="btn" @click="saveAddress">报存地址</view> <view class="btn" @click="saveAddress">{{
$lang.lang.notices.saveAddress
}}</view>
</uni-forms> </uni-forms>
</view> </view>
</view> </view>
</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 {
form: { form: {
name: '', name: "",
phone: '', phone: "",
address: '' address: "",
}, },
areaCode: this.$store.getters.areaCode, areaCode: this.$store.getters.areaCode,
areaIndex: 0, areaIndex: 0,
areaName: [] areaName: [],
} };
}, },
computed: { computed: {
rules() { rules() {
return { return {
name: { name: {
rules: [{ required: true, errorMessage: this.$lang.lang.notices.consignee }] rules: [
{ required: true, errorMessage: this.$lang.lang.notices.consignee },
],
}, },
phone: { phone: {
rules: [ rules: [
{ required: true, errorMessage: this.$lang.lang.notices.phone }, { required: true, errorMessage: this.$lang.lang.notices.phone },
{ {
validateFunction: (rule, value) => /^\d+$/.test(value), validateFunction: (rule, value) => /^\d+$/.test(value),
errorMessage: this.$lang.lang.notices.nophone errorMessage: this.$lang.lang.notices.nophone,
} },
] ],
}, },
address: { address: {
rules: [ rules: [
{ required: true, errorMessage: this.$lang.lang.notices.fullAddress }, {
{ maxLength: 100, errorMessage: this.$lang.lang.notices.fullAddressLength } required: true,
] errorMessage: this.$lang.lang.notices.fullAddress,
} },
} {
} maxLength: 100,
errorMessage: this.$lang.lang.notices.fullAddressLength,
},
],
},
};
},
}, },
created() { created() {
this.getCountry() this.getCountry();
}, },
methods: { methods: {
saveAddress() { saveAddress() {
this.$refs.form.validate().then(async (valid) => { this.$refs.form.validate().then(async (valid) => {
...@@ -109,47 +130,55 @@ export default { ...@@ -109,47 +130,55 @@ export default {
const params = { const params = {
...this.form, ...this.form,
areaCode: this.areaCode, areaCode: this.areaCode,
memberId: this.$store.getters.id memberId: this.$store.getters.id,
} };
const { code, data } = await this.$request.post( const { code, data, msg } = await this.$request.post(
'/app-api/member/user-address/create', "/app-api/member/user-address/create",
params params
) );
if (code == 0) { if (code == 0) {
this.$router.back() uni.$emit("refreshPreviousPage", "show");
uni.navigateBack();
} else {
uni.showToast({
title: msg,
duration: 2000,
});
} }
} catch (error) {} } catch (error) {}
} }
}) });
}, },
// 获取国家区号 // 获取国家区号
async getCountry() { async getCountry() {
try { try {
const { code, data } = await this.$request.get('/app-api/ecw/country/list-all') const { code, data } = await this.$request.get(
"/app-api/ecw/country/list-all"
);
if (code == 0 && data.length > 0) { if (code == 0 && data.length > 0) {
// 查询用户区号下标 // 查询用户区号下标
const i = data.findIndex((item) => { const i = data.findIndex((item) => {
return item.tel == this.areaCode return item.tel == this.areaCode;
}) });
if (i >= 0) this.areaIndex = i if (i >= 0) this.areaIndex = i;
data.forEach((item) => { data.forEach((item) => {
const str = item.tel + ' ' + item.nameZh const str = item.tel + " " + item.nameZh;
if (this.$lang.locale == 'zh') { if (this.$lang.locale == "zh") {
this.areaName.push(str) this.areaName.push(str);
} else { } else {
this.areaName.push(str) this.areaName.push(str);
} }
}) });
} }
} catch (error) {} } catch (error) {}
}, },
// 区号选择切换 // 区号选择切换
areaChange(e) { areaChange(e) {
this.areaIndex = e.detail.value this.areaIndex = e.detail.value;
this.areaCode = this.areaName[this.areaIndex].split(' ')[0] this.areaCode = this.areaName[this.areaIndex].split(" ")[0];
} },
} },
} };
</script> </script>
<style> <style>
......
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
<dHeader :title="$lang.lang.addressInfo.editInfo"></dHeader> <dHeader :title="$lang.lang.addressInfo.editInfo"></dHeader>
<view class="container"> <view class="container">
<uni-forms ref="form" :model="form" :label-width="80" :rules="rules"> <uni-forms ref="form" :model="form" :label-width="80" :rules="rules">
<uni-forms-item :label="$lang.lang.addressInfo.consignee" required name="name"> <uni-forms-item
:label="$lang.lang.addressInfo.consignee"
required
name="name"
>
<uni-easyinput <uni-easyinput
class="input" class="input"
:trim="true" :trim="true"
...@@ -12,7 +16,11 @@ ...@@ -12,7 +16,11 @@
:placeholder="$lang.lang.notices.consignee" :placeholder="$lang.lang.notices.consignee"
/> />
</uni-forms-item> </uni-forms-item>
<uni-forms-item :label="$lang.lang.addressInfo.phone" required name="phone"> <uni-forms-item
:label="$lang.lang.addressInfo.phone"
required
name="phone"
>
<view class="phone-box"> <view class="phone-box">
<view class="phone-code">+86</view> <view class="phone-code">+86</view>
<uni-easyinput <uni-easyinput
...@@ -42,56 +50,68 @@ ...@@ -42,56 +50,68 @@
:placeholder="$lang.lang.notices.fullAddress" :placeholder="$lang.lang.notices.fullAddress"
> >
</uni-easyinput> </uni-easyinput>
<view class="placeholder">{{ $lang.lang.notices.fullAddressLength }}</view> <view class="placeholder">{{
$lang.lang.notices.fullAddressLength
}}</view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<view class="btn" @click="saveAddress">报存地址</view> <view class="btn" @click="saveAddress">{{
$lang.lang.notices.saveAddress
}}</view>
</uni-forms> </uni-forms>
</view> </view>
</view> </view>
</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 {
form: { form: {
name: '', name: "",
phone: '', phone: "",
address: '' address: "",
} },
} };
}, },
onLoad(route) { onLoad(route) {
this.getAddress(route.id) this.getAddress(route.id);
}, },
computed: { computed: {
rules() { rules() {
return { return {
name: { name: {
rules: [{ required: true, errorMessage: this.$lang.lang.notices.consignee }] rules: [
{ required: true, errorMessage: this.$lang.lang.notices.consignee },
],
}, },
phone: { phone: {
rules: [ rules: [
{ required: true, errorMessage: this.$lang.lang.notices.phone }, { required: true, errorMessage: this.$lang.lang.notices.phone },
{ {
validateFunction: (rule, value) => /^\d+$/.test(value), validateFunction: (rule, value) => /^\d+$/.test(value),
errorMessage: this.$lang.lang.notices.nophone errorMessage: this.$lang.lang.notices.nophone,
} },
] ],
}, },
address: { address: {
rules: [ rules: [
{ required: true, errorMessage: this.$lang.lang.notices.fullAddress }, {
{ maxLength: 100, errorMessage: this.$lang.lang.notices.fullAddressLength } required: true,
] errorMessage: this.$lang.lang.notices.fullAddress,
} },
} {
} maxLength: 100,
errorMessage: this.$lang.lang.notices.fullAddressLength,
},
],
},
};
},
}, },
methods: { methods: {
saveAddress() { saveAddress() {
...@@ -100,27 +120,32 @@ export default { ...@@ -100,27 +120,32 @@ export default {
if (res) { if (res) {
try { try {
const { code } = await this.$request.post( const { code } = await this.$request.post(
'/app-api/member/user-address/update', "/app-api/member/user-address/update",
this.form this.form
) );
if (code == 0) { if (code == 0) {
this.$router.back() this.$route.params.addressId = "00000";
uni.$emit("refreshPreviousPage", "show");
uni.navigateBack();
} }
} catch (err) {} } catch (err) {}
} }
}) });
}, },
// 获取地址信息 回显 // 获取地址信息 回显
async getAddress(id) { async getAddress(id) {
try { try {
const { code, data } = await this.$request.get('/app-api/member/user-address/get', { id }) const { code, data } = await this.$request.get(
"/app-api/member/user-address/get",
{ id }
);
if (code == 0 && data) { if (code == 0 && data) {
this.form = data this.form = data;
} }
} catch (err) {} } catch (err) {}
} },
} },
} };
</script> </script>
<style> <style>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</div> </div>
<div class="header-content"> <div class="header-content">
<div class="header-content-title"> <div class="header-content-title">
{{ locale === 'zh' ? detailInfo.statusZh : detailInfo.statusEn }} {{ locale === "zh" ? detailInfo.statusZh : detailInfo.statusEn }}
</div> </div>
<div class="header-content-text"> <div class="header-content-text">
<view class="header-content-small">{{ detail.total }}</view <view class="header-content-small">{{ detail.total }}</view
...@@ -18,11 +18,18 @@ ...@@ -18,11 +18,18 @@
</div> </div>
<div class="nav"> <div class="nav">
<div class="nav-image"> <div class="nav-image">
<image class="img" :src="locale === 'zh' ? detailInfo.imgZh : detailInfo.imgEn"></image> <image
class="img"
:src="locale === 'zh' ? detailInfo.imgZh : detailInfo.imgEn"
></image>
</div> </div>
<div class="nav-content"> <div class="nav-content">
<div class="nav-content-text"> <div class="nav-content-text">
{{ locale === 'zh' ? detailInfo.rewardTitleZh : detailInfo.rewardTitleEn }} {{
locale === "zh"
? detailInfo.rewardTitleZh
: detailInfo.rewardTitleEn
}}
</div> </div>
<div class="nav-content-tag"> <div class="nav-content-tag">
<div class="tag-image"> <div class="tag-image">
...@@ -45,20 +52,28 @@ ...@@ -45,20 +52,28 @@
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">{{ detail.exchangeOutlets }}</div> <div class="cell-label">{{ detail.exchangeOutlets }}</div>
<div class="cell-content"> <div class="cell-content">
{{ locale === 'zh' ? detailInfo.nodeTitleZh : detailInfo.nodeTitleEn }} {{
locale === "zh" ? detailInfo.nodeTitleZh : detailInfo.nodeTitleEn
}}
</div> </div>
</div> </div>
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">{{ detail.exchangeType }}</div> <div class="cell-label">{{ detail.exchangeType }}</div>
<div class="cell-content"> <div class="cell-content">
{{ locale === 'zh' ? detailInfo.redeemTypeZh : detailInfo.redeemTypeEn }} {{
locale === "zh"
? detailInfo.redeemTypeZh
: detailInfo.redeemTypeEn
}}
</div> </div>
</div> </div>
<template v-if="detailInfo.redeemType != 1"> <template v-if="detailInfo.redeemType != 1">
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">{{ detail.address }}</div> <div class="cell-label">{{ detail.address }}</div>
<div class="cell-content"> <div class="cell-content">
{{ detailInfo.recipientName }}&ensp;+{{ detailInfo.recipientPhoneNum }}, {{ detailInfo.recipientName }}&ensp;+{{
detailInfo.recipientPhoneNum
}},
{{ detailInfo.recipientAddress }} {{ detailInfo.recipientAddress }}
<view class="red">{{ detail.errorMsg }}</view> <view class="red">{{ detail.errorMsg }}</view>
</div> </div>
...@@ -73,7 +88,9 @@ ...@@ -73,7 +88,9 @@
</div> </div>
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">{{ detail.courierTime }}</div> <div class="cell-label">{{ detail.courierTime }}</div>
<div class="cell-content">{{ formatDate(detailInfo.expressDate) }}</div> <div class="cell-content">
{{ formatDate(detailInfo.expressDate) }}
</div>
</div> </div>
</template> </template>
<div class="main-cell"> <div class="main-cell">
...@@ -86,64 +103,66 @@ ...@@ -86,64 +103,66 @@
</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 {
id: null, id: null,
detailInfo: {} detailInfo: {},
} };
}, },
onLoad(route) { onLoad(route) {
console.log(route) console.log(route);
this.id = route.id this.id = route.id;
this.getDetail() this.getDetail();
}, },
computed: { computed: {
locale() { locale() {
return this.$lang.locale return this.$lang.locale;
}, },
detail() { detail() {
return this.$lang.lang.detail return this.$lang.lang.detail;
} },
}, },
methods: { methods: {
// 获取详情 // 获取详情
getDetail() { getDetail() {
this.$request this.$request
.post('/app-api/reward/redeem/record/detail', { .post("/app-api/reward/redeem/record/detail", {
redeemId: this.id redeemId: this.id,
}) })
.then(({ code, data }) => { .then(({ code, data }) => {
if (code == 0 && data) { if (code == 0 && data) {
this.detailInfo = data this.detailInfo = data;
} }
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error);
}) });
}, },
// 时间范围返回 // 时间范围返回
getTimeRange(start, end) { getTimeRange(start, end) {
return `${this.formatDate(start)}${this.formatDate(end)}` return `${this.formatDate(start)}${this.detail.to}${this.formatDate(
end
)}`;
}, },
// 时间戳转换为YYYY-MM-DD HH:mm:ss // 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(timestamp) { formatDate(timestamp) {
if (!timestamp) return '' if (!timestamp) return "";
const date = new Date(timestamp) const date = new Date(timestamp);
const year = date.getFullYear() const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0') const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, '0') const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, '0') const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, '0') const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, '0') const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}:${month}:${day} ${hours}:${minutes}:${seconds}` return `${year}:${month}:${day}`;
} },
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -132,7 +132,23 @@ export default { ...@@ -132,7 +132,23 @@ export default {
); );
if (code === 0) { if (code === 0) {
this.giftList = data.list; this.giftList = data.list;
if (!this.nodeId) {
if (data.city) {
this.netList =
this.$lang.locale === "zh"
? [this.userInfo.countryTitleZh, this.userInfo.cityTitleZh]
: [this.userInfo.countryTitleEn, this.userInfo.cityTitleEn];
} else if (data.country == "130") {
this.netList = this.$lang.locale === "zh" ? ["中国"] : ["china"];
} else {
this.netList =
this.$lang.locale === "zh"
? [this.userInfo.countryTitleZh]
: [this.userInfo.countryTitleEn];
}
}
} }
console.log("giftList", this.giftList);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
...@@ -195,6 +211,7 @@ export default { ...@@ -195,6 +211,7 @@ export default {
} }
this.pickerData = data.pickerData; this.pickerData = data.pickerData;
this.pickerValue = data.pickerValue; this.pickerValue = data.pickerValue;
this.$forceUpdate();
}, },
// 选择数据显示 // 选择数据显示
getPickerValue(val) { getPickerValue(val) {
......
...@@ -8,11 +8,17 @@ ...@@ -8,11 +8,17 @@
</view> </view>
<view class="content"> <view class="content">
<view class="content-title" <view class="content-title"
>{{ $lang.lang.integral.headerTitle }}{{ levelInfo.levelName }}</view >{{ $lang.lang.integral.headerTitle
}}{{ levelInfo.levelName }}</view
> >
<view class="content-text"> <view class="content-text">
<view class="text">{{ $lang.lang.integral.spend }} {{ levelInfo.holdScore }}</view> <view class="text"
<view class="text">{{ $lang.lang.integral.available }} {{ levelInfo.usedScore }}</view> >{{ $lang.lang.integral.spend }} {{ levelInfo.usedScore }}</view
>
<view class="text"
>{{ $lang.lang.integral.available }}
{{ levelInfo.holdScore }}</view
>
</view> </view>
<view class="divider"> <view class="divider">
<view class="divider-active" :style="{ width: `${score}%` }"></view> <view class="divider-active" :style="{ width: `${score}%` }"></view>
...@@ -34,12 +40,18 @@ ...@@ -34,12 +40,18 @@
</view> </view>
<view class="main"> <view class="main">
<view class="main-nav"> <view class="main-nav">
<view class="nav-item" :class="{ 'nav-active1': navIndex === 0 }" @click="navIndex = 0">{{ <view
$lang.lang.integral.redeemGifts class="nav-item"
}}</view> :class="{ 'nav-active1': navIndex === 0 }"
<view class="nav-item" :class="{ 'nav-active2': navIndex === 1 }" @click="navIndex = 1">{{ @click="navIndex = 0"
$lang.lang.integral.pointsCampaign >{{ $lang.lang.integral.redeemGifts }}</view
}}</view> >
<view
class="nav-item"
:class="{ 'nav-active2': navIndex === 1 }"
@click="navIndex = 1"
>{{ $lang.lang.integral.pointsCampaign }}</view
>
</view> </view>
<view class="main-content"> <view class="main-content">
<gift v-show="navIndex === 0" :userInfo="userInfo"></gift> <gift v-show="navIndex === 0" :userInfo="userInfo"></gift>
...@@ -51,14 +63,14 @@ ...@@ -51,14 +63,14 @@
</template> </template>
<script> <script>
import dHeader from '../../components/dHeader/index.vue' import dHeader from "../../components/dHeader/index.vue";
import points from './components/points.vue' import points from "./components/points.vue";
import gift from './components/gift.vue' import gift from "./components/gift.vue";
export default { export default {
components: { components: {
dHeader, dHeader,
gift, gift,
points points,
}, },
data() { data() {
return { return {
...@@ -66,38 +78,42 @@ export default { ...@@ -66,38 +78,42 @@ export default {
// 会员信息 // 会员信息
levelInfo: {}, levelInfo: {},
// 会员图标 // 会员图标
levelIcon: '', levelIcon: "",
userInfo: {} userInfo: {},
} };
}, },
computed: { computed: {
score() { score() {
if (this.levelInfo.totalScore) { if (this.levelInfo.totalScore) {
return Math.min( return Math.min(
Math.floor((this.levelInfo.totalScore / this.levelInfo.upperCount) * 100), Math.floor(
(this.levelInfo.totalScore / this.levelInfo.upperCount) * 100
),
100 100
) );
}
return 0
} }
return 0;
},
}, },
created() { created() {
this.getUserInfo() this.getUserInfo();
}, },
methods: { methods: {
toLog(val) { toLog(val) {
const url = val === 1 ? '/pages/log/exchange' : '/pages/log/integral' const url = val === 1 ? "/pages/log/exchange" : "/pages/log/integral";
uni.navigateTo({ url }) uni.navigateTo({ url });
}, },
// 获取个人信息 // 获取个人信息
async getUserInfo() { async getUserInfo() {
try { try {
const { code, data } = await this.$request.get('/app-api/member/user/get') const { code, data } = await this.$request.get(
"/app-api/member/user/get"
);
if (code === 0 && data) { if (code === 0 && data) {
const { userScoreLevelInfo, ...args } = data const { userScoreLevelInfo, ...args } = data;
this.userInfo = args this.userInfo = args;
this.levelIcon = userScoreLevelInfo.levelIcon this.levelIcon = userScoreLevelInfo.levelIcon;
this.getMemberScore(this.$store.getters.id) this.getMemberScore(this.$store.getters.id);
} }
} catch (err) {} } catch (err) {}
}, },
...@@ -107,14 +123,14 @@ export default { ...@@ -107,14 +123,14 @@ export default {
const { code, data } = await this.$request.post( const { code, data } = await this.$request.post(
`/app-api/member/user-score/info?id=${id}`, `/app-api/member/user-score/info?id=${id}`,
{ id } { id }
) );
if (code === 0 && data) { if (code === 0 && data) {
this.levelInfo = data this.levelInfo = data;
} }
} catch (err) {} } catch (err) {}
} },
} },
} };
</script> </script>
<style> <style>
......
<template> <template>
<view> <view>
<dHeader :title="$lang.lang.log.logPoints"></dHeader> <dHeader :title="$lang.lang.log.logExchange"></dHeader>
<view class="container"> <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-title">{{ $lang.lang.log.redeemGifts }}</div>
<div class="item-box"> <div class="item-box">
<div class="box-img"> <div class="box-img">
...@@ -13,7 +18,7 @@ ...@@ -13,7 +18,7 @@
</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>
...@@ -28,57 +33,63 @@ ...@@ -28,57 +33,63 @@
</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('/app-api/reward/redeem/record/list', { const { code, data } = await this.$request.post(
memberId "/app-api/reward/redeem/record/list",
}) {
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 = (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() + " ";
return Y + M + D + h + m + s const h = date.getHours() + ":";
} const m = date.getMinutes() + ":";
} const s = date.getSeconds();
} return Y + M + D + h + m + s;
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
...@@ -102,6 +113,7 @@ page { ...@@ -102,6 +113,7 @@ page {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
border-radius: 16upx; border-radius: 16upx;
background: #ffffff;
box-shadow: 0 2upx 12upx 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2upx 12upx 0 rgba(0, 0, 0, 0.1);
} }
} }
......
<template> <template>
<view> <view>
<dHeader :title="$lang.lang.log.logExchange"></dHeader> <dHeader :title="$lang.lang.log.logPoints"></dHeader>
<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">{{ locale == 'zh' ? item.sourceTypeZh : item.sourceTypeEn }}</div> <div class="item-title">
{{ locale == "zh" ? item.sourceTypeZh : item.sourceTypeEn }}
</div>
<div class="item-box"> <div class="item-box">
<div class="box-img"> <div class="box-img">
<image <image class="imgs" :src="imgArr[item.sourceType]"></image>
class="imgs"
:src="imgArr[item.sourceType]"
></image>
</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">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"> <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">{{ item.operateType }}&ensp;{{ item.scoreCount }}</view> <view class="box-right-text"
>{{ item.operateType }}&ensp;{{ item.scoreCount }}</view
>
</div> </div>
</div> </div>
</view> </view>
...@@ -31,62 +34,68 @@ ...@@ -31,62 +34,68 @@
</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('/app-api/member/user-score/log', { const { code, data } = await this.$request.post(
id "/app-api/member/user-score/log",
}) {
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 = (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() + " ";
return Y + M + D + h + m + s const h = date.getHours() + ":";
} const m = date.getMinutes() + ":";
} const s = date.getSeconds();
} return Y + M + D + h + m + s;
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
...@@ -110,6 +119,7 @@ page { ...@@ -110,6 +119,7 @@ page {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
border-radius: 16upx; border-radius: 16upx;
background: #ffffff;
box-shadow: 0 2upx 12upx 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2upx 12upx 0 rgba(0, 0, 0, 0.1);
} }
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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