addDesignerPage.vue 25 KB

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