index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="container">
  3. <uni-navbar title="新增运输"></uni-navbar>
  4. <view class="box" style="overflow: hidden;">
  5. <u-button class="commonMt custom-style" shape="circle" @click="addLine"
  6. color="linear-gradient(to top, #F59A02, #FFD334)">
  7. <view class="button-class">
  8. <image style="width: 29rpx;height: 29rpx;" src="../../static/images/transport/plus.png"
  9. mode="widthFix">
  10. </image>
  11. <text style="margin-left: 19rpx;">新增运输</text>
  12. </view>
  13. </u-button>
  14. <view class="box2">
  15. <view class="commonMb">
  16. <view @tap="goToDetial(item)" class="small-box commonBj" v-for="(item,index) in list"
  17. :key="item.id">
  18. <view class="small-box-top">
  19. <view class="small-box-top-left">
  20. <image style="width: 35rpx;height: 35rpx;margin-left: 11rpx;"
  21. :src="item.auditState===0? '../../static/images/transport/state1.png': item.auditState===-1? '../../static/images/transport/state2.png':'../../static/images/transport/state3.png'"
  22. mode="widthFix">
  23. </image>
  24. <text>{{ item.transportName }}</text>
  25. </view>
  26. <view :class="changeStateClass(item.auditState)" class="small-box-top-right">
  27. <text>{{item.auditState===0? '待审批':item.auditState===-1?'驳 回':'通 过'}}</text>
  28. </view>
  29. </view>
  30. <view class="small-box-middle mt20">
  31. <view class="middle-left">
  32. <view class="circle-green circle-style">
  33. </view>
  34. <view class="small-box-middle-line-left">
  35. </view>
  36. <view class="circle-red circle-style">
  37. </view>
  38. </view>
  39. <view class="middle-middle">
  40. <view class="position-start">
  41. <view class="green bold size24 textStyle">{{item.startName}}</view>
  42. </view>
  43. <view class="position-end">
  44. <text class="red bold size24 textStyle ">{{item.endName}}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="small-box-date">
  49. <image style="width: 24rpx;height: 24rpx;margin-left: 10rpx;"
  50. src="../../static/images/transport/rili.png" mode="widthFix">
  51. </image>
  52. <text class="ml19 font-size-style">
  53. 日期:{{changeDate(item.startDate)}} — {{changeDate(item.endDate)}}
  54. </text>
  55. </view>
  56. <view class="small-box-bottom mt23">
  57. <view class="small-box-bottom-left">
  58. <image style="width: 25rpx;height: 25rpx;margin-left: 10rpx;"
  59. src="../../static/images/transport/time.png" mode="widthFix"></image>
  60. <text class="ml19 font-size-style">
  61. 时间:{{changeTime(item.startTime)}} — {{changeTime(item.endTime)}}
  62. </text>
  63. </view>
  64. <view class="small-box-bottom-left">
  65. <image style="width: 25rpx;height: 25rpx;" src="../../static/images/transport/lb_01.png"
  66. mode="">
  67. </image>
  68. <text class="mr15 ml19 font-size-style">计划使用车辆数:{{item.expectCar}} 辆</text>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. getTransport
  80. } from "../../api/company/transport.js"
  81. export default {
  82. data() {
  83. return {
  84. list: [],
  85. queryParams: {
  86. pageSize: 1000,
  87. pageNum: 1
  88. },
  89. total: 0
  90. }
  91. },
  92. methods: {
  93. // 跳转
  94. // 通过和驳回跳转,待审核不跳
  95. goToDetial(item) {
  96. if (item.auditState === -1) {
  97. this.$tab.navigateTo(`/pages/addTransport/index?id=${item.id}&state=${item.auditState}`)
  98. }
  99. if (item.auditState === 1) {
  100. this.$tab.navigateTo(`/pages/transportInfo/index?id=${item.id}`)
  101. }
  102. },
  103. addLine() {
  104. this.$tab.navigateTo('/pages/addTransport/index')
  105. },
  106. changeStateClass(state) {
  107. switch (state) {
  108. case 0:
  109. return 'state-class1'
  110. case -1:
  111. return 'state-class2'
  112. case 1:
  113. return 'state-class3'
  114. }
  115. },
  116. changeDate(date) {
  117. return date.substring(0, 4) + '年' + date.substring(5, 7) + '月' + date.substring(8, 10) + '日'
  118. },
  119. changeTime(time) {
  120. return time.slice(0, 5)
  121. },
  122. // 获取运输列表
  123. async getList() {
  124. const res = await getTransport(this.queryParams)
  125. console.log('运输列表', res);
  126. this.total = res.total
  127. this.list = res.rows
  128. console.log(this.list);
  129. }
  130. },
  131. onShow() {
  132. this.getList()
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .small-box {
  138. margin-bottom: 31rpx;
  139. padding: 22rpx;
  140. .small-box-top {
  141. display: flex;
  142. justify-content: space-between;
  143. align-items: center;
  144. .small-box-top-left {
  145. display: flex;
  146. align-items: center;
  147. uni-text {
  148. font-size: 28rpx;
  149. font-weight: bold;
  150. color: #333333;
  151. margin-left: 18rpx;
  152. }
  153. }
  154. .small-box-top-right {
  155. text-align: center;
  156. width: 103rpx;
  157. height: 45rpx;
  158. border-radius: 15rpx;
  159. font-size: 26rpx;
  160. font-weight: bold;
  161. color: #FFFFFF;
  162. line-height: 45rpx;
  163. }
  164. }
  165. .mt20 {
  166. margin-top: 20rpx;
  167. }
  168. .small-box-date {
  169. display: flex;
  170. align-items: center;
  171. margin-top: 24rpx;
  172. }
  173. .small-box-bottom {
  174. display: flex;
  175. justify-content: space-between;
  176. align-items: center;
  177. .small-box-bottom-left {
  178. display: flex;
  179. align-items: center;
  180. }
  181. }
  182. }
  183. .ml19 {
  184. margin-left: 10rpx;
  185. }
  186. .mt23 {
  187. margin-top: 23rpx;
  188. }
  189. .mr15 {
  190. margin-right: 15rpx;
  191. }
  192. .font-size-style {
  193. font-size: 24rpx;
  194. font-weight: 400;
  195. color: #485B93;
  196. }
  197. .state-class1 {
  198. background: linear-gradient(90deg, #F59A02 0%, #FFD334 100%);
  199. }
  200. .state-class2 {
  201. background: linear-gradient(90deg, #FF2D04 0%, #FFA53E 100%);
  202. }
  203. .state-class3 {
  204. background: linear-gradient(90deg, #3FC377 0%, #83D992 100%);
  205. }
  206. </style>