|
|
@@ -65,10 +65,20 @@
|
|
|
<view class="tui-input" v-if="form.province || form.city" >{{ form.province + '-' + form.city }}</view> <view class="tui-placeholder" v-else>请选择</view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <!-- <tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title">详细地址</view>
|
|
|
<input v-model="form.address" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="address" placeholder="请填写地址" @input="changeAddress()" />
|
|
|
- </tui-list-cell>
|
|
|
+ </tui-list-cell> -->
|
|
|
+ <tui-list-cell v-if="hasMap == 0" class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">详细地址</view>
|
|
|
+ <input v-model="form.address" placeholder-class="phcolor" class="tui-input" name="address" @input="changeAddress" placeholder="请填写详细地址" />
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell v-else class="line-cell" :hover="false" :arrow="true" @click="selectRegion">
|
|
|
+ <view class="tui-title">详细地址</view>
|
|
|
+ <view class="tui-input" v-if="form.address">{{ form.address }}</view>
|
|
|
+ <view class="tui-placeholder" v-else>请填写详细地址</view>
|
|
|
+ <input v-model="form.address" name="address" hidden />
|
|
|
+ </tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title">门牌号</view>
|
|
|
@@ -98,12 +108,12 @@
|
|
|
|
|
|
<!-- 省市联动 -->
|
|
|
<simple-address ref="simpleAddress" :region="regionTree" :pickerValueDefault="cityPickerValueDefault" @onConfirm="getCityConfirm" ></simple-address>
|
|
|
-
|
|
|
+ <!-- 选择地区 -->
|
|
|
+ <app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapGetters } from "vuex";
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppDatePicker from "@/components/app-date-picker";
|
|
|
import SimpleAddress from "@/components/plugin/simple-address";
|
|
|
@@ -125,6 +135,10 @@ export default {
|
|
|
type: Object,
|
|
|
default: {}
|
|
|
},
|
|
|
+ hasMap: { // 是否具备定位功能 0不具备 1具备
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -137,6 +151,7 @@ export default {
|
|
|
receiveMobile: "",
|
|
|
province: "",
|
|
|
city: "",
|
|
|
+ dist: "",
|
|
|
address: "",
|
|
|
showAddress:"",
|
|
|
floor: "",
|
|
|
@@ -155,9 +170,9 @@ export default {
|
|
|
regionTree:[],
|
|
|
cityPickerValueDefault: [0, 0],
|
|
|
timeOptions: [
|
|
|
- ['00', '01', '02','03','04','05','06','07','08','09','10','11','12','13', '14','15','16','17','18','19','20','21','22','23'],
|
|
|
- ['00', '05', '10','15','20','25','30','35','40','45','50','55']
|
|
|
- ],
|
|
|
+ ['00', '01', '02','03','04','05','06','07','08','09','10','11','12','13', '14','15','16','17','18','19','20','21','22','23'],
|
|
|
+ ['00', '05', '10','15','20','25','30','35','40','45','50','55']
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -209,7 +224,6 @@ export default {
|
|
|
|
|
|
this.form.lat = newVal.lat
|
|
|
this.form.long = newVal.long
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
immediate:true
|
|
|
@@ -247,7 +261,27 @@ export default {
|
|
|
getCityConfirm(e) {
|
|
|
this.form.province = e.provinceName;
|
|
|
this.form.city = e.cityName;
|
|
|
- }
|
|
|
+ },
|
|
|
+ selectRegion() {
|
|
|
+ if (!this.form.city) {
|
|
|
+ this.$msg('请先选择城市!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.showRegion = true
|
|
|
+ },
|
|
|
+ changeAreaFn(e) {
|
|
|
+ this.form.address = e.name
|
|
|
+ let locationStr = e.location
|
|
|
+ let fruits = locationStr.split(",").map(fruit => fruit.trim())
|
|
|
+ this.form.lat = fruits[1]
|
|
|
+ this.form.long = fruits[0]
|
|
|
+ this.form.showAddress = e.address
|
|
|
+
|
|
|
+ // 提取地区信息,按遇到第一个"市"字后,把"市"后面的字符串作为地区
|
|
|
+ const districtStr = e.district || '';
|
|
|
+ const cityIndex = districtStr.indexOf('市');
|
|
|
+ this.form.dist = cityIndex !== -1 ? districtStr.substring(cityIndex + 1) : districtStr;
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|