index.vue 59 KB

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