问题修改
This commit is contained in:
parent
033675abf0
commit
a1e01a635f
|
|
@ -619,6 +619,12 @@
|
|||
"navigationBarTitleText": "费用减免申请"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/business/addHandlingOrder",
|
||||
"style": {
|
||||
"navigationBarTitleText": "装卸单"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/integratedQuery/electronicTag/index",
|
||||
"style": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,349 @@
|
|||
<template>
|
||||
<view class="accept page-common">
|
||||
<div class="card">
|
||||
<uni-forms :model="formData" label-width="170rpx" :border="true">
|
||||
<uni-forms-item label="工程名称:" name="proId">
|
||||
<eselect
|
||||
style="width: 100%; height: 90rpx"
|
||||
ref="treeSelect2"
|
||||
:options="proList"
|
||||
@change="changePro"
|
||||
@clear="clearPro"
|
||||
></eselect>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="车牌号:" name="backPerson">
|
||||
<uni-easyinput v-model="carCode" maxlength="10" placeholder="请输入车牌号" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="联系人:" name="backPerson">
|
||||
<uni-easyinput v-model="linkMan" maxlength="10" placeholder="请输入联系人" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="联系电话:" name="phone">
|
||||
<uni-easyinput
|
||||
v-model="phone"
|
||||
maxlength="11"
|
||||
placeholder="请输入联系电话"
|
||||
@blur="checkPhone"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="添加日期:" name="reserveDate">
|
||||
<uni-datetime-picker
|
||||
v-model="formData.reserveDate"
|
||||
:start="minDate"
|
||||
:end="maxDate"
|
||||
@change="handleDateChange"
|
||||
:disabled="false"
|
||||
:placeholder="currentDate"
|
||||
:hide-second="true"
|
||||
:border="false"
|
||||
type="date"
|
||||
style="width: 100%; height: 90rpx; line-height: 90rpx;"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</div>
|
||||
|
||||
<div class="btn">
|
||||
<button class="btn-cont" @click="confirmAdd">确认</button>
|
||||
</div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import {
|
||||
addHandlingOrder,
|
||||
getProjectList,
|
||||
} from '../../services/back.js'
|
||||
import eselect from '@/components/tree-select/eselect.vue'
|
||||
import { useMemberStore } from '@/stores'
|
||||
const memberStore = useMemberStore()
|
||||
const treeSelect = ref(null)
|
||||
const treeSelect2 = ref(null)
|
||||
const formData = ref({})
|
||||
const unitId = ref('')
|
||||
const proId = ref('')
|
||||
const carCode = ref('')
|
||||
const linkMan = ref('')
|
||||
const agreementId = ref('')
|
||||
const unitList = ref([])
|
||||
const proList = ref([])
|
||||
const backPerson = ref('')
|
||||
const phone = ref('')
|
||||
const currentDate = ref('')
|
||||
const minDate = ref('')
|
||||
const maxDate = ref('') // 可选最大日期(比如未来一年)
|
||||
const today = new Date()
|
||||
|
||||
// 设置默认日期格式为 YYYY-MM-DD
|
||||
const formatDate = (date) => {
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
// 初始化日期
|
||||
const initDate = () => {
|
||||
const now = new Date()
|
||||
const oneYearLater = new Date()
|
||||
oneYearLater.setFullYear(now.getFullYear() + 1)
|
||||
|
||||
formData.value.reserveDate = formatDate(now)
|
||||
minDate.value = formatDate(now)
|
||||
maxDate.value = formatDate(oneYearLater)
|
||||
currentDate.value = formatDate(now)
|
||||
}
|
||||
|
||||
//工程
|
||||
const getProject = (e) => {
|
||||
console.log('🚀 ~ getProject ~ e:', e)
|
||||
unitId.value = e?.id || ''
|
||||
let obj = {
|
||||
unitId: unitId.value,
|
||||
}
|
||||
getProjectList(obj)
|
||||
.then((res) => {
|
||||
proList.value = res.data
|
||||
agreementId.value = ''
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const clearPro = () => {
|
||||
proId.value = ''
|
||||
agreementId.value = ''
|
||||
getProject()
|
||||
getProject()
|
||||
}
|
||||
//工程选择
|
||||
const changePro = (e) => {
|
||||
console.log(e)
|
||||
proId.value = e.id
|
||||
}
|
||||
|
||||
//清空
|
||||
const clearForm = () => {
|
||||
proId.value = ''
|
||||
carCode.value = ''
|
||||
linkMan.value = ''
|
||||
phone.value = ''
|
||||
agreementId.value = ''
|
||||
// 手动清空 eselect 绑定的值
|
||||
treeSelect.value && (treeSelect.value.selected = {}) // 假设组件使用 selected 保存选中值
|
||||
treeSelect2.value && (treeSelect2.value.selected = {})
|
||||
}
|
||||
//确认
|
||||
const confirmAdd = () => {
|
||||
if (proId.value == '') {
|
||||
uni.showToast({ title: '请选择装卸单工程!', icon: 'none' })
|
||||
} else if (carCode.value == '') {
|
||||
uni.showToast({ title: '请输入车牌号!', icon: 'none' })
|
||||
} else if (!checkCarCode()) {
|
||||
uni.showToast({ title: '车牌号不正确!', icon: 'none' })
|
||||
} else if (linkMan.value == '') {
|
||||
uni.showToast({ title: '请输入联系人!', icon: 'none' })
|
||||
} else if (phone.value == '') {
|
||||
uni.showToast({ title: '请输入联系电话!', icon: 'none' })
|
||||
} else if (!checkPhone()) {
|
||||
uni.showToast({ title: '请输入正确的手机号!', icon: 'none' })
|
||||
} else {
|
||||
let obj = {
|
||||
proId: proId.value,
|
||||
carCode: carCode.value,
|
||||
linkMan: linkMan.value,
|
||||
phone: phone.value,
|
||||
reserveDate: formData.value.reserveDate,
|
||||
}
|
||||
addHandlingOrder(obj)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
uni.showToast({ title: '新增成功', icon: 'none' })
|
||||
uni.navigateBack({
|
||||
delta: 1, // 返回到已存在的页面
|
||||
})
|
||||
} else {
|
||||
uni.showToast({ title: res.msg, icon: 'none' })
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 校验电话
|
||||
const checkPhone = () => {
|
||||
const phonePattern = /^1[3-9][0-9]{9}$/;
|
||||
if (!phonePattern.test(phone.value)) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入正确的电话号码',
|
||||
})
|
||||
// 清空输入框
|
||||
phone.value = ''
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 校验车牌号
|
||||
const checkCarCode = () => {
|
||||
// 支持传统和新能源车牌的正则表达式
|
||||
const carCodePattern = /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1})$/;
|
||||
|
||||
if (!carCodePattern.test(carCode.value)) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入正确的车牌号',
|
||||
})
|
||||
// 清空输入框
|
||||
carCode.value = ''
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
getProject()
|
||||
initDate()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
:deep(.uni-datetime-picker__text) {
|
||||
font-size: 28rpx;
|
||||
color: #262626;
|
||||
padding-left: 16rpx;
|
||||
}
|
||||
.accept {
|
||||
padding: 24rpx;
|
||||
height: 90vh;
|
||||
word-break: break-all;
|
||||
background-color: #f7f8fa;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
// 卡片样式
|
||||
.card {
|
||||
padding: 32rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
|
||||
margin-bottom: 24rpx;
|
||||
height: auto;
|
||||
|
||||
// 表单样式
|
||||
:deep(.uni-forms) {
|
||||
.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-data-select {
|
||||
.uni-select {
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
height: 88rpx;
|
||||
padding: 0 2rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:focus-within {
|
||||
border-color: #3784fb;
|
||||
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
|
||||
}
|
||||
|
||||
.uni-select__input-box {
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
}
|
||||
|
||||
.uni-select__input-text {
|
||||
font-size: 28rpx;
|
||||
color: #262626;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 输入框样式
|
||||
.uni-easyinput {
|
||||
.uni-easyinput__content {
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
height: 75rpx;
|
||||
padding: 0 2rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:focus-within {
|
||||
border-color: #3784fb;
|
||||
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
|
||||
}
|
||||
|
||||
.uni-easyinput__content-input {
|
||||
font-size: 28rpx;
|
||||
height: 75rpx;
|
||||
line-height: 75rpx;
|
||||
color: #262626;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 底部按钮
|
||||
.btn {
|
||||
margin-top: auto;
|
||||
padding: 32rpx;
|
||||
// background: #fff;
|
||||
// box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
|
||||
.btn-cont {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
opacity: 0.9;
|
||||
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
|
||||
}
|
||||
|
||||
// 清空按钮样式
|
||||
&:first-child {
|
||||
background: #fff;
|
||||
color: #3784fb;
|
||||
border: 2rpx solid #3784fb;
|
||||
box-shadow: none;
|
||||
|
||||
&:active {
|
||||
background: #f7f8fa;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -101,6 +101,11 @@ const newInfoList = ref([
|
|||
url: '/pages/business/discountApply',
|
||||
iconSrc: '../../static/workbench/panDian.png',
|
||||
},
|
||||
{
|
||||
title: '装卸单',
|
||||
url: '/pages/business/addHandlingOrder',
|
||||
iconSrc: '../../static/workbench/panDian.png',
|
||||
},
|
||||
])
|
||||
|
||||
// 使用计算属性筛选 newInfoList 中的数据
|
||||
|
|
|
|||
|
|
@ -59,12 +59,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">申请时间:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">{{ item.createTime }}</div>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">发布时间:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">{{ item.releaseTime }}</div>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">领料物资:</uni-col>
|
||||
<uni-col :span="18">
|
||||
|
|
|
|||
|
|
@ -289,4 +289,14 @@ export const getLeaseCode = (data) => {
|
|||
url: '/material/leaseTask/getCode',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const addHandlingOrder = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/back_apply_info/addHandlingOrder',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue