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

438 lines
11 KiB

2 weeks ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="接车确认" :leftClick="true" @leftClick="goBack" />
  5. <view class="content">
  6. <view class="cr mt40">
  7. <!-- 仪表盘照片 -->
  8. <view class="re-card-p32">
  9. <view class="flex-sb">
  10. <view class="re-from-label">请拍摄仪表盘照片</view>
  11. <view class="re-card-show" @tap="clickShowExample('https://relief.oss-cn-hangzhou.aliyuncs.com/one01.png')">查看示例</view>
  12. </view>
  13. <input-image
  14. :height="456"
  15. @uploadSuccess="handleImageUpload('a', $event)"
  16. />
  17. <view class="re-card-context">
  18. 请拍摄车辆启动后的仪表 确保柴油油位照片<text class="highlight">机油压力水温和故障预警照片清晰无倾斜</text>
  19. </view>
  20. </view>
  21. <!-- 车身前方照片 -->
  22. <view class="re-card-p32">
  23. <view class="flex-sb">
  24. <view class="re-from-label">请拍摄车身前方照片</view>
  25. <view class="re-card-show" @tap="clickShowExample('https://relief.oss-cn-hangzhou.aliyuncs.com/one02.png')">查看示例</view>
  26. </view>
  27. <input-image
  28. :height="456"
  29. @uploadSuccess="handleImageUpload('b', $event)"
  30. />
  31. <view class="re-card-context">
  32. 需拍摄<text class="highlight">车辆前方</text>照片以保证车辆交车状况
  33. </view>
  34. </view>
  35. <!-- 车身后方照片 -->
  36. <view class="re-card-p32">
  37. <view class="flex-sb">
  38. <view class="re-from-label">请拍摄车身后方照片</view>
  39. <view class="re-card-show" @tap="clickShowExample('https://relief.oss-cn-hangzhou.aliyuncs.com/one08.png')">查看示例</view>
  40. </view>
  41. <input-image
  42. :height="456"
  43. @uploadSuccess="handleImageUpload('c', $event)"
  44. />
  45. <view class="re-card-context">
  46. 需拍摄<text class="highlight">车辆后方</text>照片以保证车辆交车状况
  47. </view>
  48. </view>
  49. <!-- 车身左侧方照片 -->
  50. <view class="re-card-p32">
  51. <view class="flex-sb">
  52. <view class="re-from-label">请拍摄车身左侧方照片</view>
  53. <view class="re-card-show" @tap="clickShowExample('https://relief.oss-cn-hangzhou.aliyuncs.com/one04.png')">查看示例</view>
  54. </view>
  55. <input-image
  56. :height="456"
  57. @uploadSuccess="handleImageUpload('d', $event)"
  58. />
  59. <view class="re-card-context">
  60. 需拍摄<text class="highlight">车辆左侧方</text>照片以保证车辆交车状况
  61. </view>
  62. </view>
  63. <!-- 车身右侧方照片 -->
  64. <view class="re-card-p32">
  65. <view class="flex-sb">
  66. <view class="re-from-label">请拍摄车身右侧方照片</view>
  67. <view class="re-card-show" @tap="clickShowExample('https://relief.oss-cn-hangzhou.aliyuncs.com/one03.png')">查看示例</view>
  68. </view>
  69. <input-image
  70. :height="456"
  71. @uploadSuccess="handleImageUpload('e', $event)"
  72. />
  73. <view class="re-card-context">
  74. 需拍摄<text class="highlight">车辆右侧方</text>照片以保证车辆交车状况
  75. </view>
  76. </view>
  77. <!-- 当前工作环境 -->
  78. <view class="re-card-p32">
  79. <view class="flex-sb">
  80. <view class="re-from-label">请拍摄当前工作环境</view>
  81. <view class="re-card-show" @tap="clickShowExample('https://relief.oss-cn-hangzhou.aliyuncs.com/one07.png')">查看示例</view>
  82. </view>
  83. <input-image
  84. :height="456"
  85. @uploadSuccess="handleImageUpload('f', $event)"
  86. />
  87. <view class="re-card-context">
  88. 需拍摄<text class="highlight">车辆四周</text>照片以保证平台任务相符
  89. </view>
  90. </view>
  91. <!-- 水槽照片 -->
  92. <view class="re-card-p32">
  93. <view class="flex-sb">
  94. <view class="re-from-label">请拍摄水槽照片</view>
  95. </view>
  96. <input-image
  97. :height="456"
  98. @uploadSuccess="handleImageUpload('g', $event)"
  99. />
  100. <view class="re-card-context">
  101. 需拍摄<text class="highlight">车辆水槽</text>照片以保证水位能满足车辆降温
  102. </view>
  103. </view>
  104. <!-- 液压油位照片 -->
  105. <view class="re-card-p32">
  106. <view class="flex-sb">
  107. <view class="re-from-label">请拍摄液压油位照片</view>
  108. <view class="re-card-show" @tap="clickShowExample('https://relief.oss-cn-hangzhou.aliyuncs.com/one06.png')">查看示例</view>
  109. </view>
  110. <input-image
  111. :height="456"
  112. @uploadSuccess="handleImageUpload('h', $event)"
  113. />
  114. <view class="re-card-context">
  115. 需拍摄<text class="highlight">车辆液压油位</text>照片以保证油位满足正常施工
  116. </view>
  117. </view>
  118. <!-- 备注 -->
  119. <view class="re-card-p32">
  120. <view class="re-from-label">备注<text class="optional">选填</text></view>
  121. <textarea
  122. class="re-card-textarea"
  123. placeholder="如在施工过程中发现问题,请用文字描述。"
  124. v-model="form.remark"
  125. />
  126. </view>
  127. </view>
  128. <!-- 提交按钮 -->
  129. <view class="re-end-pand">
  130. <button @tap="clickSaveAndBack">提交保存</button>
  131. </view>
  132. </view>
  133. <!-- 示例弹窗 -->
  134. <show-example
  135. :show="show"
  136. :url="url"
  137. @close="show = false"
  138. />
  139. </view>
  140. </template>
  141. <script>
  142. import navbar from '@/components/base/navbar.vue'
  143. import inputImage from '@/components/base/input-image.vue'
  144. import showExample from '@/components/base/show-example.vue'
  145. export default {
  146. name: 'UserStep0',
  147. components: {
  148. navbar,
  149. inputImage,
  150. showExample
  151. },
  152. data() {
  153. return {
  154. show: false,
  155. url: '',
  156. orderId: '',
  157. form: {
  158. a: '', // 仪表盘照片
  159. b: '', // 车身前方照片
  160. c: '', // 车身后方照片
  161. d: '', // 车身左侧方照片
  162. e: '', // 车身右侧方照片
  163. f: '', // 当前工作环境
  164. g: '', // 水槽照片
  165. h: '', // 液压油位照片
  166. i: '', // 预留字段
  167. j: '', // 预留字段
  168. k: '', // 预留字段
  169. remark: '' // 备注
  170. }
  171. }
  172. },
  173. onLoad(options) {
  174. if (options.id) {
  175. this.orderId = options.id
  176. }
  177. },
  178. methods: {
  179. // 返回上一页
  180. goBack() {
  181. uni.navigateBack()
  182. },
  183. // 显示示例图片
  184. clickShowExample(url) {
  185. if (url) {
  186. this.url = url
  187. } else {
  188. this.url = 'https://relief.oss-cn-hangzhou.aliyuncs.com/yx.jpg'
  189. }
  190. this.show = true
  191. },
  192. // 处理图片上传成功
  193. handleImageUpload(field, event) {
  194. console.log('图片上传成功:', field, event)
  195. // event 包含 { localPath, ossUrl }
  196. if (event && event.ossUrl) {
  197. this.form[field] = event.ossUrl
  198. } else if (event && event.localPath) {
  199. // 如果没有OSS地址,使用本地路径(开发模式)
  200. this.form[field] = event.localPath
  201. }
  202. },
  203. // 提交保存
  204. clickSaveAndBack() {
  205. // 验证必填字段
  206. if (!this.form.a || !this.form.b || !this.form.c || !this.form.d ||
  207. !this.form.e || !this.form.f || !this.form.g || !this.form.h) {
  208. uni.showToast({
  209. icon: 'none',
  210. title: '请按照要求拍摄上传照片'
  211. })
  212. return
  213. }
  214. this.doSubmit()
  215. },
  216. // 执行提交
  217. doSubmit() {
  218. // 模拟数据提交
  219. const submitData = {
  220. id: this.$utils?.generateUUID?.() || Date.now().toString(),
  221. status: 1,
  222. step: 1,
  223. orderId: this.orderId,
  224. ...this.form
  225. }
  226. console.log('提交数据:', submitData)
  227. // 模拟提交成功
  228. uni.showToast({
  229. icon: 'success',
  230. title: '提交成功'
  231. })
  232. setTimeout(() => {
  233. uni.navigateBack({
  234. delta: 1
  235. })
  236. }, 1500)
  237. // 实际项目中的API调用示例:
  238. // this.$httpPost('/api/order/image', submitData, (res) => {
  239. // console.log('[/order/image]', res)
  240. // if (res.data && res.data > 0) {
  241. // this.$httpPost('/api/order/status', submitData, (res2) => {
  242. // console.log('[/order/status]', res2)
  243. // if (res2.data) {
  244. // uni.showToast({ icon: 'success', title: '提交成功' })
  245. // setTimeout(() => {
  246. // uni.navigateBack({ delta: 1 })
  247. // }, 1500)
  248. // }
  249. // })
  250. // } else {
  251. // uni.showModal({
  252. // title: '提交失败',
  253. // content: `本次提交失败,您可以停留在本页面,稍后再次尝试提交,错误码[${res.data}]`
  254. // })
  255. // }
  256. // })
  257. }
  258. }
  259. }
  260. </script>
  261. <style scoped lang="scss">
  262. .page {
  263. background-color: #F5F5F5;
  264. min-height: 100vh;
  265. }
  266. .content {
  267. padding-bottom: 120rpx; // 为底部按钮留出空间
  268. }
  269. .cr {
  270. min-height: calc(88vh);
  271. }
  272. .mt40 {
  273. margin-top: 40rpx;
  274. }
  275. // 卡片样式
  276. .re-card-p32 {
  277. padding: 32rpx;
  278. margin: 0 32rpx 32rpx 32rpx;
  279. background-color: #fff;
  280. border-radius: 16rpx;
  281. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
  282. }
  283. // 弹性布局
  284. .flex-sb {
  285. display: flex;
  286. justify-content: space-between;
  287. align-items: center;
  288. margin-bottom: 24rpx;
  289. }
  290. // 标签样式
  291. .re-from-label {
  292. font-size: 32rpx;
  293. font-weight: 500;
  294. color: #333;
  295. line-height: 44rpx;
  296. }
  297. // 查看示例按钮
  298. .re-card-show {
  299. font-size: 26rpx;
  300. color: #007AFF;
  301. padding: 8rpx 16rpx;
  302. border: 1rpx solid #007AFF;
  303. border-radius: 20rpx;
  304. background-color: rgba(0, 122, 255, 0.1);
  305. }
  306. // 说明文字
  307. .re-card-context {
  308. font-size: 26rpx;
  309. color: #666;
  310. line-height: 36rpx;
  311. margin-top: 16rpx;
  312. padding: 16rpx;
  313. background-color: #f8f9fa;
  314. border-radius: 8rpx;
  315. border-left: 4rpx solid #007AFF;
  316. }
  317. // 高亮文字
  318. .highlight {
  319. color: #F40000;
  320. font-weight: 500;
  321. }
  322. // 可选标识
  323. .optional {
  324. color: #999;
  325. font-weight: normal;
  326. }
  327. // 文本域样式
  328. .re-card-textarea {
  329. width: 100%;
  330. min-height: 120rpx;
  331. padding: 20rpx;
  332. border: 1rpx solid #e0e0e0;
  333. border-radius: 8rpx;
  334. font-size: 28rpx;
  335. color: #333;
  336. background-color: #fafafa;
  337. margin-top: 16rpx;
  338. box-sizing: border-box;
  339. resize: none;
  340. &::placeholder {
  341. color: #999;
  342. }
  343. &:focus {
  344. border-color: #007AFF;
  345. background-color: #fff;
  346. }
  347. }
  348. // 底部按钮区域
  349. .re-end-pand {
  350. position: fixed;
  351. bottom: 0;
  352. left: 0;
  353. right: 0;
  354. padding: 24rpx 32rpx;
  355. padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
  356. background-color: #fff;
  357. border-top: 1rpx solid #e0e0e0;
  358. z-index: 100;
  359. button {
  360. width: 100%;
  361. height: 88rpx;
  362. background: linear-gradient(135deg, #007AFF 0%, #0056CC 100%);
  363. color: #fff;
  364. font-size: 32rpx;
  365. font-weight: 500;
  366. border: none;
  367. border-radius: 44rpx;
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.3);
  372. transition: all 0.3s ease;
  373. &:active {
  374. transform: translateY(2rpx);
  375. box-shadow: 0 2rpx 8rpx rgba(0, 122, 255, 0.4);
  376. }
  377. &::after {
  378. border: none;
  379. }
  380. }
  381. }
  382. // 单选框样式覆盖
  383. /deep/ uni-radio .uni-radio-input {
  384. background-color: #F40000 !important;
  385. border-color: #F40000 !important;
  386. }
  387. /deep/ uni-radio .uni-radio-input:empty {
  388. background-color: #ffffff !important;
  389. border-color: #d1d1d1 !important;
  390. }
  391. // 车辆图标
  392. .re-from-car {
  393. width: 72rpx;
  394. height: 60rpx;
  395. margin: 0 16rpx -20rpx 0;
  396. }
  397. </style>