suishenbangOutstoreVisit.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  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 = that.filterSfaTaskList(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 = that.filterSfaTaskList(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. filterSfaTaskList(list) {
  602. let taskTypeArr = list.filter((val) => val.taskType !== '5');
  603. let taskType5Index = list.findIndex((val) => val.taskType == '5');
  604. if (taskType5Index != -1) {
  605. let taskType5 = {
  606. ...list[taskType5Index],
  607. };
  608. taskType5.taskName = '生动化陈列任务拍照';
  609. taskTypeArr.splice(taskType5Index, 0, taskType5);
  610. }
  611. console.log(taskTypeArr);
  612. return taskTypeArr;
  613. },
  614. addStoreVisit(val, index) {
  615. localStorage.setItem('getRequestFlage', 'false');
  616. console.log(this.visitId);
  617. if (val.taskType == '5') {
  618. // if (val.taskType == '5') {
  619. this.$router.push({
  620. path: '/taskPhotoTaking',
  621. query: {},
  622. });
  623. } else {
  624. this.$router.push({
  625. path: '/addStoreVisit',
  626. query: {
  627. storeId: this.storeId,
  628. storeCode: this.urlParameter.storeCode,
  629. visitId: this.visitId,
  630. ids: index,
  631. taskId: val.taskId,
  632. storeGroupId: this.storeGroupId,
  633. taskType: val.taskType,
  634. photoType: val.photoType,
  635. lat: this.lat,
  636. lon: this.lon,
  637. visitSource: '1',
  638. visitModel: this.visitModel,
  639. locationCity: this.city,
  640. locationRemark: this.address,
  641. locationAccuracy: this.locationAccuracy,
  642. photoIdentifyType: val.photoIdentifyType,
  643. deviceCode: val.deviceCode,
  644. putInCode: val.putInCode,
  645. equipmentCode: val.equipmentCode,
  646. inspectionType: val.inspectionType,
  647. },
  648. });
  649. }
  650. },
  651. onClickLeft() {
  652. localStorage.setItem('getRequestFlage', 'true');
  653. if (this.$route.query.urltype == 1) {
  654. window.location.replace(window.location.origin + '/mobile/home');
  655. } else {
  656. this.$router.go(-1);
  657. }
  658. },
  659. onshouow() {
  660. this.uploadshow = false;
  661. this.questionsshow = false;
  662. },
  663. uploadImgEdit() {
  664. if (this.uploadImgEditText == '编辑') {
  665. this.uploadImgEditText = '完成';
  666. } else {
  667. this.uploadImgEditText = '编辑';
  668. this.uploadImgshow = false;
  669. }
  670. },
  671. deleteImg(index) {
  672. this.imgs.splice(index, 1);
  673. },
  674. questionClick(item) {
  675. console.log(item);
  676. if (item.isUpload) {
  677. this.uploadshow = true;
  678. } else if (item.isQuestion) {
  679. this.questionsshow = true;
  680. }
  681. },
  682. endVisitsFn() {
  683. if (this.list.length == 0) {
  684. this.$toast('暂无任务提交');
  685. return;
  686. }
  687. for (var vl = 0; vl < this.list.length; vl++) {
  688. if (this.list[vl].isMust == '0') {
  689. if (!this.list[vl].success) {
  690. this.$toast(this.list[vl].taskName + '任务未完成');
  691. return;
  692. }
  693. }
  694. }
  695. let loading1 = this.$toast.loading({
  696. duration: 0,
  697. message: '加载中...',
  698. forbidClick: true,
  699. });
  700. let dwellTime = this.weekend(localStorage.getItem('startTime'), new Date());
  701. let storeCode = this.storeCode;
  702. if (this.$route.query.shopCode != undefined) {
  703. storeCode = this.$route.query.shopCode;
  704. }
  705. if (this.flag) {
  706. this.flag = false;
  707. this.timer = null;
  708. this.timer = setTimeout(() => {
  709. this.flag = true;
  710. }, 5000);
  711. endVisits({
  712. visitSource: '1',
  713. storeGroupId: this.storeGroupId,
  714. id: this.visitId,
  715. storeCode: storeCode,
  716. dwellTime: dwellTime,
  717. visitModel: this.$route.query.visitModel,
  718. }).then((res) => {
  719. this.flag = true;
  720. loading1.clear();
  721. if (res.code == 200) {
  722. this.editDwellTimes();
  723. // if (this.$route.query.linkType == 6) {
  724. // window.location.replace(window.location.origin + '/mobile/topStore?info=y');
  725. // } else {
  726. if (this.$route.query.urltype == 1) {
  727. window.location.replace(window.location.origin + '/mobile/home');
  728. } else {
  729. this.onClickLeft();
  730. // window.location.replace(
  731. // window.location.origin + '/mobile/outsidelist/index?info=y'
  732. // );
  733. }
  734. // }
  735. } else {
  736. this.$toast({
  737. message: res.msg,
  738. duration: 5000,
  739. });
  740. }
  741. });
  742. }
  743. },
  744. newimgarr1(val) {
  745. this.imgs = val;
  746. },
  747. uploadImgShowFn() {
  748. this.uploadImgshow = true;
  749. if (this.uploadImages.length <= 0) {
  750. this.uploadImgEditText = '';
  751. }
  752. },
  753. previewsImg(index) {
  754. ImagePreview({
  755. images: this.uploadImages,
  756. startPosition: index,
  757. onClose() {
  758. // do something
  759. },
  760. });
  761. },
  762. // 物料历史
  763. wuliaoLog() {
  764. this.toastLoading(0, '加载中...', true);
  765. getMaterialHistory({ storeId: this.storeId })
  766. .then((res) => {
  767. this.toastLoading().clear();
  768. if (res.code == 200 && res.data) {
  769. this.wuliaoList = res.data;
  770. this.wuliaoTable = true;
  771. }
  772. })
  773. .catch(() => {
  774. this.toastLoading().clear();
  775. });
  776. },
  777. wuliaoTableClose() {
  778. this.wuliaoTable = false;
  779. },
  780. // 跳转好帮手门店详情
  781. goOtherSystem() {
  782. if (this.isToOtherSystem) {
  783. if (this.storeCode)
  784. window.location.href =
  785. process.env.VUE_APP_SSB_LINK + '/order/storeDetail/index?shopCode=' + this.storeCode;
  786. }
  787. },
  788. },
  789. destroyed() {
  790. this.timeN = null;
  791. clearInterval(this.timeN);
  792. },
  793. };
  794. </script>
  795. <style lang="scss" scoped>
  796. .container {
  797. margin-bottom: 10px;
  798. background-color: white;
  799. /*padding:0 16px;*/
  800. }
  801. .navBarOverlay {
  802. background: #fff;
  803. }
  804. .card {
  805. background: #fff;
  806. box-sizing: border-box;
  807. padding: 10px 16px;
  808. .title {
  809. line-height: 32px;
  810. font-size: 16px;
  811. font-weight: bold;
  812. color: #333;
  813. }
  814. .subtitle {
  815. line-height: 24px;
  816. font-size: 14px;
  817. color: #7b7b7b;
  818. .status {
  819. float: right;
  820. }
  821. }
  822. .info {
  823. font-size: 14px;
  824. color: #484848;
  825. padding: 14px;
  826. border-bottom: 1px solid #f1f1f1;
  827. position: relative;
  828. .arrow {
  829. float: right;
  830. display: inline-block;
  831. height: 20px;
  832. width: 20px;
  833. line-height: 20px;
  834. text-align: center;
  835. border-radius: 50%;
  836. background: #0057ba;
  837. color: #fff;
  838. font-weight: bold;
  839. font-size: 14px;
  840. position: absolute;
  841. margin-top: -10px;
  842. right: 0;
  843. top: 50%;
  844. }
  845. }
  846. .info1 {
  847. font-size: 14px;
  848. color: #666;
  849. line-height: 18px;
  850. padding: 4px 0;
  851. position: relative;
  852. line-height: 24px;
  853. .arrow {
  854. float: right;
  855. display: inline-block;
  856. height: 20px;
  857. width: 20px;
  858. line-height: 20px;
  859. text-align: center;
  860. border-radius: 50%;
  861. background: #0057ba;
  862. color: #fff;
  863. font-weight: bold;
  864. font-size: 14px;
  865. margin-top: 9px;
  866. position: absolute;
  867. right: 0;
  868. top: 50%;
  869. margin-top: -10px;
  870. }
  871. }
  872. }
  873. .must {
  874. font-size: 18px;
  875. color: #f56c6c;
  876. margin-right: 2px;
  877. }
  878. .zw {
  879. display: inline-block;
  880. width: 7px;
  881. height: 100%;
  882. }
  883. .lineGrey {
  884. height: 10px;
  885. width: 100%;
  886. background: #f1f1f1;
  887. }
  888. .submitBtn {
  889. margin: 16px 0;
  890. font-size: 18px;
  891. }
  892. .wrapper {
  893. display: flex;
  894. align-items: center;
  895. justify-content: center;
  896. height: 100%;
  897. .block {
  898. width: 100%;
  899. height: 100%;
  900. background-color: #fff;
  901. overflow: auto;
  902. }
  903. }
  904. .questionName {
  905. font-size: 16px;
  906. color: #484848;
  907. /*line-height: 40px;*/
  908. background: #f4f4f4;
  909. padding: 10px 15px;
  910. box-sizing: border-box;
  911. position: relative;
  912. display: flex;
  913. justify-content: center;
  914. .text {
  915. flex: 9;
  916. }
  917. }
  918. .answerDiv {
  919. background: #fff;
  920. padding: 0 15px 10px;
  921. .answerItem {
  922. padding: 10px 0;
  923. border-bottom: 1px solid #dedede;
  924. .name {
  925. line-height: 36px;
  926. font-size: 14px;
  927. color: #8b8b8b;
  928. }
  929. }
  930. }
  931. .border {
  932. border: 1px solid #dedede;
  933. }
  934. .ht30 {
  935. height: 30px;
  936. }
  937. .bodrder-b {
  938. border-bottom: 1px solid #dedede;
  939. }
  940. .img-box {
  941. width: 50%;
  942. /*height: 100%;*/
  943. position: relative;
  944. padding: 10px;
  945. display: inline-block;
  946. i {
  947. position: absolute;
  948. right: 2px;
  949. top: 2px;
  950. }
  951. img {
  952. width: 100%;
  953. height: 100%;
  954. }
  955. }
  956. .imgNull {
  957. text-align: center;
  958. padding-top: 100px;
  959. i {
  960. color: #dedede;
  961. }
  962. div {
  963. padding-top: 30px;
  964. font-size: 18px;
  965. font-weight: bold;
  966. }
  967. }
  968. .card .f-blue {
  969. color: #0057ba;
  970. }
  971. .suishenbangOutstoreVisit {
  972. .to-other-system {
  973. color: #0057ba;
  974. text-decoration: underline;
  975. }
  976. .storeCategory {
  977. display: flex;
  978. justify-content: space-between;
  979. .storeType {
  980. flex: 1;
  981. display: flex;
  982. align-items: center;
  983. }
  984. }
  985. .visitsRemarks {
  986. display: flex;
  987. justify-content: space-between;
  988. .f-blue {
  989. flex: 1;
  990. display: flex;
  991. align-items: center;
  992. }
  993. }
  994. }
  995. </style>
  996. <style lang="scss">
  997. .navBarOverlay .van-nav-bar__left .van-icon {
  998. color: #8b8b8b;
  999. }
  1000. .navBarOverlay .van-nav-bar__right .van-nav-bar__text {
  1001. color: #333;
  1002. }
  1003. .ht30 .van-radio__label {
  1004. color: #8b8b8b;
  1005. }
  1006. .van-dialog__confirm,
  1007. .van-dialog__confirm:active {
  1008. color: #0057ba;
  1009. }
  1010. #allmap {
  1011. width: 20px;
  1012. height: 20px;
  1013. left: -1000px;
  1014. position: relative;
  1015. }
  1016. .el-dialog__wrapper {
  1017. z-index: 9999 !important;
  1018. display: flex;
  1019. justify-content: center;
  1020. align-items: center;
  1021. background: rgba(0, 0, 0, 0.5) !important;
  1022. .wuliaoTable {
  1023. overflow: hidden;
  1024. display: flex;
  1025. flex-direction: column;
  1026. max-height: 70%;
  1027. margin-top: 0 !important;
  1028. .el-dialog__header {
  1029. height: 40px;
  1030. display: flex;
  1031. justify-content: right;
  1032. .el-dialog__headerbtn {
  1033. position: static !important;
  1034. }
  1035. }
  1036. .el-dialog__body {
  1037. padding: 30px 20px !important;
  1038. overflow-y: auto;
  1039. flex: 1;
  1040. }
  1041. .cell {
  1042. font-size: 12px;
  1043. }
  1044. }
  1045. }
  1046. </style>