展品维保小程序前端代码接口
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.

364 lines
9.3 KiB

  1. <template>
  2. <view class="maintain-container">
  3. <!-- 顶部选择器区域 -->
  4. <view class="selector-section">
  5. <!-- 紧急程度选择器 -->
  6. <view class="selector-item" @click="openUrgencyPicker">
  7. <text class="selector-label" :class="{ active: selectedUrgency !== '紧急程度' }">{{ selectedUrgency }}</text>
  8. <uv-icon name="arrow-down-fill" size="14" :color="selectedUrgency !== '紧急程度' ? '#C70019' : '#000'"></uv-icon>
  9. </view>
  10. <!-- 维修状态选择器 -->
  11. <view class="selector-item" @click="openStatusPicker">
  12. <text class="selector-label" :class="{ active: selectedStatus !== '维修状态' }">{{ selectedStatus }}</text>
  13. <uv-icon name="arrow-down-fill" size="14" :color="selectedStatus !== '维修状态' ? '#C70019' : '#000'"></uv-icon>
  14. </view>
  15. </view>
  16. <!-- 产品列表 -->
  17. <view class="product-list">
  18. <view class="product-item" v-for="(item, index) in productList" :key="index" @click="navigateToDetail(item)">
  19. <!-- 产品ID和状态标签 -->
  20. <view class="item-header">
  21. <view >
  22. <text class="item-id">{{ item.id }}</text>
  23. <img src="@/static/copy.png" alt="复制图标" class="item-icon">
  24. </view>
  25. <view class="status-tag" :class="[getStatusClass(item.status)]">
  26. <text class="status-text">{{ item.status }}</text>
  27. </view>
  28. </view>
  29. <!-- 中间那条下划线 -->
  30. <view class="item-border" />
  31. <!-- 产品标题 -->
  32. <view class="item-title">
  33. <text class="title-text">{{ item.name }}</text>
  34. </view>
  35. <!-- 产品详情 -->
  36. <view class="item-details">
  37. <view class="detail-row">
  38. <view class="detail-item">
  39. <text class="detail-label">展品编号</text>
  40. <text class="detail-value">{{ item.code }}</text>
  41. </view>
  42. <view class="detail-item">
  43. <text class="detail-label">紧急程度</text>
  44. <text class="detail-value">一般</text>
  45. </view>
  46. </view>
  47. <view class="detail-row">
  48. <view class="detail-item">
  49. <text class="detail-label">展品位置</text>
  50. <text class="detail-value">{{ item.location }}</text>
  51. </view>
  52. </view>
  53. <view class="detail-row">
  54. <view class="detail-item">
  55. <text class="detail-label">报修人</text>
  56. <text class="detail-value">{{ item.reporter }}</text>
  57. </view>
  58. <view class="detail-item">
  59. <text class="detail-label">报修日期</text>
  60. <text class="detail-value">{{ item.reportDate }}</text>
  61. </view>
  62. </view>
  63. <view class="detail-row">
  64. <view class="detail-item full-width">
  65. <text class="detail-label">故障描述</text>
  66. <text class="detail-value">{{ item.description }}</text>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- 操作按钮 -->
  71. <view class="item-actions">
  72. <button class="item-actions-button">立即维修</button>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 紧急程度选择器 -->
  77. <uv-picker
  78. ref="urgencyPicker"
  79. v-model="urgencyShow"
  80. :columns="urgencyColumns"
  81. mode="selector"
  82. @confirm="onUrgencyConfirm"
  83. confirmColor="#C70019"
  84. ></uv-picker>
  85. <!-- 维修状态选择器 -->
  86. <uv-picker
  87. ref="statusPicker"
  88. v-model="statusShow"
  89. :columns="statusColumns"
  90. mode="selector"
  91. @confirm="onStatusConfirm"
  92. confirmColor="#C70019"
  93. ></uv-picker>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. selectedUrgency: '紧急程度',
  101. selectedStatus: '维修状态',
  102. urgencyShow: false,
  103. statusShow: false,
  104. urgencyColumns: [
  105. [
  106. '一般',
  107. '紧急',
  108. '非常紧急'
  109. ]
  110. ],
  111. statusColumns: [
  112. [
  113. '维护中',
  114. '故障中',
  115. '已解决'
  116. ]
  117. ],
  118. productList: [
  119. {
  120. id: '3451356565',
  121. name: '展品名称内容',
  122. code: '56559685623452',
  123. location: '2楼互动区液体力学',
  124. reporter: '李天华',
  125. reportDate: '2025-08-19',
  126. description: '展品右上边有破损,影响正常使用',
  127. status: '维修中'
  128. },
  129. {
  130. id: '3451356565',
  131. name: '展品名称内容',
  132. code: '56559685623452',
  133. location: '2楼互动区液体力学',
  134. reporter: '李天华',
  135. reportDate: '2025-08-19',
  136. description: '展品右上边有破损,影响正常使用',
  137. status: '故障中'
  138. },
  139. {
  140. id: '3451356565',
  141. name: '展品名称内容',
  142. code: '56559685623452',
  143. location: '2楼互动区液体力学',
  144. reporter: '李天华',
  145. reportDate: '2025-08-19',
  146. description: '展品右上边有破损,影响正常使用',
  147. status: '已解决'
  148. }
  149. ]
  150. }
  151. },
  152. methods: {
  153. navigateToDetail(item) {
  154. uni.navigateTo({
  155. url: '/subPages/repair/maintainSubmit?id=' + item.id
  156. })
  157. },
  158. openUrgencyPicker() {
  159. this.$refs.urgencyPicker.open()
  160. },
  161. openStatusPicker() {
  162. this.$refs.statusPicker.open()
  163. },
  164. onUrgencyConfirm(e) {
  165. this.selectedUrgency = e.value[0]
  166. console.log('选择紧急程度:', e)
  167. // TODO: 根据紧急程度筛选
  168. },
  169. onStatusConfirm(e) {
  170. this.selectedStatus = e.value[0]
  171. console.log('选择维修状态:', e)
  172. // TODO: 根据状态筛选
  173. },
  174. getStatusClass(status) {
  175. switch(status) {
  176. case '维修中':
  177. return 'status-repairing'
  178. case '故障中':
  179. return 'status-fault'
  180. case '已解决':
  181. return 'status-resolved'
  182. default:
  183. return ''
  184. }
  185. },
  186. handleRepair(item) {
  187. console.log('立即维修:', item)
  188. // TODO: 处理维修逻辑
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .maintain-container {
  195. background-color: #fff;
  196. min-height: 100vh;
  197. }
  198. .selector-section {
  199. display: flex;
  200. padding: 34rpx 41rpx;
  201. // background-color: #fff;
  202. gap: 58rpx;
  203. .selector-item {
  204. display: flex;
  205. align-items: center;
  206. gap: 9rpx;
  207. cursor: pointer;
  208. .selector-label {
  209. font-size: 28rpx;
  210. color: #000;
  211. &.active {
  212. color: $primary-color;
  213. }
  214. }
  215. }
  216. }
  217. .product-list {
  218. padding: 20rpx 32rpx;
  219. .product-item {
  220. background-color: #fff;
  221. border-radius: 15rpx;
  222. padding: 30rpx 30rpx 20rpx;
  223. margin-bottom: 24rpx;
  224. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  225. .item-header {
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. margin-bottom: 13.5rpx;
  230. .item-icon {
  231. width: 25.5rpx;
  232. height: 25.5rpx;
  233. }
  234. .item-id {
  235. font-size: 28rpx;
  236. margin-right: 20rpx;
  237. color: $secondary-text-color;
  238. }
  239. .status-tag {
  240. border-radius: 15rpx;
  241. width: 135rpx;
  242. height: 57rpx;
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. .status-text {
  247. font-size: 28rpx;
  248. }
  249. &.status-repairing {
  250. background-color: #ffffca;
  251. color: #CE7C62;
  252. }
  253. &.status-fault {
  254. background-color: #fccec7;
  255. color: #b82222;
  256. }
  257. &.status-resolved {
  258. background-color: #cfffca;
  259. color: #528828;
  260. }
  261. }
  262. }
  263. .item-border {
  264. border-bottom: 1rpx solid $secondary-text-color;
  265. // background-color: #E5E5E5;
  266. margin-bottom: 26.5rpx;
  267. opacity: 0.22;
  268. }
  269. .item-title {
  270. margin-bottom: 37rpx;
  271. .title-text {
  272. font-size: 30rpx;
  273. color: $primary-text-color;
  274. font-weight: bold;
  275. }
  276. }
  277. .item-details {
  278. margin-bottom: 52rpx;
  279. .detail-row {
  280. display: flex;
  281. margin-bottom: 25rpx;
  282. &:last-child {
  283. margin-bottom: 0;
  284. }
  285. .detail-item {
  286. flex: 1;
  287. display: flex;
  288. align-items: flex-start;
  289. margin-right: 35rpx;
  290. &.full-width {
  291. flex: 1 1 100%;
  292. margin-right: 0;
  293. }
  294. &:last-child {
  295. margin-right: 0;
  296. margin-bottom: 0;
  297. }
  298. .detail-label {
  299. font-size: 22rpx;
  300. color: $secondary-text-color;
  301. margin-right: 19rpx;
  302. flex-shrink: 0;
  303. min-width: 95rpx;
  304. }
  305. .detail-value {
  306. font-size: 22rpx;
  307. color: $primary-text-color;
  308. flex: 1;
  309. }
  310. }
  311. }
  312. }
  313. .item-actions {
  314. display: flex;
  315. justify-content: center;
  316. .item-actions-button {
  317. width: 378rpx;
  318. height: 78rpx;
  319. background-color: $primary-color;
  320. color: #fff;
  321. font-size: 28rpx;
  322. border-radius: 39rpx;
  323. }
  324. }
  325. }
  326. }
  327. </style>