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

607 lines
17 KiB

1 week ago
1 week ago
1 week ago
1 week ago
5 days ago
5 days ago
5 days ago
1 week ago
5 days ago
5 days ago
5 days ago
5 days ago
5 days ago
5 days ago
5 days ago
5 days ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <!-- 大Tab维修记录/保养记录 -->
  5. <view class="main-tabs">
  6. <view
  7. class="tab-item"
  8. :class="{ active: activeMainTab === 'repair' }"
  9. @click="switchMainTab('repair')"
  10. >
  11. <text class="tab-text">维修记录</text>
  12. <view class="tab-underline" v-if="activeMainTab === 'repair'"></view>
  13. </view>
  14. <view
  15. class="tab-item"
  16. :class="{ active: activeMainTab === 'maintain' }"
  17. @click="switchMainTab('maintain')"
  18. >
  19. <text class="tab-text">保养记录</text>
  20. <view class="tab-underline" v-if="activeMainTab === 'maintain'"></view>
  21. </view>
  22. </view>
  23. <!-- 筛选按钮区域 -->
  24. <view class="picker-buttons">
  25. <view class="picker-btn" :class="{ active: selectedTime }" @click="showTimePicker" >
  26. <text class="btn-text">{{ selectedTime || '时间' }}</text>
  27. <text class="arrow-icon"></text>
  28. </view>
  29. <view class="picker-btn" :class="{ active: selectedPerson }" @click="showPersonPicker" >
  30. <text class="btn-text">{{ selectedPerson.label || '人员' }}</text>
  31. <text class="arrow-icon"></text>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 日期选择器 -->
  36. <uv-datetime-picker
  37. confirm-color="#C70019"
  38. ref="timePicker"
  39. mode="date"
  40. @confirm="onTimeConfirm"
  41. ></uv-datetime-picker>
  42. <!-- 人员选择器 -->
  43. <uv-picker
  44. ref="personPicker"
  45. :columns="personColumns"
  46. @confirm="onPersonConfirm"
  47. @cancel="onPersonCancel"
  48. keyName="label"
  49. title="选择人员"
  50. confirmColor="#C70019"
  51. ></uv-picker>
  52. <!-- 内容区域 -->
  53. <view class="content-area">
  54. <!-- 记录item -->
  55. <!-- 加载动画容器 -->
  56. <view v-if="list.length">
  57. <view class="record-item" v-for="(record, index) in list" :key="index">
  58. <!-- 维修记录 -->
  59. <template v-if="activeMainTab === 'repair'">
  60. <!-- 基本信息 -->
  61. <view class="info-row">
  62. <text class="label">维修人</text>
  63. <text class="value">{{ record.repairName }}</text>
  64. </view>
  65. <view class="info-row">
  66. <text class="label">联系方式</text>
  67. <text class="value">{{ record.phone }}</text>
  68. </view>
  69. <view class="info-row">
  70. <text class="label">维修日期</text>
  71. <text class="value">{{ record.repairDate }}</text>
  72. </view>
  73. <view class="info-row">
  74. <text class="label">处理内容</text>
  75. </view>
  76. <!-- 处理内容文本区域 -->
  77. <view class="content-text">
  78. <text>{{ record.content }}</text>
  79. </view>
  80. <!-- 上传图片 -->
  81. <view class="info-row" v-if="!collapsedStates[index]">
  82. <text class="label">上传图片</text>
  83. </view>
  84. <view class="image-container" v-if="!collapsedStates[index]">
  85. <image class="uploaded-image" v-for="(value, index) in record.image.split(',')" :key="index" :src="value" mode="aspectFill"></image>
  86. </view>
  87. <!-- 是否产生费用 -->
  88. <view class="info-row" v-if="!collapsedStates[index]">
  89. <text class="label">是否产生费用</text>
  90. <text class="value red-text">{{ record.isExpend === '1' || record.isExpend === 1 ? '是' : '否' }}</text>
  91. </view>
  92. </template>
  93. <!-- 保养记录 -->
  94. <template v-else>
  95. <!-- 基本信息 -->
  96. <view class="info-row">
  97. <text class="label">保养人</text>
  98. <text class="value">{{ record.maintenanceName }}</text>
  99. </view>
  100. <view class="info-row">
  101. <text class="label">保养日期</text>
  102. <text class="value">{{ record.maintenanceDate }}</text>
  103. </view>
  104. <view class="info-row">
  105. <text class="label">保养前状态</text>
  106. </view>
  107. <!-- 保养前状态文本区域 -->
  108. <view class="content-text">
  109. <text>{{ record.stateFrontText }}</text>
  110. </view>
  111. <!-- 保养前图片 -->
  112. <view class="image-container" v-if="!collapsedStates[index]">
  113. <image
  114. class="uploaded-image"
  115. v-for="(img, imgIndex) in record.stateFrontImage.split(',')"
  116. :key="imgIndex"
  117. :src="img"
  118. mode="aspectFill"
  119. ></image>
  120. </view>
  121. <view class="info-row" v-if="!collapsedStates[index]">
  122. <text class="label">保养后状态</text>
  123. </view>
  124. <!-- 保养后状态文本区域 -->
  125. <view class="content-text" v-if="!collapsedStates[index]">
  126. <text>{{ record.stateBackText }}</text>
  127. </view>
  128. <!-- 保养后图片 -->
  129. <view class="image-container" v-if="!collapsedStates[index]">
  130. <image
  131. class="uploaded-image"
  132. v-for="(img, imgIndex) in record.stateBackImage.split(',')"
  133. :key="'after-' + imgIndex"
  134. :src="img"
  135. mode="aspectFill"
  136. ></image>
  137. </view>
  138. <!-- 是否产生费用 -->
  139. <view class="info-row" v-if="!collapsedStates[index]">
  140. <text class="label">是否产生费用</text>
  141. <text class="value red-text">{{ record.isExpend === '1'||record.isExpend === 1 ? '是' : '否' }}</text>
  142. </view>
  143. </template>
  144. <!-- 产生费用 -->
  145. <view class="info-row" v-if="!collapsedStates[index]">
  146. <text class="label">产生费用</text>
  147. <text class="value red-text">{{ record.amount }}</text>
  148. </view>
  149. <!-- 费用详情表格 -->
  150. <view class="cost-table" v-if="!collapsedStates[index]">
  151. <view class="table-header">
  152. <text class="header-cell">费用名称</text>
  153. <text class="header-cell">数量</text>
  154. <text class="header-cell">金额</text>
  155. </view>
  156. <view class="table-row" v-for="(item, costIndex) in record.exhibitMaintenanceExpenses" :key="costIndex">
  157. <text class="cell">{{ item.title }}</text>
  158. <text class="cell">{{ item.num }}</text>
  159. <text class="cell">{{ item.amount }}</text>
  160. </view>
  161. <view class="table-row" v-for="(item, costIndex) in record.exhibitRepairExpenseList" :key="costIndex">
  162. <text class="cell">{{ item.title }}</text>
  163. <text class="cell">{{ item.num }}</text>
  164. <text class="cell">{{ item.amount }}</text>
  165. </view>
  166. </view>
  167. <!-- 维修记录特有字段 -->
  168. <template v-if="activeMainTab === 'repair'">
  169. <!-- 问题是否解决 -->
  170. <view class="info-row" >
  171. <text class="label">问题是否解决</text>
  172. <text class="value red-text">{{ record.isFix_dictText }}</text>
  173. </view>
  174. <!-- 备注 -->
  175. <view class="info-row" v-if="!collapsedStates[index]">
  176. <text class="label">备注</text>
  177. </view>
  178. <!-- 备注文本区域 -->
  179. <view class="content-text" v-if="!collapsedStates[index]">
  180. <text>{{ record.remark }}</text>
  181. </view>
  182. </template>
  183. <!-- 保养记录特有字段 -->
  184. <template v-else>
  185. <!-- 附件信息 -->
  186. <view class="info-row" v-if="!collapsedStates[index]">
  187. <text class="label">附件信息</text>
  188. </view>
  189. <!-- 附件信息文本区域 -->
  190. <view class="content-text" v-if="!collapsedStates[index]">
  191. <text>{{ record.remarkText }}</text>
  192. </view>
  193. <!-- 附件图片 -->
  194. <view class="image-container" v-if="!collapsedStates[index]">
  195. <image class="uploaded-image" v-for="(value, index) in record.remarkImage.split(',')" :src="value" :key="index" mode="aspectFill"></image>
  196. </view>
  197. <!-- 保养备注 -->
  198. <view class="info-row" v-if="!collapsedStates[index]">
  199. <text class="label">备注</text>
  200. </view>
  201. <!-- 保养备注文本区域 -->
  202. <view class="content-text" v-if="!collapsedStates[index]">
  203. <text>{{ record.remark }}</text>
  204. </view>
  205. </template>
  206. <!-- 收起按钮 -->
  207. <view class="collapse-btn" @click="toggleCollapse(index)">
  208. <text class="collapse-text">{{ collapsedStates[index] ? '查看全部' : '收起' }}</text>
  209. <text class="collapse-icon">{{ collapsedStates[index] ? '▼' : '▲' }}</text>
  210. </view>
  211. </view>
  212. <uv-loading-icon v-if="loading"></uv-loading-icon>
  213. </view>
  214. <view v-else-if="!loading && !records.length ">
  215. <uv-empty icon="/static/暂无搜索结果.png" />
  216. </view>
  217. <uv-loading-icon v-else></uv-loading-icon>
  218. </view>
  219. </view>
  220. </template>
  221. <script>
  222. import ListMixin from '@/mixins/list'
  223. export default {
  224. mixins: [ListMixin],
  225. data() {
  226. return {
  227. showpieceId: '',
  228. mixinListApi: 'exhibit.queryRepairList',
  229. activeMainTab: 'repair', // 当前激活的主Tab
  230. activeFilter: 0, // 当前激活的筛选器
  231. collapsedStates: [], // 控制每个记录项的展开/收起状态
  232. afterUpdateDataFn(list) {
  233. this.collapsedStates = new Array(list.length).fill(true)
  234. },
  235. filterOptions: [
  236. { name: '时间' },
  237. { name: '人员' }
  238. ],
  239. selectedTime: '', // 选中的时间
  240. selectedPerson: '', // 选中的人员
  241. timeColumns: [
  242. ['今天', '昨天', '本周', '本月', '上月', '自定义']
  243. ],
  244. personColumns: [ ]
  245. }
  246. },
  247. computed: {
  248. contentText() {
  249. const tabText = this.activeMainTab === 'repair' ? '维修' : '保养'
  250. const filterText = this.filterOptions[this.activeFilter].name
  251. let selectedText = ''
  252. if (this.activeFilter === 0 && this.selectedTime) {
  253. selectedText = ` - ${this.selectedTime}`
  254. } else if (this.activeFilter === 1 && this.selectedPerson) {
  255. selectedText = ` - ${this.selectedPerson}`
  256. }
  257. return `${tabText}记录 - 按${filterText}筛选${selectedText}`
  258. }
  259. },
  260. methods: {
  261. mixinSetParams() {
  262. const params = { }
  263. if (this.activeMainTab === 'repair' && this.selectedTime) {
  264. params.repairDate = this.selectedTime
  265. } else if (this.activeMainTab === 'maintain' && this.selectedTime) {
  266. params.maintainDate = this.selectedTime
  267. }
  268. if (this.selectedPerson) {
  269. params.id = this.selectedPerson.id
  270. }
  271. return {
  272. showpieceId: this.showpieceId,
  273. ...params
  274. }
  275. },
  276. async switchMainTab(tab) {
  277. this.activeMainTab = tab
  278. this.mixinListApi = this.activeMainTab === 'repair' ? 'exhibit.queryRepairList' : 'exhibit.queryMaintenanceList'
  279. this.onFilterChange()
  280. this.initPage()
  281. this.getList(true)
  282. // this.initCollapsedStates()
  283. },
  284. onFilterChange() {
  285. // this.activeFilter = index
  286. // 切换筛选器时清空选择
  287. this.selectedTime = ''
  288. this.selectedPerson = ''
  289. },
  290. showTimePicker() {
  291. this.$refs.timePicker.open()
  292. },
  293. showPersonPicker() {
  294. this.$refs.personPicker.open()
  295. },
  296. onTimeConfirm(e) {
  297. this.selectedTime = this.$utils.formatTime(e.value)
  298. this.initPage()
  299. this.getList(true)
  300. },
  301. onTimeCancel() {
  302. console.log('取消选择时间')
  303. },
  304. onPersonConfirm(value) {
  305. this.selectedPerson = value.value[0]
  306. console.log('选择的人员:', value)
  307. this.initPage()
  308. this.getList(true)
  309. },
  310. onPersonCancel() {
  311. console.log('取消选择人员')
  312. },
  313. toggleCollapse(index) {
  314. this.$set(this.collapsedStates, index, !this.collapsedStates[index])
  315. console.log('收起/展开费用详情', this.collapsedStates[index])
  316. }
  317. },
  318. async onLoad(args){{
  319. this.showpieceId = args.id
  320. const userRes = await this.$api.config.queryUserList()
  321. this.personColumns = [[...userRes.result.records.map(item => ({
  322. label: item.nickName,
  323. id: item.id
  324. }))]]
  325. }}
  326. }
  327. </script>
  328. <style lang="scss" scoped>
  329. .container {
  330. background-color: #f5f5f5;
  331. min-height: 100vh;
  332. }
  333. .header{
  334. padding: 16rpx 39rpx 23rpx;
  335. background: #fff;
  336. }
  337. .main-tabs {
  338. display: flex;
  339. margin-bottom: 48rpx;
  340. // border-bottom: 2rpx solid #f0f0f0;
  341. .tab-item {
  342. flex: 1;
  343. position: relative;
  344. padding: 13rpx 0;
  345. text-align: center;
  346. .tab-text {
  347. font-size: 28rpx;
  348. color: $secondary-text-color;
  349. font-weight: 400;
  350. transition: all 0.3s ease;
  351. }
  352. &.active {
  353. .tab-text {
  354. color: $primary-color;
  355. // font-weight: 600;
  356. }
  357. }
  358. .tab-underline {
  359. position: absolute;
  360. bottom: 0;
  361. left: 50%;
  362. transform: translateX(-50%);
  363. width: 60rpx;
  364. height: 4rpx;
  365. background-color: $primary-color;
  366. border-radius: 2rpx;
  367. }
  368. }
  369. }
  370. .filter-section {
  371. margin-bottom: 32rpx;
  372. }
  373. .picker-buttons {
  374. // margin-bottom: 32rpx;
  375. display: flex;
  376. gap: 55rpx;
  377. .picker-btn {
  378. display: flex;
  379. align-items: center;
  380. justify-content: flex-start;
  381. padding: 0;
  382. background-color: transparent;
  383. color: $primary-text-color;
  384. &.active {
  385. color: $primary-color;
  386. }
  387. .btn-text {
  388. font-size: 28rpx;
  389. // color: $primary-color;
  390. margin-right: 10rpx;
  391. }
  392. .arrow-icon {
  393. font-size: 20rpx;
  394. // color: $primary-color;
  395. }
  396. }
  397. }
  398. .content-area {
  399. padding: 22rpx 29rpx;
  400. .loading-icon {
  401. margin-top: 60rpx;
  402. }
  403. .record-item {
  404. background: #fff;
  405. border-radius: 16rpx;
  406. padding: 29rpx;
  407. margin-bottom: 37rpx;
  408. border-radius: 15rpx;
  409. box-shadow: 0 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  410. .info-row {
  411. display: flex;
  412. justify-content: space-between;
  413. align-items: flex-start;
  414. margin-bottom: 38rpx;
  415. .label {
  416. font-size: 28rpx;
  417. color: $primary-text-color;
  418. // font-weight: 400;
  419. flex-shrink: 0;
  420. }
  421. .value {
  422. font-size: 28rpx;
  423. color: $primary-text-color;
  424. text-align: right;
  425. flex: 1;
  426. margin-left: 32rpx;
  427. &.red-text {
  428. color: $primary-color;
  429. }
  430. }
  431. }
  432. .content-text {
  433. background: #f5f5f5;
  434. border-radius: 15rpx;
  435. padding: 24rpx;
  436. margin-bottom: 24rpx;
  437. min-height: 120rpx;
  438. text {
  439. font-size: 28rpx;
  440. color: $primary-text-color;
  441. line-height: 1.5;
  442. }
  443. }
  444. .image-container {
  445. margin-bottom: 29rpx;
  446. .uploaded-image {
  447. width: 157rpx;
  448. height: 157rpx;
  449. // border-radius: 8rpx;
  450. }
  451. }
  452. .cost-table {
  453. margin-bottom: 24rpx;
  454. .table-header {
  455. display: flex;
  456. // background: #f8f8f8;
  457. // border-radius: 8rpx 8rpx 0 0;
  458. padding: 30rpx 0;
  459. justify-content: space-between;
  460. .header-cell {
  461. flex: 1;
  462. font-size: 30rpx;
  463. color: $secondary-text-color;
  464. &:nth-child(1) {
  465. text-align: left;
  466. }
  467. &:nth-child(2) {
  468. text-align: center;
  469. }
  470. &:nth-child(3) {
  471. text-align: right;
  472. }
  473. // font-weight: 500;
  474. }
  475. }
  476. .table-row {
  477. display: flex;
  478. border-bottom: 1rpx solid #f0f0f0;
  479. padding: 30rpx 0;
  480. // justify-content: space-between;
  481. .cell {
  482. flex: 1;
  483. font-size: 30rpx;
  484. color: $primary-text-color;
  485. &:nth-child(1) {
  486. text-align: left;
  487. }
  488. &:nth-child(2) {
  489. text-align: center;
  490. }
  491. &:nth-child(3) {
  492. text-align: right;
  493. }
  494. }
  495. // .cell:first-child {
  496. // text-align: center;
  497. // }
  498. }
  499. }
  500. .view-all-btn {
  501. display: flex;
  502. justify-content: center;
  503. align-items: center;
  504. padding: 16rpx 0;
  505. margin-top: 16rpx;
  506. .view-all-text {
  507. font-size: 26rpx;
  508. color: $primary-color;
  509. margin-right: 8rpx;
  510. }
  511. .view-all-icon {
  512. font-size: 20rpx;
  513. color: $primary-color;
  514. }
  515. }
  516. .collapse-btn {
  517. display: flex;
  518. justify-content: center;
  519. align-items: center;
  520. padding: 16rpx 0;
  521. margin-top: 16rpx;
  522. .collapse-text {
  523. font-size: 26rpx;
  524. color: $primary-color;
  525. margin-right: 8rpx;
  526. }
  527. .collapse-icon {
  528. font-size: 20rpx;
  529. color: $primary-color;
  530. }
  531. }
  532. }
  533. }
  534. </style>