index.vue 62 KB

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