my_task.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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"/>
  31. <!-- <u-tag :text="item.taskType" type=""/> -->
  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. }
  104. },
  105. },
  106. methods: {
  107. searchKeyWord(){
  108. if(!this.keyword){
  109. this.$api.msg('关键字不能为空')
  110. }
  111. this.warehouseInOutInfo.statusFlag = this.statusFlag
  112. this.warehouseInOutInfo.keyWord = this.keyword
  113. uni.showLoading({
  114. title:"正在加载"
  115. })
  116. this.$api.doRequest('get', '/warehouseInOutInfo/selectInfoByKeyWord', this.warehouseInOutInfo).then(res => {
  117. if (res.data.code == 200) {
  118. this.taskInfo = res.data.data
  119. uni.hideLoading()
  120. } else {
  121. uni.showToast({
  122. title: res.data.message,
  123. icon: 'none',
  124. duration: 2000
  125. })
  126. uni.hideLoading()
  127. }
  128. }).catch(res => {
  129. uni.showToast({
  130. title: res.data.message,
  131. icon: 'none',
  132. duration: 2000
  133. })
  134. uni.hideLoading()
  135. })
  136. },
  137. getIndexBuyData() {
  138. const that = this
  139. var pages = that.pages
  140. var limit = that.limit
  141. uni.showLoading({
  142. title:"正在加载"
  143. })
  144. this.warehouseInOutInfo.statusFlag = this.statusFlag
  145. //this.warehouseInOutInfo.status = this.status
  146. this.$api.doRequest('get', '/warehouseInOutInfo/selectInfo', this.warehouseInOutInfo).then(res => {
  147. if (res.data.code == 200) {
  148. let data = res.data.data.records
  149. //采购信息
  150. if (data.length > 0) {
  151. that.taskInfo = that.taskInfo.concat(data)
  152. that.isLoadMore = false
  153. } else {
  154. if (that.pages > 1) {
  155. that.pages -= 1
  156. }
  157. that.isLoadMore = true
  158. that.loadStatus = 'nomore'
  159. }
  160. uni.hideLoading()
  161. this.taskInfo = res.data.data.records
  162. } else {
  163. uni.showToast({
  164. title: res.data.message,
  165. icon: 'none',
  166. duration: 2000
  167. })
  168. }
  169. }).catch(res => {
  170. uni.showToast({
  171. title: res.data.message,
  172. icon: 'none',
  173. duration: 2000
  174. })
  175. })
  176. },
  177. tabcarchange(statusFlag) {
  178. this.statusFlag = statusFlag
  179. this.pageSize = 1
  180. this.getIndexBuyData()
  181. },
  182. navToDetailPage(item) {
  183. if(item.taskType == "入库任务"){
  184. if(item.statusFlag == 3){
  185. uni.navigateTo({
  186. url: `/pageD/warehousings/warehousingDetails?id=${item.id}`
  187. })
  188. }else{
  189. uni.navigateTo({
  190. 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}`
  191. })
  192. }
  193. }else if(item.taskType == "出库任务"){
  194. if(item.statusFlag == 3){
  195. uni.navigateTo({
  196. url: `/pageD/warehousings/ex_warehouse_detail?id=${item.id}`
  197. })
  198. }else{
  199. uni.navigateTo({
  200. 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}`
  201. })
  202. }
  203. }
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. .tag {
  210. background:#F5F6F9;
  211. padding: 5px;
  212. color:#333333;
  213. display: inline-flex;
  214. font-size: 22rpx;
  215. border-radius: 3px;
  216. margin: 3px;
  217. }
  218. .introduce-section .title_b .title-tip{
  219. font-size: 13px;
  220. height:40px;
  221. line-height: 40px;
  222. flex: 2.5;
  223. }
  224. .introduce-section .title_b .title-tip-b{
  225. flex: 1;
  226. font-size: 13px;
  227. color: #878C9C;
  228. height:40px;
  229. line-height: 40px;
  230. }
  231. .introduce-section .title text{
  232. font-size: 17px;
  233. font-weight: bold;
  234. height:50px;
  235. line-height: 50px;
  236. flex: 2.5;
  237. border-bottom:1px solid #EEEEEE;
  238. }
  239. .introduce-section .title .title-tip{
  240. flex: 1;
  241. font-size: 15px;
  242. color: #FE6430;
  243. font-weight: 500;
  244. height:50px;
  245. line-height: 50px;
  246. border-bottom:1px solid #EEEEEE;
  247. }
  248. .introduce-section .title .title-tip-a{
  249. flex: 1;
  250. font-size: 15px;
  251. color: #AFB3BF;
  252. font-weight: 500;
  253. height:50px;
  254. line-height: 50px;
  255. border-bottom:1px solid #EEEEEE;
  256. }
  257. .introduce-section .guess-item{
  258. border-radius:4px;
  259. background: #fff;
  260. padding: 0upx 30upx 20upx;
  261. margin:10px;
  262. padding-bottom: 20upx;
  263. border-bottom: 1px solid #ccc;
  264. }
  265. .line{
  266. display:inline-block;
  267. padding:5px;
  268. position:relative;
  269. font-size:17px;
  270. }
  271. .line.active{
  272. font-size:19px;
  273. font-weight: 900;
  274. }
  275. .line.active:after{
  276. content:'';
  277. display:block;
  278. position:absolute;
  279. width:18px;
  280. left:50%;
  281. transform: translateX(-50%);
  282. bottom:0;
  283. border-bottom:1px solid #22C572;
  284. }
  285. </style>