suishenbangOutstoreVisit.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. <template>
  2. <div class="suishenbangOutstoreVisit">
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar class="navBar" title="拜访" left-arrow @click-left="onClickLeft" />
  6. </div>
  7. <!-- 主体内容-->
  8. <div class="container">
  9. <div class="lineGrey"></div>
  10. <div class="lineGrey"></div>
  11. <div class="lineGrey"></div>
  12. <div class="lineGrey"></div>
  13. <div class="lineGrey"></div>
  14. <div class="card mt10">
  15. <div class="title f-blue">
  16. <span
  17. @click="goOtherSystem"
  18. :class="{
  19. 'to-other-system': isToOtherSystem,
  20. }">
  21. {{ storeName }}
  22. (
  23. <span style="color: #0057ba">
  24. {{ urlParameter.storeCode }}
  25. </span>
  26. )
  27. </span>
  28. </div>
  29. <div class="info1 storeCategory" v-if="addressLine != null">
  30. <div class="storeType">类型:{{ storeCategory }}</div>
  31. <van-button
  32. type="info"
  33. style="background: #ed5565; border-color: #ed5565; color: #fff; border-radius: 5px"
  34. size="small"
  35. plain
  36. class="centerBtn"
  37. @click="onstopVisit">
  38. 取消拜访
  39. </van-button>
  40. </div>
  41. <div class="info1" v-if="addressLine != 'null'">地址:{{ addressLine }}</div>
  42. <div class="info1" v-if="notes != null">上次拜访备注:{{ notes }}</div>
  43. <div class="info1">拜访时长:{{ showTime }}</div>
  44. <div class="info1" v-if="urlParameter.hisTime">
  45. 上次拜访时间:{{ parseTime(urlParameter.hisTime) }}
  46. </div>
  47. <div class="info1 visitsRemarks" v-if="visitsRemarks">
  48. <span @click="shows = true" class="f-blue" style="font-weight: bold">
  49. <van-icon name="browsing-history-o" />查看最近三次
  50. </span>
  51. <van-button
  52. type="info"
  53. style="background: rgb(0, 87, 186); color: #fff; border-radius: 5px; width: 55px"
  54. size="small"
  55. plain
  56. v-if="showOrderButton"
  57. class="centerBtn"
  58. @click="overbookingFn(urlParameter)">
  59. 去下单
  60. </van-button>
  61. </div>
  62. <!-- <van-button
  63. type="info"
  64. style="background: rgb(0, 87, 186); color: #fff; margin: 10px 0; border-radius: 5px"
  65. size="small"
  66. plain
  67. class="centerBtn"
  68. @click="visitFn(urlParameter.storeCode)">
  69. 经营情况
  70. </van-button> -->
  71. <!-- <van-button
  72. type="info"
  73. style="background: rgb(0, 87, 186); color: #fff; margin: 10px; border-radius: 5px"
  74. size="small"
  75. plain
  76. class="centerBtn"
  77. @click="wuliaoLog(urlParameter)">
  78. 物料历史
  79. </van-button> -->
  80. </div>
  81. <div v-if="addShow1" style="padding: 10px; background-color: #f5f5f5">
  82. <!-- <van-icon name="info-o" /> -->
  83. <p style="margin: 5px 0; color: red; font-size: 12px">
  84. 1、已启动SKU图像识别,目前覆盖桶装和战略产品106个
  85. </p>
  86. <p style="margin: 5px 0; color: red; font-size: 12px">
  87. 2、请在“奖励案”和“生动化陈列”中拍全本店陈列的所有立邦产品,以便准确识别SKU数量
  88. </p>
  89. <p style="margin: 5px 0; color: red; font-size: 12px">
  90. 3、提交拜访后约30秒,可去历史拜访中查看SKU图像识别结果
  91. </p>
  92. </div>
  93. <div class="card">
  94. <div
  95. class="info"
  96. v-for="(item, index) in list"
  97. :key="index"
  98. @click="addStoreVisit(item, index)">
  99. <span class="must" v-show="item.isMust == '0' || item.isMust == '2'">*</span>
  100. <span class="must" v-show="item.isMust != '0' && item.isMust != '2'">&nbsp;</span>
  101. <p style="width: 74%; margin: 0; line-height: 24px; display: inline-block">
  102. {{ item.taskName }}
  103. </p>
  104. <span v-show="item.processKey != null" class="processIco">
  105. <van-icon :name="sp" size="16" />
  106. </span>
  107. <span v-show="!item.success" class="arrow" style="background-color: #fff; color: #444"
  108. ><van-icon name="arrow"
  109. /></span>
  110. <span v-show="item.success" class="arrow" tyle="background-color: #0057ba"
  111. ><van-icon name="success"
  112. /></span>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="tc" style="padding: 0 16px">
  117. <van-button class="submitBtn" block type="info" color="#0057ba" @click="endVisitsFn"
  118. >提交拜访</van-button
  119. >
  120. </div>
  121. <br />
  122. <van-dialog v-model="shows">
  123. <div class="tipTitleBox" style="padding: 10px">
  124. <p class="p">近三次拜访备注</p>
  125. <div
  126. v-for="item in visitsRemarks"
  127. style="border-bottom: 1px solid #e8e8e8; font-size: 14px; padding: 10px 0">
  128. <p>拜访时间:{{ item.stopTime }}</p>
  129. <p>备注:{{ item.visitRemark }}</p>
  130. </div>
  131. </div>
  132. </van-dialog>
  133. <div id="allmap"></div>
  134. <!-- 物料历史列表 -->
  135. <el-dialog
  136. :visible.sync="wuliaoTable"
  137. width="90%"
  138. :append-to-body="true"
  139. :close-on-click-modal="false"
  140. @close="wuliaoTableClose"
  141. custom-class="wuliaoTable">
  142. <el-table :data="wuliaoList" border style="width: 100%">
  143. <el-table-column label="物料名称" prop="materialDataName" align="center" />
  144. <el-table-column label="发放时间" prop="issuerTime" align="center" />
  145. <el-table-column label="数量" prop="inventoryNum" width="60" align="center" />
  146. <el-table-column label="签收状态" prop="receiptState" width="60" align="center" />
  147. </el-table>
  148. </el-dialog>
  149. </div>
  150. </template>
  151. <script>
  152. import sp from './../../assets/sp.png';
  153. import {
  154. getStoreGroupTask,
  155. endVisits,
  156. editDwellTime,
  157. suishenbangStoreSale,
  158. stopVisit,
  159. buryingPoint,
  160. getMaterialHistory,
  161. getVisitTasks,
  162. } from '@/api/index';
  163. import axios from 'axios';
  164. import { saveVisitsParams, getOrderUrlByStoreId } from '@/api/inventory';
  165. export default {
  166. name: 'suishenbangOutstoreVisit',
  167. data() {
  168. return {
  169. notes: '',
  170. visitModel: '1',
  171. sp: sp,
  172. shows: false,
  173. flag: true,
  174. questionsshow: false,
  175. uploadImgshow: false,
  176. imgs: [],
  177. uploadImages: [],
  178. uploadid1: 'uploadid1',
  179. uploadid2: 'uploadid2',
  180. iscuxiao: false,
  181. text: '',
  182. radio: '',
  183. uploadImgEditText: '编辑',
  184. isEdit: false,
  185. storeId: '',
  186. rdId: '',
  187. lat: '',
  188. lon: '',
  189. list: [],
  190. storeGroupId: '',
  191. addShow1: false,
  192. visitId: '',
  193. addressLine: '',
  194. storeCategory: '',
  195. storeName: '',
  196. contactName: '',
  197. urlParameter: '',
  198. uType: '-1',
  199. showOrderButton: null,
  200. visitsRemarks: [],
  201. location: {
  202. lat: '34.6174',
  203. lon: '112.44039',
  204. },
  205. address: '',
  206. showTime: '00:00:00',
  207. city: '',
  208. locationAccuracy: '',
  209. id: '89',
  210. startTime: null,
  211. timeN: null,
  212. wuliaoTable: false,
  213. wuliaoList: [],
  214. isToOtherSystem: false,
  215. };
  216. },
  217. created() {},
  218. beforeRouteLeave(to, from, next) {
  219. if (
  220. (to.path == '/outsidelist/index' && from.path == '/suishenbangOutstoreVisit') ||
  221. (to.path == '/storeAdd' && from.path == '/suishenbangOutstoreVisit')
  222. ) {
  223. if (this.visitId != null && this.visitId != '') {
  224. this.editDwellTimes();
  225. }
  226. }
  227. next();
  228. },
  229. activated() {
  230. // 是否请求任务列表接口
  231. let getRequestFlage = localStorage.getItem('getRequestFlage');
  232. if (getRequestFlage != 'true') return;
  233. this.urlParameter = this.$route.query;
  234. this.storeId = this.$route.query.storeId + '';
  235. this.visitId = this.$route.query.visitId;
  236. this.storeCode = this.$route.query.storeCode;
  237. this.rdId = this.$route.query.rdId + '';
  238. this.addressLine = this.$route.query.addressLine + '';
  239. this.storeCategory = this.$route.query.storeCategory + '';
  240. this.storeName = this.$route.query.storeName + '';
  241. this.contactName = this.$route.query.contactName + '';
  242. this.lat = this.$route.query.lat + '';
  243. this.lon = this.$route.query.lon + '';
  244. this.visitModel = this.$route.query.visitModel + '';
  245. this.uType = localStorage.getItem('uType');
  246. this.list = [];
  247. this.isToOtherSystem = false;
  248. if (localStorage.getItem('visitId') != null) {
  249. this.visitId = localStorage.getItem('visitId');
  250. setTimeout(() => {
  251. this.addVisits();
  252. });
  253. } else {
  254. setTimeout(() => {
  255. this.addVisits();
  256. });
  257. }
  258. },
  259. methods: {
  260. animation() {
  261. //前时间减去上次开启时间减去暂停累计时间
  262. var times = new Date().getTime() - new Date(this.startTime).getTime();
  263. var house = Math.floor(times / 3600000); //毫秒转化为分钟
  264. var minutes = Math.floor(times / 60000 - house * 60); //毫秒转化为分钟
  265. var minutes1 = Math.floor(times / 60000); //毫秒转化为分钟
  266. var seconds = Math.floor((times - minutes1 * 60000) / 1000); //已知分钟将time减去分钟 除去1000得出 秒
  267. var ms = Math.floor((times - minutes1 * 60000 - seconds * 1000) / 10); //
  268. this.showTime =
  269. (house < 10 ? '0' + house : house) +
  270. ':' +
  271. (minutes < 10 ? '0' + minutes : minutes) +
  272. ':' +
  273. (seconds < 10 ? '0' + seconds : seconds);
  274. // +":"
  275. // +(ms<10 ? "0"+ms : ms);
  276. },
  277. // 结束拜访
  278. onstopVisit() {
  279. this.$dialog
  280. .confirm({
  281. confirmButtonText: '确定',
  282. cancelButtonText: '取消',
  283. title: '系统提示',
  284. message: '取消拜访会清空填写的拜访内容和照片,是否确认?',
  285. })
  286. .then(() => {
  287. buryingPoint({
  288. systemModel: '拜访页',
  289. buryingPointType: 1,
  290. buryingPointValue: this.storeName + '(' + this.storeCode + ')',
  291. buryingPointName: '取消拜访',
  292. buryingPointPosition: '拜访页',
  293. });
  294. stopVisit({ visitsId: this.visitId }).then((res) => {
  295. if (res.code == 200) {
  296. localStorage.removeItem('visitId');
  297. this.$dialog
  298. .alert({
  299. title: '系统提示',
  300. message: '拜访中任务结束成功!',
  301. })
  302. .then(() => {
  303. // this.$router.replace({});
  304. this.onClickLeft();
  305. // window.location.replace(window.location.origin + '/mobile/outsidelist/index');
  306. });
  307. } else {
  308. this.$dialog.alert({
  309. title: '系统提示',
  310. message: res.msg,
  311. });
  312. }
  313. });
  314. });
  315. },
  316. overbookingFn(val) {
  317. buryingPoint({
  318. systemModel: '拜访页',
  319. buryingPointType: 1,
  320. buryingPointValue: val.storeName + '(' + val.storeCode + ')',
  321. buryingPointName: '去下单',
  322. buryingPointPosition: '拜访页',
  323. });
  324. this.toastLoading(0, '加载中...', true);
  325. getOrderUrlByStoreId({
  326. storeId: this.$route.query.storeId,
  327. from: this.$route.query.from,
  328. }).then((res) => {
  329. this.toastLoading().clear();
  330. if (res.code == 200 && res.data) {
  331. window.location.href = res.data;
  332. } else {
  333. this.Toast({
  334. message: res.msg,
  335. duration: 5000,
  336. });
  337. }
  338. });
  339. },
  340. visitFn(val) {
  341. var that = this;
  342. suishenbangStoreSale({ storeCode: val }).then((res) => {
  343. if (res.code == 200) {
  344. if (res.data.num != '0') {
  345. window.location.href =
  346. process.env.VUE_APP_SSB_LINK + '/order/storeDetail/index?shopCode=' + val;
  347. } else {
  348. that.$toast(res.data.msg);
  349. }
  350. } else {
  351. that.$toast(res.msg);
  352. }
  353. });
  354. },
  355. getLocation() {
  356. let loading1 = this.$toast.loading({
  357. duration: 0,
  358. message: '加载中...',
  359. forbidClick: true,
  360. });
  361. this.list = [];
  362. let url = window.location.href;
  363. let that = this;
  364. let wx = this.wx;
  365. let qiyeData;
  366. const instance = axios.create();
  367. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  368. instance
  369. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  370. params: {
  371. url: url,
  372. },
  373. })
  374. .then((response) => {
  375. if (response.status == 200) {
  376. loading1.clear();
  377. qiyeData = response.data.data;
  378. wx.config({
  379. beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
  380. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  381. appId: qiyeData.appId, // 必填,企业微信的corpID
  382. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  383. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  384. signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
  385. jsApiList: ['ready', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
  386. });
  387. wx.ready(function () {
  388. wx.getLocation({
  389. type: 'gcj02',
  390. success: function (res) {
  391. var location = that.CJ02BD(res.latitude, res.longitude);
  392. that.location = location;
  393. if (that.urlParameter.lat == '' || that.urlParameter.lat == null) {
  394. that.lat = that.location.lat;
  395. that.lon = that.location.lon;
  396. }
  397. let PointSum = that
  398. .twoPointSum(that.lat, that.lon, location.lat, location.lon)
  399. .toFixed(2);
  400. if (PointSum > 500) {
  401. that.visitModel = '5';
  402. localStorage.setItem('visitModel', '5');
  403. that.$dialog
  404. .confirm({
  405. confirmButtonText: '确定',
  406. cancelButtonText: '重新定位',
  407. title: '系统提示',
  408. message: '距离本店距离差距太大',
  409. })
  410. .then(() => {
  411. that.addVisits();
  412. })
  413. .catch(() => {
  414. that.getLocation();
  415. });
  416. } else {
  417. that.addVisits();
  418. }
  419. },
  420. fail: function () {
  421. that.$dialog
  422. .alert({
  423. message: 'GPS未开启',
  424. })
  425. .then(() => {
  426. that.getLocation();
  427. });
  428. },
  429. });
  430. });
  431. }
  432. });
  433. },
  434. editDwellTimes() {
  435. let dwellTime = this.weekend(localStorage.getItem('startTime'), new Date()) + '';
  436. editDwellTime({ dwellTime: dwellTime, visitsId: this.visitId }).then((res) => {
  437. if (res.code == 200) {
  438. localStorage.removeItem('visitId');
  439. }
  440. });
  441. },
  442. weekend(time1) {
  443. var arrtime1 = new Date(time1).getTime();
  444. var arrtime2 = new Date().getTime();
  445. return Math.round((arrtime2 - arrtime1) / 1000);
  446. },
  447. addVisits() {
  448. var postType = localStorage.getItem('postType');
  449. if (postType == 'GZ') {
  450. this.addShow1 = false;
  451. } else {
  452. this.addShow1 = true;
  453. }
  454. var visitEntry = '';
  455. if (this.urlParameter.tabVal == '0') {
  456. visitEntry = '2';
  457. } else {
  458. visitEntry = '1';
  459. }
  460. if (this.$route.query.shopCode != undefined) {
  461. this.storeCode = this.$route.query.shopCode;
  462. }
  463. var that = this;
  464. var map = new TMap.Map('allmap', {
  465. zoom: 14,
  466. center: new TMap.LatLng(39.986785, 116.301012),
  467. });
  468. var geocoder = new TMap.service.Geocoder();
  469. var markers = new TMap.MultiMarker({
  470. map: map,
  471. geometries: [],
  472. });
  473. markers.setGeometries([]);
  474. var input = [that.urlParameter.marklat, that.urlParameter.marklon];
  475. var location = new TMap.LatLng(Number(input[0]), Number(input[1]));
  476. geocoder.getAddress({ location: location }).then(
  477. function (result) {
  478. var addresses = result.result.formatted_addresses;
  479. let address_component = result.result.address_component;
  480. let province = address_component.province;
  481. let city = address_component.city;
  482. let district = address_component.district;
  483. console.log('province=' + province);
  484. console.log('city=' + city);
  485. console.log('district=' + district);
  486. let recommend = '';
  487. if (addresses) {
  488. recommend = addresses.recommend;
  489. }
  490. var params = {
  491. storeId: that.storeId,
  492. storeCode: that.storeCode,
  493. visitEntry: visitEntry,
  494. lat: that.urlParameter.latNew,
  495. lon: that.urlParameter.lonNew,
  496. visitModel: that.visitModel,
  497. routeDetailsId: that.rdId,
  498. visitSource: '1',
  499. locationCity: '',
  500. locationRemark: recommend,
  501. locationAccuracy: that.urlParameter.PointSum,
  502. province: address_component.province,
  503. city: address_component.city,
  504. district: address_component.district,
  505. };
  506. that.locationAccuracy = that.urlParameter.PointSum;
  507. that.city = '';
  508. that.address = recommend;
  509. localStorage.setItem('address', '');
  510. if (that.visitId != null) {
  511. params.id = that.visitId;
  512. }
  513. let loading2 = that.$toast.loading({
  514. duration: 0,
  515. message: '加载中...',
  516. forbidClick: true,
  517. });
  518. getVisitTasks(params).then((res) => {
  519. loading2.clear();
  520. if (res.code == 200) {
  521. localStorage.setItem('visitId', res.data.visitId);
  522. that.notes = res.data.notes;
  523. that.visitId = res.data.visitId;
  524. that.list = res.data.sfaTaskList;
  525. that.storeGroupId = res.data.storeGroupId;
  526. that.showOrderButton = res.data.showOrderButton;
  527. that.startTime = res.data.startTime;
  528. that.timeN = setInterval(that.animation, 16);
  529. that.visitsRemarks = res.data.visitsRemarks;
  530. let sfaStoreType = res.data.sfaStoreType;
  531. if (
  532. (sfaStoreType && (sfaStoreType.jz || sfaStoreType.gz)) ||
  533. res.data.approvalStatus == null ||
  534. res.data.approvalStatus == 0
  535. ) {
  536. that.isToOtherSystem = false;
  537. } else {
  538. that.isToOtherSystem = true;
  539. }
  540. } else {
  541. that.$toast(res.msg);
  542. }
  543. });
  544. },
  545. function (err) {
  546. var params = {
  547. storeId: that.storeId,
  548. storeCode: that.storeCode,
  549. visitEntry: visitEntry,
  550. lat: that.urlParameter.latNew,
  551. lon: that.urlParameter.lonNew,
  552. visitModel: that.visitModel,
  553. routeDetailsId: that.rdId,
  554. visitSource: '1',
  555. locationCity: '',
  556. locationRemark: '',
  557. locationAccuracy: that.urlParameter.PointSum,
  558. };
  559. that.locationAccuracy = that.urlParameter.PointSum;
  560. that.city = '';
  561. that.address = '';
  562. localStorage.setItem('address', '');
  563. if (that.visitId != null) {
  564. params.id = that.visitId;
  565. }
  566. let loading2 = that.$toast.loading({
  567. duration: 0,
  568. message: '加载中...',
  569. forbidClick: true,
  570. });
  571. getVisitTasks(params).then((res) => {
  572. loading2.clear();
  573. if (res.code == 200) {
  574. localStorage.setItem('visitId', res.data.visitId);
  575. that.notes = res.data.notes;
  576. that.visitId = res.data.visitId;
  577. that.list = res.data.sfaTaskList;
  578. that.storeGroupId = res.data.storeGroupId;
  579. that.showOrderButton = res.data.showOrderButton;
  580. that.startTime = res.data.startTime;
  581. that.timeN = setInterval(that.animation, 16);
  582. that.visitsRemarks = res.data.visitsRemarks;
  583. console.log(that.visitId);
  584. let sfaStoreType = res.data.sfaStoreType;
  585. if (
  586. (sfaStoreType && (sfaStoreType.jz || sfaStoreType.gz)) ||
  587. res.data.approvalStatus == null ||
  588. res.data.approvalStatus == 0
  589. ) {
  590. that.isToOtherSystem = false;
  591. } else {
  592. that.isToOtherSystem = true;
  593. }
  594. } else {
  595. that.$toast(res.msg);
  596. }
  597. });
  598. }
  599. );
  600. },
  601. addStoreVisit(val, index) {
  602. localStorage.setItem('getRequestFlage', 'false');
  603. console.log(this.visitId);
  604. this.$router.push({
  605. path: '/addStoreVisit',
  606. query: {
  607. storeId: this.storeId,
  608. storeCode: this.urlParameter.storeCode,
  609. visitId: this.visitId,
  610. ids: index,
  611. taskId: val.taskId,
  612. storeGroupId: this.storeGroupId,
  613. taskType: val.taskType,
  614. photoType: val.photoType,
  615. lat: this.lat,
  616. lon: this.lon,
  617. visitSource: '1',
  618. visitModel: this.visitModel,
  619. locationCity: this.city,
  620. locationRemark: this.address,
  621. locationAccuracy: this.locationAccuracy,
  622. photoIdentifyType: val.photoIdentifyType,
  623. deviceCode: val.deviceCode,
  624. putInCode: val.putInCode,
  625. equipmentCode: val.equipmentCode,
  626. inspectionType: val.inspectionType,
  627. },
  628. });
  629. },
  630. onClickLeft() {
  631. localStorage.setItem('getRequestFlage', 'true');
  632. if (this.$route.query.urltype == 1) {
  633. window.location.replace(window.location.origin + '/mobile/home');
  634. } else {
  635. this.$router.go(-1);
  636. }
  637. },
  638. onshouow() {
  639. this.uploadshow = false;
  640. this.questionsshow = false;
  641. },
  642. uploadImgEdit() {
  643. if (this.uploadImgEditText == '编辑') {
  644. this.uploadImgEditText = '完成';
  645. } else {
  646. this.uploadImgEditText = '编辑';
  647. this.uploadImgshow = false;
  648. }
  649. },
  650. deleteImg(index) {
  651. this.imgs.splice(index, 1);
  652. },
  653. questionClick(item) {
  654. console.log(item);
  655. if (item.isUpload) {
  656. this.uploadshow = true;
  657. } else if (item.isQuestion) {
  658. this.questionsshow = true;
  659. }
  660. },
  661. endVisitsFn() {
  662. if (this.list.length == 0) {
  663. this.$toast('暂无任务提交');
  664. return;
  665. }
  666. for (var vl = 0; vl < this.list.length; vl++) {
  667. if (this.list[vl].isMust == '0') {
  668. if (!this.list[vl].success) {
  669. this.$toast(this.list[vl].taskName + '任务未完成');
  670. return;
  671. }
  672. }
  673. }
  674. let loading1 = this.$toast.loading({
  675. duration: 0,
  676. message: '加载中...',
  677. forbidClick: true,
  678. });
  679. let dwellTime = this.weekend(localStorage.getItem('startTime'), new Date());
  680. let storeCode = this.storeCode;
  681. if (this.$route.query.shopCode != undefined) {
  682. storeCode = this.$route.query.shopCode;
  683. }
  684. if (this.flag) {
  685. this.flag = false;
  686. this.timer = null;
  687. this.timer = setTimeout(() => {
  688. this.flag = true;
  689. }, 5000);
  690. endVisits({
  691. visitSource: '1',
  692. storeGroupId: this.storeGroupId,
  693. id: this.visitId,
  694. storeCode: storeCode,
  695. dwellTime: dwellTime,
  696. visitModel: this.$route.query.visitModel,
  697. }).then((res) => {
  698. this.flag = true;
  699. loading1.clear();
  700. if (res.code == 200) {
  701. this.editDwellTimes();
  702. // if (this.$route.query.linkType == 6) {
  703. // window.location.replace(window.location.origin + '/mobile/topStore?info=y');
  704. // } else {
  705. if (this.$route.query.urltype == 1) {
  706. window.location.replace(window.location.origin + '/mobile/home');
  707. } else {
  708. this.onClickLeft();
  709. // window.location.replace(
  710. // window.location.origin + '/mobile/outsidelist/index?info=y'
  711. // );
  712. }
  713. // }
  714. } else {
  715. this.$toast({
  716. message: res.msg,
  717. duration: 5000,
  718. });
  719. }
  720. });
  721. }
  722. },
  723. newimgarr1(val) {
  724. this.imgs = val;
  725. },
  726. uploadImgShowFn() {
  727. this.uploadImgshow = true;
  728. if (this.uploadImages.length <= 0) {
  729. this.uploadImgEditText = '';
  730. }
  731. },
  732. previewsImg(index) {
  733. ImagePreview({
  734. images: this.uploadImages,
  735. startPosition: index,
  736. onClose() {
  737. // do something
  738. },
  739. });
  740. },
  741. // 物料历史
  742. wuliaoLog() {
  743. this.toastLoading(0, '加载中...', true);
  744. getMaterialHistory({ storeId: this.storeId })
  745. .then((res) => {
  746. this.toastLoading().clear();
  747. if (res.code == 200 && res.data) {
  748. this.wuliaoList = res.data;
  749. this.wuliaoTable = true;
  750. }
  751. })
  752. .catch(() => {
  753. this.toastLoading().clear();
  754. });
  755. },
  756. wuliaoTableClose() {
  757. this.wuliaoTable = false;
  758. },
  759. // 跳转好帮手门店详情
  760. goOtherSystem() {
  761. if (this.isToOtherSystem) {
  762. if (this.storeCode)
  763. window.location.href =
  764. process.env.VUE_APP_SSB_LINK + '/order/storeDetail/index?shopCode=' + this.storeCode;
  765. }
  766. },
  767. },
  768. destroyed() {
  769. this.timeN = null;
  770. clearInterval(this.timeN);
  771. },
  772. };
  773. </script>
  774. <style lang="scss" scoped>
  775. .container {
  776. margin-bottom: 10px;
  777. background-color: white;
  778. /*padding:0 16px;*/
  779. }
  780. .navBarOverlay {
  781. background: #fff;
  782. }
  783. .card {
  784. background: #fff;
  785. box-sizing: border-box;
  786. padding: 10px 16px;
  787. .title {
  788. line-height: 32px;
  789. font-size: 16px;
  790. font-weight: bold;
  791. color: #333;
  792. }
  793. .subtitle {
  794. line-height: 24px;
  795. font-size: 14px;
  796. color: #7b7b7b;
  797. .status {
  798. float: right;
  799. }
  800. }
  801. .info {
  802. font-size: 14px;
  803. color: #484848;
  804. padding: 14px;
  805. border-bottom: 1px solid #f1f1f1;
  806. position: relative;
  807. .arrow {
  808. float: right;
  809. display: inline-block;
  810. height: 20px;
  811. width: 20px;
  812. line-height: 20px;
  813. text-align: center;
  814. border-radius: 50%;
  815. background: #0057ba;
  816. color: #fff;
  817. font-weight: bold;
  818. font-size: 14px;
  819. position: absolute;
  820. margin-top: -10px;
  821. right: 0;
  822. top: 50%;
  823. }
  824. }
  825. .info1 {
  826. font-size: 14px;
  827. color: #666;
  828. line-height: 18px;
  829. padding: 4px 0;
  830. position: relative;
  831. line-height: 24px;
  832. .arrow {
  833. float: right;
  834. display: inline-block;
  835. height: 20px;
  836. width: 20px;
  837. line-height: 20px;
  838. text-align: center;
  839. border-radius: 50%;
  840. background: #0057ba;
  841. color: #fff;
  842. font-weight: bold;
  843. font-size: 14px;
  844. margin-top: 9px;
  845. position: absolute;
  846. right: 0;
  847. top: 50%;
  848. margin-top: -10px;
  849. }
  850. }
  851. }
  852. .must {
  853. font-size: 18px;
  854. color: #f56c6c;
  855. margin-right: 2px;
  856. }
  857. .zw {
  858. display: inline-block;
  859. width: 7px;
  860. height: 100%;
  861. }
  862. .lineGrey {
  863. height: 10px;
  864. width: 100%;
  865. background: #f1f1f1;
  866. }
  867. .submitBtn {
  868. margin: 16px 0;
  869. font-size: 18px;
  870. }
  871. .wrapper {
  872. display: flex;
  873. align-items: center;
  874. justify-content: center;
  875. height: 100%;
  876. .block {
  877. width: 100%;
  878. height: 100%;
  879. background-color: #fff;
  880. overflow: auto;
  881. }
  882. }
  883. .questionName {
  884. font-size: 16px;
  885. color: #484848;
  886. /*line-height: 40px;*/
  887. background: #f4f4f4;
  888. padding: 10px 15px;
  889. box-sizing: border-box;
  890. position: relative;
  891. display: flex;
  892. justify-content: center;
  893. .text {
  894. flex: 9;
  895. }
  896. }
  897. .answerDiv {
  898. background: #fff;
  899. padding: 0 15px 10px;
  900. .answerItem {
  901. padding: 10px 0;
  902. border-bottom: 1px solid #dedede;
  903. .name {
  904. line-height: 36px;
  905. font-size: 14px;
  906. color: #8b8b8b;
  907. }
  908. }
  909. }
  910. .border {
  911. border: 1px solid #dedede;
  912. }
  913. .ht30 {
  914. height: 30px;
  915. }
  916. .bodrder-b {
  917. border-bottom: 1px solid #dedede;
  918. }
  919. .img-box {
  920. width: 50%;
  921. /*height: 100%;*/
  922. position: relative;
  923. padding: 10px;
  924. display: inline-block;
  925. i {
  926. position: absolute;
  927. right: 2px;
  928. top: 2px;
  929. }
  930. img {
  931. width: 100%;
  932. height: 100%;
  933. }
  934. }
  935. .imgNull {
  936. text-align: center;
  937. padding-top: 100px;
  938. i {
  939. color: #dedede;
  940. }
  941. div {
  942. padding-top: 30px;
  943. font-size: 18px;
  944. font-weight: bold;
  945. }
  946. }
  947. .card .f-blue {
  948. color: #0057ba;
  949. }
  950. .suishenbangOutstoreVisit {
  951. .to-other-system {
  952. color: #0057ba;
  953. text-decoration: underline;
  954. }
  955. .storeCategory {
  956. display: flex;
  957. justify-content: space-between;
  958. .storeType {
  959. flex: 1;
  960. display: flex;
  961. align-items: center;
  962. }
  963. }
  964. .visitsRemarks {
  965. display: flex;
  966. justify-content: space-between;
  967. .f-blue {
  968. flex: 1;
  969. display: flex;
  970. align-items: center;
  971. }
  972. }
  973. }
  974. </style>
  975. <style lang="scss">
  976. .navBarOverlay .van-nav-bar__left .van-icon {
  977. color: #8b8b8b;
  978. }
  979. .navBarOverlay .van-nav-bar__right .van-nav-bar__text {
  980. color: #333;
  981. }
  982. .ht30 .van-radio__label {
  983. color: #8b8b8b;
  984. }
  985. .van-dialog__confirm,
  986. .van-dialog__confirm:active {
  987. color: #0057ba;
  988. }
  989. #allmap {
  990. width: 20px;
  991. height: 20px;
  992. left: -1000px;
  993. position: relative;
  994. }
  995. .el-dialog__wrapper {
  996. z-index: 9999 !important;
  997. display: flex;
  998. justify-content: center;
  999. align-items: center;
  1000. background: rgba(0, 0, 0, 0.5) !important;
  1001. .wuliaoTable {
  1002. overflow: hidden;
  1003. display: flex;
  1004. flex-direction: column;
  1005. max-height: 70%;
  1006. margin-top: 0 !important;
  1007. .el-dialog__header {
  1008. height: 40px;
  1009. display: flex;
  1010. justify-content: right;
  1011. .el-dialog__headerbtn {
  1012. position: static !important;
  1013. }
  1014. }
  1015. .el-dialog__body {
  1016. padding: 30px 20px !important;
  1017. overflow-y: auto;
  1018. flex: 1;
  1019. }
  1020. .cell {
  1021. font-size: 12px;
  1022. }
  1023. }
  1024. }
  1025. </style>