competingStoresAdd.vue 28 KB

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