purchase-publish.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. <template>
  2. <view class="purchase-publish-container">
  3. <!-- 表单内容 -->
  4. <view class="form-container">
  5. <!-- 收购标题 -->
  6. <view class="form-item">
  7. <view class="item-label">
  8. <text class="label-text">收购标题</text>
  9. <text class="required">*</text>
  10. </view>
  11. <view class="item-content">
  12. <input class="form-input" v-model="formData.title" placeholder="请输入收购标题"
  13. placeholder-style="color: #999;" maxlength="30" @input="onTitleInput" />
  14. <view class="char-count">{{ titleLength }}/30</view>
  15. </view>
  16. </view>
  17. <!-- 收购品类 -->
  18. <view class="form-item">
  19. <view class="item-label">
  20. <text class="label-text">收购品类</text>
  21. <text class="required">*</text>
  22. </view>
  23. <view class="item-content">
  24. <view class="category-selector" @click="showCategoryPicker = true">
  25. <text class="selector-text" :class="{ placeholder: !formData.categoryId }">
  26. <!-- {{ formData.categoryLabel || '请选择产品分类' }} -->
  27. {{getDictLabel('agricultural_category',formData.categoryId) || '请选择产品分类' }}
  28. </text>
  29. <text class="arrow-icon">></text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="form-item">
  34. <!-- 所在地 -->
  35. <view class="item-label">
  36. <text class="label-text">所在地</text>
  37. <text class="required">*</text>
  38. </view>
  39. <LocationPicker v-model="formData.location" mode="edit" />
  40. </view>
  41. <!-- 收购数量 -->
  42. <view class="form-item">
  43. <view class="item-label">
  44. <text class="label-text">收购数量</text>
  45. <text class="required">*</text>
  46. </view>
  47. <view class="item-content">
  48. <view class="input-with-unit">
  49. <input class="form-input" v-model="formData.quantity" placeholder="请输入收购数量"
  50. placeholder-style="color: #999;" type="number" />
  51. <!-- <text class="unit-text">斤</text> -->
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 单位-->
  56. <view class="form-item">
  57. <view class="item-label">
  58. <text class="label-text">单位</text>
  59. <text class="required">*</text>
  60. </view>
  61. <view class="item-content">
  62. <view class="category-selector" @click="showUnitPicker = true">
  63. <text class="selector-text" :class="{ placeholder: !formData.unit }">
  64. <!-- {{ formData.dictLabel || '请选择价格单位' }} -->
  65. {{ getDictLabel('agricultural_unit',formData.unit) || '请选择价格单位'}}
  66. </text>
  67. <text class="arrow-icon">></text>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 单价预算 -->
  72. <view class="form-item">
  73. <view class="item-label">
  74. <text class="label-text">单价预算</text>
  75. <text class="required">*</text>
  76. </view>
  77. <view class="item-content">
  78. <view class="input-with-unit">
  79. <text class="currency-symbol">¥</text>
  80. <input class="form-input" v-model="formData.price" placeholder="请输入单价预算"
  81. placeholder-style="color: #999;" type="digit" />
  82. <!-- <text class="unit-text">元/斤</text> -->
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 补充说明 -->
  87. <view class="form-item">
  88. <view class="item-label">
  89. <text class="label-text">补充说明</text>
  90. </view>
  91. <view class="item-content">
  92. <textarea class="form-textarea" v-model="formData.description" placeholder="请描述交货要求、时间等补充信息"
  93. placeholder-style="color: #999;" maxlength="200" auto-height @input="onDescInput" />
  94. <view class="char-count">{{ descLength }}/200</view>
  95. </view>
  96. </view>
  97. <!-- 上传参考图片 -->
  98. <view class="form-item">
  99. <view class="item-label">
  100. <text class="label-text">参考图片</text>
  101. <text class="optional">(最多6张)</text>
  102. </view>
  103. <view class="item-content">
  104. <view class="image-upload-area">
  105. <view class="image-item" v-for="(image, index) in formData.images" :key="index">
  106. <image class="uploaded-image" :src="image.url" mode="aspectFill"></image>
  107. <view class="image-delete" @click="removeImage(index)">×</view>
  108. </view>
  109. <view class="image-upload-btn" v-if="formData.images.length < 6" @click="chooseImage">
  110. <text class="upload-icon">+</text>
  111. <text class="upload-text">上传图片</text>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- 联系人信息 -->
  117. <view class="form-item">
  118. <view class="item-label">
  119. <text class="label-text">联系人信息</text>
  120. </view>
  121. <view class="item-content">
  122. <view class="contact-input-row">
  123. <text class="contact-label">联系人:</text>
  124. <input class="contact-input" v-model="formData.contactName" placeholder="请输入联系人姓名"
  125. placeholder-style="color: #999;" maxlength="10" />
  126. </view>
  127. <view class="contact-input-row">
  128. <text class="contact-label">电话:</text>
  129. <input class="contact-input" v-model="formData.contactPhone" placeholder="请输入联系电话"
  130. placeholder-style="color: #999;" type="number" maxlength="11" />
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. <!-- 底部提交按钮 -->
  136. <view class="bottom-action-bar">
  137. <view class="submit-btn" @click="submitForm">
  138. <text class="btn-text">{{ isEditMode ? '保存修改' : '提交发布' }}</text>
  139. </view>
  140. </view>
  141. <!-- 品类选择弹窗 -->
  142. <view class="picker-modal" v-if="showCategoryPicker" @click="showCategoryPicker = false">
  143. <view class="picker-content" @click.stop>
  144. <view class="picker-header">
  145. <text class="picker-title">选择收购品类</text>
  146. <text class="picker-close" @click="showCategoryPicker = false">×</text>
  147. </view>
  148. <view class="picker-options">
  149. <view class="picker-option"
  150. v-for="category in dictDataOptions.agricultural_category"
  151. :key="category.dictCode"
  152. @click="selectCategory(category)"
  153. :class="{ 'active': category.dictValue == formData.categoryId }">
  154. <text class="option-text">{{ category.dictLabel }}</text>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <!-- 单位选择弹窗 -->
  160. <view class="picker-modal" v-if="showUnitPicker" @click="showUnitPicker = false">
  161. <view class="picker-content" @click.stop>
  162. <view class="picker-header">
  163. <text class="picker-title">选择价格单位</text>
  164. <text class="picker-close" @click="showUnitPicker = false">×</text>
  165. </view>
  166. <view class="picker-options">
  167. <view class="picker-option"
  168. v-for="unit in dictDataOptions.agricultural_unit"
  169. :key="unit.dictCode"
  170. @click="selectUnit(unit)"
  171. :class="{ 'active': unit.dictValue == formData.unit }">
  172. <text class="option-text">{{ unit.dictLabel }}</text>
  173. </view>
  174. </view>
  175. </view>
  176. </view>
  177. </view>
  178. </template>
  179. <script setup>
  180. import { ref, reactive, computed, onMounted } from 'vue'
  181. import LocationPicker from "@/components/common/LocationPicker.vue"
  182. import api from "@/config/api.js"
  183. import storage from "@/utils/storage.js"
  184. import { addProductInfo, getProductInfoById, editProductInfo } from '@/api/services/productInfo.js'
  185. import { useDict } from '@/utils/composables/useDict'
  186. import { getFormattedTime } from '@/utils/dateUtils'
  187. // 使用 useDict 替换 dictMixin
  188. const { dictData } = useDict(['agricultural_unit', 'agricultural_category'])
  189. // 响应式状态
  190. const isEditMode = ref(false)
  191. const editItemId = ref('')
  192. const showCategoryPicker = ref(false)
  193. const showUnitPicker = ref(false)
  194. const titleLength = ref(0)
  195. const descLength = ref(0)
  196. // 使用 reactive 管理复杂的表单对象
  197. const formData = reactive({
  198. title: '',
  199. categoryId: '',
  200. price: '',
  201. description: '',
  202. imageUrl: '',
  203. images: [],
  204. unit: '',
  205. quantity: '',
  206. contactName: '',
  207. contactPhone: '',
  208. location: '',
  209. publishTime: getFormattedTime(),
  210. userId: storage.getUserInfo().userid,
  211. type: 1, // 收购
  212. status: 1 // 审核中
  213. })
  214. // 计算属性:dictDataOptions
  215. const dictDataOptions = computed(() => dictData.value)
  216. // onLoad 替换为 onMounted + getCurrentPages
  217. onMounted(() => {
  218. const pages = getCurrentPages()
  219. const currentPage = pages[pages.length - 1]
  220. const options = currentPage.options
  221. // 检查是否为编辑模式
  222. if (options.action === 'edit' && options.id) {
  223. isEditMode.value = true
  224. editItemId.value = options.id
  225. // 设置页面标题
  226. uni.setNavigationBarTitle({
  227. title: '编辑收购信息'
  228. })
  229. // 加载收购信息数据
  230. loadPurchaseData()
  231. } else {
  232. // 新建模式
  233. isEditMode.value = false
  234. uni.setNavigationBarTitle({
  235. title: '发布收购信息'
  236. })
  237. }
  238. })
  239. // 方法定义
  240. // 加载收购信息数据(编辑模式)
  241. const loadPurchaseData = () => {
  242. uni.showLoading({
  243. title: '加载中...'
  244. })
  245. getProductInfoById(editItemId.value).then(res => {
  246. if (res.data.code === 200) {
  247. Object.assign(formData, res.data.data)
  248. // 更新字符计数
  249. titleLength.value = formData.title.length
  250. descLength.value = formData.description.length
  251. console.log("this.goodsDetail", formData)
  252. // 处理图片数据
  253. if (formData.imageUrl) {
  254. try {
  255. formData.images = formData.imageUrl.split(',').map(url => ({ url, status: 'success' }))
  256. console.log('解析后的图片数据:', formData.images)
  257. } catch (e) {
  258. console.error('解析图片数据失败:', e)
  259. formData.images = []
  260. }
  261. } else {
  262. formData.images = []
  263. }
  264. uni.hideLoading()
  265. } else {
  266. uni.showToast({
  267. title: res.data.msg || '获取农品信息失败',
  268. icon: 'none'
  269. })
  270. }
  271. })
  272. }
  273. // 标题输入处理
  274. const onTitleInput = (e) => {
  275. titleLength.value = e.detail.value.length
  276. }
  277. // 描述输入处理
  278. const onDescInput = (e) => {
  279. descLength.value = e.detail.value.length
  280. }
  281. // 选择分类
  282. const selectCategory = (category) => {
  283. formData.categoryId = category.dictValue
  284. formData.categoryLabel = category.dictLabel
  285. showCategoryPicker.value = false
  286. }
  287. // 选择单位
  288. const selectUnit = (unit) => {
  289. formData.unit = unit.dictValue
  290. formData.dictLabel = unit.dictLabel
  291. showUnitPicker.value = false
  292. }
  293. // 获取字典标签
  294. const getDictLabel = (dictKey, value) => {
  295. if (!dictData.value || !dictData.value[dictKey]) {
  296. return ''
  297. }
  298. const list = dictData.value[dictKey] || []
  299. const item = list.find(u => u.dictValue == value)
  300. return item ? item.dictLabel : ''
  301. }
  302. // 选择图片
  303. const chooseImage = () => {
  304. uni.chooseImage({
  305. count: 6 - formData.images.length,
  306. sizeType: ['original', 'compressed'],
  307. sourceType: ['album', 'camera'],
  308. success: (res) => {
  309. console.log('选择图片成功:', res);
  310. // 验证文件类型和大小
  311. const validFiles = [];
  312. const invalidFiles = [];
  313. const maxSize = 5 * 1024 * 1024; // 5MB 最大限制
  314. // 检查每个文件
  315. res.tempFiles.forEach((file, index) => {
  316. // 检查文件类型
  317. const isImage = /\.(jpg|jpeg|png|gif)$/i.test(file.name);
  318. // 检查文件大小
  319. const isValidSize = file.size <= maxSize;
  320. if (isImage && isValidSize) {
  321. validFiles.push(res.tempFilePaths[index]);
  322. } else {
  323. invalidFiles.push({
  324. path: file.path,
  325. size: file.size,
  326. reason: !isImage ? '文件格式不支持' : '文件大于5MB'
  327. });
  328. }
  329. });
  330. // 显示无效文件提示
  331. if (invalidFiles.length > 0) {
  332. uni.showToast({
  333. title: `${invalidFiles.length}个文件无效,请检查格式和大小`,
  334. icon: 'none',
  335. duration: 2000
  336. });
  337. }
  338. // 如果有有效文件,则上传
  339. if (validFiles.length > 0) {
  340. uploadImages(validFiles)
  341. }
  342. },
  343. fail: (err) => {
  344. console.error('选择图片失败:', err)
  345. uni.showToast({
  346. title: '选择图片失败',
  347. icon: 'none'
  348. })
  349. }
  350. })
  351. }
  352. // 上传图片到服务器
  353. const uploadImages = (tempFilePaths) => {
  354. uni.showLoading({
  355. title: '上传中...',
  356. mask: true
  357. });
  358. // 上传成功的图片计数
  359. let successCount = 0;
  360. let failCount = 0;
  361. const totalFiles = tempFilePaths.length;
  362. const newImages = [];
  363. // 遍历处理每张图片
  364. tempFilePaths.forEach((path, index) => {
  365. // 调用上传API
  366. uni.uploadFile({
  367. // url: api.serve + '/base/tasks/uploadTaskImage',
  368. url: api.serve + '/file/upload',
  369. filePath: path,
  370. name: 'file', // 文件参数名称,需要与后端接口匹配
  371. formData: {
  372. type: 'task', // 标识文件类型,用于后端区分不同业务的文件
  373. // directory: '/opt/app/nongxiaoyu/uploadImage' // 指定保存目录
  374. },
  375. header: {
  376. 'Authorization': `Bearer ${storage.getAccessToken()}`
  377. },
  378. success: (res) => {
  379. try {
  380. const response = JSON.parse(res.data);
  381. uni.showToast({
  382. title: `返回: ${response.data}`,
  383. icon: 'none',
  384. });
  385. if (response.code === 200) {
  386. // 获取返回的URL
  387. const imageUrl = response.data.url;
  388. console.log('上传成功,返回的图片URL:', imageUrl);
  389. // 上传成功,将图片信息添加到数组
  390. newImages.push({
  391. url: imageUrl, // 保存原始URL,在显示时会通过getImageUrl方法处理
  392. path: path, // 保存本地路径用于预览
  393. status: 'success',
  394. fileName: response.data.fileName || '' // 保存文件名,如果后端返回的话
  395. });
  396. successCount++;
  397. } else {
  398. failCount++;
  399. console.error('上传失败:', response.msg);
  400. }
  401. } catch (e) {
  402. failCount++;
  403. uni.showToast({
  404. title: `解析响应失败: ${e}`,
  405. icon: 'none',
  406. });
  407. console.error('解析响应失败:', e);
  408. }
  409. },
  410. fail: (err) => {
  411. failCount++;
  412. console.error('上传请求失败:', err);
  413. uni.showToast({
  414. title: `上传请求失败: ${err}`,
  415. icon: 'none',
  416. });
  417. },
  418. complete: () => {
  419. // 当所有文件都已处理完成
  420. if (successCount + failCount === totalFiles) {
  421. if (newImages.length > 0) {
  422. // 将新上传的图片添加到已有图片列表
  423. formData.images = [...formData.images, ...newImages]
  424. // 更新taskImages字段,将图片URL用逗号连接
  425. formData.imageUrl = formData.images.map(item => item.url).join(',')
  426. // 显示成功提示
  427. uni.hideLoading()
  428. uni.showToast({
  429. title: `成功上传${successCount}张图片`,
  430. icon: 'success'
  431. })
  432. } else {
  433. // 全部失败
  434. uni.showToast({
  435. title: `图片上传: ${newImages}`,
  436. icon: 'none'
  437. })
  438. uni.hideLoading()
  439. }
  440. }
  441. }
  442. })
  443. })
  444. }
  445. const removeImage = (index) => {
  446. uni.showModal({
  447. title: '确认删除',
  448. content: '确定要删除这张图片吗?',
  449. success: (res) => {
  450. if (res.confirm) {
  451. formData.images.splice(index, 1)
  452. // 更新taskImages字段
  453. formData.imageUrl = formData.images.map(item => item.url).join(',')
  454. uni.showToast({
  455. title: '已删除',
  456. icon: 'none'
  457. })
  458. }
  459. }
  460. })
  461. }
  462. // 表单验证
  463. const validateForm = () => {
  464. if (!formData.title.trim()) {
  465. uni.showToast({
  466. title: '请输入收购标题',
  467. icon: 'none'
  468. })
  469. return false
  470. }
  471. if (!formData.categoryId) {
  472. uni.showToast({
  473. title: '请选择收购品类',
  474. icon: 'none'
  475. })
  476. return false
  477. }
  478. if (!formData.quantity || formData.quantity <= 0) {
  479. uni.showToast({
  480. title: '请输入有效的收购数量',
  481. icon: 'none'
  482. })
  483. return false
  484. }
  485. if (!formData.price || formData.price <= 0) {
  486. uni.showToast({
  487. title: '请输入有效的单价预算',
  488. icon: 'none'
  489. })
  490. return false
  491. }
  492. if (!formData.contactName.trim()) {
  493. uni.showToast({
  494. title: '请输入联系人姓名',
  495. icon: 'none'
  496. })
  497. return false
  498. }
  499. if (!formData.contactPhone.trim()) {
  500. uni.showToast({
  501. title: '请输入联系电话',
  502. icon: 'none'
  503. })
  504. return false
  505. }
  506. // 简单的手机号格式验证
  507. const phoneRegex = /^1[3-9]\d{9}$/
  508. if (!phoneRegex.test(formData.contactPhone)) {
  509. uni.showToast({
  510. title: '请输入正确的手机号码',
  511. icon: 'none'
  512. })
  513. return false
  514. }
  515. return true
  516. }
  517. // 提交表单
  518. const submitForm = () => {
  519. if (!validateForm()) {
  520. return
  521. }
  522. // 显示加载提示
  523. const loadingTitle = isEditMode.value ? '保存中...' : '提交中...'
  524. uni.showLoading({
  525. title: loadingTitle
  526. })
  527. uni.hideLoading()
  528. if (isEditMode.value) {
  529. editProductInfo(formData).then(res => {
  530. if (res.data.code === 200) {
  531. uni.showModal({
  532. title: '保存成功',
  533. content: '您的修改已保存成功!',
  534. showCancel: false,
  535. success: () => {
  536. uni.navigateBack()
  537. }
  538. })
  539. } else {
  540. uni.showToast({
  541. title: res.data.msg || '提交失败,请稍后重试',
  542. icon: 'none'
  543. })
  544. }
  545. }).catch(err => {
  546. console.error("提交异常:", err)
  547. uni.showToast({
  548. title: '网络错误,请检查后重试',
  549. icon: 'none'
  550. })
  551. })
  552. } else {
  553. // 新建模式 - 提交审核
  554. console.log("this.formData", formData)
  555. addProductInfo(formData).then(res => {
  556. console.log("新增出售农产品", res)
  557. if (res.data.code === 200) {
  558. uni.showModal({
  559. title: '提交成功',
  560. content: '您的收购农产品信息已提交审核,审核通过后将在收购页面展示。',
  561. showCancel: false,
  562. success: () => {
  563. uni.navigateBack()
  564. }
  565. })
  566. } else {
  567. uni.showToast({
  568. title: res.data.msg || '提交失败,请稍后重试',
  569. icon: 'none'
  570. })
  571. }
  572. }).catch(err => {
  573. console.error("提交异常:", err)
  574. uni.showToast({
  575. title: '网络错误,请检查后重试',
  576. icon: 'none'
  577. })
  578. })
  579. }
  580. }
  581. </script>
  582. <style lang="scss">
  583. .purchase-publish-container {
  584. min-height: 100vh;
  585. background-color: #f5f5f5;
  586. padding-bottom: calc(128rpx + env(safe-area-inset-bottom));
  587. }
  588. .form-container {
  589. padding: 20rpx;
  590. }
  591. .form-item {
  592. background-color: #fff;
  593. border-radius: 12rpx;
  594. padding: 24rpx;
  595. margin-bottom: 16rpx;
  596. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
  597. }
  598. .item-label {
  599. display: flex;
  600. align-items: center;
  601. margin-bottom: 16rpx;
  602. }
  603. .label-text {
  604. font-size: 28rpx;
  605. color: #333;
  606. font-weight: bold;
  607. }
  608. .required {
  609. color: #ff4d4f;
  610. font-size: 28rpx;
  611. margin-left: 4rpx;
  612. }
  613. .optional {
  614. color: #999;
  615. font-size: 24rpx;
  616. margin-left: 8rpx;
  617. }
  618. .item-content {
  619. position: relative;
  620. }
  621. .form-input {
  622. width: 100%;
  623. height: 44rpx;
  624. font-size: 28rpx;
  625. color: #333;
  626. line-height: 44rpx;
  627. }
  628. .form-textarea {
  629. width: 100%;
  630. min-height: 120rpx;
  631. font-size: 28rpx;
  632. color: #333;
  633. line-height: 1.5;
  634. }
  635. .char-count {
  636. position: absolute;
  637. right: 0;
  638. bottom: -4rpx;
  639. font-size: 24rpx;
  640. color: #999;
  641. }
  642. // 品类选择器
  643. .category-selector {
  644. display: flex;
  645. align-items: center;
  646. justify-content: space-between;
  647. padding: 12rpx 0;
  648. border-bottom: 1rpx solid #f0f0f0;
  649. }
  650. .selector-text {
  651. font-size: 28rpx;
  652. color: #333;
  653. &.placeholder {
  654. color: #999;
  655. }
  656. }
  657. .arrow-icon {
  658. font-size: 24rpx;
  659. color: #999;
  660. }
  661. // 带单位的输入框
  662. .input-with-unit {
  663. display: flex;
  664. align-items: center;
  665. border-bottom: 1rpx solid #f0f0f0;
  666. padding: 12rpx 0;
  667. }
  668. .currency-symbol {
  669. font-size: 28rpx;
  670. color: #333;
  671. margin-right: 8rpx;
  672. }
  673. .unit-text {
  674. font-size: 28rpx;
  675. color: #666;
  676. margin-left: 8rpx;
  677. white-space: nowrap;
  678. }
  679. // 图片上传
  680. .image-upload-area {
  681. display: flex;
  682. flex-wrap: wrap;
  683. gap: 16rpx;
  684. }
  685. .image-item {
  686. position: relative;
  687. width: 160rpx;
  688. height: 160rpx;
  689. border-radius: 8rpx;
  690. overflow: hidden;
  691. }
  692. .uploaded-image {
  693. width: 100%;
  694. height: 100%;
  695. }
  696. .image-delete {
  697. position: absolute;
  698. top: -8rpx;
  699. right: -8rpx;
  700. width: 32rpx;
  701. height: 32rpx;
  702. background-color: #ff4d4f;
  703. color: #fff;
  704. border-radius: 50%;
  705. display: flex;
  706. align-items: center;
  707. justify-content: center;
  708. font-size: 20rpx;
  709. font-weight: bold;
  710. }
  711. .image-upload-btn {
  712. width: 160rpx;
  713. height: 160rpx;
  714. border: 2rpx dashed #ddd;
  715. border-radius: 8rpx;
  716. display: flex;
  717. flex-direction: column;
  718. align-items: center;
  719. justify-content: center;
  720. background-color: #fafafa;
  721. }
  722. .upload-icon {
  723. font-size: 48rpx;
  724. color: #999;
  725. margin-bottom: 8rpx;
  726. }
  727. .upload-text {
  728. font-size: 24rpx;
  729. color: #999;
  730. }
  731. // 联系人信息
  732. .contact-input-row {
  733. display: flex;
  734. align-items: center;
  735. margin-bottom: 20rpx;
  736. &:last-child {
  737. margin-bottom: 0;
  738. }
  739. }
  740. .contact-label {
  741. font-size: 28rpx;
  742. color: #333;
  743. width: 120rpx;
  744. font-weight: bold;
  745. }
  746. .contact-input {
  747. flex: 1;
  748. height: 44rpx;
  749. font-size: 28rpx;
  750. color: #333;
  751. line-height: 44rpx;
  752. border-bottom: 1rpx solid #f0f0f0;
  753. padding: 12rpx 0;
  754. }
  755. // 底部提交按钮
  756. .bottom-action-bar {
  757. position: fixed;
  758. bottom: 0;
  759. left: 0;
  760. right: 0;
  761. width: 100%;
  762. background-color: #fff;
  763. border-top: 1rpx solid #f0f0f0;
  764. padding: 20rpx 30rpx;
  765. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  766. z-index: 1000;
  767. box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.05);
  768. box-sizing: border-box;
  769. }
  770. .submit-btn {
  771. width: 100%;
  772. height: 88rpx;
  773. background-color: #4CAF50;
  774. border-radius: 12rpx;
  775. display: flex;
  776. align-items: center;
  777. justify-content: center;
  778. transition: background-color 0.2s ease;
  779. box-sizing: border-box;
  780. &:active {
  781. background-color: #45a049;
  782. }
  783. .btn-text {
  784. font-size: 32rpx;
  785. color: #fff;
  786. font-weight: bold;
  787. }
  788. }
  789. // 品类选择弹窗
  790. .picker-modal {
  791. position: fixed;
  792. top: 0;
  793. left: 0;
  794. width: 100%;
  795. height: 100%;
  796. background-color: rgba(0, 0, 0, 0.5);
  797. z-index: 2000;
  798. display: flex;
  799. align-items: flex-end;
  800. }
  801. .picker-content {
  802. width: 100%;
  803. background-color: #fff;
  804. border-radius: 24rpx 24rpx 0 0;
  805. padding: 0;
  806. }
  807. .picker-header {
  808. display: flex;
  809. justify-content: space-between;
  810. align-items: center;
  811. padding: 30rpx;
  812. border-bottom: 1rpx solid #f0f0f0;
  813. }
  814. .picker-title {
  815. font-size: 32rpx;
  816. font-weight: bold;
  817. color: #333;
  818. }
  819. .picker-close {
  820. font-size: 36rpx;
  821. color: #999;
  822. }
  823. .picker-options {
  824. padding: 20rpx 0;
  825. }
  826. .picker-option {
  827. padding: 24rpx 30rpx;
  828. border-bottom: 1rpx solid #f8f8f8;
  829. transition: background-color 0.2s ease;
  830. &:last-child {
  831. border-bottom: none;
  832. }
  833. &:active {
  834. background-color: #f5f5f5;
  835. }
  836. }
  837. .option-text {
  838. font-size: 30rpx;
  839. color: #333;
  840. }
  841. </style>