Commit a77cf605 authored by chenwei's avatar chenwei

变更提货点接口

parent e8258cbd
......@@ -5,12 +5,7 @@
<view class="select-list">
<view class="list-item" v-for="(item, index) in netList" :key="index"
>{{ 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 class="select-right">
......@@ -23,22 +18,12 @@
@columnchange="bindColumnChange"
>
{{ $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>
</view>
</view>
<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">
<image
class="gift-image"
......@@ -47,27 +32,17 @@
></image>
<view class="gift-tag">
<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>
</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 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-text"
v-for="ele in item.pickMethodList"
:key="ele.id"
>{{ locale === "zh" ? ele.labelZh : ele.labelEn }}</view
>
<view class="gift-menu-text" v-for="ele in item.pickMethodList" :key="ele.id">{{
locale === 'zh' ? ele.labelZh : ele.labelEn
}}</view>
</view>
</view>
</view>
......@@ -79,8 +54,8 @@ export default {
props: {
userInfo: {
type: Object,
default: () => {},
},
default: () => {}
}
},
data() {
return {
......@@ -89,142 +64,138 @@ export default {
pickerData: [[], [], []],
pickerValue: [0, 0, 0],
nodeId: null,
netList: [],
};
netList: []
}
},
computed: {
locale() {
return this.$lang.locale;
},
return this.$lang.locale
}
},
watch: {
userInfo: {
handler(val) {
console.log(val);
console.log(val)
this.netList =
this.$lang.locale === "zh"
this.$lang.locale === 'zh'
? [val.countryTitleZh, val.cityTitleZh]
: [val.countryTitleEn, val.cityTitleEn];
: [val.countryTitleEn, val.cityTitleEn]
},
immediate: true,
},
immediate: true
}
},
created() {
this.getGift();
this.getNet();
this.getGift()
this.getNet()
},
methods: {
toMail(id) {
uni.navigateTo({
url: "/pages/order_mail/order_mail?id=" + id,
});
url: '/pages/order_mail/order_mail?id=' + id
})
},
// 获取礼品列表
async getGift() {
try {
const memberId = this.$store.getters.id;
const { code, data } = await this.$request.post(
"/app-api/ecw/reward/list",
{
memberId,
nodeId: this.nodeId,
}
);
const memberId = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/ecw/reward/list', {
memberId,
nodeId: this.nodeId
})
if (code === 0) {
this.giftList = data.list;
this.giftList = data.list
if (!this.nodeId) {
if (data.city) {
this.netList =
this.$lang.locale === "zh"
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"];
: [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.$lang.locale === 'zh'
? [this.userInfo.countryTitleZh]
: [this.userInfo.countryTitleEn];
: [this.userInfo.countryTitleEn]
}
}
}
console.log("giftList", this.giftList);
console.log('giftList', this.giftList)
} catch (error) {
console.log(error);
console.log(error)
}
},
// 获取网点列表
async getNet() {
try {
const { code, data } = await this.$request.get(
"/admin-api/ecw/node/get-node-tree-region"
);
'/admin-api/member/score-rule/warehouse-tree-region-list'
)
if (code === 0) {
this.data = data;
this.initPickerData();
this.data = data
this.initPickerData()
}
} catch (error) {
console.log(error);
console.log(error)
}
},
// 初始化选择器数据
initPickerData() {
if (this.data.length === 0) return;
const countries = this.data;
const cities = this.data[0].children || [];
const areas =
(this.data[0].children && this.data[0].children[0].children) || [];
this.pickerData[0] = countries;
this.pickerData[1] = cities;
this.pickerData[2] = areas;
if (this.data.length === 0) return
const countries = this.data
const cities = this.data[0].children || []
const areas = (this.data[0].children && this.data[0].children[0].children) || []
this.pickerData[0] = countries
this.pickerData[1] = cities
this.pickerData[2] = areas
},
// 选择改变
bindPickerChange(e) {
const val = e.detail.value;
this.pickerValue = val;
this.nodeId = this.pickerData[2][val[2]].id;
this.getGift();
this.getPickerValue(val);
const val = e.detail.value
this.pickerValue = val
this.nodeId = this.pickerData[2][val[2]].id
this.getGift()
this.getPickerValue(val)
},
// 列改变
bindColumnChange(e) {
const { column, value } = e.detail;
const { column, value } = e.detail
const data = {
pickerData: this.pickerData,
pickerValue: this.pickerValue,
};
data.pickerValue[column] = value;
pickerValue: this.pickerValue
}
data.pickerValue[column] = value
if (column === 0) {
const selectedCountry = this.data[value];
const cities = selectedCountry.children || [];
const areas = (cities[0] && cities[0].children) || [];
data.pickerData[1] = cities;
data.pickerData[2] = areas;
data.pickerValue[1] = 0;
data.pickerValue[2] = 0;
const selectedCountry = this.data[value]
const cities = selectedCountry.children || []
const areas = (cities[0] && cities[0].children) || []
data.pickerData[1] = cities
data.pickerData[2] = areas
data.pickerValue[1] = 0
data.pickerValue[2] = 0
} else if (column === 1) {
const selectedCountry = this.data[data.pickerValue[0]];
const selectedCity = selectedCountry.children[value];
const areas = selectedCity.children || [];
data.pickerData[2] = areas;
data.pickerValue[2] = 0;
const selectedCountry = this.data[data.pickerValue[0]]
const selectedCity = selectedCountry.children[value]
const areas = selectedCity.children || []
data.pickerData[2] = areas
data.pickerValue[2] = 0
}
this.pickerData = data.pickerData;
this.pickerValue = data.pickerValue;
this.$forceUpdate();
this.pickerData = data.pickerData
this.pickerValue = data.pickerValue
this.$forceUpdate()
},
// 选择数据显示
getPickerValue(val) {
const countries = this.pickerData[0][val[0]];
const cities = this.pickerData[1][val[1]];
const areas = this.pickerData[2][val[2]];
const countries = this.pickerData[0][val[0]]
const cities = this.pickerData[1][val[1]]
const areas = this.pickerData[2][val[2]]
this.netList =
this.locale === "zh"
this.locale === 'zh'
? [countries.labelZh, cities.labelZh, areas.labelZh]
: [countries.labelEn, cities.labelEn, areas.labelEn];
},
},
};
: [countries.labelEn, cities.labelEn, areas.labelEn]
}
}
}
</script>
<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