| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458 |
- <template>
- <ele-modal
- custom-class="ele-dialog-form long-dialog-form"
- :centered="true"
- v-if="visible"
- :visible.sync="visible"
- :title="title"
- :close-on-click-modal="false"
- width="70%"
- append-to-body
- destroy-on-close
- @close="cancel"
- :maxable="true"
- :resizable="true"
- >
- <el-form
- ref="form"
- :model="form"
- :rules="rules"
- class="el-form-box"
- label-width="120px"
- >
- <headerTitle title="合同信息"></headerTitle>
- <el-row>
- <el-col :span="8">
- <el-form-item label="合同类型" prop="type">
- <el-select
- v-model="form.type"
- placeholder="请选择"
- style="width: 100%"
- @change="dictChange"
- :disabled="!!contactData?.id || !!businessOpportunityData.id"
- >
- <el-option
- v-for="item in contractBookTypeList"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="来源类型" v-if="form.type">
- <el-select
- v-model="form.sourceType"
- placeholder="请选择"
- style="width: 100%"
- :disabled="!!businessOpportunityData.id"
- clearable
- @change="sourceTypeChange(form.type)"
- >
- <el-option
- v-if="item.parentId == form.type"
- v-for="item in sourceTypeList"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <!-- <el-form-item
- prop="remark"
- label="是否首工序"
- v-if="form.categoryId == '1752993827954225153'"
- >
- <el-radio-group v-model="form.isFirstProcess">
- <el-radio v-for="item in processList" :label="item.value">{{
- item.label
- }}</el-radio>
- </el-radio-group>
- </el-form-item> -->
- <el-form-item
- label="核价单"
- prop="sourceName"
- v-if="form.sourceType == 2"
- >
- <el-input
- clearable
- v-model="form.sourceName"
- @click.native="handInquiry"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- label="报价单"
- prop="sourceName"
- v-if="form.sourceType == 1"
- >
- <el-input
- clearable
- v-model="form.sourceName"
- @click.native="handQuotation"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- label="采购计划"
- prop="sourceName"
- v-if="form.sourceType == 3"
- >
- <el-input
- clearable
- v-model="form.sourceName"
- @click.native="handPlan"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- label="商机名称"
- prop="sourceName"
- v-if="form.sourceType == 4"
- >
- <el-input
- clearable
- :disabled="!!businessOpportunityData.id"
- v-model="form.sourceName"
- @click.native="handOpportunity"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- label="退货单"
- prop="sourceName"
- v-if="form.sourceType == 5"
- >
- <el-input
- clearable
- v-model="form.sourceName"
- @click.native="handReturnOrder"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- label="销售订单"
- prop="sourceName"
- v-if="form.sourceType == 7"
- >
- <el-input
- clearable
- v-model="form.sourceName"
- @click.native="handSaleOrder"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- label="需求类型"
- prop="requireSourceType"
- v-if="form.type == 2"
- style="margin-bottom: 22px"
- >
- <el-select
- v-model="form.requireSourceType"
- placeholder="请选择"
- style="width: 100%"
- v-if="form.type == 2"
- :disabled="!!form.sourceName"
- >
- <el-option
- v-for="item in requirementSourceType"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="需求部门"
- prop="requireDeptId"
- v-if="form.type == 2"
- >
- <ele-tree-select
- clearable
- :data="groupTreeData"
- v-model="form.requireDeptId"
- valueKey="id"
- labelKey="name"
- placeholder="请选择"
- @change="change_principalDep"
- default-expand-all
- />
- </el-form-item>
- <!-- 采购部门/销售部门 -->
- <el-form-item
- :label="form.type == 2 ? '采购部门' : '销售部门'"
- prop="businessDeptId"
- >
- <ele-tree-select
- clearable
- :data="groupTreeData"
- v-model="form.businessDeptId"
- valueKey="id"
- labelKey="name"
- placeholder="请选择"
- @change="changeBusinessDep"
- default-expand-all
- />
- </el-form-item>
- <el-form-item
- :label="form.type == 2 ? '采购员' : '业务员'"
- prop="businessUserId"
- >
- <personSelect
- ref="businessDirectorRef"
- v-model="form.businessUserId"
- @selfChange="businessUserChange"
- :init="false"
- />
- </el-form-item>
- <el-form-item prop="contractFile" label="合同附件">
- <fileMain v-model="form.fileId"></fileMain>
- </el-form-item>
-
- <!-- <el-form-item prop="productionRequirements" label="生产要求">
- <el-input
- clearable
- v-model="form.productionRequirements"
- placeholder="请输入"
- type="textarea"
- />
- </el-form-item> -->
- </el-col>
- <el-col :span="8">
- <el-form-item label="合同分类" prop="categoryId" style="width: 100%">
- <el-select
- v-model="form.categoryId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in categoryList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- @click.native="getListCode()"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="核价清单"
- prop="HJQD"
- v-if="form.sourceType == 2"
- >
- <el-input
- readonly
- v-model="form.HJQD"
- @click.native="handleHJQD"
- ></el-input>
- </el-form-item>
- <el-form-item label="签订日期" prop="contractStartDate">
- <el-date-picker
- v-model="form.contractStartDate"
- @change="setDeliveryDays"
- type="date"
- placeholder="选择日期"
- style="width: 100%"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="结束日期" prop="contractEndDate">
- <el-date-picker
- v-model="form.contractEndDate"
- type="date"
- placeholder="选择日期"
- style="width: 100%"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="合同名称" prop="contractName">
- <el-input
- clearable
- v-model="form.contractName"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="合同编号" prop="contractNumber">
- <el-input
- clearable
- v-model="form.contractNumber"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- label="需求人"
- prop="requireUserId"
- v-if="form.type == 2"
- >
- <personSelect
- ref="directorRef"
- v-model="form.requireUserId"
- @selfChange="salesmanChange"
- :init="false"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="交易方式" prop="transactionMode">
- <el-select
- v-model="form.transactionMode"
- placeholder="请选择"
- @change="transactionModeChange"
- style="width: 100%"
- >
- <el-option
- v-for="item in transactionMethodsOp"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item :label="form.type == 2 ? '收货模式' : '发货模式'" prop="deliveryMode">
- <el-select
- v-model="form.deliveryMode"
- placeholder="请选择"
- @change="deliveryModeChange"
- style="width: 100%"
- >
- <el-option
- v-for="item in shippingModeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="结算方式" prop="settlementMode">
- <DictSelection
- dictName="结算方式"
- clearable
- v-model="form.settlementMode"
- style="width: 100%"
- @itemChange="settlementModeChange"
- >
- </DictSelection>
- </el-form-item>
- <el-form-item v-if="form.settlementMode == 1" label="结算日期范围" prop="settlementDate">
- <!-- <el-date-picker
- v-model="form.contractStartDate"
- @change="setDeliveryDays"
- type="date"
- placeholder="选择日期"
- style="width: 100%"
- >
- </el-date-picker> -->
- <el-date-picker
- style="width: 100%"
- v-model="form.settlementDate"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- @change="settlementDateChange">
- </el-date-picker>
- </el-form-item>
- <el-form-item v-if="form.settlementMode == 2" label="结算月份范围" prop="settlementDate">
- <!-- <el-date-picker
- v-model="form.contractEndDate"
- type="date"
- placeholder="选择日期"
- style="width: 100%"
- >
- </el-date-picker> -->
- <el-date-picker
- v-model="form.settlementDate"
- type="monthrange"
- range-separator="至"
- start-placeholder="开始月份"
- end-placeholder="结束月份"
- value-format="yyyy-MM"
- style="width: 100%"
- @change="settlementDateChange"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item v-if="form.settlementMode == 2" label="收款日期" prop="receiptDate">
- <el-input type="number" :min="1" :max="31" placeholder="请输入" v-model="form.receiptDate" @input="receiptDateChange">
- <template slot="prepend">每月</template>
- <template slot="append">日</template>
- </el-input>
- </el-form-item>
- <el-form-item
- label="期数"
- prop="issueNumber"
- >
- <el-input type="number" :min="1" v-model="form.issueNumber" @input="issueNumberChange">
- <template slot="append">
- <span>期</span>
- </template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <headerTitle title="基本信息"></headerTitle>
- <el-row>
- <el-col :span="12">
- <el-form-item label="甲方名称" prop="partaName">
- <template v-if="form.type == '2'">
- <el-input
- clearable
- v-model="form.partaName"
- placeholder="请输入"
- v-if="enterprisePage.length <= 1"
- />
- <el-select
- v-if="enterprisePage.length > 1"
- style="width: 100%"
- v-model="form.partaName"
- placeholder="请选择"
- @change="getEnterprise(1)"
- >
- <el-option
- v-for="item in enterprisePage"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- >
- </el-option>
- </el-select>
- </template>
- <template v-else>
- <el-input
- clearable
- v-model="form.partaName"
- @click.native="handParent"
- placeholder="请选择"
- :disabled="!!contactData?.id || !!businessOpportunityData.id"
- />
- </template>
- </el-form-item>
- <el-form-item
- label="甲方统一社会信用代码"
- prop="partaUnifiedSocialCreditCode"
- class="form_item_label"
- >
- <el-input
- clearable
- v-model="form.partaUnifiedSocialCreditCode"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="甲方联系人" prop="partaLinkName">
- <template v-if="form.type == '2'">
- <el-input
- clearable
- v-model="form.partaLinkName"
- @click.native="handHead"
- placeholder="请选择"
- />
- </template>
- <template v-else>
- <el-select
- v-model="form.partaLinkName"
- placeholder="请选择"
- @change="onchangeLink"
- style="width: 100%"
- >
- <el-option
- v-for="item in linkNameOptions"
- :key="item.id"
- :label="item.linkName"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- <el-form-item label="甲方电话" prop="partaTel">
- <el-input
- clearable
- :maxlength="20"
- v-model="form.partaTel"
- placeholder="请输入"
- />
- </el-form-item>
- <!-- <el-form-item label="甲方传真" prop="partaFax">
- <el-input clearable v-model="form.partaFax" placeholder="请输入" />
- </el-form-item>
- <el-form-item label=" 甲方Email" prop="partaEmail">
- <el-input
- clearable
- v-model="form.partaEmail"
- placeholder="请输入"
- />
- </el-form-item> -->
- <el-form-item label="甲方开户行" prop="partaBank">
- <el-input clearable v-model="form.partaBank" placeholder="请输入" />
- </el-form-item>
- <el-form-item label=" 甲方银行账号" prop="partaBankAccount">
- <el-input
- clearable
- v-model="form.partaBankAccount"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="甲方地址" prop="partaAddress">
- <el-input
- clearable
- v-model="form.partaAddress"
- placeholder="请输入"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <template v-if="form.type == '2'">
- <el-form-item label="乙方名称" prop="partbName">
- <el-input
- clearable
- v-model="form.partbName"
- @click.native="handSupplier"
- placeholder="请输入"
- />
- </el-form-item>
- </template>
- <template v-else>
- <el-form-item label="乙方名称" prop="partbName">
- <el-input
- clearable
- v-model="form.partbName"
- placeholder="请输入"
- v-if="enterprisePage.length <= 1"
- />
- <el-select
- v-if="enterprisePage.length > 1"
- style="width: 100%"
- v-model="form.partbName"
- placeholder="请选择"
- @change="getEnterprise(1)"
- >
- <el-option
- v-for="item in enterprisePage"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </template>
- <el-form-item
- label="乙方统一社会信用代码"
- prop="partbUnifiedSocialCreditCode"
- class="form_item_label"
- >
- <el-input
- clearable
- v-model="form.partbUnifiedSocialCreditCode"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="乙方联系人" prop="partbLinkName">
- <template v-if="form.type == '2'">
- <el-select
- style="width: 100%"
- v-model="form.partbLinkName"
- placeholder="请选择"
- @change="onchangeLink"
- >
- <el-option
- v-for="item in linkNameOptions"
- :key="item.id"
- :label="item.linkName"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </template>
- <template v-else>
- <el-input
- clearable
- v-model="form.partbLinkName"
- @click.native="handHead"
- placeholder="请输入"
- />
- </template>
- </el-form-item>
- <el-form-item prop="partbTel" label="乙方联系电话">
- <el-input clearable v-model="form.partbTel" placeholder="请输入" />
- </el-form-item>
- <!-- <el-form-item prop="partbFax" label="乙方传真">
- <el-input clearable v-model="form.partbFax" placeholder="请输入" />
- </el-form-item>
- <el-form-item label="乙方Email" prop="partbEmail">
- <el-input
- clearable
- v-model="form.partbEmail"
- placeholder="请输入"
- />
- </el-form-item> -->
- <el-form-item prop="partbBank" label="乙方开户行">
- <el-input clearable v-model="form.partbBank" placeholder="请输入" />
- </el-form-item>
- <el-form-item label="乙方银行账号" prop="partbBankAccount">
- <el-input
- clearable
- v-model="form.partbBankAccount"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="乙方地址" prop="partbAddress">
- <el-input
- clearable
- v-model="form.partbAddress"
- placeholder="请输入"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
- <el-tab-pane label="物品清单" name="1">
- <inventoryTable1
- ref="inventoryTable"
- :contractStartDate="this.form.contractStartDate"
- :isCustomerMark="form.type == '1'"
- :isSupplierMark="form.type == '2'"
- :customerMark="form.customerMark"
- :isDiscountTotalPrice="true"
- :contractBookType="form.type"
- :pricingWay="form.pricingWay"
- :isChangeCount="false"
- @setDiscountTotalPrice="setDiscountTotalPrice"
- :isTemporary="true"
- :isSalesRecord="form.type"
- :cacheKeyUrl="cacheKeyUrl"
- :isArrivalWay="true"
- :isGoods="true"
- :isProductionRequirements="form.type == '1'"
- :countObj="{
- countKey: 'contractCount',
- unitKey: 'contractUnit',
- unitIdKey: 'contractUnitId'
- }"
- ></inventoryTable1>
- </el-tab-pane>
- <el-tab-pane
- label="带料清单"
- name="2"
- v-if="form.categoryId == '1752993827954225153'"
- >
- <inventoryTable
- ref="rawDetailListRef"
- :detailType="1"
- :contractStartDate="this.form.contractStartDate"
- :isCustomerMark="form.type == '1'"
- :customerMark="form.customerMark"
- :isDiscountTotalPrice="true"
- :contractBookType="form.type"
- :pricingWay="form.pricingWay"
- ></inventoryTable>
- </el-tab-pane>
- <el-tab-pane
- label="产出清单"
- name="3"
- v-if="form.categoryId == '1752993827954225153'"
- >
- <inventoryTable
- ref="outputDetailListRef"
- :detailType="2"
- :contractStartDate="this.form.contractStartDate"
- :isCustomerMark="form.type == '1'"
- :customerMark="form.customerMark"
- :isDiscountTotalPrice="true"
- :contractBookType="form.type"
- :pricingWay="form.pricingWay"
- ></inventoryTable>
- </el-tab-pane>
- </el-tabs>
- <headerTitle
- :title="form.type == '2' ? '付款计划' : '收款计划'"
- style="margin-top: 30px"
- ></headerTitle>
- <!-- <paymentList ref="paymentListTable" /> -->
- <PaymentCollectionPlan
- ref="paymentCollectionPlanRef"
- :menu="form.type == '2' ? 'purchase' : 'sale'"
- :info="form"
- @getIssueNumber="setIssueNumber"
- ></PaymentCollectionPlan>
- </el-form>
- <div slot="footer" class="footer">
- <el-button type="primary" @click="save" v-click-once>保存</el-button>
- <el-button
- type="primary"
- v-if="isNeed_process_is_close"
- @click="save('sub')"
- >提交</el-button
- >
- <el-button @click="cancel">返回</el-button>
- </div>
- <parentList ref="parentRef" @changeParent="changeParent"></parentList>
- <inquiryManageList
- generatedType="contract"
- ref="inquiryManageRef"
- @changeInquiryManageList="changeInquiryManageList"
- ></inquiryManageList>
- <inquiryList
- ref="inquiryListRef"
- @changeParent="changeInquiryList"
- ></inquiryList>
- <quotationList
- ref="quotationListRef"
- @changeParent="changeQuotationList"
- :contactData="contactData"
- :businessOpportunityData="businessOpportunityData"
- ></quotationList>
- <supplierList
- ref="supplierListRef"
- :classType="2"
- @changeParent="changeSupplier"
- ></supplierList>
- <head-list ref="headRef" @changeParent="changePersonel"></head-list>
- <!-- 商机 -->
- <opportunity-dialog
- :opportunityDialogFlag.sync="opportunityDialogFlag"
- v-if="opportunityDialogFlag"
- ref="opportunityDialogRef"
- :contactData="contactData"
- @changeParent="getOpportunityDetail"
- ></opportunity-dialog>
- <!-- 退货 -->
- <return-order-dialog
- :returnOrderDialogFlag.sync="returnOrderDialogFlag"
- :contactData="contactData"
- v-if="returnOrderDialogFlag"
- @changeParent="getReturnOrderInfo"
- >
- </return-order-dialog>
- <!-- 销售订单 -->
- <saleOrderListDialog
- ref="saleOrderListDialogRef"
- @changeParent="changeOrder"
- :isBoundContract="2"
- ></saleOrderListDialog>
- <generate-contracts-dialog1
- :isContractBook="true"
- v-if="generateContractsDialogFlag1"
- ref="generateContractsDialogRef"
- :generate-contracts-dialog-flag1.sync="generateContractsDialogFlag1"
- @changeParent="changeInquiryDetailList"
- ></generate-contracts-dialog1>
- <process-submit-dialog
- api-fun-name="contractStatusAPI"
- :processSubmitDialogFlag.sync="processSubmitDialogFlag"
- v-if="processSubmitDialogFlag"
- ref="processSubmitDialogRef"
- @reload="reload"
- ></process-submit-dialog>
- </ele-modal>
- </template>
- <script>
- import { emailReg, telReg } from 'ele-admin';
- import { acceptUnpackoptions } from '@/enum/dict';
- import inventoryTable from './inventoryTable.vue';
- import inventoryTable1 from '@/BIZComponents/inventoryTable.vue';
- import inquiryList from './inquiryList.vue';
- import quotationList from './quotationList.vue';
- // import fileMain from '@/components/addDoc/index';
- import fileUpload from '@/components/upload/fileUpload';
- import dictMixins from '@/mixins/dictMixins';
- import parentList from '@/views/saleManage/contact/components/parentList.vue';
- import {
- getDetail,
- UpdateInformation,
- addInformation,
- submit
- } from '@/api/contractManage/contractBook';
- import {
- contactDetail,
- updateRelationStatus
- } from '@/api/saleManage/contact';
- import { getDetail as getOpportunityInfo } from '@/api/saleManage/businessOpportunity';
- import { isHasGeneratedContractAPI as BJisHasGeneratedContractAPI } from '@/api/saleManage/quotation';
- import { isHasGeneratedContractAPI as SJisHasGeneratedContractAPI } from '@/api/saleManage/businessOpportunity';
- import { getcontactlink } from '@/api/saleManage/businessFollow';
- import headList from '@/BIZComponents/user-select/user-select.vue';
- import supplierList from '@/views/purchasingManage/supplierManage/components/parentList.vue';
- import paymentList from './paymentList.vue';
- import { copyObj } from '@/utils/util';
- import { enterprisePage } from '@/api/contractManage/contractBook';
- import inquiryManageList from '@/views/purchasingManage/inquiryManage/components/inquiryManage-list.vue';
- import { getplanDetail } from '@/api/purchasingManage/purchasePlanManage';
- import opportunityDialog from '@/views/financialManage/components/opportunityDialog.vue';
- import { getOpportunityDetail } from '@/api/saleManage/businessOpportunity';
- import { isHasGeneratedContractPI } from '@/api/purchasingManage/inquiryManage';
- import returnOrderDialog from '@/views/saleManage/saleOrder/customerReturnOrder/returnOrderDialog.vue';
- import {
- getReturnSaleOrderrecordDetail,
- saleReturnGetByIdAPI
- } from '@/api/saleManage/returnGoods';
- import generateContractsDialog1 from './generateContractsDialog1.vue';
- import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
- import personSelect from '@/components/CommomSelect/person-select.vue';
- import { listOrganizations } from '@/api/system/organization';
- import { requirementSourceType } from '@/enum/dict.js';
- import { listCode, getCode } from '@/components/addDoc/api/index.js';
- import saleOrderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue'; //销售订单
- import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
- import PaymentCollectionPlan from '@/BIZComponents/paymentCollectionPlan/Index.vue'
- import { shippingModeOp, shippingModePurchaseOp, transactionMethodsOp } from '@/enum/dict.js';
- export default {
- props: {
- isRequired: {
- type: Boolean,
- default: true
- },
- categoryTreeList: Array,
- contactData: {
- type: Object,
- default: () => {
- return {};
- }
- },
- curNodeData: {
- type: Object,
- default: () => {
- return {};
- }
- },
- businessOpportunityData: {
- type: Object,
- default: () => {
- return {};
- }
- }
- },
- mixins: [dictMixins],
- components: {
- processSubmitDialog,
- generateContractsDialog1,
- returnOrderDialog,
- opportunityDialog,
- inquiryManageList,
- fileUpload,
- headList,
- paymentList,
- inventoryTable,
- supplierList,
- parentList,
- inquiryList,
- quotationList,
- // fileMain,
- inventoryTable1,
- personSelect,
- saleOrderListDialog,
- PaymentCollectionPlan
- },
- data() {
- let formDef = {
- id: '',
- contractEndDate: '',
- contractFile: [],
- contractName: '',
- contractNumber: '',
- productionRequirements: '',
- contractStartDate: '',
- opportunityId: '',
- categoryName: '',
- categoryId: '',
- sourceId: '',
- sourceType: '',
- sourceName: '',
- partaUnifiedSocialCreditCode: '',
- partbUnifiedSocialCreditCode: '',
- partaAddress: '',
- // partaEmail: '',
- // partaFax: '',
- partaBank: '',
- partaBankAccount: '',
- partaId: '',
- partaLinkId: '',
- partaLinkName: '',
- partaName: '',
- partaTel: '',
- partbAddress: '',
- // partbEmail: '',
- // partbFax: '',
- partbBank: '',
- partbBankAccount: '',
- partbId: '',
- partbLinkId: '',
- partbLinkName: '',
- partbName: '',
- partbTel: '',
- settlementModeName: '分期付款',
- settlementMode: '4',
- pricingWay: 1,
- customerMark: '',
- requireSourceType: '',
- requireSourceTypeName: '',
- totalPrice: null,
- isFirstProcess: 0,
- requireDeptId: '',
- businessDeptId: '',
- businessDeptName: '',
- businessUserId: '',
- businessUserName: '',
- requireUserId: '',
- requireUserName: '',
- requireDeptName: '',
- type: '', //1=销售合同 2=采购合同
- typeName: '',
- fileId: [], //附件集合
- issueNumber: 1,
- transactionMode: 1,
- deliveryMode: 1,
- receiptDate: 1,
- settlementDate: [],
- endSettlementDate: '',
- startSettlementDate: ''
- };
- return {
- shippingModeOp,
- transactionMethodsOp,
- fullscreen: false,
- requirementSourceType,
- cacheKeyUrl: 'eos-contractManage-contractBook-inventoryTabl',
- activeName: '1',
- payWayOptions: [],
- delDetailIds: [],
- paymentTypeOptions: [
- { id: 1, name: '固定' },
- { id: 2, name: '分期' }
- ],
- pricingWayList: [
- { id: 1, name: '按数量计价' },
- { id: 2, name: '按重量计价' }
- ],
- processList: [
- {
- label: '是',
- value: 1
- },
- {
- label: '否',
- value: 0
- }
- ],
- contractBookTypeList: [],
- sourceTypeList: [
- {
- code: 1,
- name: '报价单',
- parentId: '1'
- },
- {
- code: 2,
- name: '核价单',
- parentId: '2'
- },
- {
- code: 3,
- name: '采购计划',
- parentId: '2'
- },
- {
- code: 4,
- name: '商机',
- parentId: '1'
- },
- {
- code: 5,
- name: '退货单',
- parentId: '1'
- },
- {
- code: 6,
- name: '客户',
- parentId: '1'
- },
- {
- code: 7,
- name: '销售订单',
- parentId: '1'
- }
- ],
- categoryList: [],
- linkNameOptions: [],
- acceptUnpackoptions,
- visible: false,
- processSubmitDialogFlag: false,
- opportunityDialogFlag: false,
- returnOrderDialogFlag: false,
- generateContractsDialogFlag1: false,
- title: '',
- row: {},
- formDef,
- form: copyObj(formDef),
- // removeBankList: [],
- // removeLinkList: [],
- tableBankData: [],
- tableLinkData: [],
- enterprise: {
- address: '',
- unifiedSocialCreditCode: '',
- tel: '',
- name: ''
- },
- // 提交状态
- loading: false,
- // 是否是修改
- isUpdate: false,
- enterprisePage: [],
- create: false,
- source: '',
- businessId: '',
- groupTreeData: [],
- // 组织机构平铺数据
- groupData: [],
- companyInfo: {}
- };
- },
- computed: {
- shippingModeOptions() {
- return this.form.type == 2 ? shippingModePurchaseOp : shippingModeOp;
- },
- rules() {
- let isRequired = this.isRequired;
- return {
- type: [
- { required: true, message: '请选择合同类型', trigger: 'change' }
- ],
- HJQD: [
- { required: true, message: '请选择核价清单', trigger: 'change' }
- ],
- settlementMode: [
- { required: true, message: '请选择合结算方式', trigger: 'change' }
- ],
- categoryId: [
- { required: true, message: '请选择合同分类', trigger: 'change' }
- ],
- contractNumber: [
- { required: true, message: '请输入自带编号', trigger: 'change' }
- ],
- // productionRequirements: [
- // { required: true, message: '请输入生产要求', trigger: 'blur' }
- // ],
- contractName: [
- { required: true, message: '请输入合同名称', trigger: 'blur' }
- ],
- partaName: [
- { required: true, message: '请选择甲方名称', trigger: 'change' }
- ],
- partaLinkName: [
- {
- required: isRequired,
- message: '请选择甲方联系人',
- trigger: 'change'
- }
- ],
- acceptUnpack: [
- { required: true, message: '请选择是否接受', trigger: 'change' }
- ],
- partaTel: [
- {
- required: isRequired,
- pattern: telReg,
- message: '请输入甲方联系电话',
- trigger: 'blur'
- }
- ],
- deliveryDate: [
- { required: true, message: '请选择交货日期', trigger: 'change' }
- ],
- partbName: [
- { required: true, message: '请输入乙方名称', trigger: 'change' }
- ],
- partbLinkName: [
- {
- required: isRequired,
- message: '请输入乙方联系人',
- trigger: 'change'
- }
- ],
- partbTel: [
- {
- required: isRequired,
- pattern: telReg,
- message: '请输入乙方联系电话',
- trigger: 'blur'
- }
- ],
- // partaEmail: [
- // { pattern: emailReg, message: '邮箱格式不正确', trigger: 'blur' }
- // ],
- contractStartDate: [
- { required: true, message: '请选择签订日期', trigger: 'change' }
- ],
- contractEndDate: [
- { validator: this.validateEndDate, trigger: 'blur' }
- ],
- businessDeptId: [
- { required: this.form.type == 1 ? true : false, message: '请选择', trigger: 'change' }
- ],
- businessUserId: [
- { required: this.form.type == 1 ? true : false, message: '请选择', trigger: 'change' }
- ],
- };
- }
- },
- created() {
- this.getGroupAll();
- enterprisePage({
- pageNum: 1,
- size: 200
- }).then((res) => {
- console.log('企业列表', res);
- console.log('企业列表第一个', this.$store.state.user.info);
- this.companyInfo = res.list[0] || {};
- this.enterprisePage = [];
- this.enterprisePage.push(...res.list);
- this.getEnterprise();
- });
- },
- methods: {
- setDiscountTotalPrice(val) {
- this.form.discountTotalPrice = val;
- this.$nextTick(() => {
- // this.$refs.paymentListTable.setDiscountAmount(val);
- this.$refs.paymentCollectionPlanRef.setDiscountAmount(val);
- });
- },
- // 获取公司数据
- getGroupAll() {
- listOrganizations().then((list) => {
- this.groupData = list;
- this.groupTreeData = this.$util.toTreeData({
- data: list,
- idField: 'id',
- parentIdField: 'parentId'
- });
- });
- },
- // 选择负责人部门
- change_principalDep(id) {
- const info = this.groupData.find((e) => e.id == id);
- this.form.requireDeptName = info.name;
- this.form.requireUserId = '';
- this.form.requireUserName = '';
- // 根据部门获取人员
- this.$nextTick(() => {});
- this.getrequireUser(id);
- },
- // 选择业务部门
- changeBusinessDep(id) {
- const info = this.groupData.find((e) => e.id == id);
- this.form.businessDeptName = info?.name || '';
- this.form.businessUserId = '';
- this.form.businessUserName = '';
- // 根据部门获取人员
- this.$nextTick(() => {});
- this.getBusinessUser(id);
- },
- getBusinessUser(groupId) {
- if (groupId) {
- this.$refs.businessDirectorRef.getList({ groupId });
- }
- },
- getrequireUser(groupId) {
- if (groupId) {
- this.$refs.directorRef.getList({ groupId });
- }
- },
- //开始日期验证
- validateStartDate(rule, value, callback) {
- if (this.form.contractEndDate && value > this.form.contractEndDate) {
- callback(new Error('开始日期不能大于结束日期'));
- } else {
- callback();
- }
- },
- //结束日期验证
- validateEndDate(rule, value, callback) {
- if (
- this.form.contractEndDate &&
- this.form.contractStartDate &&
- value < this.form.contractStartDate
- ) {
- callback(new Error('结束日期不能小于开始日期'));
- } else {
- callback();
- }
- },
- //选择供应商
- async changeSupplier(obj) {
- if (!obj.id) {
- return;
- }
- const { base, other } = await contactDetail(obj.id);
- this.form = Object.assign({}, this.form, {
- partbId: base.id,
- partbName: base.name,
- partbAddress: other.addressName
- ? other.addressName + other.address
- : base.addressName + other.address,
- partbLinkId: '',
- partbLinkName: '',
- // partbEmail: '',
- partbTel: '',
- partbUnifiedSocialCreditCode: obj.unifiedSocialCreditCode,
- customerMark: base.serialNo
- });
- await this.getLinkInfo(obj.id);
- this.$nextTick(() => {
- this.setProductInfo();
- let firstLink =
- this.linkNameOptions.find((item) => item.ifChief == 1) || {};
- this.form = Object.assign({}, this.form, {
- partbLinkId: firstLink.id || this.linkNameOptions[0]?.id,
- partbLinkName:
- firstLink.linkName || this.linkNameOptions[0]?.linkName,
- partbTel:
- firstLink.mobilePhone || this.linkNameOptions[0]?.mobilePhone
- });
- });
- },
- //获取编码list
- async getListCode() {
- // let categoryData = this.categoryList.find(
- // (item) => item.id == this.form.categoryId
- // );
- let list = await listCode({ id: this.form.categoryId });
- if (list?.length > 0) {
- this.$set(this.form, 'contractNumber', await getCode(list[0]?.id));
- } else {
- this.$set(this.form, 'contractNumber', '');
- }
- },
- setIssueNumber(len) {
- this.form.issueNumber = len;
- },
- //获取详情
- async getDetailData(id) {
- this.businessId = id;
- this.loading = true;
- const data = await getDetail(id);
- let { contractVO } = data;
- contractVO.settlementDate = contractVO.startSettlementDate ? [contractVO.startSettlementDate, contractVO.endSettlementDate] : [];
- this.form = contractVO;
- this.loading = false;
- if (data) {
- this.form.HJQD = this.form.partbName;
- this.$nextTick(() => {
- this.dictChange(contractVO.type, 'init');
- this.getrequireUser(contractVO.requireDeptId);
- this.getBusinessUser(contractVO.businessDeptId);
- // if (this.form.fileId) {
- // this.form.fileId = JSON.parse(this.form.fileId);
- // }
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(data);
- // this.$refs.paymentListTable &&
- // this.$refs.paymentListTable.putTableValue(
- // data.receiptPaymentList
- // );
- // this.$refs.paymentListTable &&
- // this.$refs.paymentListTable.setDiscountAmount(
- // contractVO.discountTotalPrice
- // );
-
- const receiptData = {
- receiptPaymentList: data.receiptPaymentList,
- payAmount: contractVO.discountTotalPrice
- }
- this.$refs.paymentCollectionPlanRef && this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValueNew(contractVO.rawList); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValueNew(
- contractVO.outputList
- );
- this.getLinkInfo(
- contractVO.type == '2' ? contractVO.partbId : contractVO.partaId
- );
- });
- }
- },
- //签订日期 更新
- setDeliveryDays() {
- this.$refs.inventoryTable.setDeliveryDays('', '', '', true);
- },
- //更新联系人数据
- async getLinkInfo(contactId) {
- const data = await getcontactlink({ contactId });
- if (data && data?.length) {
- this.linkNameOptions = data;
- }
- },
- handleHJQD() {
- if (!this.form.sourceId) return this.$message.warning('请先选择核价单');
- this.generateContractsDialogFlag1 = true;
- this.$nextTick(() => {
- this.$refs.generateContractsDialogRef.open({
- id: this.form.sourceId
- });
- });
- },
- //选择合同类型
- dictChange(val, type) {
- console.log('val~~~', val);
- this.categoryList = copyObj(
- this.contractBookTypeList?.find((item) => item.code == val)?.children
- );
- if (type == 'init') {
- return;
- }
- let typeName = '';
- if (val)
- typeName =
- this.contractBookTypeList?.find((item) => item.code == val)?.name ||
- '';
- this.form = Object.assign({}, this.form, {
- typeName: typeName || val.dictValue,
- contractName: '',
- sourceType: '',
- sourceId: '',
- sourceName: '',
- partaAddress: '',
- // partaEmail: '',
- // partaFax: '',
- partaBank: '',
- partaId: '',
- partaLinkId: '',
- partaLinkName: '',
- partaName: '',
- partaTel: '',
- partbAddress: '',
- // partbEmail: '',
- // partbFax: '',
- partbBank: '',
- partbBankAccount: '',
- partbId: '',
- partbLinkId: '',
- partbLinkName: '',
- partbName: '',
- partbTel: '',
- partaUnifiedSocialCreditCode: '',
- partbUnifiedSocialCreditCode: '',
- categoryName: '',
- categoryId: '',
- businessDeptId: this.form.type == 2 ? this.companyInfo.groupId : '',
- businessDeptName: this.form.type == 2 ? this.companyInfo.name : '',
- businessUserId: this.form.type == 2 ? this.$store.state.user.info?.id : '',
- businessUserName: this.form.type == 2 ? this.$store.state.user.info?.name : '',
- transactionMode: 1,
- settlementDate: [],
- issueNumber: 1,
- deliveryMode: 1,
- receiptDate: 1,
- endSettlementDate: '',
- startSettlementDate: ''
- });
- this.$nextTick(() => {
- this.getBusinessUser(this.form.businessDeptId)
- })
-
- console.log('form~~~', this.form);
- this.getEnterprise();
- this.changePersonel();
- },
- //选择来源类型
- sourceTypeChange(val, type) {
- if (this.contactData.id) {
- return;
- }
- this.form = Object.assign({}, this.form, {
- contractName: '',
- sourceId: '',
- sourceName: '',
- partaAddress: '',
- // partaEmail: '',
- // partaFax: '',
- partaBankAccount: '',
- partaBank: '',
- partaId: '',
- partaLinkId: '',
- partaLinkName: '',
- partaName: '',
- partaTel: '',
- partbAddress: '',
- // partbEmail: '',
- // partbFax: '',
- partbBank: '',
- partbBankAccount: '',
- partbId: '',
- partbLinkId: '',
- partbLinkName: '',
- partbName: '',
- partbTel: '',
- partaUnifiedSocialCreditCode: '',
- partbUnifiedSocialCreditCode: ''
- // categoryName: '',
- // categoryId: ''
- });
- this.getEnterprise();
- this.changePersonel();
- },
- getEnterprise(type) {
- let key = this.form.type == '1' || !this.form.type ? 'partb' : 'parta';
- let keyArr = [
- key + 'Name',
- key + 'Id',
- key + 'UnifiedSocialCreditCode',
- key + 'Fax',
- key + 'Address'
- ];
- if (type === 1) {
- let data = this.enterprisePage.find(
- (item) => item.name == this.form[keyArr[0]]
- );
- this.form[keyArr[0]] = data.name;
- this.form[keyArr[1]] = data.id;
- this.form[keyArr[2]] = data.unifiedSocialCreditCode;
- this.form[keyArr[3]] = data.fax;
- this.form[keyArr[4]] = data.address;
- return;
- }
- if (this.enterprisePage.length > 0) {
- this.form[keyArr[0]] =
- this.form[keyArr[0]] || this.enterprisePage[0].name;
- this.form[keyArr[1]] =
- this.form[keyArr[1]] || this.enterprisePage[0].id;
- this.form[keyArr[2]] =
- this.form[keyArr[2]] ||
- this.enterprisePage[0].unifiedSocialCreditCode;
- this.form[keyArr[2]] =
- this.form[keyArr[2]] || this.enterprisePage[0].fax;
- this.form[keyArr[3]] =
- this.form[keyArr[3]] || this.enterprisePage[0].fax;
- this.form[keyArr[4]] =
- this.form[keyArr[4]] || this.enterprisePage[0].address;
- }
- },
- // 交易方式改变
- transactionModeChange(v) {
- },
- // 配送方式改变
- deliveryModeChange(v) {
- },
- // 结算方式改变
- settlementModeChange(v) {
- console.log('v~~~', v.dictCode);
- this.form.settlementModeName = v.dictValue;
- // this.$set(this.form, 'issueNumber', 1);
- this.$set(this.form, 'settlementDate', []);
- this.$set(this.form, 'receiptDate', 1);
-
- if(v.dictCode == 3) {
- this.$set(this.form, 'issueNumber', 2);
- } else {
- this.$set(this.form, 'issueNumber', 1);
- }
- this.$refs.paymentCollectionPlanRef.defaultList(v.dictCode, this.form.issueNumber);
- },
- //选择合同分类
- // treeChange(val) {
- // //这里eladmin组件有bug,要手动验证下
- // this.$set(this.form, 'categoryId', val);
- // this.$refs.form.validateField('categoryId');
- // },
- //选择下拉框
- onchangeLink(selectedOptions) {
- if (this.form.type == '2') {
- const option = this.linkNameOptions.find(
- (opt) => opt.id === selectedOptions
- );
- this.form = Object.assign({}, this.form, {
- // partbEmail: option?.email,
- partbLinkName: option?.linkName || '',
- partbTel: option?.mobilePhone || option?.phone || '',
- partbLinkId: option?.id
- });
- } else {
- const option = this.linkNameOptions.find(
- (opt) => opt.id === selectedOptions
- );
- this.form = Object.assign({}, this.form, {
- // partaEmail: option?.email,
- partaLinkName: option?.linkName || '',
- partaTel: option?.mobilePhone || option?.phone || '',
- partaLinkId: option?.id
- });
- }
- },
- handHead(title) {
- if (this.form.type == '2') {
- let item = {
- id: this.form.partaLinkId
- };
- this.$refs.headRef.open(item);
- } else {
- let item = {
- id: this.form.partbLinkId
- };
- this.$refs.headRef.open(item);
- }
- },
- //选择乙方人和采购合同下的甲方人回调
- changePersonel(obj, index, title) {
- if (!obj) {
- obj = this.$store.getters.user.info;
- obj.id = obj.userId;
- }
- if (this.form.type == '2') {
- this.$set(this.form, 'partaLinkId', obj.id);
- this.$set(this.form, 'partaLinkName', obj.name);
- this.$set(this.form, 'partaTel', obj.phone);
- // this.$set(this.form, 'partaEmail', obj.email);
- } else {
- this.$set(this.form, 'partbLinkId', obj.id);
- this.$set(this.form, 'partbLinkName', obj.name);
- this.$set(this.form, 'partbTel', obj.phone);
- // this.$set(this.form, 'partbEmail', obj.email);
- }
- },
- //选择客户回调
- async changeParent(obj) {
- if (!obj.id) {
- return;
- }
- const { base, other } = await contactDetail(obj.id);
- this.form = Object.assign({}, this.form, {
- partaId: base.id,
- partaName: base.name,
- partaAddress: other.addressName
- ? other.addressName + other.address
- : base.addressName + other.address,
- partaLinkId: '',
- partaLinkName: '',
- // partaEmail: '',
- partaTel: '',
- customerMark: base.serialNo,
- partaUnifiedSocialCreditCode: base.unifiedSocialCreditCode
- });
- await this.getLinkInfo(obj.id);
- this.$nextTick(() => {
- this.setProductInfo();
- let firstLink =
- this.linkNameOptions.find((item) => item.ifChief == 1) || {};
- this.form = Object.assign({}, this.form, {
- partaLinkId: firstLink.id || this.linkNameOptions[0]?.id,
- partaLinkName:
- firstLink.linkName || this.linkNameOptions[0]?.linkName,
- partaTel:
- firstLink.mobilePhone || this.linkNameOptions[0]?.mobilePhone
- });
- });
- },
- setProductInfo() {
- if (this.$refs.inventoryTable && this.$refs.inventoryTable.form) {
- this.$refs.inventoryTable?.form?.datasource.forEach((item, index) => {
- if (this.form.type == 1) {
- this.$set(
- this.$refs.inventoryTable?.form?.datasource[index],
- 'customerMark',
- item.customerMark || this.form.customerMark
- );
- } else {
- this.$set(
- this.$refs.inventoryTable?.form?.datasource[index],
- 'customerMark',
- item.customerMark || this.form.customerMark
- );
- }
- });
- }
- },
- //选择采购合同的乙方
- handSupplier() {
- let item = {
- id: this.form.partbId
- };
- this.$refs.supplierListRef.open(item);
- },
- handParent() {
- let item = {
- id: this.form.contactId
- };
- this.$refs.parentRef.open(item);
- },
- async open(type, row, create = false, source) {
- console.log('row~~~', row)
- this.title = type === 'add' ? '新增' : '修改';
- this.activeName = '1';
- this.row = row;
- this.visible = true;
- this.create = create;
- this.source = source;
- this.contractBookTypeList = copyObj(this.categoryTreeList[0].children);
- console.log('contractBookTypeList!!!', this.contractBookTypeList)
- if (type == 'add') {
- let userInfo = this.$store.getters.user.info;
- this.isUpdate = false;
- userInfo.id = userInfo.userId;
- this.changePersonel();
- this.form.contractStartDate = new Date();
- if (row?.contractVO?.type) {
- this.dictChange(row.contractVO.type, 'init');
- }
- if (this.contactData.id) {
- this.form.type = '1';
- this.dictChange('1');
- this.changeParent(this.contactData);
- }
- if (this.businessOpportunityData.id) {
- this.form.type = '1';
- this.dictChange('1');
- this.form.sourceType = 4;
- this.getOpportunityDetail(this.businessOpportunityData);
- }
- this.$nextTick(() => {
- // this.$refs.paymentListTable.defaultList();
- this.$nextTick(() => {
- this.issueNumberChange(this.form.issueNumber);
- })
- });
- if (this.curNodeData?.id) {
- console.log('44444444', this.curNodeData)
- this.form.type =
- this.curNodeData.parentCode || this.curNodeData.code;
- this.dictChange(this.form.type);
- if (this.curNodeData.parentCode) {
- this.form.categoryId = this.curNodeData.id;
- await this.getListCode();
- }
- }
- if (create) {
- this.create = create;
- //核价单生成的合同
- this.$nextTick(async () => {
- this.setValue(row);
- if (source == 'inquiryManage') {
- //核价单是否生成过合同
- this.$nextTick(() => {
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValueNew(
- row.contractVO?.rawList
- ); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValueNew(
- row.contractVO?.outputList
- );
- });
- let res = await isHasGeneratedContractPI({
- inquiryIds: [row.contractVO.sourceId],
- supplierId: row.contractVO.partbId
- });
- if (res.result) this.$message.warning(res.message);
- this.$refs.inventoryTable.discountInputByOrder(
- row.contractVO.discountTotalPrice
- );
- }
- if (source == 'quotation') {
-
- //报价单是否生成过合同
- let res = await BJisHasGeneratedContractAPI(
- row.contractVO.sourceId
- );
- if (res) this.$message.warning('该报价单已生成过合同,请注意');
- }
- });
- }
- } else {
- this.isUpdate = true;
- await this.getDetailData(row.id);
- }
- },
- //赋值
- async setValue(row) {
- let { contractVO } = row;
- contractVO = {
- ...contractVO,
- categoryId: contractVO.categoryId || this.form.categoryId,
- categoryName: contractVO.categoryName || this.form.categoryName,
- contractStartDate:
- contractVO.contractStartDate || this.form.contractStartDate,
- contractEndDate:
- contractVO.contractEndDate || this.form.contractEndDate,
- pricingWay: 1,
- transactionMode: contractVO.transactionMode || this.form.transactionMode,
- settlementDate: contractVO.settlementDate || this.form.settlementDate,
- issueNumber: contractVO.issueNumber || this.form.issueNumber,
- deliveryMode: contractVO.deliveryMode || this.form.deliveryMode,
- receiptDate: contractVO.receiptDate || this.form.receiptDate,
- endSettlementDate: contractVO.endSettlementDate || this.form.endSettlementDate,
- startSettlementDate: contractVO.startSettlementDate || this.form.startSettlementDate
- };
- row.productList = row.productList.map((item) => {
- item['contractCount'] =
- contractVO.type == 1
- ? item.saleCount
- : item.contractCount || item.purchaseCount;
- item['contractUnit'] =
- contractVO.type == 1
- ? item.saleUnit
- : item.contractUnit || item.purchaseUnit;
- item['contractUnitId'] =
- contractVO.type == 1
- ? item.saleUnitId
- : item.contractUnitId || item.purchaseUnitId;
- return item;
- });
- this.form = contractVO;
- this.form.HJQD = this.form.partbName;
- this.issueNumberChange(this.form.issueNumber)
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(row);
- // const receiptData = {
- // receiptPaymentList: row.receiptPaymentList,
- // payAmount: contractVO.discountTotalPrice
- // }
- // this.$refs.paymentCollectionPlanRef &&
- // this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
- this.$refs.paymentCollectionPlanRef &&
- this.$refs.paymentCollectionPlanRef.setDiscountAmount(
- contractVO.discountTotalPrice
- );
- this.getEnterprise();
- await this.getLinkInfo(
- contractVO.type == '2' ? contractVO.partbId : contractVO.partaId
- );
- if (contractVO.discountTotalPrice) {
- this.$refs.inventoryTable.allPrice = contractVO.totalPrice;
- this.$refs.inventoryTable.discountInputByOrder(
- contractVO.discountTotalPrice
- );
- }
- this.$nextTick(() => {
- this.getrequireUser(contractVO.requireDeptId);
- this.getBusinessUser(contractVO.businessDeptId);
- let firstLink =
- this.linkNameOptions.find((item) => item.ifChief == 1) || {};
- let LinkId = [1, 4, 5].includes(this.form.sourceType)
- ? 'partaLinkId'
- : 'partbLinkId';
- let LinkName = [1, 4, 5].includes(this.form.sourceType)
- ? 'partaLinkName'
- : 'partbLinkName';
- let Tel = [1, 4, 5].includes(this.form.sourceType)
- ? 'partaTel'
- : 'partbTel';
- this.$set(
- this.form,
- LinkId,
- firstLink.id || this.linkNameOptions[0]?.id
- );
- this.$set(
- this.form,
- LinkName,
- firstLink.linkName || this.linkNameOptions[0]?.linkName
- );
- this.$set(
- this.form,
- Tel,
- firstLink.mobilePhone || this.linkNameOptions[0]?.mobilePhone
- );
- this.$set(
- this.form,
- 'businessUserId',
- contractVO.businessUserId || this.form.businessUserId || ''
- );
- this.changePersonel();
- if (contractVO.type == 1) {
- this.changeParent({ id: contractVO.partaId });
- } else {
- this.changeSupplier({ id: contractVO.partbId });
- }
- });
- },
- businessUserChange(val, info) {
- this.form.businessUserName = info.name;
- },
- salesmanChange(val, info) {
- this.form.salesmanName = info.name;
- this.form.requireUserName = info.name;
- },
- ifChiefChange(value, idx) {
- if (value === 1) {
- this.tableLinkData.forEach((e) => (e.ifChief = 0));
- this.tableLinkData[idx].ifChief = 1;
- }
- },
- // getValidate() {
- // return new Promise((resolve, reject) => {
- // this.$refs.form.validate((valid) => {
- // if (!valid) {
- // reject(false);
- // } else {
- // resolve(true);
- // }
- // });
- // });
- // },
- getValidate() {
- return Promise.all([
- new Promise((resolve, reject) => {
- this.$refs.form.validate((valid) => {
- if (!valid) {
- reject(false);
- } else {
- resolve(true);
- }
- });
- }),
- new Promise((resolve, reject) => {
- this.$refs.inventoryTable.validateForm((valid) => {
- if (!valid) {
- reject(false);
- } else {
- resolve(true);
- }
- });
- }),
- // new Promise((resolve, reject) => {
- // this.$refs.paymentListTable.validateForm((valid) => {
- // if (!valid) {
- // reject(false);
- // } else {
- // resolve(true);
- // }
- // });
- // }),
- new Promise((resolve, reject) => {
- this.$refs.paymentCollectionPlanRef.validateForm((valid) => {
- if (!valid) {
- reject(false);
- } else {
- resolve(true);
- }
- });
- })
- ]);
- },
- async save(type) {
- try {
- await this.getValidate();
- let isTemporary = [];
- // 表单验证通过,执行保存操作
- this.loading = true;
- if (!this.isUpdate) {
- delete this.form.id;
- }
- let [totalPrice, discountTotalPrice] =
- this.$refs.inventoryTable.getPrice();
- this.form.totalPrice = totalPrice;
- this.form.discountTotalPrice = discountTotalPrice;
- if (this.form.categoryId) {
- this.form.categoryName = this.findNameById(
- this.categoryTreeList,
- this.form.categoryId
- );
- }
- this.form.settlementModeName = this.getDictValue(
- '结算方式',
- this.form.settlementMode
- );
- this.form.requireSourceTypeName = this.requirementSourceType.find(
- (item) => item.value == this.form.requireSourceType
- )?.label;
- // if (this.form.fileId) {
- // this.form.fileId = JSON.stringify(this.form.fileId);
- // } else {
- // this.form.fileId = '[]';
- // }
- const rawDetailList =
- (this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.getTableValue()) ||
- [];
- const outputDetailList =
- (this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.getTableValue()) ||
- [];
- let commitData = Object.assign(
- {},
- {
- contract: {
- ...this.form,
- endSettlementDate: this.form.settlementDate.length ?this.form.settlementDate[1] : '',
- startSettlementDate: this.form.settlementDate.length ? this.form.settlementDate[0] : ''
- },
- productList: [
- ...this.$refs.inventoryTable.getTableValue(),
- ...rawDetailList,
- ...outputDetailList
- ],
- receiptPaymentList: this.$refs.paymentCollectionPlanRef.getTableValue()
- }
- );
- const receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
- console.log('receiptPaymentListSum~~~', receiptPaymentListSum, commitData.contract.discountTotalPrice)
- if(+receiptPaymentListSum != +commitData.contract.discountTotalPrice){
- this.$message.error('计划收款金额合计与优惠后金额不一致');
- return;
- }
- const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
- if(+ratioSum != 100){
- this.$message.error('比例合计必须为100%');
- return;
- }
- // commitData.productList.forEach((item) => {
- // if (!item.productCode) {
- // isTemporary.push(item.productName);
- // }
- // });
- // if (isTemporary.length > 0) {
- // this.$message.error(
- // isTemporary.toString() +
- // '是临时产品,无法创建合同,请先去主数据维护!'
- // );
- // return;
- // }
- let relationId =
- this.form.type == 1 ? this.form.partaId : this.form.partbId;
- if (this.isUpdate) {
- UpdateInformation(commitData)
- .then((res) => {
- this.loading = false;
- this.$message.success('修改成功');
- updateRelationStatus([relationId]);
- if (type === 'sub') {
- this.contractBookSubmit(res);
- return;
- }
- this.cancel();
- this.$emit('done');
- })
- .catch((e) => {
- //this.loading = false;
- });
- } else {
- addInformation(commitData)
- .then((res) => {
- this.loading = false;
- this.$message.success('新增成功');
- updateRelationStatus([relationId]);
- if (type === 'sub') {
- this.contractBookSubmit(res);
- return;
- }
- this.cancel();
- this.$emit('done');
- })
- .catch((e) => {
- //this.loading = false;
- });
- }
- } catch (error) {
- console.log(error);
- // 表单验证未通过,不执行保存操作
- }
- },
- async contractBookSubmit(res) {
- const data = await getDetail(this.businessId || res);
- this.processSubmitDialogFlag = true;
- let key =
- data.contractVO.type == 1
- ? 'sales_contract_approve'
- : 'contract_approve_2';
- this.$nextTick(() => {
- let params = {
- businessId: data.contractVO.id,
- businessKey: key,
- formCreateUserId: data.contractVO.createUserId,
- variables: {
- businessType: data.contractVO.categoryName,
- businessName: data.contractVO.contractName,
- businessCode: data.contractVO.contractNumber
- }
- // callBackMethodType : '1',
- // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
- // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
- // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
- // miniHandle : '',
- // miniView : '',
- };
- this.$refs.processSubmitDialogRef.init(params);
- });
- // submit({
- // businessId: this.businessId || res,
- // businessType: this.form.type
- // // productionSupervisorId
- // }).then((res) => {
- // this.cancel();
- // this.$emit('done');
- // });
- },
- reload() {
- this.cancel();
- this.$emit('done');
- },
- handInquiry(e) {
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'sourceName', '');
- this.$set(this.form, 'sourceId', '');
- return;
- }
- this.$refs.inquiryListRef.open();
- },
- handQuotation(e) {
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'sourceName', '');
- this.$set(this.form, 'sourceId', '');
- return;
- }
- this.$refs.quotationListRef.open();
- },
- //核价单
- async changeInquiryList({ data, sourceId, sourceName }) {
- console.log(sourceId, sourceName);
- this.$set(this.form, 'sourceName', sourceName);
- this.$set(this.form, 'sourceId', sourceId);
- this.$set(this.form, 'HJQD', '');
- if (!data) return;
- console.log(data);
- this.$nextTick(() => {
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValueNew(data.rawList); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValueNew(data.outputList);
- });
- this.setValue(data);
- },
- //核价清单
- async changeInquiryDetailList({ data }) {
- if (!data) return;
- this.setValue(data);
- let contactId =
- this.form.type == 2
- ? data.contractVO.partbId
- : data.contractVO.partaId;
- let { base } = await contactDetail(contactId);
- this.$set(this.form, 'contractName', base.simpleName);
- },
- //报价单
- async changeQuotationList({ data, sourceCode, sourceName }) {
- this.setValue(data);
- this.$set(this.form, 'sourceName', sourceCode);
- this.$set(this.form, 'sourceId', data.contractVO.sourceId);
- },
- //选择采购计划
- handPlan(e) {
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'sourceName', '');
- this.$set(this.form, 'sourceId', '');
- return;
- }
- this.$refs.inquiryManageRef.open();
- },
- //选择采购计划回调
- async changeInquiryManageList(data) {
- let info = await this.getPlanInfo(data.id);
- let cusInfo = {};
- // if (info.detailList.length) cusInfo = await this.getCusInfo(info.detailList[0]?.supplierId ?? '');
- this.$set(this.form, 'sourceName', data.planName);
- this.$set(this.form, 'contractName', data.planName);
- this.$set(this.form, 'sourceId', data.id);
- this.$set(this.form, 'requireDeptId', data.requireDeptId);
- this.$set(this.form, 'requireUserId', data.requireUserId);
- this.$set(this.form, 'requireDeptName', data.requireDeptName);
- this.$set(this.form, 'requireUserName', data.requireUserName);
- // this.getrequireUser(data.requireDeptId)
- this.form.isFirstProcess = info.isFirstProcess;
- this.$nextTick(() => {
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValueNew(info.rawDetailList); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValueNew(
- info.outputDetailList
- );
- });
- // this.$set(this.form, 'contractName', cusInfo?.base?.simpleName);
- let form = {
- contractVO: {
- ...this.form,
- requireSourceType: info.sourceType,
- requireSourceTypeName: info.sourceTypeName
- },
- productList:
- info.detailList.map((item) => {
- item['customerExpectDeliveryDeadline'] = item.expectReceiveDate;
- return item;
- }) || []
- };
- this.setValue(form);
- // await this.getLinkInfo(cusInfo.base.id)
- },
- //获取计划详情
- async getPlanInfo(id) {
- return Promise.resolve(await getplanDetail(id));
- },
- //获取客户详情
- async getCusInfo(id = '') {
- if (!id) return;
- return Promise.resolve(await contactDetail(id));
- },
- //选择商机
- handOpportunity(e) {
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'sourceName', '');
- this.$set(this.form, 'sourceId', '');
- return;
- }
- this.opportunityDialogFlag = true;
- this.$nextTick(() => {
- let item = {
- id: this.form.sourceId
- };
- this.$refs.opportunityDialogRef.init(item);
- });
- },
- //获取商机信息
- async getOpportunityDetail(row) {
- let res = await SJisHasGeneratedContractAPI(row.id);
- if (res) this.$message.warning('该商机已生成过合同,请注意');
- this.$set(this.form, 'sourceName', row.name);
- this.$set(this.form, 'sourceId', row.id);
- let cusInfo = await this.getCusInfo(row?.contactId ?? '');
- let info = await this.getOpportunityDetailData(row?.id ?? '');
- await this.getLinkInfo(cusInfo.base.id);
- let totalPrice = info.productList.reduce((num, cur) => {
- return num + Number(cur.totalPrice);
- }, 0);
- info.productList.forEach((item) => {
- item.discountSinglePrice =
- item.discountSinglePrice || item.singlePrice;
- item.discountTotalPrice = item.discountTotalPrice || item.totalPrice;
- });
- let discountTotalPrice = info.productList.reduce((num, cur) => {
- return num + Number(cur.discountTotalPrice);
- }, 0);
- let form = {
- contractVO: {
- ...this.form,
- partaName: cusInfo.base.name,
- partaId: cusInfo.base.id,
- partaUnifiedSocialCreditCode: cusInfo.base.unifiedSocialCreditCode,
- partaAddress: cusInfo.base.addressName + cusInfo.base.address,
- partaLinkName: cusInfo.linkList[0]?.linkName,
- partaLinkId: cusInfo.linkList[0]?.id,
- partaTel: cusInfo.linkList[0]?.mobilePhone,
- totalPrice: totalPrice,
- discountTotalPrice: discountTotalPrice
- },
- productList: info.productList || []
- };
- this.setValue(form);
- this.$set(this.form, 'contractName', row.name);
- },
- //获取商机详情
- async getOpportunityDetailData(id) {
- return Promise.resolve(await getOpportunityInfo(id));
- },
- // 选择销售订单
- handSaleOrder(e) {
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'sourceName', '');
- this.$set(this.form, 'sourceId', '');
- return;
- }
- this.$refs.saleOrderListDialogRef.open();
- },
- async changeOrder(row) {
- let data = await getSaleOrderDetail(row.id);
- this.$set(this.form, 'sourceName', data.orderNo);
- this.$set(this.form, 'sourceId', row.id);
- [
- 'createTime',
- 'createUserId',
- 'createUserName',
- 'processInstanceId',
- 'progress',
- 'id'
- ].forEach((key) => {
- delete data[key];
- });
- let form = {
- contractVO: {
- ...this.form,
- ...data,
- hasGeneratedOrder:1,
- totalPrice: data.totalAmount,
- discountTotalPrice: data.payAmount
- },
- productList: data.productList || []
- };
- this.setValue(form);
- },
- cancel() {
- this.$nextTick(() => {
- this.activeName = 'base';
- // 关闭后,销毁所有的表单数据
- this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
- this.$refs['formRef'] && this.$refs['formRef'].resetFields();
- this.form = copyObj(this.formDef);
- this.$store.commit('concact/setDiscountAmount', 0);
- this.visible = false;
- });
- },
- //选择退货单
- handReturnOrder(e) {
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'sourceName', '');
- this.$set(this.form, 'sourceId', '');
- return;
- }
- this.returnOrderDialogFlag = true;
- // this.$nextTick(() => {
- // this.$refs.returnOrderDialogRef.init()
- // })
- },
- //退货单
- async getReturnOrderInfo(row) {
- this.$set(this.form, 'sourceName', row.returnNo);
- this.$set(this.form, 'sourceId', row.id);
- let cusInfo = await this.getCusInfo(row?.contactId ?? '');
- let info = await this.getReturnOrderDetail(row?.id ?? '');
- await this.getLinkInfo(cusInfo.base.id);
- let totalPrice = info?.productList.reduce((num, cur) => {
- return num + Number(cur.totalPrice);
- }, 0);
- info?.redressProductList.forEach((item) => {
- item.discountSinglePrice =
- item.discountSinglePrice || item.singlePrice;
- item.discountTotalPrice = item.discountTotalPrice || item.totalPrice;
- });
- let discountTotalPrice = info?.redressProductList.reduce((num, cur) => {
- return num + Number(cur.discountTotalPrice);
- }, 0);
- let form = {
- contractVO: {
- ...this.form,
- partaName: cusInfo.base.name,
- partaId: cusInfo.base.id,
- partaUnifiedSocialCreditCode: cusInfo.base.unifiedSocialCreditCode,
- partaAddress: cusInfo.base.addressName + cusInfo.base.address,
- partaLinkName: cusInfo.linkList[0]?.linkName,
- partaLinkId: cusInfo.linkList[0]?.id,
- partaTel: cusInfo.linkList[0]?.mobilePhone,
- totalPrice: totalPrice,
- discountTotalPrice: discountTotalPrice
- },
- productList: info.redressProductList || []
- };
- this.setValue(form);
- },
- //获取退货单详情
- async getReturnOrderDetail(id) {
- return Promise.resolve(await getReturnSaleOrderrecordDetail(id));
- },
- //查找合同分类对应name
- findNameById(tree, targetId) {
- for (let i = 0; i < tree.length; i++) {
- const node = tree[i];
- if (node.id === targetId) {
- return node.name;
- }
- if (node.children && node.children.length > 0) {
- const name = this.findNameById(node.children, targetId);
- if (name) {
- return name;
- }
- }
- }
- return null;
- },
- // 日期范围变化
- settlementDateChange(val) {
- console.log(val, this.form.settlementDate);
- let dateRange = [];
- if(this.form.settlementMode == 1) {
- // // this.transformDays(val)
- dateRange = this.transformDaysFun(val);
- }
- if(this.form.settlementMode == 2) {
- // // this.transformMonth(val)
- dateRange = this.transformMonthFun(val, this.form.receiptDate);
- }
- // console.log('dateRange~~~', dateRange);
- this.$set(this.form, 'issueNumber', dateRange.length);
- // this.setDefaultList(dateRange)
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
- },
- // 收款日变化
- receiptDateChange(v) {
- console.log('v~~~', v, this.form.settlementDate, this.form.issueNumber);
- // this.transformMonth(this.form.settlementDate)
- if(this.form.settlementDate.length > 0 && this.form.issueNumber) {
- const dateRange = this.transformMonthFun(this.form.settlementDate, v);
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
- }
- },
- // 期数变化
- issueNumberChange(v) {
- let dateRange = [];
- if(this.form.settlementMode == 1) {
- dateRange = this.transformDaysFun(this.form.settlementDate, v);
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange);
- } else if(this.form.settlementMode == 2) {
- dateRange = this.transformMonthFun(this.form.settlementDate, v);
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange);
- } else {
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v);
- }
- },
- transformDaysFun(date) {
- const startDate = new Date(date[0]);
- const endDate = new Date(date[1]);
- // 计算毫秒差并转换为天数,使用Math.ceil确保结果为整数
- const days = Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24)) + 1;
- console.log('包含两头的天数:', days);
- // 生成包括头尾在内的所有日期
- const allDates = [];
- const current = new Date(startDate);
-
- // 遍历从开始日期到结束日期的所有天数
- while (current <= endDate) {
- // 格式化日期为YYYY-MM-dd
- const year = current.getFullYear();
- const month = current.getMonth() + 1; // 月份从0开始,需要+1
- const day = current.getDate();
-
- const formattedMonth = String(month).padStart(2, '0');
- const formattedDay = String(day).padStart(2, '0');
- const formattedDateStr = `${year}-${formattedMonth}-${formattedDay}`;
-
- allDates.push(formattedDateStr);
-
- // 移动到下一天
- current.setDate(current.getDate() + 1);
- }
- return allDates;
- },
- transformMonthFun(date, day) {
- console.log('date~~~', date, day);
- // 处理月份数据(转换为Date对象)
- const parseMonthDate = (dateStr) => {
- return dateStr instanceof Date ? dateStr : new Date(dateStr + '-01');
- };
-
- const start = parseMonthDate(date[0]);
- const end = parseMonthDate(date[1]);
-
- // 先生成所有月份的日期数组
- const allMonthDates = [];
- const currentDate = new Date(start);
-
- // 遍历从开始月份到结束月份的所有月份
- while (currentDate <= end) {
- const year = currentDate.getFullYear();
- const month = currentDate.getMonth() + 1; // 月份从0开始,需要+1
- const receiptDate = day;
-
- // 格式化日期为YYYY-MM-dd
- const formattedMonth = String(month).padStart(2, '0');
- const formattedDate = String(receiptDate).padStart(2, '0');
- const deadLine = receiptDate ? `${year}-${formattedMonth}-${formattedDate}` : '';
-
- allMonthDates.push(deadLine);
-
- // 使用Date对象的setMonth方法正确移动到下一个月(自动处理年份变化)
- currentDate.setMonth(currentDate.getMonth() + 1);
- }
- return allMonthDates;
- },
- }
- };
- </script>
- <style scoped lang="scss">
- .TotalAmount {
- font-size: 16px;
- padding-right: 30px;
- }
- </style>
|