my_task.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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="item.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. this.warehouseInOutInfo.currentPage += 1
  87. this.getIndexBuyData()
  88. }
  89. },
  90. // onLoad(options) {
  91. // this.getIndexBuyData()
  92. // },
  93. filters: {
  94. formatDate (date) {
  95. var date=new Date(date)
  96. var time=new Date()
  97. var newdate=''
  98. if(time.getMonth() + 1>=10){
  99. newdate=time.getFullYear()+'-'+(time.getMonth()+1)+'-'+time.getDate()
  100. }else{
  101. newdate=time.getFullYear()+'-0'+(time.getMonth()+1)+'-'+time.getDate()
  102. }
  103. //把时间戳改为yyyy-MM-dd格式
  104. //判断是否今天
  105. var datatime=''
  106. if(date.getMonth() + 1>=10){
  107. datatime=date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()
  108. }else{
  109. datatime=date.getFullYear()+'-0'+(date.getMonth()+1)+'-'+date.getDate()
  110. }
  111. if(datatime == newdate){
  112. var h = date.getHours();
  113. h = h < 10 ? '0' + h : h;
  114. var m = date.getMinutes();
  115. m = m < 10 ? '0' + m : m;
  116. var s = date.getSeconds();
  117. s = s < 10 ? '0' + s : s;
  118. return h + ':' + m + ':' + s;
  119. }else{
  120. if(date.getMonth() + 1>=10){
  121. return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()
  122. }else{
  123. return date.getFullYear()+'-0'+(date.getMonth()+1)+'-'+date.getDate()
  124. }
  125. }
  126. let o = {
  127. 'Y': date.getFullYear(),
  128. 'M+': date.getMonth() + 1,
  129. 'd+': date.getDate(),
  130. }
  131. },
  132. },
  133. methods: {
  134. searchKeyWord(){
  135. if(!this.keyword){
  136. this.$api.msg('关键字不能为空')
  137. }
  138. this.warehouseInOutInfo.statusFlag = this.statusFlag
  139. this.warehouseInOutInfo.keyWord = this.keyword
  140. uni.showLoading({
  141. title:"正在加载"
  142. })
  143. this.$api.doRequest('get', '/warehouseInOutInfo/selectInfoByKeyWord', this.warehouseInOutInfo).then(res => {
  144. if (res.data.code == 200) {
  145. this.taskInfo = res.data.data
  146. uni.hideLoading()
  147. } else {
  148. uni.showToast({
  149. title: res.data.message,
  150. icon: 'none',
  151. duration: 2000
  152. })
  153. uni.hideLoading()
  154. }
  155. }).catch(res => {
  156. uni.showToast({
  157. title: res.data.message,
  158. icon: 'none',
  159. duration: 2000
  160. })
  161. uni.hideLoading()
  162. })
  163. },
  164. getIndexBuyData(status) {
  165. const that = this
  166. var pages = that.pages
  167. var limit = that.limit
  168. var url=''
  169. uni.showLoading({
  170. title:"正在加载"
  171. })
  172. var data={}
  173. this.warehouseInOutInfo.statusFlag = this.statusFlag
  174. this.warehouseInOutInfo.phone = this.userInfo.phone
  175. this.warehouseInOutInfo.pcFlag = 0
  176. if(this.statusFlag==1){
  177. data=this.warehouseInOutInfo
  178. url='/warehouseInOutInfo/selectInfo'
  179. }else{
  180. data=this.data
  181. url='/commonUser/query/findHisPageNoticeTasks'
  182. }
  183. //this.warehouseInOutInfo.status = this.status
  184. this.$api.doRequest('get', url, data).then(res => {
  185. if (res.data.code == 200) {
  186. let data = res.data.data.records
  187. //采购信息
  188. if (data.length > 0) {
  189. if(status){
  190. that.taskInfo=data
  191. }else{
  192. that.taskInfo = that.taskInfo.concat(data)
  193. }
  194. } else {
  195. if (that.pages > 1) {
  196. that.pages -= 1
  197. }
  198. that.isLoadMore = false
  199. that.loadStatus = 'nomore'
  200. }
  201. if(res.data.data.records.length==0){
  202. that.isSole=true
  203. }else{
  204. that.isSole=false
  205. }
  206. uni.hideLoading()
  207. } else {
  208. uni.showToast({
  209. title: res.data.message,
  210. icon: 'none',
  211. duration: 2000
  212. })
  213. }
  214. }).catch(res => {
  215. uni.showToast({
  216. title: res.data.message,
  217. icon: 'none',
  218. duration: 2000
  219. })
  220. })
  221. },
  222. tabcarchange(statusFlag) {
  223. this.statusFlag = statusFlag
  224. this.pageSize = 1
  225. this.getIndexBuyData(1)
  226. },
  227. navToDetailPage(item) {
  228. if(item.taskType == "入库任务"){
  229. if(item.statusFlag == 3){
  230. uni.navigateTo({
  231. url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  232. })
  233. }else{
  234. uni.navigateTo({
  235. 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}`
  236. })
  237. }
  238. }else if(item.taskType == "出库任务"){
  239. if(item.statusFlag == 3){
  240. uni.navigateTo({
  241. url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  242. })
  243. }else{
  244. uni.navigateTo({
  245. 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}`
  246. })
  247. }
  248. }
  249. }
  250. }
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. .tag {
  255. background:#F5F6F9;
  256. padding: 5px;
  257. color:#333333;
  258. display: inline-flex;
  259. font-size: 22rpx;
  260. border-radius: 3px;
  261. margin: 3px;
  262. }
  263. .introduce-section .title_b .title-tip{
  264. font-size: 13px;
  265. height:40px;
  266. line-height: 40px;
  267. flex: 2.5;
  268. }
  269. .introduce-section .title_b .title{
  270. font-size: 13px;
  271. height:40px;
  272. padding:10px 0;
  273. flex: 2.5;
  274. }
  275. .introduce-section .title_b .title-tip-b{
  276. flex: 1;
  277. font-size: 13px;
  278. color: #878C9C;
  279. height:40px;
  280. line-height: 40px;
  281. }
  282. .introduce-section .title text{
  283. font-size: 17px;
  284. font-weight: bold;
  285. height:50px;
  286. line-height: 50px;
  287. flex: 2.5;
  288. border-bottom:1px solid #EEEEEE;
  289. }
  290. .introduce-section .title .title-tip{
  291. flex: 1;
  292. font-size: 15px;
  293. color: #FE6430;
  294. font-weight: 500;
  295. height:50px;
  296. line-height: 50px;
  297. border-bottom:1px solid #EEEEEE;
  298. }
  299. .introduce-section .title .title-tip-a{
  300. flex: 1;
  301. font-size: 15px;
  302. color: #AFB3BF;
  303. font-weight: 500;
  304. height:50px;
  305. line-height: 50px;
  306. border-bottom:1px solid #EEEEEE;
  307. }
  308. .introduce-section .guess-item{
  309. border-radius:4px;
  310. background: #fff;
  311. padding: 0upx 30upx 20upx;
  312. margin:10px;
  313. padding-bottom: 20upx;
  314. border-bottom: 1px solid #ccc;
  315. }
  316. .line{
  317. display:inline-block;
  318. padding:5px;
  319. position:relative;
  320. font-size:17px;
  321. }
  322. .line.active{
  323. font-size:19px;
  324. font-weight: 900;
  325. }
  326. .line.active:after{
  327. content:'';
  328. display:block;
  329. position:absolute;
  330. width:18px;
  331. left:50%;
  332. transform: translateX(-50%);
  333. bottom:0;
  334. border-bottom:1px solid #22C572;
  335. }
  336. /deep/.u-action-active{
  337. margin-right:6px;
  338. }
  339. </style>