From 177284c9924907b7a2f777c487de93c4f7233a9a Mon Sep 17 00:00:00 2001 From: hflllll Date: Fri, 5 Sep 2025 15:45:38 +0800 Subject: [PATCH] =?UTF-8?q?'=E4=BF=AEBUG'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/modules/config.js | 8 ++ pages/index/home.vue | 20 ++- pages/index/maintain.vue | 4 +- subPages/home/RAArecord.vue | 2 +- subPages/home/maintainanceSubmit.vue | 251 ++++++++++++++++------------------- subPages/home/repairSubmit.vue | 7 +- subPages/repair/maintainSubmit.vue | 15 ++- 7 files changed, 159 insertions(+), 148 deletions(-) diff --git a/api/modules/config.js b/api/modules/config.js index 46ebab7..0ad0aa7 100644 --- a/api/modules/config.js +++ b/api/modules/config.js @@ -40,4 +40,12 @@ export default { method: 'GET' }) }, + + // 配置- 查看轮播图列表 + async queryBannerList() { + return http({ + url: '/config/queryBannerList', + method: 'GET' + }) + } } \ No newline at end of file diff --git a/pages/index/home.vue b/pages/index/home.vue index 9265b51..0c773c7 100644 --- a/pages/index/home.vue +++ b/pages/index/home.vue @@ -2,7 +2,8 @@ @@ -107,7 +108,8 @@ export default { label: '', value: '' }, - + // 轮播图数据 + bannerList: [], } }, computed: { @@ -182,9 +184,17 @@ export default { uni.navigateTo({ url: '/subPages/home/RAArecord?id=' + item.id }) - // TODO: 跳转到维修保养记录页面 - } - } + }, + async getBannerList() { + const bannerRes = await this.$api.config.queryBannerList() + if (bannerRes.code === 200) { + this.bannerList = bannerRes.result.records.map(item => item.image) + } + }, + }, + onLoad(){ + this.getBannerList() + }, } diff --git a/pages/index/maintain.vue b/pages/index/maintain.vue index fdc00d8..39951c6 100644 --- a/pages/index/maintain.vue +++ b/pages/index/maintain.vue @@ -62,7 +62,7 @@ 报修日期 - {{ item.firstDate }} + {{ item.malfunctionDate }} @@ -176,7 +176,7 @@ export default { }, navigateToDetail(item) { uni.navigateTo({ - url: '/subPages/repair/maintainSubmit?id=' + item.id + url: '/subPages/repair/maintainSubmit?id=' + item.id + '&showpieceId=' + item.showpieceId }) }, openUrgencyPicker() { diff --git a/subPages/home/RAArecord.vue b/subPages/home/RAArecord.vue index a6a6faf..73dc8e3 100644 --- a/subPages/home/RAArecord.vue +++ b/subPages/home/RAArecord.vue @@ -115,7 +115,7 @@ 保养日期 - {{ record.maintainDate }} + {{ record.maintenanceDate }} diff --git a/subPages/home/maintainanceSubmit.vue b/subPages/home/maintainanceSubmit.vue index ac272b4..8ea3670 100644 --- a/subPages/home/maintainanceSubmit.vue +++ b/subPages/home/maintainanceSubmit.vue @@ -111,63 +111,60 @@ - - - 产生费用 - - - - 费用名称 - + 产生费用 + + + disabled + class="input-field" + /> + + + + + + + 费用名称 + 数量 + 金额 + - - - 费用名称 - 数量 - 金额 + + + - - - {{ item.name }} - - - {{ item.quantity }} - - + + + + - - - - - 添加费用项目 + + + + + + + @@ -210,7 +207,7 @@ 下次保养日期 - {{ malfunctionDate || '请选择' }} + {{ nextMaintenanceDate || '请选择' }} @@ -248,6 +245,7 @@ confirm-color="#C70019" ref="datePicker" mode="date" + v-model="timeValue" @confirm="confirmDate" > @@ -255,6 +253,7 @@ confirm-color="#C70019" ref="nextDatePicker" mode="date" + v-model="nextTimeValue" @confirm="confirmNextDate" > @@ -264,6 +263,8 @@ export default { data() { return { + timeValue: Number(new Date()), + nextTimeValue: Number(new Date()), // 表单数据 maintenanceName: '', maintenanceDate: '', @@ -272,11 +273,10 @@ export default { stateBackText: '', stateBackImage: [], isExpend: '0', - newCostName: '', - costList: [], + costList: [{ name: '', quantity: '', amount: '' }], remarkText: '', remarkImage: [], - malfunctionDate: '', + nextMaintenanceDate: '', remark: '', showpieceId: '', submiting: false @@ -285,7 +285,9 @@ export default { computed: { // 计算总金额 amount() { - return this.costList.reduce((sum, item) => sum + (parseFloat(item.amount) * Number(item.quantity) || 0), 0) + return this.costList.reduce((sum, item) => { + return sum + (Number(item.quantity) * parseFloat(item.amount || 0)) + }, 0) } }, methods: { @@ -308,31 +310,22 @@ export default { // 确认下次保养日期 confirmNextDate(e) { // uv-datetime-picker返回的是时间戳,需要转换为日期格式 - this.malfunctionDate = this.$utils.formatTime(e.value) + this.nextMaintenanceDate = this.$utils.formatTime(e.value) }, // 选择是否产生费用 selectCost(value) { this.isExpend = value - if (!value) { - this.costList = [] - this.newCostName = '' + if (value === '0') { + this.costList = [{ name: '', quantity: '', amount: '' }] + } else if (this.costList.length === 0) { + this.costList = [{ name: '', quantity: '', amount: '' }] } }, // 添加费用项目 addCostItem() { - if (!this.newCostName.trim()) { - uni.showToast({ title: '请输入费用名称', icon: 'none' }) - return - } - - this.costList.push({ - name: this.newCostName, - quantity: 1, - amount: '' - }) - this.newCostName = '' + this.costList.push({ name: '', quantity: '', amount: '' }) }, // 删除费用项目 @@ -344,17 +337,6 @@ export default { } }, - // 增加数量 - increaseQuantity(index) { - this.costList[index].quantity++ - }, - - // 减少数量 - decreaseQuantity(index) { - if (this.costList[index].quantity > 1) { - this.costList[index].quantity-- - } - }, // 上传保养前图片 async uploadBeforeImage() { @@ -472,7 +454,7 @@ export default { amount: this.amount, remarkText: this.remarkText, remarkImage: this.remarkImage?.join(',') || '', - malfunctionDate: this.malfunctionDate, + nextMaintenanceDate: this.nextMaintenanceDate, remark: this.remark, showpieceId: this.showpieceId } @@ -691,79 +673,78 @@ export default { } } - .cost-section { - .cost-input { + // 费用表格样式 + .cost-table { + margin-top: 24rpx; + border: 2rpx solid #f0f0f0; + border-radius: 8rpx; + overflow: hidden; + + .table-header { display: flex; - align-items: center; - justify-content: space-between; - padding: 24rpx 0; - border-bottom: 2rpx solid #f0f0f0; + background-color: #f5f5f5; + padding: 16rpx 0; - .label { - font-size: 30rpx; + .header-cell { + flex: 1; + text-align: center; + font-size: 28rpx; + font-weight: bold; color: $primary-text-color; - flex-shrink: 0; - margin-right: 24rpx; - } - } - - .cost-list { - .cost-header { - display: flex; - align-items: center; - padding: 24rpx 0; - border-bottom: 4rpx solid #f0f0f0; - .header-item { - flex: 1; - font-size: 28rpx; - font-weight: bold; - color: $primary-text-color; - text-align: center; - - &:first-child { - text-align: left; - } + &:first-child { + flex: 2; + } + + &:last-child { + width: 120rpx; + flex: none; } } + } + + .table-row { + display: flex; + border-top: 2rpx solid #f0f0f0; - .cost-item { - display: flex; - align-items: center; - padding: 24rpx 0; - border-bottom: 2rpx solid #f0f0f0; - gap: 24rpx; + .cell-input { + flex: 1; + padding: 8rpx; + border-right: 2rpx solid #f0f0f0; - .cost-name { - flex: 1; - font-size: 28rpx; - color: $primary-text-color; + &:first-child { + flex: 2; } - .quantity-control { - display: flex; - align-items: center; - gap: 16rpx; - - .quantity { - font-size: 28rpx; - color: $primary-text-color; - min-width: 40rpx; - text-align: center; - } + &:last-child { + border-right: none; } } - .add-cost-btn { + .cell-action { + width: 120rpx; display: flex; align-items: center; justify-content: center; - gap: 16rpx; - padding: 24rpx 0; - color: $primary-color; + gap: 8rpx; + padding: 8rpx; - text { - font-size: 28rpx; + .action-btn { + width: 36rpx; + height: 36rpx; + padding: 4rpx; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + + &.add-btn { + background-color: #1a9c10; + } + + &.delete-btn { + background-color: $primary-color; + } } } } diff --git a/subPages/home/repairSubmit.vue b/subPages/home/repairSubmit.vue index 372f02c..9569721 100644 --- a/subPages/home/repairSubmit.vue +++ b/subPages/home/repairSubmit.vue @@ -147,7 +147,7 @@ - 是否采取的对措施 + 是否采取临时措施 @@ -269,6 +270,7 @@ @@ -294,7 +296,8 @@ export default { isAffectExperience: '0', remark: '', showpieceId: '', - + timeValue: Number(new Date()), + firstTime: Number(new Date()), // 频率选项 frequencyOptions: [ { label: '持续性问题', value: '0' }, diff --git a/subPages/repair/maintainSubmit.vue b/subPages/repair/maintainSubmit.vue index 12e4be5..f352510 100644 --- a/subPages/repair/maintainSubmit.vue +++ b/subPages/repair/maintainSubmit.vue @@ -109,7 +109,7 @@ 是否采取临时措施 - {{ repairData.isTakeMeasure === '1' ? '是' : '否' }} + {{ repairData.isMeasure === '1' ? '是' : '否' }} @@ -130,7 +130,7 @@ 是否影响体验 - {{ repairData.isAffectUsage === '1' ? '是' : '否' }} + {{ repairData.isAffectExperience === '1' ? '是' : '否' }} @@ -372,6 +372,7 @@ @@ -382,10 +383,12 @@ export default { data() { return { + timeValue: Number(new Date()), statusType: 'modify', selectedStatus: '故障中', isCollapsed: true, id: '', + showpieceId: '', // 映射表 statusMap: { '故障中': '0', @@ -444,6 +447,7 @@ export default { }, onLoad(args){ this.id = args.id + this.showpieceId = args.showpieceId }, methods: { // 修改状态 @@ -536,7 +540,7 @@ export default { delete tempData.expenseList } const submitRes = await this.$api.exhibit.addRepair({ - id: this.id, + id: this.showpieceId, ...tempData, amount: this.amount }) @@ -546,6 +550,11 @@ export default { title: submitRes.message, icon: 'none' }) + setTimeout(() => { + uni.navigateBack({ + delta: 1 + }) + }, 400) }else { uni.showToast({ title: submitRes.message,