混凝土运输管理微信小程序、替班
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.

453 lines
11 KiB

2 weeks ago
  1. <template>
  2. <view class="content">
  3. <navbar title="意见反馈" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="form-container">
  5. <!-- 申请类型 -->
  6. <view class="form-item">
  7. <view class="label">申请类型</view>
  8. <view class="select-value" @click="selectApplicationType">
  9. <text v-if="!applicationInfo.type" class="placeholder">请选择申请类型</text>
  10. <text v-else>{{ applicationInfo.type }}</text>
  11. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  12. </view>
  13. </view>
  14. <!-- 车牌号 -->
  15. <view class="form-item">
  16. <view class="label">车牌号</view>
  17. <input
  18. v-model="applicationInfo.plateNumber"
  19. placeholder="请输入车牌号"
  20. class="input"
  21. maxlength="8"
  22. />
  23. </view>
  24. <!-- 车辆类型 -->
  25. <view class="form-item" @click="selectCarType">
  26. <view class="label">车辆类型</view>
  27. <view class="select-value">
  28. <text v-if="!applicationInfo.carType" class="placeholder">请选择车辆类型</text>
  29. <text v-else>{{ applicationInfo.carType }}</text>
  30. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  31. </view>
  32. </view>
  33. <!-- 轴数 -->
  34. <view class="form-item" @click="selectAxleCount">
  35. <view class="label">轴数</view>
  36. <view class="select-value">
  37. <text v-if="!applicationInfo.axleCount" class="placeholder">请选择轴数</text>
  38. <text v-else>{{ applicationInfo.axleCount }}</text>
  39. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  40. </view>
  41. </view>
  42. <!-- 载重量 -->
  43. <view class="form-item">
  44. <view class="label">载重量()</view>
  45. <input
  46. v-model="applicationInfo.loadCapacity"
  47. placeholder="请输入载重量"
  48. class="input"
  49. type="number"
  50. />
  51. </view>
  52. <!-- 联系人 -->
  53. <view class="form-item">
  54. <view class="label">联系人</view>
  55. <input
  56. v-model="applicationInfo.contactName"
  57. placeholder="请输入联系人姓名"
  58. class="input"
  59. />
  60. </view>
  61. <!-- 联系电话 -->
  62. <view class="form-item">
  63. <view class="label">联系电话</view>
  64. <input
  65. v-model="applicationInfo.contactPhone"
  66. placeholder="请输入联系电话"
  67. class="input"
  68. type="number"
  69. maxlength="11"
  70. />
  71. </view>
  72. <!-- 所在地区 -->
  73. <view class="form-item">
  74. <view class="label">所在地区</view>
  75. <view class="address-input" @click="selectLocation">
  76. <text v-if="!applicationInfo.location" class="placeholder">请选择所在地区</text>
  77. <text v-else>{{ applicationInfo.location }}</text>
  78. <uv-icon name="map-pin" size="20" color="#007AFF"></uv-icon>
  79. </view>
  80. </view>
  81. <!-- 车辆照片 -->
  82. <view class="form-item">
  83. <view class="label">车辆照片</view>
  84. <view class="upload-container">
  85. <view v-for="(image, index) in applicationInfo.images" :key="index" class="image-item">
  86. <image :src="image" mode="aspectFill" class="uploaded-image" @click="previewImage(index)"></image>
  87. <view class="delete-btn" @click="deleteImage(index)">
  88. <uv-icon name="close" size="16" color="#fff"></uv-icon>
  89. </view>
  90. </view>
  91. <view v-if="applicationInfo.images.length < 3" class="upload-btn" @click="uploadImage">
  92. <uv-icon name="plus" size="32" color="#999"></uv-icon>
  93. <text>上传照片</text>
  94. </view>
  95. </view>
  96. <view class="upload-tip">最多上传3张照片</view>
  97. </view>
  98. <!-- 相关证件 -->
  99. <view class="form-item">
  100. <view class="label">相关证件</view>
  101. <view class="upload-container">
  102. <view v-for="(doc, index) in applicationInfo.documents" :key="index" class="image-item">
  103. <image :src="doc" mode="aspectFill" class="uploaded-image" @click="previewDocument(index)"></image>
  104. <view class="delete-btn" @click="deleteDocument(index)">
  105. <uv-icon name="close" size="16" color="#fff"></uv-icon>
  106. </view>
  107. </view>
  108. <view v-if="applicationInfo.documents.length < 5" class="upload-btn" @click="uploadDocument">
  109. <uv-icon name="plus" size="32" color="#999"></uv-icon>
  110. <text>上传证件</text>
  111. </view>
  112. </view>
  113. <view class="upload-tip">请上传行驶证营运证等相关证件最多5张</view>
  114. </view>
  115. <!-- 申请说明 -->
  116. <view class="form-item">
  117. <view class="label">申请说明</view>
  118. <textarea
  119. v-model="applicationInfo.description"
  120. placeholder="请简述申请理由和相关说明"
  121. class="textarea"
  122. maxlength="200"
  123. ></textarea>
  124. </view>
  125. </view>
  126. <!-- 底部按钮 -->
  127. <view class="bottom-buttons">
  128. <button class="btn-save" @click="saveApplication">{{ isEdit ? '保存' : '提交申请' }}</button>
  129. </view>
  130. </view>
  131. </template>
  132. <script>
  133. import navbar from '@/components/base/navbar.vue'
  134. export default {
  135. components: {
  136. navbar
  137. },
  138. name: 'BaseYuan',
  139. data() {
  140. return {
  141. isEdit: false,
  142. applicationId: '',
  143. applicationInfo: {
  144. type: '',
  145. plateNumber: '',
  146. carType: '',
  147. axleCount: '',
  148. loadCapacity: '',
  149. contactName: '',
  150. contactPhone: '',
  151. location: '',
  152. images: [],
  153. documents: [],
  154. description: ''
  155. }
  156. }
  157. },
  158. onLoad(options) {
  159. if (options.mode === 'edit' && options.id) {
  160. this.isEdit = true;
  161. this.applicationId = options.id;
  162. this.loadApplicationInfo();
  163. }
  164. uni.setNavigationBarTitle({
  165. title: this.isEdit ? '编辑申请' : '新增申请'
  166. });
  167. },
  168. methods: {
  169. loadApplicationInfo() {
  170. // 模拟加载申请信息
  171. this.applicationInfo = {
  172. type: '车辆入驻申请',
  173. plateNumber: '湘A12345',
  174. carType: '泵车',
  175. axleCount: '4轴',
  176. loadCapacity: '25',
  177. contactName: '张师傅',
  178. contactPhone: '13800138000',
  179. location: '长沙市雨花区',
  180. images: ['/static/re/ide1.png'],
  181. documents: ['/static/re/ide2.png'],
  182. description: '申请车辆入驻平台,提供专业代驾服务'
  183. };
  184. },
  185. selectApplicationType() {
  186. uni.showActionSheet({
  187. itemList: ['车辆入驻申请', '司机认证申请', '企业入驻申请'],
  188. success: (res) => {
  189. const types = ['车辆入驻申请', '司机认证申请', '企业入驻申请'];
  190. this.applicationInfo.type = types[res.tapIndex];
  191. }
  192. });
  193. },
  194. selectCarType() {
  195. uni.showActionSheet({
  196. itemList: ['泵车', '搅拌车', '车载泵'],
  197. success: (res) => {
  198. const types = ['泵车', '搅拌车', '车载泵'];
  199. this.applicationInfo.carType = types[res.tapIndex];
  200. }
  201. });
  202. },
  203. selectAxleCount() {
  204. uni.showActionSheet({
  205. itemList: ['2轴', '3轴', '4轴', '5轴', '6轴'],
  206. success: (res) => {
  207. const axles = ['2轴', '3轴', '4轴', '5轴', '6轴'];
  208. this.applicationInfo.axleCount = axles[res.tapIndex];
  209. }
  210. });
  211. },
  212. selectLocation() {
  213. uni.chooseLocation({
  214. success: (res) => {
  215. this.applicationInfo.location = res.address;
  216. }
  217. });
  218. },
  219. uploadImage() {
  220. uni.chooseImage({
  221. count: 3 - this.applicationInfo.images.length,
  222. sizeType: ['compressed'],
  223. sourceType: ['camera', 'album'],
  224. success: (res) => {
  225. this.applicationInfo.images.push(...res.tempFilePaths);
  226. }
  227. });
  228. },
  229. uploadDocument() {
  230. uni.chooseImage({
  231. count: 5 - this.applicationInfo.documents.length,
  232. sizeType: ['compressed'],
  233. sourceType: ['camera', 'album'],
  234. success: (res) => {
  235. this.applicationInfo.documents.push(...res.tempFilePaths);
  236. }
  237. });
  238. },
  239. previewImage(index) {
  240. uni.previewImage({
  241. current: index,
  242. urls: this.applicationInfo.images
  243. });
  244. },
  245. previewDocument(index) {
  246. uni.previewImage({
  247. current: index,
  248. urls: this.applicationInfo.documents
  249. });
  250. },
  251. deleteImage(index) {
  252. this.applicationInfo.images.splice(index, 1);
  253. },
  254. deleteDocument(index) {
  255. this.applicationInfo.documents.splice(index, 1);
  256. },
  257. saveApplication() {
  258. // 表单验证
  259. if (!this.applicationInfo.type) {
  260. uni.showToast({ title: '请选择申请类型', icon: 'none' });
  261. return;
  262. }
  263. if (!this.applicationInfo.plateNumber) {
  264. uni.showToast({ title: '请输入车牌号', icon: 'none' });
  265. return;
  266. }
  267. if (!this.applicationInfo.carType) {
  268. uni.showToast({ title: '请选择车辆类型', icon: 'none' });
  269. return;
  270. }
  271. if (!this.applicationInfo.contactName) {
  272. uni.showToast({ title: '请输入联系人', icon: 'none' });
  273. return;
  274. }
  275. if (!this.applicationInfo.contactPhone) {
  276. uni.showToast({ title: '请输入联系电话', icon: 'none' });
  277. return;
  278. }
  279. uni.showToast({
  280. title: this.isEdit ? '保存成功' : '申请提交成功',
  281. icon: 'success'
  282. });
  283. setTimeout(() => {
  284. uni.navigateBack();
  285. }, 1500);
  286. }
  287. }
  288. }
  289. </script>
  290. <style scoped lang="scss">
  291. .content {
  292. padding: 20rpx;
  293. min-height: 100vh;
  294. background-color: #f5f5f5;
  295. padding-bottom: 120rpx;
  296. }
  297. .form-container {
  298. background-color: #fff;
  299. border-radius: 10rpx;
  300. padding: 30rpx;
  301. }
  302. .form-item {
  303. margin-bottom: 40rpx;
  304. &:last-child {
  305. margin-bottom: 0;
  306. }
  307. }
  308. .label {
  309. font-size: 28rpx;
  310. color: #333;
  311. margin-bottom: 20rpx;
  312. font-weight: 500;
  313. }
  314. .input {
  315. width: 100%;
  316. height: 80rpx;
  317. padding: 0 20rpx;
  318. border: 1rpx solid #e0e0e0;
  319. border-radius: 8rpx;
  320. font-size: 28rpx;
  321. box-sizing: border-box;
  322. }
  323. .textarea {
  324. width: 100%;
  325. height: 120rpx;
  326. padding: 20rpx;
  327. border: 1rpx solid #e0e0e0;
  328. border-radius: 8rpx;
  329. font-size: 28rpx;
  330. box-sizing: border-box;
  331. resize: none;
  332. }
  333. .select-value {
  334. display: flex;
  335. justify-content: space-between;
  336. align-items: center;
  337. height: 80rpx;
  338. padding: 0 20rpx;
  339. border: 1rpx solid #e0e0e0;
  340. border-radius: 8rpx;
  341. font-size: 28rpx;
  342. }
  343. .address-input {
  344. display: flex;
  345. justify-content: space-between;
  346. align-items: center;
  347. height: 80rpx;
  348. padding: 0 20rpx;
  349. border: 1rpx solid #e0e0e0;
  350. border-radius: 8rpx;
  351. font-size: 28rpx;
  352. }
  353. .placeholder {
  354. color: #999;
  355. }
  356. .upload-container {
  357. display: flex;
  358. flex-wrap: wrap;
  359. gap: 20rpx;
  360. }
  361. .image-item {
  362. position: relative;
  363. width: 200rpx;
  364. height: 200rpx;
  365. }
  366. .uploaded-image {
  367. width: 100%;
  368. height: 100%;
  369. border-radius: 8rpx;
  370. }
  371. .delete-btn {
  372. position: absolute;
  373. top: -10rpx;
  374. right: -10rpx;
  375. width: 40rpx;
  376. height: 40rpx;
  377. background-color: #ff3b30;
  378. border-radius: 50%;
  379. display: flex;
  380. align-items: center;
  381. justify-content: center;
  382. }
  383. .upload-btn {
  384. width: 200rpx;
  385. height: 200rpx;
  386. border: 2rpx dashed #ccc;
  387. border-radius: 8rpx;
  388. display: flex;
  389. flex-direction: column;
  390. align-items: center;
  391. justify-content: center;
  392. gap: 10rpx;
  393. color: #999;
  394. font-size: 24rpx;
  395. }
  396. .upload-tip {
  397. font-size: 24rpx;
  398. color: #999;
  399. margin-top: 10rpx;
  400. }
  401. .bottom-buttons {
  402. position: fixed;
  403. bottom: 0;
  404. left: 0;
  405. right: 0;
  406. padding: 20rpx;
  407. background-color: #fff;
  408. border-top: 1rpx solid #f0f0f0;
  409. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  410. }
  411. .btn-save {
  412. width: 100%;
  413. height: 80rpx;
  414. line-height: 80rpx;
  415. background-color: #007AFF;
  416. color: #fff;
  417. border-radius: 40rpx;
  418. font-size: 32rpx;
  419. border: none;
  420. }
  421. </style>