my_task.vue 7.2 KB

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