my_task.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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.warehouseInOutInfo.phone = this.userInfo.phone
  78. },
  79. onReachBottom() { //上拉触底函数
  80. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  81. if(this.statusFlag==1){
  82. this.warehouseInOutInfo.currentPage += 1
  83. }else{
  84. this.data.currentPage+=1
  85. }
  86. this.getIndexBuyData()
  87. }
  88. },
  89. // onLoad(options) {
  90. // this.getIndexBuyData()
  91. // },
  92. filters: {
  93. formatDate (date) {
  94. var date=new Date(date)
  95. var time=new Date()
  96. var newdate=''
  97. if(time.getMonth() + 1>=10){
  98. newdate=time.getFullYear()+'-'+(time.getMonth()+1)+'-'+time.getDate()
  99. }else{
  100. newdate=time.getFullYear()+'-0'+(time.getMonth()+1)+'-'+time.getDate()
  101. }
  102. //把时间戳改为yyyy-MM-dd格式
  103. //判断是否今天
  104. var datatime=''
  105. if(date.getMonth() + 1>=10){
  106. datatime=date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()
  107. }else{
  108. datatime=date.getFullYear()+'-0'+(date.getMonth()+1)+'-'+date.getDate()
  109. }
  110. if(datatime == newdate){
  111. var h = date.getHours();
  112. h = h < 10 ? '0' + h : h;
  113. var m = date.getMinutes();
  114. m = m < 10 ? '0' + m : m;
  115. var s = date.getSeconds();
  116. s = s < 10 ? '0' + s : s;
  117. return h + ':' + m + ':' + s;
  118. }else{
  119. if(date.getMonth() + 1>=10){
  120. return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()
  121. }else{
  122. return date.getFullYear()+'-0'+(date.getMonth()+1)+'-'+date.getDate()
  123. }
  124. }
  125. let o = {
  126. 'Y': date.getFullYear(),
  127. 'M+': date.getMonth() + 1,
  128. 'd+': date.getDate(),
  129. }
  130. },
  131. },
  132. methods: {
  133. searchKeyWord(){
  134. if(!this.keyword){
  135. this.$api.msg('关键字不能为空')
  136. }
  137. uni.showLoading({
  138. title:"正在加载"
  139. })
  140. this.$api.doRequest('get', '/warehouseInOutInfo/selectInfoByKeyWord', this.warehouseInOutInfo).then(res => {
  141. if (res.data.code == 200) {
  142. this.taskInfo = res.data.data
  143. uni.hideLoading()
  144. } else {
  145. uni.showToast({
  146. title: res.data.message,
  147. icon: 'none',
  148. duration: 2000
  149. })
  150. uni.hideLoading()
  151. }
  152. }).catch(res => {
  153. uni.showToast({
  154. title: res.data.message,
  155. icon: 'none',
  156. duration: 2000
  157. })
  158. uni.hideLoading()
  159. })
  160. },
  161. getIndexBuyData(status) {
  162. const that = this
  163. var pages = that.pages
  164. var limit = that.limit
  165. var url=''
  166. uni.showLoading({
  167. title:"正在加载"
  168. })
  169. var data={}
  170. if(this.statusFlag==1){
  171. data=this.warehouseInOutInfo
  172. url='/noticeTask/query/noticeTasks'
  173. }else{
  174. data=this.data
  175. url='/commonUser/query/findHisPageNoticeTasks'
  176. }
  177. //this.warehouseInOutInfo.status = this.status
  178. this.$api.doRequest('get', url, data).then(res => {
  179. if (res.data.code == 200) {
  180. let data = res.data.data.records
  181. //采购信息
  182. if (data.length > 0) {
  183. if(status){
  184. that.taskInfo=data
  185. }else{
  186. that.taskInfo = that.taskInfo.concat(data)
  187. }
  188. } else {
  189. if (that.pages > 1) {
  190. that.pages -= 1
  191. }
  192. that.isLoadMore = false
  193. that.loadStatus = 'nomore'
  194. }
  195. for(var i=0;i<this.taskInfo.length;i++){
  196. if(this.taskInfo[i].businessType=='WAREHOUSE'){
  197. if(this.taskInfo[i].businessCode=='INOUTTASK-TASK-APPROVE'){
  198. this.taskInfo[i].messageTitle='出入库任务'
  199. }
  200. }else if(this.taskInfo[i].businessType=='REPORT'){
  201. if(this.taskInfo[i].businessCode=='PROCUREMENT-RECEIPT-REPORT'){
  202. this.taskInfo[i].messageTitle='采购入库统计'
  203. }else if(this.taskInfo[i].businessCode=='PROCUREMENT-CLOSE-REPORT'){
  204. this.taskInfo[i].messageTitle='采购平仓统计'
  205. }else if(this.taskInfo[i].businessCode=='SALE-RECEIPT-REPORT'){
  206. this.taskInfo[i].messageTitle='销售出库统计'
  207. }else if(this.taskInfo[i].businessCode=='SALE-CLOSE-REPORT'){
  208. this.taskInfo[i].messageTitle='销售平仓统计'
  209. }
  210. }else if(this.taskInfo[i].businessType=='PROCUREMENT'){
  211. if(this.taskInfo[i].businessCode=='PROCUREMENT-ORDER-APPROVE'){
  212. this.taskInfo[i].messageTitle='采购订单'
  213. }
  214. }else if(this.taskInfo[i].businessType=='SALE'){
  215. if(this.taskInfo[i].businessCode=='SALE-ORDER-APPROVE'){
  216. this.taskInfo[i].messageTitle='销售订单'
  217. }
  218. }
  219. }
  220. if(res.data.data.records.length==0){
  221. that.isSole=true
  222. }else{
  223. that.isSole=false
  224. }
  225. if(res.data.data.records.length==0&&this.data.currentPage==1&&this.statusFlag==3
  226. ||res.data.data.records.length==0&&this.warehouseInOutInfo.currentPage==1&&this.statusFlag==1){
  227. console.log()
  228. this.taskInfo=[]
  229. }
  230. uni.hideLoading()
  231. } else {
  232. uni.hideLoading()
  233. uni.showToast({
  234. title: "系统异常,请联系管理员",
  235. icon: 'none',
  236. duration: 2000
  237. })
  238. }
  239. }).catch(res => {
  240. uni.hideLoading()
  241. uni.showToast({
  242. title: "Session失效,请重新登录",
  243. icon: 'none',
  244. duration: 2000
  245. })
  246. })
  247. },
  248. tabcarchange(statusFlag) {
  249. this.statusFlag = statusFlag
  250. this.pageSize = 1
  251. this.getIndexBuyData(1)
  252. },
  253. navToDetailPage(item) {
  254. if(item.businessCode=='PROCUREMENT-ORDER-APPROVE'){
  255. uni.navigateTo({
  256. url:'/pages/task/procurement_details?id='+item.businessId
  257. })
  258. }else if(item.businessCode=='SALE-ORDER-APPROVE'){
  259. uni.navigateTo({
  260. url:'/pages/task/sale_details?id='+item.businessId
  261. })
  262. }else if(item.businessCode=='PROCUREMENT-RECEIPT-REPORT'){
  263. uni.navigateTo({
  264. url:'/pages/task/procurement_report_details?id='+item.businessId
  265. })
  266. }else if(item.businessCode=='PROCUREMENT-CLOSE-REPORT'){
  267. uni.navigateTo({
  268. url:'/pages/task/procurement_close_details?id='+item.businessId
  269. })
  270. }else if(item.businessCode=='SALE-RECEIPT-REPORT'){
  271. uni.navigateTo({
  272. url:'/pages/task/sale_report_details?id='+item.businessId
  273. })
  274. }else if(item.businessCode=='SALE-CLOSE-REPORT'){
  275. uni.navigateTo({
  276. url:'/pages/task/sale_close_details?id='+item.businessId
  277. })
  278. }else if(item.businessCode=='INOUTTASK-TASK-APPROVE'){
  279. if(this.statusFlag==3){
  280. uni.navigateTo({
  281. url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+this.pcUserInfo.compId
  282. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  283. })
  284. }else{
  285. uni.navigateTo({
  286. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  287. url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+this.pcUserInfo.compId
  288. })
  289. }
  290. }
  291. // if(item.taskType == "入库任务"){
  292. // if(item.statusFlag == 3){
  293. // uni.navigateTo({
  294. // url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  295. // })
  296. // }else{
  297. // uni.navigateTo({
  298. // 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}`
  299. // })
  300. // }
  301. // }else if(item.taskType == "出库任务"){
  302. // if(item.statusFlag == 3){
  303. // uni.navigateTo({
  304. // url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  305. // })
  306. // }else{
  307. // uni.navigateTo({
  308. // 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}`
  309. // })
  310. // }
  311. // }
  312. }
  313. }
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. .tag {
  318. background:#F5F6F9;
  319. padding: 5px;
  320. color:#333333;
  321. display: inline-flex;
  322. font-size: 22rpx;
  323. border-radius: 3px;
  324. margin: 3px;
  325. }
  326. .introduce-section .title_b .title-tip{
  327. font-size: 13px;
  328. height:40px;
  329. line-height: 40px;
  330. flex: 2.5;
  331. }
  332. .introduce-section .title_b .title{
  333. font-size: 13px;
  334. height:40px;
  335. padding:10px 0;
  336. flex: 2.5;
  337. }
  338. .introduce-section .title_b .title-tip-b{
  339. flex: 1;
  340. font-size: 13px;
  341. color: #878C9C;
  342. height:40px;
  343. line-height: 40px;
  344. }
  345. .introduce-section .title text{
  346. font-size: 17px;
  347. font-weight: bold;
  348. height:50px;
  349. line-height: 50px;
  350. flex: 2.5;
  351. border-bottom:1px solid #EEEEEE;
  352. }
  353. .introduce-section .title .title-tip{
  354. flex: 1;
  355. font-size: 15px;
  356. color: #FE6430;
  357. font-weight: 500;
  358. height:50px;
  359. line-height: 50px;
  360. border-bottom:1px solid #EEEEEE;
  361. }
  362. .introduce-section .title .title-tip-a{
  363. flex: 1;
  364. font-size: 15px;
  365. color: #AFB3BF;
  366. font-weight: 500;
  367. height:50px;
  368. line-height: 50px;
  369. border-bottom:1px solid #EEEEEE;
  370. }
  371. .introduce-section .guess-item{
  372. border-radius:4px;
  373. background: #fff;
  374. padding: 0upx 30upx 20upx;
  375. margin:10px;
  376. padding-bottom: 20upx;
  377. border-bottom: 1px solid #ccc;
  378. }
  379. .line{
  380. display:inline-block;
  381. padding:5px;
  382. position:relative;
  383. font-size:17px;
  384. }
  385. .line.active{
  386. font-size:19px;
  387. font-weight: 900;
  388. }
  389. .line.active:after{
  390. content:'';
  391. display:block;
  392. position:absolute;
  393. width:18px;
  394. left:50%;
  395. transform: translateX(-50%);
  396. bottom:0;
  397. border-bottom:1px solid #22C572;
  398. }
  399. /deep/.u-action-active{
  400. margin-right:6px;
  401. }
  402. </style>