my_task.vue 11 KB

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