From 53660c7731b92475a5ded3d4f73b451e9fd2313e Mon Sep 17 00:00:00 2001 From: bb_pan Date: Thu, 20 Nov 2025 16:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/api/cart/index.ts | 5 ++ src/views/cart/index.vue | 119 ++++++++++++++++++++++++++++++++++- src/views/order/index.vue | 123 ++++++++++++++++++++++++++++++++++++- 3 files changed, 243 insertions(+), 4 deletions(-) diff --git a/src/http/api/cart/index.ts b/src/http/api/cart/index.ts index a7d9487..0b5a497 100644 --- a/src/http/api/cart/index.ts +++ b/src/http/api/cart/index.ts @@ -16,4 +16,9 @@ export const deleteCartByIdApi = (data: any) => { // 获取租赁协议 export const getBookCarAgreementApi = (data: any) => { return post('/material-mall/order/bookCarAgreement', data) +} + +// 使用项目 +export const getProListApi = (data: any = {}) => { + return post('/material-mall/decChange/getProList', data) } \ No newline at end of file diff --git a/src/views/cart/index.vue b/src/views/cart/index.vue index 52d02b8..cb47b8d 100644 --- a/src/views/cart/index.vue +++ b/src/views/cart/index.vue @@ -14,6 +14,71 @@
预约车
({{ amountNum }})
+ + + + + + + + + + + + + + + + + + + + + + + + + @@ -390,6 +455,7 @@ import { submitBookCarApi, deleteCartByIdApi, getBookCarAgreementApi, + getProListApi } from 'http/api/cart/index' import { getAreaApi } from 'http/api/home' import { getAddressListApi, addAddressInfoApi } from 'http/api/address-manage/index' @@ -401,6 +467,8 @@ import { useStore } from '../../store/user' import jsPreviewDocx from '@js-preview/docx' import '@js-preview/docx/lib/index.css' import { debounce } from 'lodash' +import { mainStore } from '@/store/main' +const store = mainStore() const userStore = useStore() const router = useRouter() // const protocolChecked = ref(false) @@ -428,6 +496,43 @@ const addOrEditFormRules = reactive({ const areaList = ref([]) // 省 const areaCityList = ref([]) // 市 const areaCountyList = ref([]) // 区/县 +const queryForm: any = reactive({ + useUnit: store.userInfo.dept.deptId, // 需求单位 + useUnitName: store.userInfo.dept.deptName, + proCode: '', // 项目编号 + proName: '', // 项目名称 + proType: '', // 项目类型 + proTypeName: '', // 项目类型名称 + voltageLevel: '', // 电压等级 + proProvince: '', // 项目所在省 + proCity: '', // 项目所在市 + proCounty: '', // 项目所在区/县 +}) +const queryFormRules = reactive({ + proCode: [{ required: true, message: '请选择使用项目', trigger: 'blur' }], +}) +const projectList: any = ref([]) + +const getProList = async () => { + try { + const res: any = await getProListApi() + projectList.value = res.data + } catch (error) { + console.log('🚀 ~ getProList ~ error:', error) + } +} +const onChangeProject = (val: any) => { + const current = projectList.value.find((e: any) => e.proCode === val) + console.log('🚀 ~ onChangeProject ~ current:', current) + queryForm.proName = current.proName + queryForm.proType = current.proType + queryForm.proTypeName = current.proTypeName + queryForm.voltageLevel = current.voltage + queryForm.proProvince = current.province + queryForm.proCity = current.city + queryForm.proCounty = current.county + console.log('🚀 ~ onChangeProject ~ queryForm:', queryForm) +} const getBookCarDetailsData = async () => { const res: any = await getBookCarDetailsApi() @@ -449,6 +554,7 @@ const getBookCarDetailsData = async () => { onMounted(() => { getBookCarDetailsData() + getProList() }) // 日期change事件 @@ -643,6 +749,13 @@ const orderAmountPice = computed(() => { // 提交按钮 const onCartSubmit = debounce(async () => { ElMessage.closeAll() + if (!queryForm.proCode) { + ElMessageBox.alert('请选择使用项目', '提示', { + confirmButtonText: '确定', + type: 'error', + }) + return + } if (amountDevice.value < 1) { ElMessageBox.alert('请选择装备', '提示', { confirmButtonText: '确定', @@ -711,6 +824,7 @@ const onCartSubmit = debounce(async () => { j.devInfoVoList.forEach((e: any) => { if (e.isChecked) { itemsArray.push({ + ...e, maId: e.maId, id: e.id, rentBeginTime: e.rentBeginTime + ' ' + '00:00:00', @@ -740,7 +854,10 @@ const onCartSubmit = debounce(async () => { // detailsList, // } - const res: any = await submitBookCarApi(paramsList) + const res: any = await submitBookCarApi({ + ...queryForm, + orderInfoDto: paramsList, + }) if (res.code === 200) { ElMessage({ showClose: false, diff --git a/src/views/order/index.vue b/src/views/order/index.vue index 9580d88..65f56b6 100644 --- a/src/views/order/index.vue +++ b/src/views/order/index.vue @@ -15,6 +15,72 @@
({{ amountNum }})
+ + + + + + + + + + + + + + + + + + + + + + + + + +