移除省市区
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user