移除省市区

This commit is contained in:
Dev
2026-10-19 12:05:36 +08:00
parent 8a3f133488
commit 0c6f4177f1
6 changed files with 14 additions and 20510 deletions
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,5 @@
import Toast from 'tdesign-miniprogram/toast/index';
import { fetchDeliveryAddress } from '../../../../services/address/fetchAddress';
import { areaData } from '../../../../config/index';
import { resolveAddress, rejectAddress } from './util';
const innerPhoneReg = '^1(?:3\\d|4[4-9]|5[0-35-9]|6[67]|7[0-8]|8\\d|9\\d)\\d{8}$';
@@ -36,9 +35,7 @@ Page({
isOrderDetail: false,
isOrderSure: false,
},
areaData: areaData,
labels: labelsOptions,
areaPickerVisible: false,
submitActive: false,
visible: false,
labelValue: '',
@@ -78,44 +75,19 @@ Page({
},
onInputValue(e) {
const { item } = e.currentTarget.dataset;
if (item === 'address') {
const { selectedOptions = [] } = e.detail;
this.setData(
{
'locationState.provinceCode': selectedOptions[0].value,
'locationState.provinceName': selectedOptions[0].label,
'locationState.cityName': selectedOptions[1].label,
'locationState.cityCode': selectedOptions[1].value,
'locationState.districtCode': selectedOptions[2].value,
'locationState.districtName': selectedOptions[2].label,
areaPickerVisible: false,
},
() => {
const { isLegal, tips } = this.onVerifyInputLegal();
this.setData({
submitActive: isLegal,
});
this.privateData.verifyTips = tips;
},
);
} else {
const { value = '' } = e.detail;
this.setData(
{
[`locationState.${item}`]: value,
},
() => {
const { isLegal, tips } = this.onVerifyInputLegal();
this.setData({
submitActive: isLegal,
});
this.privateData.verifyTips = tips;
},
);
}
},
onPickArea() {
this.setData({ areaPickerVisible: true });
const { value = '' } = e.detail;
this.setData(
{
[`locationState.${item}`]: value,
},
() => {
const { isLegal, tips } = this.onVerifyInputLegal();
this.setData({
submitActive: isLegal,
});
this.privateData.verifyTips = tips;
},
);
},
onPickLabels(e) {
const { item } = e.currentTarget.dataset;
@@ -10,7 +10,6 @@
"t-toast": "tdesign-miniprogram/toast/toast",
"t-dialog": "tdesign-miniprogram/dialog/dialog",
"t-switch": "tdesign-miniprogram/switch/switch",
"t-location": "/pages/usercenter/components/t-location/index",
"t-cascader": "tdesign-miniprogram/cascader/cascader"
"t-location": "/pages/usercenter/components/t-location/index"
}
}
@@ -49,7 +49,6 @@
placeholder="省/市/区"
data-item="address"
value="{{locationState.provinceName ? locationState.provinceName+'/':'' }}{{locationState.cityName ? locationState.cityName+'/':''}}{{locationState.districtName}}"
catch:tap="onPickArea"
disabled
/>
<t-icon slot="right-icon" t-class="map" prefix="wr" name="location" catch:tap="onSearchAddress" />
@@ -108,16 +107,6 @@
</view>
</form>
</view>
<t-cascader
data-item="address"
data-type="1"
visible="{{areaPickerVisible}}"
theme="tab"
options="{{areaData}}"
value="{{locationState.districtCode}}"
title="选择地区"
bind:change="onInputValue"
></t-cascader>
</view>
<t-dialog
visible="{{visible}}"
@@ -1,7 +1,6 @@
import { getPermission } from '../../../../utils/getPermission';
import { phoneRegCheck } from '../../../../utils/util';
import Toast from 'tdesign-miniprogram/toast/index';
import { addressParse } from '../../../../utils/addressParse';
import { resolveAddress, rejectAddress } from '../../address/list/util';
Component({
-25
View File
@@ -1,25 +0,0 @@
import { areaData } from '../config/index';
const addressParse = (provinceName, cityName, countryName) => {
return new Promise((resolve, reject) => {
try {
const province = areaData.find((v) => v.label === provinceName);
const { value: provinceCode } = province;
const city = province.children.find((v) => v.label === cityName);
const { value: cityCode } = city;
const country = city.children.find((v) => v.label === countryName);
const { value: districtCode } = country;
resolve({
provinceCode,
cityCode,
districtCode,
});
} catch (error) {
reject('地址解析失败');
}
});
};
module.exports = {
addressParse,
};