1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075 |
- <template>
- <div style="width: 100%; padding: 0px 15px">
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
- <template #seller>
- <div style="width: 100%">
- <el-form-item prop="sellCorporationId">
- <el-select v-model="formData.data.sellCorporationId" style="width: 100%" disabled>
- <el-option v-for="item in corporationList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="8">
- <el-form-item label="地址" prop="sellCountryId">
- <el-input v-model="formData.data.sellCountryId" placeholder="请输入国家" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label=" " prop="sellProvinceId">
- <el-input v-model="formData.data.sellProvinceId" placeholder="请输入省/州" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label=" " prop="sellCityId">
- <el-input v-model="formData.data.sellCityId" 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-row style="margin-top: 20px; width: 100%">
- <el-col :span="8">
- <el-form-item label="联系人" prop="sellContactName">
- <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" />
- </el-form-item>
- </el-col>
- <el-col :span="16">
- <el-form-item label=" " prop="sellContactNumber">
- <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #buyer>
- <div style="width: 100%">
- <div style="width: 100%">
- <el-form-item prop="buyCorporationId">
- <el-select v-model="formData.data.buyCorporationId" style="width: 100%" @change="changeCustomer">
- <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="6">
- <el-form-item label="地址" prop="buyCountryId">
- <el-select v-model="formData.data.buyCountryId" placeholder="国家" @change="(val) => getCityData(val, '20', true)">
- <el-option v-for="item in countryData" :label="item.chineseName" :value="item.id"> </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label=" " prop="buyProvinceId">
- <el-select v-model="formData.data.buyProvinceId" placeholder="省/洲" @change="(val) => getCityData(val, '30', true)">
- <el-option v-for="item in provinceData" :label="item.name" :value="item.id"> </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label=" " prop="buyCityId">
- <el-select v-model="formData.data.buyCityId" placeholder="城市">
- <el-option v-for="item in cityData" :label="item.name" :value="item.id"> </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label=" " prop="buyPostalCode">
- <el-input v-model="formData.data.buyPostalCode" placeholder="请输入邮编" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="24">
- <el-form-item prop="buyAddress">
- <el-input v-model="formData.data.buyAddress" type="textarea"> </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="8">
- <el-form-item label="联系人" prop="buyContactName">
- <el-autocomplete
- v-model="formData.data.buyContactName"
- :fetch-suggestions="querySearchPerson"
- clearable
- class="inline-input w-50"
- placeholder="请输入联系人"
- @select="handlePerson">
- </el-autocomplete>
- </el-form-item>
- </el-col>
- <el-col :span="16">
- <el-form-item label=" " prop="buyContactNumber">
- <el-input v-model="formData.data.buyContactNumber" placeholder="请输入联系人电话" />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- </template>
- <template #payment>
- <div style="width: 100%">
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="6">
- <el-form-item label="币种" prop="currency">
- <el-select v-model="formData.data.currency" placeholder="请选择币种" style="width: 100%">
- <el-option v-for="item in accountCurrency" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="付款方式" prop="paymentMethod">
- <el-select v-model="formData.data.paymentMethod" placeholder="请选择付款方式" style="width: 100%">
- <el-option v-for="item in fundsPaymentMethod" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="预付比例 (%)" prop="advanceRatio">
- <el-input-number
- v-model="formData.data.advanceRatio"
- placeholder="请输入预付比例"
- style="width: 100%"
- :precision="2"
- :controls="false"
- :min="0"
- :max="100" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="18">
- <el-form-item label="付款条件" prop="remark">
- <el-input v-model="formData.data.remark" :rows="2" type="textarea" placeholder="请输入付款条件" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="9">
- <el-form-item label="收款账号" prop="shroffAccountId">
- <el-select v-model="formData.data.shroffAccountId" placeholder="请选择收款账号" style="width: 100%" @change="changeShroffAccount">
- <el-option v-for="item in accountList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="9">
- <el-form-item label=" ">
- <el-button type="primary" @click="changeActiveName" text>
- <span v-if="activeName == '1'">收起</span>
- <span v-else>展开</span>
- </el-button>
- </el-form-item>
- </el-col>
- </el-row>
- <div style="width: 100%; margin-top: 34px">
- <el-collapse v-model="activeName" class="hideCollapse" accordion>
- <el-collapse-item title="" name="1">
- <el-row style="width: 100%">
- <el-col :span="9">
- <el-form-item label="Beneficiary Name" prop="beneficiaryName">
- <el-input v-model="formData.data.beneficiaryName" placeholder="请输入Beneficiary Name" />
- </el-form-item>
- <div style="height: 20px"></div>
- <el-form-item label="Beneficiary Bank" prop="beneficiaryBank">
- <el-input v-model="formData.data.beneficiaryBank" placeholder="请输入Beneficiary Bank" />
- </el-form-item>
- <div style="height: 20px"></div>
- <el-form-item label="Beneficiary Bank Address" prop="beneficiaryBankAddress">
- <el-input v-model="formData.data.beneficiaryBankAddress" placeholder="请输入Beneficiary Bank Address" />
- </el-form-item>
- </el-col>
- <el-col :span="9">
- <el-form-item label="Beneficiary Account Number" prop="beneficiaryAccountNumber">
- <el-input v-model="formData.data.beneficiaryAccountNumber" placeholder="请输入Beneficiary Account Number" />
- </el-form-item>
- <div style="height: 20px"></div>
- <el-form-item label="Swift Code" prop="swiftCode">
- <el-input v-model="formData.data.swiftCode" placeholder="请输入Swift Code" />
- </el-form-item>
- <div style="height: 20px"></div>
- <el-form-item label="Beneficiary Address" prop="beneficiaryAddress">
- <el-input v-model="formData.data.beneficiaryAddress" placeholder="请输入Beneficiary Address" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-collapse-item>
- </el-collapse>
- </div>
- </div>
- </template>
- <template #delivery>
- <div style="width: 100%">
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="6">
- <el-form-item label="报价有效期 (天)" prop="effective">
- <el-input-number v-model="formData.data.effective" placeholder="请输入有效期" style="width: 100%" :precision="0" :controls="false" :min="0" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="交货期限" prop="deliveryTime">
- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="运输方式" prop="transportMethod">
- <el-select v-model="formData.data.transportMethod" placeholder="请选择运输方式" style="width: 100%">
- <el-option v-for="item in shippingMethod" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="运输说明" prop="transportRemark">
- <el-input v-model="formData.data.transportRemark" placeholder="请输入运输说明" />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #commodity>
- <div style="width: 100%">
- <el-button type="primary" @click="openProductCompany = true" plain>标准产品库</el-button>
- <el-button type="primary" @click="clickCustomerProduct()" plain>客户产品库</el-button>
- <el-table :data="formData.data.contractProductList" style="width: 100%; margin-top: 16px">
- <el-table-column label="商品图片" width="80">
- <template #default="{ row }">
- <div v-if="row.productId">
- <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
- </div>
- <div v-else></div>
- </template>
- </el-table-column>
- <el-table-column label="商品名称" min-width="180">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item
- :prop="'contractProductList.' + $index + '.productName'"
- :rules="rules.productName"
- :inline-message="true"
- class="shrinkPadding">
- <el-input v-model="row.productName" placeholder="请输入商品名称" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="尺寸 cm*cm*cm" width="140">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item
- :prop="'contractProductList.' + $index + '.productModel'"
- :rules="rules.productModel"
- :inline-message="true"
- class="shrinkPadding">
- <el-input v-model="row.productModel" placeholder="请输入" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="数量" width="130">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" class="shrinkPadding">
- <el-input-number
- v-model="row.quantity"
- placeholder="请输入"
- style="width: 100%"
- :precision="0"
- :controls="false"
- :min="0"
- @change="calculationAmount()" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="单价" width="140">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true" class="shrinkPadding">
- <el-input-number
- v-model="row.price"
- placeholder="请输入"
- style="width: 100%"
- :precision="2"
- :controls="false"
- :min="0"
- @change="calculationAmount()" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="贸易方式" width="140">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item
- :prop="'contractProductList.' + $index + '.tradeMethods'"
- :rules="rules.tradeMethods"
- :inline-message="true"
- class="shrinkPadding">
- <el-select v-model="row.tradeMethods" placeholder="请选择" style="width: 100%">
- <el-option v-for="item in tradeMethods" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="包装方式" width="180">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.packMethod'" :rules="rules.packMethod" :inline-message="true" class="shrinkPadding">
- <el-input v-model="row.packMethod" placeholder="请输入" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="amount" :label="'金额 ( ' + formData.data.currency + ' )'" width="130" />
- <el-table-column label="操作" width="60" align="center" fixed="right">
- <template #default="{ row, $index }">
- <el-button type="primary" link @click="handleRemove($index, row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #file>
- <div style="width: 100%">
- <el-upload
- v-model:fileList="formData.data.fileList"
- action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :data="uploadData"
- multiple
- :before-upload="uploadFile"
- :on-success="handleSuccess"
- :on-preview="onPreviewFile">
- <el-button type="primary" plain>选择</el-button>
- </el-upload>
- </div>
- </template>
- <template #otherCharge>
- <div style="width: 100%">
- <el-button type="primary" @click="clickAdd()">添加行</el-button>
- <el-table :data="formData.data.contractProjectList" style="width: 100%; margin-top: 16px">
- <el-table-column label="收费项目" width="220">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
- <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50" placeholder="请输入收费项目" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="备注">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProjectList.' + $index + '.remark'">
- <el-input v-model="row.remark" placeholder="请输入备注" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column :label="'金额 ( ' + formData.data.currency + ' )'" width="130">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true" class="shrinkPadding">
- <el-input-number
- v-model="row.amount"
- placeholder="请输入金额"
- style="width: 100%"
- :precision="2"
- :controls="false"
- :min="0"
- @change="totalAmount()" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="60" align="center" fixed="right">
- <template #default="{ $index }">
- <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #offerMoney>
- <div style="width: 100%; display: flex">
- <div style="width: calc(100% - 190px)"></div>
- <div style="width: 130px; padding: 0 12px">
- <el-form-item label="合同总金额" prop="amount" class="shrinkPadding">
- <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
- </el-form-item>
- </div>
- </div>
- </template>
- <template #shipment>
- <div style="width: 100%">
- <el-table :data="formData.data.contractShipmentList" style="width: 100%; margin-top: 16px">
- <el-table-column prop="code" label="商品编码" width="120" />
- <el-table-column prop="productName" label="商品名称" />
- <el-table-column label="出货日期" width="220">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractShipmentList.' + $index + '.shipmentTime'" :rules="rules.shipmentTime" :inline-message="true">
- <el-date-picker v-model="row.shipmentTime" type="date" placeholder="请选择出货日期" value-format="YYYY-MM-DD" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="数量" width="160">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractShipmentList.' + $index + '.quantity'" :inline-message="true">
- <el-input-number
- v-model="row.quantity"
- placeholder="请输入数量"
- style="width: 100%"
- :precision="0"
- :controls="false"
- :min="0"
- @change="calculationAmount()" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作" width="120" fixed="right">
- <template #default="{ row, $index }">
- <el-button type="primary" link @click="clickSplit(row)">拆分</el-button>
- <el-button type="primary" link @click="clickDelete($index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </byForm>
- <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="公司产品库" width="90%" append-to-body>
- <CompanyProduct :selectStatus="true" @selectProduct="selectProduct"></CompanyProduct>
- </el-dialog>
- <el-dialog v-if="openProductCustomer" v-model="openProductCustomer" title="客户产品库" width="90%" append-to-body>
- <CustomerProduct :selectStatus="true" :buyCorporationId="formData.data.buyCorporationId" @selectProduct="selectProduct"></CustomerProduct>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byForm from "@/components/byForm/index";
- import CompanyProduct from "@/views/EHSD/productLibrary/companyProduct/index";
- import CustomerProduct from "@/views/EHSD/productLibrary/customerProduct/index";
- import { ElMessage } from "element-plus";
- const { proxy } = getCurrentInstance();
- const innerMethod = ref([]);
- const outsideMethod = ref([]);
- const accountCurrency = ref([]);
- const fundsPaymentMethod = ref([]);
- const tradeMethods = ref([]);
- const shippingMethod = ref([]);
- const templateList = ref([]);
- const corporationList = ref([]);
- const customerList = ref([]);
- const accountList = ref([]);
- const countryData = ref([]);
- const provinceData = ref([]);
- const cityData = ref([]);
- const customerUserList = ref([]);
- const openProductCompany = ref(false);
- const openProductCustomer = ref(false);
- const activeName = ref("");
- const formData = reactive({
- data: {
- currency: "¥",
- amount: undefined,
- contractProductList: [],
- contractProjectList: [],
- fileList: [],
- contractShipmentList: [],
- },
- });
- const submit = ref(null);
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const uploadData = ref({});
- const formConfig = computed(() => {
- return [
- {
- label: "合同模板",
- },
- {
- type: "select",
- label: "选择合同模板",
- prop: "contractTemplateId",
- data: templateList.value,
- fn: (val) => {
- changeTemplate(val);
- },
- },
- {
- type: "slot",
- slotName: "seller",
- label: "卖方信息",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "buyer",
- label: "买方信息",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "payment",
- label: "付款信息",
- },
- {
- type: "slot",
- slotName: "delivery",
- label: "交付信息",
- },
- {
- type: "slot",
- slotName: "commodity",
- label: "商品信息",
- },
- {
- type: "slot",
- prop: "file",
- slotName: "file",
- label: "交接单",
- },
- {
- type: "slot",
- slotName: "otherCharge",
- label: "其他收费项目",
- },
- {
- type: "slot",
- slotName: "offerMoney",
- },
- {
- type: "slot",
- slotName: "shipment",
- label: "出货计划",
- },
- ];
- });
- const rules = ref({
- contractTemplateId: [{ required: true, message: "请选择合同模板", trigger: "change" }],
- buyCorporationId: [{ required: true, message: "请选择公司", trigger: "change" }],
- buyCountryId: [{ required: true, message: "请选择国家", trigger: "change" }],
- buyProvinceId: [{ required: true, message: "请选择省/州", trigger: "change" }],
- buyCityId: [{ required: true, message: "请选择城市", trigger: "change" }],
- // buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
- buyContactName: [{ required: true, message: "请输入联系人", trigger: ["change", "blur"] }],
- buyContactNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
- productName: [{ required: true, message: "请输入商品名称", trigger: "blur" }],
- productModel: [{ required: true, message: "请输入尺寸 cm*cm*cm", trigger: "blur" }],
- quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
- price: [{ required: true, message: "请输入单价", trigger: "blur" }],
- packMethod: [{ required: true, message: "请输入包装方式", trigger: "blur" }],
- amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
- payName: [{ required: true, message: "请输入收费项目", trigger: ["change", "blur"] }],
- currency: [{ required: true, message: "请选择币种", trigger: "change" }],
- effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
- deliveryTime: [{ required: true, message: "请选择交货期限", trigger: "change" }],
- paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
- advanceRatio: [{ required: true, message: "请输入预付比例", trigger: "blur" }],
- shroffAccountId: [{ required: true, message: "请选择收款账号", trigger: "change" }],
- tradeMethods: [{ required: true, message: "请选择贸易方式", trigger: "change" }],
- transportMethod: [{ required: true, message: "请选择运输方式", trigger: "change" }],
- transportRemark: [{ required: true, message: "请输入运输说明", trigger: "blur" }],
- remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
- });
- const getDict = () => {
- proxy
- .getDictOne([
- "inner_packaging_method_ehsd",
- "outside_packaging_method_ehsd",
- "account_currency",
- "funds_payment_method",
- "trade_methods",
- "shipping_method",
- ])
- .then((res) => {
- innerMethod.value = res["inner_packaging_method_ehsd"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- outsideMethod.value = res["outside_packaging_method_ehsd"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- accountCurrency.value = res["account_currency"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- tradeMethods.value = res["trade_methods"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- shippingMethod.value = res["shipping_method"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- });
- proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- templateList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.templateName,
- 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.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- customerList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.name,
- value: item.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,
- };
- });
- });
- };
- getDict();
- const changeTemplate = (val) => {
- if (val) {
- proxy.post("/contractTemplate/detail", { id: val }).then(
- (res) => {
- proxy.post("/areaInfo/list", { parentId: "0" }).then((resCountry) => {
- let sellCountryData = resCountry.filter((item) => item.id === res.countryId);
- if (sellCountryData && sellCountryData.length > 0) {
- formData.data.sellCountryId = sellCountryData[0].chineseName;
- } else {
- formData.data.sellCountryId = "";
- }
- });
- if (res.countryId) {
- proxy.post("/areaInfo/list", { parentId: res.countryId }).then((resProvince) => {
- let sellProvinceData = resProvince.filter((item) => item.id === res.provinceId);
- if (sellProvinceData && sellProvinceData.length > 0) {
- formData.data.sellProvinceId = sellProvinceData[0].name;
- } else {
- formData.data.sellProvinceId = "";
- }
- });
- } else {
- formData.data.sellProvinceId = "";
- }
- if (res.provinceId) {
- proxy.post("/areaInfo/list", { parentId: res.provinceId }).then((resCity) => {
- let sellCityData = resCity.filter((item) => item.id === res.cityId);
- if (sellCityData && sellCityData.length > 0) {
- formData.data.sellCityId = sellCityData[0].name;
- } else {
- formData.data.sellCityId = "";
- }
- });
- } else {
- formData.data.sellCityId = "";
- }
- formData.data.sellCorporationId = res.corporationId;
- formData.data.sellContactName = res.contactName;
- formData.data.sellContactNumber = res.contactNumber;
- formData.data.sellAddress = res.address;
- },
- (err) => {
- console.log(err);
- formData.data.sellCorporationId = "";
- formData.data.sellContactName = "";
- formData.data.sellContactNumber = "";
- formData.data.sellCountryId = "";
- formData.data.sellProvinceId = "";
- formData.data.sellCityId = "";
- formData.data.sellAddress = "";
- }
- );
- } else {
- formData.data.sellCorporationId = "";
- formData.data.sellContactName = "";
- formData.data.sellContactNumber = "";
- formData.data.sellCountryId = "";
- formData.data.sellProvinceId = "";
- formData.data.sellCityId = "";
- formData.data.sellAddress = "";
- }
- };
- const getCityData = (id, type, isChange) => {
- proxy.post("/areaInfo/list", { parentId: id }).then((res) => {
- if (type === "20") {
- provinceData.value = res;
- if (isChange) {
- formData.data.customerState = "";
- formData.data.customerCityId = "";
- }
- } else if (type === "30") {
- cityData.value = res;
- if (isChange) {
- formData.data.customerCityId = "";
- }
- } else {
- countryData.value = res;
- }
- });
- };
- getCityData("0");
- const changeCustomer = (val) => {
- formData.data.contractProductList = [];
- formData.data.customerName = "";
- formData.data.customerTel = "";
- if (val) {
- proxy.post("/customer/detail", { id: val }).then(
- (res) => {
- if (res.customerUserList && res.customerUserList.length > 0) {
- formData.data.buyContactName = res.customerUserList[0].name;
- formData.data.buyContactNumber = res.customerUserList[0].phone;
- customerUserList.value = res.customerUserList.map((item) => {
- return {
- ...item,
- value: item.name,
- };
- });
- }
- formData.data.buyCountryId = res.countryId;
- formData.data.buyProvinceId = res.provinceId;
- formData.data.buyCityId = res.cityId;
- formData.data.buyPostalCode = res.zipCode;
- formData.data.buyAddress = res.address;
- getCityData(formData.data.buyCountryId, "20");
- getCityData(formData.data.buyProvinceId, "30");
- },
- (err) => {
- console.log(err);
- formData.data.buyCountryId = "";
- formData.data.buyProvinceId = "";
- formData.data.buyCityId = "";
- formData.data.buyPostalCode = "";
- formData.data.buyAddress = "";
- }
- );
- } else {
- formData.data.buyCountryId = "";
- formData.data.buyProvinceId = "";
- formData.data.buyCityId = "";
- formData.data.buyPostalCode = "";
- formData.data.buyAddress = "";
- }
- };
- const createFilter = (queryString) => {
- return (restaurant) => {
- return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
- };
- };
- const querySearchPerson = (queryString, callback) => {
- const results = queryString ? customerUserList.value.filter(createFilter(queryString)) : customerUserList.value;
- callback(results);
- };
- const handlePerson = (item) => {
- formData.data.customerTel = item.phone;
- };
- const selectProduct = (goods) => {
- if (goods && goods.id) {
- let data = formData.data.contractProductList.filter((item) => item.productId === goods.id);
- if (data && data.length > 0) {
- return ElMessage("该产品已添加");
- }
- let fileUrl = "";
- if (goods.fileList && goods.fileList.length > 0) {
- fileUrl = goods.fileList[0].fileUrl;
- }
- let packMethod = "";
- if (goods.innerPackMethod) {
- let innerPackMethod = goods.innerPackMethod.split(",");
- innerPackMethod.map((item) => {
- if (packMethod) {
- packMethod = packMethod + "," + proxy.dictValueLabel(item, innerMethod.value);
- } else {
- packMethod = proxy.dictValueLabel(item, innerMethod.value);
- }
- });
- }
- if (goods.outerPackMethod) {
- let outerPackMethod = goods.outerPackMethod.split(",");
- outerPackMethod.map((item) => {
- if (packMethod) {
- packMethod = packMethod + "," + proxy.dictValueLabel(item, outsideMethod.value);
- } else {
- packMethod = proxy.dictValueLabel(item, outsideMethod.value);
- }
- });
- }
- if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
- formData.data.contractProductList.push({
- fileUrl: fileUrl,
- productId: goods.id,
- productName: goods.name,
- productModel: goods.productLong + "*" + goods.productWide + "*" + goods.productHigh,
- quantity: undefined,
- price: undefined,
- amount: "",
- tradeMethods: "",
- packMethod: packMethod,
- });
- } else {
- formData.data.contractProductList = [
- {
- fileUrl: fileUrl,
- productId: goods.id,
- productName: goods.name,
- productModel: goods.productLong + "*" + goods.productWide + "*" + goods.productHigh,
- quantity: undefined,
- price: undefined,
- amount: "",
- tradeMethods: "",
- packMethod: packMethod,
- },
- ];
- }
- formData.data.contractShipmentList.push({
- code: goods.code,
- productId: goods.id,
- productName: goods.name,
- shipmentTime: "",
- quantity: undefined,
- });
- ElMessage({
- message: "添加成功!",
- type: "success",
- });
- } else {
- return ElMessage("选择错误");
- }
- };
- const onPicture = (path) => {
- window.open(path, "_blank");
- };
- const handleRemove = async (index, row) => {
- formData.data.contractShipmentList = formData.data.contractShipmentList.filter((item) => item.productId !== row.productId);
- await formData.data.contractProductList.splice(index, 1);
- totalAmount();
- };
- const calculationAmount = () => {
- nextTick(() => {
- if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- let money = 0;
- if (formData.data.contractProductList[i].quantity && formData.data.contractProductList[i].price) {
- money = parseFloat(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price)).toFixed(2);
- }
- formData.data.contractProductList[i].amount = money;
- }
- }
- nextTick(() => {
- totalAmount();
- });
- });
- };
- const totalAmount = () => {
- let money = 0;
- if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- if (formData.data.contractProductList[i].amount) {
- money = parseFloat(Number(money) + Number(formData.data.contractProductList[i].amount)).toFixed(2);
- }
- }
- }
- if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
- for (let i = 0; i < formData.data.contractProjectList.length; i++) {
- if (formData.data.contractProjectList[i].amount) {
- money = parseFloat(Number(money) + Number(formData.data.contractProjectList[i].amount)).toFixed(2);
- }
- }
- }
- formData.data.amount = money;
- };
- const clickAdd = () => {
- if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
- formData.data.contractProjectList.push({
- payName: "",
- amount: undefined,
- remark: "",
- });
- } else {
- formData.data.contractProjectList = [{ payName: "", amount: undefined, remark: "" }];
- }
- };
- const handleDelete = async (index) => {
- await formData.data.contractProjectList.splice(index, 1);
- totalAmount();
- };
- const querySearch = (queryString, callback) => {
- proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- res.rows = res.rows.map((item) => {
- return {
- ...item,
- value: item.payName,
- };
- });
- callback(res.rows);
- } else {
- callback([]);
- }
- });
- };
- const handleSubmit = async () => {
- let status = await submit.value.handleSubmit(() => {});
- if (status) {
- if (!(formData.data.contractProductList && formData.data.contractProductList.length > 0)) {
- ElMessage("请添加至少一件商品");
- return false;
- }
- if (!(formData.data.fileList && formData.data.fileList.length > 0)) {
- ElMessage("请上传交接单");
- return false;
- }
- for (let i = 0; i < formData.data.fileList.length; i++) {
- if (formData.data.fileList[i].raw.uploadState) {
- ElMessage("文件上传中,请稍后提交");
- return false;
- }
- }
- if (formData.data.contractShipmentList && formData.data.contractShipmentList.length > 0) {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- let data = formData.data.contractShipmentList.filter((item) => item.productId === formData.data.contractProductList[i].productId);
- if (data && data.length > 0) {
- let quantity = 0;
- for (let j = 0; j < data.length; j++) {
- quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
- }
- if (quantity > formData.data.contractProductList[i].quantity) {
- ElMessage("出货数量不能大于商品数量");
- return false;
- }
- }
- }
- }
- return true;
- } else {
- setTimeout(() => {
- const errorDiv = document.getElementsByClassName("is-error");
- errorDiv[0].scrollIntoView();
- }, 0);
- }
- return status;
- };
- // 接收父组件的传值
- const props = defineProps({
- queryData: Object,
- });
- const clickCustomerProduct = () => {
- if (!formData.data.buyCorporationId) {
- return ElMessage("请先选择客户");
- }
- openProductCustomer.value = true;
- };
- // 向父组件暴露
- defineExpose({
- submitData: formData.data,
- handleSubmit,
- });
- const changeShroffAccount = (val) => {
- if (val) {
- let data = accountList.value.filter((item) => item.value === val);
- if (data && data.length > 0) {
- formData.data.beneficiaryName = data[0].beneficiaryName;
- formData.data.beneficiaryBank = data[0].beneficiaryBank;
- formData.data.beneficiaryBankAddress = data[0].beneficiaryBankAddress;
- formData.data.beneficiaryAccountNumber = data[0].beneficiaryAccountNumber;
- formData.data.swiftCode = data[0].swiftCode;
- formData.data.beneficiaryAddress = data[0].beneficiaryAddress;
- }
- }
- };
- const changeActiveName = () => {
- if (activeName.value) {
- activeName.value = "";
- } else {
- activeName.value = "1";
- }
- };
- const uploadFile = async (file) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- uploadData.value = res.uploadBody;
- file.id = res.id;
- file.fileName = res.fileName;
- file.fileUrl = res.fileUrl;
- file.uploadState = true;
- return true;
- };
- const handleSuccess = (any, UploadFile) => {
- UploadFile.raw.uploadState = false;
- };
- const onPreviewFile = (file) => {
- window.open(file.raw.fileUrl, "_blank");
- };
- const clickSplit = (item) => {
- formData.data.contractShipmentList.push({
- code: item.code,
- productId: item.productId,
- productName: item.productName,
- shipmentTime: "",
- quantity: undefined,
- });
- };
- const clickDelete = (index) => {
- formData.data.contractShipmentList.splice(index, 1);
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- .pic {
- object-fit: contain;
- width: 50px;
- height: 50px;
- cursor: pointer;
- vertical-align: middle;
- }
- .shrinkPadding {
- padding-right: 0 !important;
- }
- .hideCollapse {
- margin-top: -62px;
- border: 0 !important;
- }
- ::v-deep(.el-collapse-item__arrow) {
- display: none !important;
- }
- ::v-deep(.el-collapse-item__wrap) {
- border: 0 !important;
- }
- ::v-deep(.el-collapse-item__header) {
- border: 0 !important;
- }
- </style>
|