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

613 lines
18 KiB

1 week ago
1 week ago
1 week ago
1 week ago
5 days ago
5 days ago
5 days 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
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] && record.image">
  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] && record.stateFrontImage">
  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] && record.stateBackImage">
  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] && record.exhibitMaintenanceExpenses.length">
  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] && record.remarkImage">
  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. <view v-if="isLoading" style="padding:400rpx 0; ">
  213. <uv-loading-icon text="正在加载中 先喝杯茶吧"></uv-loading-icon>
  214. </view>
  215. </view>
  216. <view v-else-if="!isLoading && !list.length ">
  217. <uv-empty icon="/static/暂无搜索结果.png" />
  218. </view>
  219. <view v-else style="padding:400rpx 0; ">
  220. <uv-loading-icon text="正在加载中 先喝杯茶吧"></uv-loading-icon>
  221. </view>
  222. </view>
  223. </view>
  224. </template>
  225. <script>
  226. import ListMixin from '@/mixins/list'
  227. export default {
  228. mixins: [ListMixin],
  229. data() {
  230. return {
  231. showpieceId: '',
  232. mixinListApi: 'exhibit.queryRepairList',
  233. activeMainTab: 'repair', // 当前激活的主Tab
  234. activeFilter: 0, // 当前激活的筛选器
  235. collapsedStates: [], // 控制每个记录项的展开/收起状态
  236. afterUpdateDataFn(list) {
  237. // 改为新增加的数组部分 为true 原来的 状态保留
  238. this.collapsedStates.push(...new Array(8).fill(true))
  239. },
  240. filterOptions: [
  241. { name: '时间' },
  242. { name: '人员' }
  243. ],
  244. selectedTime: '', // 选中的时间
  245. selectedPerson: '', // 选中的人员
  246. timeColumns: [
  247. ['今天', '昨天', '本周', '本月', '上月', '自定义']
  248. ],
  249. personColumns: [ ]
  250. }
  251. },
  252. computed: {
  253. contentText() {
  254. const tabText = this.activeMainTab === 'repair' ? '维修' : '保养'
  255. const filterText = this.filterOptions[this.activeFilter].name
  256. let selectedText = ''
  257. if (this.activeFilter === 0 && this.selectedTime) {
  258. selectedText = ` - ${this.selectedTime}`
  259. } else if (this.activeFilter === 1 && this.selectedPerson) {
  260. selectedText = ` - ${this.selectedPerson}`
  261. }
  262. return `${tabText}记录 - 按${filterText}筛选${selectedText}`
  263. }
  264. },
  265. methods: {
  266. mixinSetParams() {
  267. const params = { }
  268. if (this.activeMainTab === 'repair' && this.selectedTime) {
  269. params.repairDate = this.selectedTime
  270. } else if (this.activeMainTab === 'maintain' && this.selectedTime) {
  271. params.maintainDate = this.selectedTime
  272. }
  273. if (this.selectedPerson) {
  274. params.id = this.selectedPerson.id
  275. }
  276. return {
  277. showpieceId: this.showpieceId,
  278. ...params
  279. }
  280. },
  281. async switchMainTab(tab) {
  282. this.activeMainTab = tab
  283. this.mixinListApi = this.activeMainTab === 'repair' ? 'exhibit.queryRepairList' : 'exhibit.queryMaintenanceList'
  284. this.onFilterChange()
  285. this.initPage()
  286. this.list = []
  287. this.getList(true)
  288. // this.initCollapsedStates()
  289. },
  290. onFilterChange() {
  291. // this.activeFilter = index
  292. // 切换筛选器时清空选择
  293. this.selectedTime = ''
  294. this.selectedPerson = ''
  295. },
  296. showTimePicker() {
  297. this.$refs.timePicker.open()
  298. },
  299. showPersonPicker() {
  300. this.$refs.personPicker.open()
  301. },
  302. onTimeConfirm(e) {
  303. this.selectedTime = this.$utils.formatTime(e.value)
  304. this.initPage()
  305. this.getList(true)
  306. },
  307. onTimeCancel() {
  308. console.log('取消选择时间')
  309. },
  310. onPersonConfirm(value) {
  311. this.selectedPerson = value.value[0]
  312. console.log('选择的人员:', value)
  313. this.initPage()
  314. this.getList(true)
  315. },
  316. onPersonCancel() {
  317. console.log('取消选择人员')
  318. },
  319. toggleCollapse(index) {
  320. this.$set(this.collapsedStates, index, !this.collapsedStates[index])
  321. console.log('收起/展开费用详情', this.collapsedStates[index])
  322. }
  323. },
  324. async onLoad(args){{
  325. this.showpieceId = args.id
  326. const userRes = await this.$api.config.queryUserList()
  327. this.personColumns = [[...userRes.result.records.map(item => ({
  328. label: item.nickName,
  329. id: item.id
  330. }))]]
  331. }}
  332. }
  333. </script>
  334. <style lang="scss" scoped>
  335. .container {
  336. background-color: #f5f5f5;
  337. min-height: 100vh;
  338. }
  339. .header{
  340. padding: 16rpx 39rpx 23rpx;
  341. background: #fff;
  342. }
  343. .main-tabs {
  344. display: flex;
  345. margin-bottom: 48rpx;
  346. // border-bottom: 2rpx solid #f0f0f0;
  347. .tab-item {
  348. flex: 1;
  349. position: relative;
  350. padding: 13rpx 0;
  351. text-align: center;
  352. .tab-text {
  353. font-size: 28rpx;
  354. color: $secondary-text-color;
  355. font-weight: 400;
  356. transition: all 0.3s ease;
  357. }
  358. &.active {
  359. .tab-text {
  360. color: $primary-color;
  361. // font-weight: 600;
  362. }
  363. }
  364. .tab-underline {
  365. position: absolute;
  366. bottom: 0;
  367. left: 50%;
  368. transform: translateX(-50%);
  369. width: 60rpx;
  370. height: 4rpx;
  371. background-color: $primary-color;
  372. border-radius: 2rpx;
  373. }
  374. }
  375. }
  376. .filter-section {
  377. margin-bottom: 32rpx;
  378. }
  379. .picker-buttons {
  380. // margin-bottom: 32rpx;
  381. display: flex;
  382. gap: 55rpx;
  383. .picker-btn {
  384. display: flex;
  385. align-items: center;
  386. justify-content: flex-start;
  387. padding: 0;
  388. background-color: transparent;
  389. color: $primary-text-color;
  390. &.active {
  391. color: $primary-color;
  392. }
  393. .btn-text {
  394. font-size: 28rpx;
  395. // color: $primary-color;
  396. margin-right: 10rpx;
  397. }
  398. .arrow-icon {
  399. font-size: 20rpx;
  400. // color: $primary-color;
  401. }
  402. }
  403. }
  404. .content-area {
  405. padding: 22rpx 29rpx;
  406. .loading-icon {
  407. margin-top: 60rpx;
  408. }
  409. .record-item {
  410. background: #fff;
  411. border-radius: 16rpx;
  412. padding: 29rpx;
  413. margin-bottom: 37rpx;
  414. border-radius: 15rpx;
  415. box-shadow: 0 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  416. .info-row {
  417. display: flex;
  418. justify-content: space-between;
  419. align-items: flex-start;
  420. margin-bottom: 38rpx;
  421. .label {
  422. font-size: 28rpx;
  423. color: $primary-text-color;
  424. // font-weight: 400;
  425. flex-shrink: 0;
  426. }
  427. .value {
  428. font-size: 28rpx;
  429. color: $primary-text-color;
  430. text-align: right;
  431. flex: 1;
  432. margin-left: 32rpx;
  433. &.red-text {
  434. color: $primary-color;
  435. }
  436. }
  437. }
  438. .content-text {
  439. background: #f5f5f5;
  440. border-radius: 15rpx;
  441. padding: 24rpx;
  442. margin-bottom: 24rpx;
  443. min-height: 120rpx;
  444. text {
  445. font-size: 28rpx;
  446. color: $primary-text-color;
  447. line-height: 1.5;
  448. }
  449. }
  450. .image-container {
  451. margin-bottom: 29rpx;
  452. .uploaded-image {
  453. width: 157rpx;
  454. height: 157rpx;
  455. // border-radius: 8rpx;
  456. }
  457. }
  458. .cost-table {
  459. margin-bottom: 24rpx;
  460. .table-header {
  461. display: flex;
  462. // background: #f8f8f8;
  463. // border-radius: 8rpx 8rpx 0 0;
  464. padding: 30rpx 0;
  465. justify-content: space-between;
  466. .header-cell {
  467. flex: 1;
  468. font-size: 30rpx;
  469. color: $secondary-text-color;
  470. &:nth-child(1) {
  471. text-align: left;
  472. }
  473. &:nth-child(2) {
  474. text-align: center;
  475. }
  476. &:nth-child(3) {
  477. text-align: right;
  478. }
  479. // font-weight: 500;
  480. }
  481. }
  482. .table-row {
  483. display: flex;
  484. border-bottom: 1rpx solid #f0f0f0;
  485. padding: 30rpx 0;
  486. // justify-content: space-between;
  487. .cell {
  488. flex: 1;
  489. font-size: 30rpx;
  490. color: $primary-text-color;
  491. &:nth-child(1) {
  492. text-align: left;
  493. }
  494. &:nth-child(2) {
  495. text-align: center;
  496. }
  497. &:nth-child(3) {
  498. text-align: right;
  499. }
  500. }
  501. // .cell:first-child {
  502. // text-align: center;
  503. // }
  504. }
  505. }
  506. .view-all-btn {
  507. display: flex;
  508. justify-content: center;
  509. align-items: center;
  510. padding: 16rpx 0;
  511. margin-top: 16rpx;
  512. .view-all-text {
  513. font-size: 26rpx;
  514. color: $primary-color;
  515. margin-right: 8rpx;
  516. }
  517. .view-all-icon {
  518. font-size: 20rpx;
  519. color: $primary-color;
  520. }
  521. }
  522. .collapse-btn {
  523. display: flex;
  524. justify-content: center;
  525. align-items: center;
  526. padding: 16rpx 0;
  527. margin-top: 16rpx;
  528. .collapse-text {
  529. font-size: 26rpx;
  530. color: $primary-color;
  531. margin-right: 8rpx;
  532. }
  533. .collapse-icon {
  534. font-size: 20rpx;
  535. color: $primary-color;
  536. }
  537. }
  538. }
  539. }
  540. </style>