index.vue 35 KB

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