infoHistorVisit.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <div class="bgcolor historAllVisit">
  3. <div class="navBarTOP">
  4. <!-- 顶部条-->
  5. <van-nav-bar class="navBar" title="历史拜访" left-arrow @click-left="onClickLeft" />
  6. <div class="searcTime">
  7. <van-row class="serchInput">
  8. <van-col span="12">
  9. <van-cell
  10. class="monthNow selectcell"
  11. :title="companyName"
  12. is-link
  13. arrow-direction="down"
  14. @click="regionClick" />
  15. </van-col>
  16. <van-col span="12">
  17. <van-cell
  18. class="monthNow selectcell"
  19. :title="regionName"
  20. is-link
  21. @click="SalesRegionClick"
  22. arrow-direction="down" />
  23. </van-col>
  24. <van-col span="12">
  25. <van-cell
  26. class="monthNow selectcell"
  27. :title="deptName"
  28. is-link
  29. @click="SalesDepartmentClick"
  30. arrow-direction="down" />
  31. </van-col>
  32. <van-col span="12">
  33. <van-cell
  34. class="monthNow selectcell"
  35. :title="userName"
  36. is-link
  37. @click="StaffClick"
  38. arrow-direction="down" />
  39. </van-col>
  40. <van-col span="12">
  41. <div class="monthNow" @click="startTimeshow = true">
  42. <span class="month">{{ startTime }}</span>
  43. <van-icon class="CalendarIcon" :name="require('@/assets/icon/datatims.png')" />
  44. </div>
  45. </van-col>
  46. <van-col span="12">
  47. <div class="monthNow" @click="endTimeshow = true">
  48. <span class="month">{{ endTime }}</span>
  49. <van-icon class="CalendarIcon" :name="require('@/assets/icon/datatims.png')" />
  50. </div>
  51. </van-col>
  52. </van-row>
  53. </div>
  54. <div class="searchDiv">
  55. <van-search v-model="chainName" show-action placeholder="搜索名称/编号/拜访人">
  56. <template #action>
  57. <div @click="onSearch">搜索</div>
  58. </template>
  59. </van-search>
  60. </div>
  61. <div class="lineGrey"></div>
  62. </div>
  63. <!-- 主体内容-->
  64. <div class="container" style="margin-top: 262px">
  65. <van-list
  66. class="myList1"
  67. v-model="loading"
  68. :finished="finished"
  69. finished-text="没有更多了"
  70. @load="onLoad">
  71. <div v-if="list.length > 0">
  72. <div class="cellcontent" v-for="(item, index) in list" :key="index">
  73. <van-cell>
  74. <div class="card" style="position: relative" @click="detilsFn(item)">
  75. <span v-if="item.visitSource == 2" class="stateAbnormal">异常拜访</span>
  76. <span v-if="item.visitSource == 1" class="state">正常拜访</span>
  77. <div class="title">
  78. <span>{{ item.chainName }}</span> (<span style="color: #0057ba">{{
  79. item.chainCode
  80. }}</span
  81. >)
  82. </div>
  83. <div class="info">身份类型:{{ item.typeName2 }}</div>
  84. <div class="info">拜访人:{{ item.nickName }}</div>
  85. <div class="info">
  86. 拜访时间:{{ item.visitsTime }}
  87. <span class="textRight" v-if="item.status == '1' && item.taskId == null">
  88. 审批中
  89. </span>
  90. <span
  91. class="textRight"
  92. v-if="item.status == '1' && item.taskId != null"
  93. style="color: red">
  94. 退回修改
  95. </span>
  96. <span class="textRight" style="color: #07c160" v-if="item.status == 2">
  97. 审批完成
  98. </span>
  99. <span class="textRight" v-if="item.status == '3'" style="color: red"> 拒绝 </span>
  100. </div>
  101. </div>
  102. </van-cell>
  103. <div class="lineGrey"></div>
  104. </div>
  105. </div>
  106. </van-list>
  107. </div>
  108. <van-popup v-model="startTimeshow" position="bottom" :style="{ height: '30%' }">
  109. <van-datetime-picker
  110. v-model="startcurrentDate"
  111. type="date"
  112. title="开始日期"
  113. :min-date="minDate"
  114. :max-date="startmaxDate"
  115. @confirm="dateeconfirm"
  116. @cancel="startTimeshow = false" />
  117. </van-popup>
  118. <van-popup v-model="endTimeshow" position="bottom" :style="{ height: '50%' }">
  119. <van-datetime-picker
  120. v-model="currentDate"
  121. type="date"
  122. title="开始日期"
  123. :min-date="endminDate"
  124. :max-date="maxDate"
  125. @confirm="endTimeconfirm"
  126. @cancel="endTimeshow = false" />
  127. </van-popup>
  128. <van-popup v-model="RegionShow" capture position="bottom">
  129. <van-picker
  130. show-toolbar
  131. :columns="companyList"
  132. value-key="deptName"
  133. @confirm="onregionConfirm"
  134. @cancel="RegionShow = false" />
  135. </van-popup>
  136. <van-popup v-model="SalesRegionShow" capture position="bottom">
  137. <van-picker
  138. show-toolbar
  139. :columns="regionList"
  140. value-key="deptName"
  141. @confirm="onSalesRegionConfirm"
  142. @cancel="SalesRegionShow = false" />
  143. </van-popup>
  144. <van-popup v-model="SalesDepartmentShow" capture position="bottom">
  145. <van-picker
  146. show-toolbar
  147. :columns="deptList"
  148. value-key="deptName"
  149. @confirm="onSalesDepartmentConfirm"
  150. @cancel="SalesDepartmentShow = false" />
  151. </van-popup>
  152. <van-popup v-model="StaffShow" capture position="bottom">
  153. <van-picker
  154. show-toolbar
  155. :columns="userList"
  156. @confirm="onStaffConfirm"
  157. value-key="nickName"
  158. @cancel="StaffShow = false" />
  159. </van-popup>
  160. </div>
  161. </template>
  162. <script>
  163. import { chainVisitList } from '@/api/info';
  164. import { getvisitDeptInfo } from '@/api/index';
  165. export default {
  166. name: 'index.vue',
  167. data() {
  168. return {
  169. defaultDate: new Date(),
  170. searchValue: '',
  171. calendarShow: '',
  172. monthNames: [
  173. '-01',
  174. '-02',
  175. '-03',
  176. '-04',
  177. '-05',
  178. '-06',
  179. '-07',
  180. '-08',
  181. '-09',
  182. '-10',
  183. '-11',
  184. '-12',
  185. ],
  186. calendarIsshow: false,
  187. tabVal: 'insidePlan',
  188. list: [],
  189. loading: false,
  190. finished: true,
  191. listActive: null,
  192. query: '',
  193. show: false,
  194. minDate: new Date(2022, 0, 1),
  195. maxDate: new Date(),
  196. currentDate: new Date(),
  197. startcurrentDate: new Date(),
  198. endminDate: new Date(),
  199. startmaxDate: new Date(),
  200. endTime: '',
  201. startTime: '',
  202. endTimeshow: false,
  203. startTimeshow: false,
  204. chainName: '',
  205. companyName: '全部公司',
  206. deptName: '全部销售部',
  207. regionName: '全部大区',
  208. userName: '全部',
  209. companyCode: '',
  210. deptCode: '',
  211. regionCode: '',
  212. userCode: '',
  213. companyList: [],
  214. deptList: [],
  215. regionList: [],
  216. userList: [],
  217. RegionShow: false,
  218. SalesRegionShow: false,
  219. SalesDepartmentShow: false,
  220. StaffShow: false,
  221. deptForm: { type: '', parentId: '' },
  222. pageNum: 1, // 当前页码 int类型
  223. pageSize: 10, // 当前每页条数 int类型
  224. formData: {
  225. companyId: '', // 公司id,必传 Long类型
  226. regionId: '', // 大区id,必传 Long类型
  227. deptId: '', // 部门id,如果为周报或日报为必传 Long类型
  228. userId: '', // 业务员id,如果为日报为必传 Long类型
  229. startTime: '', // 开始时间,必传 格式:yyyy-MM-dd String类型
  230. endTime: '', // 结束时间,必传 格式:yyyy-MM-dd String类型
  231. pageNum: 1, // 当前页码 int类型
  232. pageSize: 10, // 当前每页条数 int类型
  233. },
  234. };
  235. },
  236. created() {
  237. this.info();
  238. this.userList = [];
  239. this.pageNum = 1;
  240. this.list = [];
  241. this.powerGrade = localStorage.getItem('powerGrade');
  242. this.getDeptInfo('dept', null, () => {
  243. this.onSearch();
  244. });
  245. if (this.powerGrade == 5) {
  246. setTimeout(() => {
  247. if (this.$route.query.userCode == undefined) {
  248. this.companyName = this.companyList[0].deptName;
  249. this.companyCode = this.companyList[0].deptId;
  250. }
  251. this.getDeptInfo('dept', 1);
  252. }, 1000);
  253. }
  254. if (this.powerGrade == 4) {
  255. setTimeout(() => {
  256. this.getDeptInfo('dept', 1);
  257. }, 1000);
  258. }
  259. if (this.powerGrade == 3) {
  260. setTimeout(() => {
  261. this.getDeptInfo('dept', 2);
  262. }, 1000);
  263. }
  264. if (this.powerGrade == 2 || this.powerGrade == 1) {
  265. setTimeout(() => {
  266. this.getDeptInfo('user');
  267. }, 2000);
  268. }
  269. },
  270. mounted() {},
  271. methods: {
  272. onLoad() {
  273. // this.loading = false;
  274. this.getVisitsListFn();
  275. },
  276. info() {
  277. this.query = this.$route.query;
  278. this.startTime = this.getDay(-7);
  279. this.startcurrentDate = new Date(this.getDay(-7));
  280. this.endTime = this.parseTime(new Date(), '{y}-{m}-{d}');
  281. this.endminDate = new Date(this.getDay(-7));
  282. },
  283. detilsFn(val) {
  284. this.$router.push({
  285. path: '/visitHistoryDetail',
  286. query: {
  287. visitId: val.id,
  288. // typeName2: val.typeName2,
  289. // chainId: val.chainId,
  290. // customerManager: val.customerManager,
  291. // close: val.close,
  292. // freeze: val.freeze,
  293. // chainName: val.chainName,
  294. // chainCode: val.chainCode,
  295. // openDate: val.openDate,
  296. },
  297. });
  298. },
  299. timeBefore7(date) {
  300. if (!date) {
  301. date = new Date();
  302. }
  303. var y = date.getFullYear();
  304. var m = date.getMonth() + 1;
  305. var d = date.getDate() - 6;
  306. if (d < 0) {
  307. m = date.getMonth();
  308. var d1 = new Date(y, m, 0);
  309. var d2 = d1.getDate();
  310. return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d2 + d);
  311. } else {
  312. return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d < 10 ? '0' + d : d);
  313. }
  314. },
  315. getDay(day) {
  316. var today = new Date();
  317. var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
  318. today.setTime(targetday_milliseconds); //注意,这行是关键代码
  319. var tYear = today.getFullYear();
  320. var tMonth = today.getMonth();
  321. var tDate = today.getDate();
  322. tMonth = this.doHandleMonth(tMonth + 1);
  323. tDate = this.doHandleMonth(tDate);
  324. return tYear + '-' + tMonth + '-' + tDate;
  325. },
  326. doHandleMonth(month) {
  327. var m = month;
  328. if (month.toString().length == 1) {
  329. m = '0' + month;
  330. }
  331. return m;
  332. },
  333. dateeconfirm() {
  334. this.startTimeshow = false;
  335. this.startTime = this.parseTime(this.startcurrentDate, '{yy}-{mm}-{dd}');
  336. this.endminDate = new Date(this.startcurrentDate);
  337. this.onSearch();
  338. },
  339. endTimeconfirm() {
  340. this.endTimeshow = false;
  341. this.endTime = this.parseTime(this.currentDate, '{yy}-{mm}-{dd}');
  342. this.startmaxDate = new Date(this.currentDate);
  343. this.onSearch();
  344. },
  345. onClickLeft() {
  346. // 有直接从其他系统进入列表,返回时不能上一页
  347. this.$router.push({
  348. path: '/info',
  349. });
  350. },
  351. onSearch() {
  352. this.pageNum = 1;
  353. this.list = [];
  354. this.getVisitsListFn();
  355. },
  356. getVisitsListFn() {
  357. let loading1 = this.$toast.loading({
  358. duration: 0,
  359. message: '数据获取中...',
  360. forbidClick: true,
  361. });
  362. if (this.refreshing) {
  363. this.list = [];
  364. this.refreshing = false;
  365. }
  366. chainVisitList({
  367. startTime: this.startTime + ' 00:00:00', //
  368. stopTime: this.endTime + ' 24:00:00', //
  369. chainRequest: this.chainName.trim(),
  370. pageNum: this.pageNum,
  371. pageSize: this.pageSize,
  372. companyId: this.companyCode,
  373. regionId: this.regionCode,
  374. userId: this.userCode,
  375. deptId: this.deptCode,
  376. }).then((res) => {
  377. loading1.clear();
  378. if (res.code == 200) {
  379. this.loading = false;
  380. this.list = this.list.concat(res.data);
  381. if (this.list.length >= res.total) {
  382. this.finished = true;
  383. } else {
  384. this.finished = false;
  385. }
  386. this.pageNum = this.pageNum + 1;
  387. } else {
  388. this.$toast.fail(res.msg);
  389. }
  390. });
  391. },
  392. regionClick() {
  393. // if(this.powerGrade>4){
  394. this.RegionShow = true;
  395. // }
  396. },
  397. SalesRegionClick(val) {
  398. // if(this.powerGrade>3){
  399. this.SalesRegionShow = true;
  400. // }
  401. },
  402. SalesDepartmentClick() {
  403. // if(this.powerGrade>2){
  404. this.SalesDepartmentShow = true;
  405. // }
  406. },
  407. StaffClick() {
  408. this.StaffShow = true;
  409. },
  410. StartTimeClick() {
  411. this.StartTimeShow = true;
  412. },
  413. onregionConfirm(val) {
  414. this.RegionShow = false;
  415. this.companyName = val.deptName;
  416. this.companyCode = val.deptId;
  417. this.regionName = '全部大区';
  418. this.regionCode = '';
  419. this.deptName = '全部销售部';
  420. this.deptCode = '';
  421. this.userName = '全部';
  422. this.userCode = '';
  423. this.getDeptInfo('dept', 1);
  424. },
  425. onSalesRegionConfirm(val) {
  426. this.SalesRegionShow = false;
  427. this.regionName = val.deptName;
  428. this.regionCode = val.deptId;
  429. if (val.deptId != '') {
  430. this.getDeptInfo('dept', 2);
  431. }
  432. this.deptName = '全部销售部';
  433. this.deptCode = '';
  434. this.userName = '全部';
  435. this.userCode = '';
  436. this.userList = [];
  437. },
  438. onSalesDepartmentConfirm(val) {
  439. this.SalesDepartmentShow = false;
  440. this.deptName = val.deptName;
  441. this.deptCode = val.deptId;
  442. if (val.deptId != '') {
  443. this.getDeptInfo('user');
  444. }
  445. this.userName = '全部';
  446. this.userCode = '';
  447. },
  448. onStaffConfirm(val) {
  449. this.StaffShow = false;
  450. this.userName = val.nickName;
  451. this.userCode = val.userId;
  452. },
  453. getDeptInfo(type, grade, callback) {
  454. this.deptForm.type = type;
  455. if (type == 'dept') {
  456. if (grade == '1') {
  457. this.deptForm.parentId = this.companyCode;
  458. } else if (grade == '2') {
  459. this.deptForm.parentId = this.regionCode;
  460. } else {
  461. this.deptForm.type = '';
  462. this.deptForm.parentId = '';
  463. }
  464. } else if (type == 'user') {
  465. this.deptForm.parentId = this.deptCode;
  466. }
  467. getvisitDeptInfo(this.deptForm).then((res) => {
  468. if (type == 'dept') {
  469. if (grade == '1') {
  470. if (res.data.region != null) {
  471. this.regionList = [{ deptName: '全部大区', deptId: '' }].concat(res.data.region);
  472. }
  473. } else if (grade == '2') {
  474. if (res.data.dept != null) {
  475. this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
  476. }
  477. } else {
  478. this.companyList = res.data.company;
  479. if (this.$route.query.userCode == undefined) {
  480. this.companyName = res.data.company[0].deptName;
  481. this.companyCode = res.data.company[0].deptId;
  482. }
  483. if (res.data.dept != null) {
  484. this.deptName = res.data.dept[0].deptName;
  485. this.deptCode = res.data.dept[0].deptId;
  486. this.deptList = res.data.dept;
  487. }
  488. if (res.data.region != null) {
  489. this.regionName = res.data.region[0].deptName;
  490. this.regionCode = res.data.region[0].deptId;
  491. this.regionList = res.data.region;
  492. }
  493. if (res.data.user != null) {
  494. this.userList = res.data.user;
  495. this.userCode = '';
  496. }
  497. }
  498. callback && callback();
  499. } else if (type == 'user') {
  500. if (res.data.user != null) {
  501. this.userList = [{ nickName: '全部', userId: '' }].concat(res.data.user);
  502. }
  503. }
  504. });
  505. },
  506. },
  507. };
  508. </script>
  509. <style lang="scss">
  510. .searchDiv {
  511. .van-search {
  512. background: #fff;
  513. }
  514. .van-search__action {
  515. font-size: 14px;
  516. color: #1989fa;
  517. font-weight: bold;
  518. background: #f5f5f5;
  519. border-bottom-right-radius: 60px;
  520. border-top-right-radius: 60px;
  521. border: 1px solid #ccc;
  522. padding: 0 20px;
  523. }
  524. .van-search--show-action {
  525. padding-right: 12px;
  526. }
  527. .van-search__content {
  528. border: 1px solid #ccc;
  529. border-bottom-left-radius: 60px;
  530. border-top-left-radius: 60px;
  531. background: #f5f5f5;
  532. border-right: 0;
  533. }
  534. }
  535. .myList1 {
  536. .van-cell {
  537. padding: 10px 16px;
  538. &:after {
  539. border-bottom: none;
  540. }
  541. }
  542. }
  543. .historAllVisit {
  544. .TCFXListItem {
  545. display: inline-block;
  546. border: 1px solid #ccc;
  547. padding: 3px 5px;
  548. margin: 0 5px;
  549. border-radius: 6px;
  550. }
  551. }
  552. </style>
  553. <style lang="scss" scoped>
  554. .bgcolor {
  555. background-color: #f5f5f5;
  556. }
  557. .container {
  558. padding-bottom: 50px;
  559. }
  560. .monthNow {
  561. height: 34px;
  562. line-height: 34px;
  563. text-align: left;
  564. font-weight: bold;
  565. padding: 0 16px;
  566. box-sizing: border-box;
  567. background-color: #f1f1f1;
  568. border-radius: 20px;
  569. margin: 8px;
  570. border: 1px solid #ccc;
  571. position: relative;
  572. color: #333;
  573. font-size: 14px;
  574. .van-cell__left-icon,
  575. .van-cell__right-icon {
  576. line-height: 34px;
  577. }
  578. .CalendarIcon {
  579. float: right;
  580. font-size: 24px;
  581. color: #1989fa;
  582. margin-top: 6px;
  583. position: absolute;
  584. right: 12px;
  585. img {
  586. height: 0.8em;
  587. }
  588. }
  589. }
  590. .serchInput {
  591. padding: 0 4px;
  592. }
  593. .selectcell {
  594. width: 92%;
  595. }
  596. .card {
  597. box-sizing: border-box;
  598. .title {
  599. font-size: 16px;
  600. font-weight: bold;
  601. color: #333;
  602. line-height: 30px;
  603. width: 78%;
  604. }
  605. .info {
  606. font-size: 14px;
  607. color: #909090;
  608. line-height: 26px;
  609. }
  610. }
  611. /**/
  612. .searcTime {
  613. background-color: white;
  614. }
  615. .btnbox {
  616. padding: 0 16px;
  617. }
  618. .cellcontent .centerBtn {
  619. margin: 0 auto 10px;
  620. display: block;
  621. width: 92%;
  622. border-radius: 5px;
  623. }
  624. .statstext {
  625. background-color: #1c84c6;
  626. position: absolute;
  627. right: 0;
  628. top: 16px;
  629. padding: 2px 6px 2px 12px;
  630. border-bottom-left-radius: 60px;
  631. border-top-left-radius: 60px;
  632. color: #fff;
  633. }
  634. .stateAbnormal {
  635. position: absolute;
  636. right: 0;
  637. top: 0;
  638. color: #fff;
  639. background-color: red;
  640. border-radius: 5px;
  641. display: inline-block;
  642. padding: 0 5px;
  643. }
  644. .state {
  645. position: absolute;
  646. right: 0;
  647. top: 0;
  648. color: #fff;
  649. background-color: #1c84c6;
  650. border-radius: 5px;
  651. display: inline-block;
  652. padding: 0 5px;
  653. }
  654. .navBarTOP {
  655. position: fixed;
  656. width: 100%;
  657. z-index: 2;
  658. top: 0;
  659. }
  660. .cellcontent .textRight {
  661. float: right;
  662. color: #0057ba;
  663. }
  664. </style>