storeGroup.vue 17 KB

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