my_task.vue 16 KB

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