Commit 5d61c4ff authored by chenwei's avatar chenwei

Merge branch 'feature' into 'dev'

rewards list  change hierarchy of data

See merge request !3
parents 351451c4 72c3329a
...@@ -5,7 +5,12 @@ ...@@ -5,7 +5,12 @@
<view class="select-list"> <view class="select-list">
<view class="list-item" v-for="(item, index) in netList" :key="index" <view class="list-item" v-for="(item, index) in netList" :key="index"
>{{ item }} >{{ item }}
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons> <uni-icons
class="list-icon"
type="right"
color="#B3B3B3"
size="12"
></uni-icons>
</view> </view>
</view> </view>
<view class="select-right"> <view class="select-right">
...@@ -18,12 +23,22 @@ ...@@ -18,12 +23,22 @@
@columnchange="bindColumnChange" @columnchange="bindColumnChange"
> >
{{ $lang.lang.integral.outlets }} {{ $lang.lang.integral.outlets }}
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons> <uni-icons
class="list-icon"
type="right"
color="#B3B3B3"
size="12"
></uni-icons>
</picker> </picker>
</view> </view>
</view> </view>
<view class="gift-content"> <view class="gift-content">
<view class="gift-item" v-for="item in giftList" :key="item.id" @click="toMail(item.id)"> <view
class="gift-item"
v-for="item in giftList"
:key="item.id"
@click="toMail(item.id)"
>
<view class="gift-image-box"> <view class="gift-image-box">
<image <image
class="gift-image" class="gift-image"
...@@ -32,17 +47,27 @@ ...@@ -32,17 +47,27 @@
></image> ></image>
<view class="gift-tag"> <view class="gift-tag">
<view class="tags"> <view class="tags">
<image class="tag-image" src="../../../static/img/score.png"></image> <image
class="tag-image"
src="../../../static/img/score.png"
></image>
<view class="tag-text">{{ item.pointsRequire }}</view> <view class="tag-text">{{ item.pointsRequire }}</view>
</view> </view>
</view> </view>
<view class="foot-tag">{{ $lang.lang.integral.remainder(item.quantityRemain) }}</view> <view class="foot-tag">{{
$lang.lang.integral.remainder(item.quantityRemain)
}}</view>
</view> </view>
<view class="gift-name">{{ locale === 'zh' ? item.titleZh : item.titleEn }}</view> <view class="gift-name">{{
locale === "zh" ? item.titleZh : item.titleEn
}}</view>
<view class="gift-menu"> <view class="gift-menu">
<view class="gift-menu-text" v-for="ele in item.pickMethodList" :key="ele.id">{{ <view
locale === 'zh' ? ele.labelZh : ele.labelEn class="gift-menu-text"
}}</view> v-for="ele in item.pickMethodList"
:key="ele.id"
>{{ locale === "zh" ? ele.labelZh : ele.labelEn }}</view
>
</view> </view>
</view> </view>
</view> </view>
...@@ -54,8 +79,8 @@ export default { ...@@ -54,8 +79,8 @@ export default {
props: { props: {
userInfo: { userInfo: {
type: Object, type: Object,
default: () => {} default: () => {},
} },
}, },
data() { data() {
return { return {
...@@ -64,119 +89,125 @@ export default { ...@@ -64,119 +89,125 @@ export default {
pickerData: [[], [], []], pickerData: [[], [], []],
pickerValue: [0, 0, 0], pickerValue: [0, 0, 0],
nodeId: null, nodeId: null,
netList: [] netList: [],
} };
}, },
computed: { computed: {
locale() { locale() {
return this.$lang.locale return this.$lang.locale;
} },
}, },
watch: { watch: {
userInfo: { userInfo: {
handler(val) { handler(val) {
console.log(val) console.log(val);
this.netList = this.netList =
this.$lang.locale === 'zh' this.$lang.locale === "zh"
? [val.countryTitleZh, val.cityTitleZh] ? [val.countryTitleZh, val.cityTitleZh]
: [val.countryTitleEn, val.cityTitleEn] : [val.countryTitleEn, val.cityTitleEn];
}, },
immediate: true immediate: true,
} },
}, },
created() { created() {
this.getGift() this.getGift();
this.getNet() this.getNet();
}, },
methods: { methods: {
toMail(id) { toMail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/order_mail/order_mail?id=' + id url: "/pages/order_mail/order_mail?id=" + id,
}) });
}, },
// 获取礼品列表 // 获取礼品列表
async getGift() { async getGift() {
try { try {
const memberId = this.$store.getters.id const memberId = this.$store.getters.id;
const { code, data } = await this.$request.post('/app-api/ecw/reward/list', { const { code, data } = await this.$request.post(
memberId, "/app-api/ecw/reward/list",
nodeId: this.nodeId {
}) memberId,
nodeId: this.nodeId,
}
);
if (code === 0) { if (code === 0) {
this.giftList = data this.giftList = data.list;
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error);
} }
}, },
// 获取网点列表 // 获取网点列表
async getNet() { async getNet() {
try { try {
const { code, data } = await this.$request.get('/admin-api/ecw/node/get-node-tree-region') const { code, data } = await this.$request.get(
"/admin-api/ecw/node/get-node-tree-region"
);
if (code === 0) { if (code === 0) {
this.data = data this.data = data;
this.initPickerData() this.initPickerData();
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error);
} }
}, },
// 初始化选择器数据 // 初始化选择器数据
initPickerData() { initPickerData() {
if (this.data.length === 0) return if (this.data.length === 0) return;
const countries = this.data const countries = this.data;
const cities = this.data[0].children || [] const cities = this.data[0].children || [];
const areas = (this.data[0].children && this.data[0].children[0].children) || [] const areas =
this.pickerData[0] = countries (this.data[0].children && this.data[0].children[0].children) || [];
this.pickerData[1] = cities this.pickerData[0] = countries;
this.pickerData[2] = areas this.pickerData[1] = cities;
this.pickerData[2] = areas;
}, },
// 选择改变 // 选择改变
bindPickerChange(e) { bindPickerChange(e) {
const val = e.detail.value const val = e.detail.value;
this.pickerValue = val this.pickerValue = val;
this.nodeId = this.pickerData[2][val[2]].id this.nodeId = this.pickerData[2][val[2]].id;
this.getGift() this.getGift();
this.getPickerValue(val) this.getPickerValue(val);
}, },
// 列改变 // 列改变
bindColumnChange(e) { bindColumnChange(e) {
const { column, value } = e.detail const { column, value } = e.detail;
const data = { const data = {
pickerData: this.pickerData, pickerData: this.pickerData,
pickerValue: this.pickerValue pickerValue: this.pickerValue,
} };
data.pickerValue[column] = value data.pickerValue[column] = value;
if (column === 0) { if (column === 0) {
const selectedCountry = this.data[value] const selectedCountry = this.data[value];
const cities = selectedCountry.children || [] const cities = selectedCountry.children || [];
const areas = (cities[0] && cities[0].children) || [] const areas = (cities[0] && cities[0].children) || [];
data.pickerData[1] = cities data.pickerData[1] = cities;
data.pickerData[2] = areas data.pickerData[2] = areas;
data.pickerValue[1] = 0 data.pickerValue[1] = 0;
data.pickerValue[2] = 0 data.pickerValue[2] = 0;
} else if (column === 1) { } else if (column === 1) {
const selectedCountry = this.data[data.pickerValue[0]] const selectedCountry = this.data[data.pickerValue[0]];
const selectedCity = selectedCountry.children[value] const selectedCity = selectedCountry.children[value];
const areas = selectedCity.children || [] const areas = selectedCity.children || [];
data.pickerData[2] = areas data.pickerData[2] = areas;
data.pickerValue[2] = 0 data.pickerValue[2] = 0;
} }
this.pickerData = data.pickerData this.pickerData = data.pickerData;
this.pickerValue = data.pickerValue this.pickerValue = data.pickerValue;
}, },
// 选择数据显示 // 选择数据显示
getPickerValue(val) { getPickerValue(val) {
const countries = this.pickerData[0][val[0]] const countries = this.pickerData[0][val[0]];
const cities = this.pickerData[1][val[1]] const cities = this.pickerData[1][val[1]];
const areas = this.pickerData[2][val[2]] const areas = this.pickerData[2][val[2]];
this.netList = this.netList =
this.locale === 'zh' this.locale === "zh"
? [countries.labelZh, cities.labelZh, areas.labelZh] ? [countries.labelZh, cities.labelZh, areas.labelZh]
: [countries.labelEn, cities.labelEn, areas.labelEn] : [countries.labelEn, cities.labelEn, areas.labelEn];
} },
} },
} };
</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