index.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135
  1. <template>
  2. <div class="bgcolor home">
  3. <div class="header">
  4. <van-nav-bar class="navBar" :title="$route.meta.title">
  5. <template #right>
  6. <span @click="searchFn">筛选<van-icon name="arrow-down" /></span>
  7. </template>
  8. </van-nav-bar>
  9. <div class="searchDiv">
  10. <van-search
  11. v-model="chainsName"
  12. left-icon="search"
  13. show-action
  14. placeholder="搜索名称/编号/地址"
  15. @clear="clearFn">
  16. <template #action>
  17. <div @click="onSearchm">搜索</div>
  18. </template>
  19. </van-search>
  20. </div>
  21. <van-tabs class="myTab" type="card" v-model="tabVal" color="#0057ba" @change="tabChange">
  22. <van-tab title="销售部" name="0" :disabled="disabled"></van-tab>
  23. <van-tab title="我的" name="1" :disabled="disabled"></van-tab>
  24. </van-tabs>
  25. </div>
  26. <div class="content" id="content" @touchmove="handleTouch">
  27. <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
  28. <van-list
  29. class="myList"
  30. v-model="loading"
  31. :finished="finished"
  32. finished-text="--已经到底了--"
  33. @load="onLoad">
  34. <div class="cellcontent" v-for="(item, index) in list" :key="index" v-if="list.length">
  35. <van-cell>
  36. <div class="card">
  37. <div class="title titlero">
  38. <span @click="goOtherSystem(item)" :style="setStroeNameStyle(item)">
  39. <span>{{ item.chainName }}</span>
  40. (<span>{{ item.chainCode }}</span
  41. >)
  42. </span>
  43. <span class="btn" :data-clipboard-text="item.chainCode">
  44. <van-icon
  45. :name="require('@/assets/icon/paste.png')"
  46. color="#ee0a24"
  47. size="20"
  48. style="top: 6px; margin-left: 4px" />
  49. </span>
  50. </div>
  51. <div class="info">客户分类:{{ verifyChainType(item.typeCode2) }}</div>
  52. <div class="info">实际经营者:{{ item.customerManager }}</div>
  53. <div class="info">开户日期:{{ item.openDate }}</div>
  54. <div class="info">是否冻结:{{ item.freeze }}</div>
  55. <div class="info">是否关户:{{ item.close }}</div>
  56. </div>
  57. <div
  58. class="statstext"
  59. v-if="item.stateString == '未拜访'"
  60. style="background-color: #ed5c68">
  61. 未拜访
  62. </div>
  63. <div
  64. class="statstext"
  65. v-if="item.stateString == '拜访中'"
  66. style="background-color: white">
  67. <van-icon :name="require('@/assets/icon/times.png')" color="#ee0a24" size="32" />
  68. </div>
  69. <div class="statstext" v-if="item.stateString == '已拜访'">已拜访</div>
  70. <div class="btnbox">
  71. <van-row>
  72. <van-col span="5" v-if="item.stateString != '已拜访'" @click="storeVisit(item)">
  73. <img
  74. :src="require('@/assets/icon/call.png')"
  75. style="margin: 0 auto; height: 18px; display: block" />
  76. <p style="text-align: center; margin: 0; font-size: 12px">进入拜访</p>
  77. </van-col>
  78. <van-col
  79. span="5"
  80. v-if="item.stateString != '已拜访'"
  81. @click="abnormalVisit(item)">
  82. <img
  83. :src="require('@/assets/icon/yichang.png')"
  84. style="margin: 0 auto; height: 18px; display: block" />
  85. <p style="text-align: center; margin: 0; margin-top: 1px; font-size: 12px">
  86. 异常拜访
  87. </p>
  88. </van-col>
  89. <!-- <van-col span="5" v-if="item.stateString == '已拜访'" @click="Visit(item)">
  90. <img
  91. :src="require('@/assets/icon/bfxx.png')"
  92. style="margin: 0 auto; height: 18px; display: block" />
  93. <p style="text-align: center; margin: 0; margin-top: 1px; font-size: 12px">
  94. 拜访信息
  95. </p>
  96. </van-col> -->
  97. <van-col span="5" @click="visitFn(item)">
  98. <img
  99. :src="require('@/assets/icon/kehuxinxi-2.png')"
  100. style="margin: 0 auto; width: 18px; display: block" />
  101. <p style="text-align: center; margin: 0; margin-top: 1px; font-size: 12px">
  102. 客户门店
  103. </p>
  104. </van-col>
  105. </van-row>
  106. </div>
  107. </van-cell>
  108. <div class="lineGrey"></div>
  109. </div>
  110. <van-empty v-if="list.length == 0" />
  111. </van-list>
  112. </van-pull-refresh>
  113. </div>
  114. <van-popup v-model="showPicker" position="bottom" class="textsize">
  115. <van-row
  116. style="
  117. /* position: fixed; */
  118. /* top: 0; */
  119. width: 100%;
  120. z-index: 998;
  121. background-color: #fff;
  122. border-bottom: 1px solid #ccc;
  123. height: 50px;
  124. ">
  125. <van-col span="3" style="text-align: center; margin: 14px 0" @click="showPicker = false">
  126. <van-icon name="cross" size="20" color="#909399" />
  127. </van-col>
  128. <van-col span="13"> </van-col>
  129. <van-col span="4" style="text-align: center; line-height: 36px" @click="onConfirm">
  130. <div style="color: #0057ba">
  131. <van-button type="info" size="small" color="#0057ba">筛选</van-button>
  132. </div></van-col
  133. >
  134. <van-col span="4" style="text-align: center; line-height: 36px" @click="onsets">
  135. <van-button type="default" size="small" style="height: 28px">重置</van-button>
  136. </van-col>
  137. </van-row>
  138. <!-- <div style="height: 48px; width: 100%"></div> -->
  139. <div class="searchcheck" @touchmove="handleTouch">
  140. <p class="searchchecktitle">&nbsp;经销商</p>
  141. <van-row>
  142. <van-col span="24">
  143. <div @click="moreTypeShowFn">
  144. <van-field
  145. style="
  146. margin-top: -6px;
  147. border-radius: 6px;
  148. border: 1px solid #ccc;
  149. overflow: hidden;
  150. "
  151. readonly
  152. v-model="chainName"
  153. label=""
  154. placeholder="请选择经销商" />
  155. </div>
  156. </van-col>
  157. </van-row>
  158. <p class="searchchecktitle" @click="isMonthVisited = !isMonthVisited">
  159. &nbsp;本月是否拜访<van-icon name="arrow-down" style="float: right" />
  160. </p>
  161. <van-radio-group v-model="monthVisited" direction="horizontal" class="monthVisited">
  162. <template v-if="isMonthVisited">
  163. <van-radio name="1">已拜访</van-radio>
  164. <van-radio name="0">未拜访</van-radio>
  165. </template>
  166. </van-radio-group>
  167. <van-checkbox-group v-model="result" direction="horizontal">
  168. <p class="searchchecktitle" @click="otherfxdShow = !otherfxdShow">
  169. &nbsp;客户分类<van-icon name="arrow-down" style="float: right" />
  170. </p>
  171. <div v-if="otherfxdShow" style="margin: 0 14px; width: 100%">
  172. <p class="searchchecktitle1" @click="otherfxdShow1 = !otherfxdShow1">
  173. 片区经销商<van-icon name="arrow-down" style="float: right" />
  174. </p>
  175. <div v-if="otherfxdShow1">
  176. <div v-for="(item1, index1) in PQChain" :key="200 + index1" class="checkbox1">
  177. <div class="child">
  178. <van-checkbox :name="item1.dictValue">{{ item1.dictLabel }}</van-checkbox>
  179. </div>
  180. </div>
  181. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  182. </div>
  183. <p class="searchchecktitle1" @click="otherfxdShow2 = !otherfxdShow2">
  184. 非片区经销商<van-icon name="arrow-down" style="float: right" />
  185. </p>
  186. <div v-if="otherfxdShow2">
  187. <div v-for="(itemlj, indexlj) in FPQChain" :key="400 + indexlj" class="checkbox1">
  188. <div class="child">
  189. <van-checkbox :name="itemlj.dictValue">{{ itemlj.dictLabel }}</van-checkbox>
  190. </div>
  191. </div>
  192. <div style="clear: both"></div>
  193. </div>
  194. </div>
  195. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  196. </van-checkbox-group>
  197. </div>
  198. </van-popup>
  199. <van-popup v-model="moreTypeShow" position="bottom" style="height: 80%">
  200. <van-row style="background-color: #f5f5f5">
  201. <van-col span="20">
  202. <van-field
  203. left-icon="search"
  204. style="margin-top: 2px; border-radius: 6px; overflow: hidden"
  205. v-model="CustomerName"
  206. label=""
  207. placeholder="请输入关键词"
  208. clearable />
  209. </van-col>
  210. <van-col span="4" style="text-align: center; line-height: 48px" @click="getCustomer">
  211. <div style="background-color: #0057ba; color: #fff">搜索</div></van-col
  212. >
  213. </van-row>
  214. <van-picker
  215. show-toolbar
  216. :columns="chainsData"
  217. value-key="chainName"
  218. @confirm="onConfirmChainsList"
  219. @cancel="moreTypeShow = false"
  220. visible-item-count="10" />
  221. </van-popup>
  222. <!-- 测试用 -->
  223. <!-- 下单系统 -->
  224. <div
  225. class="storeSystem"
  226. v-if="objectPath"
  227. style="
  228. width: 100%;
  229. height: 100%;
  230. position: absolute;
  231. z-index: 9999999;
  232. display: flex;
  233. flex-direction: column;
  234. ">
  235. <div
  236. style="
  237. position: relative;
  238. z-index: 1;
  239. display: flex;
  240. align-items: center;
  241. height: 46px;
  242. background-color: #fff;
  243. font-size: 16px;
  244. font-weight: bold;
  245. justify-content: center;
  246. ">
  247. 下单系统
  248. </div>
  249. <object style="flex: 1" :data="objectPath" type="text/html" width="100%"></object>
  250. </div>
  251. </div>
  252. </template>
  253. <script>
  254. import {
  255. checkVisit,
  256. addVisitsPosition,
  257. mobileReposition,
  258. getStoreTypeListlp,
  259. getStoreLabels,
  260. getCustomerList,
  261. buryingPoint,
  262. } from '@/api/index';
  263. import { checkStoreAddressByStoreCode } from '@/api/visitstore';
  264. import { getPosition, getMapPoi, getkeywordPoi, getTicketFun } from '@/utils/TXApiFun';
  265. import { mapState } from 'vuex';
  266. import store from '@/store';
  267. import { scrollTopMixins } from '@/mixin/scrollTop';
  268. import {
  269. queryMyChainsGroupList,
  270. queryMyChainsGroupListByDept,
  271. checkChainsAddressByChainCode,
  272. getMainchains,
  273. } from '@/api/home';
  274. export default {
  275. name: 'outsidelist',
  276. mixins: [scrollTopMixins],
  277. computed: {
  278. ...mapState({
  279. deviceOutsidePage: (state) => state.isRefreshPage.deviceOutsidePage,
  280. }),
  281. },
  282. data() {
  283. return {
  284. otherShow: false,
  285. chainName: '',
  286. chainCode: '',
  287. showPopover: false,
  288. moreTypeShow: false,
  289. storeLabelTypes: [],
  290. disabled: false,
  291. timer: null,
  292. flag: true,
  293. show: false,
  294. tabVal: '1',
  295. list: [],
  296. cont: 0,
  297. loading: false,
  298. showPicker: false,
  299. finished: false,
  300. otherbqShow: true,
  301. otherkkdShow: true,
  302. otherfxdShow: true,
  303. otherfxdShow2: true,
  304. otherfxdShow1: true,
  305. typeName: '搜索',
  306. visitEndId: '',
  307. pageSize: 12,
  308. pageNum: 1,
  309. listActive: null,
  310. query: '',
  311. chainsName: '',
  312. storeType: '',
  313. endShow: false,
  314. storeCategory: '',
  315. fromValue: {},
  316. storeTypeList: [],
  317. PQChain: [],
  318. FPQChain: [],
  319. chainsData: [],
  320. serachstype: '',
  321. addShow1: false,
  322. storeCategoryList: '',
  323. result: [],
  324. StoreLabels: [],
  325. CustomerName: '',
  326. lat: '',
  327. lon: '',
  328. objectPath: '',
  329. isLoading: false,
  330. monthVisited: '', //本月是否拜访
  331. isMonthVisited: true,
  332. };
  333. },
  334. created() {
  335. if (this.deviceOutsidePage) this.initData();
  336. store.dispatch('setDeviceOutsidePage', false);
  337. },
  338. mounted() {
  339. localStorage.setItem('tabVal', '1');
  340. // 上拉边界下拉出现白色空白
  341. let node = document.getElementsByClassName('home')[0];
  342. node.addEventListener(
  343. 'touchmove',
  344. (e) => {
  345. if (e._isScroller) return;
  346. e.preventDefault();
  347. },
  348. {
  349. passive: false,
  350. }
  351. );
  352. },
  353. methods: {
  354. onRefresh() {
  355. this.onSearch();
  356. this.isLoading = false;
  357. },
  358. handleTouch(e) {
  359. e._isScroller = true;
  360. },
  361. initData() {
  362. // 筛选-门店标签
  363. if (localStorage.getItem('outvstoreLabelTypes') != null) {
  364. this.storeLabelTypes = localStorage.getItem('outvstoreLabelTypes').split(',');
  365. } else {
  366. this.storeLabelTypes = [];
  367. }
  368. this.chainName = localStorage.getItem('outvchainName'); //筛选-经销商名称搜索
  369. this.chainCode = localStorage.getItem('outvchainCode'); //筛选-经销商Code
  370. // 筛选-店型选择
  371. if (localStorage.getItem('outvstoreCategoryList') != null) {
  372. this.result = localStorage.getItem('outvstoreCategoryList').split(',');
  373. this.storeCategoryList = this.result.join(',');
  374. } else {
  375. this.result = [];
  376. this.storeCategoryList = this.result.join(',');
  377. }
  378. // 当前tabs,0:销售部;1:我的
  379. this.tabVal = localStorage.getItem('tabVal') == '0' ? '0' : '1';
  380. this.query = this.$route.query; // 路由参数
  381. localStorage.removeItem('visitId');
  382. if (localStorage.getItem('postType') == 'GZ') {
  383. this.addShow1 = false;
  384. this.otherShow = true; //筛选-其他
  385. } else {
  386. this.addShow1 = true;
  387. this.otherShow = false; //筛选-其他
  388. }
  389. this.onSearch();
  390. },
  391. setStroeNameStyle(item) {
  392. return { color: '#0057ba', 'text-decoration': 'underline' };
  393. },
  394. clearFn() {
  395. this.chainsName = '';
  396. localStorage.setItem('outvstoreName', '');
  397. },
  398. moreTypeShowFn() {
  399. this.moreTypeShow = true;
  400. this.getCustomer();
  401. },
  402. buryingPoint(val) {
  403. buryingPoint(val);
  404. },
  405. getCustomer() {
  406. getMainchains({ mainChainsName: this.CustomerName }).then((request) => {
  407. this.chainsData = request.data;
  408. this.chainsData.push({});
  409. this.chainsData.pop();
  410. });
  411. },
  412. onConfirmChainsList(value) {
  413. if (value.chainName != undefined) {
  414. this.chainName = value.chainName;
  415. this.chainCode = value.chainCode;
  416. }
  417. this.showPickerChainsList = false;
  418. this.moreTypeShow = false;
  419. },
  420. getStoreLabels() {
  421. if (this.StoreLabels.length == 0) {
  422. getStoreLabels().then((res) => {
  423. this.StoreLabels = res.data;
  424. });
  425. }
  426. },
  427. onConfirm(value) {
  428. this.storeCategoryList = this.result.join(',');
  429. this.showPicker = false;
  430. this.onSearchm();
  431. },
  432. onsets() {
  433. this.result = [];
  434. this.storeLabelTypes = [];
  435. this.storeCategoryList = this.result.join(',');
  436. this.chainName = '';
  437. this.chainCode = '';
  438. this.monthVisited = '';
  439. this.onSearch();
  440. },
  441. setChainTypeList() {
  442. if (store.getters.chainsType) {
  443. this.PQChain = store.getters.chainsType.filter((val) => val.remark == 'pq');
  444. this.FPQChain = store.getters.chainsType.filter((val) => val.remark == 'fp');
  445. }
  446. },
  447. searchFn() {
  448. //获取门店类型 //获取门店标签
  449. Promise.all([this.setChainTypeList(), this.getStoreLabels()]).then(() => {
  450. this.showPicker = true;
  451. this.CustomerName = '';
  452. });
  453. },
  454. getUserOrgStoreList() {
  455. this.storeType = localStorage.getItem('storeType');
  456. this.endShow = false;
  457. if (this.refreshing) {
  458. this.list = [];
  459. this.refreshing = false;
  460. }
  461. this.disabled = true;
  462. this.toastLoading(0, '加载中...', true);
  463. queryMyChainsGroupListByDept({
  464. lat: this.lat,
  465. lon: this.lon,
  466. pageNum: this.pageNum,
  467. typeCodeList: this.storeCategoryList,
  468. pageSize: this.pageSize,
  469. chainsName: this.chainsName.trim(),
  470. monthVisited: this.monthVisited, //本月是否拜访1=拜访,0=未拜访
  471. }).then((res) => {
  472. this.disabled = false;
  473. this.toastLoading().clear();
  474. this.loading = false;
  475. if (res.code == 200) {
  476. if (this.pageNum == '1') {
  477. this.list = [];
  478. }
  479. this.list = this.list.concat(res.rows);
  480. if (this.list.length >= res.total) {
  481. this.finished = true;
  482. } else {
  483. this.finished = false;
  484. }
  485. this.pageNum = this.pageNum + 1;
  486. this.list.forEach((item) => {
  487. if (item.stateString.indexOf('拜访中') != -1) {
  488. this.endShow = true;
  489. this.visitEndId = item.visitId;
  490. return;
  491. }
  492. });
  493. } else {
  494. this.$toast(res.msg);
  495. }
  496. });
  497. },
  498. getUserOutPlaListFun() {
  499. this.storeType = localStorage.getItem('storeType');
  500. this.disabled = true;
  501. this.toastLoading(0, '加载中...', true);
  502. this.endShow = false;
  503. if (this.refreshing) {
  504. this.list = [];
  505. this.refreshing = false;
  506. }
  507. queryMyChainsGroupList({
  508. lat: this.lat,
  509. lon: this.lon,
  510. pageNum: this.pageNum,
  511. typeCodeList: this.storeCategoryList,
  512. pageSize: this.pageSize,
  513. chainsName: this.chainsName.trim(),
  514. monthVisited: this.monthVisited, //本月是否拜访1=拜访,0=未拜访
  515. }).then((res) => {
  516. this.disabled = false;
  517. this.toastLoading().clear();
  518. this.loading = false;
  519. if (res.code == 200) {
  520. this.list = this.list.concat(res.rows);
  521. if (this.list.length >= res.total) {
  522. this.finished = true;
  523. } else {
  524. this.finished = false;
  525. }
  526. this.pageNum = this.pageNum + 1;
  527. this.list.forEach((item) => {
  528. if (item.stateString.indexOf('拜访中') != -1) {
  529. this.endShow = true;
  530. this.visitEndId = item.visitId;
  531. return;
  532. }
  533. });
  534. } else {
  535. this.finished = true;
  536. this.$toast(res.msg);
  537. }
  538. });
  539. },
  540. // 进入拜访
  541. storeVisit(val) {
  542. localStorage.setItem('tabVal', this.tabVal);
  543. localStorage.removeItem('visitId');
  544. this.buryingPoint({
  545. systemModel: '计划外',
  546. buryingPointType: 1,
  547. buryingPointValue: val.chainName + '(' + val.chainCode + ')',
  548. buryingPointName: '进店拜访',
  549. buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
  550. });
  551. if (val.stateString.indexOf('拜访中') != -1) {
  552. localStorage.setItem('startTime', new Date());
  553. localStorage.setItem('ORGName', val.deptName);
  554. localStorage.setItem('chainNameR', val.chainName);
  555. this.$router.push({
  556. path: '/visitPage',
  557. query: {
  558. typeCode2: val.typeCode2,
  559. chainId: val.chainId,
  560. rdId: val.rdId,
  561. lat: val.lat,
  562. lon: val.lon,
  563. visitId: val.visitId,
  564. pageType: 'out',
  565. addressLine: val.addressLine,
  566. storeCategory: val.storeCategory,
  567. chainName: val.chainName,
  568. hisTime: val.hisTime,
  569. contactName: val.contactName,
  570. chainCode: val.chainCode,
  571. tabVal: this.tabVal,
  572. visitModel: '1',
  573. latNew: val.lat,
  574. lonNew: val.lon,
  575. PointSum: '0',
  576. marklat: val.lat,
  577. marklon: val.lon,
  578. from: 'outPlan',
  579. },
  580. });
  581. } else {
  582. getPosition()
  583. .then((res) => {
  584. let { TXisBD, resData } = res;
  585. this.lat = TXisBD.lat;
  586. this.lon = TXisBD.lon;
  587. localStorage.setItem('lat', this.lat);
  588. localStorage.setItem('lon', this.lon);
  589. // var location = this.CJ02BD(res.latitude, res.longitude);
  590. this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
  591. })
  592. .catch((error) => {
  593. this.$dialog.alert({
  594. message: error,
  595. });
  596. });
  597. }
  598. },
  599. checkStoreAddressByStoreCodeFun(val, location, res) {
  600. checkChainsAddressByChainCode({
  601. chainCode: val.chainCode,
  602. lon: location.lon,
  603. lat: location.lat,
  604. }).then((response) => {
  605. if (val.lat == '' || val.lat == null) {
  606. this.lat = location.lat;
  607. this.lon = location.lon;
  608. }
  609. let PointSumval = this.twoPointSum(
  610. location.lat,
  611. location.lon,
  612. location.lat,
  613. location.lon
  614. ).toFixed(2);
  615. // 直接进入拜访 不校验经纬度
  616. // localStorage.setItem('startTime', new Date());
  617. // localStorage.setItem('ORGName', val.deptName);
  618. // localStorage.setItem('chainNameR', val.chainName);
  619. // this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  620. // return;
  621. // 门店校验 地址不通过
  622. if (response.code != 200) {
  623. // updateAddress : ,1:同城AB+金牌,去修改地址;2:非金牌店铺,非同城店铺偏差过大不允许拜访,可以重置定位;0非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
  624. if (response.data.updateAddress == 0) {
  625. // 非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
  626. this.$dialog
  627. .confirm({
  628. confirmButtonText: '确定拜访',
  629. cancelButtonText: '取消拜访',
  630. title: '系统提示',
  631. message:
  632. '该客户没有经纬度,此次拜访会保存定位点作为客户经纬度,下次拜访时判断是否偏差过大。',
  633. closeOnClickOverlay: true,
  634. })
  635. .then(() => {
  636. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  637. });
  638. } else if (response.data.updateAddress == 1) {
  639. // 同城AB+金牌,去修改地址
  640. // addressUpdateTimesOver: true=已经达到最大次数,不让修改; false=没有达到可以修改
  641. if (!response.data.addressUpdateTimesOver) {
  642. this.$dialog
  643. .confirm({
  644. title: '系统提示',
  645. message: response.msg + '请立即修改后再拜访',
  646. messageAlign: 'left',
  647. confirmButtonText: '立即修改',
  648. cancelButtonText: '取消',
  649. })
  650. .then(() => {
  651. this.$router.push({
  652. path: '/storeDetail',
  653. query: {
  654. id: val.chainId,
  655. type: 'address',
  656. storeAddressId: val.storeAddressId,
  657. },
  658. });
  659. });
  660. } else {
  661. this.$dialog.confirm({
  662. title: '系统提示',
  663. message: '已经达到最大修改次数',
  664. messageAlign: 'left',
  665. confirmButtonText: '确定',
  666. });
  667. }
  668. } else if (response.data.updateAddress == 2) {
  669. // 1.非金牌店铺,非同城店铺 位置偏差过大 重置经纬度
  670. this.resetCoord(res, val, location, PointSumval);
  671. return;
  672. }
  673. } else {
  674. // 门店编码校验门店地址通过 进入拜访
  675. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  676. }
  677. });
  678. },
  679. // 重置经纬度
  680. resetCoord(res, val, location, PointSumval) {
  681. this.$dialog
  682. .confirm({
  683. confirmButtonText: '初始化定位',
  684. cancelButtonText: '取消拜访',
  685. title: '系统提示',
  686. message: '偏差过大,不允许拜访。可修改本店定位.',
  687. closeOnClickOverlay: true,
  688. })
  689. .then(() => {
  690. mobileReposition({
  691. chainId: val.chainId,
  692. lat: location.lat,
  693. lon: location.lon,
  694. }).then((response) => {
  695. if (response.code == 200) {
  696. this.$dialog
  697. .alert({
  698. title: '系统提示',
  699. message: '本信息定位已更新成功!',
  700. })
  701. .then(() => {
  702. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  703. });
  704. localStorage.setItem('startTime', new Date());
  705. localStorage.setItem('ORGName', val.deptName);
  706. localStorage.setItem('chainNameR', val.chainName);
  707. } else {
  708. this.$toast(response.msg);
  709. }
  710. });
  711. });
  712. },
  713. // 进入拜访 router.push
  714. toSuishenbangOutstoreVisit(res, val, location, PointSumval) {
  715. addVisitsPosition({
  716. chainId: val.chainId,
  717. visitsId: '',
  718. lon: res.longitude,
  719. lat: res.latitude,
  720. sourceLon: location.lon,
  721. sourceLat: location.lat,
  722. positionDesc: '',
  723. accuracy: res.accuracy,
  724. }).then((response) => {
  725. // 进入拜访之前先刷新页面
  726. store.dispatch('setDeviceOutsidePage', true);
  727. this.$router.push({
  728. path: '/visitPage',
  729. query: {
  730. typeCode2: val.typeCode2,
  731. chainId: val.chainId,
  732. rdId: val.rdId,
  733. lat: location.lat,
  734. lon: location.lon,
  735. visitId: val.visitId,
  736. pageType: 'out',
  737. addressLine: val.addressLine,
  738. storeCategory: val.storeCategory,
  739. chainName: val.chainName,
  740. hisTime: val.hisTime,
  741. contactName: val.contactName,
  742. chainCode: val.chainCode,
  743. tabVal: this.tabVal,
  744. visitModel: '1',
  745. latNew: location.lat,
  746. lonNew: location.lon,
  747. PointSum: PointSumval,
  748. marklat: res.latitude,
  749. marklon: res.longitude,
  750. from: 'outPlan',
  751. },
  752. });
  753. });
  754. },
  755. // 异常拜访
  756. abnormalVisit(val) {
  757. localStorage.removeItem('visitId');
  758. localStorage.setItem('tabVal', this.tabVal);
  759. this.buryingPoint({
  760. systemModel: '计划外',
  761. buryingPointType: 1,
  762. buryingPointValue: val.chainName + '(' + val.chainCode + ')',
  763. buryingPointName: '异常拜访',
  764. buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
  765. });
  766. getPosition()
  767. .then((res) => {
  768. let { TXisBD, resData } = res;
  769. this.lat = TXisBD.lat;
  770. this.lon = TXisBD.lon;
  771. localStorage.setItem('lat', this.lat);
  772. localStorage.setItem('lon', this.lon);
  773. let PointSum = this.twoPointSum(TXisBD.lat, TXisBD.lon, TXisBD.lat, TXisBD.lon).toFixed(
  774. 2
  775. );
  776. addVisitsPosition({
  777. chainId: val.chainId,
  778. visitsId: '',
  779. lon: resData.longitude,
  780. lat: resData.latitude,
  781. sourceLon: location.lon,
  782. sourceLat: location.lat,
  783. positionDesc: '',
  784. accuracy: resData.accuracy,
  785. }).then((response) => {
  786. // 进入拜访之前先刷新页面
  787. store.dispatch('setDeviceOutsidePage', true);
  788. this.$router.push({
  789. path: '/visitAbnormal',
  790. query: {
  791. chainId: val.chainId,
  792. rdId: val.rdId,
  793. lat: this.lat,
  794. lon: this.lon,
  795. visitId: val.visitId,
  796. pageType: 'out',
  797. visitModel: localStorage.getItem('postType') != 'GZ' ? '5' : '3',
  798. chainCode: val.chainCode,
  799. tabVal: this.tabVal,
  800. latNew: TXisBD.lat,
  801. lonNew: TXisBD.lon,
  802. PointSum: PointSum,
  803. marklat: resData.latitude,
  804. marklon: resData.longitude,
  805. },
  806. });
  807. localStorage.setItem('startTime', new Date());
  808. localStorage.setItem('ORGName', val.deptName);
  809. localStorage.setItem('chainNameR', val.chainName);
  810. });
  811. })
  812. .catch((error) => {
  813. this.$dialog.alert({
  814. message: error,
  815. });
  816. });
  817. },
  818. // 客户门店
  819. visitFn(val) {
  820. this.buryingPoint({
  821. systemModel: '计划外',
  822. buryingPointType: 1,
  823. buryingPointValue: val.chainName + '(' + val.chainCode + ')',
  824. buryingPointName: '客户信息',
  825. buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
  826. });
  827. this.$router.push({
  828. path: '/storeDetail',
  829. query: { id: val.chainId, detilId: 'a' },
  830. });
  831. },
  832. // 拜访信息
  833. Visit(val) {
  834. this.$router.push({
  835. path: '/historicalDetails',
  836. query: {
  837. visitId: val.visitId,
  838. chainId: val.chainId,
  839. chainCode: val.chainCode,
  840. },
  841. });
  842. },
  843. onClickLeft() {
  844. this.$router.go(-1);
  845. },
  846. onSearch() {
  847. this.pageNum = 1;
  848. this.list = [];
  849. this.finished = true;
  850. this.onLoad();
  851. },
  852. onSearchm() {
  853. storeCategoryList;
  854. var StoreLabelsArr = [];
  855. for (var k = 0; k < this.storeLabelTypes.length; k++) {
  856. for (var k1 = 0; k1 < this.StoreLabels.length; k1++) {
  857. if (this.StoreLabels[k1].dictValue == this.storeLabelTypes[k]) {
  858. StoreLabelsArr.push(this.StoreLabels[k1].dictLabel);
  859. }
  860. }
  861. }
  862. var storeCategoryList = [];
  863. for (var q = 0; q < this.result.length; q++) {
  864. for (var q1 = 0; q1 < this.storeTypeLists.length; q1++) {
  865. if (this.storeTypeLists[q1].dictValue == this.result[q]) {
  866. storeCategoryList.push(this.storeTypeLists[q1].dictLabel);
  867. }
  868. }
  869. }
  870. localStorage.setItem('outvstoreName', this.chainName);
  871. localStorage.setItem('outvchainName', this.chainName);
  872. localStorage.setItem('outvstoreLabelTypes', this.storeLabelTypes);
  873. localStorage.setItem('outvstoreCategoryList', this.result);
  874. localStorage.setItem('outvchainCode', this.chainCode);
  875. this.onSearch();
  876. },
  877. tabChange(name) {
  878. this.finished = true;
  879. this.pageNum = 1;
  880. this.list = [];
  881. this.tabVal = name;
  882. localStorage.setItem('tabVal', name);
  883. this.onLoad();
  884. },
  885. // 滚动条与底部距离小于 offset 时触发 初始化会触发
  886. onLoad() {
  887. this.toastLoading(0, '加载中...', true);
  888. // 授权
  889. getTicketFun()
  890. .then(() => {
  891. getPosition(true)
  892. .then((res) => {
  893. let { TXisBD } = res;
  894. this.lat = TXisBD.lat;
  895. this.lon = TXisBD.lon;
  896. if (this.tabVal == '1') {
  897. this.getUserOutPlaListFun();
  898. } else {
  899. this.getUserOrgStoreList();
  900. }
  901. })
  902. .catch((error) => {
  903. this.$dialog.alert({
  904. message: error,
  905. });
  906. });
  907. })
  908. .catch(() => {
  909. this.finished = true;
  910. });
  911. },
  912. // 跳转好帮手门店详情
  913. goOtherSystem(item) {
  914. if (item.chainCode) {
  915. window.location.href =
  916. process.env.VUE_APP_SSB_LINK + '/order/storeDetail/index?shopCode=' + item.chainCode;
  917. } else {
  918. this.$dialog.alert({
  919. message: '缺少门店code',
  920. });
  921. }
  922. },
  923. },
  924. };
  925. </script>
  926. <style lang="scss" scoped>
  927. .bgcolor {
  928. background-color: #f5f5f5;
  929. }
  930. .card {
  931. padding: 10px 16px;
  932. box-sizing: border-box;
  933. }
  934. .card .title {
  935. font-size: 15px;
  936. font-weight: bold;
  937. color: #333;
  938. line-height: 22px;
  939. padding-right: 52px;
  940. }
  941. .card .info {
  942. font-size: 14px;
  943. color: #909090;
  944. line-height: 26px;
  945. }
  946. .btnbox {
  947. padding-top: 14px;
  948. border-top: 1px solid #eee;
  949. margin: 0 10px;
  950. }
  951. .statstext {
  952. background-color: #0057ba;
  953. position: absolute;
  954. right: 0;
  955. top: 6px;
  956. padding: 2px 6px 2px 12px;
  957. border-bottom-left-radius: 60px;
  958. border-top-left-radius: 60px;
  959. color: #fff;
  960. }
  961. .cellcontent .van-cell {
  962. padding-bottom: 10px;
  963. }
  964. .statstext .van-icon__image {
  965. height: 0.7em;
  966. }
  967. .home {
  968. height: 100%;
  969. width: 100%;
  970. display: flex;
  971. flex-direction: column;
  972. overflow: hidden;
  973. .content {
  974. flex: 1;
  975. overflow: hidden;
  976. padding: 10px 0;
  977. .van-pull-refresh {
  978. height: 100%;
  979. overflow-y: auto;
  980. .van-pull-refresh__track {
  981. }
  982. }
  983. }
  984. }
  985. .monthVisited {
  986. margin: 0px 14px;
  987. .van-radio {
  988. width: 50%;
  989. margin: 0;
  990. }
  991. }
  992. </style>
  993. <style lang="scss">
  994. .van-tabs__nav--card .van-tab.van-tab--active {
  995. background-color: #0057ba !important;
  996. }
  997. .zDialog .van-dialog__header {
  998. padding: 10px;
  999. border-bottom: 1px solid #f5f5f5;
  1000. }
  1001. .zDialog .infoText {
  1002. margin: 10px;
  1003. font-size: 14px;
  1004. color: #909090;
  1005. width: 98%;
  1006. }
  1007. .visitStoreIco {
  1008. float: left;
  1009. float: left;
  1010. width: 26px;
  1011. text-align: center;
  1012. background-color: #ffba13;
  1013. color: #fff;
  1014. border-radius: 100%;
  1015. margin-left: 14px;
  1016. line-height: 26px;
  1017. height: 26px;
  1018. }
  1019. .searchcheck {
  1020. padding: 0 10px 10px;
  1021. }
  1022. .searchcheck .van-checkbox {
  1023. /*width: 44%;*/
  1024. padding-bottom: 10px;
  1025. }
  1026. .searchcheck .checkbox {
  1027. font-size: 14px;
  1028. display: inline-block;
  1029. width: 50%;
  1030. line-height: 28px;
  1031. }
  1032. .searchcheck .checkbox .van-checkbox {
  1033. margin-bottom: 2px;
  1034. }
  1035. .searchcheck .checkbox1 {
  1036. font-size: 14px;
  1037. float: left;
  1038. line-height: 28px;
  1039. width: 50%;
  1040. }
  1041. .searchcheck .checkbox1 .child {
  1042. width: 100%;
  1043. }
  1044. .searchcheck {
  1045. /* height: 93vh;
  1046. overflow-y: auto; */
  1047. }
  1048. .searchchecktitle {
  1049. width: 100%;
  1050. margin: 20px 0;
  1051. font-size: 16px;
  1052. border-left: 3px solid #0057ba;
  1053. line-height: 18px;
  1054. }
  1055. .searchchecktitle1 {
  1056. width: 100%;
  1057. margin: 20px 0;
  1058. font-size: 16px;
  1059. line-height: 18px;
  1060. }
  1061. .textsize {
  1062. font-size: 14px;
  1063. /* overflow: hidden; */
  1064. display: flex;
  1065. flex-direction: column;
  1066. .searchcheck {
  1067. flex: 1;
  1068. overflow-y: auto;
  1069. margin-bottom: 50px;
  1070. }
  1071. }
  1072. .home {
  1073. .TCFXListItem {
  1074. display: inline-block;
  1075. border: 1px solid #ccc;
  1076. padding: 3px 5px;
  1077. margin: 0 5px;
  1078. border-radius: 6px;
  1079. }
  1080. }
  1081. .van-dialog__confirm,
  1082. .van-dialog__confirm:active {
  1083. color: #0057ba;
  1084. }
  1085. .searchDiv {
  1086. .van-search {
  1087. background: #fff;
  1088. }
  1089. .van-search__action {
  1090. font-size: 14px;
  1091. color: #0057ba;
  1092. font-weight: bold;
  1093. background: #f1f1f1;
  1094. border-bottom-right-radius: 60px;
  1095. border-top-right-radius: 60px;
  1096. border: 1px solid #ccc;
  1097. padding: 0 20px;
  1098. }
  1099. .van-search--show-action {
  1100. padding-right: 12px;
  1101. }
  1102. .van-search__content {
  1103. border: 1px solid #ccc;
  1104. border-bottom-left-radius: 60px;
  1105. border-top-left-radius: 60px;
  1106. background: #f1f1f1;
  1107. border-right: 0;
  1108. }
  1109. }
  1110. .myTab {
  1111. .van-tabs__nav--card {
  1112. margin: 0 !important;
  1113. border-left: 0;
  1114. border-right: 0;
  1115. }
  1116. .van-tabs__wrap,
  1117. .van-tabs__nav--card {
  1118. height: 39px;
  1119. }
  1120. .van-tab {
  1121. line-height: 40px;
  1122. }
  1123. }
  1124. .myList {
  1125. .van-cell {
  1126. padding: 0;
  1127. &:after {
  1128. border-bottom: none;
  1129. }
  1130. }
  1131. }
  1132. </style>