addDesignerPage.vue 25 KB

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