my_task.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <template name="task">
  2. <view class="content">
  3. <view class="cu-bar search bg-white">
  4. <view class="search-form round" v-hasPermission="'acquisitionPay.view11'">
  5. <u-search placeholder="请输入合同编号、车牌号或派车编号" v-model="keyword" @search="searchKeyWord()"
  6. @custom="searchKeyWord()"></u-search>
  7. </view>
  8. </view>
  9. <view style='background:#fff;padding:0 15px;'>
  10. <view @click='tabcarchange(1)' class='line' :class='statusFlag==1?"active":""'>未完成</view>
  11. <view @click='tabcarchange(3)' class='line' :class='statusFlag==3?"active":""'>已完成</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>{{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">
  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: 10, //每次取条目数
  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. if (this.statusFlag == 1) {
  103. this.warehouseInOutInfo.currentPage += 1
  104. } else {
  105. this.data.currentPage += 1
  106. }
  107. this.getIndexBuyData()
  108. }
  109. },
  110. // onLoad(options) {
  111. // this.getIndexBuyData()
  112. // },
  113. filters: {
  114. formatDate(date) {
  115. var date = new Date(date)
  116. var time = new Date()
  117. var newdate = ''
  118. if (time.getMonth() + 1 >= 10) {
  119. newdate = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate()
  120. } else {
  121. newdate = time.getFullYear() + '-0' + (time.getMonth() + 1) + '-' + time.getDate()
  122. }
  123. //把时间戳改为yyyy-MM-dd格式
  124. //判断是否今天
  125. var datatime = ''
  126. if (date.getMonth() + 1 >= 10) {
  127. datatime = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  128. } else {
  129. datatime = date.getFullYear() + '-0' + (date.getMonth() + 1) + '-' + date.getDate()
  130. }
  131. if (datatime == newdate) {
  132. var h = date.getHours();
  133. h = h < 10 ? '0' + h : h;
  134. var m = date.getMinutes();
  135. m = m < 10 ? '0' + m : m;
  136. var s = date.getSeconds();
  137. s = s < 10 ? '0' + s : s;
  138. return h + ':' + m + ':' + s;
  139. } else {
  140. if (date.getMonth() + 1 >= 10) {
  141. return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  142. } else {
  143. return date.getFullYear() + '-0' + (date.getMonth() + 1) + '-' + date.getDate()
  144. }
  145. }
  146. let o = {
  147. 'Y': date.getFullYear(),
  148. 'M+': date.getMonth() + 1,
  149. 'd+': date.getDate(),
  150. }
  151. },
  152. },
  153. methods: {
  154. searchKeyWord() {
  155. if (!this.keyword) {
  156. this.$api.msg('关键字不能为空')
  157. }
  158. uni.showLoading({
  159. title: "正在加载"
  160. })
  161. this.$api.doRequest('get', '/warehouseInOutInfo/selectInfoByKeyWord', this.warehouseInOutInfo).then(
  162. res => {
  163. if (res.data.code == 200) {
  164. this.taskInfo = res.data.data
  165. uni.hideLoading()
  166. } else {
  167. uni.showToast({
  168. title: res.data.message,
  169. icon: 'none',
  170. duration: 2000
  171. })
  172. uni.hideLoading(this.taskInfo,"信息")
  173. }
  174. console.log()
  175. }).catch(res => {
  176. uni.showToast({
  177. title: res.data.message,
  178. icon: 'none',
  179. duration: 2000
  180. })
  181. uni.hideLoading()
  182. })
  183. },
  184. getIndexBuyData(status) {
  185. const that = this
  186. var pages = that.pages
  187. var limit = that.limit
  188. var url = ''
  189. uni.showLoading({
  190. title: "正在加载"
  191. })
  192. var data = {}
  193. if (this.statusFlag == 1) {
  194. data = this.warehouseInOutInfo
  195. url = '/noticeTask/query/noticeTasks'
  196. } else {
  197. data = this.data
  198. url = '/commonUser/query/findHisPageNoticeTasks'
  199. }
  200. data.currentPage = pages
  201. data.pageSize = limit
  202. //this.warehouseInOutInfo.status = this.status
  203. this.$api.doRequest('get', url, data).then(res => {
  204. if (res.data.code == 200) {
  205. let data = res.data.data.records
  206. //采购信息
  207. if (data.length > 0) {
  208. if (status) {
  209. that.taskInfo = data
  210. } else {
  211. that.taskInfo = that.taskInfo.concat(data)
  212. }
  213. } else {
  214. if (that.pages > 1) {
  215. that.pages -= 1
  216. }
  217. that.isLoadMore = false
  218. that.loadStatus = 'nomore'
  219. }
  220. for (var i = 0; i < this.taskInfo.length; i++) {
  221. this.taskInfo[i].department=this.taskInfo[i].messageContent.split(' ')[0]
  222. if (this.taskInfo[i].businessType == 'WAREHOUSE') {
  223. if (this.taskInfo[i].businessCode == 'INOUTTASK-TASK-APPROVE') {
  224. this.taskInfo[i].messageTitle = '出入库任务'
  225. }
  226. } else if (this.taskInfo[i].businessType == 'acquisition') {
  227. if (this.taskInfo[i].businessCode == 'PAYMENT-MANAGEMENT-APPROVE') {
  228. this.taskInfo[i].messageTitle = '付款管理'
  229. }
  230. } else if (this.taskInfo[i].businessType == 'REPORT') {
  231. if (this.taskInfo[i].businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  232. this.taskInfo[i].messageTitle = '采购平仓统计'
  233. }
  234. if (this.taskInfo[i].businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  235. this.taskInfo[i].messageTitle = '采购入库统计'
  236. }
  237. if (this.taskInfo[i].businessCode == 'SALE-CLOSE-REPORT') {
  238. this.taskInfo[i].messageTitle = '销售平仓统计'
  239. }
  240. if (this.taskInfo[i].businessCode == 'SALE-RECEIPT-REPORT') {
  241. this.taskInfo[i].messageTitle = '销售入库统计'
  242. }
  243. if (this.taskInfo[i].businessCode == 'TRANSPORTATION-SETTLEMENT-REPORT') {
  244. this.taskInfo[i].messageTitle = '运输结算统计'
  245. }
  246. } else if (this.taskInfo[i].businessType == 'PROCUREMENT') {
  247. if (this.taskInfo[i].businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  248. this.taskInfo[i].messageTitle = '采购订单'
  249. }
  250. } else if (this.taskInfo[i].businessType == 'SALE') {
  251. if (this.taskInfo[i].businessCode == 'SALE-ORDER-APPROVE') {
  252. this.taskInfo[i].messageTitle = '销售订单'
  253. }
  254. } else if (this.taskInfo[i].businessType == 'PROCUREMENT') {
  255. if (this.taskInfo[i].businessCode == 'PROCUREMENT-PRICE-APPROVE') {
  256. this.taskInfo[i].messageTitle = '仓库设置'
  257. }
  258. } else if (this.taskInfo[i].businessType == 'Tran') {
  259. if (this.taskInfo[i].businessCode == 'TRAN-TASK-APPROVE') {
  260. this.taskInfo[i].messageTitle = '运费设置'
  261. }
  262. }
  263. }
  264. if (res.data.data.records.length == 0) {
  265. that.isSole = true
  266. } else {
  267. that.isSole = false
  268. }
  269. if (res.data.data.records.length == 0 && this.data.currentPage == 1 && this.statusFlag ==
  270. 3 ||
  271. res.data.data.records.length == 0 && this.warehouseInOutInfo.currentPage == 1 && this
  272. .statusFlag == 1) {
  273. console.log()
  274. this.taskInfo = []
  275. }
  276. uni.hideLoading()
  277. } else {
  278. uni.hideLoading()
  279. uni.showToast({
  280. title: "系统异常,请联系管理员",
  281. icon: 'none',
  282. duration: 2000
  283. })
  284. }
  285. }).catch(res => {
  286. uni.hideLoading()
  287. uni.showToast({
  288. title: "Session失效,请重新登录",
  289. icon: 'none',
  290. duration: 2000
  291. })
  292. })
  293. },
  294. tabcarchange(statusFlag) {
  295. this.statusFlag = statusFlag
  296. this.pageSize = 1
  297. this.getIndexBuyData(statusFlag)
  298. },
  299. navToDetailPage(item) {
  300. if (item.businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  301. uni.navigateTo({
  302. url: '/pages/task/procurement_details?id=' + item.businessId
  303. })
  304. } else if (item.businessCode == 'SALE-ORDER-APPROVE') {
  305. uni.navigateTo({
  306. url: '/pages/task/sale_details?id=' + item.businessId
  307. })
  308. } else if (item.businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  309. uni.navigateTo({
  310. url: '/pages/task/procurement_report_details?id=' + item.businessId
  311. })
  312. } else if (item.businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  313. uni.navigateTo({
  314. url: '/pages/task/procurement_close_details?id=' + item.businessId
  315. })
  316. } else if (item.businessCode == 'SALE-RECEIPT-REPORT') {
  317. uni.navigateTo({
  318. url: '/pages/task/sale_report_details?id=' + item.businessId
  319. })
  320. } else if (item.businessCode == 'SALE-CLOSE-REPORT') {
  321. uni.navigateTo({
  322. url: '/pages/task/sale_close_details?id=' + item.businessId
  323. })
  324. } else if (item.businessCode == 'PROCUREMENT-PRICE-APPROVE') {
  325. if(this.statusFlag==1){
  326. uni.navigateTo({
  327. url: `/pages/task/audit/warehouse_approval?id=${item.businessId}`
  328. })
  329. }else{
  330. uni.navigateTo({
  331. url: '/pages/task/audit/warehouse_details/?id=' + item.businessId
  332. })
  333. }
  334. } else if (item.businessCode == 'PAYMENT-MANAGEMENT-APPROVE') {
  335. if(this.statusFlag==1){
  336. uni.navigateTo({
  337. url: `/pages/task/audit/acquisition_settlement_approval?id=${item.businessId}`
  338. })
  339. }else{
  340. uni.navigateTo({
  341. url: '/pages/task/audit/acquisition_settlement_details/?id=' + item.businessId
  342. })
  343. }
  344. }else if (item.businessCode == 'INOUTTASK-TASK-APPROVE') {
  345. if (this.statusFlag == 1) {
  346. uni.navigateTo({
  347. url: `/pages/task/audit/Issueandreceipt_task_approval?id=` + item.businessId
  348. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  349. })
  350. } else {
  351. uni.navigateTo({
  352. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  353. url: `/pages/task/audit/Issueandreceipt_task_details?id=` + item.businessId + '&compId=' + this
  354. .pcUserInfo.compId
  355. })
  356. }
  357. }else if (item.businessCode == 'STOCK-PROCUREMENT-RECEIPT-REPORT') {
  358. if (this.statusFlag == 1) {
  359. uni.navigateTo({
  360. url: `/pages/task/audit/purchase_settlement_approval?id=` + item.businessId
  361. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  362. })
  363. } else {
  364. uni.navigateTo({
  365. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  366. url: `/pages/task/audit/purchase_settlement_details?id=` + item.businessId + '&compId=' + this
  367. .pcUserInfo.compId
  368. })
  369. }
  370. }else if (item.businessCode == 'TRANSPORTATION-SETTLEMENT-REPORT') {
  371. if (this.statusFlag == 1) {
  372. uni.navigateTo({
  373. url: `/pages/task/audit/freight_settlement_approval?id=` + item.businessId
  374. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  375. })
  376. } else {
  377. uni.navigateTo({
  378. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  379. url: `/pages/task/audit/freight_settlement_details?id=` + item.businessId + '&compId=' + this
  380. .pcUserInfo.compId
  381. })
  382. }
  383. }else if (item.businessCode == 'TRAN-TASK-APPROVE') {
  384. if (this.statusFlag == 1) {
  385. uni.navigateTo({
  386. url: `/pages/task/audit/freight_setting_approval?id=` + item.businessId
  387. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  388. })
  389. } else {
  390. uni.navigateTo({
  391. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  392. url: `/pages/task/audit/freight_setting_details?id=` + item.businessId
  393. })
  394. }
  395. }
  396. if (item.taskType == "入库任务") {
  397. if (item.statusFlag == 3) {
  398. uni.navigateTo({
  399. url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  400. })
  401. } else {
  402. uni.navigateTo({
  403. 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}`
  404. })
  405. }
  406. } else if (item.taskType == "出库任务") {
  407. if (item.statusFlag == 3) {
  408. uni.navigateTo({
  409. url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  410. })
  411. } else {
  412. uni.navigateTo({
  413. 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}`
  414. })
  415. }
  416. }
  417. }
  418. }
  419. }
  420. </script>
  421. <style lang="scss" scoped>
  422. .tag {
  423. background: #F5F6F9;
  424. padding: 5px;
  425. color: #333333;
  426. display: inline-flex;
  427. font-size: 22rpx;
  428. border-radius: 3px;
  429. margin: 3px;
  430. }
  431. .introduce-section .title_b .title-tip {
  432. font-size: 13px;
  433. height: 40px;
  434. line-height: 40px;
  435. flex: 2.5;
  436. }
  437. .introduce-section .title_b .title {
  438. font-size: 13px;
  439. height: 40px;
  440. padding: 10px 0;
  441. flex: 2.5;
  442. }
  443. .introduce-section .title_b .title-tip-b {
  444. flex: 1;
  445. font-size: 13px;
  446. color: #878C9C;
  447. height: 40px;
  448. line-height: 40px;
  449. }
  450. .introduce-section .title {
  451. justify-content: space-between;
  452. }
  453. .introduce-section .title text {
  454. font-size: 14px;
  455. height: 50px;
  456. line-height: 50px;
  457. }
  458. .introduce-section .title .title-tip {
  459. flex: 1;
  460. font-size: 15px;
  461. color: #FE6430;
  462. font-weight: 500;
  463. height: 50px;
  464. line-height: 50px;
  465. border-bottom: 1px solid #EEEEEE;
  466. }
  467. .introduce-section .title .title-tip-a {
  468. flex: 1;
  469. font-size: 15px;
  470. color: #AFB3BF;
  471. font-weight: 500;
  472. height: 50px;
  473. line-height: 50px;
  474. border-bottom: 1px solid #EEEEEE;
  475. }
  476. .introduce-section .guess-item {
  477. border-radius: 10px;
  478. background: #fff;
  479. padding: 30upx 30upx 80upx;
  480. margin: 10px;
  481. }
  482. .line {
  483. display: inline-block;
  484. padding: 5px;
  485. position: relative;
  486. font-size: 17px;
  487. }
  488. .line.active {
  489. font-size: 19px;
  490. font-weight: 900;
  491. }
  492. .line.active:after {
  493. content: '';
  494. display: block;
  495. position: absolute;
  496. width: 18px;
  497. left: 50%;
  498. transform: translateX(-50%);
  499. bottom: 0;
  500. border-bottom: 1px solid #22C572;
  501. }
  502. /deep/.u-action-active {
  503. margin-right: 6px;
  504. }
  505. </style>