混凝土运输管理微信小程序、替班
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

303 lines
7.0 KiB

2 weeks ago
  1. <template>
  2. <view class="content">
  3. <navbar title="企业设备" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="mt40">
  5. <view v-for="(item, index) in carList" :key="index" class="re-card-p32">
  6. <view v-if="isEmpty" class="re-empty">
  7. <view>暂无数据</view>
  8. </view>
  9. <view class="flex-sb">
  10. <view class="flex">
  11. <image class="re-from-car" src="/static/icons/icon11.png"></image>
  12. <text>{{ item.name }}</text>
  13. </view>
  14. <view v-if="item.isReviewing" class="re-card-show">
  15. <text style="color:limegreen">系统审核中</text>
  16. </view>
  17. <view v-if="item.isRejected" class="re-card-show">
  18. <text style="color:#F40000">未通过审核</text>
  19. </view>
  20. </view>
  21. <!-- 车辆种类 -->
  22. <view class="flex-sb re-card-select mt20" @click="selectCarType(item)">
  23. <view>种类</view>
  24. <view class="flex" style="color:#9E9E9E">
  25. <text v-if="item.showTypePlaceholder">请选择</text>
  26. <view v-if="item.showTypeValue" style="color:#0d0d0d">{{ item.carType }}</view>
  27. <uv-icon v-if="item.showTypeIcon" name="arrow-right" size="16" color="#999"></uv-icon>
  28. </view>
  29. </view>
  30. <!-- 轴数 -->
  31. <view class="flex-sb re-card-select" @click="selectAxleCount(item)">
  32. <view>轴数</view>
  33. <view class="flex" style="color:#9E9E9E">
  34. <text v-if="item.showAxlePlaceholder">请选择</text>
  35. <view v-if="item.showAxleValue" style="color:#0d0d0d">{{ item.axleCount }}</view>
  36. <uv-icon v-if="item.showAxleIcon" name="arrow-right" size="16" color="#999"></uv-icon>
  37. </view>
  38. </view>
  39. <!-- 上传证件 -->
  40. <view class="flex-sb re-card-select" @click="uploadDocuments(item)">
  41. <view>上传证件</view>
  42. <view v-if="item.showUploadPlaceholder" class="flex" style="color:#9E9E9E">
  43. <text>未上传</text>
  44. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  45. </view>
  46. <view v-if="item.showUploadValue" class="flex" style="color:#0d0d0d">
  47. <text>已上传</text>
  48. <uv-icon name="checkmark" size="16" color="#4cd964"></uv-icon>
  49. </view>
  50. </view>
  51. <!-- 操作按钮 -->
  52. <view class="action-buttons mt20">
  53. <button class="btn-edit" @click="editCar(item)">编辑</button>
  54. <button class="btn-delete" @click="deleteCar(item)">删除</button>
  55. </view>
  56. </view>
  57. <!-- 添加车辆按钮 -->
  58. <view class="add-car-btn" @click="addCar">
  59. <uv-icon name="plus" size="24" color="#007AFF"></uv-icon>
  60. <text>添加车辆</text>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import navbar from '@/components/base/navbar.vue'
  67. export default {
  68. components: {
  69. navbar
  70. },
  71. name: 'StaffCars',
  72. data() {
  73. return {
  74. isEmpty: false,
  75. carList: [
  76. {
  77. id: 1,
  78. name: '湘A12345',
  79. isReviewing: true,
  80. isRejected: false,
  81. showTypePlaceholder: false,
  82. showTypeValue: true,
  83. showTypeIcon: true,
  84. carType: '泵车',
  85. showAxlePlaceholder: false,
  86. showAxleValue: true,
  87. showAxleIcon: true,
  88. axleCount: '4轴',
  89. showUploadPlaceholder: false,
  90. showUploadValue: true
  91. },
  92. {
  93. id: 2,
  94. name: '湘A67890',
  95. isReviewing: false,
  96. isRejected: true,
  97. showTypePlaceholder: false,
  98. showTypeValue: true,
  99. showTypeIcon: true,
  100. carType: '搅拌车',
  101. showAxlePlaceholder: false,
  102. showAxleValue: true,
  103. showAxleIcon: true,
  104. axleCount: '3轴',
  105. showUploadPlaceholder: true,
  106. showUploadValue: false
  107. },
  108. {
  109. id: 3,
  110. name: '湘A11111',
  111. isReviewing: false,
  112. isRejected: false,
  113. showTypePlaceholder: true,
  114. showTypeValue: false,
  115. showTypeIcon: true,
  116. carType: '',
  117. showAxlePlaceholder: true,
  118. showAxleValue: false,
  119. showAxleIcon: true,
  120. axleCount: '',
  121. showUploadPlaceholder: true,
  122. showUploadValue: false
  123. }
  124. ]
  125. }
  126. },
  127. methods: {
  128. selectCarType(item) {
  129. uni.showActionSheet({
  130. itemList: ['泵车', '搅拌车', '车载泵'],
  131. success: (res) => {
  132. const types = ['泵车', '搅拌车', '车载泵'];
  133. item.carType = types[res.tapIndex];
  134. item.showTypePlaceholder = false;
  135. item.showTypeValue = true;
  136. }
  137. });
  138. },
  139. selectAxleCount(item) {
  140. uni.showActionSheet({
  141. itemList: ['2轴', '3轴', '4轴', '5轴', '6轴'],
  142. success: (res) => {
  143. const axles = ['2轴', '3轴', '4轴', '5轴', '6轴'];
  144. item.axleCount = axles[res.tapIndex];
  145. item.showAxlePlaceholder = false;
  146. item.showAxleValue = true;
  147. }
  148. });
  149. },
  150. uploadDocuments(item) {
  151. uni.chooseImage({
  152. count: 3,
  153. sizeType: ['compressed'],
  154. sourceType: ['camera', 'album'],
  155. success: (res) => {
  156. uni.showToast({
  157. title: '上传成功',
  158. icon: 'success'
  159. });
  160. item.showUploadPlaceholder = false;
  161. item.showUploadValue = true;
  162. }
  163. });
  164. },
  165. editCar(item) {
  166. uni.navigateTo({
  167. url: `/pages_order/staff/car?id=${item.id}&mode=edit`
  168. });
  169. },
  170. deleteCar(item) {
  171. uni.showModal({
  172. title: '确认删除',
  173. content: `确定要删除车辆 ${item.name} 吗?`,
  174. success: (res) => {
  175. if (res.confirm) {
  176. const index = this.carList.findIndex(car => car.id === item.id);
  177. if (index > -1) {
  178. this.carList.splice(index, 1);
  179. uni.showToast({
  180. title: '删除成功',
  181. icon: 'success'
  182. });
  183. }
  184. }
  185. }
  186. });
  187. },
  188. addCar() {
  189. uni.navigateTo({
  190. url: '/pages_order/staff/car?mode=add'
  191. });
  192. }
  193. }
  194. }
  195. </script>
  196. <style scoped lang="scss">
  197. .content {
  198. padding: 20rpx;
  199. min-height: 100vh;
  200. background-color: #f5f5f5;
  201. }
  202. .mt40 {
  203. margin-top: 40rpx;
  204. }
  205. .mt20 {
  206. margin-top: 20rpx;
  207. }
  208. .re-card-p32 {
  209. background-color: #fff;
  210. border-radius: 10rpx;
  211. padding: 32rpx;
  212. margin-bottom: 20rpx;
  213. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  214. }
  215. .re-empty {
  216. text-align: center;
  217. padding: 100rpx 0;
  218. color: #999;
  219. font-size: 28rpx;
  220. }
  221. .flex {
  222. display: flex;
  223. align-items: center;
  224. gap: 10rpx;
  225. }
  226. .flex-sb {
  227. display: flex;
  228. justify-content: space-between;
  229. align-items: center;
  230. }
  231. .re-from-car {
  232. width: 40rpx;
  233. height: 40rpx;
  234. }
  235. .re-card-show {
  236. padding: 8rpx 16rpx;
  237. border-radius: 20rpx;
  238. background-color: #f0f0f0;
  239. font-size: 24rpx;
  240. }
  241. .re-card-select {
  242. padding: 25rpx 0;
  243. border-bottom: 1rpx solid #f0f0f0;
  244. font-size: 28rpx;
  245. &:last-child {
  246. border-bottom: none;
  247. }
  248. }
  249. .action-buttons {
  250. display: flex;
  251. gap: 20rpx;
  252. justify-content: flex-end;
  253. button {
  254. padding: 15rpx 25rpx;
  255. border-radius: 25rpx;
  256. font-size: 26rpx;
  257. border: none;
  258. &.btn-edit {
  259. background-color: #007AFF;
  260. color: #fff;
  261. }
  262. &.btn-delete {
  263. background-color: #ff3b30;
  264. color: #fff;
  265. }
  266. }
  267. }
  268. .add-car-btn {
  269. display: flex;
  270. align-items: center;
  271. justify-content: center;
  272. gap: 10rpx;
  273. background-color: #fff;
  274. border: 2rpx dashed #007AFF;
  275. border-radius: 10rpx;
  276. padding: 60rpx;
  277. margin-top: 20rpx;
  278. color: #007AFF;
  279. font-size: 28rpx;
  280. }
  281. </style>