租赁协议完善

This commit is contained in:
BianLzhaoMin 2024-12-30 15:02:18 +08:00
parent c26a49e728
commit 959220a068
6 changed files with 199 additions and 64 deletions

View File

@ -5,7 +5,6 @@
<van-icon name="arrow-left" @click="onClickLeft" /> <van-icon name="arrow-left" @click="onClickLeft" />
<text style="color: #000"> 租赁协议 </text> <text style="color: #000"> 租赁协议 </text>
</view> </view>
<scroll-view scroll-y> <scroll-view scroll-y>
<van-cell-group inset> <van-cell-group inset>
<rich-text :nodes="docHtml"></rich-text> <rich-text :nodes="docHtml"></rich-text>
@ -19,14 +18,22 @@ import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import mammoth from 'mammoth' import mammoth from 'mammoth'
const docHtml = ref('') const docHtml = ref('')
const pagesType = ref(1)
const onClickLeft = () => { 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 () => { onLoad(async (options) => {
const response = await fetch( pagesType.value = options.type
'http://36.33.26.201:17788/statics/2024/12/27/bookCar_20241227152534A023.docx', const response = await fetch(options.url)
)
const arrayBuffer = await response.arrayBuffer() const arrayBuffer = await response.arrayBuffer()
mammoth mammoth
.convertToHtml({ arrayBuffer: arrayBuffer }) .convertToHtml({ arrayBuffer: arrayBuffer })

View File

@ -141,24 +141,11 @@
</view> </view>
</view> </view>
<van-row style="padding: 10px 0; margin-top: 10px; border-top: 1px solid #ccc"> <van-row style="padding: 10px 0; margin-top: 10px; border-top: 1px solid #ccc">
<!-- <van-checkbox-group
v-model="item.protocolChecked"
shape="square"
icon-size="16px"
>
<van-checkbox name="1">
我已阅读并同意
<text class="protocol" @click.stop="onViewProtocol">
xxx公司协议
</text>
</van-checkbox>
</van-checkbox-group> -->
<van-checkbox v-model="item.protocolChecked" icon-size="16px"> <van-checkbox v-model="item.protocolChecked" icon-size="16px">
我已阅读并同意 我已阅读并同意
<text class="protocol" @click.stop="onViewProtocol"> xxx公司协议 </text> <text class="protocol" @click.stop="onViewProtocol(item, index)">
{{ item.companyPersonPhoneKey.companyName }}公司协议
</text>
</van-checkbox> </van-checkbox>
</van-row> </van-row>
</view> </view>
@ -222,12 +209,14 @@ import dateIcon from '@/static/goods/date-icon.png'
import { computed, nextTick, ref } from 'vue' import { computed, nextTick, ref } from 'vue'
import { onHide, onLoad, onShow } from '@dcloudio/uni-app' import { onHide, onLoad, onShow } from '@dcloudio/uni-app'
import { import {
getBookCarDetailsAPI,
getAddressListAPI,
submitBookCarAPI, submitBookCarAPI,
deleteBookCarAPI, deleteBookCarAPI,
getAddressListAPI,
getBookCarDetailsAPI,
deleteBookCarByIdsAPI, deleteBookCarByIdsAPI,
getBookCarAgreementAPI,
} from '@/services/cart/index.js' } from '@/services/cart/index.js'
import { useMemberStore } from '@/stores/index.js'
import moment from 'moment' import moment from 'moment'
const cartList = ref([]) const cartList = ref([])
const showBottom = ref(false) const showBottom = ref(false)
@ -244,6 +233,7 @@ const chosenAddressId = ref()
const addressList = ref([]) const addressList = ref([])
const isCartManage = ref(false) const isCartManage = ref(false)
const checkedAll = ref(false) const checkedAll = ref(false)
const memberStore = useMemberStore()
const onClickLeft = () => { const onClickLeft = () => {
uni.showTabBar() uni.showTabBar()
uni.switchTab({ uni.switchTab({
@ -341,9 +331,54 @@ const onSubmitOrder = async () => {
// getDeviceDetailsData() // 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({ uni.navigateTo({
url: '/pages/agreement/index', url: `/pages/agreement/index?url=${res.url}&type=1`,
}) })
} }
const onSelectTime = (type, index, goodsI) => { const onSelectTime = (type, index, goodsI) => {

View File

@ -6,7 +6,13 @@
<text style="color: #000"> 我的订单 </text> <text style="color: #000"> 我的订单 </text>
</view> </view>
<van-tabs v-model:active="activeTabs" swipeable color="#00a288" background="#f0f7f7"> <van-tabs
v-model:active="activeTabs"
swipeable
color="#00a288"
background="#f0f7f7"
@change="onTapsChange"
>
<van-tab v-for="(t, i) in tabList" :title="t.tab_name"> </van-tab> <van-tab v-for="(t, i) in tabList" :title="t.tab_name"> </van-tab>
</van-tabs> </van-tabs>
@ -146,20 +152,15 @@
> >
费用确认 费用确认
</van-button> </van-button>
<van-button
<!-- <van-button style="margin-right: 6px" round type="success" size="small"> style="margin-right: 6px"
发起退租 size="small"
</van-button> type="primary"
class="primary-lease"
<van-button @click.stop="onViewAgreement(item)"
style="margin-right: 6px" >
round 租赁协议
type="success" </van-button>
size="small"
@click="onReduction"
>
发起减免
</van-button> -->
</van-row> </van-row>
<van-row style="margin-top: 14px"> <van-row style="margin-top: 14px">
@ -414,6 +415,7 @@ import {
editOrderStatusAPI, editOrderStatusAPI,
editOrderDetailsAPI, editOrderDetailsAPI,
setAddLeaseRepairAPI, setAddLeaseRepairAPI,
getLeaseAgreementAPI,
} from '@/services/order/index.js' } from '@/services/order/index.js'
const showBottom = ref(false) const showBottom = ref(false)
const showCenter = ref(false) const showCenter = ref(false)
@ -495,7 +497,6 @@ const onReturnRepair = (item) => {
submitParams.value.code = code submitParams.value.code = code
submitParams.value.orderId = orderId submitParams.value.orderId = orderId
editOrderDetailsAPI({ orderId }).then(async (result) => { editOrderDetailsAPI({ orderId }).then(async (result) => {
console.log(result, 'resultresultresult')
repairList.value = result.data.detailsList.map((e) => { repairList.value = result.data.detailsList.map((e) => {
// //
const repairRecord = { const repairRecord = {
@ -698,6 +699,14 @@ const onCostConfirm = (item) => {
uni.navigateTo({ url: `/pages/order-confirm/index?orderId=${item.orderId}` }) 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) => { const onClearRepairRecord = (type, index) => {
if (type === 1) { if (type === 1) {
@ -795,6 +804,11 @@ const onJumpOrderDetails = (item) => {
uni.navigateTo({ url: `/pages/order-details/index?orderId=${item.orderId}` }) 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) => { onLoad((options) => {
orderQueryParams.value.flag = options?.type == 1 ? true : false orderQueryParams.value.flag = options?.type == 1 ? true : false
// console.log(options?.status, '') // console.log(options?.status, '')

View File

@ -19,7 +19,6 @@
</view> </view>
</van-col> </van-col>
<van-col span="10" class="contacts"> <van-col span="10" class="contacts">
<!-- 联系人 {{ item.person }} {{ item.personPhone }} -->
<view> 联系人 {{ item.person }} </view> <view> 联系人 {{ item.person }} </view>
<view style="margin-top: 4px"> {{ item.personPhone }}</view> <view style="margin-top: 4px"> {{ item.personPhone }}</view>
</van-col> </van-col>
@ -33,15 +32,12 @@
<view style="color: #000">{{ item.deviceName }}</view> <view style="color: #000">{{ item.deviceName }}</view>
<view>装备编号{{ item.code }}</view> <view>装备编号{{ item.code }}</view>
<view>装备型号{{ item.typeName }}</view> <view>装备型号{{ item.typeName }}</view>
<view> <view style="display: flex; justify-content: space-between">
租赁金额
<text style="color: var(--van-submit-bar-price-color)"> <text style="color: var(--van-submit-bar-price-color)">
{{ item.dayLeasePrice }}/ 租赁金额{{ item.dayLeasePrice }}/
</text> </text>
<van-stepper <van-stepper
style="margin-left: 20px" button-size="16"
button-size="18"
:max="item.deviceCount" :max="item.deviceCount"
v-model="item.num" v-model="item.num"
/> />
@ -73,22 +69,38 @@
</van-col> </van-col>
</van-row> </van-row>
<van-row style="margin-top: 14px"> <view
总金额 style="
margin-top: 14px;
display: flex;
justify-content: flex-end;
height: 30px;
line-height: 30px;
"
>
<view style="color: var(--van-submit-bar-price-color)"> <view style="color: var(--van-submit-bar-price-color)">
<text> </text> <text> </text>
<text style="font-size: 16px; font-weight: bold"> <text style="font-size: 16px; font-weight: bold">
{{ item.num * item.dayLeasePrice * item.days }} {{ item.num * item.dayLeasePrice * item.days }}
</text> </text>
</view> </view>
</van-row> </view>
<van-row style="padding: 10px 0; margin-top: 10px; border-top: 1px solid #ccc"> <van-row style="padding: 10px 0; margin-top: 10px; border-top: 1px solid #ccc">
<van-checkbox-group v-model="item.checked" shape="square" icon-size="16px"> <!-- <van-checkbox-group v-model="item.checked" shape="square" icon-size="16px">
<van-checkbox name="1"> <van-checkbox name="1">
我已阅读并同意 我已阅读并同意
<text class="protocol" @click.stop="onViewProtocol"> xxx公司协议 </text> <text class="protocol" @click.stop="onViewProtocol">
{{ item.companyName }}公司协议
</text>
</van-checkbox> </van-checkbox>
</van-checkbox-group> </van-checkbox-group> -->
<van-checkbox v-model="item.checked" icon-size="16px">
我已阅读并同意
<text class="protocol" @click.stop="onViewProtocol(item)">
{{ item.companyName }}公司协议
</text>
</van-checkbox>
</van-row> </van-row>
</view> </view>
@ -138,10 +150,13 @@ import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { useMemberStore } from '@/stores/index.js' import { useMemberStore } from '@/stores/index.js'
import { getDeviceDetailsAPI } from '@/services/goods/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' import moment from 'moment'
const memberStore = useMemberStore() const memberStore = useMemberStore()
const checked = ref(['1'])
const orderList = ref([]) const orderList = ref([])
const showBottom = ref(false) const showBottom = ref(false)
const showBottomAddress = ref(false) const showBottomAddress = ref(false)
@ -156,22 +171,27 @@ const onClickLeft = () => {
uni.navigateBack() uni.navigateBack()
} }
const onSubmitOrder = async () => { const onSubmitOrder = async () => {
let isPass = false
orderList.value.forEach((e) => { orderList.value.forEach((e) => {
if (e.days < 1) { if (e.days < 1) {
showFailToast('请选择租期') showFailToast('请选择租期')
isPass = true
return return
} }
if (!e.checked.includes('1')) { if (!e.checked) {
showFailToast('请先阅读公司协议') showFailToast('请先阅读公司协议')
isPass = true
return return
} }
if (address.value.length == 0) { if (address.value.length == 0) {
showFailToast('请选择收货地址') showFailToast('请选择收货地址')
isPass = true
return return
} }
}) })
if (isPass) return
const orderInfo = orderList.value[0] const orderInfo = orderList.value[0]
const submitInfo = { const submitInfo = {
maId: orderInfo.maId, maId: orderInfo.maId,
@ -197,9 +217,47 @@ const onSubmitOrder = async () => {
}, 500) }, 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({ uni.navigateTo({
url: '/pages/agreement/index', url: `/pages/agreement/index?url=${res.url}&type=2`,
}) })
} }
const onSelectTime = (type) => { const onSelectTime = (type) => {
@ -235,7 +293,7 @@ const getDeviceDetailsData = async (id) => {
rentEndTime: '', rentEndTime: '',
days: 0, days: 0,
num: 1, num: 1,
checked: [''], checked: false,
...res, ...res,
} }
orderList.value.push(orderInfo) orderList.value.push(orderInfo)
@ -345,8 +403,9 @@ onLoad((options) => {
align-items: center; align-items: center;
.info { .info {
font-size: 12px; font-size: 13px;
padding-left: 8px;
flex: 1;
view { view {
padding: 2px 0 2px 10px; padding: 2px 0 2px 10px;
font-size: 12px; font-size: 12px;

View File

@ -58,3 +58,13 @@ export const deleteBookCarByIdsAPI = (data) => {
data, data,
}) })
} }
/**
* 获取协议
*/
export const getBookCarAgreementAPI = (data) => {
return http({
method: 'POST',
url: '/material-mall/order/bookCarAgreement',
data,
})
}

View File

@ -70,3 +70,13 @@ export const confirmPriceAPI = (data) => {
data, data,
}) })
} }
/**
* 订单 获取租赁协议
*/
export const getLeaseAgreementAPI = (data) => {
return http({
method: 'GET',
url: '/material-mall/order/leaseAgreement',
data,
})
}