my_task.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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="title-tip-a" v-if="statusFlag==3">已完成</view>
  18. <view class="title-tip" v-if="statusFlag==1">未完成</view> -->
  19. <view class='line'>2021-06-30 11:11:22</view>
  20. </view>
  21. <view class="flex title_b">
  22. <view class="title">
  23. {{item.messageContent}}
  24. </view>
  25. </view>
  26. <u-tag :text="item.taskType" type="success" v-if="item.taskType == '出库任务'" />
  27. <u-tag :text="item.taskType" type="primary" v-if="item.taskType == '入库任务'" />
  28. </view>
  29. <view v-show="isSole">
  30. <uni-load-more :status="loadStatus"></uni-load-more>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. mapState
  38. } from 'vuex';
  39. export default {
  40. name: "task",
  41. data() {
  42. return {
  43. PageCur: "task",
  44. taskInfo: [],
  45. pages: 1, //页数
  46. limit: 10, //每次取条目数
  47. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  48. isLoadMore: false, //是否加载中
  49. isSole: false,
  50. showTran: true,
  51. scrollTop: 0,
  52. isContent: true,
  53. statusFlag: 1,
  54. current: 1,
  55. pcUserInfo: {},
  56. warehouseInOutInfo: {
  57. pageSize: 10,
  58. currentPage: 1
  59. },
  60. data: {
  61. pageSize: 10,
  62. currentPage: 1
  63. },
  64. keyword: ""
  65. };
  66. },
  67. computed: {
  68. ...mapState(['hasLogin', 'userInfo'])
  69. },
  70. onShow() {
  71. debugger
  72. this.warehouseInOutInfo.currentPage = 1
  73. this.data.currentPage = 1
  74. this.taskInfo = []
  75. this.pcUserInfo = uni.getStorageSync("pcUserInfo")
  76. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  77. console.log("checkSession", res)
  78. if (res.data.data == "INVALID") {
  79. uni.showModal({
  80. title: '登录提示',
  81. content: 'Session过期需要重新登录,是否立即登录?',
  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()
  173. }
  174. }).catch(res => {
  175. uni.showToast({
  176. title: res.data.message,
  177. icon: 'none',
  178. duration: 2000
  179. })
  180. uni.hideLoading()
  181. })
  182. },
  183. getIndexBuyData(status) {
  184. const that = this
  185. var pages = that.pages
  186. var limit = that.limit
  187. var url = ''
  188. uni.showLoading({
  189. title: "正在加载"
  190. })
  191. var data = {}
  192. if (this.statusFlag == 1) {
  193. data = this.warehouseInOutInfo
  194. url = '/noticeTask/query/noticeTasks'
  195. } else {
  196. data = this.data
  197. url = '/commonUser/query/findHisPageNoticeTasks'
  198. }
  199. //this.warehouseInOutInfo.status = this.status
  200. this.$api.doRequest('get', url, data).then(res => {
  201. if (res.data.code == 200) {
  202. let data = res.data.data.records
  203. //采购信息
  204. if (data.length > 0) {
  205. if (status) {
  206. that.taskInfo = data
  207. } else {
  208. that.taskInfo = that.taskInfo.concat(data)
  209. }
  210. } else {
  211. if (that.pages > 1) {
  212. that.pages -= 1
  213. }
  214. that.isLoadMore = false
  215. that.loadStatus = 'nomore'
  216. }
  217. for (var i = 0; i < this.taskInfo.length; i++) {
  218. if (this.taskInfo[i].businessType == 'WAREHOUSE') {
  219. if (this.taskInfo[i].businessCode == 'INOUTTASK-TASK-APPROVE') {
  220. this.taskInfo[i].messageTitle = '出入库任务'
  221. }
  222. } else if (this.taskInfo[i].businessType == 'REPORT') {
  223. if (this.taskInfo[i].businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  224. this.taskInfo[i].messageTitle = '仓库设置'
  225. } else if (this.taskInfo[i].businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  226. this.taskInfo[i].messageTitle = '运费设置'
  227. } else if (this.taskInfo[i].businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  228. this.taskInfo[i].messageTitle = '运费结算'
  229. } else if (this.taskInfo[i].businessCode == 'SALE-RECEIPT-REPORT') {
  230. this.taskInfo[i].messageTitle = '收购结算'
  231. } else if (this.taskInfo[i].businessCode == 'SALE-CLOSE-REPORT') {
  232. this.taskInfo[i].messageTitle = '采购结算'
  233. }
  234. } else if (this.taskInfo[i].businessType == 'PROCUREMENT') {
  235. if (this.taskInfo[i].businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  236. this.taskInfo[i].messageTitle = '入库任务'
  237. }
  238. } else if (this.taskInfo[i].businessType == 'PROCUREMENT') {
  239. if (this.taskInfo[i].businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  240. this.taskInfo[i].messageTitle = '出库任务'
  241. }
  242. }
  243. }
  244. if (res.data.data.records.length == 0) {
  245. that.isSole = true
  246. } else {
  247. that.isSole = false
  248. }
  249. if (res.data.data.records.length == 0 && this.data.currentPage == 1 && this.statusFlag ==
  250. 3 ||
  251. res.data.data.records.length == 0 && this.warehouseInOutInfo.currentPage == 1 && this
  252. .statusFlag == 1) {
  253. console.log()
  254. this.taskInfo = []
  255. }
  256. uni.hideLoading()
  257. } else {
  258. uni.hideLoading()
  259. uni.showToast({
  260. title: "系统异常,请联系管理员",
  261. icon: 'none',
  262. duration: 2000
  263. })
  264. }
  265. }).catch(res => {
  266. uni.hideLoading()
  267. uni.showToast({
  268. title: "Session失效,请重新登录",
  269. icon: 'none',
  270. duration: 2000
  271. })
  272. })
  273. },
  274. tabcarchange(statusFlag) {
  275. this.statusFlag = statusFlag
  276. this.pageSize = 1
  277. this.getIndexBuyData(1)
  278. },
  279. navToDetailPage(item) {debugger
  280. if (item.businessCode == 'PROCUREMENT-ORDER-APPROVE') {
  281. uni.navigateTo({
  282. url: '/pages/task/procurement_details?id=' + item.businessId
  283. })
  284. } else if (item.businessCode == 'SALE-ORDER-APPROVE') {
  285. uni.navigateTo({
  286. url: '/pages/task/sale_details?id=' + item.businessId
  287. })
  288. } else if (item.businessCode == 'PROCUREMENT-RECEIPT-REPORT') {
  289. uni.navigateTo({
  290. url: '/pages/task/procurement_report_details?id=' + item.businessId
  291. })
  292. } else if (item.businessCode == 'PROCUREMENT-CLOSE-REPORT') {
  293. uni.navigateTo({
  294. url: '/pages/task/procurement_close_details?id=' + item.businessId
  295. })
  296. } else if (item.businessCode == 'SALE-RECEIPT-REPORT') {
  297. uni.navigateTo({
  298. url: '/pages/task/sale_report_details?id=' + item.businessId
  299. })
  300. } else if (item.businessCode == 'SALE-CLOSE-REPORT') {
  301. uni.navigateTo({
  302. url: '/pages/task/sale_close_details?id=' + item.businessId
  303. })
  304. } else if (item.businessCode == 'INOUTTASK-TASK-APPROVE') {
  305. if (this.statusFlag == 3) {
  306. uni.navigateTo({
  307. url: '/pageD/warehousings/warehousingDetails?id=' + item.businessId + '&compId=' + this
  308. .pcUserInfo.compId
  309. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  310. })
  311. } else {
  312. uni.navigateTo({
  313. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  314. url: '/pageD/warehousings/warehousings?id=' + item.businessId + '&compId=' + this
  315. .pcUserInfo.compId
  316. })
  317. }
  318. }
  319. // if(item.taskType == "入库任务"){
  320. // if(item.statusFlag == 3){
  321. // uni.navigateTo({
  322. // url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  323. // })
  324. // }else{
  325. // uni.navigateTo({
  326. // 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}`
  327. // })
  328. // }
  329. // }else if(item.taskType == "出库任务"){
  330. // if(item.statusFlag == 3){
  331. // uni.navigateTo({
  332. // url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  333. // })
  334. // }else{
  335. // uni.navigateTo({
  336. // 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}`
  337. // })
  338. // }
  339. // }
  340. }
  341. }
  342. }
  343. </script>
  344. <style lang="scss" scoped>
  345. .tag {
  346. background: #F5F6F9;
  347. padding: 5px;
  348. color: #333333;
  349. display: inline-flex;
  350. font-size: 22rpx;
  351. border-radius: 3px;
  352. margin: 3px;
  353. }
  354. .introduce-section .title_b .title-tip {
  355. font-size: 13px;
  356. height: 40px;
  357. line-height: 40px;
  358. flex: 2.5;
  359. }
  360. .introduce-section .title_b .title {
  361. font-size: 13px;
  362. height: 40px;
  363. padding: 10px 0;
  364. flex: 2.5;
  365. }
  366. .introduce-section .title_b .title-tip-b {
  367. flex: 1;
  368. font-size: 13px;
  369. color: #878C9C;
  370. height: 40px;
  371. line-height: 40px;
  372. }
  373. .introduce-section .title {
  374. justify-content: space-between;
  375. }
  376. .introduce-section .title text {
  377. font-size: 17px;
  378. font-weight: bold;
  379. height: 50px;
  380. line-height: 50px;
  381. }
  382. .introduce-section .title .title-tip {
  383. flex: 1;
  384. font-size: 15px;
  385. color: #FE6430;
  386. font-weight: 500;
  387. height: 50px;
  388. line-height: 50px;
  389. border-bottom: 1px solid #EEEEEE;
  390. }
  391. .introduce-section .title .title-tip-a {
  392. flex: 1;
  393. font-size: 15px;
  394. color: #AFB3BF;
  395. font-weight: 500;
  396. height: 50px;
  397. line-height: 50px;
  398. border-bottom: 1px solid #EEEEEE;
  399. }
  400. .introduce-section .guess-item {
  401. border-radius: 4px;
  402. background: #fff;
  403. padding: 0upx 30upx 20upx;
  404. margin: 10px;
  405. padding-bottom: 20upx;
  406. border-bottom: 1px solid #ccc;
  407. }
  408. .line {
  409. display: inline-block;
  410. padding: 5px;
  411. position: relative;
  412. font-size: 17px;
  413. }
  414. .line.active {
  415. font-size: 19px;
  416. font-weight: 900;
  417. }
  418. .line.active:after {
  419. content: '';
  420. display: block;
  421. position: absolute;
  422. width: 18px;
  423. left: 50%;
  424. transform: translateX(-50%);
  425. bottom: 0;
  426. border-bottom: 1px solid #22C572;
  427. }
  428. /deep/.u-action-active {
  429. margin-right: 6px;
  430. }
  431. </style>