index.vue 65 KB

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