applyNew.uvue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695
  1. <template>
  2. <uni-navbar-lite :showRight=false title="物料申请"></uni-navbar-lite>
  3. <view class="page-container">
  4. <scroll-view class="page-content">
  5. <view class="section">
  6. <view class="search-bar">
  7. <view class="search-box">
  8. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  9. <input class="search-input" type="text" placeholder="请输入关键字查询" v-model="keyword" @input="handleSearch" />
  10. <view v-if="keyword.length > 0" class="clear-btn" @tap="clearKeyword">
  11. <text class="clear-btn-text">×</text>
  12. </view>
  13. <view class="search-btn" @tap="handleSearch">
  14. <text class="search-btn-text">搜索</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="status-tabs">
  19. <scroll-view class="scroll-view_H" direction="horizontal" :show-scrollbar="false">
  20. <view
  21. v-for="(cat, idx) in categories"
  22. :key="idx"
  23. class="status-tab"
  24. :class="{ 'active': currentStatus === cat.id }"
  25. @click="switchStatus(cat.id)"
  26. >
  27. <text class="status-tab-text" :class="{ 'active-text': currentStatus === cat.id }">{{ cat.name }}</text>
  28. </view>
  29. </scroll-view>
  30. </view>
  31. </view>
  32. <view class="section">
  33. <view class="section-header">
  34. <view class="section-header-left">
  35. <view class="section-indicator"></view>
  36. <text class="section-title">物料列表</text>
  37. </view>
  38. <view class="add-material-btn" @click="showAddMaterialModal = true">
  39. <text class="add-material-text">新物料</text>
  40. </view>
  41. </view>
  42. <view class="material-list">
  43. <view
  44. v-for="(item, index) in dataList"
  45. :key="item.itemId + '_' + page"
  46. class="list-item"
  47. @click="handleItemClick(item, index)"
  48. >
  49. <view class="item-header">
  50. <view class="item-info">
  51. <view class="item-name-row">
  52. <text class="item-name" :class="{'status-0': getAuditStatus(item) == 0, 'status-2': getAuditStatus(item) == 3}">{{ getItemName(item) }}</text>
  53. <text class="item-measure">{{ getMeasureName(item) }}</text>
  54. </view>
  55. <view class="item-sub-row">
  56. <text class="item-sub-title">{{ getItemTypeName(item) }}</text>
  57. <text class="item-stock">库存: {{ getStockNum(item) }}</text>
  58. </view>
  59. </view>
  60. <view class="item-actions">
  61. <view v-if="getAuditStatus(item) == 0 && !item.isSelected! && canDeleteMaterial(item)" class="delete-btn" @click.stop="handleDeleteMaterial(item)">
  62. <text class="delete-icon">×</text>
  63. </view>
  64. <view v-if="item.isSelected" class="added-btn">
  65. <text class="added-icon">已选</text>
  66. </view>
  67. <view v-else-if="isItemDisabled(item)" class="add-btn disabled">
  68. <text class="add-icon">+</text>
  69. </view>
  70. <view v-else class="add-btn" @click.stop="addToSelected(item)">
  71. <text class="add-icon">+</text>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 手动分页 -->
  78. <view class="pagination">
  79. <view class="page-btn" :class="{disabled: page <= 1}" @click="prevPage">
  80. <text class="page-btn-text"><</text>
  81. </view>
  82. <text class="page-info">第{{ page }}页 / 共{{ totalPages }}页</text>
  83. <view class="page-btn" :class="{disabled: page >= totalPages}" @click="nextPage">
  84. <text class="page-btn-text">></text>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="section">
  89. <view class="section-header">
  90. <view class="section-header-left">
  91. <view class="section-indicator"></view>
  92. <text class="section-title">已选列表</text>
  93. </view>
  94. </view>
  95. <view class="selected-list">
  96. <view v-if="selectedItems.length === 0" class="empty-tip">
  97. <text class="empty-tip-text">请选择物料</text>
  98. </view>
  99. <view
  100. v-else
  101. v-for="(selItem, selIndex) in selectedItems"
  102. :key="selIndex"
  103. class="selected-item"
  104. >
  105. <view class="selected-item-row1">
  106. <text class="selected-item-name">{{ selItem.itemName }}</text>
  107. <text class="selected-item-measure">{{ selItem.measureName }}</text>
  108. <view class="quantity-control">
  109. <view class="qty-btn" @click="decreaseQty(selIndex)">
  110. <text class="qty-btn-text">-</text>
  111. </view>
  112. <input
  113. class="quantity-input"
  114. type="digit"
  115. v-model="selItem.qty"
  116. placeholder="数量"
  117. />
  118. <view class="qty-btn" @click="increaseQty(selIndex)">
  119. <text class="qty-btn-text">+</text>
  120. </view>
  121. </view>
  122. <view class="delete-btn" @click="removeSelected(selIndex)">
  123. <text class="delete-icon">×</text>
  124. </view>
  125. </view>
  126. <view class="selected-item-row2">
  127. <input
  128. class="selected-item-remark"
  129. type="text"
  130. v-model="selItem.remark"
  131. placeholder="备注"
  132. :maxlength="200"
  133. />
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="section">
  139. <view class="section-header">
  140. <view class="section-header-left">
  141. <view class="section-indicator"></view>
  142. <text class="section-title">备注/用途</text>
  143. </view>
  144. </view>
  145. <view class="remark-section">
  146. <textarea
  147. class="remark-input"
  148. v-model="remark"
  149. placeholder="请输入备注/用途"
  150. :maxlength="500"
  151. ></textarea>
  152. <text class="remark-count">{{ remark.length }}/500</text>
  153. </view>
  154. </view>
  155. </scroll-view>
  156. <!-- 底部按钮 -->
  157. <view class="bottom-buttons">
  158. <view class="btn-row">
  159. <button class="save-btn" @click="saveApplication">保存</button>
  160. <button class="confirm-btn" @click="confirmApplication">确认申请</button>
  161. </view>
  162. </view>
  163. <!-- 新增物料弹窗 -->
  164. <view v-if="showAddMaterialModal" class="picker-modal">
  165. <view class="modal-mask" @click="showAddMaterialModal = false"></view>
  166. <view class="modal-content">
  167. <view class="modal-header">
  168. <text class="modal-title">新增物料</text>
  169. <text class="modal-close" @click="showAddMaterialModal = false">取消</text>
  170. </view>
  171. <view class="form-item-input">
  172. <text class="label-picker">物料名称</text>
  173. <view class="view-input-picker">
  174. <input class="input-picker" type="text" placeholder="请输入物料名称" v-model="newMaterial.itemName" />
  175. </view>
  176. </view>
  177. <view class="form-item-input">
  178. <text class="label-picker">规格型号</text>
  179. <view class="view-input-picker">
  180. <input class="input-picker" type="text" placeholder="请输入规格型号" v-model="newMaterial.specification" />
  181. </view>
  182. </view>
  183. <view class="form-item-input">
  184. <text class="label-picker">单位</text>
  185. <view class="view-input-picker measure-input-row">
  186. <input class="input-picker" type="text" placeholder="请输入或选择单位" v-model="newMaterial.measureName" />
  187. <view class="pick-btn" @click="showMeasurePicker = true">
  188. <text class="pick-btn-text">选择</text>
  189. </view>
  190. </view>
  191. </view>
  192. <view class="form-item-input">
  193. <text class="label-picker">产品链接</text>
  194. <view class="view-input-picker">
  195. <input class="input-picker" type="url" placeholder="请输入产品链接" v-model="newMaterial.productUrl" />
  196. </view>
  197. </view>
  198. <view class="form-item-input">
  199. <text class="label-picker">图片(最多3张)</text>
  200. <view class="upload-wrapper">
  201. <UploadImage
  202. :maxCount="3"
  203. :modelValue="newMaterial.imageUrls"
  204. businessType="material"
  205. @update:modelValue="handleImageUpdate"
  206. @delete="handleImageDelete"
  207. @preview="handleImagePreview"
  208. />
  209. </view>
  210. </view>
  211. <view class="form-item-btn">
  212. <button class="btn-primary" @click="handleAddMaterial">
  213. 保存
  214. </button>
  215. </view>
  216. </view>
  217. </view>
  218. <!-- 单位选择弹窗 -->
  219. <view v-if="showMeasurePicker" class="picker-modal">
  220. <view class="modal-mask" @click="showMeasurePicker = false"></view>
  221. <view class="modal-content">
  222. <view class="modal-header">
  223. <text class="modal-title">选择单位</text>
  224. <text class="modal-close" @click="showMeasurePicker = false">取消</text>
  225. </view>
  226. <scroll-view class="measure-list" :scroll-y="true">
  227. <view
  228. v-for="(item, index) in measureList"
  229. :key="index"
  230. class="measure-item"
  231. @click="selectMeasure(item)"
  232. >
  233. <text class="measure-name">{{ item['measureName'] }}</text>
  234. </view>
  235. <view v-if="measureList.length === 0" class="empty-tip">
  236. <text class="empty-tip-text">暂无单位数据</text>
  237. </view>
  238. </scroll-view>
  239. </view>
  240. </view>
  241. <!-- 删除确认弹窗 -->
  242. <view v-if="showDeleteConfirm" class="delete-confirm-modal">
  243. <view class="delete-confirm-mask" @click="showDeleteConfirm = false"></view>
  244. <view class="delete-confirm-content">
  245. <text class="delete-confirm-title">确认删除</text>
  246. <text class="delete-confirm-text">确定要删除这张图片吗?</text>
  247. <view class="delete-confirm-btns">
  248. <view class="delete-confirm-cancel" @click="showDeleteConfirm = false">
  249. <text class="delete-confirm-cancel-text">取消</text>
  250. </view>
  251. <view class="delete-confirm-ok" @click="confirmDeleteImage">
  252. <text class="delete-confirm-ok-text">确定</text>
  253. </view>
  254. </view>
  255. </view>
  256. </view>
  257. <!-- 图片预览弹窗 -->
  258. <view v-if="showImagePreview" class="image-preview-modal" @click="showImagePreview = false">
  259. <swiper class="preview-swiper" :current="previewIndex" @change="handlePreviewChange">
  260. <swiper-item v-for="(url, idx) in previewUrls" :key="idx">
  261. <image class="preview-image" :src="url" mode="aspectFit" @click.stop></image>
  262. </swiper-item>
  263. </swiper>
  264. <view class="preview-close" @click="showImagePreview = false">
  265. <text class="preview-close-text">×</text>
  266. </view>
  267. <view class="preview-indicator">
  268. <text class="preview-indicator-text">{{ previewIndex + 1 }} / {{ previewUrls.length }}</text>
  269. </view>
  270. </view>
  271. </view>
  272. </template>
  273. <script setup lang="uts">
  274. import { ref, computed, onBeforeUnmount, onMounted } from 'vue'
  275. import { getItemTypeListByParentId, getItemList, savePurchaseApply, confirmPurchaseApply, addMaterial, getMeasureList, deleteMaterial } from '../../api/apply/index'
  276. import { getUserInfo } from '../../utils/storage'
  277. import UploadImage from '../../components/upload-image/upload-image.uvue'
  278. import type { UploadResponse } from '../../types/workbench'
  279. let searchTimer: number | null = null
  280. type CategoryItem = { id: string; name: string; code: string }
  281. type Item = {
  282. itemId: string;
  283. itemName: string;
  284. itemCode: string;
  285. itemTypeName: string;
  286. measureName: string;
  287. specification: string;
  288. imageUrls: string;
  289. productUrl: string;
  290. auditStatus: number;
  291. stockNum: number;
  292. createBy: string;
  293. isSelected?: boolean;
  294. }
  295. type SelectedItem = { itemId: string; itemName: string; itemTypeName: string; measureName: string; qty: string; remark: string }
  296. const keyword = ref<string>("")
  297. const dataList = ref<Item[]>([])
  298. const selectedItems = ref<SelectedItem[]>([])
  299. const remark = ref<string>("")
  300. const page = ref<number>(1)
  301. const pageSize: number = 10
  302. const total = ref<number>(0)
  303. const totalPages = computed((): number => {
  304. if (total.value <= 0) return 1
  305. return Math.ceil(total.value / pageSize)
  306. })
  307. const hasMore = ref<boolean>(true)
  308. const loading = ref<boolean>(false)
  309. const refreshing = ref<boolean>(false)
  310. const categories = ref<CategoryItem[]>([])
  311. const dealLoad = ref<boolean>(false)
  312. let currentStatus = ref<string>('')
  313. const isSearching = ref<boolean>(false)
  314. // 当前登录用户
  315. const currentUserName = ref<string>('')
  316. // 新增物料相关
  317. const showAddMaterialModal = ref<boolean>(false)
  318. const showMeasurePicker = ref<boolean>(false)
  319. const measureList = ref<UTSJSONObject[]>([])
  320. const showDeleteConfirm = ref<boolean>(false)
  321. const deleteImageIndex = ref<number>(0)
  322. const showImagePreview = ref<boolean>(false)
  323. const previewUrls = ref<string[]>([])
  324. const previewIndex = ref<number>(0)
  325. type NewMaterial = {
  326. itemName: string
  327. specification: string
  328. measureName: string
  329. imageUrls: UploadResponse[]
  330. productUrl: string
  331. }
  332. const newMaterial = ref<NewMaterial>({
  333. itemName: '',
  334. specification: '',
  335. measureName: '',
  336. imageUrls: [],
  337. productUrl: ''
  338. })
  339. // 加载单位列表
  340. const loadMeasureList = (): void => {
  341. getMeasureList().then((res: any) => {
  342. const data = res as UTSJSONObject
  343. const list = data['data']
  344. if (list != null) {
  345. measureList.value = list as UTSJSONObject[]
  346. }
  347. }).catch(() => {
  348. measureList.value = []
  349. })
  350. }
  351. // 选择单位
  352. const selectMeasure = (item: UTSJSONObject): void => {
  353. const measureName = item['measureName'] != null ? item['measureName'].toString() : ''
  354. newMaterial.value.measureName = measureName
  355. showMeasurePicker.value = false
  356. }
  357. // 获取当前选中的分类code
  358. const getCurrentCategoryCode = (): string => {
  359. const currentCat = categories.value.find((c: CategoryItem) => c.id === currentStatus.value)
  360. return currentCat != null ? currentCat.code : ''
  361. }
  362. // 加载物料列表
  363. const loadItems = (): void => {
  364. loading.value = true
  365. const itemTypeCode = getCurrentCategoryCode()
  366. getItemList(itemTypeCode, page.value, pageSize, keyword.value).then((res: any) => {
  367. const data = res as UTSJSONObject
  368. const rows = data['rows']
  369. const totalNum = data['total']
  370. if (totalNum != null) {
  371. total.value = totalNum as number
  372. }
  373. if (rows != null) {
  374. const listData = rows as UTSJSONObject[]
  375. if (listData.length > 0) {
  376. const arr: Item[] = []
  377. const selectedIds = selectedItems.value.map((s: SelectedItem) => s.itemId)
  378. listData.forEach((item: UTSJSONObject) => {
  379. const itemId = item['itemId'] != null ? item['itemId'].toString() : ''
  380. let auditStatus = -1
  381. const auditStatusVal = item['auditStatus']
  382. if (auditStatusVal != null) {
  383. if (typeof auditStatusVal === 'number') {
  384. auditStatus = auditStatusVal as number
  385. } else {
  386. auditStatus = parseInt(auditStatusVal.toString())
  387. }
  388. }
  389. let stockNum = 0
  390. const stockNumVal = item['stockNum']
  391. if (stockNumVal != null) {
  392. if (typeof stockNumVal === 'number') {
  393. stockNum = stockNumVal as number
  394. } else {
  395. stockNum = parseFloat(stockNumVal.toString())
  396. }
  397. }
  398. const it: Item = {
  399. itemId: itemId,
  400. itemName: item['itemName'] != null ? item['itemName'].toString() : '',
  401. itemCode: item['itemCode'] != null ? item['itemCode'].toString() : '',
  402. itemTypeName: item['itemTypeName'] != null ? item['itemTypeName'].toString() : '',
  403. measureName: item['measureName'] != null ? item['measureName'].toString() : '',
  404. specification: item['specification'] != null ? item['specification'].toString() : '',
  405. imageUrls: item['imageUrls'] != null ? item['imageUrls'].toString() : '',
  406. productUrl: item['productUrl'] != null ? item['productUrl'].toString() : '',
  407. isSelected: selectedIds.includes(itemId),
  408. auditStatus: auditStatus,
  409. stockNum: stockNum,
  410. createBy: item['createBy'] != null ? item['createBy'].toString() : ''
  411. }
  412. arr.push(it)
  413. })
  414. dataList.value = arr
  415. loading.value = false
  416. return
  417. }
  418. }
  419. dataList.value = []
  420. loading.value = false
  421. }).catch(() => {
  422. dataList.value = []
  423. loading.value = false
  424. })
  425. }
  426. // 上一页
  427. const prevPage = (): void => {
  428. if (page.value > 1) {
  429. page.value--
  430. loadItems()
  431. }
  432. }
  433. // 下一页
  434. const nextPage = (): void => {
  435. if (page.value < totalPages.value) {
  436. page.value++
  437. loadItems()
  438. }
  439. }
  440. const loadCategories = (): void => {
  441. getItemTypeListByParentId(200).then((res: any) => {
  442. const data = res as UTSJSONObject
  443. const list = data['data']
  444. if (list != null) {
  445. const listData = list as UTSJSONObject[]
  446. if (listData.length > 0) {
  447. const arr: CategoryItem[] = []
  448. listData.forEach((item: UTSJSONObject) => {
  449. const idVal = item['itemTypeId']
  450. const nameVal = item['itemTypeName']
  451. const codeVal = item['itemTypeCode']
  452. const cat: CategoryItem = {
  453. id: idVal != null ? idVal.toString() : '',
  454. name: nameVal != null ? nameVal.toString() : '',
  455. code: codeVal != null ? codeVal.toString() : ''
  456. }
  457. arr.push(cat)
  458. })
  459. const allItem: CategoryItem = {id: '', name: '全部', code: ''}
  460. arr.unshift(allItem)
  461. categories.value = arr
  462. // 加载第一个分类的物料
  463. if (arr.length > 0) {
  464. currentStatus.value = arr[0].id
  465. loadItems()
  466. }
  467. return
  468. }
  469. }
  470. const defaultArr: CategoryItem[] = []
  471. const defaultItem: CategoryItem = {id: '', name: '全部', code: ''}
  472. defaultArr.push(defaultItem)
  473. categories.value = defaultArr
  474. }).catch(() => {
  475. const defaultArr: CategoryItem[] = []
  476. const defaultItem: CategoryItem = {id: '', name: '全部', code: ''}
  477. defaultArr.push(defaultItem)
  478. categories.value = defaultArr
  479. })
  480. }
  481. // 添加到已选列表
  482. const addToSelected = (item: any | null): void => {
  483. if (item == null) return
  484. const mdItem = item as Item
  485. // 检查审核状态
  486. if (mdItem.auditStatus != null && mdItem.auditStatus === 2) {
  487. uni.showToast({ title: '该物料已禁用,无法添加', icon: 'none'})
  488. return
  489. }
  490. // 检查是否已存在
  491. const exists = selectedItems.value.find((s: SelectedItem) => s.itemId === mdItem.itemId)
  492. if (exists != null) {
  493. uni.showToast({ title: '该物料已在选择列表中', icon: 'none'})
  494. return
  495. }
  496. const selItem: SelectedItem = {
  497. itemId: mdItem.itemId,
  498. itemName: mdItem.itemName,
  499. itemTypeName: mdItem.itemTypeName,
  500. measureName: mdItem.measureName,
  501. qty: '1',
  502. remark: ''
  503. }
  504. selectedItems.value.push(selItem)
  505. // 更新 dataList 中的选中状态
  506. const idx = dataList.value.findIndex((d: Item) => d.itemId === mdItem.itemId)
  507. if (idx >= 0) {
  508. dataList.value[idx].isSelected = true
  509. }
  510. }
  511. // 删除已选
  512. const removeSelected = (index: number): void => {
  513. const removedItem = selectedItems.value[index]
  514. selectedItems.value.splice(index, 1)
  515. // 重新加载当前页数据以更新选中状态
  516. loadItems()
  517. }
  518. // 增加数量
  519. const increaseQty = (index: number): void => {
  520. const currentQty = parseInt(selectedItems.value[index].qty)
  521. selectedItems.value[index].qty = (currentQty + 1).toString()
  522. }
  523. // 减少数量
  524. const decreaseQty = (index: number): void => {
  525. const currentQty = parseInt(selectedItems.value[index].qty)
  526. if (currentQty > 1) {
  527. selectedItems.value[index].qty = (currentQty - 1).toString()
  528. }
  529. }
  530. const handleItemClick = (item: any | null, index: number): void => {
  531. if (item == null) return
  532. const mdItem = item as Item
  533. uni.navigateTo({
  534. url: `/pages/item/detail?id=${mdItem.itemId}`
  535. })
  536. }
  537. const getItemName = (item: any | null): string => {
  538. if (item == null) return ''
  539. const mdItem = item as Item
  540. return mdItem.itemName
  541. }
  542. const getItemTypeName = (item: any | null): string => {
  543. if (item == null) return ''
  544. const mdItem = item as Item
  545. return mdItem.itemTypeName
  546. }
  547. const getMeasureName = (item: any | null): string => {
  548. if (item == null) return ''
  549. const mdItem = item as Item
  550. return mdItem.measureName
  551. }
  552. const getStockNum = (item: any | null): string => {
  553. if (item == null) return '0'
  554. const mdItem = item as Item
  555. const stock = mdItem.stockNum != null ? mdItem.stockNum : 0
  556. return stock.toString()
  557. }
  558. const getAuditStatus = (item: any | null): number => {
  559. if (item == null) return -1
  560. const mdItem = item as Item
  561. return mdItem.auditStatus != null ? mdItem.auditStatus : -1
  562. }
  563. const isItemDisabled = (item: any | null): boolean => {
  564. if (item == null) return false
  565. const mdItem = item as Item
  566. const status = mdItem.auditStatus != null ? mdItem.auditStatus : -1
  567. return status == 3
  568. }
  569. // 判断物料是否可删除(创建人是当前用户)
  570. const canDeleteMaterial = (item: any | null): boolean => {
  571. if (item == null) return false
  572. const mdItem = item as Item
  573. const createBy = mdItem.createBy != null ? mdItem.createBy : ''
  574. return createBy === currentUserName.value
  575. }
  576. // 检查物料是否已被选择
  577. const isItemSelected = (item: any | null): boolean => {
  578. if (item == null) return false
  579. const mdItem = item as Item
  580. return selectedItems.value.find((s: SelectedItem) => s.itemId === mdItem.itemId) != null
  581. }
  582. const handleSearch = (): void => {
  583. const timer = searchTimer
  584. if (timer != null) {
  585. clearTimeout(timer)
  586. }
  587. searchTimer = setTimeout(() => {
  588. page.value = 1
  589. loadItems()
  590. }, 300)
  591. }
  592. const clearKeyword = (): void => {
  593. keyword.value = ''
  594. page.value = 1
  595. loadItems()
  596. }
  597. const switchStatus = (status: string): void => {
  598. if (loading.value) {
  599. return;
  600. }
  601. if (isSearching.value) {
  602. return
  603. }
  604. isSearching.value = true
  605. currentStatus.value = status
  606. page.value = 1
  607. loadItems()
  608. setTimeout(() => {
  609. isSearching.value = false
  610. }, 100)
  611. }
  612. // 构建申请单数据
  613. const buildApplyData = (status: string): UTSJSONObject => {
  614. const applyLines: UTSJSONObject[] = []
  615. selectedItems.value.forEach((item: SelectedItem) => {
  616. const lineObj = new UTSJSONObject()
  617. lineObj['itemId'] = parseInt(item.itemId)
  618. lineObj['itemCode'] = ''
  619. lineObj['itemName'] = item.itemName
  620. lineObj['specification'] = ''
  621. lineObj['unitOfMeasure'] = ''
  622. lineObj['quantityApply'] = parseInt(item.qty)
  623. lineObj['remark'] = item.remark || ''
  624. applyLines.push(lineObj)
  625. })
  626. const result = new UTSJSONObject()
  627. result['applyCode'] = ''
  628. result['applyName'] = '物料申请'
  629. result['status'] = status
  630. result['remark'] = remark.value
  631. result['wmPurchaseApplyLineList'] = applyLines
  632. return result
  633. }
  634. // 来源页面
  635. const fromIndexPage = ref<boolean>(false)
  636. // 保存申请
  637. const saveApplication = (): void => {
  638. if (selectedItems.value.length === 0) {
  639. uni.showToast({ title: '请选择物料', icon: 'none'})
  640. return
  641. }
  642. // 构建申请单数据
  643. const applyData = buildApplyData('PREPARE')
  644. savePurchaseApply(applyData).then((res: any) => {
  645. uni.showToast({ title: '保存成功', icon: 'success'})
  646. // 清空已选列表
  647. selectedItems.value = []
  648. loadItems()
  649. // 如果从index.uvue跳转过来,返回index.uvue
  650. if (fromIndexPage.value) {
  651. setTimeout(() => {
  652. uni.navigateBack()
  653. }, 1000)
  654. }else{
  655. uni.navigateTo({
  656. url: `/pages/apply/index?from=new`
  657. })
  658. }
  659. }).catch((e) => {
  660. console.log(e)
  661. const error = e as UTSError
  662. const errMsg = error?.message
  663. uni.showToast({ title: errMsg.toString(), icon: 'none'})
  664. })
  665. }
  666. // 确认申请
  667. const confirmApplication = (): void => {
  668. if (selectedItems.value.length === 0) {
  669. uni.showToast({ title: '请选择物料', icon: 'none'})
  670. return
  671. }
  672. // 验证所有数量都大于0
  673. for (let i = 0; i < selectedItems.value.length; i++) {
  674. const qty = parseFloat(selectedItems.value[i].qty)
  675. if (qty <= 0) {
  676. uni.showToast({ title: '所有物料数量必须大于0', icon: 'none'})
  677. return
  678. }
  679. }
  680. // 构建申请单数据
  681. const applyData = buildApplyData('CONFIRMED')
  682. savePurchaseApply(applyData).then((res: any) => {
  683. uni.showToast({ title: '确认申请成功', icon: 'success'})
  684. // 清空已选列表
  685. selectedItems.value = []
  686. loadItems()
  687. // 如果从index.uvue跳转过来,返回index.uvue
  688. if (fromIndexPage.value) {
  689. setTimeout(() => {
  690. uni.navigateBack()
  691. }, 1000)
  692. }else{
  693. uni.navigateTo({
  694. url: `/pages/apply/index?from=new`
  695. })
  696. }
  697. }).catch((e) => {
  698. const error = e as UTSError
  699. const errMsg = error?.message
  700. uni.showToast({ title: errMsg.toString(), icon: 'none'})
  701. })
  702. }
  703. // 处理图片更新
  704. const handleImageUpdate = (value: UploadResponse[]): void => {
  705. newMaterial.value.imageUrls = value
  706. }
  707. // 处理图片删除
  708. const handleImageDelete = (index: number, currentList: UploadResponse[]): void => {
  709. deleteImageIndex.value = index
  710. showDeleteConfirm.value = true
  711. }
  712. const confirmDeleteImage = (): void => {
  713. newMaterial.value.imageUrls.splice(deleteImageIndex.value, 1)
  714. showDeleteConfirm.value = false
  715. }
  716. // 处理图片预览
  717. const handleImagePreview = (index: number, urls: string[]): void => {
  718. previewUrls.value = urls
  719. previewIndex.value = index
  720. showImagePreview.value = true
  721. }
  722. const handlePreviewChange = (e: any): void => {
  723. previewIndex.value = e.detail.current
  724. }
  725. // 处理新增物料
  726. const handleAddMaterial = async (): Promise<void> => {
  727. // 验证输入
  728. if (newMaterial.value.itemName.length == 0) {
  729. uni.showToast({ title: '请输入物料名称', icon: 'none'})
  730. return
  731. }
  732. if (newMaterial.value.measureName.length == 0) {
  733. uni.showToast({ title: '请输入单位', icon: 'none'})
  734. return
  735. }
  736. try {
  737. // 构建物料数据
  738. const materialData = new UTSJSONObject()
  739. materialData['itemShortName'] = newMaterial.value.itemName
  740. materialData['itemName'] = newMaterial.value.itemName + "("+newMaterial.value.specification+")"
  741. materialData['specification'] = newMaterial.value.specification
  742. materialData['measureName'] = newMaterial.value.measureName
  743. materialData['auditStatus'] = 0 // 审核状态为0
  744. // 从 UploadResponse 数组中提取 fileName 并拼接成逗号分隔的字符串
  745. const imageFileNames = newMaterial.value.imageUrls.map((item: UploadResponse) => item.fileName).join(',')
  746. materialData['imageUrls'] = imageFileNames
  747. materialData['productUrl'] = newMaterial.value.productUrl
  748. // 调用接口保存物料
  749. await addMaterial(materialData)
  750. // 保存成功
  751. uni.showToast({ title: '物料新增成功', icon: 'success'})
  752. // 关闭弹窗
  753. showAddMaterialModal.value = false
  754. // 清空表单
  755. newMaterial.value = {
  756. itemName: '',
  757. specification: '',
  758. measureName: '',
  759. imageUrls: [],
  760. productUrl: ''
  761. } as NewMaterial
  762. // 重新加载物料列表
  763. loadItems()
  764. } catch (e) {
  765. const error = e as UTSError
  766. const errMsg = error?.message
  767. uni.showToast({ title: errMsg.toString(), icon: 'none'})
  768. }
  769. }
  770. // 处理删除物料
  771. const handleDeleteMaterial = (item: Item): void => {
  772. uni.showModal({
  773. title: '确认删除',
  774. content: `确定要删除物料「${item.itemName}」吗?`,
  775. success: (res) => {
  776. if (res.confirm) {
  777. deleteMaterial(item.itemId).then(() => {
  778. uni.showToast({
  779. title: '删除成功',
  780. icon: 'success',
  781. })
  782. loadItems()
  783. }).catch((e) => {
  784. const error = e as UTSError
  785. const errMsg = error?.message
  786. uni.showModal({
  787. title: '删除失败',
  788. content: errMsg.toString(),
  789. showCancel: false,
  790. confirmText: '确定'
  791. })
  792. })
  793. }
  794. }
  795. })
  796. }
  797. onMounted(() => {
  798. loadCategories()
  799. loadMeasureList()
  800. // 获取当前登录用户信息
  801. const userInfo = getUserInfo()
  802. if (userInfo != null) {
  803. currentUserName.value = userInfo['userName'] != null ? userInfo['userName'].toString() : ''
  804. }
  805. // 获取页面参数,判断是否从index.uvue跳转过来
  806. const pages = getCurrentPages()
  807. const currentPage = pages[pages.length - 1]
  808. const options = currentPage.options
  809. if (options != null && options.from == 'index') {
  810. fromIndexPage.value = true
  811. }
  812. })
  813. </script>
  814. <style lang="scss">
  815. .page-container {
  816. flex: 1;
  817. background-color: #f5f8fe;
  818. padding-top: env(safe-area-inset-top);
  819. background-color: #e8f0f9;
  820. padding: 0rpx 20rpx 0rpx 20rpx;
  821. }
  822. .page-content {
  823. flex: 1;
  824. padding: 0rpx;
  825. padding-bottom: 150rpx;
  826. box-sizing: border-box;
  827. }
  828. .section {
  829. margin-top: 10rpx;
  830. padding: 0 10rpx 10rpx;
  831. background: #ffffff;
  832. border-radius: 16rpx;
  833. .section-header {
  834. flex-direction: row;
  835. align-items: center;
  836. justify-content: space-between;
  837. padding: 30rpx 10rpx 20rpx;
  838. }
  839. .section-header-left {
  840. flex-direction: row;
  841. align-items: center;
  842. }
  843. .add-material-btn {
  844. padding: 8rpx 16rpx;
  845. background-color: #007aff;
  846. border-radius: 8rpx;
  847. }
  848. .add-material-text {
  849. color: #ffffff;
  850. font-size: 24rpx;
  851. font-weight: bold;
  852. }
  853. &-indicator {
  854. width: 6rpx;
  855. height: 32rpx;
  856. background-color: #007aff;
  857. border-radius: 3rpx;
  858. margin-right: 12rpx;
  859. }
  860. &-title {
  861. font-size: 36rpx;
  862. color: #333333;
  863. font-weight: bold;
  864. }
  865. }
  866. .search-bar {
  867. padding: 10rpx 3rpx;
  868. }
  869. .search-box {
  870. flex-direction: row;
  871. align-items: center;
  872. height: 72rpx;
  873. padding: 0 24rpx;
  874. background-color: #f5f5f5;
  875. border-radius: 16rpx;
  876. .search-icon {
  877. width: 32rpx;
  878. height: 32rpx;
  879. margin-right: 12rpx;
  880. }
  881. .search-input {
  882. flex: 1;
  883. font-size: 28rpx;
  884. color: #333333;
  885. }
  886. .search-btn {
  887. padding: 10rpx 20rpx;
  888. background-color: #007aff;
  889. border-radius: 8rpx;
  890. margin-left: 10rpx;
  891. }
  892. .search-btn-text {
  893. color: #ffffff;
  894. font-size: 24rpx;
  895. }
  896. .clear-btn {
  897. width: 36rpx;
  898. height: 36rpx;
  899. border-radius: 18rpx;
  900. background-color: #cccccc;
  901. align-items: center;
  902. justify-content: center;
  903. margin-left: 10rpx;
  904. }
  905. .clear-btn-text {
  906. color: #ffffff;
  907. font-size: 24rpx;
  908. font-weight: bold;
  909. }
  910. }
  911. .status-tabs {
  912. padding: 20rpx 30rpx;
  913. background-color: #ffffff;
  914. border-bottom: 1rpx solid #eeeeee;
  915. }
  916. .scroll-view_H {
  917. width: 100%;
  918. flex-direction: row;
  919. }
  920. .status-tab {
  921. padding: 16rpx 24rpx;
  922. text-align: center;
  923. margin-right: 16rpx;
  924. border-radius: 8rpx;
  925. background-color: #f5f5f5;
  926. flex-shrink: 0;
  927. &:last-child {
  928. margin-right: 0;
  929. }
  930. &.active {
  931. background-color: #007aff;
  932. }
  933. .status-tab-text {
  934. font-size: 26rpx;
  935. color: #666666;
  936. &.active-text {
  937. color: #ffffff;
  938. font-weight: bold;
  939. }
  940. }
  941. }
  942. .list-item {
  943. margin: 3rpx;
  944. padding: 10rpx 10rpx 0rpx 10rpx;
  945. border-bottom: 1px solid #f9f9f9;
  946. }
  947. .item-header {
  948. flex-direction: row;
  949. align-items: center;
  950. justify-content: space-between;
  951. margin-bottom: 10rpx;
  952. }
  953. .item-actions {
  954. display: flex;
  955. align-items: center;
  956. gap: 10rpx;
  957. }
  958. .item-title {
  959. flex: 1;
  960. }
  961. .item-name {
  962. font-size: 28rpx;
  963. color: #333333;
  964. font-weight: bold;
  965. &.status-0 {
  966. color: #ff4d4f;
  967. }
  968. &.status-2 {
  969. color: #999999;
  970. }
  971. }
  972. .item-name-row {
  973. flex-direction: row;
  974. align-items: center;
  975. }
  976. .item-measure {
  977. font-size: 24rpx;
  978. color: #999999;
  979. margin-left: 10rpx;
  980. }
  981. .item-sub-title {
  982. flex: 1;
  983. font-size: 23rpx;
  984. color: #797979;
  985. margin-left: 10rpx;
  986. }
  987. .item-sub-row {
  988. flex-direction: row;
  989. align-items: center;
  990. }
  991. .item-stock {
  992. font-size: 23rpx;
  993. color: #52c41a;
  994. margin-left: 20rpx;
  995. }
  996. .item-measure {
  997. font-size: 23rpx;
  998. color: #999999;
  999. margin-left: 10rpx;
  1000. }
  1001. .add-btn {
  1002. width: 44rpx;
  1003. height: 44rpx;
  1004. border-radius: 22rpx;
  1005. background-color: #165DFF;
  1006. color: #FFFFFF;
  1007. align-items: center;
  1008. justify-content: center;
  1009. }
  1010. .add-btn.disabled {
  1011. background-color: #cccccc;
  1012. }
  1013. .added-btn {
  1014. padding: 8rpx 16rpx;
  1015. border-radius: 8rpx;
  1016. align-items: center;
  1017. justify-content: center;
  1018. }
  1019. .added-icon {
  1020. color: #ff4d4f;
  1021. font-size: 24rpx;
  1022. }
  1023. .detail-link {
  1024. font-size: 21rpx;
  1025. color: #999999;
  1026. }
  1027. .material-list {
  1028. }
  1029. .pagination {
  1030. flex-direction: row;
  1031. display: flex;
  1032. align-items: center;
  1033. justify-content: center;
  1034. padding: 20rpx;
  1035. gap: 30rpx;
  1036. }
  1037. .page-btn {
  1038. padding: 10rpx 20rpx;
  1039. margin: 5px;
  1040. background-color: #165DFF;
  1041. border-radius: 8rpx;
  1042. }
  1043. .page-btn.disabled {
  1044. background-color: #cccccc;
  1045. }
  1046. .page-btn-text {
  1047. color: #FFFFFF;
  1048. font-size: 26rpx;
  1049. }
  1050. .page-info {
  1051. font-size: 26rpx;
  1052. color: #666666;
  1053. }
  1054. .selected-list {
  1055. padding: 20rpx;
  1056. background-color: #ffffff;
  1057. min-height: 150rpx;
  1058. display: flex;
  1059. flex-direction: column;
  1060. gap: 15rpx;
  1061. }
  1062. .empty-tip {
  1063. display: flex;
  1064. align-items: center;
  1065. justify-content: center;
  1066. padding: 40rpx;
  1067. }
  1068. .empty-tip-text {
  1069. color: #999999;
  1070. font-size: 28rpx;
  1071. }
  1072. .selected-item {
  1073. display: flex;
  1074. flex-direction: column;
  1075. background-color: #ffffff;
  1076. border-radius: 10rpx;
  1077. padding: 16rpx 20rpx;
  1078. border: 1rpx solid #e5e5e5;
  1079. box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
  1080. margin-bottom: 12rpx;
  1081. }
  1082. .selected-item-row1 {
  1083. display: flex;
  1084. flex-direction: row;
  1085. align-items: center;
  1086. }
  1087. .selected-item-row2 {
  1088. margin-top: 10rpx;
  1089. }
  1090. .selected-item-name {
  1091. font-size: 26rpx;
  1092. color: #333333;
  1093. margin-right: 20rpx;
  1094. font-weight: 500;
  1095. max-width: 180rpx;
  1096. flex-shrink: 0;
  1097. }
  1098. .selected-item-remark-row {
  1099. margin-top: 10rpx;
  1100. }
  1101. .selected-item-remark {
  1102. width: 100%;
  1103. height: 56rpx;
  1104. padding: 0 16rpx;
  1105. background-color: #f5f5f5;
  1106. border-radius: 6rpx;
  1107. font-size: 24rpx;
  1108. color: #333333;
  1109. border: 1rpx solid #e5e5e5;
  1110. }
  1111. .selected-item-measure {
  1112. font-size: 24rpx;
  1113. color: #999999;
  1114. margin-right: 20rpx;
  1115. flex-shrink: 0;
  1116. }
  1117. .quantity-control {
  1118. display: flex;
  1119. flex-direction: row;
  1120. align-items: center;
  1121. margin-left: auto;
  1122. margin-right: 20rpx;
  1123. flex-shrink: 0;
  1124. }
  1125. .qty-btn {
  1126. width: 44rpx;
  1127. height: 44rpx;
  1128. background-color: #f5f5f5;
  1129. border-radius: 6rpx;
  1130. align-items: center;
  1131. justify-content: center;
  1132. border: 1rpx solid #e5e5e5;
  1133. }
  1134. .qty-btn-text {
  1135. color: #333333;
  1136. font-size: 28rpx;
  1137. font-weight: bold;
  1138. }
  1139. .quantity-input {
  1140. width: 160rpx;
  1141. height: 44rpx;
  1142. background-color: #f5f5f5;
  1143. border-radius: 6rpx;
  1144. font-size: 24rpx;
  1145. padding: 0 10rpx;
  1146. border: 1rpx solid #e5e5e5;
  1147. text-align: center;
  1148. margin: 0 10rpx;
  1149. }
  1150. .quantity-input:focus {
  1151. outline: none;
  1152. border-color: #007aff;
  1153. background-color: #ffffff;
  1154. }
  1155. .delete-btn {
  1156. width: 40rpx;
  1157. height: 40rpx;
  1158. border-radius: 20rpx;
  1159. background-color: #ff4d4f;
  1160. align-items: center;
  1161. justify-content: center;
  1162. display: flex;
  1163. flex-shrink: 0; // 防止删除按钮被压缩
  1164. }
  1165. .delete-icon {
  1166. color: #ffffff;
  1167. font-size: 30rpx;
  1168. font-weight: bold;
  1169. }
  1170. /* 底部按钮 */
  1171. .bottom-buttons {
  1172. padding: 20rpx;
  1173. background-color: #ffffff;
  1174. border-top: 1rpx solid #e5e5e5;
  1175. position: fixed;
  1176. bottom: 0;
  1177. left: 0;
  1178. right: 0;
  1179. z-index: 100;
  1180. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  1181. }
  1182. .btn-row {
  1183. flex-direction: row;
  1184. display: flex;
  1185. gap: 20rpx;
  1186. }
  1187. .save-btn {
  1188. width: 180rpx;
  1189. height: 80rpx;
  1190. background-color: #f5f5f5;
  1191. color: #333333;
  1192. font-size: 28rpx;
  1193. font-weight: 500;
  1194. border-radius: 20rpx;
  1195. border: 1rpx solid #e5e5e5;
  1196. }
  1197. .confirm-btn {
  1198. flex: 1;
  1199. height: 80rpx;
  1200. background-color: #007aff;
  1201. color: #ffffff;
  1202. font-size: 28rpx;
  1203. font-weight: 600;
  1204. border-radius: 20rpx;
  1205. margin-left: 10rpx;
  1206. border: none;
  1207. box-shadow: 0 2rpx 8rpx rgba(0, 122, 255, 0.3);
  1208. }
  1209. /* 新增物料弹窗样式 */
  1210. .picker-modal {
  1211. position: fixed;
  1212. top: 0;
  1213. left: 0;
  1214. right: 0;
  1215. bottom: 0;
  1216. z-index: 1000;
  1217. display: flex;
  1218. align-items: center;
  1219. justify-content: center;
  1220. }
  1221. .modal-mask {
  1222. position: absolute;
  1223. top: 0;
  1224. left: 0;
  1225. right: 0;
  1226. bottom: 0;
  1227. background-color: rgba(0, 0, 0, 0.5);
  1228. }
  1229. .modal-content {
  1230. position: relative;
  1231. width: 90%;
  1232. // max-width: 500rpx;
  1233. background-color: #ffffff;
  1234. border-radius: 16rpx;
  1235. padding: 30rpx;
  1236. box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.15);
  1237. }
  1238. .modal-header {
  1239. display: flex;
  1240. flex-direction: row;
  1241. justify-content: space-between;
  1242. align-items: center;
  1243. margin-bottom: 30rpx;
  1244. padding-bottom: 20rpx;
  1245. border-bottom: 1rpx solid #e5e5e5;
  1246. }
  1247. .modal-title {
  1248. font-size: 32rpx;
  1249. font-weight: bold;
  1250. color: #333333;
  1251. }
  1252. .modal-close {
  1253. font-size: 28rpx;
  1254. color: #999999;
  1255. padding: 8rpx 16rpx;
  1256. border-radius: 8rpx;
  1257. background-color: #f5f5f5;
  1258. }
  1259. .form-item-input {
  1260. display: flex;
  1261. flex-direction: column;
  1262. margin-bottom: 24rpx;
  1263. }
  1264. .label-picker {
  1265. font-size: 28rpx;
  1266. color: #333333;
  1267. margin-bottom: 12rpx;
  1268. font-weight: 500;
  1269. }
  1270. .view-input-picker {
  1271. position: relative;
  1272. width: 100%;
  1273. }
  1274. .input-picker {
  1275. width: 100%;
  1276. height: 80rpx;
  1277. padding: 0 24rpx;
  1278. background-color: #f5f5f5;
  1279. border-radius: 12rpx;
  1280. font-size: 28rpx;
  1281. color: #333333;
  1282. border: 1rpx solid #e5e5e5;
  1283. }
  1284. .input-picker:focus {
  1285. outline: none;
  1286. border-color: #007aff;
  1287. background-color: #ffffff;
  1288. }
  1289. .form-item-btn {
  1290. margin-top: 30rpx;
  1291. display: flex;
  1292. justify-content: center;
  1293. }
  1294. .btn-primary {
  1295. width: 100%;
  1296. height: 80rpx;
  1297. background-color: #007aff;
  1298. color: #ffffff;
  1299. font-size: 28rpx;
  1300. font-weight: 600;
  1301. border-radius: 12rpx;
  1302. border: none;
  1303. box-shadow: 0 2rpx 8rpx rgba(0, 122, 255, 0.3);
  1304. }
  1305. .add-icon{
  1306. color: #ffffff;
  1307. }
  1308. .measure-list {
  1309. max-height: 500rpx;
  1310. overflow-y: auto;
  1311. }
  1312. .measure-item {
  1313. padding: 24rpx;
  1314. border-bottom: 1rpx solid #f0f0f0;
  1315. }
  1316. .measure-name {
  1317. font-size: 28rpx;
  1318. color: #333333;
  1319. }
  1320. .measure-input-row {
  1321. flex-direction: row;
  1322. align-items: center;
  1323. }
  1324. .measure-input-row .input-picker {
  1325. flex: 1;
  1326. margin-right: 16rpx;
  1327. }
  1328. .pick-btn {
  1329. padding: 16rpx 24rpx;
  1330. background-color: #007aff;
  1331. border-radius: 8rpx;
  1332. }
  1333. .pick-btn-text {
  1334. color: #ffffff;
  1335. font-size: 26rpx;
  1336. }
  1337. /* 备注输入框样式 */
  1338. .remark-section {
  1339. padding: 20rpx;
  1340. background-color: #ffffff;
  1341. }
  1342. .remark-input {
  1343. width: 100%;
  1344. min-height: 200rpx;
  1345. padding: 20rpx;
  1346. background-color: #f5f5f5;
  1347. border-radius: 12rpx;
  1348. font-size: 28rpx;
  1349. color: #333333;
  1350. border: 1rpx solid #e5e5e5;
  1351. resize: none;
  1352. box-sizing: border-box;
  1353. }
  1354. .remark-input:focus {
  1355. outline: none;
  1356. border-color: #007aff;
  1357. background-color: #ffffff;
  1358. }
  1359. .remark-count {
  1360. display: block;
  1361. text-align: right;
  1362. margin-top: 10rpx;
  1363. font-size: 24rpx;
  1364. color: #999999;
  1365. }
  1366. /* 图片上传样式 */
  1367. .image-upload-container {
  1368. display: flex;
  1369. flex-direction: row;
  1370. flex-wrap: wrap;
  1371. gap: 16rpx;
  1372. margin-top: 12rpx;
  1373. }
  1374. .uploaded-image {
  1375. position: relative;
  1376. width: 160rpx;
  1377. height: 160rpx;
  1378. border-radius: 8rpx;
  1379. overflow: hidden;
  1380. border: 1rpx solid #e5e5e5;
  1381. }
  1382. .uploaded-image-item {
  1383. width: 100%;
  1384. height: 100%;
  1385. }
  1386. .image-delete-btn {
  1387. position: absolute;
  1388. top: 8rpx;
  1389. right: 8rpx;
  1390. width: 36rpx;
  1391. height: 36rpx;
  1392. border-radius: 18rpx;
  1393. background-color: rgba(0, 0, 0, 0.6);
  1394. display: flex;
  1395. align-items: center;
  1396. justify-content: center;
  1397. }
  1398. .image-delete-icon {
  1399. color: #ffffff;
  1400. font-size: 28rpx;
  1401. font-weight: bold;
  1402. }
  1403. .upload-btn {
  1404. width: 160rpx;
  1405. height: 160rpx;
  1406. border-radius: 8rpx;
  1407. border: 2rpx dashed #e5e5e5;
  1408. display: flex;
  1409. flex-direction: column;
  1410. align-items: center;
  1411. justify-content: center;
  1412. background-color: #fafafa;
  1413. }
  1414. .upload-btn-icon {
  1415. font-size: 48rpx;
  1416. color: #999999;
  1417. margin-bottom: 8rpx;
  1418. }
  1419. .upload-btn-text {
  1420. font-size: 24rpx;
  1421. color: #999999;
  1422. }
  1423. /* 删除确认弹窗样式 */
  1424. .delete-confirm-modal {
  1425. position: fixed;
  1426. top: 0;
  1427. left: 0;
  1428. right: 0;
  1429. bottom: 0;
  1430. z-index: 10000;
  1431. display: flex;
  1432. align-items: center;
  1433. justify-content: center;
  1434. }
  1435. .delete-confirm-mask {
  1436. position: absolute;
  1437. top: 0;
  1438. left: 0;
  1439. right: 0;
  1440. bottom: 0;
  1441. background-color: rgba(0, 0, 0, 0.5);
  1442. }
  1443. .delete-confirm-content {
  1444. position: relative;
  1445. width: 600rpx;
  1446. background-color: #ffffff;
  1447. border-radius: 16rpx;
  1448. padding: 40rpx;
  1449. display: flex;
  1450. flex-direction: column;
  1451. align-items: center;
  1452. }
  1453. .delete-confirm-title {
  1454. font-size: 32rpx;
  1455. font-weight: bold;
  1456. color: #333333;
  1457. margin-bottom: 20rpx;
  1458. }
  1459. .delete-confirm-text {
  1460. font-size: 28rpx;
  1461. color: #666666;
  1462. margin-bottom: 40rpx;
  1463. }
  1464. .delete-confirm-btns {
  1465. display: flex;
  1466. flex-direction: row;
  1467. gap: 40rpx;
  1468. }
  1469. .delete-confirm-cancel {
  1470. padding: 20rpx 60rpx;
  1471. background-color: #f5f5f5;
  1472. border-radius: 12rpx;
  1473. }
  1474. .delete-confirm-cancel-text {
  1475. font-size: 28rpx;
  1476. color: #666666;
  1477. }
  1478. .delete-confirm-ok {
  1479. padding: 20rpx 60rpx;
  1480. background-color: #ff4d4f;
  1481. border-radius: 12rpx;
  1482. }
  1483. .delete-confirm-ok-text {
  1484. font-size: 28rpx;
  1485. color: #ffffff;
  1486. }
  1487. /* 图片预览弹窗样式 */
  1488. .image-preview-modal {
  1489. position: fixed;
  1490. top: 0;
  1491. left: 0;
  1492. right: 0;
  1493. bottom: 0;
  1494. background-color: #000000;
  1495. z-index: 10000;
  1496. display: flex;
  1497. align-items: center;
  1498. justify-content: center;
  1499. }
  1500. .preview-swiper {
  1501. width: 100%;
  1502. height: 80%;
  1503. }
  1504. .preview-image {
  1505. width: 100%;
  1506. height: 100%;
  1507. }
  1508. .preview-close {
  1509. position: absolute;
  1510. top: 80rpx;
  1511. right: 30rpx;
  1512. width: 60rpx;
  1513. height: 60rpx;
  1514. border-radius: 30rpx;
  1515. background-color: rgba(255, 255, 255, 0.3);
  1516. display: flex;
  1517. align-items: center;
  1518. justify-content: center;
  1519. }
  1520. .preview-close-text {
  1521. font-size: 40rpx;
  1522. color: #ffffff;
  1523. }
  1524. .preview-indicator {
  1525. position: absolute;
  1526. bottom: 100rpx;
  1527. left: 50%;
  1528. transform: translateX(-50%);
  1529. padding: 10rpx 30rpx;
  1530. background-color: rgba(0, 0, 0, 0.5);
  1531. border-radius: 20rpx;
  1532. }
  1533. .preview-indicator-text {
  1534. font-size: 28rpx;
  1535. color: #ffffff;
  1536. }
  1537. </style>