购物车逻辑完善

个人信息存储优化
团购下单
This commit is contained in:
2024-03-31 03:19:19 +08:00
parent 074b0057da
commit 1fc0aa432b
17 changed files with 316 additions and 166 deletions

View File

@@ -2,20 +2,21 @@
<view class='content'>
<view class='c-flex-row'>
<text>收货人</text>
<input placeholder='请输入收货人姓名' />
<input placeholder='请输入收货人姓名' @input='bindConsignee' />
</view>
<view class='divider' />
<view class='c-flex-row'>
<text>手机号</text>
<input placeholder='请输入收货人手机号' maxlength='11' />
<input placeholder='请输入收货人手机号' @input='bindMobile' :maxlength='11' />
</view>
<view class='divider' />
<view class='c-flex-row detail-row'>
<text>详细地址</text>
<view class='c-flex-column'>
<textarea placeholder='详细地址:如街道、门牌\n号、楼栋号、单元室等' />
<textarea placeholder='详细地址:如街道、门牌\n号、楼栋号、单元室等'
@input='bindAddress' />
<view class='tips-view c-flex-row'>
<image :src='assetsUrl("ic_tips.png")' />
<text>记得完善门牌号</text>
@@ -27,7 +28,8 @@
<view class='c-flex-column'>
<text style='width: auto'>设为默认地址</text>
<text style='width: auto'>提醒每次下单会默认推荐使用该地址</text>
<switch color='#F32B2B' />
<!-- @change='ev=>{params.defaultstatus = ev.detail.value}'-->
<switch color='#F32B2B' @change='bindStatus' />
</view>
<view class='bottom-button-view'>
@@ -41,16 +43,40 @@
import { assetsUrl } from '@/utils/assets';
import { addressCreate } from '@/api/user';
const params = ref<{
name: string,
mobile: string,
zonecode: string,
addr: string,
defaultstatus: number
}>({
name: '',
mobile: '',
zonecode: '',
addr: '',
defaultstatus: 0
});
const bindConsignee = (e: any) => {
params.value.name = e.detail.value;
};
const bindMobile = (e: any) => {
params.value.mobile = e.detail.value;
};
const bindAddress = (e: any) => {
params.value.addr = e.detail.value;
};
const bindStatus = (e: any) => {
params.value.defaultstatus = e.detail.value == true ? 1 : 0;
};
const save = () => {
addressCreate(
{
bean: {
'name': '高昂',
'mobile': '15475655487',
'zonecode': '420101001001',
'addr': '肯德基挂',
'defaultstatus': 1
}
bean: params.value
}
).then(() => {
uni.showToast({

View File

@@ -24,6 +24,10 @@ const addressList = ref<{
}[]>([]);
onLoad((e) => {
// fetchAddressList();
});
onShow(() => {
fetchAddressList();
});