|
|
@ -2,23 +2,22 @@
|
|
|
|
<view class="wrap">
|
|
|
|
<view class="wrap">
|
|
|
|
<view class="top">
|
|
|
|
<view class="top">
|
|
|
|
<view class="item">
|
|
|
|
<view class="item">
|
|
|
|
<view class="left">收货人:</view>
|
|
|
|
<view class="left">收货人</view>
|
|
|
|
<input type="text" placeholder-class="line" placeholder="请填写收货人姓名" />
|
|
|
|
<input type="text" v-model="address.userName" placeholder-class="line" placeholder="请填写收货人姓名" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="item">
|
|
|
|
<view class="item">
|
|
|
|
<view class="left">手机号码:</view>
|
|
|
|
<view class="left">手机号码</view>
|
|
|
|
<input type="text" placeholder-class="line" placeholder="请填写收货人手机号" />
|
|
|
|
<input type="text" v-model="address.phone" placeholder-class="line" placeholder="请填写收货人手机号" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="item" @confirm='confirm' @tap="showRegionPicker">
|
|
|
|
<view class="item" @confirm='confirm' @tap="showRegionPicker">
|
|
|
|
<view class="left">所在地区:</view>
|
|
|
|
<view class="left">所在地区:</view>
|
|
|
|
<input disabled style="width: 100%;" v-model="finalAddress" type="text" :placeholder-class="line"
|
|
|
|
<input disabled style="width: 100%;" v-model="address.area" type="text" :placeholder-class="line"
|
|
|
|
placeholder="省市区县、乡镇等" />
|
|
|
|
placeholder="省市区县、乡镇等" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="item address">
|
|
|
|
<view class="item address">
|
|
|
|
<view class="left">详细地址:</view>
|
|
|
|
<view class="left">详细地址</view>
|
|
|
|
<textarea type="text" placeholder-class="line" placeholder="街道、楼牌等" />
|
|
|
|
<textarea type="text" v-model="address.address" placeholder-class="line" placeholder="街道、楼牌等" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="bottom">
|
|
|
|
<view class="bottom">
|
|
|
|
<view class="default">
|
|
|
|
<view class="default">
|
|
|
@ -32,7 +31,7 @@
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-picker v-model="show" mode="region" ref="uPicker" @confirm="confirm"></u-picker>
|
|
|
|
<u-picker v-model="show" mode="region" ref="uPicker" @confirm="confirm"></u-picker>
|
|
|
|
<u-button :custom-style="customStyle" type="warning">提交</u-button>
|
|
|
|
<u-button @click="addBtn" :custom-style="customStyle" type="warning">提交</u-button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
@ -41,25 +40,42 @@
|
|
|
|
reactive,
|
|
|
|
reactive,
|
|
|
|
ref
|
|
|
|
ref
|
|
|
|
} from 'vue'
|
|
|
|
} from 'vue'
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
addAddressApi
|
|
|
|
|
|
|
|
} from '../../api/user.js'
|
|
|
|
|
|
|
|
const show = ref(false)
|
|
|
|
|
|
|
|
const finalAddress = ref('')
|
|
|
|
const customStyle = reactive({
|
|
|
|
const customStyle = reactive({
|
|
|
|
margin: '20px', // 注意驼峰命名,并且值必须用引号包括,因为这是对象
|
|
|
|
margin: '20px', // 注意驼峰命名,并且值必须用引号包括,因为这是对象
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const finalAddress = ref('')
|
|
|
|
const setDefault = (dom) => {
|
|
|
|
const show = ref(false)
|
|
|
|
console.log(dom)
|
|
|
|
|
|
|
|
//设置默认地址
|
|
|
|
const setDefault = () => {}
|
|
|
|
dom.detail.value ? address.status = '1' : address.status = '0'
|
|
|
|
|
|
|
|
}
|
|
|
|
const showRegionPicker = () => {
|
|
|
|
const showRegionPicker = () => {
|
|
|
|
show.value = true;
|
|
|
|
show.value = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const confirm = (e) => {
|
|
|
|
const confirm = (e) => {
|
|
|
|
console.log(e)
|
|
|
|
console.log(e)
|
|
|
|
finalAddress.value = e.province.name + '/' + e.city.name + '/' + e.area.name
|
|
|
|
address.area = e.province.name + '/' + e.city.name + '/' + e.area.name
|
|
|
|
console.log(finalAddress.value)
|
|
|
|
console.log(address.area)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const changeAddress = () => {
|
|
|
|
//表单绑定的数据
|
|
|
|
|
|
|
|
const address = reactive({
|
|
|
|
|
|
|
|
addressId: '',
|
|
|
|
|
|
|
|
openid: uni.getStorageSync('openid'),
|
|
|
|
|
|
|
|
userName: "",
|
|
|
|
|
|
|
|
phone: '',
|
|
|
|
|
|
|
|
area: '',
|
|
|
|
|
|
|
|
address: '',
|
|
|
|
|
|
|
|
status: '0'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
//提交
|
|
|
|
|
|
|
|
const addBtn = async () => {
|
|
|
|
|
|
|
|
console.log(address)
|
|
|
|
|
|
|
|
let res = await addAddressApi(address)
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|