my_task.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  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. this.warehouseInOutInfo.statusFlag = this.statusFlag
  167. this.warehouseInOutInfo.phone = this.userInfo.phone
  168. this.warehouseInOutInfo.pcFlag = 0
  169. if(this.statusFlag==1){
  170. data=this.warehouseInOutInfo
  171. url='/noticeTask/query/noticeTasks'
  172. }else{
  173. data=this.data
  174. url='/commonUser/query/findHisPageNoticeTasks'
  175. }
  176. //this.warehouseInOutInfo.status = this.status
  177. this.$api.doRequest('get', url, data).then(res => {
  178. if (res.data.code == 200) {
  179. let data = res.data.data.records
  180. //采购信息
  181. if (data.length > 0) {
  182. if(status){
  183. that.taskInfo=data
  184. }else{
  185. that.taskInfo = that.taskInfo.concat(data)
  186. }
  187. } else {
  188. if (that.pages > 1) {
  189. that.pages -= 1
  190. }
  191. that.isLoadMore = false
  192. that.loadStatus = 'nomore'
  193. }
  194. for(var i=0;i<this.taskInfo.length;i++){
  195. if(this.taskInfo[i].businessType=='WAREHOUSE'){
  196. if(this.taskInfo[i].businessCode=='INOUTTASK-TASK-APPROVE'){
  197. this.taskInfo[i].messageTitle='出入库任务'
  198. }
  199. }else if(this.taskInfo[i].businessType=='REPORT'){
  200. if(this.taskInfo[i].businessCode=='PROCUREMENT-RECEIPT-REPORT'){
  201. this.taskInfo[i].messageTitle='采购入库统计'
  202. }else if(this.taskInfo[i].businessCode=='PROCUREMENT-CLOSE-REPORT'){
  203. this.taskInfo[i].messageTitle='采购平仓统计'
  204. }else if(this.taskInfo[i].businessCode=='SALE-RECEIPT-REPORT'){
  205. this.taskInfo[i].messageTitle='销售出库统计'
  206. }else if(this.taskInfo[i].businessCode=='SALE-CLOSE-REPORT'){
  207. this.taskInfo[i].messageTitle='销售平仓统计'
  208. }
  209. }else if(this.taskInfo[i].businessType=='PROCUREMENT'){
  210. if(this.taskInfo[i].businessCode=='PROCUREMENT-ORDER-APPROVE'){
  211. this.taskInfo[i].messageTitle='采购订单'
  212. }
  213. }else if(this.taskInfo[i].businessType=='SALE'){
  214. if(this.taskInfo[i].businessCode=='SALE-ORDER-APPROVE'){
  215. this.taskInfo[i].messageTitle='销售订单'
  216. }
  217. }
  218. }
  219. if(res.data.data.records.length==0){
  220. that.isSole=true
  221. }else{
  222. that.isSole=false
  223. }
  224. uni.hideLoading()
  225. } else {
  226. uni.showToast({
  227. title: res.data.message,
  228. icon: 'none',
  229. duration: 2000
  230. })
  231. }
  232. }).catch(res => {
  233. uni.showToast({
  234. title: res.data.message,
  235. icon: 'none',
  236. duration: 2000
  237. })
  238. })
  239. },
  240. tabcarchange(statusFlag) {
  241. this.statusFlag = statusFlag
  242. this.pageSize = 1
  243. this.getIndexBuyData(1)
  244. },
  245. navToDetailPage(item) {
  246. if(item.businessCode=='PROCUREMENT-ORDER-APPROVE'){
  247. uni.navigateTo({
  248. url:'/pages/task/procurement_details?id='+item.businessId
  249. })
  250. }else if(item.businessCode=='SALE-ORDER-APPROVE'){
  251. uni.navigateTo({
  252. url:'/pages/task/sale_details?id='+item.businessId
  253. })
  254. }else if(item.businessCode=='PROCUREMENT-RECEIPT-REPORT'){
  255. uni.navigateTo({
  256. url:'/pages/task/procurement_report_details?id='+item.businessId
  257. })
  258. }else if(item.businessCode=='PROCUREMENT-CLOSE-REPORT'){
  259. uni.navigateTo({
  260. url:'/pages/task/procurement_close_details?id='+item.businessId
  261. })
  262. }else if(item.businessCode=='SALE-RECEIPT-REPORT'){
  263. uni.navigateTo({
  264. url:'/pages/task/sale_report_details?id='+item.businessId
  265. })
  266. }else if(item.businessCode=='SALE-CLOSE-REPORT'){
  267. uni.navigateTo({
  268. url:'/pages/task/sale_close_details?id='+item.businessId
  269. })
  270. }
  271. // if(item.taskType == "入库任务"){
  272. // if(item.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.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}`
  279. // })
  280. // }
  281. // }else if(item.taskType == "出库任务"){
  282. // if(item.statusFlag == 3){
  283. // uni.navigateTo({
  284. // url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  285. // })
  286. // }else{
  287. // uni.navigateTo({
  288. // 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}`
  289. // })
  290. // }
  291. // }
  292. }
  293. }
  294. }
  295. </script>
  296. <style lang="scss" scoped>
  297. .tag {
  298. background:#F5F6F9;
  299. padding: 5px;
  300. color:#333333;
  301. display: inline-flex;
  302. font-size: 22rpx;
  303. border-radius: 3px;
  304. margin: 3px;
  305. }
  306. .introduce-section .title_b .title-tip{
  307. font-size: 13px;
  308. height:40px;
  309. line-height: 40px;
  310. flex: 2.5;
  311. }
  312. .introduce-section .title_b .title{
  313. font-size: 13px;
  314. height:40px;
  315. padding:10px 0;
  316. flex: 2.5;
  317. }
  318. .introduce-section .title_b .title-tip-b{
  319. flex: 1;
  320. font-size: 13px;
  321. color: #878C9C;
  322. height:40px;
  323. line-height: 40px;
  324. }
  325. .introduce-section .title text{
  326. font-size: 17px;
  327. font-weight: bold;
  328. height:50px;
  329. line-height: 50px;
  330. flex: 2.5;
  331. border-bottom:1px solid #EEEEEE;
  332. }
  333. .introduce-section .title .title-tip{
  334. flex: 1;
  335. font-size: 15px;
  336. color: #FE6430;
  337. font-weight: 500;
  338. height:50px;
  339. line-height: 50px;
  340. border-bottom:1px solid #EEEEEE;
  341. }
  342. .introduce-section .title .title-tip-a{
  343. flex: 1;
  344. font-size: 15px;
  345. color: #AFB3BF;
  346. font-weight: 500;
  347. height:50px;
  348. line-height: 50px;
  349. border-bottom:1px solid #EEEEEE;
  350. }
  351. .introduce-section .guess-item{
  352. border-radius:4px;
  353. background: #fff;
  354. padding: 0upx 30upx 20upx;
  355. margin:10px;
  356. padding-bottom: 20upx;
  357. border-bottom: 1px solid #ccc;
  358. }
  359. .line{
  360. display:inline-block;
  361. padding:5px;
  362. position:relative;
  363. font-size:17px;
  364. }
  365. .line.active{
  366. font-size:19px;
  367. font-weight: 900;
  368. }
  369. .line.active:after{
  370. content:'';
  371. display:block;
  372. position:absolute;
  373. width:18px;
  374. left:50%;
  375. transform: translateX(-50%);
  376. bottom:0;
  377. border-bottom:1px solid #22C572;
  378. }
  379. /deep/.u-action-active{
  380. margin-right:6px;
  381. }
  382. </style>