|
@@ -102,7 +102,8 @@
|
|
|
},
|
|
|
onLoad: function(e) {
|
|
|
const that = this;
|
|
|
- that.$set(that, `id`, e && e.id || '');
|
|
|
+ that.$set(that, `id`, e.id || '635f13fc42e87c7a2880ed52');
|
|
|
+ that.searchPor();
|
|
|
that.watchLogin();
|
|
|
},
|
|
|
onShow: function() {
|
|
@@ -114,7 +115,6 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- onUnload: function() {},
|
|
|
methods: {
|
|
|
// 监听用户是否登录
|
|
|
watchLogin() {
|
|
@@ -128,6 +128,10 @@
|
|
|
if (that.id) {
|
|
|
let arr = await that.$api(`/address/${that.id}`, 'GET')
|
|
|
if (arr.errcode == '0') {
|
|
|
+ let index = that.provinceList.findIndex((i) => i.name == arr.data.province);
|
|
|
+ if (index) {
|
|
|
+ that.proChange(parseFloat(index));
|
|
|
+ }
|
|
|
that.$set(that, `form`, arr.data)
|
|
|
}
|
|
|
} else {
|
|
@@ -137,7 +141,7 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- that.searchPor();
|
|
|
+
|
|
|
},
|
|
|
fail: function(err) {
|
|
|
uni.reLaunch({
|
|
@@ -198,8 +202,15 @@
|
|
|
// 选择省份
|
|
|
proChange(e) {
|
|
|
const that = this;
|
|
|
- let data = that.provinceList[e.detail.value];
|
|
|
+ let index = 0;
|
|
|
+ if (e && e.detail && e.detail.value) index = e.detail.value
|
|
|
+ else index = e;
|
|
|
+ let data = that.provinceList[index];
|
|
|
if (data) {
|
|
|
+ if (that.id) {
|
|
|
+ that.$set(that.form, `city`, '');
|
|
|
+ that.$set(that.form, `area`, '');
|
|
|
+ }
|
|
|
that.$set(that.form, `province`, data.name);
|
|
|
that.$set(that, `cityList`, data.city)
|
|
|
}
|
|
@@ -209,6 +220,9 @@
|
|
|
const that = this;
|
|
|
let data = that.cityList[e.detail.value];
|
|
|
if (data) {
|
|
|
+ if (that.id) {
|
|
|
+ that.$set(that.form, `area`, '');
|
|
|
+ }
|
|
|
that.$set(that.form, `city`, data.name);
|
|
|
that.$set(that, `areaList`, data.area);
|
|
|
}
|