my_task.vue 7.5 KB

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