From 3e5232c296d2c3e92a54df621d1cee7b38b2783f Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Thu, 26 Dec 2024 18:17:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/GoodsItems/index.vue | 66 +++-- src/pages/cart/index.vue | 214 ++++++++++----- src/pages/demand-details/index.vue | 244 +++++++++++++----- src/pages/demand-release/index.vue | 17 +- .../components/details-model.vue | 4 +- src/pages/goods-list/index.vue | 34 ++- src/pages/index/index.vue | 45 ++-- src/pages/lease-demand/index.vue | 71 +++-- src/pages/my/index.vue | 4 +- src/pages/order-settlement/index.vue | 5 +- src/services/cart/index.js | 20 ++ src/services/demand/index.js | 10 + src/static/index/order_icon1.png | Bin 0 -> 3921 bytes src/static/index/order_icon2.png | Bin 0 -> 4440 bytes src/static/index/order_icon3.png | Bin 0 -> 4280 bytes src/static/index/order_icon4.png | Bin 0 -> 4401 bytes src/static/index/order_icon5.png | Bin 0 -> 4658 bytes src/static/index/order_icon6.png | Bin 0 -> 4100 bytes 18 files changed, 522 insertions(+), 212 deletions(-) create mode 100644 src/static/index/order_icon1.png create mode 100644 src/static/index/order_icon2.png create mode 100644 src/static/index/order_icon3.png create mode 100644 src/static/index/order_icon4.png create mode 100644 src/static/index/order_icon5.png create mode 100644 src/static/index/order_icon6.png diff --git a/src/components/GoodsItems/index.vue b/src/components/GoodsItems/index.vue index f9c60cd..231010d 100644 --- a/src/components/GoodsItems/index.vue +++ b/src/components/GoodsItems/index.vue @@ -2,26 +2,31 @@ - - {{ goodsInfo.deviceName }} - ({{ goodsInfo.typeName }}) + + + + + - {{ goodsInfo.companyName }} + - {{ goodsInfo.companyName }} - + + + + + {{ goodsInfo.personPhone }} - - - {{ goodsInfo.dayLeasePrice }} - /日 - + + + + {{ goodsInfo.dayLeasePrice }} + /日 @@ -43,13 +48,17 @@ const props = defineProps({ width: 100%; font-size: 12px; background-color: #f9f9f9; + border-radius: 12px; + margin-top: 8px; .goods-info { flex: 1; + padding: 4px 6px; + box-sizing: border-box; } .van-image { - width: 100%; height: 120px; + border-radius: 10px; } view { padding: 3px 0; @@ -58,15 +67,18 @@ const props = defineProps({ color: #636262; } - .device-title text:first-child { + .device-title { color: #000; - font-size: 16px; + font-size: 15px; font-weight: bold; } .address-box { - display: flex; - align-items: center; + // display: flex; + // align-items: center; + border: 1px solid $el-color-primary; + box-sizing: border-box; + color: $el-color-primary; text { width: 100%; @@ -81,20 +93,26 @@ const props = defineProps({ } } + .price-box { + color: #fe4700; + .price { + margin: 0 1px; + font-size: 16px; + font-weight: bold; + } + } + .phone-price { justify-content: space-between; - .price-box { - color: #fe4700; - .price { - margin: 0 1px; - font-size: 14px; - font-weight: bold; - } - } view { padding: 0 !important; } } } + +:deep(.van-image__img) { + border-top-left-radius: 10px; + border-top-right-radius: 10px; +} diff --git a/src/pages/cart/index.vue b/src/pages/cart/index.vue index 705e7c6..1f3310b 100644 --- a/src/pages/cart/index.vue +++ b/src/pages/cart/index.vue @@ -8,13 +8,13 @@ ({{ amountNum }}) - 管理 + {{ isCartManage ? '退出管理' : '管理' }} @@ -22,13 +22,11 @@ - - - + @change="onChangeAllCheckbox($event, index)" + /> @@ -45,21 +43,21 @@ - 联系人: {{ item.companyPersonPhoneKey.person }} - {{ item.companyPersonPhoneKey.personPhone }} + 联系人: {{ item.companyPersonPhoneKey.person }} + + {{ item.companyPersonPhoneKey.personPhone }} + - - - + @click="onChangeCheckbox($event, index)" + /> @@ -73,17 +71,31 @@ {{ goods.deviceName }} 装备编号:{{ goods.code }} 装备型号:{{ goods.typeName }} - - 租赁金额: + - ¥{{ goods.dayLeasePrice }}/天 + 租赁金额:¥{{ goods.dayLeasePrice }}/天 + + @@ -111,23 +123,26 @@ - - - 总金额: - - - - {{ goods.num * goods.dayLeasePrice * goods.days }} - - - + + 总金额: + + + {{ goods.num * goods.dayLeasePrice * goods.days }} + + - - + + + --> + + + 我已阅读并同意 + 《xxx公司协议》 + @@ -168,6 +190,7 @@ button-text="提交" :price="totalPrice" @submit="onSubmitOrder" + v-if="!isCartManage" > + + + + @@ -188,7 +222,13 @@ import cartImg from '@/static/cart/cart.png' import dateIcon from '@/static/goods/date-icon.png' import { computed, nextTick, ref } from 'vue' import { onHide, onLoad, onShow } from '@dcloudio/uni-app' -import { getBookCarDetailsAPI, getAddressListAPI, submitBookCarAPI } from '@/services/cart/index.js' +import { + getBookCarDetailsAPI, + getAddressListAPI, + submitBookCarAPI, + deleteBookCarAPI, + deleteBookCarByIdsAPI, +} from '@/services/cart/index.js' import moment from 'moment' const cartList = ref([]) const showBottom = ref(false) @@ -203,6 +243,8 @@ const address = ref('') const actionBarHeight = ref() const chosenAddressId = ref() const addressList = ref([]) +const isCartManage = ref(false) +const checkedAll = ref(false) const onClickLeft = () => { uni.showTabBar() uni.switchTab({ @@ -230,8 +272,8 @@ const onSubmitOrder = async () => { let isRead = false try { cartList.value.forEach((e) => { - const isSelect = e.devInfoVoList.some((j) => j.isChecked?.length > 0) - if (isSelect && e.protocolChecked.length == 0) { + const isSelect = e.devInfoVoList.some((j) => j.isChecked === true) + if (isSelect && !e.protocolChecked) { showFailToast('请阅读公司合同') isRead = true throw new Error() @@ -264,12 +306,12 @@ const onSubmitOrder = async () => { cartList.value.forEach((j, index) => { let itemsArray = [] j.devInfoVoList.forEach((e) => { - if (e.isChecked?.length > 0) { + if (e.isChecked) { itemsArray.push({ maId: e.maId, id: e.id, - rentBeginTime: e.rentBeginTime + '00:00:00', - rentEndTime: e.rentEndTime + '23:59:59', + rentBeginTime: e.rentBeginTime + ' ' + '00:00:00', + rentEndTime: e.rentEndTime + ' ' + '23:59:59', manageType: e.manageType, days: e.days, num: e.num, @@ -286,18 +328,18 @@ const onSubmitOrder = async () => { } } }) - paramsList.forEach((e) => { e.cost = e.detailsList.reduce((accumulator, currentValue) => { return accumulator + currentValue.costs }, 0) }) - - console.log(paramsList, 'paramsList') const res = await submitBookCarAPI(paramsList) if (res.code === 200) { showSuccessToast('提交成功') - getDeviceDetailsData() + setTimeout(() => { + uni.navigateTo({ url: `/pages/order-details/index?type=2` }) + }, 500) + // getDeviceDetailsData() } } const onViewProtocol = () => {} @@ -335,6 +377,10 @@ const onConfirm = () => { showBottom.value = false leaseTime.value = [] } + +const onClickManage = () => { + isCartManage.value = !isCartManage.value +} const onCancel = () => { showBottom.value = false } @@ -344,10 +390,10 @@ const getDeviceDetailsData = async () => { const { data: res } = await getBookCarDetailsAPI() cartList.value = res cartList.value.forEach((e) => { - e.isChecked = [] - e.protocolChecked = [] + e.isChecked = false + e.protocolChecked = false e.devInfoVoList.forEach((j) => { - e.isChecked = [] + e.isChecked = false j.days = 0 j.num = 1 j.costs = 0 @@ -375,7 +421,7 @@ const totalPrice = computed(() => { let orderAmountPice = 0 cartList.value.forEach((e) => { e.devInfoVoList.forEach((g) => { - if (g.isChecked?.length > 0) { + if (g.isChecked) { orderAmountPice = g.num * g.dayLeasePrice * g.days + orderAmountPice } }) @@ -397,7 +443,7 @@ const amountDeviceList = computed(() => { let selectList = [] cartList.value.forEach((e) => { e.devInfoVoList.forEach((g) => { - if (g.isChecked?.length > 0) { + if (g.isChecked) { selectList.push(g) } }) @@ -409,7 +455,7 @@ const amountDevice = computed(() => { let amountNum = 0 cartList.value.forEach((e) => { e.devInfoVoList.forEach((g) => { - if (g.isChecked?.length > 0) { + if (g.isChecked) { amountNum++ } }) @@ -417,23 +463,21 @@ const amountDevice = computed(() => { return amountNum }) -const onChangeAllCheckbox = (index) => { +const onChangeAllCheckbox = (e, index) => { cartList.value[index].devInfoVoList.forEach((j) => { - if (cartList.value[index].isChecked.length > 0) { - j.isChecked = ['1'] - } else { - j.isChecked = [] - } + j.isChecked = e }) + checkedAll.value = cartList.value.every((i) => i.isChecked === true) } -const onChangeCheckbox = (index) => { - const isCheckAll = cartList.value[index].devInfoVoList.every((j) => j.isChecked.length > 0) - console.log(isCheckAll, 'isCheckAll') +const onChangeCheckbox = (e, index) => { + const isCheckAll = cartList.value[index].devInfoVoList.every((j) => j.isChecked === true) if (isCheckAll) { - cartList.value[index].isChecked.push('1') + cartList.value[index].isChecked = true } else { - cartList.value[index].isChecked = [] + cartList.value[index].isChecked = false } + + checkedAll.value = cartList.value.every((i) => i.isChecked === true) } // 获取底部操作栏高度 适配底部内容 @@ -449,6 +493,12 @@ const getActionBarHeight = () => { .exec() } +const onChangeDelete = (val) => { + cartList.value.forEach((e) => { + e.isChecked = val + }) +} + // 选择地址 const onClickLink = () => { showBottomAddress.value = true @@ -458,6 +508,45 @@ const onClickAddress = (res) => { showBottomAddress.value = false } +// 删除 底部操作 +const onDeleteCart = () => { + showConfirmDialog({ + title: '温馨提示', + message: '是否确定删除这条预约车记录', + }) + .then(async () => { + let ids = [] + cartList.value.forEach((e) => { + e.devInfoVoList.forEach((j) => { + if (j.isChecked) { + ids.push(j.id) + } + }) + }) + const res = await deleteBookCarByIdsAPI({ ids }) + if (res.code === 200) { + showSuccessToast('删除成功') + getDeviceDetailsData() + } + }) + .catch(() => {}) +} + +const onDeleteCartGoods = (id) => { + showConfirmDialog({ + title: '温馨提示', + message: '是否确定删除这条预约车记录', + }) + .then(async () => { + const res = await deleteBookCarAPI({ id }) + if (res.code === 200) { + showSuccessToast('删除成功') + getDeviceDetailsData() + } + }) + .catch(() => {}) +} + onLoad(() => { nextTick(() => { getActionBarHeight() @@ -543,10 +632,12 @@ onHide(() => { .items-info { display: flex; + align-items: center; .info { font-size: 12px; + flex: 1; view { padding: 1px 0 1px 10px; @@ -573,4 +664,7 @@ onHide(() => { :deep(.van-address-item__edit) { display: none; } +:deep(.van-submit-bar__bar) { + justify-content: space-between; +} diff --git a/src/pages/demand-details/index.vue b/src/pages/demand-details/index.vue index b06766e..995c8c1 100644 --- a/src/pages/demand-details/index.vue +++ b/src/pages/demand-details/index.vue @@ -1,119 +1,183 @@ diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index caa2c1a..5c95a30 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -18,14 +18,12 @@ - - 您好!{{ userCompanyName }} / {{ memberStore.userInfo.nickName }} - + 您好!{{ userCompanyName }} - 大鹏一日同风起,扶摇直上九万里 + 最新通知··· @@ -40,16 +38,17 @@ - - + + {{ o.order_title }} {{ o.order_count }} - - + + + import { ref } from 'vue' +import orderIcon_1 from '@/static/index/order_icon1.png' +import orderIcon_2 from '@/static/index/order_icon2.png' +import orderIcon_3 from '@/static/index/order_icon3.png' +import orderIcon_4 from '@/static/index/order_icon4.png' +import orderIcon_5 from '@/static/index/order_icon5.png' +import orderIcon_6 from '@/static/index/order_icon6.png' import noticeImg from '@/static/index/notice.png' import toDoList from '@/static/index/to_do_list.png' import SearchIpt from '@/components/SearchIpt/index' @@ -83,12 +88,12 @@ const activeUser = ref(1) const loading = ref(false) const finished = ref(false) const orderData = ref([ - { order_title: '我的订单', order_count: 20 }, - { order_title: '待出库', order_count: 6 }, - { order_title: '待收货', order_count: 8 }, - { order_title: '租赁中', order_count: 12 }, - { order_title: '已退租', order_count: 7 }, - { order_title: '已完成', order_count: 3 }, + { order_title: '我的订单', order_count: 20, order_icon: orderIcon_1 }, + { order_title: '待出库', order_count: 6, order_icon: orderIcon_2 }, + { order_title: '待收货', order_count: 8, order_icon: orderIcon_3 }, + { order_title: '租赁中', order_count: 12, order_icon: orderIcon_4 }, + { order_title: '已退租', order_count: 7, order_icon: orderIcon_5 }, + { order_title: '已完成', order_count: 3, order_icon: orderIcon_6 }, ]) const userActions = ref([ { text: '出租方', userType: 1 }, @@ -124,6 +129,12 @@ const getOrderStatusCountData = async () => { // console.log(res, '数量') } +const onViewMyOrder = (order) => { + uni.navigateTo({ + url: `/pages/order-details/index?type=${activeUser.value}`, + }) +} + onLoad(() => { finished.value = true userCompanyName.value = memberStore?.userCompanyName @@ -186,7 +197,7 @@ onShow(() => { } .order-data { - padding: 0 20px; + padding: 0 10px; box-sizing: border-box; .order-title, @@ -201,6 +212,8 @@ onShow(() => { .to-do-list { margin-top: 10px; + padding: 0 10px; + box-sizing: border-box; .items-info { display: flex; @@ -208,7 +221,7 @@ onShow(() => { font-size: 12px; color: #333; & text:first-child { - color: #0292f9; + color: #22ab9b; } } } diff --git a/src/pages/lease-demand/index.vue b/src/pages/lease-demand/index.vue index 9a6f632..d92d6fb 100644 --- a/src/pages/lease-demand/index.vue +++ b/src/pages/lease-demand/index.vue @@ -1,13 +1,31 @@