用户地址数据服务层分离,新增百度小程序地址导入

This commit is contained in:
devil
2020-09-21 16:03:38 +08:00
parent 0f1ed149f1
commit 54764fe7f2
15 changed files with 719 additions and 381 deletions

View File

@ -46,7 +46,7 @@ App({
"goods_search": "商品搜索",
"goods_detail": "商品详情",
"user_address": "我的地址",
"user_address_save_add": "新增地址",
"user_address_save_add": "添加地址",
"user_address_save_edit": "编辑地址",
"buy": "订单确认",
"user_order": "我的订单",

View File

@ -46,7 +46,7 @@ App({
"goods_search": "商品搜索",
"goods_detail": "商品详情",
"user_address": "我的地址",
"user_address_save_add": "新增地址",
"user_address_save_add": "添加地址",
"user_address_save_edit": "编辑地址",
"buy": "订单确认",
"user_order": "我的订单",

View File

@ -33,4 +33,12 @@
}
.page {
padding-bottom: 85rpx;
}
.submit-list button {
width: 50%;
}
.submit-list .import-system-address-submit {
background: #07c160 !important;
right: 0;
left: auto;
}

View File

@ -209,7 +209,6 @@ Page({
},
fail: () => {
swan.hideLoading();
app.showToast("服务器请求出错");
}
});
@ -226,6 +225,48 @@ Page({
});
swan.navigateBack();
}
}
},
// 获取系统地址
choose_system_address_event(e) {
var detail = e.detail;
var data = {
"name": detail.userName || '',
"tel": detail.telNumber || '',
"province": detail.provinceName || '',
"city": detail.cityName || '',
"county": detail.countyName || '',
"town": detail.townName || '',
"address": detail.detailInfo || '',
};
// 加载loding
swan.showLoading({ title: "处理中..." });
// 获取数据
swan.request({
url: app.get_request_url("outsystemadd", "useraddress"),
method: "POST",
data: data,
dataType: "json",
success: res => {
swan.hideLoading();
if (res.data.code == 0) {
this.get_data_list();
app.showToast(res.data.msg, "success");
} else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
}
},
fail: () => {
swan.hideLoading();
app.showToast("服务器请求出错");
}
});
},
});

View File

@ -30,11 +30,14 @@
<import src="/pages/common/nodata.swan" />
<template is="nodata" data="{{{status: data_list_loding_status}}}"></template>
</view>
<import src="/pages/common/bottom_line.swan" />
<template is="bottom_line" data="{{{status: data_bottom_line_status}}}"></template>
<navigator url="/pages/user-address-save/user-address-save" open-type="navigate" hover-class="none">
<button class="submit-fixed submit-bottom" type="default" hover-class="none">新增地址</button>
</navigator>
<view class="submit-list">
<navigator url="/pages/user-address-save/user-address-save" open-type="navigate" hover-class="none">
<button class="submit-fixed submit-bottom" type="default" hover-class="none">添加新地址</button>
</navigator>
<button class="submit-fixed submit-bottom import-system-address-submit" type="default" hover-class="none" open-type="chooseAddress" bindchooseAddress="choose_system_address_event">导入百度地址</button>
</view>
</view>

View File

@ -46,7 +46,7 @@ App({
"goods_search": "商品搜索",
"goods_detail": "商品详情",
"user_address": "我的地址",
"user_address_save_add": "新增地址",
"user_address_save_add": "添加地址",
"user_address_save_edit": "编辑地址",
"buy": "订单确认",
"user_order": "我的订单",

View File

@ -46,7 +46,7 @@ App({
"goods_search": "商品搜索",
"goods_detail": "商品详情",
"user_address": "我的地址",
"user_address_save_add": "新增地址",
"user_address_save_add": "添加地址",
"user_address_save_edit": "编辑地址",
"buy": "订单确认",
"user_order": "我的订单",

View File

@ -46,7 +46,7 @@ App({
"goods_search": "商品搜索",
"goods_detail": "商品详情",
"user_address": "我的地址",
"user_address_save_add": "新增地址",
"user_address_save_add": "添加地址",
"user_address_save_edit": "编辑地址",
"buy": "订单确认",
"user_order": "我的订单",