This commit is contained in:
weipengfei 2023-09-07 18:30:16 +08:00
commit e50333eaab
5 changed files with 155 additions and 82 deletions

View File

@ -1,6 +1,19 @@
import request from '@/utils/request'
import request from "@/utils/request";
// 合同列表
export function apiContractLists(params: any) {
return request.get({ url: '/contract.VehicleContract/townRentList', params })
return request.get({ url: "/contract.VehicleContract/townRentList", params });
}
// 发送合同
// /adminapi/accnortt.VehicleContract / initiatingRentCarContract;
export function sendContract(params: any) {
return request.post({
url: "/contract.VehicleContract/initiatingRentCarContract",
params,
});
}
// 重新短信
export function sendMsg(params: any) {
return request.post({ url: "/contract.contract/sendSmsAgain", params });
}
// /adminapi//adminapi/contract.VehicleContract/initiatingRentCarContract

View File

@ -117,6 +117,7 @@
<el-col :span="24" class="el-card pt-6">
<div class="tit">租赁信息</div>
<!-- {{ formData.car_inf }} -->
<el-row v-for="(item, index) in formData.cars_info">
<el-col :span="4">
<el-form-item label-width="120px" label="车牌号"
@ -177,8 +178,9 @@
</template>
<script setup>
import { reactive, ref } from "vue";
import { contractDetail, sendContract, sendMsg } from "@/api/contract";
// import { contractDetail, sendContract, sendMsg } from "@/api/contract";
import feedback from "@/utils/feedback";
import { leaseContractDetail } from "@/api/contract";
const router = useRouter();
const route = useRoute();
@ -214,11 +216,13 @@ const formData = reactive({
const num = ref(0);
// route.query.flag
contractDetail({ id: route.query.id }).then((res) => {
leaseContractDetail({ id: route.query.id }).then((res) => {
for (let key in formData) {
formData[key] = res[key];
}
console.log(formData);
// formData.cars_info = JSON.parse(formData.cars_info) || "";
// console.log(formData.cars_info);
});
const checkContract = () => {
window.open(formData.contract_url, "_blank");

View File

@ -83,7 +83,7 @@
<el-button type="primary" link>
<router-link
:to="{
path: '/contract/detail',
path: '/contract/card_detail',
query: {
id: row.id,
},
@ -130,7 +130,7 @@
import { usePaging } from "@/hooks/usePaging";
import { useDictData } from "@/hooks/useDictOptions";
// import { contractList, sendContract, sendMsg } from "@/api/contract";
import { apiContractLists } from "@/api/car_contract";
import { apiContractLists, sendContract, sendMsg } from "@/api/car_contract";
import feedback from "@/utils/feedback";
const sendAgain = (id: number) => {

View File

@ -151,69 +151,107 @@
</div>
</el-row>
</el-col>
<el-col :span="24" class="el-card pt-6">
<!-- -->
<el-col :span="24" class="el-card pt-6" v-if="formData.cars_info">
<div class="tit">租赁信息</div>
<el-row v-for="(item, index) in formData.cars_info">
<el-col :span="4">
<el-form-item label-width="120px" label="车牌号"
><el-input
v-model="item.license"
placeholder="请输入车牌号"
clearable
:style="{ width: '100%' }"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="120px" label="车辆类型">
<el-input
v-model="formData.type"
placeholder="请输入车辆类型"
clearable
:style="{ width: '100%' }"
></el-input
></el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="120px" label="使用公司"
><el-input
v-model="formData.company_b_name"
placeholder="请输入使用公司"
clearable
:style="{ width: '100%' }"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="120px" label="签约时间">
<el-input
v-model="formData.update_time"
placeholder="请输入签约时间"
clearable
:style="{ width: '100%' }"
></el-input
></el-form-item>
</el-col>
</el-row>
<div>
<el-row>
<el-col :span="4">
<el-form-item label-width="120px" label="车牌号"
><el-input
v-model="formData.cars_info.license"
placeholder="请输入车牌号"
clearable
:style="{ width: '100%' }"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="120px" label="车辆类型">
<el-input
v-model="formData.type"
placeholder="请输入车辆类型"
clearable
:style="{ width: '100%' }"
></el-input
></el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="120px" label="使用公司"
><el-input
v-model="formData.company_b_name"
placeholder="请输入使用公司"
clearable
:style="{ width: '100%' }"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="120px" label="签约时间">
<el-input
v-model="formData.update_time"
placeholder="请输入签约时间"
clearable
:style="{ width: '100%' }"
></el-input
></el-form-item>
</el-col>
</el-row>
</div>
</el-col>
</el-form>
<el-upload
v-if="formData.status == 0"
:disabled="isDisabled"
v-model:file-list="fileList"
:headers="{ Token: userStore.token }"
class="upload-demo"
:action="base_url + '/upload/file'"
multiple
:limit="1"
:on-success="handleAvatarSuccess_three"
<!-- 小组公司申请车辆 -->
<!-- {{ formData.contract_logistic_id }}
{{ formData.type }} -->
<div
v-if="formData.contract_logistic_id && formData.type == '租赁车辆'"
class="el-card pt-6"
>
<el-button :disabled="isDisabled" type="primary">上传合同</el-button>
</el-upload>
<el-button type="primary" @click="checkContract" v-if="formData.file"
>查看合同</el-button
<div class="tit">租赁信息</div>
<div style="padding: 0 2vw">
<el-checkbox-group
:max="formData.num"
v-model="checkList"
@change="handChangeFn"
>
<el-checkbox
:label="item.license"
v-for="(item, index) in formData.car_list"
:key="index"
/>
</el-checkbox-group>
</div>
</div>
<div class="el-card pt-6">
<el-upload
style="display: inline-block"
:headers="{ Token: userStore.token }"
:action="base_url + '/upload/file'"
:on-success="handleAvatarSuccess_three"
:before-upload="handleBeforeUpload"
:limit="1"
v-if="formData?.status == 0"
:on-exceed="handleExceed"
ref="upload"
>
<el-button type="primary">{{
formData.file ? "重新上传" : "上传合同"
}}</el-button>
</el-upload>
<a
v-if="formData.file && formData?.status == 0"
style="margin-left: 10px; color: #4a5dff"
:href="formData.file"
target="_blank"
>合同已上传,点击查看</a
>
<el-button type="primary" v-if="formData.status > 0" @click="test"
>查看合同</el-button
>
</div>
<el-button type="primary" v-if="formData.status == 0" @click="create"
>确定</el-button
>
</div>
</template>
@ -224,6 +262,7 @@ import useUserStore from "@/stores/modules/user";
const userStore = useUserStore();
const router = useRouter();
const route = useRoute();
const checkList = ref([]);
const formData = reactive({
contract_logistic_id: "",
contract_no: "",
@ -244,6 +283,7 @@ const formData = reactive({
id: "",
license: "",
},
car_list: [],
type: 0,
status: 0,
file: "",
@ -254,14 +294,26 @@ const formData = reactive({
update_time: "2023-08-31 14:26:49",
reject_message: "",
});
let arrs = [];
const base_url = inject("base_url");
// route.query.flag
// console.log(route.query.id);
// leaseContractDetail({ id: route.query.id }).then((res) => {
// console.log(res);
// });
const checkContract = () => {
const handChangeFn = (e) => {
arrs = [];
e.map((item) => {
formData.car_list.forEach((element) => {
if (element.license == item) {
arrs.push(element);
}
});
});
// console.log(JSON.stringify(arrs));
// console.log(arrs[0].id);
// console.log(checkList.value);
// console.log(e);
// console.log(formData.car_list);
// console.log(formData.file);
};
const test = () => {
window.open(formData.file, "_blank");
};
leaseContractDetail({ id: route.query.id }).then((res) => {
@ -269,22 +321,24 @@ leaseContractDetail({ id: route.query.id }).then((res) => {
formData[key] = res[key];
}
if (formData.company_a_id) {
formData.cars_info = [formData.cars_info];
// console.log(JSON.parse(formData.cars_info));
// formData.cars_info = JSON.parse(formData.cars_info) || "";
}
formData.type
? (formData.type = "自有车辆合同")
: (formData.type = "租赁合同");
console.log(formData);
formData.type ? (formData.type = "自有车辆") : (formData.type = "租赁车辆");
console.log(formData.type);
});
const handleAvatarSuccess_three = (response, uploadFile) => {
formData.file = response.data.uri;
};
const create = () => {
leaseUpContract({
id: route.query.id,
file: response.data.uri,
file: formData.file,
cars: JSON.stringify(arrs),
}).then((res) => {
// console.log(res);
formData.status = 1;
console.log(res);
});
};
</script>
@ -317,7 +371,9 @@ const handleAvatarSuccess_three = (response, uploadFile) => {
border-radius: 6px;
flex-shrink: 0;
}
.upload-demo {
display: flex;
}
.avatar-uploader-head .el-upload {
width: 120px;
height: 140px;

View File

@ -121,7 +121,7 @@ import { usePaging } from "@/hooks/usePaging";
import { useDictData } from "@/hooks/useDictOptions";
// import { contractList, sendContract } from "@/api/contract";
import { leaseContractList } from "@/api/contract";
//
// import EditPopup from "./edit.vue";
// let obj = [
// {