From 356912fd37a13cd8c6e8431acf109e270d5910f7 Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Mon, 2 Dec 2024 15:33:53 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
env/.env.dev | 4 +-
src/components/Navmenu/index.vue | 11 ++-
src/components/header/index.vue | 15 +++-
src/layout/header.vue | 2 +
src/router/index.ts | 10 +--
src/store/user.ts | 2 +-
src/views/cart/index.vue | 12 ++-
src/views/equip/detail.vue | 36 ++++++--
src/views/order/index.vue | 141 ++++++++++++++++++-------------
src/views/user/index.vue | 5 +-
10 files changed, 159 insertions(+), 79 deletions(-)
diff --git a/env/.env.dev b/env/.env.dev
index b46887f..3fe5b11 100644
--- a/env/.env.dev
+++ b/env/.env.dev
@@ -7,8 +7,8 @@ VITE_API_URL = '/proxyApi'
# 开发环境接口地址
# VITE_proxyTarget = 'http://10.40.92.74:8080' #盛旭
-# VITE_proxyTarget = 'http://192.168.2.246:28080' # 马帅
-VITE_proxyTarget = 'http://192.168.0.244:28580' # 马帅
+VITE_proxyTarget = 'http://192.168.2.246:28080' # 马帅
+# VITE_proxyTarget = 'http://192.168.0.244:28580' # 马帅
# VITE_proxyTarget = 'http://192.168.2.129:18080' # 马帅
# VITE_proxyTarget = 'http://10.40.92.185:9206' # 赵福海 ( 设备类型)
diff --git a/src/components/Navmenu/index.vue b/src/components/Navmenu/index.vue
index c2306bb..ee6f1e6 100644
--- a/src/components/Navmenu/index.vue
+++ b/src/components/Navmenu/index.vue
@@ -37,7 +37,16 @@ const navMenuList = computed(() => {
})
const navMenuClick = (name: any) => {
- router.push({ name })
+ if (name == 'goodsManagement' || name == 'orderManagementCz' || name == 'orderManagement') {
+ store.editcurrentMenuItem(name)
+ setTimeout(() => {
+ router.push({
+ name: 'my-user',
+ })
+ }, 500)
+ } else {
+ router.push({ name })
+ }
}
diff --git a/src/components/header/index.vue b/src/components/header/index.vue
index 14a022b..198cf79 100644
--- a/src/components/header/index.vue
+++ b/src/components/header/index.vue
@@ -96,13 +96,18 @@ const onSelectRoles = (type: number) => {
if (type === 1) {
rolesName.value = '1'
userStore.editMenuList(1)
+ userStore.editcurrentMenuItem('goodsManagement')
// userStore.editUserMenuList(1)
localStorage.setItem('rolesType', '1')
+
+ // window.location.reload()
} else {
rolesName.value = '2'
userStore.editMenuList(2)
// userStore.editUserMenuList(2)
localStorage.setItem('rolesType', '2')
+ userStore.editcurrentMenuItem('sourcingNeed')
+ // window.location.reload()
}
window.location.reload()
@@ -163,7 +168,15 @@ const onCarts = () => {
@@ -78,14 +78,28 @@
-
{{ item.lease_date_string }}
-
{{ item.lease_date_string }} -->
+
+ {{ item.rentBeginTime }}
+ -
+ {{ item.rentEndTime }}
+
+
+
@@ -119,7 +133,7 @@
删除
@@ -175,6 +189,7 @@ import Header from '../../components/header/index.vue'
import FooterInfo from '../../components/FooterInfo/index.vue'
import { ElMessage } from 'element-plus'
import { getBookCarDetailByMaId, submitBookCarApi } from '../../http/api/order/index'
+import CustomDatePickerButton from '../cart/components/date-picker-button.vue'
import { getDetail } from 'http/api/equip'
import moment from 'moment'
import { useRoute, useRouter } from 'vue-router'
@@ -196,24 +211,14 @@ const getOrderListData = async () => {
orderList.value = []
// orderList.value = res.data
- const { companyName, person, picUrl, personPhone, deviceName, code, typeName, dayLeasePrice } =
- res.data
-
// 组装参数
const orderInfo = {
- companyName,
- person,
- personPhone,
- deviceName,
- code,
- typeName,
- picUrl,
rentBeginTime: '',
rentEndTime: '',
lease_date: '',
- dayLeasePrice,
days: 0,
num: 1,
+ ...res.data,
}
orderList.value.push(orderInfo)
@@ -237,9 +242,22 @@ onMounted(() => {
})
// 日期change事件
-const onLeaseDateChange = (e: any, item: any) => {
- item.lease_date_string = `${e[0]}至${e[1]}`
- item.lease_day = moment(e[1]).diff(e[0], 'day')
+// const onLeaseDateChange = (e: any, item: any) => {
+// item.lease_date_string = `${e[0]}至${e[1]}`
+// item.lease_day = moment(e[1]).diff(e[0], 'day')
+// }
+const onLeaseDateChange = (value: any, companyIndex: number, goodsIndex: number) => {
+ orderList.value.forEach((e: any) => {
+ if (!value) {
+ e.rentBeginTime = ''
+ e.rentEndTime = ''
+ e.days = 0
+ } else {
+ e.rentBeginTime = value[0]
+ e.rentEndTime = value[1]
+ e.days = moment(value[1]).diff(value[0], 'day')
+ }
+ })
}
// 删除按钮
@@ -283,13 +301,13 @@ const allChecked = computed(() => {
// 已勾选的装备数量
const amountDevice = computed(() => {
- let amountNum = 0
- orderList.value.forEach((e) => {
- if (e.isChecked) {
- amountNum++
- }
- })
- return amountNum
+ // let amountNum = 0
+ // orderList.value.forEach((e) => {
+ // if (e.isChecked) {
+ // amountNum++
+ // }
+ // })
+ return 1
})
// 已勾选的装备数量
const amountDeviceList = computed(() => {
@@ -306,26 +324,27 @@ const amountDeviceList = computed(() => {
const orderAmountPice = computed(() => {
let orderAmountPice = 0
orderList.value.forEach((e) => {
- if (e.isChecked) {
- orderAmountPice = e.goods_num * e.dayLeasePrice * e.lease_day + orderAmountPice
- }
+ // if (e.isChecked) {
+
+ // }
+ orderAmountPice = e.num * e.dayLeasePrice * e.days
})
return orderAmountPice
})
// 提交按钮
const onCartSubmit = async () => {
- ElMessage.closeAll()
- if (amountDevice.value < 1) {
- ElMessage({
- showClose: false,
- message: '请选择装备',
- type: 'error',
- })
- return
- }
- console.log(amountDeviceList.value[0].lease_date == undefined)
- if (amountDeviceList.value[0].lease_date == undefined) {
+ // ElMessage.closeAll()
+ // if (amountDevice.value < 1) {
+ // ElMessage({
+ // showClose: false,
+ // message: '请选择装备',
+ // type: 'error',
+ // })
+ // return
+ // }
+ // console.log(amountDeviceList.value[0].lease_date == undefined)
+ if (orderList.value[0].days < 1) {
ElMessage({
showClose: false,
message: '请选择租期',
@@ -342,25 +361,21 @@ const onCartSubmit = async () => {
return
}
- console.log('提交订单')
- // 组装参数
- const detailsList = amountDeviceList.value.map((e: any) => {
- console.log(e)
- return {
- maId: e.maId,
- id: e.id,
- rentBeginTime: e.lease_date[0] + ' ' + '00:00:00',
- rentEndTime: e.lease_date[1] + ' ' + '00:00:00',
- manageType: e.manageType,
- days: e.lease_day,
- num: e.goods_num,
- costs: e.goods_num * e.dayLeasePrice * e.lease_day,
- }
- })
+ const orderInfo = orderList.value[0]
+ const submitInfo = {
+ maId: orderInfo.maId,
+ id: orderInfo.id,
+ rentBeginTime: orderInfo.rentBeginTime + ' ' + '00:00:00',
+ rentEndTime: orderInfo.rentEndTime + ' ' + '00:00:00',
+ manageType: orderInfo.manageType,
+ days: orderInfo.days,
+ num: orderInfo.num,
+ costs: orderInfo.num * orderInfo.days * orderInfo.dayLeasePrice,
+ }
const submitParams = {
cost: orderAmountPice.value,
- detailsList,
+ detailsList: [submitInfo],
}
console.log('submitParams', submitParams)
const res: any = await submitBookCarApi(submitParams)
@@ -370,10 +385,16 @@ const onCartSubmit = async () => {
message: '提交成功',
type: 'success',
})
- allKey.value++
- router.push({
- path: `/equipDetail/${pageParams.maId}`,
- })
+ userStore.editcurrentMenuItem('goodsManagement')
+ setTimeout(() => {
+ router.push({
+ name: 'my-user',
+ })
+ }, 500)
+
+ // router.push({
+ // path: `/equipDetail/${pageParams.maId}`,
+ // })
}
}
diff --git a/src/views/user/index.vue b/src/views/user/index.vue
index 93c298c..8e62106 100644
--- a/src/views/user/index.vue
+++ b/src/views/user/index.vue
@@ -71,8 +71,11 @@ const menuList: any = computed(() => {
return allList.filter((e) => e.permission.includes(isType.value))
})
+const activeItem = computed(() => {
+ return store.currentMenuItem
+})
router.push({
- name: menuList.value[0].name,
+ name: activeItem.value,
})
onMounted(() => {