my_task.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  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'>2021-06-30 11:11:22</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: 'Session过期需要重新登录,是否立即登录?',
  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. //this.warehouseInOutInfo.status = this.status
  197. this.$api.doRequest('get', url, data).then(res => {
  198. if (res.data.code == 200) {
  199. let data = res.data.data.records
  200. //采购信息
  201. if (data.length > 0) {
  202. if (status) {
  203. that.taskInfo = data
  204. } else {
  205. that.taskInfo = that.taskInfo.concat(data)
  206. }
  207. } else {
  208. if (that.pages > 1) {
  209. that.pages -= 1
  210. }
  211. that.isLoadMore = false
  212. that.loadStatus = 'nomore'
  213. }
  214. for (var i = 0; i < this.taskInfo.length; i++) {
  215. if (this.taskInfo[i].businessType == 'WAREHOUSE') {
  216. if (this.taskInfo[i].businessCode == 'INOUTTASK-TASK-APPROVE') {
  217. this.taskInfo[i].messageTitle = '出入库任务'
  218. }
  219. } else if (this.taskInfo[i].businessType == 'acquisition') {
  220. if (this.taskInfo[i].businessCode == 'PAYMENT-MANAGEMENT-APPROVE') {
  221. this.taskInfo[i].messageTitle = '付款管理'
  222. }
  223. if (this.taskInfo[i].businessCode == 'PROCUREMENT-PRICE-APPROVE') {
  224. this.taskInfo[i].messageTitle = '仓库设置'
  225. }
  226. } else if (this.taskInfo[i].businessType == 'REPORT') {
  227. if (this.taskInfo[i].businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  228. this.taskInfo[i].messageTitle = '采购平仓统计'
  229. }
  230. if (this.taskInfo[i].businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  231. this.taskInfo[i].messageTitle = '采购入库统计'
  232. }
  233. if (this.taskInfo[i].businessCode == 'SALE-CLOSE-REPORT') {
  234. this.taskInfo[i].messageTitle = '销售平仓统计'
  235. }
  236. if (this.taskInfo[i].businessCode == 'SALE-RECEIPT-REPORT') {
  237. this.taskInfo[i].messageTitle = '销售入库统计'
  238. }
  239. if (this.taskInfo[i].businessCode == 'TRANSPORTATION-SETTLEMENT-REPORT') {
  240. this.taskInfo[i].messageTitle = '运输结算统计'
  241. }
  242. } else if (this.taskInfo[i].businessType == 'PROCUREMENT') {
  243. if (this.taskInfo[i].businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  244. this.taskInfo[i].messageTitle = '采购订单'
  245. }
  246. } else if (this.taskInfo[i].businessType == 'SALE') {
  247. if (this.taskInfo[i].businessCode == 'SALE-ORDER-APPROVE') {
  248. this.taskInfo[i].messageTitle = '销售订单'
  249. }
  250. } else if (this.taskInfo[i].businessType == 'TRANSPORTATIONTASK') {
  251. if (this.taskInfo[i].businessCode == 'TRAN-TASK-APPROVE') {
  252. this.taskInfo[i].messageTitle = '运费设置'
  253. }
  254. }
  255. }
  256. if (res.data.data.records.length == 0) {
  257. that.isSole = true
  258. } else {
  259. that.isSole = false
  260. }
  261. if (res.data.data.records.length == 0 && this.data.currentPage == 1 && this.statusFlag ==
  262. 3 ||
  263. res.data.data.records.length == 0 && this.warehouseInOutInfo.currentPage == 1 && this
  264. .statusFlag == 1) {
  265. console.log()
  266. this.taskInfo = []
  267. }
  268. uni.hideLoading()
  269. } else {
  270. uni.hideLoading()
  271. uni.showToast({
  272. title: "系统异常,请联系管理员",
  273. icon: 'none',
  274. duration: 2000
  275. })
  276. }
  277. }).catch(res => {
  278. uni.hideLoading()
  279. uni.showToast({
  280. title: "Session失效,请重新登录",
  281. icon: 'none',
  282. duration: 2000
  283. })
  284. })
  285. },
  286. tabcarchange(statusFlag) {
  287. this.statusFlag = statusFlag
  288. this.pageSize = 1
  289. this.getIndexBuyData(1)
  290. },
  291. navToDetailPage(item) {
  292. console.log(item.businessCode)
  293. if (item.businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  294. uni.navigateTo({
  295. url: '/pages/task/procurement_details?id=' + item.businessId
  296. })
  297. } else if (item.businessCode == 'SALE-ORDER-APPROVE') {
  298. uni.navigateTo({
  299. url: '/pages/task/sale_details?id=' + item.businessId
  300. })
  301. } else if (item.businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  302. uni.navigateTo({
  303. url: '/pages/task/procurement_report_details?id=' + item.businessId
  304. })
  305. } else if (item.businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  306. uni.navigateTo({
  307. url: '/pages/task/procurement_close_details?id=' + item.businessId
  308. })
  309. } else if (item.businessCode == 'SALE-RECEIPT-REPORT') {
  310. uni.navigateTo({
  311. url: '/pages/task/sale_report_details?id=' + item.businessId
  312. })
  313. } else if (item.businessCode == 'SALE-CLOSE-REPORT') {
  314. uni.navigateTo({
  315. url: '/pages/task/sale_close_details?id=' + item.businessId
  316. })
  317. } else if (item.businessCode == 'PROCUREMENT-PRICE-APPROVE') {
  318. if(this.statusFlag==1){
  319. uni.navigateTo({
  320. url: `/pages/task/audit/warehouse_approval?id=${item.businessId}`
  321. })
  322. }else{
  323. uni.navigateTo({
  324. url: '/pages/task/audit/warehouse_details/?id=' + item.businessId
  325. })
  326. }
  327. } else if (item.businessCode == 'PAYMENT-MANAGEMENT-APPROVE') {
  328. if(this.statusFlag==1){
  329. uni.navigateTo({
  330. url: `/pages/task/audit/acquisition_settlement_approval?id=${item.businessId}`
  331. })
  332. }else{
  333. uni.navigateTo({
  334. url: '/pages/task/audit/acquisition_settlement_details/?id=' + item.businessId
  335. })
  336. }
  337. }else if (item.businessCode == 'INOUTTASK-TASK-APPROVE') {
  338. if (this.statusFlag == 1) {
  339. uni.navigateTo({
  340. url: `/pages/task/audit/Issueandreceipt_task_approval?id=` + item.businessId
  341. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  342. })
  343. } else {
  344. uni.navigateTo({
  345. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  346. url: `/pages/task/audit/Issueandreceipt_task_details?id=` + item.businessId + '&compId=' + this
  347. .pcUserInfo.compId
  348. })
  349. }
  350. }else if (item.businessCode == 'STOCK-PROCUREMENT-RECEIPT-REPORT') {
  351. if (this.statusFlag == 1) {
  352. uni.navigateTo({
  353. url: `/pages/task/audit/purchase_settlement_approval?id=` + item.businessId
  354. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  355. })
  356. } else {
  357. uni.navigateTo({
  358. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  359. url: `/pages/task/audit/purchase_settlement_details?id=` + item.businessId + '&compId=' + this
  360. .pcUserInfo.compId
  361. })
  362. }
  363. }else if (item.businessCode == 'TRANSPORTATION-SETTLEMENT-REPORT') {
  364. if (this.statusFlag == 1) {
  365. uni.navigateTo({
  366. url: `/pages/task/audit/freight_settlement_approval?id=` + item.businessId
  367. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  368. })
  369. } else {
  370. uni.navigateTo({
  371. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  372. url: `/pages/task/audit/freight_settlement_details?id=` + item.businessId + '&compId=' + this
  373. .pcUserInfo.compId
  374. })
  375. }
  376. }else if (item.businessCode == 'TRAN-TASK-APPROVE') {
  377. if (this.statusFlag == 1) {
  378. uni.navigateTo({
  379. url: `/pages/task/audit/freight_setting_approval?id=` + item.businessId
  380. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  381. })
  382. } else {
  383. uni.navigateTo({
  384. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  385. url: `/pages/task/audit/freight_setting_details?id=` + item.businessId + '&compId=' + this
  386. .pcUserInfo.compId
  387. })
  388. }
  389. }
  390. if (item.taskType == "入库任务") {
  391. if (item.statusFlag == 3) {
  392. uni.navigateTo({
  393. url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  394. })
  395. } else {
  396. uni.navigateTo({
  397. 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}`
  398. })
  399. }
  400. } else if (item.taskType == "出库任务") {
  401. if (item.statusFlag == 3) {
  402. uni.navigateTo({
  403. url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  404. })
  405. } else {
  406. uni.navigateTo({
  407. 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}`
  408. })
  409. }
  410. }
  411. }
  412. }
  413. }
  414. </script>
  415. <style lang="scss" scoped>
  416. .tag {
  417. background: #F5F6F9;
  418. padding: 5px;
  419. color: #333333;
  420. display: inline-flex;
  421. font-size: 22rpx;
  422. border-radius: 3px;
  423. margin: 3px;
  424. }
  425. .introduce-section .title_b .title-tip {
  426. font-size: 13px;
  427. height: 40px;
  428. line-height: 40px;
  429. flex: 2.5;
  430. }
  431. .introduce-section .title_b .title {
  432. font-size: 13px;
  433. height: 40px;
  434. padding: 10px 0;
  435. flex: 2.5;
  436. }
  437. .introduce-section .title_b .title-tip-b {
  438. flex: 1;
  439. font-size: 13px;
  440. color: #878C9C;
  441. height: 40px;
  442. line-height: 40px;
  443. }
  444. .introduce-section .title {
  445. justify-content: space-between;
  446. }
  447. .introduce-section .title text {
  448. font-size: 17px;
  449. font-weight: bold;
  450. height: 50px;
  451. line-height: 50px;
  452. }
  453. .introduce-section .title .title-tip {
  454. flex: 1;
  455. font-size: 15px;
  456. color: #FE6430;
  457. font-weight: 500;
  458. height: 50px;
  459. line-height: 50px;
  460. border-bottom: 1px solid #EEEEEE;
  461. }
  462. .introduce-section .title .title-tip-a {
  463. flex: 1;
  464. font-size: 15px;
  465. color: #AFB3BF;
  466. font-weight: 500;
  467. height: 50px;
  468. line-height: 50px;
  469. border-bottom: 1px solid #EEEEEE;
  470. }
  471. .introduce-section .guess-item {
  472. border-radius: 4px;
  473. background: #fff;
  474. padding: 0upx 30upx 20upx;
  475. margin: 10px;
  476. padding-bottom: 20upx;
  477. border-bottom: 1px solid #ccc;
  478. }
  479. .line {
  480. display: inline-block;
  481. padding: 5px;
  482. position: relative;
  483. font-size: 17px;
  484. }
  485. .line.active {
  486. font-size: 19px;
  487. font-weight: 900;
  488. }
  489. .line.active:after {
  490. content: '';
  491. display: block;
  492. position: absolute;
  493. width: 18px;
  494. left: 50%;
  495. transform: translateX(-50%);
  496. bottom: 0;
  497. border-bottom: 1px solid #22C572;
  498. }
  499. /deep/.u-action-active {
  500. margin-right: 6px;
  501. }
  502. </style>