| | |
| | | <view class="list-item"> |
| | | <view class="list-item-label">联系电话</view> |
| | | <view class="list-item-input"> |
| | | <input type="text" placeholder="请输入联系电话" v-model="form.phone" /> |
| | | <input type="text" placeholder="请输入联系电话" v-model="form.phone" maxlength="11" /> |
| | | </view> |
| | | </view> |
| | | <view class="list-item" @click="show = true"> |
| | |
| | | onLoad() { |
| | | const item = uni.getStorageSync('addr'); |
| | | if (item) { |
| | | console.log(item,"============================") |
| | | this.type = 2 |
| | | uni.setNavigationBarTitle({ |
| | | title: '编辑收货地址' |
| | |
| | | this.form.phone = item.phone |
| | | this.form.addr = item.addr |
| | | this.form.areaId = item.areaId |
| | | this.form.areaName = item.areaDetail |
| | | this.form.latitude=item.latitude |
| | | this.form.longitude = item.longitude |
| | | this.form.areaName = (item.provinceName||'') + (item.cityName||'')+(item.districtName||'') |
| | | this.form.isDefault = Number(item.isDefault) |
| | | uni.removeStorageSync('addr'); |
| | | } |
| | |
| | | chooseLocation() { |
| | | uni.chooseLocation({ |
| | | success: (res) => { |
| | | this.form.addr = res.name |
| | | console.log(res,"============================") |
| | | this.form.addr = res.address |
| | | this.form.latitude = res.latitude |
| | | this.form.longitude = res.longitude |
| | | }, |
| | |
| | | title: '联系电话不能为空!', |
| | | icon: 'none' |
| | | }) |
| | | const phoneReg = /^1\d{10}$/ |
| | | if (!phoneReg.test(this.form.phone)) { |
| | | return uni.showToast({ |
| | | title: '请输入正确的手机号格式', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | if (!this.form.areaName) return uni.showToast({ |
| | | title: '所在地区不能为空!', |
| | | icon: 'none' |