my_task.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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. this.warehouseInOutInfo.currentPage = 1
  72. this.data.currentPage = 1
  73. this.taskInfo = []
  74. this.pcUserInfo = uni.getStorageSync("pcUserInfo")
  75. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  76. console.log("checkSession", res)
  77. if (res.data.data == "INVALID") {
  78. uni.showModal({
  79. title: '登录提示',
  80. content: 'Session过期需要重新登录,是否立即登录?',
  81. showCancel: true,
  82. confirmText: '登录',
  83. success: (e) => {
  84. if (e.confirm) {
  85. uni.navigateTo({
  86. url: '/pages/public/login'
  87. })
  88. }
  89. },
  90. fail: () => {},
  91. complete: () => {}
  92. })
  93. } else {
  94. this.getIndexBuyData()
  95. }
  96. })
  97. // this.warehouseInOutInfo.phone = this.userInfo.phone
  98. },
  99. onReachBottom() { //上拉触底函数
  100. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  101. if (this.statusFlag == 1) {
  102. this.warehouseInOutInfo.currentPage += 1
  103. } else {
  104. this.data.currentPage += 1
  105. }
  106. this.getIndexBuyData()
  107. }
  108. },
  109. // onLoad(options) {
  110. // this.getIndexBuyData()
  111. // },
  112. filters: {
  113. formatDate(date) {
  114. var date = new Date(date)
  115. var time = new Date()
  116. var newdate = ''
  117. if (time.getMonth() + 1 >= 10) {
  118. newdate = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate()
  119. } else {
  120. newdate = time.getFullYear() + '-0' + (time.getMonth() + 1) + '-' + time.getDate()
  121. }
  122. //把时间戳改为yyyy-MM-dd格式
  123. //判断是否今天
  124. var datatime = ''
  125. if (date.getMonth() + 1 >= 10) {
  126. datatime = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  127. } else {
  128. datatime = date.getFullYear() + '-0' + (date.getMonth() + 1) + '-' + date.getDate()
  129. }
  130. if (datatime == newdate) {
  131. var h = date.getHours();
  132. h = h < 10 ? '0' + h : h;
  133. var m = date.getMinutes();
  134. m = m < 10 ? '0' + m : m;
  135. var s = date.getSeconds();
  136. s = s < 10 ? '0' + s : s;
  137. return h + ':' + m + ':' + s;
  138. } else {
  139. if (date.getMonth() + 1 >= 10) {
  140. return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  141. } else {
  142. return date.getFullYear() + '-0' + (date.getMonth() + 1) + '-' + date.getDate()
  143. }
  144. }
  145. let o = {
  146. 'Y': date.getFullYear(),
  147. 'M+': date.getMonth() + 1,
  148. 'd+': date.getDate(),
  149. }
  150. },
  151. },
  152. methods: {
  153. searchKeyWord() {
  154. if (!this.keyword) {
  155. this.$api.msg('关键字不能为空')
  156. }
  157. uni.showLoading({
  158. title: "正在加载"
  159. })
  160. this.$api.doRequest('get', '/warehouseInOutInfo/selectInfoByKeyWord', this.warehouseInOutInfo).then(
  161. res => {
  162. if (res.data.code == 200) {
  163. this.taskInfo = res.data.data
  164. uni.hideLoading()
  165. } else {
  166. uni.showToast({
  167. title: res.data.message,
  168. icon: 'none',
  169. duration: 2000
  170. })
  171. uni.hideLoading()
  172. }
  173. }).catch(res => {
  174. uni.showToast({
  175. title: res.data.message,
  176. icon: 'none',
  177. duration: 2000
  178. })
  179. uni.hideLoading()
  180. })
  181. },
  182. getIndexBuyData(status) {
  183. const that = this
  184. var pages = that.pages
  185. var limit = that.limit
  186. var url = ''
  187. uni.showLoading({
  188. title: "正在加载"
  189. })
  190. var data = {}
  191. if (this.statusFlag == 1) {
  192. data = this.warehouseInOutInfo
  193. url = '/noticeTask/query/noticeTasks'
  194. } else {
  195. data = this.data
  196. url = '/commonUser/query/findHisPageNoticeTasks'
  197. }
  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(1)
  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. }
  329. else if (item.businessCode == 'INOUTTASK-TASK-APPROVE') {
  330. if (this.statusFlag == 3) {
  331. uni.navigateTo({
  332. url: '/pageD/warehousings/warehousingDetails?id=' + item.businessId + '&compId=' + this
  333. .pcUserInfo.compId
  334. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  335. })
  336. } else {
  337. uni.navigateTo({
  338. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  339. url: '/pageD/warehousings/warehousings?id=' + item.businessId + '&compId=' + this
  340. .pcUserInfo.compId
  341. })
  342. }
  343. }
  344. if (item.taskType == "入库任务") {
  345. if (item.statusFlag == 3) {
  346. uni.navigateTo({
  347. url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  348. })
  349. } else {
  350. uni.navigateTo({
  351. 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}`
  352. })
  353. }
  354. } else if (item.taskType == "出库任务") {
  355. if (item.statusFlag == 3) {
  356. uni.navigateTo({
  357. url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  358. })
  359. } else {
  360. uni.navigateTo({
  361. 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}`
  362. })
  363. }
  364. }
  365. }
  366. }
  367. }
  368. </script>
  369. <style lang="scss" scoped>
  370. .tag {
  371. background: #F5F6F9;
  372. padding: 5px;
  373. color: #333333;
  374. display: inline-flex;
  375. font-size: 22rpx;
  376. border-radius: 3px;
  377. margin: 3px;
  378. }
  379. .introduce-section .title_b .title-tip {
  380. font-size: 13px;
  381. height: 40px;
  382. line-height: 40px;
  383. flex: 2.5;
  384. }
  385. .introduce-section .title_b .title {
  386. font-size: 13px;
  387. height: 40px;
  388. padding: 10px 0;
  389. flex: 2.5;
  390. }
  391. .introduce-section .title_b .title-tip-b {
  392. flex: 1;
  393. font-size: 13px;
  394. color: #878C9C;
  395. height: 40px;
  396. line-height: 40px;
  397. }
  398. .introduce-section .title {
  399. justify-content: space-between;
  400. }
  401. .introduce-section .title text {
  402. font-size: 17px;
  403. font-weight: bold;
  404. height: 50px;
  405. line-height: 50px;
  406. }
  407. .introduce-section .title .title-tip {
  408. flex: 1;
  409. font-size: 15px;
  410. color: #FE6430;
  411. font-weight: 500;
  412. height: 50px;
  413. line-height: 50px;
  414. border-bottom: 1px solid #EEEEEE;
  415. }
  416. .introduce-section .title .title-tip-a {
  417. flex: 1;
  418. font-size: 15px;
  419. color: #AFB3BF;
  420. font-weight: 500;
  421. height: 50px;
  422. line-height: 50px;
  423. border-bottom: 1px solid #EEEEEE;
  424. }
  425. .introduce-section .guess-item {
  426. border-radius: 4px;
  427. background: #fff;
  428. padding: 0upx 30upx 20upx;
  429. margin: 10px;
  430. padding-bottom: 20upx;
  431. border-bottom: 1px solid #ccc;
  432. }
  433. .line {
  434. display: inline-block;
  435. padding: 5px;
  436. position: relative;
  437. font-size: 17px;
  438. }
  439. .line.active {
  440. font-size: 19px;
  441. font-weight: 900;
  442. }
  443. .line.active:after {
  444. content: '';
  445. display: block;
  446. position: absolute;
  447. width: 18px;
  448. left: 50%;
  449. transform: translateX(-50%);
  450. bottom: 0;
  451. border-bottom: 1px solid #22C572;
  452. }
  453. /deep/.u-action-active {
  454. margin-right: 6px;
  455. }
  456. </style>