addDesignerEdit.vue 26 KB

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