suishenbangOutstoreVisit.vue 31 KB

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