index.vue 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684
  1. <template>
  2. <div class="bgcolor deviceWithin">
  3. <div class="navBarTOP">
  4. <!-- 顶部条-->
  5. <van-nav-bar class="navBar" title="计划内"> </van-nav-bar>
  6. <div class="searchDiv">
  7. <van-search
  8. v-model="storeName"
  9. left-icon="search"
  10. show-action
  11. placeholder="搜索名称/编号/地址">
  12. <template #action>
  13. <div @click="onSearch">搜索</div>
  14. </template>
  15. </van-search>
  16. </div>
  17. <div style="background-color: #dfebf4; padding: 10px" v-if="mapShows">
  18. <div
  19. style="
  20. font-size: 16px;
  21. text-align: center;
  22. margin: 0 auto;
  23. width: 150px;
  24. text-decoration: underline;
  25. font-weight: bold;
  26. color: #222;
  27. "
  28. @click="goFn(1)">
  29. <img
  30. src="./../../assets/Icon/clcik.png"
  31. style="width: 22px; float: left; display: inline-block" />高销额门店推荐
  32. </div>
  33. <van-button
  34. round
  35. type="info"
  36. size="small"
  37. style="position: absolute; top: 108px; right: 10px; height: 28px"
  38. @click="goFn(1)"
  39. >去查看<van-icon name="arrow"
  40. /></van-button>
  41. </div>
  42. <div class="monthNow" v-show="calendarIsshow == false">
  43. <span class="month" @click="show = true">{{ timeData }}</span>
  44. <van-icon class="CalendarIcon" :name="timeico" @click="show = true" />
  45. </div>
  46. </div>
  47. <div class="lineGrey" v-if="mapShows"></div>
  48. <div class="lineGrey" v-if="mapShows"></div>
  49. <div class="lineGrey" v-if="mapShows"></div>
  50. <div class="lineGrey" v-if="mapShows"></div>
  51. <!-- 主体内容-->
  52. <div class="container" style="margin-top: 144px">
  53. <div class="cellcontent" v-for="(item, index) in list" :key="index">
  54. <van-cell>
  55. <div class="card">
  56. <div class="title">
  57. <span @click="goOtherSystem(item)" style="color: #0057ba; text-decoration: underline">
  58. <span>{{ item.storeName }}</span>
  59. (<span style="color: #0057ba">{{ item.storeCode }}</span
  60. >)
  61. </span>
  62. <span class="btn" :data-clipboard-text="item.storeCode">
  63. <van-icon
  64. :name="paste"
  65. color="#ee0a24"
  66. size="20"
  67. style="top: 6px; margin-left: 4px" />
  68. </span>
  69. <!-- "approvalStatus": 1:已结案;0:未结案, -->
  70. <!-- "processApprovalStatus": 审批状态(0=未提交,1=已提交待审核,2=审批通过,3=审批拒绝) -->
  71. <template v-if="item.approvalStatus == 0">
  72. <span class="statusIcon submit" v-if="item.processApprovalStatus == 1">已提交</span>
  73. <span class="statusIcon noSubmit" v-if="item.processApprovalStatus == 0"
  74. >未提交</span
  75. >
  76. </template>
  77. </div>
  78. <div class="info">
  79. 类型:{{ item.storeCategory }} &nbsp;
  80. <el-popover popper-class="zpover zpover6" placement="bottom-start" trigger="click">
  81. <div>
  82. <p>
  83. 本店经营品项指导:
  84. <a @click="linkimg(item)" style="text-decoration: underline">点击查看</a>
  85. </p>
  86. </div>
  87. <van-icon name="question-o" size="18" slot="reference" />
  88. </el-popover>
  89. </div>
  90. <div class="info" style="position: relative">
  91. 联系人:{{ item.contactName }}
  92. <div style="position: absolute; bottom: 0; right: 14px">
  93. <el-popover popper-class="zpover zpover6" placement="bottom-start" trigger="click">
  94. <div>
  95. <p>
  96. 本店{{ timeData1 }}下单SKU数:<a
  97. @click="linkList(item)"
  98. style="text-decoration: underline"
  99. >点击查看详情</a
  100. >
  101. </p>
  102. </div>
  103. <div
  104. class="visitStoreIco"
  105. v-if="item.storeLabels.zysslNums"
  106. style="background-color: #fff; position: relative"
  107. slot="reference">
  108. <p
  109. style="
  110. width: 100%;
  111. position: absolute;
  112. z-index: 1;
  113. top: 0.2px;
  114. width: 22px;
  115. margin: 0;
  116. margin-left: 3.6px;
  117. text-align: center;
  118. font-size: 12px;
  119. ">
  120. {{ item.storeLabels.zysslNums }}
  121. </p>
  122. <van-icon :name="ord" size="26" />
  123. </div>
  124. </el-popover>
  125. <el-popover popper-class="zpover" placement="bottom" width="200" trigger="click">
  126. <div v-if="item.storeLabels">
  127. <p>已参加:</p>
  128. <p v-for="tt in (item.storeLabels.targetOne + '').split(';')">
  129. {{ tt }}
  130. </p>
  131. </div>
  132. <div
  133. class="visitStoreIco"
  134. v-if="item.storeLabels.targetOne"
  135. style="background-color: #fff"
  136. slot="reference">
  137. <van-icon :name="targetOne" size="26" />
  138. </div>
  139. </el-popover>
  140. <el-popover
  141. popper-class="zpover"
  142. placement="bottom"
  143. width="200"
  144. trigger="click"
  145. content="同城店近60天未下单">
  146. <div
  147. v-if="item.storeLabels.fxNoOrder"
  148. class="visitStoreIco"
  149. style="background-color: #fff"
  150. slot="reference">
  151. <van-icon :name="order60" size="26" />
  152. </div>
  153. </el-popover>
  154. <el-popover
  155. popper-class="zpover"
  156. placement="bottom"
  157. width="200"
  158. trigger="click"
  159. content="金牌店近30天未下单">
  160. <div
  161. v-if="item.storeLabels.noOrder"
  162. class="visitStoreIco"
  163. style="background-color: #fff"
  164. slot="reference">
  165. <van-icon :name="order" size="26" />
  166. </div>
  167. </el-popover>
  168. <el-popover
  169. popper-class="zpover"
  170. placement="bottom"
  171. width="200"
  172. trigger="click"
  173. content="本店本月进过专业时时丽">
  174. <div
  175. v-if="item.storeLabels.zyssl"
  176. class="visitStoreIco"
  177. style="background-color: #ed5c68"
  178. slot="reference">
  179. </div>
  180. </el-popover>
  181. <el-popover
  182. popper-class="zpover zpover1"
  183. placement="bottom"
  184. width="200"
  185. trigger="click"
  186. content="本店本月进过超好贴">
  187. <div
  188. v-if="item.storeLabels.chtczj"
  189. class="visitStoreIco"
  190. style="background-color: #0057ba"
  191. slot="reference">
  192. </div>
  193. </el-popover>
  194. <!-- <el-popover-->
  195. <!-- placement="bottom"-->
  196. <!-- width="200"-->
  197. <!-- popper-class="zpover zpover2"-->
  198. <!-- trigger="click"-->
  199. <!-- content="本月未被拜访的信息">-->
  200. <!-- <div v-if="item.storeLabels.noVisit" class="visitStoreIco" style="background-color: #fff" slot="reference">-->
  201. <!-- <van-icon :name="visitTimess" size="26" /></div>-->
  202. <!-- </el-popover>-->
  203. <el-popover
  204. placement="bottom"
  205. popper-class="zpover zpover1 zpover1sb"
  206. trigger="click"
  207. :disabled="!item.userVisitTimesMap"
  208. :content="'本店本月已拜访过' + item.storeLabels.visitTimes + '次'">
  209. <div
  210. v-if="item.storeLabels.visitTimes && item.storeLabels.visitTimes > 0"
  211. class="visitStoreIco"
  212. slot="reference"
  213. style="background-color: #fff; position: relative">
  214. <p
  215. style="
  216. width: 100%;
  217. position: absolute;
  218. z-index: 10;
  219. top: -2px;
  220. margin: 0;
  221. text-align: center;
  222. font-size: 12px;
  223. ">
  224. {{ item.storeLabels.visitTimes }}
  225. </p>
  226. <van-icon :name="ordernum" size="26" />
  227. </div>
  228. <!-- <div class="tipsTitle">本店本月已拜访过{{ item.storeLabels.visitTimes }}次</div> -->
  229. <el-table :data="item.userVisitTimesMap" border max-height="180px">
  230. <el-table-column label="业务员" prop="userName" />
  231. <el-table-column label="拜访次数" prop="visitTimes" width="110px" />
  232. </el-table>
  233. </el-popover>
  234. </div>
  235. </div>
  236. <div class="info" v-if="item.telephone" @click="buryingPointFn(item)">
  237. 联系电话:<a
  238. style="color: #0057ba; font-weight: bold; text-decoration: underline"
  239. :href="'tel:' + item.telephone"
  240. >{{ item.telephone }}<van-icon name="phone"
  241. /></a>
  242. </div>
  243. <div class="info" v-if="item.addressLine">
  244. 地址:{{ item.addressLine
  245. }}<img
  246. v-if="item.storeLonExist"
  247. style="width: 36px"
  248. :src="sbpmdh"
  249. @click="linkapp(item)" />
  250. </div>
  251. <!-- 分销店 -->
  252. <template v-if="item.sfaStoreType.type == 'fxd'">
  253. <div class="info" v-if="typeShow">
  254. 经销商:
  255. <template
  256. v-if="item.TCFXListTreeSelec"
  257. v-for="(item, index) in item.TCFXListTreeSelec">
  258. <el-popover
  259. popper-class="zpover zpover6"
  260. placement="bottom-start"
  261. trigger="click">
  262. <div>
  263. {{ item.name }}
  264. </div>
  265. <span class="TCFXListItem" :key="index">{{ item.name }}</span>
  266. </el-popover>
  267. </template>
  268. </div>
  269. </template>
  270. <template v-else>
  271. <div class="info" v-if="typeShow">经销商:{{ item.chainName }}</div>
  272. </template>
  273. <!-- storeLonExist 门店是否存在经纬度 字段false=不显示导航和距离,true=显示 -->
  274. <div class="info" v-if="item.storeLonExist">距离:{{ Micrometer(item.distance) }}m</div>
  275. </div>
  276. <div
  277. class="statstext"
  278. v-if="item.stateString == '未拜访'"
  279. style="background-color: #ed5c68">
  280. 未拜访
  281. </div>
  282. <div
  283. class="statstext"
  284. v-if="item.stateString == '拜访中'"
  285. style="background-color: white">
  286. <van-icon :name="times" color="#ee0a24" size="32" />
  287. </div>
  288. <div class="statstext" v-if="item.stateString == '已拜访'">已拜访</div>
  289. <div class="btnbox">
  290. <van-row>
  291. <van-col
  292. span="6"
  293. v-if="item.stateString != '已拜访' && item.visitAble && customerVisits"
  294. @click="storeVisit(item)">
  295. <img :src="call" style="margin: 0 auto; height: 18px; display: block" />
  296. <p style="text-align: center; margin: 0">进入拜访</p>
  297. </van-col>
  298. <van-col
  299. span="6"
  300. v-if="item.storeCategory == '公装经销商'"
  301. @click="projectOutVisit(item)">
  302. <img :src="xmgj" style="margin: 0 auto; height: 18px; display: block" />
  303. <p style="text-align: center; margin: 0">项目跟进</p>
  304. <!-- <van-button type="info" size="small" plain class="centerBtn" @click="signAdd(item)">大客户签约</van-button>-->
  305. </van-col>
  306. <van-col
  307. span="6"
  308. v-if="
  309. item.stateString != '已拜访' &&
  310. item.visitAble &&
  311. item.storeCategory != '公装经销商' &&
  312. customerVisits
  313. "
  314. @click="abnormalVisit(item)">
  315. <img :src="yichang" style="margin: 0 auto; height: 18px; display: block" />
  316. <p style="text-align: center; margin: 0; margin-top: 1px">异常拜访</p>
  317. </van-col>
  318. <van-col span="6" v-if="item.showOrderButton" @click="orderFn(item)">
  319. <img :src="xiadan" style="margin: 0 auto; height: 18px; display: block" />
  320. <p style="text-align: center; margin: 0; margin-top: 1px">去下单</p>
  321. </van-col>
  322. <van-col span="6" v-if="item.stateString == '已拜访'" @click="Visit(item)">
  323. <img :src="bfxx" style="margin: 0 auto; height: 18px; display: block" />
  324. <p style="text-align: center; margin: 0; margin-top: 1px">拜访信息</p>
  325. </van-col>
  326. <van-col span="6" @click="visitFn(item)">
  327. <img :src="kehuxinxi" style="margin: 0 auto; height: 18px; display: block" />
  328. <p style="text-align: center; margin: 0; margin-top: 1px">客户信息</p>
  329. </van-col>
  330. </van-row>
  331. </div>
  332. </van-cell>
  333. <div class="lineGrey"></div>
  334. </div>
  335. <p style="text-align: center; color: #888a8e" v-if="list.length > 0">--已经到底了--</p>
  336. <br />
  337. <van-empty description="暂无数据" v-if="list.length == 0" />
  338. <!--</van-list>-->
  339. </div>
  340. <br />
  341. <br />
  342. <br />
  343. <br />
  344. <br />
  345. <br />
  346. <van-popup v-model="show" position="bottom" :style="{ height: '50%' }">
  347. <van-datetime-picker
  348. v-model="currentDate"
  349. type="date"
  350. title="计划日期"
  351. :min-date="minDate"
  352. :max-date="maxDate"
  353. @confirm="dateeconfirm"
  354. @cancel="show = false" />
  355. </van-popup>
  356. <tab-bar tabBarActive="deviceWithin"></tab-bar>
  357. </div>
  358. </template>
  359. <script>
  360. import tabBar from '@/components/tabBar';
  361. import times from '@/assets/Icon/times.png';
  362. import order60 from '@/assets/order60.png';
  363. import targetOne from '@/assets/targetOne.png';
  364. import visitTimes from '@/assets/visitTimes.png';
  365. import ord from '@/assets/ord.png';
  366. import timeico from '@/assets/Icon/datatims.png';
  367. import sbpmdh from '@/assets/sbpmdh.png';
  368. import {
  369. getUserInPlanList,
  370. checkVisit,
  371. addVisitsPosition,
  372. mobileReposition,
  373. buryingPoint,
  374. ProductItemImge,
  375. } from '@/api/index';
  376. import axios from 'axios';
  377. import paste from '@/assets/paste.png';
  378. import order from '@/assets/order.png';
  379. import ordernum from '@/assets/ordernum.png';
  380. import call from '@/assets/call.png';
  381. import jiarujihua from '@/assets/jiarujihua.png';
  382. import kehuxinxi from '@/assets/kehuxinxi-2.png';
  383. import xiadan from '@/assets/xiadan.png';
  384. import yichang from '@/assets/yichang.png';
  385. import bfxx from '@/assets/bfxx.png';
  386. import xmgj from '@/assets/xmgj.png';
  387. import { getOrderUrlByStoreId } from '@/api/inventory';
  388. import { checkStoreAddressByStoreCode } from '@/api/visitstore';
  389. import { getPosition, getTicketFun } from '@/utils/TXApiFun';
  390. export default {
  391. name: 'deviceWithin',
  392. components: { tabBar },
  393. data() {
  394. return {
  395. xmgj: xmgj,
  396. bfxx: bfxx,
  397. yichang: yichang,
  398. xiadan: xiadan,
  399. kehuxinxi: kehuxinxi,
  400. jiarujihua: jiarujihua,
  401. call: call,
  402. times: times,
  403. timeico: timeico,
  404. order60: order60,
  405. sbpmdh: sbpmdh,
  406. ord: ord,
  407. timeData1: '',
  408. targetOne: targetOne,
  409. ordernum: ordernum,
  410. paste: paste,
  411. visitTimess: visitTimes,
  412. show: false,
  413. cont: 0,
  414. timer: null,
  415. flag: true,
  416. order: order,
  417. defaultDate: new Date(),
  418. minDate: new Date(2020, 0, 1),
  419. maxDate: new Date(2025, 10, 1),
  420. showPopoverVNUM: [],
  421. showPopoverC: [],
  422. showPopoverZ: [],
  423. currentDate: new Date(),
  424. searchValue: '',
  425. calendarIsshow: false,
  426. tabVal: 'insidePlan',
  427. list: [],
  428. loading: false,
  429. finished: false,
  430. mapShows: false,
  431. typeShow: false,
  432. storeName: '',
  433. timeData: '',
  434. genDate: '',
  435. listActive: null,
  436. query: '',
  437. lat: '',
  438. lon: '',
  439. storeType: '',
  440. endShow: false,
  441. visitEndId: '',
  442. customerVisits: true,
  443. };
  444. },
  445. watch: {
  446. $route(to, from) {
  447. if (from.path == '/deviceWithin/index' && to.path == '/storeVisitpage') {
  448. localStorage.setItem('startTime', new Date());
  449. }
  450. },
  451. },
  452. activated() {
  453. this.query = this.$route.query;
  454. this.timeData = this.parseTime(new Date(), '{yy}-{mm}-{dd}');
  455. this.storeName = localStorage.getItem('deviveStoreName');
  456. this.getMonth();
  457. // 授权
  458. getTicketFun().then(() => {
  459. this.getUserInPlanList();
  460. });
  461. },
  462. methods: {
  463. linkapp(val) {
  464. var poind = this.gcj02BD(val.lat, val.lon);
  465. let url = window.location.href;
  466. let that = this;
  467. let wx = this.wx;
  468. let qiyeData;
  469. const instance = axios.create();
  470. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  471. instance
  472. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  473. params: {
  474. url: url,
  475. agent: 1,
  476. },
  477. })
  478. .then((response) => {
  479. if (response.status == 200) {
  480. qiyeData = response.data.data;
  481. wx.agentConfig({
  482. corpid: qiyeData.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
  483. agentid: qiyeData.agentId, // 必填,企业微信的应用id (e.g. 1000247)
  484. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  485. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  486. signature: qiyeData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
  487. jsApiList: ['launchMiniprogram'], //必填,传入需要使用的接口名称
  488. success: function (res) {
  489. wx.invoke(
  490. 'launchMiniprogram',
  491. {
  492. appid: 'wx238bbb5f6d958414',
  493. path:
  494. 'pages/relayStation/relayStation?latitude=' +
  495. poind.lat +
  496. '&longitude=' +
  497. poind.lon +
  498. '&name=' +
  499. val.addressLine,
  500. },
  501. function (res) {
  502. if (res.err_msg == 'launchMiniprogram:ok') {
  503. } else {
  504. }
  505. }
  506. );
  507. },
  508. fail: function (res) {
  509. if (res.errMsg.indexOf('function not exist') > -1) {
  510. alert('版本过低请升级');
  511. }
  512. },
  513. });
  514. }
  515. });
  516. },
  517. orderFn(val) {
  518. buryingPoint({
  519. systemModel: '计划内',
  520. buryingPointType: 1,
  521. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  522. buryingPointName: '去下单',
  523. buryingPointPosition: '计划内',
  524. });
  525. getOrderUrlByStoreId({
  526. storeId: val.storeId,
  527. from: 'inPlan',
  528. }).then((res) => {
  529. if (res.code == 200 && res.data) {
  530. window.location.href = res.data;
  531. } else {
  532. this.Toast({
  533. message: res.msg,
  534. duration: 5000,
  535. });
  536. }
  537. });
  538. },
  539. linkList(val) {
  540. this.$router.push({
  541. path: '/pItem',
  542. query: { id: val.storeCode, detilId: 'a' },
  543. });
  544. },
  545. linkimg(val) {
  546. ProductItemImge({ storeId: val.storeId }).then((response) => {
  547. if (response.code == 200) {
  548. if (response.data != undefined) {
  549. window.open(response.data);
  550. } else {
  551. this.$toast(response.msg);
  552. }
  553. } else {
  554. this.$dialog.alert({
  555. title: '系统提示',
  556. message: res.msg,
  557. });
  558. }
  559. });
  560. },
  561. getMonth() {
  562. // 获取当前日期
  563. var currentDate = new Date();
  564. // 获取当前月份
  565. var currentMonth = currentDate.getMonth();
  566. // 获取当前年份
  567. // var currentYear = currentDate.getFullYear();
  568. var previousMonthDate1 = new Date();
  569. if (currentDate.getDate() == 1) {
  570. previousMonthDate1.setMonth(currentMonth - 1);
  571. } else {
  572. }
  573. var previousMonth1 = previousMonthDate1.getMonth();
  574. var previousYear1 = previousMonthDate1.getFullYear();
  575. // 计算前三个月的年份和月份
  576. var previousMonthDate = new Date();
  577. if (currentDate.getDate() == 1) {
  578. previousMonthDate.setMonth(currentMonth - 3);
  579. } else {
  580. previousMonthDate.setMonth(currentMonth - 2);
  581. }
  582. 1;
  583. var previousMonth = previousMonthDate.getMonth();
  584. var previousYear = previousMonthDate.getFullYear();
  585. //前三个月
  586. if (previousYear1 == previousYear) {
  587. var formattedPreviousMonth1 = previousYear1 + '-' + (previousMonth1 + 1);
  588. // 格式化年份和月份
  589. var formattedPreviousMonth = previousYear + '-' + (previousMonth + 1);
  590. this.timeData1 =
  591. formattedPreviousMonth.split('-')[1] + '-' + formattedPreviousMonth1.split('-')[1] + '月';
  592. } else {
  593. var formattedPreviousMonth1 = previousYear1 + '年' + (previousMonth1 + 1) + '月';
  594. // .toString().padStart(2, '0');
  595. // 格式化年份和月份
  596. var formattedPreviousMonth = previousYear + '年' + (previousMonth + 1) + '月';
  597. this.timeData1 = formattedPreviousMonth + '-' + formattedPreviousMonth1;
  598. }
  599. },
  600. Visit(val) {
  601. this.$router.push({
  602. path: '/historicalDetails',
  603. query: {
  604. visitId: val.visitId,
  605. storeId: val.storeId,
  606. storeCode: val.storeCode,
  607. },
  608. });
  609. },
  610. dateeconfirm() {
  611. this.show = false;
  612. this.genDate = this.parseTime(this.currentDate, '{yy}-{mm}-{dd}');
  613. this.timeData = this.parseTime(this.currentDate, '{yy}-{mm}-{dd}');
  614. this.getUserInPlanList();
  615. },
  616. dataFn() {
  617. this.genDate = this.parseTime(new Date(), '{yy}-{mm}-{dd}');
  618. this.timeData = this.parseTime(new Date(), '{yy}-{mm}-{dd}');
  619. this.getUserInPlanList();
  620. },
  621. buryingPointFn(val) {
  622. buryingPoint({
  623. systemModel: '计划内',
  624. buryingPointType: 1,
  625. buryingPointValue: val.telephone,
  626. buryingPointName: '点击电话',
  627. buryingPointPosition: val.storeName + '(' + val.storeCode + ')',
  628. });
  629. },
  630. getUserInPlanList() {
  631. localStorage.setItem('outvstoreName', '');
  632. localStorage.setItem('outvchainName', '');
  633. localStorage.removeItem('outvstoreLabelTypes');
  634. localStorage.removeItem('outvstoreCategoryList');
  635. localStorage.setItem('outvchainCode', '');
  636. localStorage.setItem('outvstoreName', '');
  637. localStorage.setItem('outvsortType', '');
  638. localStorage.setItem('outsortParam', '');
  639. localStorage.setItem('lat', '');
  640. localStorage.setItem('lon', '');
  641. this.list = [];
  642. var postType = localStorage.getItem('postType');
  643. this.customerVisits = localStorage.getItem('customerVisits');
  644. if (localStorage.getItem('postType') == 'JZ' || localStorage.getItem('postType') == 'GZ') {
  645. this.mapShows = false;
  646. } else {
  647. this.mapShows = true;
  648. }
  649. if (postType == 'GZ') {
  650. this.typeShow = false;
  651. } else {
  652. this.typeShow = true;
  653. }
  654. this.storeType = localStorage.getItem('storeType');
  655. this.endShow = false;
  656. this.toastLoading(0, '加载中...', true);
  657. localStorage.removeItem('visitId');
  658. getPosition(true)
  659. .then((res) => {
  660. let { TXisBD } = res;
  661. this.getUserInPlanListFun(TXisBD);
  662. })
  663. .catch((error) => {
  664. this.$dialog.alert({
  665. message: error,
  666. });
  667. });
  668. },
  669. getUserInPlanListFun(TXisBD) {
  670. getUserInPlanList({
  671. storeName: this.storeName.trim(),
  672. genDate: this.genDate,
  673. lat: TXisBD.lat,
  674. lon: TXisBD.lon,
  675. }).then((res) => {
  676. this.toastLoading().clear();
  677. if (res.code == 200) {
  678. this.list = res.data;
  679. this.list.forEach((item) => {
  680. if (item.stateString.indexOf('拜访中') != -1) {
  681. this.endShow = true;
  682. this.visitEndId = item.visitId;
  683. return;
  684. }
  685. });
  686. } else {
  687. this.$toast.fail(res.msg);
  688. }
  689. });
  690. },
  691. storeVisit(val) {
  692. var that = this;
  693. localStorage.removeItem('visitId');
  694. checkVisit({ storeId: val.storeId }).then((res) => {
  695. buryingPoint({
  696. systemModel: '计划内',
  697. buryingPointType: 1,
  698. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  699. buryingPointName: '进店拜访',
  700. buryingPointPosition: '计划内',
  701. });
  702. if (res.code == 200 || val.stateString.indexOf('拜访中') != -1) {
  703. if (localStorage.getItem('loginType') == 'cs') {
  704. var lat = '';
  705. var lon = '';
  706. if (val.lat == '' || val.lat == null) {
  707. lat = '31.2517820000';
  708. lon = '120.5593090000';
  709. } else {
  710. lat = val.lat;
  711. lon = val.lon;
  712. }
  713. this.$router.push({
  714. path: '/storeVisitpage',
  715. query: {
  716. storeId: val.storeId,
  717. rdId: val.rdId,
  718. lat: lat,
  719. lon: lon,
  720. visitId: val.visitId,
  721. pageType: 'out',
  722. addressLine: val.addressLine,
  723. storeCategory: val.storeCategory,
  724. storeName: val.storeName,
  725. hisTime: val.hisTime,
  726. contactName: val.contactName,
  727. storeCode: val.storeCode,
  728. tabVal: this.tabVal,
  729. visitModel: '1',
  730. latNew: '31.2517820000',
  731. lonNew: '120.5593090000',
  732. PointSum: 0,
  733. marklat: lat,
  734. marklon: lon,
  735. from: 'inPlan',
  736. },
  737. });
  738. localStorage.setItem('startTime', new Date());
  739. localStorage.setItem('ORGName', val.deptName);
  740. localStorage.setItem('chainNameR', val.storeName);
  741. } else {
  742. if (that.flag) {
  743. that.flag = false;
  744. that.timer = null;
  745. that.timer = setTimeout(() => {
  746. that.flag = true;
  747. }, 2000);
  748. if (val.stateString.indexOf('拜访中') != -1) {
  749. that.$router.push({
  750. path: '/storeVisitpage',
  751. query: {
  752. storeId: val.storeId,
  753. rdId: val.rdId,
  754. lat: val.lat,
  755. lon: val.lon,
  756. visitId: val.visitId,
  757. addressLine: val.addressLine,
  758. storeCategory: val.storeCategory,
  759. storeName: val.storeName,
  760. contactName: val.contactName,
  761. genDate: val.hisTime,
  762. storeCode: val.storeCode,
  763. visitModel: '1',
  764. latNew: val.lat,
  765. lonNew: val.lon,
  766. PointSum: '0',
  767. marklat: val.lat,
  768. marklon: val.lon,
  769. from: 'inPlan',
  770. },
  771. });
  772. localStorage.setItem('startTime', new Date());
  773. localStorage.setItem('ORGName', val.deptName);
  774. localStorage.setItem('chainNameR', val.storeName);
  775. } else {
  776. getPosition()
  777. .then((res) => {
  778. let { TXisBD, resData } = res;
  779. this.lat = TXisBD.lat;
  780. this.lon = TXisBD.lon;
  781. localStorage.setItem('lat', this.lat);
  782. localStorage.setItem('lon', this.lon);
  783. this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
  784. })
  785. .catch((error) => {
  786. this.$dialog.alert({
  787. message: error,
  788. });
  789. });
  790. }
  791. }
  792. }
  793. } else {
  794. this.$dialog.alert({
  795. title: '系统提示',
  796. message: res.msg,
  797. });
  798. }
  799. });
  800. },
  801. checkStoreAddressByStoreCodeFun(val, location, res) {
  802. checkStoreAddressByStoreCode({
  803. storeCode: val.storeCode,
  804. lon: location.lon,
  805. lat: location.lat,
  806. }).then((response) => {
  807. // loading1.clear();
  808. if (val.lat == '' || val.lat == null) {
  809. this.lat = location.lat;
  810. this.lon = location.lon;
  811. } else {
  812. this.lat = val.lat;
  813. this.lon = val.lon;
  814. }
  815. // let PointSum = this.twoPointSum(this.lat, this.lon, location.lat, location.lon).toFixed(2);
  816. let PointSumval = this.twoPointSum(
  817. location.lat,
  818. location.lon,
  819. location.lat,
  820. location.lon
  821. ).toFixed(2);
  822. // GZ:工装店铺 直接进入拜访
  823. if (localStorage.getItem('postType') == 'GZ') {
  824. localStorage.setItem('startTime', new Date());
  825. localStorage.setItem('ORGName', val.deptName);
  826. localStorage.setItem('chainNameR', val.storeName);
  827. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  828. return;
  829. }
  830. // 门店校验 地址不通过
  831. if (response.code != 200) {
  832. // updateAddress : ,1:同城AB+金牌,去修改地址;2:非金牌店铺,非同城店铺偏差过大不允许拜访,可以重置定位;0非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
  833. if (response.data.updateAddress == 0) {
  834. // 非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
  835. this.$dialog
  836. .confirm({
  837. confirmButtonText: '确定拜访',
  838. cancelButtonText: '取消拜访',
  839. title: '系统提示',
  840. message:
  841. '该客户没有经纬度,此次拜访会保存定位点作为客户经纬度,下次拜访时判断是否偏差过大。',
  842. closeOnClickOverlay: true,
  843. })
  844. .then(() => {
  845. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  846. });
  847. } else if (response.data.updateAddress == 1) {
  848. // 同城AB+金牌,去修改地址
  849. // addressUpdateTimesOver: true=已经达到最大次数,不让修改; false=没有达到可以修改
  850. if (!response.data.addressUpdateTimesOver) {
  851. this.$dialog
  852. .confirm({
  853. title: '系统提示',
  854. message: response.msg + '请立即修改后再拜访',
  855. messageAlign: 'left',
  856. confirmButtonText: '立即修改',
  857. cancelButtonText: '取消',
  858. })
  859. .then(() => {
  860. this.$router.push({
  861. path: '/storeDetail',
  862. query: {
  863. id: val.storeId,
  864. type: 'address',
  865. storeAddressId: val.storeAddressId,
  866. },
  867. });
  868. });
  869. } else {
  870. this.$dialog.confirm({
  871. title: '系统提示',
  872. message: '已经达到最大修改次数',
  873. messageAlign: 'left',
  874. confirmButtonText: '确定',
  875. });
  876. }
  877. } else if (response.data.updateAddress == 2) {
  878. // 1.非金牌店铺,非同城店铺 位置偏差过大 重置经纬度
  879. this.resetCoord(res, val, location, PointSumval);
  880. return;
  881. }
  882. } else {
  883. // 门店编码校验门店地址通过 进入拜访
  884. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  885. }
  886. });
  887. },
  888. // 重置经纬度
  889. resetCoord(res, val, location, PointSumval) {
  890. this.$dialog
  891. .confirm({
  892. confirmButtonText: '初始化定位',
  893. cancelButtonText: '取消拜访',
  894. title: '系统提示',
  895. message: '偏差过大,不允许拜访。可修改本店定位.',
  896. closeOnClickOverlay: true,
  897. })
  898. .then(() => {
  899. mobileReposition({
  900. storeId: val.storeId,
  901. lat: location.lat,
  902. lon: location.lon,
  903. }).then((response) => {
  904. if (response.code == 200) {
  905. this.$dialog
  906. .alert({
  907. title: '系统提示',
  908. message: '本信息定位已更新成功!',
  909. })
  910. .then(() => {
  911. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  912. });
  913. localStorage.setItem('startTime', new Date());
  914. localStorage.setItem('ORGName', val.deptName);
  915. localStorage.setItem('chainNameR', val.storeName);
  916. } else {
  917. this.$toast(response.msg);
  918. }
  919. });
  920. })
  921. .catch(() => {});
  922. },
  923. // 进入拜访 router.push
  924. toSuishenbangOutstoreVisit(res, val, location, PointSumval) {
  925. addVisitsPosition({
  926. storeId: val.storeId,
  927. visitsId: '',
  928. lon: res.longitude,
  929. lat: res.latitude,
  930. sourceLon: location.lon,
  931. sourceLat: location.lat,
  932. positionDesc: '',
  933. accuracy: res.accuracy,
  934. }).then(() => {
  935. this.$router.push({
  936. path: '/storeVisitpage',
  937. query: {
  938. storeId: val.storeId,
  939. rdId: val.rdId,
  940. lat: location.lat,
  941. lon: location.lon,
  942. visitId: val.visitId,
  943. addressLine: val.addressLine,
  944. storeCategory: val.storeCategory,
  945. storeName: val.storeName,
  946. contactName: val.contactName,
  947. genDate: val.hisTime,
  948. storeCode: val.storeCode,
  949. visitModel: '1',
  950. latNew: location.lat,
  951. lonNew: location.lon,
  952. PointSum: PointSumval,
  953. marklat: res.latitude,
  954. marklon: res.longitude,
  955. from: 'inPlan',
  956. },
  957. });
  958. });
  959. },
  960. projectOutVisit(val) {
  961. localStorage.setItem('tabVal', this.tabVal);
  962. localStorage.removeItem('visitId');
  963. // checkVisit({storeId:val.storeId}).then(res=>{
  964. // if(res.code==200||val.stateString.indexOf("拜访中")!=-1){
  965. if (localStorage.getItem('loginType') == 'cs') {
  966. var lat = '';
  967. var lon = '';
  968. if (val.lat == '' || val.lat == null) {
  969. lat = '31.2517820000';
  970. lon = '120.5593090000';
  971. } else {
  972. lat = val.lat;
  973. lon = val.lon;
  974. }
  975. this.$router.push({
  976. path: '/storeGroup',
  977. query: {
  978. storeId: val.storeId,
  979. rdId: val.rdId,
  980. lat: lat,
  981. lon: lon,
  982. visitId: val.visitId,
  983. pageType: 'out',
  984. addressLine: val.addressLine,
  985. storeCategory: val.storeCategory,
  986. storeName: val.storeName,
  987. hisTime: val.hisTime,
  988. contactName: val.contactName,
  989. storeCode: val.storeCode,
  990. tabVal: this.tabVal,
  991. visitModel: '1',
  992. latNew: '31.2517820000',
  993. lonNew: '120.5593090000',
  994. PointSum: 0,
  995. marklat: lat,
  996. marklon: lon,
  997. },
  998. });
  999. localStorage.setItem('startTime', new Date());
  1000. localStorage.setItem('ORGName', val.deptName);
  1001. localStorage.setItem('chainNameR', val.storeName);
  1002. } else {
  1003. if (this.flag) {
  1004. this.flag = false;
  1005. this.timer = null;
  1006. let that = this;
  1007. this.timer = setTimeout(() => {
  1008. this.flag = true;
  1009. }, 2000);
  1010. if (val.stateString.indexOf('拜访中') != -1) {
  1011. localStorage.setItem('startTime', new Date());
  1012. localStorage.setItem('ORGName', val.deptName);
  1013. localStorage.setItem('chainNameR', val.storeName);
  1014. that.$router.push({
  1015. path: '/storeGroup',
  1016. query: {
  1017. storeId: val.storeId,
  1018. rdId: val.rdId,
  1019. lat: val.lat,
  1020. lon: val.lon,
  1021. visitId: val.visitId,
  1022. pageType: 'out',
  1023. addressLine: val.addressLine,
  1024. storeCategory: val.storeCategory,
  1025. storeName: val.storeName,
  1026. hisTime: val.hisTime,
  1027. contactName: val.contactName,
  1028. storeCode: val.storeCode,
  1029. tabVal: that.tabVal,
  1030. visitModel: '1',
  1031. latNew: val.lat,
  1032. lonNew: val.lon,
  1033. PointSum: '0',
  1034. marklat: val.lat,
  1035. marklon: val.lon,
  1036. },
  1037. });
  1038. } else {
  1039. let loading1 = this.$toast.loading({
  1040. duration: 0,
  1041. message: '加载中...',
  1042. forbidClick: true,
  1043. });
  1044. let url = window.location.href;
  1045. let wx = this.wx;
  1046. let qiyeData;
  1047. const instance = axios.create();
  1048. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  1049. instance
  1050. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  1051. params: {
  1052. url: url,
  1053. },
  1054. })
  1055. .then((response) => {
  1056. if (response.status == 200) {
  1057. this.cont = 3;
  1058. var flat = true;
  1059. var times = setInterval(() => {
  1060. this.cont--;
  1061. if (this.cont == '0') {
  1062. if (flat) {
  1063. loading1.clear();
  1064. clearInterval(times);
  1065. that.$dialog
  1066. .alert({
  1067. message: '定位失败,请开启企微定位权限',
  1068. })
  1069. .then(() => {});
  1070. } else {
  1071. clearInterval(times);
  1072. }
  1073. }
  1074. }, 1000);
  1075. qiyeData = response.data.data;
  1076. wx.config({
  1077. beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
  1078. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1079. appId: qiyeData.appId, // 必填,企业微信的corpID
  1080. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  1081. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  1082. signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
  1083. jsApiList: ['ready', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
  1084. });
  1085. wx.ready(function () {
  1086. wx.getLocation({
  1087. type: 'gcj02',
  1088. success: function (res) {
  1089. flat = false;
  1090. loading1.clear();
  1091. var location = that.CJ02BD(res.latitude, res.longitude);
  1092. if (val.lat == '' || val.lat == null) {
  1093. that.lat = location.lat;
  1094. that.lon = location.lon;
  1095. } else {
  1096. that.lat = val.lat;
  1097. that.lon = val.lon;
  1098. }
  1099. let PointSum = that
  1100. .twoPointSum(that.lat, that.lon, location.lat, location.lon)
  1101. .toFixed(2);
  1102. if (val.lat == '' || val.lat == null) {
  1103. if (localStorage.getItem('postType') != 'GZ') {
  1104. that.$dialog
  1105. .confirm({
  1106. confirmButtonText: '确定拜访',
  1107. cancelButtonText: '取消拜访',
  1108. title: '系统提示',
  1109. message:
  1110. '该信息没有经纬度,此次拜访会保存定位点作为信息经纬度,下次拜访时判断是否偏差过大。',
  1111. closeOnClickOverlay: true,
  1112. })
  1113. .then(() => {
  1114. that.$router.push({
  1115. path: '/storeGroup',
  1116. query: {
  1117. storeId: val.storeId,
  1118. rdId: val.rdId,
  1119. lat: that.lat,
  1120. lon: that.lon,
  1121. visitId: val.visitId,
  1122. pageType: 'out',
  1123. addressLine: val.addressLine,
  1124. storeCategory: val.storeCategory,
  1125. storeName: val.storeName,
  1126. contactName: val.contactName,
  1127. hisTime: val.hisTime,
  1128. storeCode: val.storeCode,
  1129. tabVal: that.tabVal,
  1130. visitModel: '1',
  1131. latNew: location.lat,
  1132. lonNew: location.lon,
  1133. PointSum: PointSum,
  1134. marklat: res.latitude,
  1135. marklon: res.longitude,
  1136. },
  1137. });
  1138. });
  1139. } else {
  1140. that.$router.push({
  1141. path: '/storeGroup',
  1142. query: {
  1143. storeId: val.storeId,
  1144. rdId: val.rdId,
  1145. lat: that.lat,
  1146. lon: that.lon,
  1147. visitId: val.visitId,
  1148. pageType: 'out',
  1149. addressLine: val.addressLine,
  1150. storeCategory: val.storeCategory,
  1151. storeName: val.storeName,
  1152. contactName: val.contactName,
  1153. hisTime: val.hisTime,
  1154. storeCode: val.storeCode,
  1155. tabVal: that.tabVal,
  1156. visitModel: '1',
  1157. latNew: location.lat,
  1158. lonNew: location.lon,
  1159. PointSum: PointSum,
  1160. marklat: res.latitude,
  1161. marklon: res.longitude,
  1162. },
  1163. });
  1164. }
  1165. } else {
  1166. that.$router.push({
  1167. path: '/storeGroup',
  1168. query: {
  1169. storeId: val.storeId,
  1170. rdId: val.rdId,
  1171. lat: that.lat,
  1172. lon: that.lon,
  1173. visitId: val.visitId,
  1174. pageType: 'out',
  1175. addressLine: val.addressLine,
  1176. storeCategory: val.storeCategory,
  1177. storeName: val.storeName,
  1178. contactName: val.contactName,
  1179. hisTime: val.hisTime,
  1180. storeCode: val.storeCode,
  1181. tabVal: that.tabVal,
  1182. visitModel: '1',
  1183. latNew: location.lat,
  1184. lonNew: location.lon,
  1185. PointSum: PointSum,
  1186. marklat: res.latitude,
  1187. marklon: res.longitude,
  1188. },
  1189. });
  1190. }
  1191. localStorage.setItem('startTime', new Date());
  1192. localStorage.setItem('ORGName', val.deptName);
  1193. localStorage.setItem('chainNameR', val.storeName);
  1194. addVisitsPosition({
  1195. storeId: val.storeId,
  1196. visitsId: '',
  1197. lon: res.longitude,
  1198. lat: res.latitude,
  1199. sourceLon: location.lon,
  1200. sourceLat: location.lat,
  1201. positionDesc: '',
  1202. accuracy: res.accuracy,
  1203. });
  1204. },
  1205. fail: function () {
  1206. loading1.clear();
  1207. that.$dialog.alert({
  1208. message: 'GPS未开启',
  1209. });
  1210. },
  1211. });
  1212. });
  1213. wx.error(function (res) {
  1214. loading1.clear();
  1215. that.$dialog
  1216. .alert({
  1217. message: '定位失败,请开启企微定位权限',
  1218. })
  1219. .then(() => {});
  1220. });
  1221. }
  1222. });
  1223. }
  1224. }
  1225. }
  1226. // }
  1227. // })
  1228. },
  1229. abnormalVisit(val) {
  1230. localStorage.removeItem('visitId');
  1231. checkVisit({ storeId: val.storeId }).then((res) => {
  1232. buryingPoint({
  1233. systemModel: '计划内',
  1234. buryingPointType: 1,
  1235. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  1236. buryingPointName: '异常拜访',
  1237. buryingPointPosition: '计划内',
  1238. });
  1239. if (res.code == 200 || val.stateString.indexOf('拜访中') != -1) {
  1240. if (localStorage.getItem('loginType') == 'cs') {
  1241. var lat = '';
  1242. var lon = '';
  1243. if (val.lat == '' || val.lat == null) {
  1244. lat = '31.2517820000';
  1245. lon = '120.5593090000';
  1246. } else {
  1247. lat = val.lat;
  1248. lon = val.lon;
  1249. }
  1250. this.$router.push({
  1251. path: '/abnormalVisit',
  1252. query: {
  1253. storeId: val.storeId,
  1254. rdId: val.rdId,
  1255. lat: lat,
  1256. lon: lon,
  1257. visitId: val.visitId,
  1258. pageType: 'out',
  1259. addressLine: val.addressLine,
  1260. storeCategory: val.storeCategory,
  1261. storeName: val.storeName,
  1262. hisTime: val.hisTime,
  1263. contactName: val.contactName,
  1264. storeCode: val.storeCode,
  1265. tabVal: this.tabVal,
  1266. visitModel: '3',
  1267. latNew: '31.2517820000',
  1268. lonNew: '120.5593090000',
  1269. PointSum: 0,
  1270. marklat: lat,
  1271. marklon: lon,
  1272. },
  1273. });
  1274. localStorage.setItem('startTime', new Date());
  1275. localStorage.setItem('ORGName', val.deptName);
  1276. localStorage.setItem('chainNameR', val.storeName);
  1277. } else {
  1278. if (this.flag) {
  1279. this.flag = false;
  1280. this.timer = null;
  1281. this.timer = setTimeout(() => {
  1282. this.flag = true;
  1283. }, 2000);
  1284. let loading1 = this.$toast.loading({
  1285. duration: 0,
  1286. message: '定位中...',
  1287. forbidClick: true,
  1288. });
  1289. let url = window.location.href;
  1290. let that = this;
  1291. let wx = this.wx;
  1292. let qiyeData;
  1293. const instance = axios.create();
  1294. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  1295. instance
  1296. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  1297. params: {
  1298. url: url,
  1299. },
  1300. })
  1301. .then((response) => {
  1302. if (response.status == 200) {
  1303. this.cont = 3;
  1304. var flat = true;
  1305. var times = setInterval(() => {
  1306. this.cont--;
  1307. if (this.cont == '0') {
  1308. if (flat) {
  1309. loading1.clear();
  1310. clearInterval(times);
  1311. that.$dialog.alert({
  1312. message: '定位失败,请开启企微定位权限',
  1313. });
  1314. } else {
  1315. clearInterval(times);
  1316. }
  1317. }
  1318. }, 1000);
  1319. qiyeData = response.data.data;
  1320. wx.config({
  1321. beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
  1322. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1323. appId: qiyeData.appId, // 必填,企业微信的corpID
  1324. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  1325. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  1326. signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
  1327. jsApiList: ['ready', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
  1328. });
  1329. wx.ready(function () {
  1330. wx.getLocation({
  1331. type: 'gcj02',
  1332. success: function (res) {
  1333. flat = false;
  1334. loading1.clear();
  1335. var location = that.CJ02BD(res.latitude, res.longitude);
  1336. if (val.lat == '' || val.lat == null) {
  1337. that.lat = location.lat;
  1338. that.lon = location.lon;
  1339. } else {
  1340. that.lat = val.lat;
  1341. that.lon = val.lon;
  1342. }
  1343. let PointSum = that
  1344. .twoPointSum(that.lat, that.lon, location.lat, location.lon)
  1345. .toFixed(2);
  1346. if (PointSum > 500 && localStorage.getItem('postType') != 'GZ') {
  1347. that.$dialog
  1348. .confirm({
  1349. confirmButtonText: '确定',
  1350. cancelButtonText: '取消',
  1351. title: '系统提示',
  1352. message: '定位距离偏差大',
  1353. closeOnClickOverlay: true,
  1354. })
  1355. .then(() => {
  1356. that.dialogms = false;
  1357. that.$router.push({
  1358. path: '/abnormalVisit',
  1359. query: {
  1360. storeId: val.storeId,
  1361. rdId: val.rdId,
  1362. lat: that.lat,
  1363. lon: that.lon,
  1364. visitModel: '5',
  1365. visitId: val.visitId,
  1366. genDate: val.genDate,
  1367. storeCode: val.storeCode,
  1368. latNew: location.lat,
  1369. lonNew: location.lon,
  1370. PointSum: PointSum,
  1371. marklat: res.latitude,
  1372. marklon: res.longitude,
  1373. },
  1374. });
  1375. localStorage.setItem('startTime', new Date());
  1376. localStorage.setItem('ORGName', val.deptName);
  1377. localStorage.setItem('chainNameR', val.storeName);
  1378. });
  1379. } else {
  1380. that.$router.push({
  1381. path: '/abnormalVisit',
  1382. query: {
  1383. storeId: val.storeId,
  1384. rdId: val.rdId,
  1385. lat: that.lat,
  1386. lon: that.lon,
  1387. visitModel: '3',
  1388. visitId: val.visitId,
  1389. genDate: val.genDate,
  1390. storeCode: val.storeCode,
  1391. latNew: location.lat,
  1392. lonNew: location.lon,
  1393. PointSum: PointSum,
  1394. marklat: res.latitude,
  1395. marklon: res.longitude,
  1396. },
  1397. });
  1398. localStorage.setItem('startTime', new Date());
  1399. localStorage.setItem('ORGName', val.deptName);
  1400. localStorage.setItem('chainNameR', val.storeName);
  1401. }
  1402. addVisitsPosition({
  1403. storeId: val.storeId,
  1404. visitsId: '',
  1405. lon: res.longitude,
  1406. lat: res.latitude,
  1407. sourceLon: location.lon,
  1408. sourceLat: location.lat,
  1409. positionDesc: '',
  1410. accuracy: res.accuracy,
  1411. });
  1412. },
  1413. fail: function () {
  1414. loading1.clear();
  1415. that.$dialog
  1416. .alert({
  1417. message: 'GPS未开启',
  1418. })
  1419. .then(() => {
  1420. // that.abnormalVisit(val)
  1421. });
  1422. },
  1423. });
  1424. });
  1425. wx.error(function (res) {
  1426. loading1.clear();
  1427. that.$dialog.alert({
  1428. message: '定位失败,请开启企微定位权限',
  1429. });
  1430. });
  1431. } else {
  1432. loading1.clear();
  1433. this.$toast.fail(dataList.msg);
  1434. }
  1435. });
  1436. }
  1437. }
  1438. } else {
  1439. this.$dialog.alert({
  1440. title: '系统提示',
  1441. message: res.msg,
  1442. });
  1443. }
  1444. });
  1445. },
  1446. compareDate(dateTime1) {
  1447. var formatDate1 = Date.parse(dateTime1);
  1448. var formatDate2 = Date.parse(this.parseTime(new Date(), '{yy}-{mm}-{dd}'));
  1449. if (formatDate1 == formatDate2) {
  1450. return true;
  1451. } else {
  1452. return false;
  1453. }
  1454. },
  1455. visitFn(val) {
  1456. buryingPoint({
  1457. systemModel: '计划内',
  1458. buryingPointType: 1,
  1459. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  1460. buryingPointName: '客户信息',
  1461. buryingPointPosition: '计划内',
  1462. });
  1463. this.$router.push({
  1464. path: '/storeDetail',
  1465. query: { id: val.storeId, detilId: 'a' },
  1466. });
  1467. },
  1468. goFn() {
  1469. this.$router.push({
  1470. path: '/topStore',
  1471. });
  1472. },
  1473. formLink() {
  1474. this.$router.push('/storeVisit/questions');
  1475. },
  1476. onClickLeft() {
  1477. this.$router.go(-1);
  1478. },
  1479. onSearch() {
  1480. localStorage.setItem('deviveStoreName', this.storeName);
  1481. this.getUserInPlanList();
  1482. },
  1483. handelChange(date) {
  1484. var dateF = this.parseTime(date.$d, '{yy}-{mm}-{dd}');
  1485. this.timeData = dateF;
  1486. this.genDate = dateF;
  1487. this.getUserInPlanList();
  1488. },
  1489. onLoad() {
  1490. this.getUserInPlanList();
  1491. },
  1492. listClick(val) {
  1493. this.listActive = val;
  1494. },
  1495. // 跳转好帮手门店详情
  1496. goOtherSystem(item) {
  1497. if (item.storeCode) {
  1498. window.location.href =
  1499. process.env.VUE_APP_SSB_LINK + '/order/storeDetail/index?shopCode=' + item.storeCode;
  1500. } else {
  1501. this.$dialog.alert({
  1502. message: '缺少门店code',
  1503. });
  1504. }
  1505. },
  1506. },
  1507. };
  1508. </script>
  1509. <style lang="scss">
  1510. .van-dialog__confirm,
  1511. .van-dialog__confirm:active {
  1512. color: #0057ba;
  1513. }
  1514. .searchDiv {
  1515. .van-search {
  1516. background: #fff;
  1517. }
  1518. .van-search__action {
  1519. font-size: 14px;
  1520. color: #0057ba;
  1521. font-weight: bold;
  1522. background: #f1f1f1;
  1523. border-bottom-right-radius: 60px;
  1524. border-top-right-radius: 60px;
  1525. border: 1px solid #c1c1c1;
  1526. padding: 0 20px;
  1527. }
  1528. .van-search--show-action {
  1529. padding-right: 12px;
  1530. }
  1531. .van-search__content {
  1532. border: 1px solid #c1c1c1;
  1533. border-bottom-left-radius: 60px;
  1534. border-top-left-radius: 60px;
  1535. background: #f1f1f1;
  1536. border-right: 0;
  1537. }
  1538. }
  1539. </style>
  1540. <style lang="scss" scoped>
  1541. .bgcolor {
  1542. background-color: #f5f5f5;
  1543. }
  1544. .container {
  1545. padding-bottom: 50px;
  1546. }
  1547. .monthNow {
  1548. height: 48px;
  1549. line-height: 48px;
  1550. text-align: center;
  1551. font-weight: bold;
  1552. padding: 0 15px;
  1553. box-sizing: border-box;
  1554. background-color: #f5f5f5;
  1555. font-size: 16px;
  1556. .CalendarIcon {
  1557. font-size: 24px;
  1558. color: #0057ba;
  1559. position: relative;
  1560. top: 6px;
  1561. margin-left: 10px;
  1562. }
  1563. }
  1564. .card {
  1565. padding: 10px 16px;
  1566. box-sizing: border-box;
  1567. .title {
  1568. font-size: 15px;
  1569. font-weight: bold;
  1570. color: #333;
  1571. line-height: 22px;
  1572. padding-right: 52px;
  1573. /*word-break: break-all;*/
  1574. .statusIcon {
  1575. padding: 3px;
  1576. font-size: 12px;
  1577. margin: 0 3px;
  1578. color: #fff;
  1579. display: inline-block;
  1580. height: 20px;
  1581. line-height: 16px;
  1582. vertical-align: -1px;
  1583. }
  1584. .submit {
  1585. background: #ffba13;
  1586. }
  1587. .noSubmit {
  1588. background: #f11818;
  1589. }
  1590. }
  1591. .info {
  1592. font-size: 14px;
  1593. color: #909090;
  1594. line-height: 26px;
  1595. }
  1596. }
  1597. .navBarTOP {
  1598. position: fixed;
  1599. width: 100%;
  1600. z-index: 2;
  1601. top: 0;
  1602. }
  1603. .cellcontent .centerBtn {
  1604. margin: 0 auto 10px;
  1605. display: block;
  1606. width: 92%;
  1607. border-radius: 5px;
  1608. color: #0057ba;
  1609. border: 1px solid #0057ba;
  1610. }
  1611. .cellcontent .centerBtn1 {
  1612. background-color: #0057ba;
  1613. color: #fff;
  1614. }
  1615. .btnbox {
  1616. padding-top: 14px;
  1617. border-top: 1px solid #eee;
  1618. margin: 0 10px;
  1619. }
  1620. .cellcontent .centerBtn2 {
  1621. margin: 0 auto 10px;
  1622. display: block;
  1623. width: 92%;
  1624. color: #0057ba;
  1625. border-radius: 5px;
  1626. padding: 0;
  1627. }
  1628. .statstext {
  1629. background-color: #0057ba;
  1630. position: absolute;
  1631. right: 0;
  1632. top: 6px;
  1633. padding: 2px 6px 2px 12px;
  1634. border-bottom-left-radius: 60px;
  1635. border-top-left-radius: 60px;
  1636. color: #fff;
  1637. }
  1638. .lineGrey {
  1639. height: 10px;
  1640. width: 100%;
  1641. background: #f1f1f1;
  1642. }
  1643. .cellcontent .van-cell {
  1644. padding: 10px 0;
  1645. }
  1646. .statstext .van-icon__image {
  1647. height: 0.7em;
  1648. }
  1649. .visitStoreIco {
  1650. float: left;
  1651. float: left;
  1652. width: 26px;
  1653. text-align: center;
  1654. background-color: #ffba13;
  1655. color: #fff;
  1656. border-radius: 100%;
  1657. margin-left: 14px;
  1658. line-height: 26px;
  1659. height: 26px;
  1660. }
  1661. .tipsTitle {
  1662. padding: 5px 0;
  1663. text-align: center;
  1664. font-size: 16px;
  1665. font-weight: 600;
  1666. }
  1667. .deviceWithin {
  1668. .TCFXListItem {
  1669. display: inline-block;
  1670. border: 1px solid #ccc;
  1671. padding: 3px 5px;
  1672. margin: 0 5px;
  1673. }
  1674. }
  1675. </style>