suishenbangOutstoreVisit.vue 31 KB

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