Commit b05cb379 authored by Damon's avatar Damon

Merge branch 'dev-1.5.0' into test

parents 267bcc6a 952a9d6e
...@@ -278,7 +278,7 @@ export default { ...@@ -278,7 +278,7 @@ export default {
provinceName: this.region[0], provinceName: this.region[0],
cityName: this.region[1], cityName: this.region[1],
districtName: this.region[2], districtName: this.region[2],
address: this.region.join("") + this.address address: this.address
}; };
let res = await this.$u.api.updateAddress(params); let res = await this.$u.api.updateAddress(params);
if (res && res.code == 200) { if (res && res.code == 200) {
...@@ -300,7 +300,7 @@ export default { ...@@ -300,7 +300,7 @@ export default {
provinceName: this.region[0], provinceName: this.region[0],
cityName: this.region[1], cityName: this.region[1],
districtName: this.region[2], districtName: this.region[2],
address: this.region.join("") + this.address address: this.address
}; };
if (this.id) params.id = this.id if (this.id) params.id = this.id
let res = await this.$u.api.saveMyAddress(params); let res = await this.$u.api.saveMyAddress(params);
......
...@@ -61,16 +61,14 @@ export default { ...@@ -61,16 +61,14 @@ export default {
getMineSite() { getMineSite() {
this.$u.api.getMyAddress().then((res) => { this.$u.api.getMyAddress().then((res) => {
const data = res.data const data = res.data
if (data.length > 0) { this.lists = data.length > 0 ? data.map(v => {
this.lists = data.map(v => { let region = []
let region = [] if(v.provinceName && v.cityName && v.districtName) {
if(v.provinceName && v.cityName && v.districtName) { region = [v.provinceName, v.cityName, v.districtName]
region = [v.provinceName, v.cityName, v.districtName] }
} v.region = region
v.region = region return v
return v }) : []
})
}
}) })
}, },
toAddSite() { toAddSite() {
......
...@@ -40,14 +40,17 @@ ...@@ -40,14 +40,17 @@
<view class="more" @click="toAddress">更多地址></view> <view class="more" @click="toAddress">更多地址></view>
</view> </view>
<view class="body"> <view class="body">
<w-address :info="addressInfo" @editSite="editSite" @selectSite="editSite" siteType="view" /> <w-address v-if="addressInfo.id" :info="addressInfo" @editSite="editSite" @selectSite="editSite" siteType="view" />
<view class="u-flex-col u-col-center list" v-if="!addressInfo.id">
<button class="add-button" plain="true" @click="$u.throttle(toAddSite, 500)">填写地址</button>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="bottom"> <view class="bottom">
<u-button shape="circle" :disabled="isEmptyParts && $u.test.isEmpty(remark)" <u-button shape="circle" :disabled="isEmptyParts && $u.test.isEmpty(remark)"
:hair-line="false" :custom-style="customStyle" :hair-line="false" :custom-style="customStyle"
hover-class="none" @click="submitParts">提交</u-button> hover-class="none" @click="$u.throttle(submitParts, 500)">提交</u-button>
</view> </view>
</view> </view>
</template> </template>
...@@ -98,6 +101,11 @@ export default { ...@@ -98,6 +101,11 @@ export default {
this.applyType = e && Number(e.applyType) || 0 this.applyType = e && Number(e.applyType) || 0
this.initData() this.initData()
}, },
onShow() {
if (!this.addressInfo.id) {
this.loadAddress()
}
},
methods: { methods: {
initData() { initData() {
this.loadAddress() this.loadAddress()
...@@ -145,6 +153,14 @@ export default { ...@@ -145,6 +153,14 @@ export default {
} }
}) })
}, },
toAddSite() {
this.$u.route({
url: 'pages/mine/address/addSite',
params: {
type: 'select'
}
})
},
toAddress() { toAddress() {
this.$u.route({ this.$u.route({
url: "pages/parts/address" url: "pages/parts/address"
......
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