| | |
| | | <template> |
| | | <!-- 收获地址列表 --> |
| | | <!-- 收货地址列表 --> |
| | | <view class="p15 container-address"> |
| | | <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> |
| | | |
| | |
| | | <view class="tel">{{ item.tel || '-' }}</view> |
| | | </view> |
| | | <view class="address"> |
| | | {{ item['province'] || '' }}{{ item['city'] && ('/' + item['city']) || '' }}{{ |
| | | item['region'] && ('/' + item['region']) || '' |
| | | }} |
| | | </view> |
| | | <view class="address"> |
| | | {{ item.address }} |
| | | |
| | | </view> |
| | | </view> |
| | | <!-- <view class="h-line"></view> --> |
| | |
| | | <view style="height: 92rpx;width: 690rpx;"> |
| | | |
| | | </view> |
| | | <view class="button-green button-fixed-bottom" style="width: 690rpx;line-height: 92rpx;height: 92rpx;" @click=" ()=>{ |
| | | delete this.submitForm.id |
| | | this.submitForm['name'] = '' |
| | | this.submitForm['tel'] = '' |
| | | this.submitForm['tel'] = '' |
| | | this.submitForm['area'] = '' |
| | | |
| | | openAddressForm() |
| | | }">添加收货地址 |
| | | <view class="button-green button-fixed-bottom" style="width: 690rpx;line-height: 92rpx;height: 92rpx;" |
| | | @click="addAddress">添加收货地址 |
| | | </view> |
| | | |
| | | <uni-popup ref="popup_form" type="top" :mask-click="false"> |
| | |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="form-item-label require"> |
| | | 收获地址 |
| | | 手机号 |
| | | </view> |
| | | <view class="form-item-value"> |
| | | <input v-model="submitForm.tel" placeholder="请输入收货人手机号" class="form-input"></input> |
| | | </view> |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="form-item-label require"> |
| | | 收货地址 |
| | | </view> |
| | | <view class="m-l-a m-r-0 flex " :class="[!dto['province']?'desc-gray':'']"> |
| | | <uni-data-picker :area="true" @change="(e)=>{PickArea(submitForm,e)}" placeholder="" |
| | |
| | | <u-icon class="m-l-a" name="arrow-right"></u-icon> |
| | | </view> |
| | | |
| | | <!-- <view class="form-item-value" @click="chooseLocation">--> |
| | | <!-- <input v-model="submitForm.room" placeholder="请选择收获地址" disabled class="form-input"></input>--> |
| | | <!-- <!– 点击定位 –>--> |
| | | <!-- </view>--> |
| | | |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="form-item-label require"> |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | addAddress() { |
| | | delete this.submitForm.id |
| | | this.submitForm['name'] = '' |
| | | this.submitForm['tel'] = '' |
| | | this.submitForm['address'] = '' |
| | | this.submitForm['province'] = '' |
| | | this.submitForm['city'] = '' |
| | | this.submitForm['region'] = '' |
| | | this.submitForm['isDefault'] = false |
| | | this.openAddressForm() |
| | | }, |
| | | PickArea(item, e) { |
| | | console.log('PickArea', item, e) |
| | | if (e.detail.value) { |
| | |
| | | this.$message.showLoading() |
| | | var { |
| | | code |
| | | } = await this.$http.request('post', '/api/address/set/default/'+item.id, { |
| | | } = await this.$http.request('post', '/api/address/set/default/' + item |
| | | .id, { |
| | | data:{ |
| | | id:item.id |
| | | }, |
| | |
| | | } |
| | | }, err => { |
| | | this.$nextTick(() => { |
| | | this.list[index].defaulted = false |
| | | this.list[index].isDefault = false |
| | | this.$forceUpdate() |
| | | console.log('err', err, this.list[index]) |
| | | }) |
| | |
| | | }) |
| | | }, |
| | | async selectAddress(item) { |
| | | await this.$message.confirm('确定选择此地址作为收获地址吗') |
| | | await this.$message.confirm('确定选择此地址作为收货地址吗') |
| | | //携带,然后返回 |
| | | this.$store.commit('setDefaultAddress', { |
| | | ...item |
| | |
| | | this.$message.hideLoading() |
| | | if (code === 0) { |
| | | this.$message.showToast('删除成功') |
| | | if (item.isDefault) { |
| | | //要清空地址了 |
| | | this.$store.commit('setDefaultAddress', {}) |
| | | } |
| | | setTimeout(() => { |
| | | this.page.current = 1 |
| | | this.getList() |
| | |
| | | if (code === 0) { |
| | | this.$refs.popup_form.close() |
| | | this.$message.showToast(this.submitForm.id ? '修改成功' : '新增成功') |
| | | |
| | | let tmp = this |
| | | setTimeout(() => { |
| | | this.page.current = 1 |
| | | this.getList() |
| | | tmp.page.current = 1 |
| | | tmp.refreshList() |
| | | }, 300) |
| | | } |
| | | }, |