my_task.vue 13 KB

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