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('服务器请求出错'); + } + }); } } };