|
@@ -0,0 +1,829 @@
|
|
|
+<template>
|
|
|
+ <div class="tenant">
|
|
|
+ <div class="content">
|
|
|
+ <byTable
|
|
|
+ :source="sourceList.data"
|
|
|
+ :pagination="sourceList.pagination"
|
|
|
+ :config="config"
|
|
|
+ :loading="loading"
|
|
|
+ highlight-current-row
|
|
|
+ :selectConfig="selectConfig"
|
|
|
+ :table-events="{
|
|
|
+ select: select,
|
|
|
+ }"
|
|
|
+ :action-list="[
|
|
|
+ {
|
|
|
+ text: '添加合同',
|
|
|
+ action: () => openModal('add'),
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ @get-list="getList"
|
|
|
+ >
|
|
|
+ </byTable>
|
|
|
+ </div>
|
|
|
+ <el-dialog
|
|
|
+ :title="modalType == 'add' ? '添加合同' : '查看合同'"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ width="80%"
|
|
|
+ v-loading="loading"
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.data"
|
|
|
+ :rules="rules"
|
|
|
+ ref="byform"
|
|
|
+ >
|
|
|
+ <template #seller>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item label="卖方公司" prop="sellCorporationId" required>
|
|
|
+ <el-select
|
|
|
+ v-model="formData.data.sellCorporationId"
|
|
|
+ @change="changeSellId"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in corporationList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-row style="margin-top: 20px; width: 100%">
|
|
|
+ <el-col :span="7">
|
|
|
+ <el-form-item label="地址" prop="sellCountryName">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellCountryName"
|
|
|
+ placeholder="请输入国家"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1"></el-col>
|
|
|
+ <el-col :span="7">
|
|
|
+ <el-form-item label=" " prop="sellProvinceName">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellProvinceName"
|
|
|
+ placeholder="请输入省/州"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1"></el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label=" " prop="sellCityName">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellCityName"
|
|
|
+ placeholder="请输入城市"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-top: 20px; width: 100%">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="sellAddress">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellAddress"
|
|
|
+ type="textarea"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #shroffAccountId>
|
|
|
+ <div style="width: 100%; margin-top: -30px; margin-bottom: 30px">
|
|
|
+ <el-form-item label="收款账号" prop="shroffAccountId" required>
|
|
|
+ <el-select
|
|
|
+ v-model="formData.data.shroffAccountId"
|
|
|
+ placeholder="请选择收款账号"
|
|
|
+ @change="changeShroffAccount"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in accountList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-row style="margin-top: 20px">
|
|
|
+ <el-col :span="11">
|
|
|
+ <el-form-item label="账户名" prop="sellAccountName">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellAccountName"
|
|
|
+ placeholder="请输入账户名"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <div style="height: 20px"></div>
|
|
|
+ <el-form-item label="账号" prop="sellAccountOpening">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellAccountOpening"
|
|
|
+ placeholder="请输入账号"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1"></el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="开户行" prop="sellOpeningBank">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellOpeningBank"
|
|
|
+ placeholder="请输入开户行"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <div style="height: 20px"></div>
|
|
|
+ <el-form-item label="银行号" prop="sellInterbankNumber">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.sellInterbankNumber"
|
|
|
+ placeholder="请输入银行号"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #products>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-button type="primary" plain @click="openProduct = true">
|
|
|
+ 添加明细
|
|
|
+ </el-button>
|
|
|
+ <el-table
|
|
|
+ :data="formData.data.salesContractDetailsList"
|
|
|
+ style="margin-top: 10px"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ prop="productName"
|
|
|
+ label="产品名称"
|
|
|
+ width="280"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="productSpec"
|
|
|
+ label="规格型号"
|
|
|
+ width="100"
|
|
|
+ />
|
|
|
+ <el-table-column prop="isCustomized" label="是否定制" width="120">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="
|
|
|
+ 'salesContractDetailsList.' + $index + '.isCustomized'
|
|
|
+ "
|
|
|
+ :rules="rules.isCustomized"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="row.isCustomized"
|
|
|
+ class="m-2"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option key="1" label="是" value="1" />
|
|
|
+ <el-option key="0" label="否" value="0" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="unitPrice" label="单价" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'salesContractDetailsList.' + $index + '.unitPrice'"
|
|
|
+ :rules="rules.unitPrice"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ onmousewheel="return false;"
|
|
|
+ v-model="row.unitPrice"
|
|
|
+ :precision="2"
|
|
|
+ :controls="false"
|
|
|
+ :min="0"
|
|
|
+ @change="changeAmount"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="quantity" label="数量" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'salesContractDetailsList.' + $index + '.quantity'"
|
|
|
+ :rules="rules.quantity"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ onmousewheel="return false;"
|
|
|
+ v-model="row.quantity"
|
|
|
+ :precision="0"
|
|
|
+ :controls="false"
|
|
|
+ :min="0"
|
|
|
+ @change="changeAmount"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="total" label="金额小计" width="100" />
|
|
|
+ <el-table-column prop="productRemark" label="备注">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="
|
|
|
+ 'salesContractDetailsList.' + $index + '.productRemark'
|
|
|
+ "
|
|
|
+ :rules="rules.productRemark"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="row.productRemark"
|
|
|
+ placeholder="请输入"
|
|
|
+ type="textarea"
|
|
|
+ :rows="3"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="zip" label="操作" width="60">
|
|
|
+ <template #default="{ $index }">
|
|
|
+ <el-button type="primary" link @click="handleRemove($index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm()"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ v-if="modalType == 'add'"
|
|
|
+ >
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog v-model="openProduct" title="选择产品" width="70%">
|
|
|
+ <SelectProduct @handleSelect="handleSelect"></SelectProduct>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="openProduct = false">取消</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="640">
|
|
|
+ <ContractPDF :rowData="rowData"></ContractPDF>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openPrint = false" size="large">取消</el-button>
|
|
|
+ <el-button v-print="printObj" size="large">打印</el-button>
|
|
|
+ <el-button type="primary" @click="clickDownload()" size="large"
|
|
|
+ >下载PDF</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
+import byTable from "@/components/byTable/index";
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
+import SelectProduct from "@/components/product/SelectProduct";
|
|
|
+import ContractPDF from "@/components/PDF/jxstContractPDF.vue";
|
|
|
+import { computed } from "vue";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const loading = ref(false);
|
|
|
+const submitLoading = ref(false);
|
|
|
+const sourceList = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 3,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ keyword: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+const isSettled = ref([
|
|
|
+ {
|
|
|
+ label: "已结清",
|
|
|
+ value: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "未结清",
|
|
|
+ value: "0",
|
|
|
+ },
|
|
|
+]);
|
|
|
+
|
|
|
+const dialogVisible = ref(false);
|
|
|
+const modalType = ref("add");
|
|
|
+const rules = ref({
|
|
|
+ customerId: [
|
|
|
+ { required: true, message: "请选择客户名称", trigger: "change" },
|
|
|
+ ],
|
|
|
+ shroffAccountId: [
|
|
|
+ { required: true, message: "请选择收款账户", trigger: "change" },
|
|
|
+ ],
|
|
|
+ deliveryDate: [
|
|
|
+ { required: true, message: "请选择交货期限", trigger: "change" },
|
|
|
+ ],
|
|
|
+ payMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
|
|
|
+ freightPayer: [
|
|
|
+ { required: true, message: "请选择运费支付方", trigger: "change" },
|
|
|
+ ],
|
|
|
+ isCustomized: [
|
|
|
+ { required: true, message: "请选择是否定制", trigger: "change" },
|
|
|
+ ],
|
|
|
+ unitPrice: [{ required: true, message: "请输入单价", trigger: "blur" }],
|
|
|
+ quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
|
|
|
+});
|
|
|
+const selectConfig = computed(() => [
|
|
|
+ {
|
|
|
+ label: "是否已结清",
|
|
|
+ prop: "isSettled",
|
|
|
+ data: isSettled.value,
|
|
|
+ },
|
|
|
+]);
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "合同号",
|
|
|
+ prop: "code",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "客户名称",
|
|
|
+ prop: "customerName",
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "合同金额",
|
|
|
+ prop: "contractAmount",
|
|
|
+ },
|
|
|
+ render(contractAmount) {
|
|
|
+ return proxy.moneyFormat(contractAmount, 2);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "签订时间",
|
|
|
+ prop: "createTime",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "交货期限",
|
|
|
+ prop: "deliveryDate",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "付款方式",
|
|
|
+ prop: "payMethod",
|
|
|
+ },
|
|
|
+ render(payMethod) {
|
|
|
+ return proxy.dictValueLabel(payMethod, payMethodData.value);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "运费支付方",
|
|
|
+ prop: "freightPayer",
|
|
|
+ },
|
|
|
+ render(freightPayer) {
|
|
|
+ return proxy.dictValueLabel(freightPayer, freightPayerData.value);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "是否已结清",
|
|
|
+ prop: "isSettled",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ render(type) {
|
|
|
+ return proxy.dictValueLabel(type, isSettled.value);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "备注",
|
|
|
+ prop: "remark",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "操作",
|
|
|
+ width: "200",
|
|
|
+ align: "center",
|
|
|
+ },
|
|
|
+ renderHTML(row) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "选择",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ handleSelect(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "结清",
|
|
|
+ // type: "primary",
|
|
|
+ // text: true,
|
|
|
+ // },
|
|
|
+ // el: "button",
|
|
|
+ // click() {
|
|
|
+ // ElMessageBox.confirm("是否确认结清?", "提示", {
|
|
|
+ // confirmButtonText: "确定",
|
|
|
+ // cancelButtonText: "取消",
|
|
|
+ // type: "warning",
|
|
|
+ // }).then(() => {
|
|
|
+ // proxy
|
|
|
+ // .post("/salesContract/settle", {
|
|
|
+ // id: row.id,
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // ElMessage({
|
|
|
+ // message: "操作成功",
|
|
|
+ // type: "success",
|
|
|
+ // });
|
|
|
+ // getList();
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "查看",
|
|
|
+ // type: "primary",
|
|
|
+ // text: true,
|
|
|
+ // },
|
|
|
+ // el: "button",
|
|
|
+ // click() {
|
|
|
+ // getDtl(row);
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "打印",
|
|
|
+ // type: "primary",
|
|
|
+ // text: true,
|
|
|
+ // },
|
|
|
+ // el: "button",
|
|
|
+ // click() {
|
|
|
+ // clickPrint(row);
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const formData = reactive({
|
|
|
+ data: {},
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+});
|
|
|
+const byform = ref(null);
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "seller",
|
|
|
+ label: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "shroffAccountId",
|
|
|
+ label: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "customerId",
|
|
|
+ label: "客户名称",
|
|
|
+ required: true,
|
|
|
+ filterable: true,
|
|
|
+ data: customerData.value,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ itemType: "date",
|
|
|
+ prop: "deliveryDate",
|
|
|
+ label: "交货期限",
|
|
|
+ required: true,
|
|
|
+ itemWidth: 30,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "textarea",
|
|
|
+ prop: "deliveryDateRemark",
|
|
|
+ label: "交货期备注",
|
|
|
+ itemWidth: 70,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "payMethod",
|
|
|
+ label: "付款方式",
|
|
|
+ required: true,
|
|
|
+ data: payMethodData.value,
|
|
|
+ itemWidth: 30,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "textarea",
|
|
|
+ prop: "payMethodRemark",
|
|
|
+ label: "付款方式备注",
|
|
|
+ itemWidth: 70,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "freightPayer",
|
|
|
+ label: "运费支付方",
|
|
|
+ required: true,
|
|
|
+ data: freightPayerData.value,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "textarea",
|
|
|
+ prop: "remark",
|
|
|
+ label: "备注",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "number",
|
|
|
+ disabled: true,
|
|
|
+ prop: "contractAmount",
|
|
|
+ label: "合同总金额",
|
|
|
+ precision: 2,
|
|
|
+ min: 0,
|
|
|
+ controls: false,
|
|
|
+ itemWidth: 30,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "products",
|
|
|
+ label: "合同明细",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const getList = async (req) => {
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
+ loading.value = true;
|
|
|
+ proxy
|
|
|
+ .post("/salesContract/page", sourceList.value.pagination)
|
|
|
+ .then((message) => {
|
|
|
+ sourceList.value.data = message.rows;
|
|
|
+ sourceList.value.pagination.total = message.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ });
|
|
|
+};
|
|
|
+const openModal = () => {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ modalType.value = "add";
|
|
|
+ formOption.disabled = false;
|
|
|
+ formData.data = {
|
|
|
+ salesContractDetailsList: [],
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
+const submitForm = () => {
|
|
|
+ byform.value.handleSubmit(() => {
|
|
|
+ if (!formData.data.salesContractDetailsList.length > 0) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "请添加合同明细",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy
|
|
|
+ .post("/flowProcess/initiate", {
|
|
|
+ flowKey: "jxst_sales_contract_flow",
|
|
|
+ data: formData.data,
|
|
|
+ })
|
|
|
+ .then(
|
|
|
+ () => {
|
|
|
+ ElMessage({
|
|
|
+ message: "添加成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err);
|
|
|
+ submitLoading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+const getDtl = (row) => {
|
|
|
+ modalType.value = "detail";
|
|
|
+ formOption.disabled = true;
|
|
|
+ proxy.post("/salesContract/detail", { id: row.id }).then((res) => {
|
|
|
+ if (res && res.contractDetailsList.length > 0) {
|
|
|
+ res.salesContractDetailsList = res.contractDetailsList;
|
|
|
+ } else {
|
|
|
+ res.salesContractDetailsList = [];
|
|
|
+ }
|
|
|
+ formData.data = res;
|
|
|
+ changeAmount();
|
|
|
+ dialogVisible.value = true;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const customerData = ref([]);
|
|
|
+const accountList = ref([]);
|
|
|
+const corporationList = ref([]);
|
|
|
+const payMethodData = ref([]);
|
|
|
+const freightPayerData = ref([
|
|
|
+ {
|
|
|
+ label: "甲方",
|
|
|
+ value: "0",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "乙方",
|
|
|
+ value: "1",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const getDict = () => {
|
|
|
+ proxy.post("/customer/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
|
|
|
+ customerData.value = res.rows.map((x) => ({
|
|
|
+ label: x.name,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+ proxy
|
|
|
+ .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
|
|
|
+ .then((res) => {
|
|
|
+ accountList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ label: item.alias,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ corporationList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ proxy.getDict(["funds_payment_method"]).then((res) => {
|
|
|
+ payMethodData.value = res["funds_payment_method"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+getList();
|
|
|
+const openProduct = ref(false);
|
|
|
+// const handleSelect = (row) => {
|
|
|
+// formData.data.salesContractDetailsList.push({
|
|
|
+// productName: row.name,
|
|
|
+// productSpec: row.spec,
|
|
|
+// productId: row.id,
|
|
|
+// quantity: null,
|
|
|
+// });
|
|
|
+// return ElMessage({
|
|
|
+// message: "选择成功",
|
|
|
+// type: "success",
|
|
|
+// });
|
|
|
+// // const flag = formData.data.salesContractDetailsList.some(
|
|
|
+// // (x) => x.productId === row.id
|
|
|
+// // );
|
|
|
+// // if (!flag) {
|
|
|
+// // formData.data.salesContractDetailsList.push({
|
|
|
+// // productName: row.name + ` (${row.spec})`,
|
|
|
+// // productId: row.id,
|
|
|
+// // quantity: null,
|
|
|
+// // });
|
|
|
+// // return ElMessage({
|
|
|
+// // message: "选择成功",
|
|
|
+// // type: "success",
|
|
|
+// // });
|
|
|
+// // }
|
|
|
+// // return ElMessage({
|
|
|
+// // message: "该产品已选择",
|
|
|
+// // type: "info",
|
|
|
+// // });
|
|
|
+// };
|
|
|
+const handleRemove = (index) => {
|
|
|
+ formData.data.salesContractDetailsList.splice(index, 1);
|
|
|
+ changeAmount();
|
|
|
+};
|
|
|
+
|
|
|
+const changeAmount = () => {
|
|
|
+ let total = 0;
|
|
|
+ for (let i = 0; i < formData.data.salesContractDetailsList.length; i++) {
|
|
|
+ const e = formData.data.salesContractDetailsList[i];
|
|
|
+ e.total = "";
|
|
|
+ if (e.quantity && e.unitPrice) {
|
|
|
+ e.total = parseFloat(Number(e.quantity) * Number(e.unitPrice)).toFixed(2);
|
|
|
+ }
|
|
|
+ total += Number(e.total);
|
|
|
+ }
|
|
|
+ formData.data.contractAmount = parseFloat(total).toFixed(2);
|
|
|
+};
|
|
|
+const changeSellId = (val) => {
|
|
|
+ if (val) {
|
|
|
+ proxy.post("/corporation/detail", { id: val }).then((detailCorporation) => {
|
|
|
+ if (detailCorporation.countryName) {
|
|
|
+ formData.data.sellCountryName = detailCorporation.countryName;
|
|
|
+ }
|
|
|
+ if (detailCorporation.provinceName) {
|
|
|
+ formData.data.sellProvinceName = detailCorporation.provinceName;
|
|
|
+ }
|
|
|
+ if (detailCorporation.cityName) {
|
|
|
+ formData.data.sellCityName = detailCorporation.cityName;
|
|
|
+ }
|
|
|
+ if (detailCorporation.address) {
|
|
|
+ formData.data.sellAddress = detailCorporation.address;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+const changeShroffAccount = (val) => {
|
|
|
+ if (val) {
|
|
|
+ let data = accountList.value.filter((item) => item.value === val);
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ formData.data.sellAccountName = data[0].name;
|
|
|
+ formData.data.sellOpeningBank = data[0].openingBank;
|
|
|
+ formData.data.sellInterbankNumber = data[0].interbankNumber;
|
|
|
+ formData.data.sellAccountOpening = data[0].accountOpening;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+const rowData = ref({});
|
|
|
+const openPrint = ref(false);
|
|
|
+const clickPrint = (row) => {
|
|
|
+ rowData.value = {
|
|
|
+ id: row.id,
|
|
|
+ };
|
|
|
+ openPrint.value = true;
|
|
|
+};
|
|
|
+const printObj = ref({
|
|
|
+ id: "pdfDom",
|
|
|
+ popTitle: "",
|
|
|
+ extraCss:
|
|
|
+ "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
|
|
|
+ extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
|
|
|
+});
|
|
|
+const clickDownload = () => {
|
|
|
+ proxy.getPdf("购销合同PDF文件");
|
|
|
+};
|
|
|
+
|
|
|
+const handleSelect = (row) => {
|
|
|
+ proxy.$emit("handleSelectContrct", row);
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.tenant {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+::v-deep(.el-input-number .el-input__inner) {
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+</style>
|