index.vue 56 KB

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