my_task.vue 11 KB

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