|
|
@@ -31,7 +31,8 @@
|
|
|
name="picker"
|
|
|
:value="fromData.storeCategoryName"
|
|
|
label="客户类型"
|
|
|
- placeholder="点击选择客户类型">
|
|
|
+ placeholder="点击选择客户类型"
|
|
|
+ :rules="[{ required: true, message: '请选择客户类型' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
@@ -43,7 +44,8 @@
|
|
|
:value="fromData.orgName"
|
|
|
label="销售部"
|
|
|
placeholder="点击选择销售部"
|
|
|
- @click="PickerDept">
|
|
|
+ @click="PickerDept"
|
|
|
+ :rules="[{ required: true, message: '请选择销售部' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
@@ -77,7 +79,8 @@
|
|
|
:value="fromData.provinceName"
|
|
|
label="省(州)"
|
|
|
placeholder="点击选择省(州)"
|
|
|
- @click="showProvincePicker = true">
|
|
|
+ @click="showProvincePicker = true"
|
|
|
+ :rules="[{ required: true, message: '请选择省(州)' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
@@ -89,7 +92,8 @@
|
|
|
:value="fromData.cityName"
|
|
|
label="城市"
|
|
|
placeholder="点击选择城市"
|
|
|
- @click="showCityPicker = true">
|
|
|
+ @click="showCityPicker = true"
|
|
|
+ :rules="[{ required: true, message: '请选择城市' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
@@ -101,23 +105,30 @@
|
|
|
:value="fromData.districtName"
|
|
|
label="区(县)"
|
|
|
placeholder="点击选择区(县)"
|
|
|
- @click="showDistrictPicker = true">
|
|
|
+ @click="showDistrictPicker = true"
|
|
|
+ :rules="[{ required: true, message: '请选择区(县)' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
</van-field>
|
|
|
- <van-field
|
|
|
+ <van-field readonly v-model="fromData.cityLevel" label="城市等级">
|
|
|
+ <template #left-icon>
|
|
|
+ <span class="van-f-red">*</span>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ <!-- <van-field
|
|
|
readonly
|
|
|
clickable
|
|
|
name="picker"
|
|
|
:value="fromData.townName"
|
|
|
label="街道"
|
|
|
placeholder="点击选择街道"
|
|
|
- @click="showTownPicker = true">
|
|
|
+ @click="showTownPicker = true"
|
|
|
+ :rules="[{ required: true, message: '请选择街道' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
- </van-field>
|
|
|
+ </van-field> -->
|
|
|
<van-field
|
|
|
v-model="fromData.addressLine"
|
|
|
label="地址"
|
|
|
@@ -125,7 +136,8 @@
|
|
|
rows="1"
|
|
|
autosize
|
|
|
type="textarea"
|
|
|
- @blur="addressFn">
|
|
|
+ @blur="addressFn"
|
|
|
+ :rules="[{ required: true, message: '请选择地址' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
@@ -138,20 +150,24 @@
|
|
|
<van-field
|
|
|
type="tel"
|
|
|
v-model="fromData.telephone"
|
|
|
- label="联系电话"
|
|
|
- placeholder="请输入联系电话"
|
|
|
+ label="门店联系电话"
|
|
|
+ placeholder="请输入门店联系电话"
|
|
|
:rules="[
|
|
|
{
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
validator: FSQValidatePhone,
|
|
|
- message: '请输入联系电话',
|
|
|
+ message: '请输入门店联系电话',
|
|
|
},
|
|
|
]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
</van-field>
|
|
|
- <van-field v-model="fromData.salesmanName" label="联系人" placeholder="联系人">
|
|
|
+ <van-field
|
|
|
+ v-model="fromData.salesmanName"
|
|
|
+ label="门店联系人"
|
|
|
+ placeholder="请输入门店联系人"
|
|
|
+ :rules="[{ required: true, message: '请输入门店联系人' }]">
|
|
|
<template #left-icon>
|
|
|
<span class="van-f-red">*</span>
|
|
|
</template>
|
|
|
@@ -183,14 +199,14 @@
|
|
|
@confirm="onDistrictConfirm"
|
|
|
@cancel="showDistrictPicker = false" />
|
|
|
</van-popup>
|
|
|
- <van-popup v-model="showTownPicker" position="bottom">
|
|
|
+ <!-- <van-popup v-model="showTownPicker" position="bottom">
|
|
|
<van-picker
|
|
|
show-toolbar
|
|
|
title="街道"
|
|
|
:columns="townList"
|
|
|
@confirm="onTownConfirm"
|
|
|
@cancel="showTownPicker = false" />
|
|
|
- </van-popup>
|
|
|
+ </van-popup> -->
|
|
|
<!-- 部门数据 -->
|
|
|
<van-popup v-model="showPickerDept" position="bottom">
|
|
|
<van-picker
|
|
|
@@ -250,13 +266,13 @@
|
|
|
<script>
|
|
|
import { phoneCheck, streetQuery, getChainsByDeptCode } from '@/api/index';
|
|
|
import { updateStore } from '@/api/FSQStore';
|
|
|
-import { getPosition, getTicketFun } from '@/utils/TXApiFun';
|
|
|
+import { getPosition, getTicketFun, getMapPoi, getkeywordPoi, getGeocoder } from '@/utils/TXApiFun';
|
|
|
import { jsonp } from 'vue-jsonp';
|
|
|
+import { getstreetInfoList } from '@/api/addDesigner';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
fromData: {
|
|
|
- storeCode: '',
|
|
|
storeName: '',
|
|
|
telephone: '',
|
|
|
storeCategoryName: '',
|
|
|
@@ -265,8 +281,6 @@ export default {
|
|
|
districtName: '',
|
|
|
addressLine: '',
|
|
|
orgName: '',
|
|
|
- // chainName: '',
|
|
|
- townName: '',
|
|
|
salesmanName: '',
|
|
|
lat: '',
|
|
|
lon: '',
|
|
|
@@ -301,11 +315,10 @@ export default {
|
|
|
maplist: [],
|
|
|
};
|
|
|
},
|
|
|
- activated() {
|
|
|
+ created() {
|
|
|
this.showmap = false;
|
|
|
+ this.getStoreCategoryList();
|
|
|
// this.toastLoading(0, '加载中...', true);
|
|
|
- // 获取地址
|
|
|
- this.getStreetQuery();
|
|
|
// 授权
|
|
|
getTicketFun(['getLocation', 'chooseImage', 'uploadImage']).then(() => {
|
|
|
this.$nextTick(() => {
|
|
|
@@ -315,30 +328,62 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
getLocation() {
|
|
|
- if (localStorage.getItem('loginType') == 'cs') {
|
|
|
- this.fromData.lat = '31.2517820000';
|
|
|
- this.fromData.lon = '120.5593090000';
|
|
|
- this.addVisits();
|
|
|
- } else {
|
|
|
- getPosition()
|
|
|
- .then((res) => {
|
|
|
- let { TXisBD, resData } = res;
|
|
|
- this.mlon = resData.longitude;
|
|
|
- this.mlan = resData.latitude;
|
|
|
- this.location = TXisBD;
|
|
|
- this.fromData.lat = TXisBD.lat;
|
|
|
- this.fromData.lon = TXisBD.lon;
|
|
|
- this.location.lat1 = resData.latitude;
|
|
|
- this.location.lon1 = resData.longitude;
|
|
|
- this.addVisits();
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- // this.beforeAddFn();
|
|
|
- this.$dialog.alert({
|
|
|
- message: error,
|
|
|
- });
|
|
|
+ getPosition()
|
|
|
+ .then((res) => {
|
|
|
+ let { TXisBD, resData } = res;
|
|
|
+ this.mlon = resData.longitude;
|
|
|
+ this.mlan = resData.latitude;
|
|
|
+ this.location = TXisBD;
|
|
|
+ this.fromData.lat = TXisBD.lat;
|
|
|
+ this.fromData.lon = TXisBD.lon;
|
|
|
+ this.location.lat1 = resData.latitude;
|
|
|
+ this.location.lon1 = resData.longitude;
|
|
|
+ this.addVisits();
|
|
|
+ this.initData();
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ // this.beforeAddFn();
|
|
|
+ this.$dialog.alert({
|
|
|
+ message: error,
|
|
|
});
|
|
|
- }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ initData() {
|
|
|
+ getGeocoder({ latitude: this.location.lat1, longitude: this.location.lon1 })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.status == 0 && res.result) {
|
|
|
+ let result = res.result;
|
|
|
+ this.fromData.cityNameOld = result.ad_info.city;
|
|
|
+ this.fromData.districtNameOld = result.ad_info.district;
|
|
|
+ let addresses = result.formatted_addresses; // 描述性地址
|
|
|
+ getstreetInfoList({ districtName: result.ad_info.district }).then((response) => {
|
|
|
+ if (response.code == 200 && response.data) {
|
|
|
+ this.fromData.province = response.data.provinceCode;
|
|
|
+ this.fromData.city = response.data.cityCode;
|
|
|
+ this.fromData.district = response.data.countyCode;
|
|
|
+ this.fromData.provinceName = response.data.provinceName;
|
|
|
+ this.fromData.cityName = response.data.cityName;
|
|
|
+ this.fromData.districtName = response.data.countyName;
|
|
|
+ this.fromData.cityLevel = response.data.countyLevel;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.getStreetQuery();
|
|
|
+ this.getStreetQuery('1');
|
|
|
+ this.getStreetQuery('2');
|
|
|
+ // this.getStreetQuery('3');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (addresses) {
|
|
|
+ this.fromData.addressLine = addresses.recommend;
|
|
|
+ localStorage.setItem('locationRemark', addresses.recommend);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ });
|
|
|
},
|
|
|
addVisits() {
|
|
|
var that = this;
|
|
|
@@ -369,6 +414,15 @@ export default {
|
|
|
clickSubmit(values) {
|
|
|
this.$refs.tabstoreVal.submit();
|
|
|
},
|
|
|
+ getStoreCategoryList() {
|
|
|
+ // designerStoreCategory().then((res) => {
|
|
|
+ // if (res.code == 200) {
|
|
|
+ // this.storeCategoryList = res.data;
|
|
|
+ // this.fromData.storeCategoryName = this.storeCategoryList[0].dictLabel;
|
|
|
+ // this.fromData.storeCategory = this.storeCategoryList[0].dictValue;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ },
|
|
|
onSubmit(value) {
|
|
|
this.toastLoading(0, '提交中...', true);
|
|
|
updateStore(this.fromData).then((res) => {
|
|
|
@@ -587,8 +641,8 @@ export default {
|
|
|
this.fromData.city = '';
|
|
|
this.fromData.districtName = '';
|
|
|
this.fromData.countyCode = '';
|
|
|
- this.fromData.townName = '';
|
|
|
- this.fromData.townCode = '';
|
|
|
+ // this.fromData.townName = '';
|
|
|
+ // this.fromData.townCode = '';
|
|
|
this.countyCode = '';
|
|
|
this.cityCode = '';
|
|
|
this.provinceCode = value.provinceCode;
|
|
|
@@ -600,8 +654,8 @@ export default {
|
|
|
this.fromData.city = value.cityCode;
|
|
|
this.fromData.districtName = '';
|
|
|
this.fromData.district = '';
|
|
|
- this.fromData.townName = '';
|
|
|
- this.fromData.townCode = '';
|
|
|
+ // this.fromData.townName = '';
|
|
|
+ // this.fromData.townCode = '';
|
|
|
this.countyCode = '';
|
|
|
this.cityCode = value.cityCode;
|
|
|
this.getStreetQuery('2');
|
|
|
@@ -610,11 +664,11 @@ export default {
|
|
|
onDistrictConfirm(value) {
|
|
|
this.fromData.districtName = value.text;
|
|
|
this.fromData.district = value.countyCode;
|
|
|
- this.fromData.townName = '';
|
|
|
- this.fromData.townCode = '';
|
|
|
+ // this.fromData.townName = '';
|
|
|
+ // this.fromData.townCode = '';
|
|
|
this.countyCode = value.countyCode;
|
|
|
this.fromData.cityLevel = value.countyLevel;
|
|
|
- this.getStreetQuery('3');
|
|
|
+ // this.getStreetQuery('3');
|
|
|
this.showDistrictPicker = false;
|
|
|
},
|
|
|
onTownConfirm(value) {
|