diff --git a/src/components/tree-select/eselect.vue b/src/components/tree-select/eselect.vue index 1be1a74..82a63b5 100644 --- a/src/components/tree-select/eselect.vue +++ b/src/components/tree-select/eselect.vue @@ -117,7 +117,7 @@ export default { }, findNodeById(list, id) { for (const item of list) { - if (item[this.defaultProps.id] === id) { + if (item[this.defaultProps.id] == id) { return item } const children = item[this.defaultProps.children] diff --git a/src/pages.json b/src/pages.json index a45cd75..6cb0f3d 100644 --- a/src/pages.json +++ b/src/pages.json @@ -801,6 +801,12 @@ "navigationBarTitleText": "现场维修详情" } }, + { + "path": "pages/repair/fieldMaintenance/detailList", + "style": { + "navigationBarTitleText": "现场维修详情" + } + }, { "path": "pages/repair/fieldMaintenance/fieldCode", "style": { diff --git a/src/pages/repair/fieldMaintenance/added.vue b/src/pages/repair/fieldMaintenance/added.vue index 8883e2f..d86ea51 100644 --- a/src/pages/repair/fieldMaintenance/added.vue +++ b/src/pages/repair/fieldMaintenance/added.vue @@ -2,17 +2,22 @@
- + 二维码识别 + + + 编码识别 +
- + - + - +
@@ -57,7 +63,7 @@ import { insert, getAgreementInfoById, } from '@/services/fieldMaintenance/fieldMaintenance.js' -import { getMachineByQrCodeApi } from '../../../services/back.js' +import { getMachineByCodeApi, getMachine } from '@/services/back.js' import eselect from '@/components/tree-select/eselect.vue' import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue' @@ -72,7 +78,47 @@ const proList = ref([]) const fieldPerson = ref('') const phone = ref('') const qrCode = ref('') -const maInfo = ref({}) //二维码 +const maCode = ref('') + +// 正则校验手机号 +const phoneReg = /^1[3-9]\d{9}$/ +const isPhone = () => { + console.log('🚀 ~ isPhone ~ phoneReg.test(phone.value):', phone.value , phoneReg.test(phone.value)) + if (!phoneReg.test(phone.value)) { + uni.showToast({ + icon: 'none', + title: '请输入正确的手机号', + }) + phone.value = '' + } +} +// 编码识别 +const maCodeScan = async() => { + if (!maCode.value) { + uni.showToast({ + title: '请输入编码', + icon: 'none', + }) + return + } + unitId.value = '' + proId.value = '' + try { + const res = await getMachineByCodeApi({ maCode: maCode.value }) + console.log('🚀 ~ maCodeScan ~ res:', res) + if (res.data) { + unitId.value = res.data.unitId + proId.value = res.data.proId + if (unitId.value && proId.value) { + getAgreement() + } + } else { + uni.showToast({ title: '未查询到该编码数据', icon: 'none' }) + } + } catch (error) { + console.log('🚀 ~ maCodeScan ~ error:', error) + } +} // 处理扫描成功事件 const handleScanSuccess = (result) => { qrCode.value = result?.data?.split('?qrcode=')[1] || result?.data @@ -93,13 +139,18 @@ const getMaInfoScan = async () => { let param = { qrCode: qrCode.value, } + unitId.value = '' + proId.value = '' //通过二维码获取相绑定的设备编码 - const res = await getMachineByQrCodeApi(param) + const res = await getMachine(param) console.log(res) if (res.code == 200) { if (res.data.length > 0) { unitId.value = res.data[0].unitId proId.value = res.data[0].proId + if (unitId.value && proId.value) { + getAgreement() + } } else { uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none' }) } @@ -108,8 +159,10 @@ const getMaInfoScan = async () => { } } const codeScan = async () => { - qrCode.value = '' + // qrCode.value = '202304-00847' + // getMaInfoScan() + qrCode.value = '' if (scanQrCodeRef.value) { scanQrCodeRef.value.scanQrCode() } @@ -282,6 +335,7 @@ onLoad((options) => { font-weight: 600; box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2); transition: all 0.3s ease; + margin-bottom: 20rpx; &:active { transform: scale(0.98); diff --git a/src/pages/repair/fieldMaintenance/detail.vue b/src/pages/repair/fieldMaintenance/detail.vue index 246edc9..67d6e10 100644 --- a/src/pages/repair/fieldMaintenance/detail.vue +++ b/src/pages/repair/fieldMaintenance/detail.vue @@ -32,7 +32,7 @@ - 是否收费: + 维修数量: - - + +
+ + 配件名称: + + + + + + 配件数量: + + + + + + + 是否收费: + +
+ +
+ + + - +
+
+
+
+ + 维修内容: + + + + + + +
+ - 配件数量: + 附件: - - - +
+ + +
+
+ +
+
@@ -108,38 +192,38 @@ @@ -393,10 +620,12 @@ onLoad((options) => { .line { margin: 24rpx 0; height: 2rpx; - background: linear-gradient(90deg, + background: linear-gradient( + 90deg, rgba(232, 232, 232, 0) 0%, rgba(232, 232, 232, 1) 50%, - rgba(232, 232, 232, 0) 100%); + rgba(232, 232, 232, 0) 100% + ); } :deep(.uni-row) { @@ -472,4 +701,157 @@ onLoad((options) => { } } } +.table-list-item { + background-color: #fff; + border-radius: 20rpx; + padding: 24rpx; + margin-bottom: 24rpx; + box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06); + + // 标题样式 + h2 { + font-size: 32rpx; + font-weight: 600; + color: #262626; + margin-bottom: 24rpx; + position: relative; + padding-left: 24rpx; + margin-left: 10px; + + &::before { + content: ''; + position: absolute; + left: -10px; + top: 50%; + transform: translateY(-50%); + width: 6rpx; + height: 28rpx; + background: #3784fb; + border-radius: 6rpx; + } + } + + // 信息行 + .uni-row { + padding: 16rpx 0; + font-size: 28rpx; + border-bottom: 2rpx solid #f5f5f5; + + &:last-child { + border-bottom: none; + } + + .uni-col-6 { + color: #8c8c8c; + } + + .cont { + color: #262626; + } + } + + // 表单样式 + :deep(.uni-forms-item) { + padding: 24rpx 0; + margin-bottom: 0; + border-bottom: 2rpx solid #f5f5f5; + + &:last-child { + border-bottom: none; + } + + .uni-forms-item__label { + color: #8c8c8c; + } + + .uni-easyinput__content { + background-color: #f7f8fa; + border: 2rpx solid #e8e8e8; + border-radius: 12rpx; + height: 75rpx; + padding: 0 24rpx; + transition: all 0.3s ease; + + &:focus-within { + border-color: #3784fb; + box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1); + } + } + + // 下拉选择框样式 + .uni-data-select { + .uni-select { + border: 2rpx solid #e8e8e8; + border-radius: 12rpx; + height: 75rpx; + padding: 0 24rpx; + transition: all 0.3s ease; + + &:focus-within { + border-color: #3784fb; + box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1); + } + } + } + } +} +.operation-btns { + display: flex; + align-items: center; + gap: 16rpx; + margin-left: 24rpx; + + span { + width: 48rpx; + height: 48rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 8rpx; + font-size: 32rpx; + transition: all 0.3s ease; + + &:active { + transform: scale(0.95); + opacity: 0.8; + } + + // 添加按钮 + &.add { + color: #2ecc71; + background-color: rgba(46, 204, 113, 0.1); + } + + // 删除按钮 + &.remove { + color: #e74c3c; + background-color: rgba(231, 76, 60, 0.1); + } + } +} +.upload { + width: 160rpx; + height: 160rpx; + background-color: #f7f8fa; + border: 2rpx dashed #d9d9d9; + border-radius: 12rpx; + display: flex; + justify-content: center; + align-items: center; + font-size: 48rpx; + color: #bfbfbf; + transition: all 0.3s ease; + + &:active { + background-color: #f0f0f0; + border-color: #3784fb; + } + + image { + width: 100%; + height: 100%; + border-radius: 12rpx; + object-fit: cover; + } +} diff --git a/src/pages/repair/fieldMaintenance/index.vue b/src/pages/repair/fieldMaintenance/index.vue index fe434a4..ea0f646 100644 --- a/src/pages/repair/fieldMaintenance/index.vue +++ b/src/pages/repair/fieldMaintenance/index.vue @@ -74,6 +74,8 @@ {{ finish ? '没有更多数据了~' : '正在加载...' }} + +