my_task.vue 10 KB

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