Commit a0868f00c244a5dc0dc01977a444e2edd428ac95
1 parent
a9707d2d
Exists in
master
and in
1 other branch
fix: 下单地址优化
Showing
2 changed files
with
11 additions
and
5 deletions
Show diff stats
pages/global/search-address.vue
| ... | ... | @@ -12,12 +12,12 @@ |
| 12 | 12 | <template v-if="list.length === 0 && hisList.length > 0"> |
| 13 | 13 | <view class="search-history">历史地址</view> |
| 14 | 14 | <template v-for="(item, index) in hisList"> |
| 15 | - <zui-cell :key="index" :title="item.address" :label="`${item.cityName}${item.areaName}`" @click="onSelect(item, index)"></zui-cell> | |
| 15 | + <zui-cell :key="index" :title="item.address" :label="`${item.cityName}${item.areaName}`" @click="onSelect(item)"></zui-cell> | |
| 16 | 16 | </template> |
| 17 | 17 | </template> |
| 18 | 18 | <List ref="list" v-model="list" :api="searchAPI"> |
| 19 | 19 | <template v-for="(item, index) in list"> |
| 20 | - <zui-cell :key="index" :title="item.name" :label="`${item.cityName}${item.areaName}${item.address}`" @click="onSelect(item, index)"></zui-cell> | |
| 20 | + <zui-cell :key="index" :title="item.name" :label="`${item.cityName}${item.areaName}${item.address}`" @click="onSelect(item, true)"></zui-cell> | |
| 21 | 21 | </template> |
| 22 | 22 | <template #empty> |
| 23 | 23 | <view v-if="hisList.length > 0"></view> |
| ... | ... | @@ -109,7 +109,13 @@ export default { |
| 109 | 109 | }); |
| 110 | 110 | }); |
| 111 | 111 | }, |
| 112 | - onSelect(item) { | |
| 112 | + onSelect(item, append = false) { | |
| 113 | + if (append) { | |
| 114 | + item = { | |
| 115 | + ...item, | |
| 116 | + address: (item.provinceName || '') + (item.cityName || '') + (item.areaName || '') + item.address, | |
| 117 | + }; | |
| 118 | + } | |
| 113 | 119 | uni.$emit('select-detail', item); |
| 114 | 120 | uni.navigateBack(); |
| 115 | 121 | }, |
| ... | ... | @@ -139,7 +145,7 @@ export default { |
| 139 | 145 | areaName: addressComponent.district, |
| 140 | 146 | address: addressInfo.address, |
| 141 | 147 | }; |
| 142 | - this.onSelect(location); | |
| 148 | + this.onSelect(location, true); | |
| 143 | 149 | }, |
| 144 | 150 | }); |
| 145 | 151 | // let location = { | ... | ... |
pages/order/add.vue
| ... | ... | @@ -430,7 +430,7 @@ export default { |
| 430 | 430 | cityName: location.cityName, |
| 431 | 431 | areaCode: location.areaCode, |
| 432 | 432 | areaName: location.areaName, |
| 433 | - address: (location.provinceName || '') + (location.cityName || '') + (location.areaName || '') + (location.address || ''), | |
| 433 | + address: location.address || '', | |
| 434 | 434 | }; |
| 435 | 435 | let waypoints = index === 0 ? [station, this.form.waypoints[1]] : [this.form.waypoints[0], station]; |
| 436 | 436 | this.form = { | ... | ... |