addDesignerPage.vue 25 KB

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