index.vue 59 KB

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