index.vue 63 KB

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