my_task.vue 7.5 KB

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