12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370 |
- <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="sellCountryName">
- <el-input v-model="formData.data.sellCountryName" placeholder="请输入国家" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label=" " prop="sellProvinceName">
- <el-input v-model="formData.data.sellProvinceName" placeholder="请输入省/州" />
- </el-form-item>
- </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-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" filterable 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="countryId">
- <el-select v-model="formData.data.countryId" placeholder="国家" filterable @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="provinceName">
- <selectCity
- placeholder="省/洲"
- @change="(val) => getCityData(val, '30', true)"
- addressId="provinceId"
- addressName="provinceName"
- v-model="formData.data"
- :data="provinceData">
- </selectCity>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label=" " prop="cityName">
- <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="formData.data" :data="cityData"> </selectCity>
- </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 #commodity>
- <div style="width: 100%">
- <el-button @click="openProduct = true">添加商品</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 prop="code" label="商品编码" width="120" />
- <el-table-column prop="name" label="商品中文名" width="160" />
- <el-table-column label="商品英文名" min-width="200">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.productName'" :rules="rules.productName" :inline-message="true">
- <el-input v-model="row.productName" placeholder="请输入商品英文名" />
- </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 + '.productModel'" :inline-message="true">
- <el-input v-model="row.productModel" placeholder="请输入规格型号" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="unit" label="单位" width="100" :formatter="(row) => dictValueLabel(row.unit, productUnit)" />
- <el-table-column label="数量" width="150">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
- <el-input-number
- onmousewheel="return false;"
- 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="160">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true">
- <el-input-number
- onmousewheel="return false;"
- 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 prop="amount" label="金额" width="100" />
- <el-table-column align="center" label="操作" width="120" fixed="right">
- <template #default="{ row, $index }">
- <el-button type="primary" link @click="handleHandover(row, $index)">交接单</el-button>
- <el-button type="primary" link @click="handleRemove($index, row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </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="金额" width="180">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true">
- <el-input-number
- onmousewheel="return false;"
- 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="备注">
- <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 align="center" label="操作" width="80" fixed="right">
- <template #default="{ row, $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%">
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="4">
- <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="amount">
- <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
- </el-form-item>
- </el-col>
- <!-- <el-col :span="4">
- <el-form-item label="报价有效期 (天)" prop="effective">
- <el-input-number onmousewheel="return false;"
- v-model="formData.data.effective"
- placeholder="请输入有效期"
- style="width: 100%"
- :precision="0"
- :controls="false"
- :min="0"
- />
- </el-form-item>
- </el-col> -->
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="7">
- <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="7">
- <el-form-item label="预付比例 (%)" prop="advanceRatio">
- <el-input-number
- onmousewheel="return false;"
- v-model="formData.data.advanceRatio"
- placeholder="请输入预付比例"
- style="width: 100%"
- :precision="2"
- :controls="false"
- :min="0"
- :max="100" />
- </el-form-item>
- </el-col>
- <el-col :span="7">
- <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="3">
- <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="7">
- <el-form-item label="贸易方式" prop="tradeMethods">
- <el-select v-model="formData.data.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>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="7">
- <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="7">
- <el-form-item label="运输说明" prop="transportRemark">
- <el-input v-model="formData.data.transportRemark" placeholder="请输入运输说明" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="14">
- <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="7">
- <el-form-item label="交货期限 (天)" prop="deliveryTime">
- <!-- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" /> -->
- <el-input-number
- onmousewheel="return false;"
- v-model="formData.data.deliveryTime"
- placeholder="请输入交货期限"
- style="width: 100%"
- :precision="0"
- :controls="false"
- :min="0" />
- </el-form-item>
- </el-col>
- <el-col :span="7">
- <el-form-item label="质保期 (天)" prop="warranty">
- <el-input-number
- onmousewheel="return false;"
- v-model="formData.data.warranty"
- placeholder="请输入质保期"
- style="width: 100%"
- :precision="0"
- :controls="false"
- :min="0" />
- </el-form-item>
- </el-col>
- </el-row>
- </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
- onmousewheel="return false;"
- 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="openProduct" v-model="openProduct" title="选择商品" width="70%" append-to-body>
- <SelectGoods :selectList="acquireSelectList()" @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
- </el-dialog>
- <el-dialog title="交接单" v-if="openHandover" v-model="openHandover" width="800">
- <byForm :formConfig="formHandoverConfig" :formOption="formOption" v-model="productRow.data">
- <template #remark>
- <div style="width: 100%">
- <Editor :value="productRow.data.remark" @updateValue="updateContent" />
- </div>
- </template>
- <template #file>
- <div style="width: 100%">
- <el-upload
- v-model:fileList="fileList"
- action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :data="uploadData"
- multiple
- :before-upload="uploadFile"
- :on-success="handleSuccess"
- :on-preview="onPreviewFile">
- <el-button>选择</el-button>
- </el-upload>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openHandover = false" size="large">取 消</el-button>
- <el-button type="primary" @click="submitHandoverForm()" size="large">确 定</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byForm from "@/components/byForm/index";
- import SelectGoods from "@/components/product/SelectGoods";
- import { ElMessage } from "element-plus";
- import Editor from "@/components/Editor/index.vue";
- import selectCity from "@/components/selectCity/index.vue";
- import { useRoute } from "vue-router";
- const route = useRoute();
- // 接收父组件的传值
- const props = defineProps({
- queryData: String,
- });
- const { proxy } = getCurrentInstance();
- const contractType = ref([]);
- const accountCurrency = ref([]);
- const fundsPaymentMethod = ref([]);
- const tradeMethods = ref([]);
- const shippingMethod = ref([]);
- const templateList = ref([]);
- const corporationList = ref([]);
- const customerList = ref([]);
- const countryData = ref([]);
- const provinceData = ref([]);
- const cityData = ref([]);
- const customerUserList = ref([]);
- const accountList = ref([]);
- const productUnit = ref([]);
- const openProduct = ref(false);
- const activeName = ref("");
- const formData = reactive({
- data: {
- contractType: "1",
- amount: undefined,
- contractProductList: [],
- contractProjectList: [],
- contractShipmentList: [],
- },
- });
- const submit = ref(null);
- const judgeStatus = () => {
- if (props.queryData.recordList && props.queryData.recordList.length > 0) {
- let data = props.queryData.recordList.filter((item) => item.status === 2 && item.nodeType !== 1);
- if (data && data.length > 0) {
- return true;
- }
- }
- return false;
- };
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- disabled: false,
- });
- const formConfig = computed(() => {
- return [
- {
- type: "title",
- title: "合同模板",
- label: "",
- },
- {
- type: "select",
- label: "合同类型",
- prop: "contractType",
- data: contractType.value,
- itemWidth: 25,
- },
- {
- type: "select",
- label: "选择合同模板",
- prop: "contractTemplateId",
- data: templateList.value,
- fn: (val) => {
- changeTemplate(val);
- },
- itemWidth: 26,
- },
- {
- type: "slot",
- slotName: "seller",
- label: "卖方信息",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "buyer",
- label: "买方信息",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "commodity",
- label: "商品信息",
- },
- {
- type: "slot",
- slotName: "otherCharge",
- label: "其他收费项目",
- },
- {
- type: "slot",
- slotName: "offerMoney",
- label: "收款信息",
- },
- {
- type: "slot",
- slotName: "delivery",
- label: "交付信息",
- },
- {
- type: "slot",
- slotName: "shipment",
- label: "出货计划",
- },
- ];
- });
- const rules = ref({
- contractType: [{ required: true, message: "请选择合同类型", trigger: "change" }],
- contractTemplateId: [{ required: true, message: "请选择合同模板", trigger: "change" }],
- buyCorporationId: [{ required: true, message: "请选择公司", trigger: "change" }],
- countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
- sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
- 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: "请输入规格型号", trigger: "blur" }],
- quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
- price: [{ 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: "blur" }],
- 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(["account_currency", "funds_payment_method", "trade_mode", "shipping_method", "contract_type", "unit"]).then((res) => {
- 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_mode"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- shippingMethod.value = res["shipping_method"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- contractType.value = res["contract_type"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- productUnit.value = res["unit"].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) => {
- formData.data.sellCorporationId = "";
- formData.data.sellContactName = "";
- formData.data.sellContactNumber = "";
- formData.data.sellCountryName = "";
- formData.data.sellProvinceName = "";
- formData.data.sellCityName = "";
- formData.data.sellAddress = "";
- if (val) {
- proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
- formData.data.sellCorporationId = res.corporationId;
- if (res.corporationId) {
- proxy.post("/corporation/detail", { id: res.corporationId }).then((detailCorporation) => {
- if (detailCorporation.countryEnStr) {
- formData.data.sellCountryName = detailCorporation.countryEnStr;
- }
- if (res.provinceEnStr) {
- formData.data.sellProvinceName = detailCorporation.provinceEnStr;
- }
- if (res.cityEnStr) {
- formData.data.sellCityName = detailCorporation.cityEnStr;
- }
- if (detailCorporation.countryEnStr) {
- formData.data.sellCountryName = detailCorporation.countryEnStr;
- } else {
- proxy.post("/customizeArea/list", { parentId: "0" }).then((resCountry) => {
- let sellCountryData = resCountry.filter((item) => item.id === detailCorporation.countryId);
- if (sellCountryData && sellCountryData.length > 0) {
- formData.data.sellCountryName = sellCountryData[0].chineseName;
- } else {
- formData.data.sellCountryName = "";
- }
- });
- }
- if (detailCorporation.provinceEnStr) {
- formData.data.sellProvinceName = detailCorporation.provinceEnStr;
- } else if (detailCorporation.countryId) {
- proxy
- .post("/customizeArea/list", {
- parentId: detailCorporation.countryId,
- })
- .then((resProvince) => {
- let sellProvinceData = resProvince.filter((item) => item.id === detailCorporation.provinceId);
- if (sellProvinceData && sellProvinceData.length > 0) {
- formData.data.sellProvinceName = sellProvinceData[0].name;
- } else {
- formData.data.sellProvinceName = "";
- }
- });
- } else {
- formData.data.sellProvinceName = "";
- }
- if (detailCorporation.cityEnStr) {
- formData.data.sellCityName = detailCorporation.cityEnStr;
- } else if (detailCorporation.provinceId) {
- proxy
- .post("/customizeArea/list", {
- parentId: detailCorporation.provinceId,
- })
- .then((resCity) => {
- let sellCityData = resCity.filter((item) => item.id === detailCorporation.cityId);
- if (sellCityData && sellCityData.length > 0) {
- formData.data.sellCityName = sellCityData[0].name;
- } else {
- formData.data.sellCityName = "";
- }
- });
- } else {
- formData.data.sellCityName = "";
- }
- if (detailCorporation.addressEn) {
- formData.data.sellAddress = detailCorporation.addressEn;
- } else {
- formData.data.sellAddress = detailCorporation.address;
- }
- if (detailCorporation.cityEnStr) {
- formData.data.sellCityName = detailCorporation.cityEnStr;
- }
- if (detailCorporation.addressEn) {
- formData.data.sellAddress = detailCorporation.addressEn;
- }
- // proxy.post("/customizeArea/list", { parentId: "0" }).then((resCountry) => {
- // let sellCountryData = resCountry.filter((item) => item.id === detailCorporation.countryId);
- // if (sellCountryData && sellCountryData.length > 0) {
- // formData.data.sellCountryName = sellCountryData[0].chineseName;
- // } else {
- // formData.data.sellCountryName = "";
- // }
- // });
- // if (detailCorporation.countryId) {
- // proxy
- // .post("/customizeArea/list", {
- // parentId: detailCorporation.countryId,
- // })
- // .then((resProvince) => {
- // let sellProvinceData = resProvince.filter((item) => item.id === detailCorporation.provinceId);
- // if (sellProvinceData && sellProvinceData.length > 0) {
- // formData.data.sellProvinceName = sellProvinceData[0].name;
- // } else {
- // formData.data.sellProvinceName = "";
- // }
- // });
- // } else {
- // formData.data.sellProvinceName = "";
- // }
- // if (detailCorporation.provinceId) {
- // proxy
- // .post("/customizeArea/list", {
- // parentId: detailCorporation.provinceId,
- // })
- // .then((resCity) => {
- // let sellCityData = resCity.filter((item) => item.id === detailCorporation.cityId);
- // if (sellCityData && sellCityData.length > 0) {
- // formData.data.sellCityName = sellCityData[0].name;
- // } else {
- // formData.data.sellCityName = "";
- // }
- // });
- // } else {
- // formData.data.sellCityName = "";
- // }
- // formData.data.sellAddress = detailCorporation.address;
- });
- }
- formData.data.sellContactName = res.contactName;
- formData.data.sellContactNumber = res.contactNumber;
- });
- }
- };
- const getCityData = (id, type, isChange) => {
- proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
- if (type === "20") {
- provinceData.value = res;
- if (isChange) {
- formData.data.provinceId = "";
- formData.data.provinceName = "";
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else if (type === "30") {
- cityData.value = res;
- if (isChange) {
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else {
- countryData.value = res;
- }
- });
- };
- getCityData("0");
- const changeCustomer = (val) => {
- formData.data.buyContactName = "";
- formData.data.buyContactNumber = "";
- if (val) {
- proxy.post("/customer/detail", { id: val }).then(
- (res) => {
- if (res.customerUserList && res.customerUserList.length > 0) {
- formData.data.buyContactName = res.customerUserList[0].name;
- if (res.customerUserList[0].contactJson) {
- let contactJson = JSON.parse(res.customerUserList[0].contactJson);
- if (contactJson && contactJson.length > 0) {
- formData.data.buyContactNumber = contactJson[0].contactNo;
- }
- }
- customerUserList.value = res.customerUserList.map((item) => {
- return {
- ...item,
- value: item.name,
- };
- });
- }
- formData.data.countryId = res.countryId;
- formData.data.provinceId = res.provinceId;
- formData.data.cityId = res.cityId;
- formData.data.buyPostalCode = res.zipCode;
- formData.data.buyAddress = res.address;
- getCityData(formData.data.countryId, "20");
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- },
- (err) => {
- console.log(err);
- formData.data.countryId = "";
- formData.data.provinceId = "";
- formData.data.cityId = "";
- formData.data.buyPostalCode = "";
- formData.data.buyAddress = "";
- }
- );
- } else {
- formData.data.countryId = "";
- formData.data.provinceId = "";
- formData.data.cityId = "";
- formData.data.buyPostalCode = "";
- formData.data.buyAddress = "";
- }
- getDecisionAids();
- };
- let auxiliaryData = ref([
- {
- label: "最近合同",
- data: [],
- },
- {
- label: "产品价格",
- data: [],
- },
- ]);
- const emit = defineEmits(["auxiliaryChange"]);
- const getDecisionAids = () => {
- let data = {
- buyCorporationId: formData.data.buyCorporationId,
- productIdList: [],
- };
- if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
- data.productIdList = formData.data.contractProductList.map((item) => item.productId);
- }
- proxy.post("/contract/decisionAid", data).then((res) => {
- if (res.lastContractList && res.lastContractList.length > 0) {
- auxiliaryData.value[0].data = res.lastContractList.map((item) => {
- return [
- {
- label: "合同编号",
- value: item.code,
- style: {
- color: "#0084FF",
- },
- id: item.id,
- num: 1,
- // fn: () => {},
- },
- {
- label: "下单日期",
- value: item.createTime,
- id: item.id,
- num: 1,
- },
- {
- label: "合同金额",
- value: item.currency + item.amount,
- id: item.id,
- num: 1,
- },
- ];
- });
- } else {
- auxiliaryData.value[0].data = [];
- }
- if (res.productPriceList && res.productPriceList.length > 0) {
- auxiliaryData.value[1].data = res.productPriceList.map((item) => {
- return [
- {
- label: "产品名称",
- value: item.name,
- id: item.id,
- num: 1,
- },
- {
- label: "最近价格",
- value: item.lastPrice,
- id: item.id,
- num: 1,
- },
- {
- label: "历史最高",
- value: item.maxPrice,
- id: item.id,
- num: 1,
- },
- {
- label: "历史最低",
- value: item.minPrice,
- id: item.id,
- num: 1,
- },
- ];
- });
- } else {
- auxiliaryData.value[1].data = [];
- }
- emit("auxiliaryChange", auxiliaryData.value);
- });
- };
- 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.buyContactNumber = item.phone;
- };
- const pushGoods = (goods) => {
- if (goods && goods.length > 0) {
- let afterFiltering = [];
- if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
- afterFiltering = goods.filter((item) => {
- let data = formData.data.contractProductList.filter((itemProduct) => itemProduct.productId === item.id);
- if (data && data.length > 0) {
- return false;
- }
- return true;
- });
- } else {
- afterFiltering = goods;
- }
- formData.data.contractProductList = formData.data.contractProductList.concat(
- afterFiltering.map((item) => {
- let fileUrl = "";
- if (item.fileList && item.fileList.length > 0) {
- fileUrl = item.fileList[0].fileUrl;
- }
- let name = item.name;
- if (item.standardJson) {
- let standardJson = JSON.parse(item.standardJson);
- if (standardJson && standardJson.englishName) {
- name = standardJson.englishName;
- }
- }
- return {
- fileUrl: fileUrl,
- code: item.code,
- productId: item.id,
- name: item.name,
- productName: name,
- productModel: item.spec,
- unit: item.unit,
- quantity: undefined,
- price: undefined,
- amount: "",
- remark: "",
- fileList: [],
- };
- })
- );
- formData.data.contractShipmentList = formData.data.contractShipmentList.concat(
- afterFiltering.map((item) => {
- let name = item.name;
- if (item.standardJson) {
- let standardJson = JSON.parse(item.standardJson);
- if (standardJson && standardJson.englishName) {
- name = standardJson.englishName;
- }
- }
- return {
- code: item.code,
- productId: item.id,
- productName: name,
- shipmentTime: "",
- quantity: undefined,
- };
- })
- );
- ElMessage({
- message: "添加成功!",
- type: "success",
- });
- openProduct.value = false;
- getDecisionAids();
- } else {
- ElMessage("请选择至少一件商品");
- }
- };
- const onPicture = (path) => {
- window.open(path, "_blank");
- };
- const productRow = reactive({
- data: {
- productName: "",
- productModel: "",
- remark: "",
- },
- });
- const productIndex = ref(0);
- const openHandover = ref(false);
- const fileList = ref([]);
- const uploadData = ref({});
- const formHandoverConfig = computed(() => {
- return [
- {
- type: "title",
- title: "产品信息",
- label: "",
- },
- {
- type: "input",
- prop: "productName",
- label: "产品名称",
- itemType: "text",
- disabled: true,
- },
- {
- type: "input",
- prop: "productModel",
- label: "规格型号",
- itemType: "text",
- disabled: true,
- },
- {
- type: "slot",
- slotName: "remark",
- label: "交接单",
- },
- {
- type: "slot",
- prop: "file",
- slotName: "file",
- label: "上传附件",
- },
- ];
- });
- const handleHandover = (row, index) => {
- productRow.data = {
- productName: row.productName,
- productModel: row.productModel,
- remark: row.remark,
- };
- if (row.fileList && row.fileList.length > 0) {
- fileList.value = row.fileList.map((item) => {
- return {
- raw: item,
- name: item.fileName,
- url: item.fileUrl,
- };
- });
- } else {
- fileList.value = [];
- }
- productIndex.value = index;
- openHandover.value = true;
- };
- const updateContent = (val) => {
- productRow.data.remark = val;
- };
- 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 submitHandoverForm = () => {
- if (fileList.value && fileList.value.length > 0) {
- for (let i = 0; i < fileList.value.length; i++) {
- if (fileList.value[i].raw.uploadState) {
- ElMessage("文件上传中,请稍后提交");
- return;
- }
- }
- formData.data.contractProductList[productIndex.value].fileList = fileList.value.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- uploadState: item.raw.uploadState,
- };
- });
- } else {
- formData.data.contractProductList[productIndex.value].fileList = [];
- }
- formData.data.contractProductList[productIndex.value].remark = productRow.data.remark;
- openHandover.value = false;
- };
- 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();
- getDecisionAids();
- };
- 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 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);
- };
- 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.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 false;
- };
- const getFormData = () => {
- return formData.data;
- };
- // 向父组件暴露
- defineExpose({
- getFormData,
- 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;
- }
- }
- };
- watch(
- props.queryData,
- () => {
- formOption.disabled = judgeStatus();
- if (props.queryData && (route.query.processType == 10 || route.query.processType == 20)) {
- for (var text in props.queryData) {
- formData.data[text] = props.queryData[text];
- }
- if (formData.data.countryId) {
- getCityData(formData.data.countryId, "20");
- }
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- }
- },
- {
- deep: true,
- }
- );
- const acquireSelectList = () => {
- let data = [];
- if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
- data = formData.data.contractProductList.map((item) => {
- return {
- id: item.productId,
- name: item.name,
- };
- });
- }
- return data;
- };
- </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>
|