storeGroup.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <div>
  3. <!-- 顶部条-->
  4. <van-nav-bar
  5. class="navBar"
  6. title="拜访"
  7. left-arrow
  8. @click-left="onClickLeft"
  9. >
  10. <!--@click-right="uploadImgShowFn"-->
  11. <!--<template slot="right">-->
  12. <!--<van-icon name="photo-o" size="22px" color="#ccc" style="margin-right: 10px;" />-->
  13. <!--</template>-->
  14. </van-nav-bar>
  15. <!-- 主体内容-->
  16. <div class="container">
  17. <div class="lineGrey"></div>
  18. <div class="card mt10">
  19. <div class="title f-blue">{{storeName}}(<span style="color:#0057ba">{{urlParameter.storeCode}}</span>)</div>
  20. <!--<div class="title">恒泰化工</div>-->
  21. <div class="info1" v-if="storeCategory!=null">类型:{{storeCategory}}</div>
  22. <div class="info1" v-if="addressLine!=null">地址:{{addressLine}}</div>
  23. <van-button type="info" style="background: rgb(0, 87, 186);color:#fff; margin: 10px 0; border-radius: 5px;" size="small" plain
  24. class="centerBtn"
  25. @click="visitFn(urlParameter.storeCode)">经营情况</van-button>
  26. <van-button type="info" style="background: rgb(0, 87, 186);color:#fff; margin: 10px; border-radius: 5px;float: right" size="small" plain class="centerBtn"
  27. @click="onstopVisit">
  28. 增加项目</van-button>
  29. </div>
  30. <div class="card">
  31. <div class="info" v-for="(item,index) in list" :key="index" @click="addStoreVisit(item,index)">
  32. <!-- <span class="must" v-show="item.isMust=='0'||item.isMust=='2'">*</span>-->
  33. <!-- <span class="must" v-show="item.isMust!='0'&&item.isMust!='2'">&nbsp;</span>-->
  34. <p style=" width: 90%; margin: 0; line-height: 24px;display: inline-block;"
  35. >{{item.answerValue}}</p>
  36. <p style=" width: 90%; margin: 0; line-height: 14px;display: inline-block;color:#666;">{{item.startTime}}</p>
  37. <!-- -->
  38. <!-- <span v-show="item.processKey!=null"><van-icon :name="sp" size="16"/></span>-->
  39. <span v-show="item.closeProject!=1" class="arrow"
  40. style="background-color: #fff;color:#444;"><van-icon name="arrow" /></span>
  41. <span v-show="item.closeProject==1" class="arrow"
  42. style="background-color: #0057ba"><van-icon name="success"/></span>
  43. </div>
  44. </div>
  45. </div>
  46. <div id="allmap"></div>
  47. </div>
  48. </template>
  49. <script>
  50. import sp from './../../assets/sp.png'
  51. import {
  52. endVisits,
  53. editDwellTime,
  54. suishenbangStoreSale,
  55. stopVisit,
  56. getProjectList
  57. } from "@/api/index";
  58. import axios from 'axios';
  59. export default {
  60. name: "outstoreVisit",
  61. data() {
  62. return {
  63. notes:"",
  64. visitModel:"1",
  65. sp:sp,
  66. uploadshow: false,
  67. flag:true,
  68. questionsshow: false,
  69. uploadImgshow:false,
  70. imgs:[],
  71. uploadImages:[],
  72. uploadid1:'uploadid1',
  73. uploadid2:'uploadid2',
  74. iscuxiao:false,
  75. text:'',
  76. radio:'',
  77. uploadImgEditText:'编辑',
  78. isEdit:false,
  79. storeId:"",
  80. rdId:"",
  81. lat:"",
  82. lon:"",
  83. list:[],
  84. storeGroupId:"",
  85. addressLine:"",
  86. storeCategory:"",
  87. storeName:"",
  88. contactName:"",
  89. urlParameter:"",
  90. uType:"-1",
  91. orderUrl:null,
  92. location:{
  93. lat:"34.6174",
  94. lon:"112.44039"
  95. },
  96. address:"",
  97. showTime:"00:00:00:00",
  98. city:"",
  99. locationAccuracy:"",
  100. id:"89",
  101. startTime:null,
  102. timeN:null
  103. }
  104. },
  105. created() {
  106. this.urlParameter=this.$route.query;
  107. this.storeId = this.$route.query.storeId + "";
  108. this.storeCode = this.$route.query.storeCode;
  109. this.rdId = this.$route.query.rdId + "";
  110. this.addressLine = this.$route.query.addressLine;
  111. this.storeCategory = this.$route.query.storeCategory;
  112. this.storeName = this.$route.query.storeName;
  113. this.contactName = this.$route.query.contactName;
  114. this.lat = this.$route.query.lat + "";
  115. this.lon = this.$route.query.lon + "";
  116. this.visitModel = this.$route.query.visitModel + "";
  117. this.uType=localStorage.getItem("uType")
  118. },
  119. activated() {
  120. this.urlParameter=this.$route.query;
  121. this.storeId = this.$route.query.storeId + "";
  122. this.storeCode = this.$route.query.storeCode;
  123. this.rdId = this.$route.query.rdId + "";
  124. this.addressLine = this.$route.query.addressLine
  125. this.storeCategory = this.$route.query.storeCategory
  126. this.storeName = this.$route.query.storeName + "";
  127. this.contactName = this.$route.query.contactName + "";
  128. this.lat = this.$route.query.lat + "";
  129. this.lon = this.$route.query.lon + "";
  130. this.list=[]
  131. this.visitModel = this.$route.query.visitModel + "";
  132. this.uType=localStorage.getItem("uType")
  133. if(localStorage.getItem('PGID')!=null){
  134. setTimeout(() => {
  135. this.addVisits()
  136. this.timeN=setInterval(this.animation,16);
  137. })
  138. }else{
  139. setTimeout(() => {
  140. this.addVisits()
  141. this.timeN=setInterval(this.animation,16);
  142. })
  143. }
  144. },
  145. methods: {
  146. animation() {
  147. //前时间减去上次开启时间减去暂停累计时间
  148. var times=new Date().getTime()-new Date(this.startTime).getTime();
  149. var house=Math.floor(times/3600000);//毫秒转化为分钟
  150. var minutes=Math.floor(times/60000-house*60);//毫秒转化为分钟
  151. var minutes1=Math.floor(times/60000);//毫秒转化为分钟
  152. var seconds=Math.floor((times-minutes1*60000)/1000);//已知分钟将time减去分钟 除去1000得出 秒
  153. var ms=Math.floor((times-minutes1*60000-seconds*1000)/10);//
  154. this.showTime=
  155. (house<10 ? "0" +house : house)+":"+
  156. (minutes<10 ? "0" +minutes : minutes)+":"
  157. +(seconds<10 ? "0"+seconds :seconds)+":"
  158. +(ms<10 ? "0"+ms : ms);
  159. },
  160. // 结束拜访
  161. onstopVisit(){
  162. localStorage.removeItem("PGID")
  163. this.$router.push({
  164. path: "/projectOut", query: {
  165. storeId: this.$route.query.storeId,
  166. rdId: this.$route.query.rdId,
  167. lat: this.$route.query.lat,
  168. lon: this.$route.query.lon,
  169. visitId:null,
  170. pageType: "out",
  171. addressLine: this.$route.query.addressLine,
  172. storeCategory: this.$route.query.storeCategory,
  173. storeName: this.$route.query.storeName,
  174. hisTime: this.$route.query.hisTime,
  175. contactName: this.$route.query.contactName,
  176. storeCode: this.$route.query.storeCode,
  177. tabVal: this.$route.query.tabVal,
  178. visitModel: "1",
  179. latNew: this.$route.query.lat,
  180. lonNew: this.$route.query.lon,
  181. PointSum: "0",
  182. closeProject:"0",
  183. marklat:this.$route.query.marklat,
  184. marklon:this.$route.query.marklon
  185. }
  186. })
  187. },
  188. overbookingFn(val){
  189. window.location.href =val
  190. // window.location.href =process.env.VUE_APP_XD_LINK+"/home/SimulateLogin?username="+val+"&operator="+localStorage.getItem("loginName")+"&system=visit"
  191. },
  192. visitFn(val) {
  193. var that=this;
  194. suishenbangStoreSale({storeCode:val}).then(res=>{
  195. if(res.code==200){
  196. if(res.data.num!='0'){
  197. window.location.href =process.env.VUE_APP_SSB_LINK+"/order/storeVisit/distributionShopDetail?shopCode=" + val +
  198. "&indexTab=2&visitId="+that.visitId+"&lon="+that.lon+"&lat="+that.lat+"&rdId="+that.rdId+"&storeCategory="+that.storeCategory+"&storeId="+that.storeId+"&storeName="+that.storeName+"&addressLine="+that.addressLine
  199. }else{
  200. that.$toast(res.data.msg);
  201. }
  202. }else{
  203. that.$toast(res.msg);
  204. }
  205. })
  206. },
  207. getLocation() {
  208. let loading1=this.$toast.loading({
  209. duration: 0,
  210. message: '加载中...',
  211. forbidClick: true,
  212. });
  213. this.list=[]
  214. let url = window.location.href;
  215. let that=this;
  216. let wx=this.wx
  217. let qiyeData
  218. const instance = axios.create();
  219. instance.defaults.headers.common['userId'] = localStorage.getItem("loginName");
  220. instance.get(process.env.VUE_APP_BASE_API+'mobile/wx/ticket',
  221. {params: {
  222. url: url
  223. }}).then(response => {
  224. if (response.status == 200) {
  225. loading1.clear()
  226. qiyeData = response.data.data;
  227. wx.config({
  228. beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
  229. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  230. appId: qiyeData.appId, // 必填,企业微信的corpID
  231. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  232. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  233. signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
  234. jsApiList: ["ready", "getLocation"] // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
  235. });
  236. wx.ready(function() {
  237. wx.getLocation({
  238. type: 'gcj02',
  239. success: function (res) {
  240. var location=that.CJ02BD(res.latitude,res.longitude)
  241. that.location = location;
  242. if(that.urlParameter.lat==""||that.urlParameter.lat==null){
  243. that.lat=that.location.lat
  244. that.lon=that.location.lon
  245. }
  246. let PointSum=that.twoPointSum(that.lat,that.lon,location.lat,location.lon).toFixed(2)
  247. if(PointSum>500){
  248. that.visitModel="5"
  249. localStorage.setItem("visitModel","5")
  250. that.$dialog.confirm({
  251. confirmButtonText:"确定",
  252. cancelButtonText:"重新定位",
  253. title: '系统提示',
  254. message: '距离本店距离差距太大',
  255. })
  256. .then(() => {
  257. that.addVisits()
  258. })
  259. .catch(() => {
  260. that.getLocation()
  261. });
  262. }else{
  263. that.addVisits()
  264. }
  265. },
  266. fail:function () {
  267. that.$dialog.alert({
  268. message: 'GPS未开启',
  269. }).then(() => {
  270. that.getLocation()
  271. });
  272. }
  273. });
  274. })
  275. }
  276. });
  277. },
  278. addVisits (){
  279. this.startTime=new Date()
  280. var visitEntry="";
  281. if(this.urlParameter.tabVal=="0"){
  282. visitEntry="2";
  283. }else{
  284. visitEntry="1";
  285. }
  286. if(this.$route.query.shopCode!=undefined){
  287. this.storeCode=this.$route.query.shopCode
  288. }
  289. var that=this;
  290. var params={
  291. storeId: that.storeId,
  292. storeCode:that.storeCode,
  293. visitEntry:visitEntry,
  294. }
  295. let loading2=that.$toast.loading({
  296. duration: 0,
  297. message: '加载中...',
  298. forbidClick: true,
  299. });
  300. getProjectList(params).then(res=>{
  301. loading2.clear()
  302. if(res.code==200){
  303. that.notes=res.data.notes
  304. that.list=res.data
  305. }else{
  306. this.$toast(res.msg);
  307. }
  308. })
  309. },
  310. addStoreVisit(val,index){
  311. localStorage.setItem('PGID', val.id);
  312. this.$router.push({path: "/projectOut", query:
  313. {
  314. storeId:this.storeId,
  315. storeCode:this.urlParameter.storeCode,
  316. visitId:val.id,
  317. addressLine: this.$route.query.addressLine,
  318. storeCategory: this.$route.query.storeCategory,
  319. storeName: this.$route.query.storeName,
  320. hisTime: this.$route.query.hisTime,
  321. contactName: this.$route.query.contactName,
  322. tabVal: this.$route.query.tabVal,
  323. stopTime:val.stopTime,
  324. ids:index,
  325. taskId:val.taskId,
  326. storeGroupId:this.storeGroupId,
  327. taskType:val.taskType,
  328. rdId: this.$route.query.rdId,
  329. photoType:
  330. val.photoType,
  331. lat: this.$route.query.lat,
  332. lon: this.$route.query.lon,
  333. visitSource:"1",
  334. visitModel: this.visitModel,
  335. locationCity:this.city,
  336. locationRemark: this.address,
  337. locationAccuracy: this.locationAccuracy,
  338. closeProject:val.closeProject,
  339. marklat:this.$route.query.marklat,
  340. marklon:this.$route.query.marklon
  341. }})
  342. },
  343. onClickLeft(){
  344. this.$router.go(-1);
  345. },
  346. onshouow(){
  347. this.uploadshow=false;
  348. this.questionsshow=false;
  349. },
  350. uploadImgEdit(){
  351. if(this.uploadImgEditText == '编辑'){
  352. this.uploadImgEditText = '完成';
  353. }else{
  354. this.uploadImgEditText = '编辑';
  355. this.uploadImgshow = false;
  356. }
  357. },
  358. deleteImg(index){
  359. this.imgs.splice(index,1);
  360. },
  361. questionClick(item){
  362. console.log(item)
  363. if(item.isUpload){
  364. this.uploadshow = true;
  365. }else if(item.isQuestion){
  366. this.questionsshow = true;
  367. }
  368. },
  369. newimgarr1(val){
  370. this.imgs = val;
  371. },
  372. uploadImgShowFn(){
  373. this.uploadImgshow = true;
  374. if(this.uploadImages.length<=0){
  375. this.uploadImgEditText = '';
  376. }
  377. },
  378. previewsImg(index){
  379. ImagePreview({
  380. images: this.uploadImages,
  381. startPosition: index,
  382. onClose() {
  383. // do something
  384. }
  385. });
  386. },
  387. },
  388. destroyed() {
  389. this.timeN=null
  390. clearInterval(this.timeN)
  391. }
  392. }
  393. </script>
  394. <style lang="scss" scoped>
  395. .container{
  396. margin-bottom: 10px;
  397. background-color: white;
  398. /*padding:0 16px;*/
  399. }
  400. .navBarOverlay{
  401. background: #FFF;
  402. }
  403. .card{
  404. background: #FFF;
  405. box-sizing: border-box;
  406. padding:10px 16px;
  407. .title{
  408. line-height: 32px;
  409. font-size: 16px;
  410. font-weight: bold;
  411. color: #333;
  412. }
  413. .subtitle{
  414. line-height: 24px;
  415. font-size: 14px;
  416. color: #7B7B7B;
  417. .status{
  418. float: right;
  419. }
  420. }
  421. .info{
  422. font-size: 14px;
  423. color: #484848;
  424. padding: 14px;
  425. border-bottom: 1px solid #f1f1f1;
  426. position: relative;
  427. .arrow{
  428. float: right;
  429. display: inline-block;
  430. height: 20px;
  431. width: 20px;
  432. line-height: 20px;
  433. text-align: center;
  434. border-radius: 50%;
  435. background: #0057ba;
  436. color: #FFF;
  437. font-weight: bold;
  438. font-size: 14px;
  439. position: absolute;
  440. margin-top: -10px;
  441. right: 0;
  442. top:50%;
  443. }
  444. }
  445. .info1{
  446. font-size: 14px;
  447. color: #666;
  448. line-height: 18px;
  449. padding: 4px 0;
  450. position: relative;
  451. .arrow{
  452. float: right;
  453. display: inline-block;
  454. height: 20px;
  455. width: 20px;
  456. line-height: 20px;
  457. text-align: center;
  458. border-radius: 50%;
  459. background: #0057ba;
  460. color: #FFF;
  461. font-weight: bold;
  462. font-size: 14px;
  463. margin-top: 9px;
  464. position: absolute;
  465. right: 0;
  466. top:50%;
  467. margin-top: -10px;
  468. }
  469. }
  470. }
  471. .must{
  472. font-size: 18px;
  473. color: #f56c6c;
  474. margin-right: 2px;
  475. }
  476. .zw{
  477. display: inline-block;
  478. width: 7px;
  479. height: 100%;
  480. }
  481. .lineGrey{
  482. height: 10px;
  483. width: 100%;
  484. background: #f1f1f1;
  485. }
  486. .submitBtn{
  487. margin: 16px 0;
  488. font-size: 18px;
  489. }
  490. .wrapper {
  491. display: flex;
  492. align-items: center;
  493. justify-content: center;
  494. height: 100%;
  495. .block {
  496. width: 100%;
  497. height: 100%;
  498. background-color: #fff;
  499. overflow: auto;
  500. }
  501. }
  502. .questionName{
  503. font-size: 16px;
  504. color: #484848;
  505. /*line-height: 40px;*/
  506. background: #F4F4F4;
  507. padding: 10px 15px;
  508. box-sizing: border-box;
  509. position: relative;
  510. display: flex;
  511. justify-content: center;
  512. .text{
  513. flex: 9;
  514. }
  515. }
  516. .answerDiv{
  517. background: #FFF;
  518. padding: 0 15px 10px;
  519. .answerItem{
  520. padding: 10px 0;
  521. border-bottom: 1px solid #dedede;
  522. .name{
  523. line-height: 36px;
  524. font-size: 14px;
  525. color: #8B8B8B;
  526. }
  527. }
  528. }
  529. .border{
  530. border: 1px solid #dedede;
  531. }
  532. .ht30{
  533. height: 30px;
  534. }
  535. .bodrder-b{
  536. border-bottom: 1px solid #dedede;
  537. }
  538. .img-box {
  539. width: 50%;
  540. /*height: 100%;*/
  541. position: relative;
  542. padding: 10px;
  543. display: inline-block;
  544. i{
  545. position: absolute;
  546. right: 2px;
  547. top: 2px;
  548. }
  549. img{
  550. width: 100%;
  551. height: 100%;
  552. }
  553. }
  554. .imgNull{
  555. text-align: center;
  556. padding-top: 100px;
  557. i{
  558. color: #dedede;
  559. }
  560. div{
  561. padding-top: 30px;
  562. font-size: 18px;
  563. font-weight: bold;
  564. }
  565. }
  566. .card .f-blue{
  567. color:#0057ba;
  568. }
  569. </style>
  570. <style>
  571. .navBarOverlay .van-nav-bar__left .van-icon{color: #8B8B8B;}
  572. .navBarOverlay .van-nav-bar__right .van-nav-bar__text{color: #333;}
  573. .ht30 .van-radio__label{color: #8B8B8B;}
  574. .van-dialog__confirm, .van-dialog__confirm:active{color:#0057ba;}
  575. #allmap{
  576. width: 20px;
  577. height: 20px;
  578. left: -1000px;
  579. position: relative;
  580. }
  581. </style>