my_task.vue 11 KB

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