index.vue 62 KB

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