my_task.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template name="task">
  2. <view class="content">
  3. <view class="content1-top">
  4. <view class="search-form round">
  5. <u-search placeholder="请输入合同编号、车牌号或派车编号" v-model="keyword" @search="searchKeyWord()"
  6. @custom="searchKeyWord()"></u-search>
  7. </view>
  8. <view>
  9. <view @click='tabcarchange(1)' class='line' :class='statusFlag==1?"active":""'>未完成</view>
  10. <view @click='tabcarchange(3)' class='line' :class='statusFlag==3?"active":""'>已完成</view>
  11. </view>
  12. </view>
  13. <view class="introduce-section">
  14. <view v-for="(item, index) in taskInfo" :key="index" @click="navToDetailPage(item)">
  15. <view v-if="item.showRow" class="guess-item">
  16. <view class="title flex align-item-center">
  17. <view>
  18. <view class="title-row1">{{item.department}}:</view>
  19. <view style='font-size:12px;color:#878C9C;'>{{item.createDate}}</view>
  20. </view>
  21. <text v-if='statusFlag==1' style='color:#FE6430;'>{{item.messageTitle}}</text>
  22. <text v-if='statusFlag==3' style='color:#AFB3BF;'>{{item.messageTitle}}</text>
  23. </view>
  24. <view class="flex title_b">
  25. <view style='color:#878C9C;' class="title row2">
  26. {{item.messageContent}}
  27. </view>
  28. </view>
  29. <u-tag :text="item.taskType" type="success" v-if="item.taskType == '出库任务'" />
  30. <u-tag :text="item.taskType" type="primary" v-if="item.taskType == '入库任务'" />
  31. </view>
  32. </view>
  33. <view v-show="isSole">
  34. <uni-load-more :status="loadStatus"></uni-load-more>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. mapState
  42. } from 'vuex';
  43. export default {
  44. name: "task",
  45. data() {
  46. return {
  47. PageCur: "task",
  48. taskInfo: [],
  49. pages: 1, //页数
  50. limit: 10, //每次取条目数
  51. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  52. isLoadMore: false, //是否加载中
  53. isSole: false,
  54. showTran: true,
  55. scrollTop: 0,
  56. isContent: true,
  57. statusFlag: 1,
  58. current: 1,
  59. pcUserInfo: {},
  60. warehouseInOutInfo: {
  61. pageSize: 10,
  62. currentPage: 1
  63. },
  64. data: {
  65. pageSize: 10,
  66. currentPage: 1
  67. },
  68. keyword: ""
  69. };
  70. },
  71. computed: {
  72. ...mapState(['hasLogin', 'userInfo'])
  73. },
  74. onShow() {
  75. this.warehouseInOutInfo.currentPage = 1
  76. this.data.currentPage = 1
  77. this.taskInfo = []
  78. this.pcUserInfo = uni.getStorageSync("pcUserInfo")
  79. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  80. if (res.data.data == "INVALID") {
  81. uni.showModal({
  82. title: '登录提示',
  83. content: '当前登入信息验证失败,是否重新登录?',
  84. showCancel: true,
  85. confirmText: '登录',
  86. success: (e) => {
  87. if (e.confirm) {
  88. uni.navigateTo({
  89. url: '/pages/public/login'
  90. })
  91. }
  92. },
  93. fail: () => {},
  94. complete: () => {}
  95. })
  96. } else {
  97. this.getIndexBuyData()
  98. }
  99. })
  100. // this.warehouseInOutInfo.phone = this.userInfo.phone
  101. },
  102. onReachBottom() { //上拉触底函数
  103. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  104. this.pages+=1
  105. if (this.statusFlag == 1) {
  106. this.warehouseInOutInfo.currentPage += 1
  107. } else {
  108. this.data.currentPage += 1
  109. }
  110. this.getIndexBuyData()
  111. }
  112. },
  113. // onLoad(options) {
  114. // this.getIndexBuyData()
  115. // },
  116. filters: {
  117. formatDate(date) {
  118. var date = new Date(date)
  119. var time = new Date()
  120. var newdate = ''
  121. if (time.getMonth() + 1 >= 10) {
  122. newdate = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate()
  123. } else {
  124. newdate = time.getFullYear() + '-0' + (time.getMonth() + 1) + '-' + time.getDate()
  125. }
  126. //把时间戳改为yyyy-MM-dd格式
  127. //判断是否今天
  128. var datatime = ''
  129. if (date.getMonth() + 1 >= 10) {
  130. datatime = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  131. } else {
  132. datatime = date.getFullYear() + '-0' + (date.getMonth() + 1) + '-' + date.getDate()
  133. }
  134. if (datatime == newdate) {
  135. var h = date.getHours();
  136. h = h < 10 ? '0' + h : h;
  137. var m = date.getMinutes();
  138. m = m < 10 ? '0' + m : m;
  139. var s = date.getSeconds();
  140. s = s < 10 ? '0' + s : s;
  141. return h + ':' + m + ':' + s;
  142. } else {
  143. if (date.getMonth() + 1 >= 10) {
  144. return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  145. } else {
  146. return date.getFullYear() + '-0' + (date.getMonth() + 1) + '-' + date.getDate()
  147. }
  148. }
  149. let o = {
  150. 'Y': date.getFullYear(),
  151. 'M+': date.getMonth() + 1,
  152. 'd+': date.getDate(),
  153. }
  154. },
  155. },
  156. methods: {
  157. // getRoles(){
  158. // let _rolesList = uni.getStorageSync('rolesList')
  159. // let _list = ['','']
  160. // for(let i = 0;i<_list.length;i++){
  161. // for(let k = 0;k<_rolesList.length;k++){
  162. // if(_list[i]==_rolesList[k]){
  163. // return true
  164. // }
  165. // }
  166. // }
  167. // return false
  168. // },
  169. searchKeyWord() {
  170. if (!this.keyword) {
  171. this.$api.msg('关键字不能为空')
  172. }
  173. uni.showLoading({
  174. title: "正在加载"
  175. })
  176. this.$api.doRequest('get', '/warehouseInOutInfo/selectInfoByKeyWord', this.warehouseInOutInfo).then(
  177. res => {
  178. if (res.data.code == 200) {
  179. this.taskInfo = res.data.data
  180. uni.hideLoading()
  181. } else {
  182. uni.showToast({
  183. title: res.data.message,
  184. icon: 'none',
  185. duration: 2000
  186. })
  187. uni.hideLoading(this.taskInfo,"信息")
  188. }
  189. console.log()
  190. }).catch(res => {
  191. uni.showToast({
  192. title: res.data.message,
  193. icon: 'none',
  194. duration: 2000
  195. })
  196. uni.hideLoading()
  197. })
  198. },
  199. getIndexBuyData(status) {
  200. const that = this
  201. var pages = that.pages
  202. var limit = that.limit
  203. var url = ''
  204. uni.showLoading({
  205. title: "正在加载"
  206. })
  207. var data = {}
  208. if (this.statusFlag == 1) {
  209. data = this.warehouseInOutInfo
  210. url = '/noticeTask/query/noticeTasks'
  211. } else {
  212. data = this.data
  213. url = '/commonUser/query/findHisPageNoticeTasks'
  214. }
  215. data.currentPage = pages
  216. data.pageSize = limit
  217. //this.warehouseInOutInfo.status = this.status
  218. this.$api.doRequest('get', url, data).then(res => {
  219. if (res.data.code == 200) {
  220. let data = res.data.data.records
  221. //采购信息
  222. if (data.length > 0) {
  223. if (status) {
  224. that.taskInfo = data
  225. } else {
  226. that.taskInfo = that.taskInfo.concat(data)
  227. }
  228. } else {
  229. if (that.pages > 1) {
  230. that.pages -= 1
  231. }
  232. that.isLoadMore = false
  233. that.loadStatus = 'nomore'
  234. }
  235. for (var i = 0; i < this.taskInfo.length; i++) {
  236. let _str = this.taskInfo[i]
  237. // let a = this.getRoles()
  238. if(_str.messageContent.indexOf("您发起")>-1){
  239. _str.showRow = false
  240. }else{
  241. _str.showRow = true;
  242. }
  243. this.taskInfo[i].department=this.taskInfo[i].messageContent.split(' ')[0]
  244. if (this.taskInfo[i].businessType == 'WAREHOUSE') {
  245. if (this.taskInfo[i].businessCode == 'INOUTTASK-TASK-APPROVE') {
  246. this.taskInfo[i].messageTitle = '出入库任务'
  247. }
  248. } else if (this.taskInfo[i].businessType == 'acquisition') {
  249. if (this.taskInfo[i].businessCode == 'PAYMENT-MANAGEMENT-APPROVE') {
  250. this.taskInfo[i].messageTitle = '付款管理'
  251. }
  252. } else if (this.taskInfo[i].businessType == 'REPORT') {
  253. if (this.taskInfo[i].businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  254. this.taskInfo[i].messageTitle = '采购平仓统计'
  255. }
  256. if (this.taskInfo[i].businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  257. this.taskInfo[i].messageTitle = '采购入库统计'
  258. }
  259. if (this.taskInfo[i].businessCode == 'SALE-CLOSE-REPORT') {
  260. this.taskInfo[i].messageTitle = '销售平仓统计'
  261. }
  262. if (this.taskInfo[i].businessCode == 'SALE-RECEIPT-REPORT') {
  263. this.taskInfo[i].messageTitle = '销售入库统计'
  264. }
  265. if (this.taskInfo[i].businessCode == 'TRANSPORTATION-SETTLEMENT-REPORT') {
  266. this.taskInfo[i].messageTitle = '运输结算统计'
  267. }
  268. } else if (this.taskInfo[i].businessType == 'PROCUREMENT') {
  269. if (this.taskInfo[i].businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  270. this.taskInfo[i].messageTitle = '采购订单'
  271. }
  272. } else if (this.taskInfo[i].businessType == 'SALE') {
  273. if (this.taskInfo[i].businessCode == 'SALE-ORDER-APPROVE') {
  274. this.taskInfo[i].messageTitle = '销售订单'
  275. }
  276. } else if (this.taskInfo[i].businessType == 'PROCUREMENT') {
  277. if (this.taskInfo[i].businessCode == 'PROCUREMENT-PRICE-APPROVE') {
  278. this.taskInfo[i].messageTitle = '仓库设置'
  279. }
  280. } else if (this.taskInfo[i].businessType == 'Tran') {
  281. if (this.taskInfo[i].businessCode == 'TRAN-TASK-APPROVE') {
  282. this.taskInfo[i].messageTitle = '运费设置'
  283. }
  284. }
  285. }
  286. if (res.data.data.records.length == 0) {
  287. that.isSole = true
  288. } else {
  289. that.isSole = false
  290. }
  291. if (res.data.data.records.length == 0 && this.data.currentPage == 1 && this.statusFlag ==
  292. 3 ||
  293. res.data.data.records.length == 0 && this.warehouseInOutInfo.currentPage == 1 && this
  294. .statusFlag == 1) {
  295. console.log()
  296. this.taskInfo = []
  297. }
  298. uni.hideLoading()
  299. } else {
  300. uni.hideLoading()
  301. uni.showToast({
  302. title: "系统异常,请联系管理员",
  303. icon: 'none',
  304. duration: 2000
  305. })
  306. }
  307. }).catch(res => {
  308. uni.hideLoading()
  309. uni.showToast({
  310. title: "Session失效,请重新登录",
  311. icon: 'none',
  312. duration: 2000
  313. })
  314. })
  315. },
  316. tabcarchange(statusFlag) {
  317. this.statusFlag = statusFlag
  318. this.pageSize = 1
  319. this.getIndexBuyData(statusFlag)
  320. },
  321. navToDetailPage(item) {
  322. if (item.businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  323. uni.navigateTo({
  324. url: '/pages/task/procurement_details?id=' + item.businessId
  325. })
  326. } else if (item.businessCode == 'SALE-ORDER-APPROVE') {
  327. uni.navigateTo({
  328. url: '/pages/task/sale_details?id=' + item.businessId
  329. })
  330. }
  331. else if (item.businessCode == 'SALE-CONTRACT-APPROVE') {
  332. uni.navigateTo({
  333. url: '/pages/task/audit/salecontract?id=' + item.businessId
  334. })
  335. }else if (item.businessCode == 'BUY-CONTRACT-APPROVE') {
  336. uni.navigateTo({
  337. url: '/pages/task/audit/purchasecontract?id=' + item.businessId
  338. })
  339. } else if (item.businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  340. uni.navigateTo({
  341. url: '/pages/task/procurement_report_details?id=' + item.businessId
  342. })
  343. } else if (item.businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  344. uni.navigateTo({
  345. url: '/pages/task/procurement_close_details?id=' + item.businessId
  346. })
  347. } else if (item.businessCode == 'SALE-RECEIPT-REPORT') {
  348. uni.navigateTo({
  349. url: '/pages/task/sale_report_details?id=' + item.businessId
  350. })
  351. } else if (item.businessCode == 'SALE-CLOSE-REPORT') {
  352. uni.navigateTo({
  353. url: '/pages/task/sale_close_details?id=' + item.businessId
  354. })
  355. } else if (item.businessCode == 'PROCUREMENT-PRICE-APPROVE') {
  356. if(this.statusFlag==1){
  357. uni.navigateTo({
  358. url: `/pages/task/audit/warehouse_approval?id=${item.businessId}`
  359. })
  360. }else{
  361. uni.navigateTo({
  362. url: '/pages/task/audit/warehouse_details/?id=' + item.businessId
  363. })
  364. }
  365. } else if (item.businessCode == 'PAYMENT-MANAGEMENT-APPROVE') {
  366. if(this.statusFlag==1){
  367. uni.navigateTo({
  368. url: `/pages/task/audit/acquisition_settlement_approval?id=${item.businessId}`
  369. })
  370. }else{
  371. uni.navigateTo({
  372. url: '/pages/task/audit/acquisition_settlement_details/?id=' + item.businessId
  373. })
  374. }
  375. }else if (item.businessCode == 'INOUTTASK-TASK-APPROVE') {
  376. if (this.statusFlag == 1) {
  377. uni.navigateTo({
  378. url: `/pages/task/audit/Issueandreceipt_task_approval?id=` + item.businessId
  379. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  380. })
  381. } else {
  382. uni.navigateTo({
  383. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  384. url: `/pages/task/audit/Issueandreceipt_task_details?id=` + item.businessId
  385. })
  386. }
  387. }else if (item.businessCode == 'STOCK-PROCUREMENT-RECEIPT-REPORT') {
  388. if (this.statusFlag == 1) {
  389. uni.navigateTo({
  390. url: `/pages/task/audit/purchase_settlement_approval?id=` + item.businessId
  391. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  392. })
  393. } else {
  394. uni.navigateTo({
  395. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  396. url: `/pages/task/audit/purchase_settlement_details?id=` + item.businessId
  397. })
  398. }
  399. }else if (item.businessCode == 'TRANSPORTATION-SETTLEMENT-REPORT') {
  400. if (this.statusFlag == 1) {
  401. uni.navigateTo({
  402. url: `/pages/task/audit/freight_settlement_approval?id=` + item.businessId
  403. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  404. })
  405. } else {
  406. uni.navigateTo({
  407. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  408. url: `/pages/task/audit/freight_settlement_details?id=` + item.businessId + '&compId=' + this
  409. .pcUserInfo.compId
  410. })
  411. }
  412. }else if (item.businessCode == 'TRAN-TASK-APPROVE') {
  413. if (this.statusFlag == 1) {
  414. uni.navigateTo({
  415. url: `/pages/task/audit/freight_setting_approval?id=` + item.businessId
  416. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  417. })
  418. } else {
  419. uni.navigateTo({
  420. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  421. url: `/pages/task/audit/freight_setting_details?id=` + item.businessId
  422. })
  423. }
  424. }
  425. if (item.taskType == "入库任务") {
  426. if (item.statusFlag == 3) {
  427. uni.navigateTo({
  428. url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  429. })
  430. } else {
  431. uni.navigateTo({
  432. url: `/pageD/warehousings/warehousings?id=${item.id}&goodsName=${item.goodsName}&contractNo=${item.contractNo}&startWeight=${item.startWeight}&carNo=${item.carNo}&tranCarNo=${item.tranCarNo}&warehouseName=${item.warehouseName}&addressUrl=${item.addressUrl}&inOutDate=${item.inOutDate}&binNumber=${item.binNumber}`
  433. })
  434. }
  435. } else if (item.taskType == "出库任务") {
  436. if (item.statusFlag == 3) {
  437. uni.navigateTo({
  438. url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  439. })
  440. } else {
  441. uni.navigateTo({
  442. url: `/pageD/warehousings/ex_warehouse?id=${item.id}&goodsName=${item.goodsName}&contractNo=${item.contractNo}&consignee=${item.consignee}&carNo=${item.carNo}&tranCarNo=${item.tranCarNo}&boxNo=${item.boxNo}&titleNo=${item.titleNo}`
  443. })
  444. }
  445. }
  446. }
  447. }
  448. }
  449. </script>
  450. <style lang="scss" scoped>
  451. .tag {
  452. background: #F5F6F9;
  453. padding: 5px;
  454. color: #333333;
  455. display: inline-flex;
  456. font-size: 22rpx;
  457. border-radius: 3px;
  458. margin: 3px;
  459. }
  460. .introduce-section{
  461. // background: red;
  462. }
  463. .introduce-section .title_b .title-tip {
  464. font-size: 13px;
  465. height: 40px;
  466. line-height: 40px;
  467. flex: 2.5;
  468. }
  469. .introduce-section .title_b .title {
  470. font-size: 13px;
  471. height: 40px;
  472. flex: 2.5;
  473. }
  474. .introduce-section .title_b .title-tip-b {
  475. flex: 1;
  476. font-size: 13px;
  477. color: #878C9C;
  478. height: 40px;
  479. line-height: 40px;
  480. }
  481. .introduce-section .title {
  482. justify-content: space-between;
  483. align-items: flex-start;
  484. }
  485. .introduce-section .title text {
  486. font-size: 28rpx;
  487. }
  488. .introduce-section .title .title-tip {
  489. flex: 1;
  490. font-size: 28rpx;
  491. color: #FE6430;
  492. font-weight: 500;
  493. height: 50px;
  494. line-height: 50px;
  495. border-bottom: 1px solid #EEEEEE;
  496. }
  497. .introduce-section .title .title-tip-a {
  498. flex: 1;
  499. font-size: 15px;
  500. color: #AFB3BF;
  501. font-weight: 500;
  502. height: 50px;
  503. line-height: 50px;
  504. border-bottom: 1px solid #EEEEEE;
  505. }
  506. .introduce-section .guess-item {
  507. border-radius: 10rpx;
  508. background: #fff;
  509. padding: 32rpx;
  510. margin: 20rpx;
  511. }
  512. .line {
  513. display: inline-block;
  514. padding: 5px;
  515. position: relative;
  516. font-size: 17px;
  517. }
  518. .line.active {
  519. font-size: 19px;
  520. font-weight: 900;
  521. }
  522. .line.active:after {
  523. content: '';
  524. display: block;
  525. position: absolute;
  526. width: 18px;
  527. left: 50%;
  528. transform: translateX(-50%);
  529. bottom: 0;
  530. border-bottom: 3px solid #22C572;
  531. }
  532. /deep/.u-action-active {
  533. margin-right: 6px;
  534. }
  535. .content1-top{
  536. background: white;
  537. padding: 20rpx;
  538. border-radius: 0 0 30rpx 30rpx;
  539. }
  540. .search-form{
  541. margin-bottom: 20rpx;
  542. }
  543. .title-row1{
  544. font-size: 34rpx;
  545. }
  546. .row2{
  547. margin-top: 55rpx;
  548. }
  549. </style>