From 4cc875a5fe6f8d906456aecfbcf56848ef037e0d Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Tue, 17 Jan 2023 16:37:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=96=B0=E5=A2=9E=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=E5=BF=AB=E9=80=9F=E6=90=9C=E7=B4=A2=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user-address-save/user-address-save.css | 15 +++++ pages/user-address-save/user-address-save.vue | 64 ++++++++++++++++++- 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/pages/user-address-save/user-address-save.css b/pages/user-address-save/user-address-save.css index f0bd9dc8..d27ab9e6 100644 --- a/pages/user-address-save/user-address-save.css +++ b/pages/user-address-save/user-address-save.css @@ -52,4 +52,19 @@ width: 256rpx; height: 170rpx; border: 1px dashed #c2c2c2; +} + +/** + * 地址编号搜索 + */ +.code-search { + width: 300rpx; +} +.code-search input { + width: calc(100% - 122rpx); +} +.code-search input, +.code-search button { + height: 40rpx; + line-height: 40rpx; } \ No newline at end of file diff --git a/pages/user-address-save/user-address-save.vue b/pages/user-address-save/user-address-save.vue index bd5dccac..8d4787a4 100644 --- a/pages/user-address-save/user-address-save.vue +++ b/pages/user-address-save/user-address-save.vue @@ -16,7 +16,14 @@ - 省市区必选 + + 省市区 + * + + + + + @@ -129,7 +136,8 @@ user_location_cache_key: app.globalData.data.cache_userlocation_key, user_location: null, address_discern_value: '', - form_submit_disabled_status: false, + form_submit_disabled_status: false, + region_code_value: '', // 基础配置 home_user_address_map_status: 0, home_user_address_idcard_status: 0, @@ -666,7 +674,6 @@ { fields: "tel", msg: "请填写联系电话" }, { fields: "province", msg: "请选择省份" }, { fields: "city", msg: "请选择城市" }, - { fields: "county", msg: "请选择区县" }, { fields: "address", msg: "请填写详细地址" } ]; @@ -749,6 +756,57 @@ } }); } + }, + + // 地址编号输入事件 + region_code_value_event(e) { + this.setData({ + region_code_value: e.detail.value + }); + }, + // 地址编号搜索 + region_code_event(e) { + if((this.region_code_value || null) == null) { + app.globalData.showToast('请输入数据'); + return false; + } + this.setData({ + form_submit_disabled_status: true + }); + uni.request({ + url: app.globalData.get_request_url('codedata', 'region'), + method: 'POST', + data: {code: this.region_code_value}, + dataType: 'json', + success: res => { + this.setData({ + form_submit_disabled_status: false + }); + if (res.data.code == 0) { + app.globalData.showToast(res.data.msg, 'success'); + var ads_data = res.data.data; + this.setData({ + province_id: ads_data.province || null, + city_id: ads_data.city || null, + county_id: ads_data.county || null + }); + // 地区数据填充处理 + this.region_data_fill_handle(); + } else { + if (app.globalData.is_login_check(res.data)) { + app.globalData.showToast(res.data.msg); + } else { + app.globalData.showToast('提交失败,请重试!'); + } + } + }, + fail: () => { + this.setData({ + form_submit_disabled_status: false + }); + app.globalData.showToast('服务器请求出错'); + } + }); } } };