|
|
@@ -73,9 +73,11 @@
|
|
|
<view class="tui-placeholder" v-else>请选择</view>
|
|
|
<input v-model="form.province" name="province" hidden />
|
|
|
</tui-list-cell>
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selectRegion">
|
|
|
<view class="tui-title">所在地址</view>
|
|
|
- <input v-model="form.address" placeholder-class="phcolor" class="tui-input" name="address" placeholder="请填写地址" />
|
|
|
+ <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>
|
|
|
@@ -108,6 +110,8 @@
|
|
|
</form>
|
|
|
<!-- 省市联动 -->
|
|
|
<simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onCityConfirm"></simple-address>
|
|
|
+ <!-- 选择地区 -->
|
|
|
+ <app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -158,10 +162,12 @@ export default {
|
|
|
default:0,
|
|
|
superWx:[]
|
|
|
},
|
|
|
+ showRegion: false,
|
|
|
region: {
|
|
|
- lat: 10,
|
|
|
- long: 11
|
|
|
+ lat: 0,
|
|
|
+ long: 0
|
|
|
},
|
|
|
+ regionData: [],
|
|
|
cityPickerValueDefault: [0, 0],
|
|
|
img: [],
|
|
|
headers:{token:''},
|
|
|
@@ -214,6 +220,8 @@ export default {
|
|
|
Object.keys(this.form).forEach((i, index) => {
|
|
|
this.form[i] = data[i]
|
|
|
})
|
|
|
+ this.region.lat = data.lat
|
|
|
+ this.region.long = data.long
|
|
|
|
|
|
// 营业时间初始化
|
|
|
this.visible = this.form.open == 1 ? true : false
|
|
|
@@ -262,10 +270,28 @@ export default {
|
|
|
this.end_time = '18:00'
|
|
|
}
|
|
|
},
|
|
|
+ selectRegion() {
|
|
|
+ if (!this.form.city) {
|
|
|
+ this.$msg('请先选择城市!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.showRegion = true
|
|
|
+ },
|
|
|
_resultData(val) {
|
|
|
console.log(val)
|
|
|
this.form.img = val;
|
|
|
},
|
|
|
+ changeAreaFn(e) {
|
|
|
+ this.form.address = e.name
|
|
|
+
|
|
|
+ let locationStr = e.location
|
|
|
+ let fruits = locationStr.split(",").map(fruit => fruit.trim())
|
|
|
+
|
|
|
+ this.region.lat = fruits[1]
|
|
|
+ this.region.long = fruits[0]
|
|
|
+ this.form.showAddress = e.address
|
|
|
+ },
|
|
|
+ // 省市联动
|
|
|
openAddres() {
|
|
|
this.$refs.simpleAddress.open()
|
|
|
},
|
|
|
@@ -273,6 +299,8 @@ export default {
|
|
|
this.form.province = e.provinceName
|
|
|
this.form.city = e.cityName
|
|
|
this.form.address = ''
|
|
|
+ this.region.lat = 0
|
|
|
+ this.region.long = 0
|
|
|
},
|
|
|
confirmFn() {
|
|
|
let hostFn = this.option.id ? update : add
|
|
|
@@ -283,7 +311,6 @@ export default {
|
|
|
if(Array.isArray(this.form.superWx) && !this.$util.isEmpty(this.form.superWx)){
|
|
|
superWx = this.form.superWx[0]
|
|
|
}
|
|
|
- this.form.showAddress = this.form.city+this.form.address+this.form.floor
|
|
|
this.form = {...this.form,...this.region,superWx:superWx}
|
|
|
uni.showLoading({mask:true})
|
|
|
hostFn(this.form).then(res => {
|