my_task.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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">
  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: '当前登入信息验证失败,是否重新登录?',
  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. if (item.businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  293. uni.navigateTo({
  294. url: '/pages/task/procurement_details?id=' + item.businessId
  295. })
  296. } else if (item.businessCode == 'SALE-ORDER-APPROVE') {
  297. uni.navigateTo({
  298. url: '/pages/task/sale_details?id=' + item.businessId
  299. })
  300. } else if (item.businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  301. uni.navigateTo({
  302. url: '/pages/task/procurement_report_details?id=' + item.businessId
  303. })
  304. } else if (item.businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  305. uni.navigateTo({
  306. url: '/pages/task/procurement_close_details?id=' + item.businessId
  307. })
  308. } else if (item.businessCode == 'SALE-RECEIPT-REPORT') {
  309. uni.navigateTo({
  310. url: '/pages/task/sale_report_details?id=' + item.businessId
  311. })
  312. } else if (item.businessCode == 'SALE-CLOSE-REPORT') {
  313. uni.navigateTo({
  314. url: '/pages/task/sale_close_details?id=' + item.businessId
  315. })
  316. } else if (item.businessCode == 'PROCUREMENT-PRICE-APPROVE') {
  317. if(this.statusFlag==1){
  318. uni.navigateTo({
  319. url: `/pages/task/audit/warehouse_approval?id=${item.businessId}`
  320. })
  321. }else{
  322. uni.navigateTo({
  323. url: '/pages/task/audit/warehouse_details/?id=' + item.businessId
  324. })
  325. }
  326. } else if (item.businessCode == 'PAYMENT-MANAGEMENT-APPROVE') {
  327. if(this.statusFlag==1){
  328. uni.navigateTo({
  329. url: `/pages/task/audit/acquisition_settlement_approval?id=${item.businessId}`
  330. })
  331. }else{
  332. uni.navigateTo({
  333. url: '/pages/task/audit/acquisition_settlement_details/?id=' + item.businessId
  334. })
  335. }
  336. }else if (item.businessCode == 'INOUTTASK-TASK-APPROVE') {
  337. if (this.statusFlag == 1) {
  338. uni.navigateTo({
  339. url: `/pages/task/audit/Issueandreceipt_task_approval?id=` + item.businessId
  340. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  341. })
  342. } else {
  343. uni.navigateTo({
  344. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  345. url: `/pages/task/audit/Issueandreceipt_task_details?id=` + item.businessId + '&compId=' + this
  346. .pcUserInfo.compId
  347. })
  348. }
  349. }else if (item.businessCode == 'STOCK-PROCUREMENT-RECEIPT-REPORT') {
  350. if (this.statusFlag == 1) {
  351. uni.navigateTo({
  352. url: `/pages/task/audit/purchase_settlement_approval?id=` + item.businessId
  353. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  354. })
  355. } else {
  356. uni.navigateTo({
  357. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  358. url: `/pages/task/audit/purchase_settlement_details?id=` + item.businessId + '&compId=' + this
  359. .pcUserInfo.compId
  360. })
  361. }
  362. }else if (item.businessCode == 'TRANSPORTATION-SETTLEMENT-REPORT') {
  363. if (this.statusFlag == 1) {
  364. uni.navigateTo({
  365. url: `/pages/task/audit/freight_settlement_approval?id=` + item.businessId
  366. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  367. })
  368. } else {
  369. uni.navigateTo({
  370. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  371. url: `/pages/task/audit/freight_settlement_details?id=` + item.businessId + '&compId=' + this
  372. .pcUserInfo.compId
  373. })
  374. }
  375. }else if (item.businessCode == 'TRAN-TASK-APPROVE') {
  376. if (this.statusFlag == 1) {
  377. uni.navigateTo({
  378. url: `/pages/task/audit/freight_setting_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/freight_setting_details?id=` + item.businessId + '&compId=' + this
  385. .pcUserInfo.compId
  386. })
  387. }
  388. }
  389. if (item.taskType == "入库任务") {
  390. if (item.statusFlag == 3) {
  391. uni.navigateTo({
  392. url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  393. })
  394. } else {
  395. uni.navigateTo({
  396. 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}`
  397. })
  398. }
  399. } else if (item.taskType == "出库任务") {
  400. if (item.statusFlag == 3) {
  401. uni.navigateTo({
  402. url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  403. })
  404. } else {
  405. uni.navigateTo({
  406. 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}`
  407. })
  408. }
  409. }
  410. }
  411. }
  412. }
  413. </script>
  414. <style lang="scss" scoped>
  415. .tag {
  416. background: #F5F6F9;
  417. padding: 5px;
  418. color: #333333;
  419. display: inline-flex;
  420. font-size: 22rpx;
  421. border-radius: 3px;
  422. margin: 3px;
  423. }
  424. .introduce-section .title_b .title-tip {
  425. font-size: 13px;
  426. height: 40px;
  427. line-height: 40px;
  428. flex: 2.5;
  429. }
  430. .introduce-section .title_b .title {
  431. font-size: 13px;
  432. height: 40px;
  433. padding: 10px 0;
  434. flex: 2.5;
  435. }
  436. .introduce-section .title_b .title-tip-b {
  437. flex: 1;
  438. font-size: 13px;
  439. color: #878C9C;
  440. height: 40px;
  441. line-height: 40px;
  442. }
  443. .introduce-section .title {
  444. justify-content: space-between;
  445. }
  446. .introduce-section .title text {
  447. font-size: 17px;
  448. font-weight: bold;
  449. height: 50px;
  450. line-height: 50px;
  451. }
  452. .introduce-section .title .title-tip {
  453. flex: 1;
  454. font-size: 15px;
  455. color: #FE6430;
  456. font-weight: 500;
  457. height: 50px;
  458. line-height: 50px;
  459. border-bottom: 1px solid #EEEEEE;
  460. }
  461. .introduce-section .title .title-tip-a {
  462. flex: 1;
  463. font-size: 15px;
  464. color: #AFB3BF;
  465. font-weight: 500;
  466. height: 50px;
  467. line-height: 50px;
  468. border-bottom: 1px solid #EEEEEE;
  469. }
  470. .introduce-section .guess-item {
  471. border-radius: 4px;
  472. background: #fff;
  473. padding: 0upx 30upx 20upx;
  474. margin: 10px;
  475. padding-bottom: 20upx;
  476. border-bottom: 1px solid #ccc;
  477. }
  478. .line {
  479. display: inline-block;
  480. padding: 5px;
  481. position: relative;
  482. font-size: 17px;
  483. }
  484. .line.active {
  485. font-size: 19px;
  486. font-weight: 900;
  487. }
  488. .line.active:after {
  489. content: '';
  490. display: block;
  491. position: absolute;
  492. width: 18px;
  493. left: 50%;
  494. transform: translateX(-50%);
  495. bottom: 0;
  496. border-bottom: 1px solid #22C572;
  497. }
  498. /deep/.u-action-active {
  499. margin-right: 6px;
  500. }
  501. </style>