my_task.vue 8.3 KB

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