index.vue 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553
  1. <template>
  2. <div class="bgcolor deviceOutside">
  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. @clear="clearFn">
  17. <template #action>
  18. <div @click="onSearchm">搜索</div>
  19. </template>
  20. </van-search>
  21. </div>
  22. <van-tabs class="myTab" type="card" v-model="tabVal" color="#0057ba" @change="tabChange">
  23. <van-tab title="销售部" name="0" :disabled="disabled"></van-tab>
  24. <van-tab title="我的" name="1" :disabled="disabled"></van-tab>
  25. </van-tabs>
  26. </div>
  27. <!-- 主体内容-->
  28. <div class="container content" style="margin-top: 144px" @touchmove="handleTouch">
  29. <van-list
  30. class="myList"
  31. v-model="loading"
  32. :finished="finished"
  33. finished-text="--已经到底了--"
  34. @load="onLoad">
  35. <div class="cellcontent" v-for="(item, index) in list" :key="index">
  36. <van-cell>
  37. <div class="card">
  38. <div class="title titlero">
  39. <template v-if="item.storeLabels">
  40. <!-- 金牌店ABC -->
  41. <img
  42. class="JPABC"
  43. :src="require('@/assets/Icon/JPA.png')"
  44. v-if="item.storeLabels.jpA" />
  45. <img
  46. class="JPABC"
  47. :src="require('@/assets/Icon/JPB.png')"
  48. v-if="item.storeLabels.jpB" />
  49. <img
  50. class="JPABC"
  51. :src="require('@/assets/Icon/JPC.png')"
  52. v-if="item.storeLabels.jpC" />
  53. </template>
  54. <span @click="goOtherSystem(item)" :style="setStroeNameStyle(item)">
  55. <span>{{ item.storeName }}</span>
  56. (<span>{{ item.storeCode }}</span
  57. >)
  58. </span>
  59. <span class="btn" :data-clipboard-text="item.storeCode">
  60. <van-icon
  61. :name="paste"
  62. color="#ee0a24"
  63. size="20"
  64. style="top: 6px; margin-left: 4px" />
  65. </span>
  66. <!-- "approvalStatus": 1:已结案;0:未结案, -->
  67. <!-- "processApprovalStatus": 审批状态(0=未提交,1=已提交待审核,2=审批通过,3=审批拒绝) -->
  68. <template v-if="item.approvalStatus == 0">
  69. <span class="statusIcon submit" v-if="item.processApprovalStatus == 1"
  70. >已提交</span
  71. >
  72. <span class="statusIcon noSubmit" v-if="item.processApprovalStatus == 0"
  73. >未提交</span
  74. >
  75. </template>
  76. </div>
  77. <div class="info" style="position: relative">
  78. 联系人:{{ item.contactName }}
  79. <div style="position: absolute; bottom: 0px; right: 0px">
  80. <!-- 金牌店ABC -->
  81. <!-- <el-popover
  82. popper-class="zpover"
  83. placement="bottom"
  84. width="120"
  85. trigger="click"
  86. :content="setJPABCContent(item)">
  87. <div
  88. v-if="setJPABCFlag(item)"
  89. class="visitStoreIco"
  90. style="background-color: #fff"
  91. slot="reference">
  92. <van-icon :name="require('@/assets/Icon/visitJPNum.png')" size="26" />
  93. <div class="JPVisitNum">{{ item.visitNum }}/{{ item.needVisitNum }}</div>
  94. </div>
  95. </el-popover> -->
  96. <!-- 凤凰客户 -->
  97. <el-popover
  98. popper-class="zpover"
  99. placement="bottom"
  100. width="120"
  101. trigger="click"
  102. content="该客户为凤凰客户">
  103. <div
  104. v-if="item.storeLabels.fhCustomer"
  105. class="visitStoreIco"
  106. style="background-color: #fff"
  107. slot="reference">
  108. <van-icon :name="require('@/assets/Icon/fenghuangjihua.png')" size="26" />
  109. </div>
  110. </el-popover>
  111. <el-popover
  112. popper-class="zpover zpover6"
  113. placement="bottom-start"
  114. trigger="click">
  115. <div>
  116. <p>
  117. 本店{{ timeData }}下单SKU数:<a
  118. @click="linkList(item)"
  119. style="text-decoration: underline"
  120. >点击查看详情</a
  121. >
  122. </p>
  123. </div>
  124. <div
  125. class="visitStoreIco"
  126. v-if="item.storeLabels.zysslNums"
  127. style="background-color: #fff; position: relative"
  128. slot="reference">
  129. <p
  130. style="
  131. width: 100%;
  132. position: absolute;
  133. z-index: 1;
  134. top: 0.2px;
  135. width: 22px;
  136. margin: 0;
  137. margin-left: 3.6px;
  138. text-align: center;
  139. font-size: 12px;
  140. ">
  141. {{ item.storeLabels.zysslNums }}
  142. </p>
  143. <van-icon :name="ord" size="26" />
  144. </div>
  145. </el-popover>
  146. <el-popover
  147. popper-class="zpover zpover5"
  148. placement="bottom"
  149. width="200"
  150. trigger="click">
  151. <div v-if="item.storeLabels">
  152. <p>已参加:</p>
  153. <p v-for="tt in (item.storeLabels.targetOne + '').split(';')">
  154. {{ tt }}
  155. </p>
  156. </div>
  157. <div
  158. class="visitStoreIco"
  159. v-if="item.storeLabels.targetOne"
  160. style="background-color: #fff"
  161. slot="reference">
  162. <van-icon :name="targetOne" size="26" />
  163. </div>
  164. </el-popover>
  165. <el-popover
  166. popper-class="zpover"
  167. placement="bottom"
  168. width="120"
  169. trigger="click"
  170. content="调色机5天未联网">
  171. <div
  172. v-if="item.storeLabels.ccmOffline"
  173. class="visitStoreIco"
  174. style="background-color: #fff"
  175. slot="reference">
  176. <van-icon :name="Network" size="26" />
  177. </div>
  178. </el-popover>
  179. <el-popover
  180. popper-class="zpover"
  181. placement="bottom"
  182. width="200"
  183. trigger="click"
  184. content="同城店近60天未下单">
  185. <div
  186. v-if="item.storeLabels.fxNoOrder"
  187. class="visitStoreIco"
  188. style="background-color: #fff"
  189. slot="reference">
  190. <van-icon :name="order60" size="26" />
  191. </div>
  192. </el-popover>
  193. <el-popover
  194. popper-class="zpover"
  195. placement="bottom"
  196. width="200"
  197. trigger="click"
  198. content="金牌店近30天未下单">
  199. <div
  200. v-if="item.storeLabels.noOrder"
  201. class="visitStoreIco"
  202. style="background-color: #fff"
  203. slot="reference">
  204. <van-icon :name="order" size="26" />
  205. </div>
  206. </el-popover>
  207. <el-popover
  208. popper-class="zpover"
  209. placement="bottom"
  210. width="200"
  211. trigger="click"
  212. content="本店本月进过专业时时丽">
  213. <div
  214. class="visitStoreIco"
  215. v-if="item.storeLabels.zyssl"
  216. style="background-color: #ed5c68"
  217. slot="reference">
  218. </div>
  219. </el-popover>
  220. <el-popover
  221. popper-class="zpover zpover1"
  222. placement="bottom"
  223. width="200"
  224. trigger="click"
  225. content="本店本月进过超好贴">
  226. <div
  227. v-if="item.storeLabels.chtczj"
  228. class="visitStoreIco"
  229. style="background-color: #0057ba"
  230. slot="reference">
  231. </div>
  232. </el-popover>
  233. <el-popover
  234. placement="bottom"
  235. popper-class="zpover zpover1 zpover1sb"
  236. :disabled="!item.userVisitTimesMap"
  237. trigger="click">
  238. <div
  239. v-if="item.storeLabels.visitTimes && item.storeLabels.visitTimes > 0"
  240. class="visitStoreIco"
  241. slot="reference"
  242. style="background-color: #fff; position: relative">
  243. <p
  244. style="
  245. width: 100%;
  246. position: absolute;
  247. z-index: 10;
  248. top: -2px;
  249. margin: 0;
  250. text-align: center;
  251. font-size: 12px;
  252. ">
  253. {{ item.storeLabels.visitTimes }}
  254. </p>
  255. <!-- A级金牌店拜访次数少于2 -->
  256. <van-icon
  257. :name="require('@/assets/ordernumRed.png')"
  258. size="26"
  259. v-if="item.storeLabels.jpA && item.storeLabels.visitTimes < 2" />
  260. <van-icon :name="require('@/assets/ordernum.png')" size="26" v-else />
  261. </div>
  262. <p style="text-align: center; background: #fff; color: #000; padding: 5px 0">
  263. 本店本月己拜访过{{ item.storeLabels.visitTimes }}次
  264. </p>
  265. <p
  266. v-if="item.storeLabels.jpA"
  267. style="text-align: center; background: #fff; color: red; padding: 5px 0">
  268. A级金牌店拜访标准:1月2次
  269. </p>
  270. <el-table :data="item.userVisitTimesMap" border max-height="180px">
  271. <el-table-column label="业务员" prop="userName" />
  272. <el-table-column label="拜访次数" prop="visitTimes" width="110px" />
  273. </el-table>
  274. </el-popover>
  275. </div>
  276. </div>
  277. <div class="info">
  278. 类型:{{ item.storeCategory }}&nbsp;
  279. <el-popover popper-class="zpover zpover6" placement="bottom-start" trigger="click">
  280. <div>
  281. <p>
  282. 本店经营品项指导:
  283. <a @click="linkimg(item)" style="text-decoration: underline">点击查看</a>
  284. </p>
  285. </div>
  286. <van-icon name="question-o" size="18" slot="reference" />
  287. </el-popover>
  288. </div>
  289. <div class="info" v-if="item.telephone" @click="buryingPointFn(item)">
  290. 联系电话:<a
  291. style="color: #0057ba; font-weight: bold; text-decoration: underline"
  292. :href="'tel:' + item.telephone"
  293. >{{ item.telephone }}<van-icon name="phone"
  294. /></a>
  295. </div>
  296. <div class="info">
  297. 地址:{{ item.addressLine }}
  298. <img
  299. v-if="item.storeLonExist"
  300. style="width: 36px"
  301. :src="sbpmdh"
  302. @click="linkapp(item)" />
  303. </div>
  304. <!-- 分销店 -->
  305. <template
  306. v-if="
  307. item.sfaStoreType &&
  308. item.sfaStoreType.type == 'fxd' &&
  309. item.sfaStoreChainsContactList
  310. ">
  311. <div class="info" v-if="typeShow">
  312. 经销商:
  313. <div class="TCFXListItem" v-for="(item, index) in item.sfaStoreChainsContactList">
  314. <el-popover
  315. popper-class="zpover zpoverStoreztype"
  316. placement="bottom-start"
  317. trigger="click">
  318. <div>
  319. <div>{{ item.chainCode }}</div>
  320. <div>{{ item.chainName }}</div>
  321. </div>
  322. <div slot="reference" :key="index">
  323. {{ item.categoryDescribe }}
  324. </div>
  325. </el-popover>
  326. </div>
  327. </div>
  328. </template>
  329. <template v-else>
  330. <div class="info" v-if="typeShow">经销商:{{ item.chainName }}</div>
  331. </template>
  332. <!-- storeLonExist 门店是否存在经纬度 字段false=不显示导航和距离,true=显示 -->
  333. <div class="info" v-if="item.storeLonExist">
  334. 距离:{{ Micrometer(item.distance) }}m
  335. </div>
  336. <div class="info" v-if="item.cntOrderAmtYear">
  337. 门店销额(全年累计):{{ Micrometer(item.cntOrderAmtYear) }}元
  338. </div>
  339. </div>
  340. <div
  341. class="statstext"
  342. v-if="item.stateString == '未拜访'"
  343. style="background-color: #ed5c68">
  344. 未拜访
  345. </div>
  346. <div
  347. class="statstext"
  348. v-if="item.stateString == '拜访中'"
  349. style="background-color: white">
  350. <van-icon :name="times" color="#ee0a24" size="32" />
  351. </div>
  352. <div class="statstext" v-if="item.stateString == '已拜访'">已拜访</div>
  353. <div class="btnbox">
  354. <van-row>
  355. <van-col
  356. span="5"
  357. v-if="item.stateString != '已拜访' && customerVisits"
  358. @click="storeVisit(item)">
  359. <img :src="call" style="margin: 0 auto; height: 18px; display: block" />
  360. <p style="text-align: center; margin: 0; font-size: 12px">进入拜访</p>
  361. </van-col>
  362. <van-col
  363. span="5"
  364. v-if="item.storeCategory == '公装经销商'"
  365. @click="projectOutVisit(item)">
  366. <img :src="xmgj" style="margin: 0 auto; height: 18px; display: block" />
  367. <p style="text-align: center; margin: 0; font-size: 12px">项目跟进</p>
  368. </van-col>
  369. <van-col
  370. span="5"
  371. v-if="
  372. item.stateString != '已拜访' &&
  373. item.storeCategory != '公装经销商' &&
  374. customerVisits
  375. "
  376. @click="abnormalVisit(item)">
  377. <img :src="yichang" style="margin: 0 auto; height: 18px; display: block" />
  378. <p style="text-align: center; margin: 0; margin-top: 1px; font-size: 12px">
  379. 异常拜访
  380. </p>
  381. </van-col>
  382. <van-col span="4" v-if="item.showOrderButton" @click="orderFn(item)">
  383. <img :src="xiadan" style="margin: 0 auto; height: 18px; display: block" />
  384. <p style="text-align: center; margin: 0; margin-top: 1px; font-size: 12px">
  385. 去下单
  386. </p>
  387. </van-col>
  388. <van-col span="5" v-if="item.stateString == '已拜访'" @click="Visit(item)">
  389. <img :src="bfxx" style="margin: 0 auto; height: 18px; display: block" />
  390. <p style="text-align: center; margin: 0; margin-top: 1px; font-size: 12px">
  391. 拜访信息
  392. </p>
  393. </van-col>
  394. <van-col span="5" @click="visitFn(item)">
  395. <img :src="kehuxinxi" style="margin: 0 auto; width: 18px; display: block" />
  396. <p style="text-align: center; margin: 0; margin-top: 1px; font-size: 12px">
  397. 客户信息
  398. </p>
  399. </van-col>
  400. <van-col span="5" v-if="tabVal == 1" @click="storeJoinVisit(item)">
  401. <img :src="jiarujihua" style="margin: 0 auto; height: 18px; display: block" />
  402. <p style="text-align: center; margin: 0; font-size: 12px">加入计划内</p>
  403. </van-col>
  404. </van-row>
  405. </div>
  406. </van-cell>
  407. <div class="lineGrey"></div>
  408. </div>
  409. <van-empty v-if="list.length == 0" />
  410. </van-list>
  411. </div>
  412. <van-popup v-model="showPicker" position="bottom" class="textsize">
  413. <van-row
  414. style="
  415. /* position: fixed; */
  416. /* top: 0; */
  417. width: 100%;
  418. z-index: 998;
  419. background-color: #fff;
  420. border-bottom: 1px solid #ccc;
  421. height: 50px;
  422. ">
  423. <van-col span="3" style="text-align: center; margin: 14px 0" @click="showPicker = false">
  424. <van-icon name="cross" size="20" color="#909399" />
  425. </van-col>
  426. <van-col span="13"> </van-col>
  427. <van-col span="4" style="text-align: center; line-height: 36px" @click="onConfirm">
  428. <div style="color: #0057ba">
  429. <van-button type="info" size="small" color="#0057ba">筛选</van-button>
  430. </div></van-col
  431. >
  432. <van-col span="4" style="text-align: center; line-height: 36px" @click="onsets">
  433. <van-button type="default" size="small" style="height: 28px">重置</van-button>
  434. </van-col>
  435. </van-row>
  436. <!-- <div style="height: 48px; width: 100%"></div> -->
  437. <div class="searchcheck" @touchmove="handleTouch">
  438. <p class="searchchecktitle">&nbsp;经销商</p>
  439. <van-row>
  440. <van-col span="24">
  441. <div @click="moreTypeShowFn">
  442. <van-field
  443. style="
  444. margin-top: -6px;
  445. border-radius: 6px;
  446. border: 1px solid #ccc;
  447. overflow: hidden;
  448. "
  449. readonly
  450. v-model="chainName"
  451. label=""
  452. placeholder="请选择经销商" />
  453. </div>
  454. </van-col>
  455. </van-row>
  456. <p class="searchchecktitle" @click="otherbqShow = !otherbqShow">
  457. &nbsp;门店标签<van-icon name="arrow-down" style="float: right" />
  458. </p>
  459. <van-checkbox-group v-model="storeLabelTypes" direction="horizontal">
  460. <div v-if="otherbqShow" style="width: 100%">
  461. <div class="checkbox" v-for="(item, index) in StoreLabels" :key="index">
  462. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  463. </div>
  464. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  465. </div>
  466. </van-checkbox-group>
  467. <van-checkbox-group v-model="result" direction="horizontal">
  468. <p class="searchchecktitle" @click="otherkkdShow = !otherkkdShow">
  469. &nbsp;可控店<van-icon name="arrow-down" style="float: right" />
  470. </p>
  471. <div v-if="otherkkdShow">
  472. <div v-for="(item, index) in storeTypeLists" :key="index" class="checkbox1">
  473. <div v-if="item.groupType == 'kkd'" class="child">
  474. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  475. </div>
  476. </div>
  477. </div>
  478. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  479. <p class="searchchecktitle" @click="otherfxdShow = !otherfxdShow">
  480. &nbsp;分销店<van-icon name="arrow-down" style="float: right" />
  481. </p>
  482. <div v-if="otherfxdShow" style="margin: 0 14px; width: 100%">
  483. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  484. <p class="searchchecktitle1" @click="otherfxdShow1 = !otherfxdShow1">
  485. 金牌店<van-icon name="arrow-down" style="float: right" />
  486. </p>
  487. <div v-if="otherfxdShow1">
  488. <div v-for="(item1, index1) in storeTypeLists" :key="200 + index1" class="checkbox1">
  489. <div v-if="item1.groupType == 'fxd' && item1.remark == 'jp'" class="child">
  490. <van-checkbox :name="item1.dictValue">{{ item1.dictLabel }}</van-checkbox>
  491. </div>
  492. </div>
  493. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  494. </div>
  495. <p class="searchchecktitle1" @click="otherfxdShow2 = !otherfxdShow2">
  496. 同城分销店<van-icon name="arrow-down" style="float: right" />
  497. </p>
  498. <div v-if="otherfxdShow2">
  499. <div
  500. v-for="(itemlj, indexlj) in storeTypeLists"
  501. :key="400 + indexlj"
  502. class="checkbox1">
  503. <div v-if="itemlj.groupType == 'fxd' && itemlj.remark == 'tcfx'" class="child">
  504. <van-checkbox :name="itemlj.dictValue">{{ itemlj.dictLabel }}</van-checkbox>
  505. </div>
  506. </div>
  507. <div style="clear: both"></div>
  508. </div>
  509. </div>
  510. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  511. <p class="searchchecktitle" @click="otherShow = !otherShow">
  512. &nbsp;其他 <van-icon name="arrow-down" style="float: right" />
  513. </p>
  514. <div v-if="otherShow">
  515. <div v-for="(item2, index2) in storeTypeLists" :key="100 + index2" class="checkbox1">
  516. <div v-if="item2.groupType == 'other'" class="child">
  517. <van-checkbox :name="item2.dictValue">{{ item2.dictLabel }}</van-checkbox>
  518. </div>
  519. </div>
  520. </div>
  521. </van-checkbox-group>
  522. </div>
  523. </van-popup>
  524. <van-popup v-model="moreTypeShow" position="bottom" style="height: 80%">
  525. <van-row style="background-color: #f5f5f5">
  526. <van-col span="20">
  527. <van-field
  528. left-icon="search"
  529. style="margin-top: 2px; border-radius: 6px; overflow: hidden"
  530. v-model="CustomerName"
  531. label=""
  532. placeholder="请输入关键词"
  533. clearable />
  534. </van-col>
  535. <van-col span="4" style="text-align: center; line-height: 48px" @click="getCustomer">
  536. <div style="background-color: #0057ba; color: #fff">搜索</div></van-col
  537. >
  538. </van-row>
  539. <van-picker
  540. show-toolbar
  541. :columns="chainsData"
  542. value-key="chainName"
  543. @confirm="onConfirmChainsList"
  544. @cancel="moreTypeShow = false"
  545. visible-item-count="10" />
  546. </van-popup>
  547. <tab-bar tabBarActive="outsidelist"></tab-bar>
  548. <div class="positionContent" @click="rangeStoreFn()" v-if="mapShows">
  549. <van-icon class="img" :name="mpimg" size="50" />
  550. </div>
  551. </div>
  552. </template>
  553. <script>
  554. import tabBar from '@/components/tabBar';
  555. import {
  556. getUserOutPlaList,
  557. getUserOrgStoreList,
  558. stopVisit,
  559. checkVisit,
  560. addVisitsPosition,
  561. mobileReposition,
  562. getStoreyslTypeList,
  563. getStoreTypeListlp,
  564. joinInPlan,
  565. getStoreLabels,
  566. getCustomerList,
  567. buryingPoint,
  568. ProductItemImge,
  569. } from '@/api/index';
  570. import times from '@/assets/Icon/times.png';
  571. import order60 from '@/assets/order60.png';
  572. import targetOne from '@/assets/targetOne.png';
  573. import Network from '@/assets/Network.png';
  574. import ord from '@/assets/ord.png';
  575. import timeico from '@/assets/Icon/datatims.png';
  576. import location from '@/assets/location.png';
  577. import paste from '@/assets/paste.png';
  578. import visitTimes from '@/assets/visitTimes.png';
  579. import mpimg from '@/assets/mpimg.png';
  580. import axios from 'axios';
  581. import mapmarker from '@/components/mapMarkerDouble';
  582. import order from '@/assets/order.png';
  583. import sbpmdh from '@/assets/sbpmdh.png';
  584. import request from '@/utils/request';
  585. import call from '@/assets/call.png';
  586. import jiarujihua from '@/assets/jiarujihua.png';
  587. import kehuxinxi from '@/assets/kehuxinxi-2.png';
  588. import xiadan from '@/assets/xiadan.png';
  589. import yichang from '@/assets/yichang.png';
  590. import bfxx from '@/assets/bfxx.png';
  591. import xmgj from '@/assets/xmgj.png';
  592. import { getOrderUrlByStoreId } from '@/api/inventory';
  593. import { checkStoreAddressByStoreCode } from '@/api/visitstore';
  594. import { getPosition, getMapPoi, getkeywordPoi, getTicketFun } from '@/utils/TXApiFun';
  595. export default {
  596. name: 'outsidelist',
  597. components: { tabBar, mapmarker },
  598. data() {
  599. return {
  600. yichang: yichang,
  601. xmgj: xmgj,
  602. bfxx: bfxx,
  603. xiadan: xiadan,
  604. kehuxinxi: kehuxinxi,
  605. jiarujihua: jiarujihua,
  606. call: call,
  607. times: times,
  608. searchShows: false,
  609. paste: paste,
  610. visitTimess: visitTimes,
  611. sbpmdh: sbpmdh,
  612. typeShow: false,
  613. mpimg: mpimg,
  614. order: order,
  615. ord: ord,
  616. mapShow: false,
  617. otherShow: false,
  618. Network: Network,
  619. order60: order60,
  620. targetOne: targetOne,
  621. chainName: '',
  622. chainCode: '',
  623. mapShows: false,
  624. activeNames: '1',
  625. showPopover: false,
  626. moreTypeShow: false,
  627. showPopoverVNUM: [],
  628. showPopoverC: [],
  629. showPopoverZ: [],
  630. zyssl: [],
  631. chtczj: [],
  632. noVisit: [],
  633. noOrder: [],
  634. fxNoOrder: [],
  635. storeLabelTypes: [],
  636. // showPopover:false,
  637. location: location,
  638. timeico: timeico,
  639. disabled: false,
  640. timer: null,
  641. flag: true,
  642. show: false,
  643. tabVal: '1',
  644. list: [],
  645. cont: 0,
  646. loading: false,
  647. showPicker: false,
  648. finished: false,
  649. otherbqShow: true,
  650. otherkkdShow: true,
  651. otherfxdShow: true,
  652. otherfxdShow2: true,
  653. otherfxdShow1: true,
  654. typeName: '搜索',
  655. visitEndId: '',
  656. pageSize: 12,
  657. pageNum: 1,
  658. listActive: null,
  659. query: '',
  660. storeName: '',
  661. genDate: '',
  662. storeType: '',
  663. endShow: false,
  664. storeCategory: '',
  665. fromValue: {},
  666. storeTypeList: [],
  667. storeTypeLists: [],
  668. chainsData: [],
  669. serachstype: '',
  670. addShow1: false,
  671. storeCategoryList: '',
  672. result: [],
  673. StoreLabels: [],
  674. CustomerName: '',
  675. lat: '',
  676. lon: '',
  677. timeData: '',
  678. customerVisits: true,
  679. };
  680. },
  681. watch: {
  682. $route(to, from) {
  683. this.storeName = localStorage.getItem('outvstoreName');
  684. this.chainName = localStorage.getItem('outvchainName');
  685. if (localStorage.getItem('lat') != null) {
  686. this.lat = localStorage.getItem('lat');
  687. this.lon = localStorage.getItem('lon');
  688. } else {
  689. this.lat = '';
  690. this.lon = '';
  691. }
  692. if (localStorage.getItem('outvstoreLabelTypes') != null) {
  693. this.storeLabelTypes = localStorage.getItem('outvstoreLabelTypes').split(',');
  694. } else {
  695. this.storeLabelTypes = [];
  696. }
  697. if (localStorage.getItem('outvstoreCategoryList') != null) {
  698. this.result = localStorage.getItem('outvstoreCategoryList').split(',');
  699. this.storeLabelTypes = [];
  700. this.storeCategoryList = this.result.join(',');
  701. } else {
  702. this.result = [];
  703. this.storeCategoryList = this.result.join(',');
  704. }
  705. this.chainCode = localStorage.getItem('outvchainCode');
  706. this.storeName = localStorage.getItem('outvstoreName');
  707. if (
  708. (from.path == '/My/index' && to.path == '/outsidelist/index') ||
  709. (from.path == '/home' && to.path == '/outsidelist/index') ||
  710. (from.path == '/deviceWithin/index' && to.path == '/outsidelist/index') ||
  711. (from.path == '/storemanagement/index' && to.path == '/outsidelist/index')
  712. ) {
  713. this.tabVal = '1';
  714. } else {
  715. if (localStorage.getItem('tabVal') != null) {
  716. this.tabVal = localStorage.getItem('tabVal');
  717. }
  718. }
  719. if (
  720. (from.path == '/storeDetail' && to.path == '/outsidelist/index') ||
  721. (from.path == '/storeGroup' && to.path == '/outsidelist/index') ||
  722. (from.path == '/suishenbangOutstoreVisit' && to.path == '/outsidelist/index') ||
  723. (from.path == '/outabnormalVisit' && to.path == '/outsidelist/index') ||
  724. (from.path == '/home' && to.path == '/outsidelist/index') ||
  725. (from.path == '/deviceWithin/index' && to.path == '/outsidelist/index') ||
  726. (from.path == '/storemanagement/index' && to.path == '/outsidelist/index') ||
  727. (from.path == '/My/index' && to.path == '/outsidelist/index')
  728. ) {
  729. this.onSearch();
  730. }
  731. var postType = localStorage.getItem('postType');
  732. if (postType == 'GZ') {
  733. this.addShow1 = false;
  734. this.otherShow = true;
  735. } else {
  736. this.addShow1 = true;
  737. this.otherShow = false;
  738. }
  739. if (localStorage.getItem('postType') == 'JZ' || localStorage.getItem('postType') == 'GZ') {
  740. this.mapShows = false;
  741. } else {
  742. this.mapShows = true;
  743. }
  744. this.getMonth();
  745. },
  746. },
  747. created() {
  748. this.storeName = localStorage.getItem('outvstoreName');
  749. this.chainName = localStorage.getItem('outvchainName');
  750. if (localStorage.getItem('outvstoreLabelTypes') != null) {
  751. this.storeLabelTypes = localStorage.getItem('outvstoreLabelTypes').split(',');
  752. } else {
  753. this.storeLabelTypes = [];
  754. }
  755. if (localStorage.getItem('outvstoreCategoryList') != null) {
  756. this.result = localStorage.getItem('outvstoreCategoryList').split(',');
  757. this.storeCategoryList = this.result.join(',');
  758. } else {
  759. this.result = [];
  760. this.storeCategoryList = this.result.join(',');
  761. }
  762. this.chainCode = localStorage.getItem('outvchainCode');
  763. this.storeName = localStorage.getItem('outvstoreName');
  764. if (localStorage.getItem('tabVal') == null || this.$route.query.info != 'y') {
  765. if (this.$route.query.info != undefined) {
  766. if (this.$route.query.info.indexOf('y') != -1) {
  767. this.tabVal = localStorage.getItem('tabVal');
  768. } else {
  769. this.tabVal = '1';
  770. }
  771. } else {
  772. this.tabVal = localStorage.getItem('tabVal');
  773. }
  774. } else {
  775. this.tabVal = localStorage.getItem('tabVal');
  776. }
  777. if (localStorage.getItem('postType') == 'JZ' || localStorage.getItem('postType') == 'GZ') {
  778. this.mapShows = false;
  779. } else {
  780. this.mapShows = true;
  781. }
  782. this.query = this.$route.query;
  783. localStorage.removeItem('visitId');
  784. this.getStoreLabels();
  785. var postType = localStorage.getItem('postType');
  786. if (postType == 'GZ') {
  787. this.addShow1 = false;
  788. this.otherShow = true;
  789. } else {
  790. this.addShow1 = true;
  791. this.otherShow = false;
  792. }
  793. this.getMonth();
  794. },
  795. mounted() {
  796. // 上拉边界下拉出现白色空白
  797. let node = document.getElementsByClassName('deviceOutside')[0];
  798. node.addEventListener(
  799. 'touchmove',
  800. (e) => {
  801. if (e._isScroller) return;
  802. e.preventDefault();
  803. },
  804. {
  805. passive: false,
  806. }
  807. );
  808. },
  809. methods: {
  810. setJPABCFlag(item) {
  811. // needVisitNum:需要拜访的次数;visitNum:本月已拜访次数
  812. if (item.storeLabels.jpA && item.visitNum < item.needVisitNum) {
  813. return true;
  814. } else {
  815. return false;
  816. }
  817. },
  818. setJPABCContent(item) {
  819. if (item.storeLabels.jpA) {
  820. return 'A级金牌店拜访标准1月2次';
  821. } else if (item.storeLabels.jpB) {
  822. return 'B级金牌店拜访标准1月1次';
  823. } else if (item.storeLabels.jpC) {
  824. return 'C级金牌店拜访标准1月1次';
  825. } else {
  826. return '';
  827. }
  828. },
  829. handleTouch(e) {
  830. e._isScroller = true;
  831. },
  832. setStroeNameStyle(item) {
  833. // 家装或工装 approvalStatus:是否结案 0:未结案,1:已结案
  834. if (
  835. (item.sfaStoreType && (item.sfaStoreType.jz || item.sfaStoreType.gz)) ||
  836. item.approvalStatus == null ||
  837. item.approvalStatus == 0
  838. ) {
  839. return {};
  840. } else {
  841. return { color: '#0057ba', 'text-decoration': 'underline' };
  842. }
  843. },
  844. clearFn() {
  845. this.storeName = '';
  846. localStorage.setItem('outvstoreName', '');
  847. },
  848. linkapp(val) {
  849. var poind = this.gcj02BD(val.lat, val.lon);
  850. let url = window.location.href;
  851. let that = this;
  852. let wx = this.wx;
  853. let qiyeData;
  854. const instance = axios.create();
  855. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  856. instance
  857. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  858. params: {
  859. url: url,
  860. agent: 1,
  861. },
  862. })
  863. .then((response) => {
  864. if (response.status == 200) {
  865. qiyeData = response.data.data;
  866. wx.agentConfig({
  867. corpid: qiyeData.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
  868. agentid: qiyeData.agentId, // 必填,企业微信的应用id (e.g. 1000247)
  869. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  870. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  871. signature: qiyeData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
  872. jsApiList: ['launchMiniprogram'], //必填,传入需要使用的接口名称
  873. success: function (res) {
  874. wx.invoke(
  875. 'launchMiniprogram',
  876. {
  877. appid: 'wx238bbb5f6d958414',
  878. path:
  879. 'pages/relayStation/relayStation?latitude=' +
  880. poind.lat +
  881. '&longitude=' +
  882. poind.lon +
  883. '&name=' +
  884. val.addressLine,
  885. },
  886. function (res) {
  887. if (res.err_msg == 'launchMiniprogram:ok') {
  888. } else {
  889. }
  890. }
  891. );
  892. },
  893. fail: function (res) {
  894. if (res.errMsg.indexOf('function not exist') > -1) {
  895. alert('版本过低请升级');
  896. }
  897. },
  898. });
  899. }
  900. });
  901. },
  902. orderFn(val) {
  903. this.buryingPoint({
  904. systemModel: '计划外',
  905. buryingPointType: 1,
  906. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  907. buryingPointName: '去下单',
  908. buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
  909. });
  910. getOrderUrlByStoreId({
  911. storeId: val.storeId,
  912. from: 'outPlan',
  913. }).then((res) => {
  914. if (res.code == 200 && res.data) {
  915. window.location.href = res.data;
  916. } else {
  917. this.Toast({
  918. message: res.msg,
  919. duration: 5000,
  920. });
  921. }
  922. });
  923. },
  924. linkList(val) {
  925. this.$router.push({
  926. path: '/pItem',
  927. query: { id: val.storeCode, detilId: 'a' },
  928. });
  929. },
  930. linkimg(val) {
  931. ProductItemImge({ storeId: val.storeId }).then((response) => {
  932. if (response.code == 200) {
  933. if (response.data != undefined) {
  934. window.open(response.data);
  935. } else {
  936. this.$toast(response.msg);
  937. }
  938. } else {
  939. this.$toast(res.msg);
  940. }
  941. });
  942. },
  943. getMonth() {
  944. // 获取当前日期
  945. var currentDate = new Date();
  946. // 获取当前月份
  947. var currentMonth = currentDate.getMonth();
  948. // 获取当前年份
  949. // var currentYear = currentDate.getFullYear();
  950. var previousMonthDate1 = new Date();
  951. if (currentDate.getDate() == 1) {
  952. previousMonthDate1.setMonth(currentMonth - 1);
  953. } else {
  954. }
  955. var previousMonth1 = previousMonthDate1.getMonth();
  956. var previousYear1 = previousMonthDate1.getFullYear();
  957. // 计算前三个月的年份和月份
  958. var previousMonthDate = new Date();
  959. if (currentDate.getDate() == 1) {
  960. previousMonthDate.setMonth(currentMonth - 3);
  961. } else {
  962. previousMonthDate.setMonth(currentMonth - 2);
  963. }
  964. 1;
  965. var previousMonth = previousMonthDate.getMonth();
  966. var previousYear = previousMonthDate.getFullYear();
  967. //前三个月
  968. if (previousYear1 == previousYear) {
  969. var formattedPreviousMonth1 = previousYear1 + '-' + (previousMonth1 + 1);
  970. // 格式化年份和月份
  971. var formattedPreviousMonth = previousYear + '-' + (previousMonth + 1);
  972. this.timeData =
  973. formattedPreviousMonth.split('-')[1] + '-' + formattedPreviousMonth1.split('-')[1] + '月';
  974. } else {
  975. var formattedPreviousMonth1 = previousYear1 + '年' + (previousMonth1 + 1) + '月';
  976. // .toString().padStart(2, '0');
  977. // 格式化年份和月份
  978. var formattedPreviousMonth = previousYear + '年' + (previousMonth + 1) + '月';
  979. this.timeData = formattedPreviousMonth + '-' + formattedPreviousMonth1;
  980. }
  981. },
  982. moreTypeShowFn() {
  983. this.moreTypeShow = true;
  984. // this.CustomerName=""
  985. // this.chainsData=[]
  986. this.getCustomer();
  987. },
  988. buryingPoint(val) {
  989. buryingPoint(val);
  990. },
  991. getCustomer() {
  992. var name = '';
  993. if (this.tabVal != 1) {
  994. name = 'org';
  995. } else {
  996. name = 'my';
  997. }
  998. getCustomerList({ name: this.CustomerName, from: name }).then((request) => {
  999. this.chainsData = request.data;
  1000. this.chainsData.push({});
  1001. this.chainsData.pop();
  1002. });
  1003. },
  1004. onConfirmChainsList(value) {
  1005. if (value.chainName != undefined) {
  1006. this.chainName = value.chainName;
  1007. this.chainCode = value.chainCode;
  1008. }
  1009. this.showPickerChainsList = false;
  1010. this.moreTypeShow = false;
  1011. },
  1012. getStoreLabels() {
  1013. getStoreLabels().then((res) => {
  1014. this.StoreLabels = res.data;
  1015. });
  1016. },
  1017. searchType(val) {
  1018. this.storeTypeLists = [];
  1019. if (val != '') {
  1020. let filterArr = this.storeTypeList.filter((item) => {
  1021. return item.dictLabel.toLowerCase().includes(val.toLowerCase());
  1022. });
  1023. this.storeTypeLists = filterArr;
  1024. } else {
  1025. this.storeTypeLists = this.storeTypeList;
  1026. }
  1027. },
  1028. onConfirm(value) {
  1029. this.storeCategoryList = this.result.join(',');
  1030. // this.typeName=value.dictLabel
  1031. this.showPicker = false;
  1032. this.onSearchm();
  1033. },
  1034. moreTypeShowclearableFn() {
  1035. this.chainName = '';
  1036. this.chainCode = '';
  1037. this.chainsData = [];
  1038. },
  1039. onsets() {
  1040. this.result = [];
  1041. this.zyssl = [];
  1042. this.chtczj = [];
  1043. this.noVisit = [];
  1044. this.noOrder = [];
  1045. this.fxNoOrder = [];
  1046. this.storeLabelTypes = [];
  1047. this.storeCategoryList = this.result.join(',');
  1048. this.chainName = '';
  1049. this.chainCode = '';
  1050. // this.typeName=value.dictLabel
  1051. this.onSearch();
  1052. },
  1053. getStoreTypeList() {
  1054. getStoreTypeListlp({ entry: this.tabVal == '0' ? 1 : 2 }).then((res) => {
  1055. this.storeTypeLists = res.data;
  1056. this.storeTypeList = res.data;
  1057. });
  1058. },
  1059. buryingPointFn(val) {
  1060. this.buryingPoint({
  1061. systemModel: '计划外',
  1062. buryingPointType: 1,
  1063. buryingPointValue: val.telephone,
  1064. buryingPointName: '点击电话',
  1065. buryingPointPosition: val.storeName + '(' + val.storeCode + ')',
  1066. });
  1067. },
  1068. // 范围
  1069. rangeStoreFn() {
  1070. localStorage.setItem('tabVal', this.tabVal);
  1071. getPosition()
  1072. .then((res) => {
  1073. let { TXisBD } = res;
  1074. this.lat = TXisBD.lat;
  1075. this.lon = TXisBD.lon;
  1076. let name = this.tabVal != 1 ? '销售部' : '我的';
  1077. this.buryingPoint({
  1078. systemModel: '计划外',
  1079. buryingPointType: 3,
  1080. buryingPointValue: name,
  1081. buryingPointName: '计划外',
  1082. buryingPointPosition: '进入地图',
  1083. });
  1084. this.$router.push({
  1085. path: '/rangeStore',
  1086. query: {
  1087. lat: '',
  1088. lon: '',
  1089. tabVal: this.tabVal,
  1090. },
  1091. });
  1092. })
  1093. .catch((error) => {
  1094. this.$dialog.alert({
  1095. message: error,
  1096. });
  1097. });
  1098. },
  1099. //取消搜索
  1100. cancelSearch() {
  1101. this.$refs.item.toggle();
  1102. },
  1103. storeJoinVisit(val) {
  1104. joinInPlan({ storeId: val.storeId }).then((res) => {
  1105. if (res.code == 200) {
  1106. this.onSearch();
  1107. } else {
  1108. this.$dialog.alert({
  1109. title: '系统提示',
  1110. message: res.msg,
  1111. });
  1112. }
  1113. });
  1114. },
  1115. searchFn() {
  1116. this.showPicker = true;
  1117. this.CustomerName = '';
  1118. this.getStoreTypeList();
  1119. },
  1120. moreSearch() {
  1121. this.onSearch();
  1122. this.$refs.item.toggle();
  1123. },
  1124. getUserOrgStoreList() {
  1125. this.storeType = localStorage.getItem('storeType');
  1126. this.endShow = false;
  1127. if (this.refreshing) {
  1128. this.list = [];
  1129. this.refreshing = false;
  1130. }
  1131. var that = this;
  1132. this.disabled = true;
  1133. this.toastLoading(0, '加载中...', true);
  1134. getUserOrgStoreList({
  1135. lat: that.lat,
  1136. lon: that.lon,
  1137. chainCode: this.chainCode ? this.chainCode : '',
  1138. storeLabelTypes: this.storeLabelTypes.join(','),
  1139. pageNum: this.pageNum,
  1140. storeCategoryList: this.storeCategoryList,
  1141. pageSize: this.pageSize,
  1142. storeName: this.storeName.trim(),
  1143. genDate: this.genDate,
  1144. }).then((res) => {
  1145. this.disabled = false;
  1146. this.toastLoading().clear();
  1147. if (res.code == 200) {
  1148. this.loading = false;
  1149. if (this.pageNum == '1') {
  1150. this.list = [];
  1151. }
  1152. this.list = this.list.concat(res.rows);
  1153. if (this.list.length >= res.total) {
  1154. this.finished = true;
  1155. } else {
  1156. this.finished = false;
  1157. }
  1158. this.pageNum = this.pageNum + 1;
  1159. this.list.forEach((item) => {
  1160. if (item.stateString.indexOf('拜访中') != -1) {
  1161. this.endShow = true;
  1162. this.visitEndId = item.visitId;
  1163. return;
  1164. }
  1165. });
  1166. res.rows.forEach((item) => {
  1167. this.showPopoverVNUM.push({ showPopover: false });
  1168. this.showPopoverC.push({ showPopover: false });
  1169. this.showPopoverZ.push({ showPopover: false });
  1170. });
  1171. } else {
  1172. this.$toast(res.msg);
  1173. }
  1174. });
  1175. },
  1176. positionFn(val) {
  1177. getPosition(true)
  1178. .then((res) => {
  1179. let { TXisBD } = res;
  1180. this.lat = TXisBD.lat;
  1181. this.lon = TXisBD.lon;
  1182. if (val == 1) {
  1183. if (this.tabVal == 1) {
  1184. this.getUserOutPlaListFun();
  1185. } else {
  1186. this.getUserOrgStoreList();
  1187. }
  1188. } else {
  1189. this.getUserOutPlaListFun();
  1190. }
  1191. })
  1192. .catch((error) => {
  1193. this.$dialog.alert({
  1194. message: error,
  1195. });
  1196. });
  1197. },
  1198. getUserOutPlaListFun() {
  1199. this.storeType = localStorage.getItem('storeType');
  1200. var that = this;
  1201. this.disabled = true;
  1202. let loading3 = this.$toast.loading({
  1203. duration: 0,
  1204. message: '加载中...',
  1205. forbidClick: true,
  1206. });
  1207. this.endShow = false;
  1208. if (this.refreshing) {
  1209. this.list = [];
  1210. this.refreshing = false;
  1211. }
  1212. getUserOutPlaList({
  1213. lat: that.lat,
  1214. lon: that.lon,
  1215. chainCode: this.chainCode ? this.chainCode : '',
  1216. storeLabelTypes: this.storeLabelTypes.join(','),
  1217. pageNum: this.pageNum,
  1218. storeCategoryList: this.storeCategoryList,
  1219. pageSize: this.pageSize,
  1220. storeName: this.storeName.trim(),
  1221. genDate: this.genDate,
  1222. }).then((res) => {
  1223. this.disabled = false;
  1224. if (res.code == 200) {
  1225. loading3.clear();
  1226. this.loading = false;
  1227. this.list = this.list.concat(res.rows);
  1228. if (this.list.length >= res.total) {
  1229. this.finished = true;
  1230. } else {
  1231. this.finished = false;
  1232. }
  1233. this.pageNum = this.pageNum + 1;
  1234. this.list.forEach((item) => {
  1235. if (item.stateString.indexOf('拜访中') != -1) {
  1236. this.endShow = true;
  1237. this.visitEndId = item.visitId;
  1238. return;
  1239. }
  1240. });
  1241. res.rows.forEach(() => {
  1242. this.showPopoverVNUM.push({ showPopover: false });
  1243. this.showPopoverC.push({ showPopover: false });
  1244. this.showPopoverZ.push({ showPopover: false });
  1245. });
  1246. } else {
  1247. this.$toast(res.msg);
  1248. }
  1249. });
  1250. },
  1251. storeVisit(val) {
  1252. if (val.visitSource && val.visitSource == 2) {
  1253. this.$toast('请先取消异常拜访后再进入正常拜访!');
  1254. return;
  1255. }
  1256. localStorage.setItem('tabVal', this.tabVal);
  1257. localStorage.removeItem('visitId');
  1258. checkVisit({ storeId: val.storeId }).then((res) => {
  1259. if (this.tabVal == 1) {
  1260. this.buryingPoint({
  1261. systemModel: '计划外',
  1262. buryingPointType: 1,
  1263. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  1264. buryingPointName: '进店拜访',
  1265. buryingPointPosition: '我的',
  1266. });
  1267. } else {
  1268. this.buryingPoint({
  1269. systemModel: '计划外',
  1270. buryingPointType: 1,
  1271. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  1272. buryingPointName: '进店拜访',
  1273. buryingPointPosition: '销售部',
  1274. });
  1275. }
  1276. if (res.code == 200 || val.stateString.indexOf('拜访中') != -1) {
  1277. if (localStorage.getItem('loginType') == 'cs') {
  1278. var lat = '';
  1279. var lon = '';
  1280. if (val.lat == '' || val.lat == null) {
  1281. lat = '31.2517820000';
  1282. lon = '120.5593090000';
  1283. } else {
  1284. lat = val.lat;
  1285. lon = val.lon;
  1286. }
  1287. this.$router.push({
  1288. path: '/suishenbangOutstoreVisit',
  1289. query: {
  1290. storeId: val.storeId,
  1291. rdId: val.rdId,
  1292. lat: lat,
  1293. lon: lon,
  1294. visitId: val.visitId,
  1295. pageType: 'out',
  1296. addressLine: val.addressLine,
  1297. storeCategory: val.storeCategory,
  1298. storeName: val.storeName,
  1299. hisTime: val.hisTime,
  1300. contactName: val.contactName,
  1301. storeCode: val.storeCode,
  1302. tabVal: this.tabVal,
  1303. visitModel: '1',
  1304. latNew: '31.2517820000',
  1305. lonNew: '120.5593090000',
  1306. PointSum: 0,
  1307. marklat: lat,
  1308. marklon: lon,
  1309. from: 'outPlan',
  1310. },
  1311. });
  1312. localStorage.setItem('startTime', new Date());
  1313. localStorage.setItem('ORGName', val.deptName);
  1314. localStorage.setItem('chainNameR', val.storeName);
  1315. } else {
  1316. if (this.flag) {
  1317. this.flag = false;
  1318. this.timer = null;
  1319. let that = this;
  1320. this.timer = setTimeout(() => {
  1321. this.flag = true;
  1322. }, 2000);
  1323. if (val.stateString.indexOf('拜访中') != -1) {
  1324. localStorage.setItem('startTime', new Date());
  1325. localStorage.setItem('ORGName', val.deptName);
  1326. localStorage.setItem('chainNameR', val.storeName);
  1327. that.$router.push({
  1328. path: '/suishenbangOutstoreVisit',
  1329. query: {
  1330. storeId: val.storeId,
  1331. rdId: val.rdId,
  1332. lat: val.lat,
  1333. lon: val.lon,
  1334. visitId: val.visitId,
  1335. pageType: 'out',
  1336. addressLine: val.addressLine,
  1337. storeCategory: val.storeCategory,
  1338. storeName: val.storeName,
  1339. hisTime: val.hisTime,
  1340. contactName: val.contactName,
  1341. storeCode: val.storeCode,
  1342. tabVal: that.tabVal,
  1343. visitModel: '1',
  1344. latNew: val.lat,
  1345. lonNew: val.lon,
  1346. PointSum: '0',
  1347. marklat: val.lat,
  1348. marklon: val.lon,
  1349. from: 'outPlan',
  1350. },
  1351. });
  1352. } else {
  1353. getPosition()
  1354. .then((res) => {
  1355. let { TXisBD, resData } = res;
  1356. this.lat = TXisBD.lat;
  1357. this.lon = TXisBD.lon;
  1358. localStorage.setItem('lat', this.lat);
  1359. localStorage.setItem('lon', this.lon);
  1360. // var location = this.CJ02BD(res.latitude, res.longitude);
  1361. this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
  1362. })
  1363. .catch((error) => {
  1364. this.$dialog.alert({
  1365. message: error,
  1366. });
  1367. });
  1368. }
  1369. }
  1370. }
  1371. } else {
  1372. this.$dialog.alert({
  1373. message: res.msg,
  1374. });
  1375. }
  1376. });
  1377. },
  1378. checkStoreAddressByStoreCodeFun(val, location, res) {
  1379. checkStoreAddressByStoreCode({
  1380. storeCode: val.storeCode,
  1381. lon: location.lon,
  1382. lat: location.lat,
  1383. }).then((response) => {
  1384. // loading1.clear();
  1385. if (val.lat == '' || val.lat == null) {
  1386. this.lat = location.lat;
  1387. this.lon = location.lon;
  1388. }
  1389. // let PointSum = this.twoPointSum(this.lat, this.lon, location.lat, location.lon).toFixed(2);
  1390. let PointSumval = this.twoPointSum(
  1391. location.lat,
  1392. location.lon,
  1393. location.lat,
  1394. location.lon
  1395. ).toFixed(2);
  1396. // GZ:工装店铺 直接进入拜访
  1397. // if (localStorage.getItem('postType') == 'GZ') {
  1398. // localStorage.setItem('startTime', new Date());
  1399. // localStorage.setItem('ORGName', val.deptName);
  1400. // localStorage.setItem('chainNameR', val.storeName);
  1401. // this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  1402. // return;
  1403. // }
  1404. // 门店校验 地址不通过
  1405. if (response.code != 200) {
  1406. // updateAddress : ,1:同城AB+金牌,去修改地址;2:非金牌店铺,非同城店铺偏差过大不允许拜访,可以重置定位;0非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
  1407. if (response.data.updateAddress == 0) {
  1408. // 非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
  1409. this.$dialog
  1410. .confirm({
  1411. confirmButtonText: '确定拜访',
  1412. cancelButtonText: '取消拜访',
  1413. title: '系统提示',
  1414. message:
  1415. '该客户没有经纬度,此次拜访会保存定位点作为客户经纬度,下次拜访时判断是否偏差过大。',
  1416. closeOnClickOverlay: true,
  1417. })
  1418. .then(() => {
  1419. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  1420. });
  1421. } else if (response.data.updateAddress == 1) {
  1422. // 同城AB+金牌,去修改地址
  1423. // addressUpdateTimesOver: true=已经达到最大次数,不让修改; false=没有达到可以修改
  1424. if (!response.data.addressUpdateTimesOver) {
  1425. this.$dialog
  1426. .confirm({
  1427. title: '系统提示',
  1428. message: response.msg + '请立即修改后再拜访',
  1429. messageAlign: 'left',
  1430. confirmButtonText: '立即修改',
  1431. cancelButtonText: '取消',
  1432. })
  1433. .then(() => {
  1434. this.$router.push({
  1435. path: '/storeDetail',
  1436. query: {
  1437. id: val.storeId,
  1438. type: 'address',
  1439. storeAddressId: val.storeAddressId,
  1440. },
  1441. });
  1442. });
  1443. } else {
  1444. this.$dialog.confirm({
  1445. title: '系统提示',
  1446. message: '已经达到最大修改次数',
  1447. messageAlign: 'left',
  1448. confirmButtonText: '确定',
  1449. });
  1450. }
  1451. } else if (response.data.updateAddress == 2) {
  1452. // 1.非金牌店铺,非同城店铺 位置偏差过大 重置经纬度
  1453. this.resetCoord(res, val, location, PointSumval);
  1454. return;
  1455. }
  1456. } else {
  1457. // 门店编码校验门店地址通过 进入拜访
  1458. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  1459. }
  1460. });
  1461. },
  1462. // 重置经纬度
  1463. resetCoord(res, val, location, PointSumval) {
  1464. this.$dialog
  1465. .confirm({
  1466. confirmButtonText: '初始化定位',
  1467. cancelButtonText: '取消拜访',
  1468. title: '系统提示',
  1469. message: '偏差过大,不允许拜访。可修改本店定位.',
  1470. closeOnClickOverlay: true,
  1471. })
  1472. .then(() => {
  1473. mobileReposition({
  1474. storeId: val.storeId,
  1475. lat: location.lat,
  1476. lon: location.lon,
  1477. }).then((response) => {
  1478. if (response.code == 200) {
  1479. this.$dialog
  1480. .alert({
  1481. title: '系统提示',
  1482. message: '本信息定位已更新成功!',
  1483. })
  1484. .then(() => {
  1485. this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
  1486. });
  1487. localStorage.setItem('startTime', new Date());
  1488. localStorage.setItem('ORGName', val.deptName);
  1489. localStorage.setItem('chainNameR', val.storeName);
  1490. } else {
  1491. this.$toast(response.msg);
  1492. }
  1493. });
  1494. });
  1495. },
  1496. // 进入拜访 router.push
  1497. toSuishenbangOutstoreVisit(res, val, location, PointSumval) {
  1498. addVisitsPosition({
  1499. storeId: val.storeId,
  1500. visitsId: '',
  1501. lon: res.longitude,
  1502. lat: res.latitude,
  1503. sourceLon: location.lon,
  1504. sourceLat: location.lat,
  1505. positionDesc: '',
  1506. accuracy: res.accuracy,
  1507. });
  1508. localStorage.setItem('getRequestFlage', 'true');
  1509. this.$router.push({
  1510. path: '/suishenbangOutstoreVisit',
  1511. query: {
  1512. storeId: val.storeId,
  1513. rdId: val.rdId,
  1514. lat: location.lat,
  1515. lon: location.lon,
  1516. visitId: val.visitId,
  1517. pageType: 'out',
  1518. addressLine: val.addressLine,
  1519. storeCategory: val.storeCategory,
  1520. storeName: val.storeName,
  1521. hisTime: val.hisTime,
  1522. contactName: val.contactName,
  1523. storeCode: val.storeCode,
  1524. tabVal: this.tabVal,
  1525. visitModel: '1',
  1526. latNew: location.lat,
  1527. lonNew: location.lon,
  1528. PointSum: PointSumval,
  1529. marklat: res.latitude,
  1530. marklon: res.longitude,
  1531. from: 'outPlan',
  1532. },
  1533. });
  1534. },
  1535. projectOutVisit(val) {
  1536. localStorage.setItem('tabVal', this.tabVal);
  1537. localStorage.removeItem('visitId');
  1538. // checkVisit({storeId:val.storeId}).then(res=>{
  1539. // if(res.code==200||val.stateString.indexOf("拜访中")!=-1){
  1540. if (localStorage.getItem('loginType') == 'cs') {
  1541. var lat = '';
  1542. var lon = '';
  1543. if (val.lat == '' || val.lat == null) {
  1544. lat = '31.2517820000';
  1545. lon = '120.5593090000';
  1546. } else {
  1547. lat = val.lat;
  1548. lon = val.lon;
  1549. }
  1550. this.$router.push({
  1551. path: '/storeGroup',
  1552. query: {
  1553. storeId: val.storeId,
  1554. rdId: val.rdId,
  1555. lat: lat,
  1556. lon: lon,
  1557. visitId: val.visitId,
  1558. pageType: 'out',
  1559. addressLine: val.addressLine,
  1560. storeCategory: val.storeCategory,
  1561. storeName: val.storeName,
  1562. hisTime: val.hisTime,
  1563. contactName: val.contactName,
  1564. storeCode: val.storeCode,
  1565. tabVal: this.tabVal,
  1566. visitModel: '1',
  1567. latNew: '31.2517820000',
  1568. lonNew: '120.5593090000',
  1569. PointSum: 0,
  1570. marklat: lat,
  1571. marklon: lon,
  1572. },
  1573. });
  1574. localStorage.setItem('startTime', new Date());
  1575. localStorage.setItem('ORGName', val.deptName);
  1576. localStorage.setItem('chainNameR', val.storeName);
  1577. } else {
  1578. if (this.flag) {
  1579. this.flag = false;
  1580. this.timer = null;
  1581. let that = this;
  1582. this.timer = setTimeout(() => {
  1583. this.flag = true;
  1584. }, 2000);
  1585. if (val.stateString.indexOf('拜访中') != -1) {
  1586. localStorage.setItem('startTime', new Date());
  1587. localStorage.setItem('ORGName', val.deptName);
  1588. localStorage.setItem('chainNameR', val.storeName);
  1589. that.$router.push({
  1590. path: '/storeGroup',
  1591. query: {
  1592. storeId: val.storeId,
  1593. rdId: val.rdId,
  1594. lat: val.lat,
  1595. lon: val.lon,
  1596. visitId: val.visitId,
  1597. pageType: 'out',
  1598. addressLine: val.addressLine,
  1599. storeCategory: val.storeCategory,
  1600. storeName: val.storeName,
  1601. hisTime: val.hisTime,
  1602. contactName: val.contactName,
  1603. storeCode: val.storeCode,
  1604. tabVal: that.tabVal,
  1605. visitModel: '1',
  1606. latNew: val.lat,
  1607. lonNew: val.lon,
  1608. PointSum: '0',
  1609. marklat: val.lat,
  1610. marklon: val.lon,
  1611. },
  1612. });
  1613. } else {
  1614. let loading1 = this.$toast.loading({
  1615. duration: 0,
  1616. message: '加载中...',
  1617. forbidClick: true,
  1618. });
  1619. let url = window.location.href;
  1620. let wx = this.wx;
  1621. let qiyeData;
  1622. const instance = axios.create();
  1623. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  1624. instance
  1625. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  1626. params: {
  1627. url: url,
  1628. },
  1629. })
  1630. .then((response) => {
  1631. if (response.status == 200) {
  1632. this.cont = 3;
  1633. var flat = true;
  1634. var times = setInterval(() => {
  1635. this.cont--;
  1636. if (this.cont == '0') {
  1637. if (flat) {
  1638. loading1.clear();
  1639. clearInterval(times);
  1640. that.$dialog
  1641. .alert({
  1642. message: '定位失败,请开启企微定位权限',
  1643. })
  1644. .then(() => {});
  1645. } else {
  1646. clearInterval(times);
  1647. }
  1648. }
  1649. }, 1000);
  1650. qiyeData = response.data.data;
  1651. wx.config({
  1652. beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
  1653. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1654. appId: qiyeData.appId, // 必填,企业微信的corpID
  1655. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  1656. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  1657. signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
  1658. jsApiList: ['ready', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
  1659. });
  1660. wx.ready(function () {
  1661. wx.getLocation({
  1662. type: 'gcj02',
  1663. success: function (res) {
  1664. flat = false;
  1665. loading1.clear();
  1666. var location = that.CJ02BD(res.latitude, res.longitude);
  1667. if (val.lat == '' || val.lat == null) {
  1668. that.lat = location.lat;
  1669. that.lon = location.lon;
  1670. }
  1671. let PointSum = that
  1672. .twoPointSum(that.lat, that.lon, location.lat, location.lon)
  1673. .toFixed(2);
  1674. if (val.lat == '' || val.lat == null) {
  1675. if (localStorage.getItem('postType') != 'GZ') {
  1676. that.$dialog
  1677. .confirm({
  1678. confirmButtonText: '确定拜访',
  1679. cancelButtonText: '取消拜访',
  1680. title: '系统提示',
  1681. message:
  1682. '该信息没有经纬度,此次拜访会保存定位点作为信息经纬度,下次拜访时判断是否偏差过大。',
  1683. closeOnClickOverlay: true,
  1684. })
  1685. .then(() => {
  1686. that.$router.push({
  1687. path: '/storeGroup',
  1688. query: {
  1689. storeId: val.storeId,
  1690. rdId: val.rdId,
  1691. lat: that.lat,
  1692. lon: that.lon,
  1693. visitId: val.visitId,
  1694. pageType: 'out',
  1695. addressLine: val.addressLine,
  1696. storeCategory: val.storeCategory,
  1697. storeName: val.storeName,
  1698. contactName: val.contactName,
  1699. hisTime: val.hisTime,
  1700. storeCode: val.storeCode,
  1701. tabVal: that.tabVal,
  1702. visitModel: '1',
  1703. latNew: location.lat,
  1704. lonNew: location.lon,
  1705. PointSum: PointSum,
  1706. marklat: res.latitude,
  1707. marklon: res.longitude,
  1708. },
  1709. });
  1710. });
  1711. } else {
  1712. that.$router.push({
  1713. path: '/storeGroup',
  1714. query: {
  1715. storeId: val.storeId,
  1716. rdId: val.rdId,
  1717. lat: that.lat,
  1718. lon: that.lon,
  1719. visitId: val.visitId,
  1720. pageType: 'out',
  1721. addressLine: val.addressLine,
  1722. storeCategory: val.storeCategory,
  1723. storeName: val.storeName,
  1724. contactName: val.contactName,
  1725. hisTime: val.hisTime,
  1726. storeCode: val.storeCode,
  1727. tabVal: that.tabVal,
  1728. visitModel: '1',
  1729. latNew: location.lat,
  1730. lonNew: location.lon,
  1731. PointSum: PointSum,
  1732. marklat: res.latitude,
  1733. marklon: res.longitude,
  1734. },
  1735. });
  1736. }
  1737. } else {
  1738. that.$router.push({
  1739. path: '/storeGroup',
  1740. query: {
  1741. storeId: val.storeId,
  1742. rdId: val.rdId,
  1743. lat: that.lat,
  1744. lon: that.lon,
  1745. visitId: val.visitId,
  1746. pageType: 'out',
  1747. addressLine: val.addressLine,
  1748. storeCategory: val.storeCategory,
  1749. storeName: val.storeName,
  1750. contactName: val.contactName,
  1751. hisTime: val.hisTime,
  1752. storeCode: val.storeCode,
  1753. tabVal: that.tabVal,
  1754. visitModel: '1',
  1755. latNew: location.lat,
  1756. lonNew: location.lon,
  1757. PointSum: PointSum,
  1758. marklat: res.latitude,
  1759. marklon: res.longitude,
  1760. },
  1761. });
  1762. }
  1763. localStorage.setItem('startTime', new Date());
  1764. localStorage.setItem('ORGName', val.deptName);
  1765. localStorage.setItem('chainNameR', val.storeName);
  1766. addVisitsPosition({
  1767. storeId: val.storeId,
  1768. visitsId: '',
  1769. lon: res.longitude,
  1770. lat: res.latitude,
  1771. sourceLon: location.lon,
  1772. sourceLat: location.lat,
  1773. positionDesc: '',
  1774. accuracy: res.accuracy,
  1775. });
  1776. },
  1777. fail: function () {
  1778. loading1.clear();
  1779. that.$dialog.alert({
  1780. message: 'GPS未开启',
  1781. });
  1782. },
  1783. });
  1784. });
  1785. wx.error(function (res) {
  1786. loading1.clear();
  1787. that.$dialog
  1788. .alert({
  1789. message: '定位失败,请开启企微定位权限',
  1790. })
  1791. .then(() => {});
  1792. });
  1793. }
  1794. });
  1795. }
  1796. }
  1797. }
  1798. // }
  1799. // })
  1800. },
  1801. abnormalVisit(val) {
  1802. localStorage.removeItem('visitId');
  1803. localStorage.setItem('tabVal', this.tabVal);
  1804. checkVisit({ storeId: val.storeId }).then((res) => {
  1805. this.buryingPoint({
  1806. systemModel: '计划外',
  1807. buryingPointType: 1,
  1808. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  1809. buryingPointName: '异常拜访',
  1810. buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
  1811. });
  1812. if (res.code == 200 || val.stateString.indexOf('拜访中') != -1) {
  1813. if (localStorage.getItem('loginType') == 'cs') {
  1814. var lat = '';
  1815. var lon = '';
  1816. if (val.lat == '' || val.lat == null) {
  1817. lat = '31.2517820000';
  1818. lon = '120.5593090000';
  1819. } else {
  1820. lat = val.lat;
  1821. lon = val.lon;
  1822. }
  1823. this.$router.push({
  1824. path: '/outabnormalVisit',
  1825. query: {
  1826. storeId: val.storeId,
  1827. rdId: val.rdId,
  1828. lat: lat,
  1829. lon: lon,
  1830. visitId: val.visitId,
  1831. pageType: 'out',
  1832. addressLine: val.addressLine,
  1833. storeCategory: val.storeCategory,
  1834. storeName: val.storeName,
  1835. hisTime: val.hisTime,
  1836. contactName: val.contactName,
  1837. storeCode: val.storeCode,
  1838. tabVal: this.tabVal,
  1839. visitModel: '3',
  1840. latNew: '31.2517820000',
  1841. lonNew: '120.5593090000',
  1842. PointSum: 0,
  1843. marklat: lat,
  1844. marklon: lon,
  1845. },
  1846. });
  1847. localStorage.setItem('startTime', new Date());
  1848. localStorage.setItem('ORGName', val.deptName);
  1849. localStorage.setItem('chainNameR', val.storeName);
  1850. } else {
  1851. if (this.flag) {
  1852. this.flag = false;
  1853. this.timer = null;
  1854. this.timer = setTimeout(() => {
  1855. this.flag = true;
  1856. }, 2000);
  1857. let loading1 = this.$toast.loading({
  1858. duration: 0,
  1859. message: '加载中...',
  1860. forbidClick: true,
  1861. });
  1862. let url = window.location.href;
  1863. let that = this;
  1864. let wx = this.wx;
  1865. let qiyeData;
  1866. const instance = axios.create();
  1867. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  1868. instance
  1869. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  1870. params: {
  1871. url: url,
  1872. },
  1873. })
  1874. .then((response) => {
  1875. if (response.status == 200) {
  1876. this.cont = 3;
  1877. var flat = true;
  1878. var times = setInterval(() => {
  1879. this.cont--;
  1880. if (this.cont == '0') {
  1881. if (flat) {
  1882. loading1.clear();
  1883. clearInterval(times);
  1884. that.$dialog
  1885. .alert({
  1886. message: '定位失败,请开启企微定位权限',
  1887. })
  1888. .then(() => {
  1889. // this.$router.go(-1);
  1890. });
  1891. } else {
  1892. clearInterval(times);
  1893. }
  1894. }
  1895. }, 1000);
  1896. qiyeData = response.data.data;
  1897. wx.config({
  1898. beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
  1899. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1900. appId: qiyeData.appId, // 必填,企业微信的corpID
  1901. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  1902. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  1903. signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
  1904. jsApiList: ['ready', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
  1905. });
  1906. wx.ready(function () {
  1907. wx.getLocation({
  1908. type: 'gcj02',
  1909. success: function (res) {
  1910. flat = false;
  1911. loading1.clear();
  1912. var location = that.CJ02BD(res.latitude, res.longitude);
  1913. if (val.lat == '' || val.lat == null) {
  1914. that.lat = location.lat;
  1915. that.lon = location.lon;
  1916. }
  1917. let PointSum = that
  1918. .twoPointSum(that.lat, that.lon, location.lat, location.lon)
  1919. .toFixed(2);
  1920. if (PointSum > 500 && localStorage.getItem('postType') != 'GZ') {
  1921. that.$dialog
  1922. .confirm({
  1923. confirmButtonText: '确定',
  1924. cancelButtonText: '取消',
  1925. title: '系统提示',
  1926. message: '定位距离偏差大',
  1927. closeOnClickOverlay: true,
  1928. })
  1929. .then(() => {
  1930. that.$router.push({
  1931. path: '/outabnormalVisit',
  1932. query: {
  1933. storeId: val.storeId,
  1934. rdId: val.rdId,
  1935. lat: that.lat,
  1936. lon: that.lon,
  1937. visitId: val.visitId,
  1938. pageType: 'out',
  1939. visitModel: '5',
  1940. storeCode: val.storeCode,
  1941. tabVal: that.tabVal,
  1942. latNew: location.lat,
  1943. lonNew: location.lon,
  1944. PointSum: PointSum,
  1945. marklat: res.latitude,
  1946. marklon: res.longitude,
  1947. },
  1948. });
  1949. localStorage.setItem('startTime', new Date());
  1950. localStorage.setItem('ORGName', val.deptName);
  1951. localStorage.setItem('chainNameR', val.storeName);
  1952. })
  1953. .catch(() => {
  1954. // that.abnormalVisit(val)
  1955. });
  1956. } else {
  1957. that.$router.push({
  1958. path: '/outabnormalVisit',
  1959. query: {
  1960. storeId: val.storeId,
  1961. rdId: val.rdId,
  1962. lat: that.lat,
  1963. lon: that.lon,
  1964. visitId: val.visitId,
  1965. pageType: 'out',
  1966. visitModel: '3',
  1967. storeCode: val.storeCode,
  1968. tabVal: that.tabVal,
  1969. latNew: location.lat,
  1970. lonNew: location.lon,
  1971. PointSum: PointSum,
  1972. marklat: res.latitude,
  1973. marklon: res.longitude,
  1974. },
  1975. });
  1976. localStorage.setItem('startTime', new Date());
  1977. localStorage.setItem('ORGName', val.deptName);
  1978. localStorage.setItem('chainNameR', val.storeName);
  1979. }
  1980. addVisitsPosition({
  1981. storeId: val.storeId,
  1982. visitsId: '',
  1983. lon: res.longitude,
  1984. lat: res.latitude,
  1985. sourceLon: location.lon,
  1986. sourceLat: location.lat,
  1987. positionDesc: '',
  1988. accuracy: res.accuracy,
  1989. });
  1990. },
  1991. fail: function () {
  1992. loading1.clear();
  1993. that.$dialog
  1994. .alert({
  1995. message: 'GPS未开启',
  1996. })
  1997. .then(() => {
  1998. // that.abnormalVisit(val)
  1999. });
  2000. },
  2001. });
  2002. });
  2003. wx.error(function (res) {
  2004. loading1.clear();
  2005. that.$dialog
  2006. .alert({
  2007. message: '定位失败,请开启企微定位权限',
  2008. })
  2009. .then(() => {});
  2010. });
  2011. } else {
  2012. loading1.clear();
  2013. this.$toast.fail(dataList.msg);
  2014. }
  2015. });
  2016. localStorage.setItem('startTime', new Date());
  2017. localStorage.setItem('ORGName', val.deptName);
  2018. localStorage.setItem('chainNameR', val.storeName);
  2019. }
  2020. }
  2021. } else {
  2022. this.$dialog.alert({
  2023. title: '系统提示',
  2024. message: res.msg,
  2025. });
  2026. }
  2027. });
  2028. },
  2029. visitFn(val) {
  2030. this.buryingPoint({
  2031. systemModel: '计划外',
  2032. buryingPointType: 1,
  2033. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  2034. buryingPointName: '客户信息',
  2035. buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
  2036. });
  2037. this.$router.push({
  2038. path: '/storeDetail',
  2039. query: { id: val.storeId, detilId: 'a' },
  2040. });
  2041. },
  2042. // 大客户签约
  2043. signAdd(val) {
  2044. this.$router.push({
  2045. path: '/sign',
  2046. query: { id: val.storeId, detilId: 'a' },
  2047. });
  2048. },
  2049. Visit(val) {
  2050. this.$router.push({
  2051. path: '/historicalDetails',
  2052. query: {
  2053. visitId: val.visitId,
  2054. storeId: val.storeId,
  2055. storeCode: val.storeCode,
  2056. },
  2057. });
  2058. },
  2059. onClickLeft() {
  2060. this.$router.go(-1);
  2061. },
  2062. onSearch() {
  2063. window.scrollTo(0, 0);
  2064. this.pageNum = 1;
  2065. this.list = [];
  2066. this.finished = true;
  2067. var postType = localStorage.getItem('postType');
  2068. this.customerVisits = localStorage.getItem('customerVisits');
  2069. if (postType == 'GZ') {
  2070. this.typeShow = false;
  2071. } else {
  2072. this.typeShow = true;
  2073. }
  2074. this.onLoad();
  2075. },
  2076. onSearchm() {
  2077. var postType = localStorage.getItem('postType');
  2078. if (postType == 'GZ') {
  2079. this.typeShow = false;
  2080. } else {
  2081. this.typeShow = true;
  2082. }
  2083. var StoreLabelsArr = [];
  2084. for (var k = 0; k < this.storeLabelTypes.length; k++) {
  2085. for (var k1 = 0; k1 < this.StoreLabels.length; k1++) {
  2086. if (this.StoreLabels[k1].dictValue == this.storeLabelTypes[k]) {
  2087. StoreLabelsArr.push(this.StoreLabels[k1].dictLabel);
  2088. }
  2089. }
  2090. }
  2091. var storeCategoryList = [];
  2092. for (var q = 0; q < this.result.length; q++) {
  2093. for (var q1 = 0; q1 < this.storeTypeLists.length; q1++) {
  2094. if (this.storeTypeLists[q1].dictValue == this.result[q]) {
  2095. storeCategoryList.push(this.storeTypeLists[q1].dictLabel);
  2096. }
  2097. }
  2098. }
  2099. if (this.tabVal == 1) {
  2100. if (this.storeLabelTypes.length > 0) {
  2101. this.buryingPoint({
  2102. systemModel: '计划外',
  2103. buryingPointType: 1,
  2104. buryingPointValue: StoreLabelsArr.join(','),
  2105. buryingPointName: '标签',
  2106. buryingPointPosition: '我的筛选',
  2107. });
  2108. }
  2109. if (this.storeCategoryList.length > 0) {
  2110. this.buryingPoint({
  2111. systemModel: '计划外',
  2112. buryingPointType: 1,
  2113. buryingPointValue: storeCategoryList.join(','),
  2114. buryingPointName: '类型',
  2115. buryingPointPosition: '我的筛选',
  2116. });
  2117. }
  2118. if (this.chainName != '') {
  2119. this.buryingPoint({
  2120. systemModel: '计划外',
  2121. buryingPointType: 1,
  2122. buryingPointValue: this.chainName,
  2123. buryingPointName: '经销商筛选',
  2124. buryingPointPosition: '我的筛选',
  2125. });
  2126. }
  2127. if (this.storeName != '') {
  2128. this.buryingPoint({
  2129. systemModel: '计划外',
  2130. buryingPointType: 1,
  2131. buryingPointValue: this.storeName,
  2132. buryingPointName: '搜索名称/编号/地址',
  2133. buryingPointPosition: '我的筛选',
  2134. });
  2135. }
  2136. } else {
  2137. if (this.storeLabelTypes.length > 0) {
  2138. this.buryingPoint({
  2139. systemModel: '计划外',
  2140. buryingPointType: 1,
  2141. buryingPointValue: StoreLabelsArr.join(','),
  2142. buryingPointName: '标签',
  2143. buryingPointPosition: '销售部的门店筛选',
  2144. });
  2145. }
  2146. if (this.storeCategoryList != '') {
  2147. this.buryingPoint({
  2148. systemModel: '计划外',
  2149. buryingPointType: 1,
  2150. buryingPointValue: storeCategoryList.join(','),
  2151. buryingPointName: '类型',
  2152. buryingPointPosition: '销售部的门店筛选',
  2153. });
  2154. }
  2155. if (this.chainName != '') {
  2156. this.buryingPoint({
  2157. systemModel: '计划外',
  2158. buryingPointType: 1,
  2159. buryingPointValue: this.chainName,
  2160. buryingPointName: '经销商筛选',
  2161. buryingPointPosition: '销售部的门店筛选',
  2162. });
  2163. }
  2164. if (this.storeName != '') {
  2165. this.buryingPoint({
  2166. systemModel: '计划外',
  2167. buryingPointType: 1,
  2168. buryingPointValue: this.storeName,
  2169. buryingPointName: '搜索名称/编号/地址',
  2170. buryingPointPosition: '销售部的门店筛选',
  2171. });
  2172. }
  2173. }
  2174. localStorage.setItem('outvstoreName', this.storeName);
  2175. localStorage.setItem('outvchainName', this.chainName);
  2176. localStorage.setItem('outvstoreLabelTypes', this.storeLabelTypes);
  2177. localStorage.setItem('outvstoreCategoryList', this.result);
  2178. localStorage.setItem('outvchainCode', this.chainCode);
  2179. this.onSearch();
  2180. },
  2181. tabChange(name) {
  2182. window.scrollTo(0, 0);
  2183. this.finished = true;
  2184. this.pageNum = 1;
  2185. this.list = [];
  2186. this.tabVal = name;
  2187. localStorage.setItem('tabVal', name);
  2188. this.onLoad();
  2189. },
  2190. // 滚动条与底部距离小于 offset 时触发 初始化会触发
  2191. onLoad() {
  2192. // 授权
  2193. getTicketFun()
  2194. .then(() => {
  2195. var postType = localStorage.getItem('postType');
  2196. if (postType == 'GZ') {
  2197. this.typeShow = false;
  2198. } else {
  2199. this.typeShow = true;
  2200. }
  2201. if (this.lon == '' && this.tabVal != 1) {
  2202. this.positionFn(1);
  2203. } else {
  2204. if (this.tabVal == 1) {
  2205. this.positionFn();
  2206. // this.getUserOutPlaListFun();
  2207. } else {
  2208. this.getUserOrgStoreList();
  2209. }
  2210. }
  2211. })
  2212. .catch(() => {
  2213. this.finished = true;
  2214. });
  2215. },
  2216. // 跳转好帮手门店详情
  2217. goOtherSystem(item) {
  2218. // 家装或工装 approvalStatus:是否结案 0:未结案,1:已结案
  2219. if (
  2220. (item.sfaStoreType && (item.sfaStoreType.jz || item.sfaStoreType.gz)) ||
  2221. item.approvalStatus == null ||
  2222. item.approvalStatus == 0
  2223. ) {
  2224. return false;
  2225. }
  2226. if (item.storeCode) {
  2227. window.location.href =
  2228. process.env.VUE_APP_SSB_LINK + '/order/storeDetail/index?shopCode=' + item.storeCode;
  2229. } else {
  2230. this.$dialog.alert({
  2231. message: '缺少门店code',
  2232. });
  2233. }
  2234. },
  2235. },
  2236. };
  2237. </script>
  2238. <style lang="scss">
  2239. .van-dialog__confirm,
  2240. .van-dialog__confirm:active {
  2241. color: #0057ba;
  2242. }
  2243. .searchDiv {
  2244. .van-search {
  2245. background: #fff;
  2246. }
  2247. .van-search__action {
  2248. font-size: 14px;
  2249. color: #0057ba;
  2250. font-weight: bold;
  2251. background: #f1f1f1;
  2252. border-bottom-right-radius: 60px;
  2253. border-top-right-radius: 60px;
  2254. border: 1px solid #ccc;
  2255. padding: 0 20px;
  2256. }
  2257. .van-search--show-action {
  2258. padding-right: 12px;
  2259. }
  2260. .van-search__content {
  2261. border: 1px solid #ccc;
  2262. border-bottom-left-radius: 60px;
  2263. border-top-left-radius: 60px;
  2264. background: #f1f1f1;
  2265. border-right: 0;
  2266. }
  2267. }
  2268. .myTab {
  2269. .van-tabs__nav--card {
  2270. margin: 0 !important;
  2271. border-left: 0;
  2272. border-right: 0;
  2273. }
  2274. .van-tabs__wrap,
  2275. .van-tabs__nav--card {
  2276. height: 39px;
  2277. }
  2278. .van-tab {
  2279. line-height: 40px;
  2280. }
  2281. }
  2282. .myList {
  2283. .van-cell {
  2284. padding: 0;
  2285. &:after {
  2286. border-bottom: none;
  2287. }
  2288. }
  2289. }
  2290. </style>
  2291. <style lang="scss" scoped>
  2292. .bgcolor {
  2293. background-color: #f5f5f5;
  2294. }
  2295. .container {
  2296. padding-bottom: 50px;
  2297. }
  2298. .card {
  2299. padding: 10px 16px;
  2300. box-sizing: border-box;
  2301. }
  2302. .card .title {
  2303. font-size: 15px;
  2304. font-weight: bold;
  2305. color: #333;
  2306. line-height: 22px;
  2307. padding-right: 52px;
  2308. .JPABC {
  2309. width: 20px;
  2310. position: relative;
  2311. top: 4px;
  2312. margin-right: 3px;
  2313. }
  2314. .statusIcon {
  2315. padding: 3px;
  2316. font-size: 12px;
  2317. margin: 0 3px;
  2318. color: #fff;
  2319. display: inline-block;
  2320. height: 20px;
  2321. line-height: 16px;
  2322. vertical-align: -1px;
  2323. }
  2324. .submit {
  2325. background: #ffba13;
  2326. }
  2327. .noSubmit {
  2328. background: #f11818;
  2329. }
  2330. }
  2331. .card .info {
  2332. font-size: 14px;
  2333. color: #909090;
  2334. line-height: 26px;
  2335. }
  2336. .btnbox {
  2337. padding-top: 14px;
  2338. border-top: 1px solid #eee;
  2339. margin: 0 10px;
  2340. }
  2341. .navBarTOP {
  2342. position: fixed;
  2343. width: 100%;
  2344. z-index: 2;
  2345. top: 0;
  2346. }
  2347. .cellcontent .centerBtn {
  2348. margin: 0 auto 10px;
  2349. display: block;
  2350. width: 92%;
  2351. color: #0057ba;
  2352. border-radius: 5px;
  2353. padding: 0 2px;
  2354. }
  2355. .cellcontent .centerBtn1 {
  2356. background-color: #0057ba;
  2357. color: #fff;
  2358. border-color: #0057ba;
  2359. }
  2360. .cellcontent .centerBtn2 {
  2361. margin: 0 auto 10px;
  2362. display: block;
  2363. width: 92%;
  2364. color: #0057ba;
  2365. border-radius: 5px;
  2366. padding: 0;
  2367. }
  2368. .statstext {
  2369. background-color: #0057ba;
  2370. position: absolute;
  2371. right: 0;
  2372. top: 6px;
  2373. padding: 2px 6px 2px 12px;
  2374. border-bottom-left-radius: 60px;
  2375. border-top-left-radius: 60px;
  2376. color: #fff;
  2377. }
  2378. .cellcontent .van-cell {
  2379. padding: 10px 0;
  2380. }
  2381. .statstext .van-icon__image {
  2382. height: 0.7em;
  2383. }
  2384. .tipsTitle {
  2385. padding: 5px 0;
  2386. text-align: center;
  2387. font-size: 16px;
  2388. font-weight: 600;
  2389. }
  2390. .deviceOutside {
  2391. height: 100%;
  2392. width: 100%;
  2393. display: flex;
  2394. flex-direction: column;
  2395. overflow: hidden;
  2396. .content {
  2397. flex: 1;
  2398. overflow-y: auto;
  2399. }
  2400. .tabBar {
  2401. height: 50px;
  2402. }
  2403. .JPVisitNum {
  2404. position: relative;
  2405. top: -26px;
  2406. font-size: 10px;
  2407. }
  2408. }
  2409. </style>
  2410. <style lang="scss">
  2411. .van-tabs__nav--card .van-tab.van-tab--active {
  2412. background-color: #0057ba !important;
  2413. }
  2414. .visitSearch {
  2415. width: 68px;
  2416. color: #0057ba;
  2417. font-size: 14px;
  2418. }
  2419. .visitSearch .van-dropdown-menu__bar {
  2420. box-shadow: 0 0 0 #fff;
  2421. height: 52px;
  2422. }
  2423. .visitSearch .van-dropdown-menu__item {
  2424. justify-content: normal;
  2425. }
  2426. .visitSearch .van-dropdown-menu__title {
  2427. border-left: 1px solid #ccc;
  2428. }
  2429. .visitSearch .van-cell {
  2430. border: 1px solid #ccc;
  2431. border-radius: 5px;
  2432. padding: 6px;
  2433. }
  2434. .positionContent {
  2435. position: fixed;
  2436. color: #666;
  2437. display: inline-block;
  2438. box-shadow: 0px 2px 7px -5px #000;
  2439. border-radius: 100px;
  2440. overflow: hidden;
  2441. right: 14px;
  2442. cursor: pointer;
  2443. bottom: 96px;
  2444. background-color: white;
  2445. }
  2446. .positionContent .img {
  2447. border-radius: 100px;
  2448. float: left;
  2449. }
  2450. .positionContent .img .van-icon__image {
  2451. border-radius: 100px;
  2452. }
  2453. .zDialog .van-dialog__header {
  2454. padding: 10px;
  2455. border-bottom: 1px solid #f5f5f5;
  2456. }
  2457. .zDialog .infoText {
  2458. margin: 10px;
  2459. font-size: 14px;
  2460. color: #909090;
  2461. width: 98%;
  2462. }
  2463. .visitStoreIco {
  2464. float: left;
  2465. float: left;
  2466. width: 26px;
  2467. text-align: center;
  2468. background-color: #ffba13;
  2469. color: #fff;
  2470. border-radius: 100%;
  2471. margin-left: 14px;
  2472. line-height: 26px;
  2473. height: 26px;
  2474. }
  2475. .searchcheck {
  2476. padding: 0 10px 10px;
  2477. }
  2478. .searchcheck .van-checkbox {
  2479. /*width: 44%;*/
  2480. padding-bottom: 10px;
  2481. }
  2482. .searchcheck .checkbox {
  2483. font-size: 14px;
  2484. display: inline-block;
  2485. width: 50%;
  2486. line-height: 28px;
  2487. }
  2488. .searchcheck .checkbox .van-checkbox {
  2489. margin-bottom: 2px;
  2490. }
  2491. .searchcheck .checkbox1 {
  2492. font-size: 14px;
  2493. float: left;
  2494. line-height: 28px;
  2495. width: 50%;
  2496. }
  2497. .searchcheck .checkbox1 .child {
  2498. width: 100%;
  2499. }
  2500. .searchcheck {
  2501. /* height: 93vh;
  2502. overflow-y: auto; */
  2503. }
  2504. .searchchecktitle {
  2505. width: 100%;
  2506. margin: 20px 0;
  2507. font-size: 16px;
  2508. border-left: 3px solid #0057ba;
  2509. line-height: 18px;
  2510. }
  2511. .searchchecktitle1 {
  2512. width: 100%;
  2513. margin: 20px 0;
  2514. font-size: 16px;
  2515. line-height: 18px;
  2516. }
  2517. .textsize {
  2518. font-size: 14px;
  2519. /* overflow: hidden; */
  2520. display: flex;
  2521. flex-direction: column;
  2522. .searchcheck {
  2523. flex: 1;
  2524. overflow-y: auto;
  2525. margin-bottom: 50px;
  2526. }
  2527. }
  2528. .deviceOutside {
  2529. .TCFXListItem {
  2530. display: inline-block;
  2531. border: 1px solid #ccc;
  2532. padding: 3px 5px;
  2533. margin: 0 5px;
  2534. border-radius: 6px;
  2535. }
  2536. }
  2537. </style>