competingStoresAdd.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  1. <template>
  2. <div class="FSQStoreDetail">
  3. <div class="header">
  4. <van-nav-bar
  5. class="navBar"
  6. title="潜在店"
  7. left-arrow
  8. @click-left="onClickLeft"
  9. right-text="提交"
  10. @click-right="clickSubmit" />
  11. </div>
  12. <div class="content">
  13. <van-form ref="tabstoreVal" @submit="onSubmit" :scroll-to-error="true" :show-error="false">
  14. <!-- <van-field readonly :value="fromData.storeCode" label="编号">
  15. <template #left-icon>
  16. <span class="van-f-red"></span>
  17. </template>
  18. </van-field> -->
  19. <van-field
  20. v-model="fromData.storeName"
  21. label="客户名称"
  22. placeholder="请输入客户名称"
  23. :rules="[{ required: true, message: '请输入客户名称' }]">
  24. <template #left-icon>
  25. <span class="van-f-red">*</span>
  26. </template>
  27. </van-field>
  28. <van-field
  29. readonly
  30. clickable
  31. name="picker"
  32. :value="fromData.storeCategoryName"
  33. label="客户类型"
  34. placeholder="点击选择客户类型"
  35. @click="showPicker = true"
  36. :rules="[{ required: true, message: '请选择客户类型' }]">
  37. <template #left-icon>
  38. <span class="van-f-red">*</span>
  39. </template>
  40. </van-field>
  41. <van-field
  42. readonly
  43. clickable
  44. name="picker"
  45. :value="fromData.orgName"
  46. label="销售部"
  47. placeholder="点击选择销售部"
  48. @click="PickerDept"
  49. :rules="[{ required: true, message: '请选择销售部' }]">
  50. <template #left-icon>
  51. <span class="van-f-red">*</span>
  52. </template>
  53. </van-field>
  54. <!-- <van-row style="border-bottom: 1px solid #ebedf0">
  55. <van-field
  56. rows="1"
  57. autosize
  58. type="textarea"
  59. readonly
  60. clickable
  61. name="picker"
  62. :value="fromData.chainName"
  63. label="经销商名称"
  64. placeholder="点击选择经销商名称"
  65. :rules="[
  66. {
  67. required: true,
  68. message: '请选择经销商',
  69. },
  70. ]">
  71. <template #left-icon>
  72. <span class="van-f-red"></span>
  73. </template>
  74. </van-field>
  75. </van-row> -->
  76. <van-field
  77. readonly
  78. clickable
  79. name="picker"
  80. :value="fromData.provinceName"
  81. label="省(州)"
  82. placeholder="点击选择省(州)"
  83. @click="showProvincePicker = true"
  84. :rules="[{ required: true, message: '请选择省(州)' }]">
  85. <template #left-icon>
  86. <span class="van-f-red">*</span>
  87. </template>
  88. </van-field>
  89. <van-field
  90. readonly
  91. clickable
  92. name="picker"
  93. :value="fromData.cityName"
  94. label="城市"
  95. placeholder="点击选择城市"
  96. @click="showCityPicker = true"
  97. :rules="[{ required: true, message: '请选择城市' }]">
  98. <template #left-icon>
  99. <span class="van-f-red">*</span>
  100. </template>
  101. </van-field>
  102. <van-field
  103. readonly
  104. clickable
  105. name="picker"
  106. :value="fromData.districtName"
  107. label="区(县)"
  108. placeholder="点击选择区(县)"
  109. @click="showDistrictPicker = true"
  110. :rules="[{ required: true, message: '请选择区(县)' }]">
  111. <template #left-icon>
  112. <span class="van-f-red">*</span>
  113. </template>
  114. </van-field>
  115. <van-field readonly v-model="fromData.cityLevel" label="城市等级">
  116. <template #left-icon>
  117. <span class="van-f-red">*</span>
  118. </template>
  119. </van-field>
  120. <!-- <van-field
  121. readonly
  122. clickable
  123. name="picker"
  124. :value="fromData.townName"
  125. label="街道"
  126. placeholder="点击选择街道"
  127. @click="showTownPicker = true"
  128. :rules="[{ required: true, message: '请选择街道' }]">
  129. <template #left-icon>
  130. <span class="van-f-red">*</span>
  131. </template>
  132. </van-field> -->
  133. <van-field
  134. v-model="fromData.addressLine"
  135. label="地址"
  136. placeholder="地址"
  137. rows="1"
  138. autosize
  139. type="textarea"
  140. @blur="addressFn"
  141. :rules="[{ required: true, message: '请选择地址' }]">
  142. <template #left-icon>
  143. <span class="van-f-red">*</span>
  144. </template>
  145. <template #button>
  146. <van-button size="small" native-type="button" type="info" @click="fns">
  147. <van-icon name="location-o" />地图
  148. </van-button>
  149. </template>
  150. </van-field>
  151. <van-field
  152. type="tel"
  153. v-model="fromData.telephone"
  154. label="门店联系电话"
  155. placeholder="请输入门店联系电话"
  156. :rules="[
  157. {
  158. required: true,
  159. validator: FSQValidatePhone,
  160. message: '请输入门店联系电话',
  161. },
  162. ]">
  163. <template #left-icon>
  164. <span class="van-f-red">*</span>
  165. </template>
  166. </van-field>
  167. <van-field
  168. v-model="fromData.contactName"
  169. label="门店联系人"
  170. placeholder="请输入门店联系人"
  171. :rules="[{ required: true, message: '请输入门店联系人' }]">
  172. <template #left-icon>
  173. <span class="van-f-red">*</span>
  174. </template>
  175. </van-field>
  176. </van-form>
  177. </div>
  178. <!--客户类型-->
  179. <van-popup v-model="showPicker" position="bottom">
  180. <van-picker
  181. show-toolbar
  182. value-key="dictLabel"
  183. :columns="storeCategoryList"
  184. @confirm="onConfirm"
  185. @cancel="showPicker = false" />
  186. </van-popup>
  187. <!--省、市、区、街道-->
  188. <van-popup v-model="showProvincePicker" position="bottom">
  189. <van-picker
  190. show-toolbar
  191. title="省(州)"
  192. :columns="provinceList"
  193. @confirm="onProvinceConfirm"
  194. @cancel="showProvincePicker = false" />
  195. </van-popup>
  196. <van-popup v-model="showCityPicker" position="bottom">
  197. <van-picker
  198. show-toolbar
  199. title="城市"
  200. :columns="cityList"
  201. @confirm="onCityConfirm"
  202. @cancel="showCityPicker = false" />
  203. </van-popup>
  204. <van-popup v-model="showDistrictPicker" position="bottom">
  205. <van-picker
  206. show-toolbar
  207. title="县区"
  208. :columns="districtList"
  209. @confirm="onDistrictConfirm"
  210. @cancel="showDistrictPicker = false" />
  211. </van-popup>
  212. <!-- <van-popup v-model="showTownPicker" position="bottom">
  213. <van-picker
  214. show-toolbar
  215. title="街道"
  216. :columns="townList"
  217. @confirm="onTownConfirm"
  218. @cancel="showTownPicker = false" />
  219. </van-popup> -->
  220. <!-- 部门数据 -->
  221. <van-popup v-model="showPickerDept" position="bottom">
  222. <van-picker
  223. show-toolbar
  224. title="部门名称"
  225. :columns="deptList"
  226. @confirm="onDeptConfirm"
  227. @cancel="showPickerDept = false" />
  228. </van-popup>
  229. <div id="allmap"></div>
  230. <div style="position: fixed; top: 0; height: 100%; z-index: 3000; width: 100%" v-if="showmap">
  231. <div id="allmap1" style="height: 100%; width: 100%"></div>
  232. <div style="position: fixed; z-index: 99999; top: 0; width: 100%; background-color: white">
  233. <van-search
  234. v-model="search"
  235. shape="round"
  236. background="#0057ba"
  237. @input="searchFn"
  238. placeholder="请输入搜索关键词" />
  239. <div style="height: 200px; overflow: hidden" v-if="searchSHow">
  240. <div style="height: 100px; min-height: 200px; overflow-y: scroll; padding: 12px">
  241. <div
  242. v-for="(itme, index) in mapsearchlist"
  243. style="border-bottom: 1px solid #eee"
  244. @click="addressFns(itme)">
  245. <p>{{ itme.title }}</p>
  246. <p>{{ itme.address }}</p>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. <div class="mapaddress">
  252. <div class="title">
  253. <span @click="showmap = false" style="float: left"
  254. ><van-icon name="cross" size="16"
  255. /></span>
  256. <p class="titleText">附近地址信息</p>
  257. <span style="float: right" @click="confirmMap">确定</span>
  258. </div>
  259. <div class="listBox">
  260. <van-radio-group v-model="addresssb" @change="mapselect">
  261. <van-radio :name="index" v-for="(item, index) in maplist" :key="index">
  262. <p style="margin: 4px 0; font-weight: bold">{{ item.title }}</p>
  263. <p style="margin: 4px 0">{{ item.address }}</p>
  264. </van-radio>
  265. </van-radio-group>
  266. <br />
  267. <br />
  268. <br />
  269. <br />
  270. </div>
  271. </div>
  272. </div>
  273. </div>
  274. </template>
  275. <script>
  276. import { phoneCheck, streetQuery } from '@/api/index';
  277. import { updateStore } from '@/api/FSQStore';
  278. import { getPosition, getTicketFun, getGeocoder } from '@/utils/TXApiFun';
  279. import { jsonp } from 'vue-jsonp';
  280. import { getstreetInfoList } from '@/api/addDesigner';
  281. import { qzStoreCategory, getChildDeptList, addQzStore } from '@/api/store';
  282. export default {
  283. data() {
  284. return {
  285. fromData: {
  286. storeName: '',
  287. telephone: '',
  288. storeCategoryName: '',
  289. provinceName: '',
  290. cityName: '',
  291. districtName: '',
  292. addressLine: '',
  293. orgName: '',
  294. contactName: '',
  295. lat: '',
  296. lon: '',
  297. cityNameOld: '',
  298. districtNameOld: '',
  299. },
  300. location: {
  301. lat1: '34.6174',
  302. lon1: '112.44039',
  303. },
  304. mlon: '',
  305. mlan: '',
  306. showProvincePicker: false,
  307. showCityPicker: false,
  308. showDistrictPicker: false,
  309. showTownPicker: false,
  310. provinceList: [],
  311. cityList: [],
  312. districtList: [],
  313. townList: [],
  314. provinceCode: '',
  315. deptShow: false,
  316. showPickerDept: false,
  317. deptList: [],
  318. showPicker: false,
  319. storeCategoryList: [],
  320. // 地图信息
  321. showmap: false,
  322. search: '',
  323. searchSHow: false,
  324. mapsearchlist: [],
  325. addresssb: -1,
  326. markers: undefined,
  327. maplist: [],
  328. };
  329. },
  330. activated() {
  331. this.fromData = {
  332. storeName: '',
  333. telephone: '',
  334. storeCategoryName: '',
  335. provinceName: '',
  336. cityName: '',
  337. districtName: '',
  338. addressLine: '',
  339. orgName: '',
  340. contactName: '',
  341. lat: '',
  342. lon: '',
  343. cityNameOld: '',
  344. districtNameOld: '',
  345. };
  346. this.showmap = false;
  347. this.getStoreCategoryList();
  348. this.getChildDeptListFun();
  349. // this.toastLoading(0, '加载中...', true);
  350. // 授权
  351. getTicketFun(['getLocation', 'chooseImage', 'uploadImage']).then(() => {
  352. this.$nextTick(() => {
  353. this.getLocation();
  354. });
  355. });
  356. },
  357. methods: {
  358. getLocation() {
  359. getPosition()
  360. .then((res) => {
  361. let { TXisBD, resData } = res;
  362. this.mlon = resData.longitude;
  363. this.mlan = resData.latitude;
  364. this.location = TXisBD;
  365. this.fromData.lat = TXisBD.lat;
  366. this.fromData.lon = TXisBD.lon;
  367. this.location.lat1 = resData.latitude;
  368. this.location.lon1 = resData.longitude;
  369. this.addVisits();
  370. this.initData();
  371. })
  372. .catch((error) => {
  373. // this.beforeAddFn();
  374. this.$dialog.alert({
  375. message: error,
  376. });
  377. });
  378. },
  379. initData() {
  380. getGeocoder({ latitude: this.location.lat1, longitude: this.location.lon1 })
  381. .then((res) => {
  382. if (res.status == 0 && res.result) {
  383. let result = res.result;
  384. this.fromData.cityNameOld = result.ad_info.city;
  385. this.fromData.districtNameOld = result.ad_info.district;
  386. let addresses = result.formatted_addresses; // 描述性地址
  387. getstreetInfoList({ districtName: result.ad_info.district }).then((response) => {
  388. if (response.code == 200 && response.data) {
  389. this.fromData.province = response.data.provinceCode;
  390. this.fromData.city = response.data.cityCode;
  391. this.fromData.district = response.data.countyCode;
  392. this.fromData.provinceName = response.data.provinceName;
  393. this.fromData.cityName = response.data.cityName;
  394. this.fromData.districtName = response.data.countyName;
  395. this.fromData.cityLevel = response.data.countyLevel;
  396. this.$nextTick(() => {
  397. this.getStreetQuery();
  398. this.getStreetQuery('1');
  399. this.getStreetQuery('2');
  400. // this.getStreetQuery('3');
  401. });
  402. }
  403. });
  404. if (addresses) {
  405. this.fromData.addressLine = addresses.recommend;
  406. localStorage.setItem('locationRemark', addresses.recommend);
  407. }
  408. } else {
  409. this.toastLoading().clear();
  410. }
  411. })
  412. .catch(() => {
  413. this.toastLoading().clear();
  414. });
  415. },
  416. addVisits() {
  417. var that = this;
  418. var map = new TMap.Map('allmap', {
  419. zoom: 15,
  420. center: new TMap.LatLng(39.986785, 116.301012),
  421. });
  422. var geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
  423. var markers = new TMap.MultiMarker({
  424. map: map,
  425. geometries: [],
  426. });
  427. markers.setGeometries([]);
  428. var location = new TMap.LatLng(that.location.lat1, that.location.lon1);
  429. map.setCenter(location);
  430. markers.updateGeometries([{ id: 'marker', position: location }]);
  431. geocoder
  432. .getAddress({ location: location })
  433. .then(function (result) {
  434. var addresses = result.result.formatted_addresses;
  435. that.fromData.cityNameOld = result.result.ad_info.city;
  436. that.fromData.districtNameOld = result.result.ad_info.district;
  437. that.fromData.addressLine = addresses.recommend;
  438. localStorage.setItem('locationRemark', addresses.recommend);
  439. })
  440. .catch((error) => console.error('Geocoding error:', error));
  441. },
  442. clickSubmit(values) {
  443. this.$refs.tabstoreVal.submit();
  444. },
  445. onConfirm(value) {
  446. if (!value) return;
  447. this.fromData.storeCategoryName = value.dictLabel;
  448. this.fromData.storeCategory = value.dictValue;
  449. this.showPicker = false;
  450. },
  451. getStoreCategoryList() {
  452. qzStoreCategory().then((res) => {
  453. if (res.code == 200) {
  454. this.storeCategoryList = res.data;
  455. this.fromData.storeCategoryName = this.storeCategoryList[0].dictLabel;
  456. this.fromData.storeCategory = this.storeCategoryList[0].dictValue;
  457. }
  458. });
  459. },
  460. onSubmit(value) {
  461. this.toastLoading(0, '提交中...', true);
  462. console.log(this.fromData);
  463. addQzStore(this.fromData).then((res) => {
  464. this.toastLoading().clear();
  465. if (res.code == 200) {
  466. this.$dialog
  467. .confirm({
  468. title: '系统提示',
  469. message: '添加成功',
  470. showCancelButton: false,
  471. })
  472. .then(() => {
  473. this.onClickLeft();
  474. });
  475. }
  476. });
  477. },
  478. FSQValidatePhone(telephone) {
  479. return new Promise((resolve, reject) => {
  480. if (telephone == '') {
  481. resolve();
  482. }
  483. var telrg = /^1[123456789]\d{9}$/;
  484. if (telephone.trim() == '') {
  485. reject();
  486. } else if (!telrg.test(telephone)) {
  487. this.Toast('手机号格式错误');
  488. reject();
  489. } else {
  490. phoneCheck({ phoneNumber: telephone }).then((res) => {
  491. if (res.code == 200) {
  492. resolve();
  493. } else {
  494. this.Toast('手机号格式错误');
  495. reject();
  496. }
  497. });
  498. }
  499. });
  500. },
  501. addressFn() {
  502. localStorage.setItem('locationRemark', this.fromData.addressLine);
  503. },
  504. fns() {
  505. this.search = '';
  506. this.showmap = true;
  507. jsonp(
  508. 'https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(' +
  509. this.location.lat1 +
  510. ',' +
  511. this.location.lon1 +
  512. ',1000,0)&page_size=10&page_index=1&orderby=_distance&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6'
  513. ).then((res) => {
  514. this.maplist = res.data;
  515. setTimeout(() => {
  516. this.addVisits1();
  517. });
  518. });
  519. this.addresssb = -1;
  520. },
  521. confirmMap() {
  522. if (this.addresssb > -1) {
  523. this.fromData.addressLine = this.maplist[this.addresssb].address;
  524. }
  525. this.showmap = false;
  526. },
  527. addressFns(val) {
  528. var that = this;
  529. setTimeout(() => {
  530. that.searchSHow = false;
  531. that.map.setCenter(new TMap.LatLng(val.location.lat, val.location.lng));
  532. that.markers1.updateGeometries([
  533. {
  534. id: 'marker',
  535. styleId: 'marker',
  536. position: new TMap.LatLng(val.location.lat, val.location.lng),
  537. },
  538. ]);
  539. that.maplist = [];
  540. jsonp(
  541. 'https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(' +
  542. val.location.lat +
  543. ',' +
  544. val.location.lng +
  545. ',1000,0)&page_size=20&page_index=1&orderby=_distance&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6'
  546. ).then((res) => {
  547. that.maplist = res.data;
  548. that.marker.setGeometries([]);
  549. setTimeout(() => {
  550. for (let p = 0; p < res.data.length; p++) {
  551. that.marker.updateGeometries([
  552. {
  553. id: res.data[p].id,
  554. position: new TMap.LatLng(res.data[p].location.lat, res.data[p].location.lng),
  555. },
  556. ]);
  557. }
  558. });
  559. });
  560. that.addresssb = -1;
  561. });
  562. },
  563. searchFn(val) {
  564. this.searchSHow = false;
  565. var that = this;
  566. jsonp(
  567. 'https://apis.map.qq.com/ws/place/v1/suggestion?keyword=' +
  568. val +
  569. '&location=' +
  570. this.location.lat1 +
  571. ',' +
  572. this.location.lon1 +
  573. '&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6&page_size=20&region_fix=1'
  574. ).then((res) => {
  575. this.searchSHow = true;
  576. that.mapsearchlist = res.data;
  577. });
  578. },
  579. mapselect(val) {
  580. if (val > -1) {
  581. this.markers.updateGeometries([
  582. {
  583. id: 'markers1',
  584. styleId: 'abc',
  585. position: new TMap.LatLng(
  586. this.maplist[val].location.lat,
  587. this.maplist[val].location.lng
  588. ),
  589. },
  590. ]);
  591. }
  592. },
  593. addVisits1() {
  594. var that = this;
  595. var map = new TMap.Map('allmap1', {
  596. zoom: 15,
  597. center: new TMap.LatLng(that.location.lat1, that.location.lon1),
  598. });
  599. var markers = new TMap.MultiMarker({
  600. id: 'markers',
  601. map: map,
  602. geometries: [],
  603. styles: {
  604. marker: new TMap.MarkerStyle({
  605. width: 32,
  606. height: 40,
  607. anchor: { x: 16, y: 32 },
  608. src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker-pink.png',
  609. }),
  610. },
  611. });
  612. markers.setGeometries([]);
  613. var location = new TMap.LatLng(that.location.lat1, that.location.lon1);
  614. map.setCenter(location);
  615. markers.updateGeometries([
  616. {
  617. id: 'marker',
  618. styleId: 'marker',
  619. position: location,
  620. },
  621. ]);
  622. var marker = new TMap.MultiMarker({
  623. map: map,
  624. styles: {
  625. default: new TMap.MarkerStyle({
  626. width: 32,
  627. height: 40,
  628. anchor: {
  629. x: 17,
  630. y: 21,
  631. },
  632. src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker_blue.png',
  633. }),
  634. },
  635. geometries: [],
  636. });
  637. for (let p = 0; p < this.maplist.length; p++) {
  638. marker.updateGeometries([
  639. {
  640. id: this.maplist[p].id,
  641. position: new TMap.LatLng(this.maplist[p].location.lat, this.maplist[p].location.lng),
  642. },
  643. ]);
  644. }
  645. var markers1 = new TMap.MultiMarker({
  646. map: map,
  647. mapgeometries: [
  648. {
  649. id: 'markers1',
  650. position: new TMap.LatLng(0, 0),
  651. },
  652. ],
  653. styles: {
  654. abc: new TMap.MarkerStyle({
  655. width: 32,
  656. height: 40,
  657. anchor: { x: 16, y: 32 },
  658. src: require('@/assets/marker_blue.png'),
  659. }),
  660. },
  661. });
  662. markers1.setGeometries([]);
  663. this.markers = markers1;
  664. this.map = map;
  665. this.markers1 = markers;
  666. this.marker = marker;
  667. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.SCALE);
  668. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ROTATION);
  669. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ZOOM);
  670. },
  671. onProvinceConfirm(value) {
  672. this.fromData.provinceName = value.text;
  673. this.fromData.province = value.provinceCode;
  674. this.fromData.cityName = '';
  675. this.fromData.city = '';
  676. this.fromData.districtName = '';
  677. this.fromData.countyCode = '';
  678. // this.fromData.townName = '';
  679. // this.fromData.townCode = '';
  680. this.countyCode = '';
  681. this.cityCode = '';
  682. this.provinceCode = value.provinceCode;
  683. this.getStreetQuery('1');
  684. this.showProvincePicker = false;
  685. },
  686. onCityConfirm(value) {
  687. this.fromData.cityName = value.text;
  688. this.fromData.city = value.cityCode;
  689. this.fromData.districtName = '';
  690. this.fromData.district = '';
  691. // this.fromData.townName = '';
  692. // this.fromData.townCode = '';
  693. this.countyCode = '';
  694. this.cityCode = value.cityCode;
  695. this.getStreetQuery('2');
  696. this.showCityPicker = false;
  697. },
  698. onDistrictConfirm(value) {
  699. this.fromData.districtName = value.text;
  700. this.fromData.district = value.countyCode;
  701. // this.fromData.townName = '';
  702. // this.fromData.townCode = '';
  703. this.countyCode = value.countyCode;
  704. this.fromData.cityLevel = value.countyLevel;
  705. // this.getStreetQuery('3');
  706. this.showDistrictPicker = false;
  707. },
  708. onTownConfirm(value) {
  709. this.fromData.townName = value.text;
  710. this.fromData.townCode = value.townCode;
  711. this.showTownPicker = false;
  712. },
  713. getStreetQuery(type) {
  714. var provinceCode = this.fromData.province;
  715. var cityCode = this.fromData.city;
  716. var countyCode = this.fromData.district;
  717. if (type == '1') {
  718. cityCode = '';
  719. countyCode = '';
  720. } else if (type == '2') {
  721. countyCode = '';
  722. } else if (type == '3') {
  723. console.log('ok');
  724. } else {
  725. provinceCode = '';
  726. cityCode = '';
  727. countyCode = '';
  728. }
  729. streetQuery({ provinceCode: provinceCode, cityCode: cityCode, countyCode: countyCode }).then(
  730. (res) => {
  731. if (res.code == 200) {
  732. var provinceList = [];
  733. var cityList = [];
  734. var districtList = [];
  735. var townList = [];
  736. if (type == '1') {
  737. for (var z1 = 0; z1 < res.data.length; z1++) {
  738. cityList.push({ cityCode: res.data[z1].cityCode, text: res.data[z1].cityName });
  739. }
  740. this.cityList = cityList;
  741. } else if (type == '2') {
  742. for (var z2 = 0; z2 < res.data.length; z2++) {
  743. districtList.push({
  744. countyCode: res.data[z2].countyCode,
  745. text: res.data[z2].countyName,
  746. countyLevel: res.data[z2].countyLevel,
  747. });
  748. }
  749. this.districtList = districtList;
  750. } else if (type == '3') {
  751. for (var z3 = 0; z3 < res.data.length; z3++) {
  752. townList.push({ townCode: res.data[z3].townCode, text: res.data[z3].townName });
  753. }
  754. this.townList = townList;
  755. } else {
  756. for (var z = 0; z < res.data.length; z++) {
  757. provinceList.push({
  758. provinceCode: res.data[z].provinceCode,
  759. text: res.data[z].provinceName,
  760. });
  761. }
  762. this.provinceList = provinceList;
  763. }
  764. } else {
  765. this.$toast.fail('请求超时');
  766. }
  767. }
  768. );
  769. },
  770. PickerDept() {
  771. this.showPickerDept = true;
  772. },
  773. onDeptConfirm(value) {
  774. this.fromData.orgName = value.text;
  775. localStorage.setItem('orgName', value.text);
  776. this.fromData.orgId = value.deptId;
  777. // this.fromData.chainCode = '';
  778. // this.fromData.chainName = '';
  779. this.showPickerDept = false;
  780. },
  781. getChildDeptListFun() {
  782. getChildDeptList({
  783. cityName: this.fromData.cityName,
  784. districtName: this.fromData.districtName,
  785. }).then((res) => {
  786. var deptList = [];
  787. for (var t1 = 0; t1 < res.data.length; t1++) {
  788. deptList.push({
  789. deptId: res.data[t1].deptId,
  790. text: res.data[t1].deptName,
  791. });
  792. }
  793. this.deptList = deptList;
  794. });
  795. },
  796. // getChainsByDeptCode(deptId, ifJzStoreType, type) {
  797. // getChainsByDeptCode({
  798. // cityName: this.fromData.cityNameOld,
  799. // districtName: this.fromData.districtNameOld,
  800. // deptId: deptId,
  801. // ifJzStoreType: ifJzStoreType,
  802. // storeCategory: this.fromData.storeCategory,
  803. // }).then((res) => {
  804. // // if (this.ChainsList.length == 1) {
  805. // // this.fromData.chainName = this.ChainsList[0].chainName;
  806. // // this.fromData.chainCode = this.ChainsList[0].chainCode;
  807. // // }
  808. // if (res.data.sfaOrderProducts != null) {
  809. // res.data.sfaOrderProducts.forEach((item) => {
  810. // item.orderNum = '';
  811. // item.storeProductId = item.orderProductId;
  812. // });
  813. // this.sfaOrderProducts = res.data.sfaOrderProducts;
  814. // }
  815. // var deptList = [];
  816. // for (var t1 = 0; t1 < res.data.deptList.length; t1++) {
  817. // deptList.push({
  818. // deptId: res.data.deptList[t1].deptId,
  819. // text: res.data.deptList[t1].deptName,
  820. // });
  821. // }
  822. // this.deptList = deptList;
  823. // if (deptList.length == 1) {
  824. // this.fromData.orgId = deptList[0].deptId;
  825. // this.fromData.orgName = deptList[0].text;
  826. // localStorage.setItem('orgName', deptList[0].text);
  827. // this.deptShow = false;
  828. // this.ChainsList = res.data.sfaChains;
  829. // } else {
  830. // this.ChainsList = [];
  831. // this.deptShow = true;
  832. // }
  833. // });
  834. // },
  835. onClickLeft() {
  836. this.$router.go(-1);
  837. },
  838. },
  839. };
  840. </script>
  841. <style lang="scss" scoped>
  842. .FSQStoreDetail {
  843. display: flex;
  844. flex-direction: column;
  845. width: 100%;
  846. height: 100%;
  847. .header {
  848. height: 46px;
  849. }
  850. .content {
  851. flex: 1;
  852. overflow-y: auto;
  853. }
  854. }
  855. </style>
  856. <style lang="scss">
  857. .van-dialog__confirm,
  858. .van-dialog__confirm:active {
  859. color: #0057ba;
  860. }
  861. .navBarTOP {
  862. position: fixed;
  863. width: 100%;
  864. z-index: 2;
  865. top: 0;
  866. }
  867. #allmap {
  868. width: 100px;
  869. height: 100px;
  870. position: fixed;
  871. left: -2000px;
  872. }
  873. .typeRadioStore .van-radio {
  874. margin: 10px;
  875. }
  876. .typeRadioStore .van-radio__icon .van-icon {
  877. border: 0 !important;
  878. }
  879. .typeRadioStore .van-radio__icon--checked .van-icon {
  880. color: #1989fa;
  881. background-color: transparent;
  882. border-color: transparent;
  883. }
  884. .typeRadioStore .van-cell {
  885. padding: 0 16px;
  886. line-height: 40px;
  887. }
  888. .container .typeRadioStore .van-cell__title {
  889. height: 40px;
  890. }
  891. .typeRadioStore1 .van-radio__icon .van-icon {
  892. border-radius: 2px;
  893. border-color: #ccc !important;
  894. }
  895. .typeRadioStore1 .van-radio__icon--checked .van-icon {
  896. background-color: transparent;
  897. color: #1989fa;
  898. border-color: #1989fa !important;
  899. }
  900. .typeRadioStore1 .van-radio[aria-checked='true'] .van-radio__label {
  901. color: #1989fa;
  902. }
  903. .morelaji .van-cell {
  904. padding: 10px 0;
  905. }
  906. .storeAdd {
  907. .agencyBox {
  908. .header_btn {
  909. display: flex;
  910. align-items: center;
  911. justify-content: space-between;
  912. padding: 10px;
  913. font-size: 16px;
  914. border-bottom: 1px solid #ccc;
  915. div {
  916. padding: 3px;
  917. }
  918. }
  919. .van-sidebar {
  920. width: 100px;
  921. text-align: center;
  922. flex: none;
  923. }
  924. .treeSelectchildren {
  925. .item {
  926. display: flex;
  927. align-items: center;
  928. padding: 5px;
  929. .value {
  930. margin-left: 15px;
  931. }
  932. }
  933. }
  934. }
  935. .TCFXList {
  936. .van-field__control--custom {
  937. flex-direction: column;
  938. align-items: self-start;
  939. .sfaStoreChainsContactList {
  940. padding: 3px;
  941. }
  942. }
  943. }
  944. }
  945. </style>