addDesignerPage.vue 27 KB

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