competingStoresAdd.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  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>
  118. </van-field>
  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. storeName: '',
  276. telephone: '',
  277. storeCategoryName: '',
  278. provinceName: '',
  279. cityName: '',
  280. districtName: '',
  281. addressLine: '',
  282. orgName: '',
  283. salesmanName: '',
  284. lat: '',
  285. lon: '',
  286. cityNameOld: '',
  287. districtNameOld: '',
  288. },
  289. location: {
  290. lat1: '34.6174',
  291. lon1: '112.44039',
  292. },
  293. mlon: '',
  294. mlan: '',
  295. showProvincePicker: false,
  296. showCityPicker: false,
  297. showDistrictPicker: false,
  298. showTownPicker: false,
  299. provinceList: [],
  300. cityList: [],
  301. districtList: [],
  302. townList: [],
  303. provinceCode: '',
  304. deptShow: false,
  305. showPickerDept: false,
  306. deptList: [],
  307. // 地图信息
  308. showmap: false,
  309. search: '',
  310. searchSHow: false,
  311. mapsearchlist: [],
  312. addresssb: -1,
  313. markers: undefined,
  314. maplist: [],
  315. };
  316. },
  317. created() {
  318. this.showmap = false;
  319. this.getStoreCategoryList();
  320. // this.toastLoading(0, '加载中...', true);
  321. // 授权
  322. getTicketFun(['getLocation', 'chooseImage', 'uploadImage']).then(() => {
  323. this.$nextTick(() => {
  324. this.getLocation();
  325. });
  326. });
  327. },
  328. methods: {
  329. getLocation() {
  330. getPosition()
  331. .then((res) => {
  332. let { TXisBD, resData } = res;
  333. this.mlon = resData.longitude;
  334. this.mlan = resData.latitude;
  335. this.location = TXisBD;
  336. this.fromData.lat = TXisBD.lat;
  337. this.fromData.lon = TXisBD.lon;
  338. this.location.lat1 = resData.latitude;
  339. this.location.lon1 = resData.longitude;
  340. this.addVisits();
  341. this.initData();
  342. })
  343. .catch((error) => {
  344. // this.beforeAddFn();
  345. this.$dialog.alert({
  346. message: error,
  347. });
  348. });
  349. },
  350. initData() {
  351. getGeocoder({ latitude: this.location.lat1, longitude: this.location.lon1 })
  352. .then((res) => {
  353. if (res.status == 0 && res.result) {
  354. let result = res.result;
  355. this.fromData.cityNameOld = result.ad_info.city;
  356. this.fromData.districtNameOld = result.ad_info.district;
  357. let addresses = result.formatted_addresses; // 描述性地址
  358. getstreetInfoList({ districtName: result.ad_info.district }).then((response) => {
  359. if (response.code == 200 && response.data) {
  360. this.fromData.province = response.data.provinceCode;
  361. this.fromData.city = response.data.cityCode;
  362. this.fromData.district = response.data.countyCode;
  363. this.fromData.provinceName = response.data.provinceName;
  364. this.fromData.cityName = response.data.cityName;
  365. this.fromData.districtName = response.data.countyName;
  366. this.fromData.cityLevel = response.data.countyLevel;
  367. this.$nextTick(() => {
  368. this.getStreetQuery();
  369. this.getStreetQuery('1');
  370. this.getStreetQuery('2');
  371. // this.getStreetQuery('3');
  372. });
  373. }
  374. });
  375. if (addresses) {
  376. this.fromData.addressLine = addresses.recommend;
  377. localStorage.setItem('locationRemark', addresses.recommend);
  378. }
  379. } else {
  380. this.toastLoading().clear();
  381. }
  382. })
  383. .catch(() => {
  384. this.toastLoading().clear();
  385. });
  386. },
  387. addVisits() {
  388. var that = this;
  389. var map = new TMap.Map('allmap', {
  390. zoom: 15,
  391. center: new TMap.LatLng(39.986785, 116.301012),
  392. });
  393. var geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
  394. var markers = new TMap.MultiMarker({
  395. map: map,
  396. geometries: [],
  397. });
  398. markers.setGeometries([]);
  399. var location = new TMap.LatLng(that.location.lat1, that.location.lon1);
  400. map.setCenter(location);
  401. markers.updateGeometries([{ id: 'marker', position: location }]);
  402. geocoder
  403. .getAddress({ location: location })
  404. .then(function (result) {
  405. var addresses = result.result.formatted_addresses;
  406. that.fromData.cityNameOld = result.result.ad_info.city;
  407. that.fromData.districtNameOld = result.result.ad_info.district;
  408. that.fromData.addressLine = addresses.recommend;
  409. localStorage.setItem('locationRemark', addresses.recommend);
  410. })
  411. .catch((error) => console.error('Geocoding error:', error));
  412. },
  413. clickSubmit(values) {
  414. this.$refs.tabstoreVal.submit();
  415. },
  416. getStoreCategoryList() {
  417. // designerStoreCategory().then((res) => {
  418. // if (res.code == 200) {
  419. // this.storeCategoryList = res.data;
  420. // this.fromData.storeCategoryName = this.storeCategoryList[0].dictLabel;
  421. // this.fromData.storeCategory = this.storeCategoryList[0].dictValue;
  422. // }
  423. // });
  424. },
  425. onSubmit(value) {
  426. this.toastLoading(0, '提交中...', true);
  427. updateStore(this.fromData).then((res) => {
  428. this.toastLoading().clear();
  429. if (res.code == 200) {
  430. this.$dialog
  431. .confirm({
  432. title: '系统提示',
  433. message: '修改成功',
  434. showCancelButton: false,
  435. })
  436. .then(() => {
  437. this.onClickLeft();
  438. });
  439. }
  440. });
  441. },
  442. FSQValidatePhone(telephone) {
  443. return new Promise((resolve, reject) => {
  444. if (telephone == '') {
  445. resolve();
  446. }
  447. 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}$/;
  448. if (telephone.trim() == '') {
  449. reject();
  450. } else if (!telrg.test(telephone)) {
  451. this.Toast('手机号格式错误');
  452. reject();
  453. } else {
  454. phoneCheck({ phoneNumber: telephone }).then((res) => {
  455. if (res.code == 200) {
  456. resolve();
  457. } else {
  458. this.Toast('手机号格式错误');
  459. reject();
  460. }
  461. });
  462. }
  463. });
  464. },
  465. addressFn() {
  466. localStorage.setItem('locationRemark', this.fromData.addressLine);
  467. },
  468. fns() {
  469. this.search = '';
  470. this.showmap = true;
  471. jsonp(
  472. 'https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(' +
  473. this.location.lat1 +
  474. ',' +
  475. this.location.lon1 +
  476. ',1000,0)&page_size=10&page_index=1&orderby=_distance&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6'
  477. ).then((res) => {
  478. this.maplist = res.data;
  479. setTimeout(() => {
  480. this.addVisits1();
  481. });
  482. });
  483. this.addresssb = -1;
  484. },
  485. confirmMap() {
  486. if (this.addresssb > -1) {
  487. this.fromData.addressLine = this.maplist[this.addresssb].address;
  488. }
  489. this.showmap = false;
  490. },
  491. addressFns(val) {
  492. var that = this;
  493. setTimeout(() => {
  494. that.searchSHow = false;
  495. that.map.setCenter(new TMap.LatLng(val.location.lat, val.location.lng));
  496. that.markers1.updateGeometries([
  497. {
  498. id: 'marker',
  499. styleId: 'marker',
  500. position: new TMap.LatLng(val.location.lat, val.location.lng),
  501. },
  502. ]);
  503. that.maplist = [];
  504. jsonp(
  505. 'https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(' +
  506. val.location.lat +
  507. ',' +
  508. val.location.lng +
  509. ',1000,0)&page_size=20&page_index=1&orderby=_distance&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6'
  510. ).then((res) => {
  511. that.maplist = res.data;
  512. that.marker.setGeometries([]);
  513. setTimeout(() => {
  514. for (let p = 0; p < res.data.length; p++) {
  515. that.marker.updateGeometries([
  516. {
  517. id: res.data[p].id,
  518. position: new TMap.LatLng(res.data[p].location.lat, res.data[p].location.lng),
  519. },
  520. ]);
  521. }
  522. });
  523. });
  524. that.addresssb = -1;
  525. });
  526. },
  527. searchFn(val) {
  528. this.searchSHow = false;
  529. var that = this;
  530. jsonp(
  531. 'https://apis.map.qq.com/ws/place/v1/suggestion?keyword=' +
  532. val +
  533. '&location=' +
  534. this.location.lat1 +
  535. ',' +
  536. this.location.lon1 +
  537. '&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6&page_size=20&region_fix=1'
  538. ).then((res) => {
  539. this.searchSHow = true;
  540. that.mapsearchlist = res.data;
  541. });
  542. },
  543. mapselect(val) {
  544. if (val > -1) {
  545. this.markers.updateGeometries([
  546. {
  547. id: 'markers1',
  548. styleId: 'abc',
  549. position: new TMap.LatLng(
  550. this.maplist[val].location.lat,
  551. this.maplist[val].location.lng
  552. ),
  553. },
  554. ]);
  555. }
  556. },
  557. addVisits1() {
  558. var that = this;
  559. var map = new TMap.Map('allmap1', {
  560. zoom: 15,
  561. center: new TMap.LatLng(that.location.lat1, that.location.lon1),
  562. });
  563. var markers = new TMap.MultiMarker({
  564. id: 'markers',
  565. map: map,
  566. geometries: [],
  567. styles: {
  568. marker: new TMap.MarkerStyle({
  569. width: 32,
  570. height: 40,
  571. anchor: { x: 16, y: 32 },
  572. src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker-pink.png',
  573. }),
  574. },
  575. });
  576. markers.setGeometries([]);
  577. var location = new TMap.LatLng(that.location.lat1, that.location.lon1);
  578. map.setCenter(location);
  579. markers.updateGeometries([
  580. {
  581. id: 'marker',
  582. styleId: 'marker',
  583. position: location,
  584. },
  585. ]);
  586. var marker = new TMap.MultiMarker({
  587. map: map,
  588. styles: {
  589. default: new TMap.MarkerStyle({
  590. width: 32,
  591. height: 40,
  592. anchor: {
  593. x: 17,
  594. y: 21,
  595. },
  596. src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker_blue.png',
  597. }),
  598. },
  599. geometries: [],
  600. });
  601. for (let p = 0; p < this.maplist.length; p++) {
  602. marker.updateGeometries([
  603. {
  604. id: this.maplist[p].id,
  605. position: new TMap.LatLng(this.maplist[p].location.lat, this.maplist[p].location.lng),
  606. },
  607. ]);
  608. }
  609. var markers1 = new TMap.MultiMarker({
  610. map: map,
  611. mapgeometries: [
  612. {
  613. id: 'markers1',
  614. position: new TMap.LatLng(0, 0),
  615. },
  616. ],
  617. styles: {
  618. abc: new TMap.MarkerStyle({
  619. width: 32,
  620. height: 40,
  621. anchor: { x: 16, y: 32 },
  622. src: require('@/assets/marker_blue.png'),
  623. }),
  624. },
  625. });
  626. markers1.setGeometries([]);
  627. this.markers = markers1;
  628. this.map = map;
  629. this.markers1 = markers;
  630. this.marker = marker;
  631. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.SCALE);
  632. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ROTATION);
  633. map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ZOOM);
  634. },
  635. onProvinceConfirm(value) {
  636. this.fromData.provinceName = value.text;
  637. this.fromData.province = value.provinceCode;
  638. this.fromData.cityName = '';
  639. this.fromData.city = '';
  640. this.fromData.districtName = '';
  641. this.fromData.countyCode = '';
  642. // this.fromData.townName = '';
  643. // this.fromData.townCode = '';
  644. this.countyCode = '';
  645. this.cityCode = '';
  646. this.provinceCode = value.provinceCode;
  647. this.getStreetQuery('1');
  648. this.showProvincePicker = false;
  649. },
  650. onCityConfirm(value) {
  651. this.fromData.cityName = value.text;
  652. this.fromData.city = value.cityCode;
  653. this.fromData.districtName = '';
  654. this.fromData.district = '';
  655. // this.fromData.townName = '';
  656. // this.fromData.townCode = '';
  657. this.countyCode = '';
  658. this.cityCode = value.cityCode;
  659. this.getStreetQuery('2');
  660. this.showCityPicker = false;
  661. },
  662. onDistrictConfirm(value) {
  663. this.fromData.districtName = value.text;
  664. this.fromData.district = value.countyCode;
  665. // this.fromData.townName = '';
  666. // this.fromData.townCode = '';
  667. this.countyCode = value.countyCode;
  668. this.fromData.cityLevel = value.countyLevel;
  669. // this.getStreetQuery('3');
  670. this.showDistrictPicker = false;
  671. },
  672. onTownConfirm(value) {
  673. this.fromData.townName = value.text;
  674. this.fromData.townCode = value.townCode;
  675. this.showTownPicker = false;
  676. },
  677. getStreetQuery(type) {
  678. var provinceCode = this.fromData.province;
  679. var cityCode = this.fromData.city;
  680. var countyCode = this.fromData.district;
  681. if (type == '1') {
  682. cityCode = '';
  683. countyCode = '';
  684. } else if (type == '2') {
  685. countyCode = '';
  686. } else if (type == '3') {
  687. console.log('ok');
  688. } else {
  689. provinceCode = '';
  690. cityCode = '';
  691. countyCode = '';
  692. }
  693. streetQuery({ provinceCode: provinceCode, cityCode: cityCode, countyCode: countyCode }).then(
  694. (res) => {
  695. if (res.code == 200) {
  696. var provinceList = [];
  697. var cityList = [];
  698. var districtList = [];
  699. var townList = [];
  700. if (type == '1') {
  701. for (var z1 = 0; z1 < res.data.length; z1++) {
  702. cityList.push({ cityCode: res.data[z1].cityCode, text: res.data[z1].cityName });
  703. }
  704. this.cityList = cityList;
  705. } else if (type == '2') {
  706. for (var z2 = 0; z2 < res.data.length; z2++) {
  707. districtList.push({
  708. countyCode: res.data[z2].countyCode,
  709. text: res.data[z2].countyName,
  710. countyLevel: res.data[z2].countyLevel,
  711. });
  712. }
  713. this.districtList = districtList;
  714. } else if (type == '3') {
  715. for (var z3 = 0; z3 < res.data.length; z3++) {
  716. townList.push({ townCode: res.data[z3].townCode, text: res.data[z3].townName });
  717. }
  718. this.townList = townList;
  719. } else {
  720. for (var z = 0; z < res.data.length; z++) {
  721. provinceList.push({
  722. provinceCode: res.data[z].provinceCode,
  723. text: res.data[z].provinceName,
  724. });
  725. }
  726. this.provinceList = provinceList;
  727. }
  728. } else {
  729. this.$toast.fail('请求超时');
  730. }
  731. }
  732. );
  733. },
  734. PickerDept() {
  735. if (this.deptShow) {
  736. this.showPickerDept = true;
  737. }
  738. },
  739. onDeptConfirm(value) {
  740. this.fromData.orgName = value.text;
  741. localStorage.setItem('orgName', value.text);
  742. this.fromData.orgId = value.deptId;
  743. // this.fromData.chainCode = '';
  744. // this.fromData.chainName = '';
  745. this.getChainsByDeptId(value.deptId, this.fromData.ifJzStoreType);
  746. this.showPickerDept = false;
  747. },
  748. getChainsByDeptId(deptCode, ifJzStoreType) {
  749. getChainsByDeptCode({
  750. cityName: this.fromData.cityName,
  751. districtName: this.fromData.districtName,
  752. deptId: deptCode,
  753. ifJzStoreType: ifJzStoreType,
  754. storeCategory: this.fromData.storeCategory,
  755. }).then((res) => {
  756. if (res.data.sfaOrderProducts != null) {
  757. res.data.sfaOrderProducts.forEach((item) => {
  758. item.orderNum = '';
  759. item.storeProductId = item.orderProductId;
  760. });
  761. this.sfaOrderProducts = res.data.sfaOrderProducts;
  762. }
  763. this.ChainsList = res.data.sfaChains;
  764. });
  765. },
  766. getChainsByDeptCode(deptId, ifJzStoreType, type) {
  767. getChainsByDeptCode({
  768. cityName: this.fromData.cityNameOld,
  769. districtName: this.fromData.districtNameOld,
  770. deptId: deptId,
  771. ifJzStoreType: ifJzStoreType,
  772. storeCategory: this.fromData.storeCategory,
  773. }).then((res) => {
  774. // if (this.ChainsList.length == 1) {
  775. // this.fromData.chainName = this.ChainsList[0].chainName;
  776. // this.fromData.chainCode = this.ChainsList[0].chainCode;
  777. // }
  778. if (res.data.sfaOrderProducts != null) {
  779. res.data.sfaOrderProducts.forEach((item) => {
  780. item.orderNum = '';
  781. item.storeProductId = item.orderProductId;
  782. });
  783. this.sfaOrderProducts = res.data.sfaOrderProducts;
  784. }
  785. var deptList = [];
  786. for (var t1 = 0; t1 < res.data.deptList.length; t1++) {
  787. deptList.push({
  788. deptId: res.data.deptList[t1].deptId,
  789. text: res.data.deptList[t1].deptName,
  790. });
  791. }
  792. this.deptList = deptList;
  793. if (deptList.length == 1) {
  794. this.fromData.orgId = deptList[0].deptId;
  795. this.fromData.orgName = deptList[0].text;
  796. localStorage.setItem('orgName', deptList[0].text);
  797. this.deptShow = false;
  798. this.ChainsList = res.data.sfaChains;
  799. } else {
  800. this.ChainsList = [];
  801. this.deptShow = true;
  802. }
  803. });
  804. },
  805. onClickLeft() {
  806. this.$router.go(-1);
  807. },
  808. },
  809. };
  810. </script>
  811. <style lang="scss" scoped>
  812. .FSQStoreDetail {
  813. display: flex;
  814. flex-direction: column;
  815. width: 100%;
  816. height: 100%;
  817. .header {
  818. height: 46px;
  819. }
  820. .content {
  821. flex: 1;
  822. overflow-y: auto;
  823. }
  824. }
  825. </style>
  826. <style lang="scss">
  827. .van-dialog__confirm,
  828. .van-dialog__confirm:active {
  829. color: #0057ba;
  830. }
  831. .navBarTOP {
  832. position: fixed;
  833. width: 100%;
  834. z-index: 2;
  835. top: 0;
  836. }
  837. #allmap {
  838. width: 100px;
  839. height: 100px;
  840. position: fixed;
  841. left: -2000px;
  842. }
  843. .typeRadioStore .van-radio {
  844. margin: 10px;
  845. }
  846. .typeRadioStore .van-radio__icon .van-icon {
  847. border: 0 !important;
  848. }
  849. .typeRadioStore .van-radio__icon--checked .van-icon {
  850. color: #1989fa;
  851. background-color: transparent;
  852. border-color: transparent;
  853. }
  854. .typeRadioStore .van-cell {
  855. padding: 0 16px;
  856. line-height: 40px;
  857. }
  858. .container .typeRadioStore .van-cell__title {
  859. height: 40px;
  860. }
  861. .typeRadioStore1 .van-radio__icon .van-icon {
  862. border-radius: 2px;
  863. border-color: #ccc !important;
  864. }
  865. .typeRadioStore1 .van-radio__icon--checked .van-icon {
  866. background-color: transparent;
  867. color: #1989fa;
  868. border-color: #1989fa !important;
  869. }
  870. .typeRadioStore1 .van-radio[aria-checked='true'] .van-radio__label {
  871. color: #1989fa;
  872. }
  873. .morelaji .van-cell {
  874. padding: 10px 0;
  875. }
  876. .storeAdd {
  877. .agencyBox {
  878. .header_btn {
  879. display: flex;
  880. align-items: center;
  881. justify-content: space-between;
  882. padding: 10px;
  883. font-size: 16px;
  884. border-bottom: 1px solid #ccc;
  885. div {
  886. padding: 3px;
  887. }
  888. }
  889. .van-sidebar {
  890. width: 100px;
  891. text-align: center;
  892. flex: none;
  893. }
  894. .treeSelectchildren {
  895. .item {
  896. display: flex;
  897. align-items: center;
  898. padding: 5px;
  899. .value {
  900. margin-left: 15px;
  901. }
  902. }
  903. }
  904. }
  905. .TCFXList {
  906. .van-field__control--custom {
  907. flex-direction: column;
  908. align-items: self-start;
  909. .sfaStoreChainsContactList {
  910. padding: 3px;
  911. }
  912. }
  913. }
  914. }
  915. </style>