my_task.vue 7.9 KB

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