my_task.vue 12 KB

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