From 959220a068e5d7df6124f2defa3ee13a998fb91b Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Mon, 30 Dec 2024 15:02:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E8=B5=81=E5=8D=8F=E8=AE=AE=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/agreement/index.vue | 21 ++++--- src/pages/cart/index.vue | 75 +++++++++++++++++------- src/pages/order-list/index.vue | 46 +++++++++------ src/pages/order/index.vue | 101 ++++++++++++++++++++++++++------- src/services/cart/index.js | 10 ++++ src/services/order/index.js | 10 ++++ 6 files changed, 199 insertions(+), 64 deletions(-) diff --git a/src/pages/agreement/index.vue b/src/pages/agreement/index.vue index dfad8ab..30ca65d 100644 --- a/src/pages/agreement/index.vue +++ b/src/pages/agreement/index.vue @@ -5,7 +5,6 @@ 租赁协议 - @@ -19,14 +18,22 @@ import { ref } from 'vue' import { onLoad } from '@dcloudio/uni-app' import mammoth from 'mammoth' const docHtml = ref('') - +const pagesType = ref(1) const onClickLeft = () => { - uni.navigateBack() + let url = '' + if (pagesType.value == 1) url = '/pages/cart/index' + if (pagesType.value == 3) url = '/pages/order-list/index' + if (pagesType.value == 1 || pagesType.value == 3) { + uni.reLaunch({ + url, + }) + } else { + uni.navigateBack() + } } -onLoad(async () => { - const response = await fetch( - 'http://36.33.26.201:17788/statics/2024/12/27/bookCar_20241227152534A023.docx', - ) +onLoad(async (options) => { + pagesType.value = options.type + const response = await fetch(options.url) const arrayBuffer = await response.arrayBuffer() mammoth .convertToHtml({ arrayBuffer: arrayBuffer }) diff --git a/src/pages/cart/index.vue b/src/pages/cart/index.vue index f1f81e0..258bfa8 100644 --- a/src/pages/cart/index.vue +++ b/src/pages/cart/index.vue @@ -141,24 +141,11 @@ - - 我已阅读并同意 - 《xxx公司协议》 + + 《{{ item.companyPersonPhoneKey.companyName }}公司协议》 + @@ -222,12 +209,14 @@ 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, deleteBookCarAPI, + getAddressListAPI, + getBookCarDetailsAPI, deleteBookCarByIdsAPI, + getBookCarAgreementAPI, } from '@/services/cart/index.js' +import { useMemberStore } from '@/stores/index.js' import moment from 'moment' const cartList = ref([]) const showBottom = ref(false) @@ -244,6 +233,7 @@ const chosenAddressId = ref() const addressList = ref([]) const isCartManage = ref(false) const checkedAll = ref(false) +const memberStore = useMemberStore() const onClickLeft = () => { uni.showTabBar() uni.switchTab({ @@ -341,9 +331,54 @@ const onSubmitOrder = async () => { // getDeviceDetailsData() } } -const onViewProtocol = () => { +const onViewProtocol = async (item, index) => { + if (amountDevice.value < 1) { + showFailToast('请选择装备') + return + } + let isDays = false + try { + amountDeviceList.value.forEach((e) => { + if (e.days < 1) { + showFailToast('有装备租期未选择或租期为0,请选择租期') + isDays = true + throw new Error() + } + }) + } catch (error) {} + + if (isDays) return + // 组装参数 获取协议 + let detailsList = [] + let cost = 0 + const { companyName, companyId, personPhone } = item.companyPersonPhoneKey + cartList.value[index].devInfoVoList.map((e) => { + if (e.isChecked) { + detailsList.push({ + rentBeginTime: e.rentBeginTime + ' ' + '00:00:00', + rentEndTime: e.rentEndTime + ' ' + '23:59:59', + manageType: e.manageType, + days: e.days, + num: e.num, + costs: e.num * e.days * e.dayLeasePrice, + deviceName: e.deviceName, + dayLeasePrice: e.dayLeasePrice, + }) + cost = cost + e.num * e.days * e.dayLeasePrice + } + }) + const queryParams = { + companyName: memberStore.userCompanyName, + czcompanyName: companyName, + companyId, + cost, + detailsList, + personPhone, + } + + const { data: res } = await getBookCarAgreementAPI(queryParams) uni.navigateTo({ - url: '/pages/agreement/index', + url: `/pages/agreement/index?url=${res.url}&type=1`, }) } const onSelectTime = (type, index, goodsI) => { diff --git a/src/pages/order-list/index.vue b/src/pages/order-list/index.vue index c06e2bb..b035c3b 100644 --- a/src/pages/order-list/index.vue +++ b/src/pages/order-list/index.vue @@ -6,7 +6,13 @@ 我的订单 - + @@ -146,20 +152,15 @@ > 费用确认 - - + + 租赁协议 + @@ -414,6 +415,7 @@ import { editOrderStatusAPI, editOrderDetailsAPI, setAddLeaseRepairAPI, + getLeaseAgreementAPI, } from '@/services/order/index.js' const showBottom = ref(false) const showCenter = ref(false) @@ -495,7 +497,6 @@ const onReturnRepair = (item) => { submitParams.value.code = code submitParams.value.orderId = orderId editOrderDetailsAPI({ orderId }).then(async (result) => { - console.log(result, 'resultresultresult') repairList.value = result.data.detailsList.map((e) => { // 维修费用 const repairRecord = { @@ -698,6 +699,14 @@ const onCostConfirm = (item) => { uni.navigateTo({ url: `/pages/order-confirm/index?orderId=${item.orderId}` }) } +// 租赁协议 +const onViewAgreement = async (item) => { + const { data: res } = await getLeaseAgreementAPI({ orderId: item.orderId }) + uni.navigateTo({ + url: `/pages/agreement/index?url=${res.url}&type=3`, + }) +} + // 移除 const onClearRepairRecord = (type, index) => { if (type === 1) { @@ -795,6 +804,11 @@ const onJumpOrderDetails = (item) => { uni.navigateTo({ url: `/pages/order-details/index?orderId=${item.orderId}` }) } +const onTapsChange = (val) => { + orderQueryParams.value.orderStatus = val === 0 ? '' : tabList.value[val].order_status + getOrderListData() +} + onLoad((options) => { orderQueryParams.value.flag = options?.type == 1 ? true : false // console.log(options?.status, '状态') diff --git a/src/pages/order/index.vue b/src/pages/order/index.vue index f4da2df..b911dc2 100644 --- a/src/pages/order/index.vue +++ b/src/pages/order/index.vue @@ -19,7 +19,6 @@ - 联系人: {{ item.person }} {{ item.personPhone }} @@ -33,15 +32,12 @@ {{ item.deviceName }} 装备编号:{{ item.code }} 装备型号:{{ item.typeName }} - - 租赁金额: + - ¥{{ item.dayLeasePrice }}/天 + 租赁金额:¥{{ item.dayLeasePrice }}/天 - @@ -73,22 +69,38 @@ - - 总金额: + {{ item.num * item.dayLeasePrice * item.days }} - + - + + + + 我已阅读并同意 + + 《{{ item.companyName }}公司协议》 + + @@ -138,10 +150,13 @@ import { computed, ref } from 'vue' import { onLoad } from '@dcloudio/uni-app' import { useMemberStore } from '@/stores/index.js' import { getDeviceDetailsAPI } from '@/services/goods/index.js' -import { getAddressListAPI, submitBookCarAPI } from '@/services/cart/index.js' +import { + getAddressListAPI, + submitBookCarAPI, + getBookCarAgreementAPI, +} from '@/services/cart/index.js' import moment from 'moment' const memberStore = useMemberStore() -const checked = ref(['1']) const orderList = ref([]) const showBottom = ref(false) const showBottomAddress = ref(false) @@ -156,22 +171,27 @@ const onClickLeft = () => { uni.navigateBack() } const onSubmitOrder = async () => { + let isPass = false orderList.value.forEach((e) => { if (e.days < 1) { showFailToast('请选择租期') + isPass = true return } - if (!e.checked.includes('1')) { + if (!e.checked) { showFailToast('请先阅读公司协议') + isPass = true return } if (address.value.length == 0) { showFailToast('请选择收货地址') + isPass = true return } }) + if (isPass) return const orderInfo = orderList.value[0] const submitInfo = { maId: orderInfo.maId, @@ -197,9 +217,47 @@ const onSubmitOrder = async () => { }, 500) } } -const onViewProtocol = () => { +const onViewProtocol = async (item) => { + let isDays = false + orderList.value.forEach((e) => { + if (e.days < 1) { + showFailToast('请选择租期') + isDays = true + return + } + }) + if (isDays) return + // 组装参数 获取协议 + let detailsList = [] + let cost = 0 + const { companyName, companyId, personPhone } = item + + orderList.value.forEach((e) => { + detailsList.push({ + rentBeginTime: e.rentBeginTime + ' ' + '00:00:00', + rentEndTime: e.rentEndTime + ' ' + '23:59:59', + manageType: e.manageType, + days: e.days, + num: e.num, + costs: e.num * e.days * e.dayLeasePrice, + deviceName: e.deviceName, + dayLeasePrice: e.dayLeasePrice, + }) + cost = cost + e.num * e.days * e.dayLeasePrice + }) + + const queryParams = { + companyName: memberStore.userCompanyName, + czcompanyName: companyName, + companyId, + cost, + detailsList, + personPhone, + } + + const { data: res } = await getBookCarAgreementAPI(queryParams) uni.navigateTo({ - url: '/pages/agreement/index', + url: `/pages/agreement/index?url=${res.url}&type=2`, }) } const onSelectTime = (type) => { @@ -235,7 +293,7 @@ const getDeviceDetailsData = async (id) => { rentEndTime: '', days: 0, num: 1, - checked: [''], + checked: false, ...res, } orderList.value.push(orderInfo) @@ -345,8 +403,9 @@ onLoad((options) => { align-items: center; .info { - font-size: 12px; - + font-size: 13px; + padding-left: 8px; + flex: 1; view { padding: 2px 0 2px 10px; font-size: 12px; diff --git a/src/services/cart/index.js b/src/services/cart/index.js index 03590cd..758d86f 100644 --- a/src/services/cart/index.js +++ b/src/services/cart/index.js @@ -58,3 +58,13 @@ export const deleteBookCarByIdsAPI = (data) => { data, }) } +/** + * 获取协议 + */ +export const getBookCarAgreementAPI = (data) => { + return http({ + method: 'POST', + url: '/material-mall/order/bookCarAgreement', + data, + }) +} diff --git a/src/services/order/index.js b/src/services/order/index.js index eaad25c..42d0030 100644 --- a/src/services/order/index.js +++ b/src/services/order/index.js @@ -70,3 +70,13 @@ export const confirmPriceAPI = (data) => { data, }) } +/** + * 订单 获取租赁协议 + */ +export const getLeaseAgreementAPI = (data) => { + return http({ + method: 'GET', + url: '/material-mall/order/leaseAgreement', + data, + }) +}