index.vue 67 KB

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