my_task.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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.showToast({
  233. title: res.data.message,
  234. icon: 'none',
  235. duration: 2000
  236. })
  237. }
  238. }).catch(res => {
  239. uni.showToast({
  240. title: res.data.message,
  241. icon: 'none',
  242. duration: 2000
  243. })
  244. })
  245. },
  246. tabcarchange(statusFlag) {
  247. this.statusFlag = statusFlag
  248. this.pageSize = 1
  249. this.getIndexBuyData(1)
  250. },
  251. navToDetailPage(item) {
  252. if(item.businessCode=='PROCUREMENT-ORDER-APPROVE'){
  253. uni.navigateTo({
  254. url:'/pages/task/procurement_details?id='+item.businessId
  255. })
  256. }else if(item.businessCode=='SALE-ORDER-APPROVE'){
  257. uni.navigateTo({
  258. url:'/pages/task/sale_details?id='+item.businessId
  259. })
  260. }else if(item.businessCode=='PROCUREMENT-RECEIPT-REPORT'){
  261. uni.navigateTo({
  262. url:'/pages/task/procurement_report_details?id='+item.businessId
  263. })
  264. }else if(item.businessCode=='PROCUREMENT-CLOSE-REPORT'){
  265. uni.navigateTo({
  266. url:'/pages/task/procurement_close_details?id='+item.businessId
  267. })
  268. }else if(item.businessCode=='SALE-RECEIPT-REPORT'){
  269. uni.navigateTo({
  270. url:'/pages/task/sale_report_details?id='+item.businessId
  271. })
  272. }else if(item.businessCode=='SALE-CLOSE-REPORT'){
  273. uni.navigateTo({
  274. url:'/pages/task/sale_close_details?id='+item.businessId
  275. })
  276. }else if(item.businessCode=='INOUTTASK-TASK-APPROVE'){
  277. if(this.statusFlag==3){
  278. uni.navigateTo({
  279. url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+this.pcUserInfo.compId
  280. // url: '/pageD/warehousings/warehousingDetails?id='+item.businessId+'&compId='+item.compId
  281. })
  282. }else{
  283. uni.navigateTo({
  284. // url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+item.compId
  285. url:'/pageD/warehousings/warehousings?id='+item.businessId+'&compId='+this.pcUserInfo.compId
  286. })
  287. }
  288. }
  289. // if(item.taskType == "入库任务"){
  290. // if(item.statusFlag == 3){
  291. // uni.navigateTo({
  292. // url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  293. // })
  294. // }else{
  295. // uni.navigateTo({
  296. // 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}`
  297. // })
  298. // }
  299. // }else if(item.taskType == "出库任务"){
  300. // if(item.statusFlag == 3){
  301. // uni.navigateTo({
  302. // url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  303. // })
  304. // }else{
  305. // uni.navigateTo({
  306. // 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}`
  307. // })
  308. // }
  309. // }
  310. }
  311. }
  312. }
  313. </script>
  314. <style lang="scss" scoped>
  315. .tag {
  316. background:#F5F6F9;
  317. padding: 5px;
  318. color:#333333;
  319. display: inline-flex;
  320. font-size: 22rpx;
  321. border-radius: 3px;
  322. margin: 3px;
  323. }
  324. .introduce-section .title_b .title-tip{
  325. font-size: 13px;
  326. height:40px;
  327. line-height: 40px;
  328. flex: 2.5;
  329. }
  330. .introduce-section .title_b .title{
  331. font-size: 13px;
  332. height:40px;
  333. padding:10px 0;
  334. flex: 2.5;
  335. }
  336. .introduce-section .title_b .title-tip-b{
  337. flex: 1;
  338. font-size: 13px;
  339. color: #878C9C;
  340. height:40px;
  341. line-height: 40px;
  342. }
  343. .introduce-section .title text{
  344. font-size: 17px;
  345. font-weight: bold;
  346. height:50px;
  347. line-height: 50px;
  348. flex: 2.5;
  349. border-bottom:1px solid #EEEEEE;
  350. }
  351. .introduce-section .title .title-tip{
  352. flex: 1;
  353. font-size: 15px;
  354. color: #FE6430;
  355. font-weight: 500;
  356. height:50px;
  357. line-height: 50px;
  358. border-bottom:1px solid #EEEEEE;
  359. }
  360. .introduce-section .title .title-tip-a{
  361. flex: 1;
  362. font-size: 15px;
  363. color: #AFB3BF;
  364. font-weight: 500;
  365. height:50px;
  366. line-height: 50px;
  367. border-bottom:1px solid #EEEEEE;
  368. }
  369. .introduce-section .guess-item{
  370. border-radius:4px;
  371. background: #fff;
  372. padding: 0upx 30upx 20upx;
  373. margin:10px;
  374. padding-bottom: 20upx;
  375. border-bottom: 1px solid #ccc;
  376. }
  377. .line{
  378. display:inline-block;
  379. padding:5px;
  380. position:relative;
  381. font-size:17px;
  382. }
  383. .line.active{
  384. font-size:19px;
  385. font-weight: 900;
  386. }
  387. .line.active:after{
  388. content:'';
  389. display:block;
  390. position:absolute;
  391. width:18px;
  392. left:50%;
  393. transform: translateX(-50%);
  394. bottom:0;
  395. border-bottom:1px solid #22C572;
  396. }
  397. /deep/.u-action-active{
  398. margin-right:6px;
  399. }
  400. </style>