my_task.vue 15 KB

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