12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060 |
- <template>
- <div class="tenant">
- <div class="content">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- highlight-current-row
- :selectConfig="selectConfig"
- :table-events="{
- //element talbe事件都能传
- }"
- :action-list="[]"
- @get-list="getList"
- @moreSearch="() => (dialogVisibleThree = true)"
- >
- <template #contractCode="{ item }">
- <div
- style="cursor: pointer; color: #409eff"
- @click="handleClickContractCode(item)"
- >
- {{ item.contractCode }}
- </div>
- </template>
- <template #arrivalStatus="{ item }">
- <span
- style="cursor: pointer; color: #409eff"
- @click="handleClickArrivalStatus(item)"
- >
- {{ dictValueLabel(item.arrivalStatus, arrivalStatus) }}
- </span>
- <span v-if="item.isTransit == 1">(有在途)</span>
- </template>
- <template #btn="{ item }">
- <div>
- <el-button type="primary" link @click="handleUpdateData(item)"
- >修改</el-button
- >
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog
- :title="modalType === 'add' ? '发货登记' : '到货通知'"
- v-model="dialogVisible"
- width="80%"
- destroy-on-close
- >
- <byForm
- :formConfig="formConfig"
- :formOption="formOption"
- v-model="formData.data"
- :rules="rules"
- ref="byform"
- v-loading="submitLoading"
- >
- <template #detailSlot>
- <div style="width: 100%">
- <el-table
- :data="
- modalType === 'add'
- ? formData.data.deliverGoodsDetailsList
- : formData.data.arrivalDetailList
- "
- >
- <el-table-column
- prop="productDefinition"
- label="物品类型"
- :formatter="
- (row) =>
- row.productDefinition == 1
- ? '产品'
- : row.productDefinition == 2
- ? '物料'
- : ''
- "
- />
- <el-table-column prop="productCode" label="物品编码" />
- <el-table-column prop="productName" label="物品名称" />
- <el-table-column prop="productSpec" label="规格" />
- <el-table-column
- prop="productUnit"
- label="单位"
- :formatter="
- (row) => dictValueLabel(row.productUnit, productUnit)
- "
- />
- <el-table-column prop="count" label="采购数量" />
- <el-table-column
- prop="alreadyDeliverGoodsQuantity"
- label="累计发货"
- v-if="modalType === 'add'"
- />
- <el-table-column
- prop="deliverGoodsQuantity"
- label="本次发货"
- min-width="150"
- v-if="modalType === 'add'"
- >
- <template #default="{ row, $index }">
- <el-form-item
- :prop="
- 'deliverGoodsDetailsList.' +
- $index +
- '.deliverGoodsQuantity'
- "
- :rules="rules.deliverGoodsQuantity"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.deliverGoodsQuantity"
- :precision="2"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- prop="transitQuantity"
- label="剩余在途"
- v-if="modalType === 'edit'"
- />
- <el-table-column
- prop="deliverGoodsQuantity"
- label="本次到货"
- min-width="150"
- v-if="modalType === 'edit'"
- >
- <template #default="{ row, $index }">
- <el-form-item
- :prop="
- 'arrivalDetailList.' + $index + '.deliverGoodsQuantity'
- "
- :rules="rules.deliverGoodsQuantity"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.deliverGoodsQuantity"
- :precision="2"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- />
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisible = false" size="large">取 消</el-button>
- <el-button
- type="primary"
- @click="submitForm()"
- size="large"
- :loading="submitLoading"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- <el-dialog
- :title="'到货详情'"
- v-model="dialogVisibleOne"
- width="80%"
- destroy-on-close
- >
- <byForm
- :formConfig="formConfigOne"
- :formOption="formOption"
- v-model="formData.dataOne"
- :rules="rules"
- ref="byformOne"
- >
- <template #detailSlot>
- <div style="width: 100%">
- <el-table :data="formData.dataOne.purchaseDetailVoList">
- <el-table-column prop="productCustomCode" label="物品编码" />
- <el-table-column prop="productName" label="物品名称" />
- <el-table-column prop="count" label="采购数量" />
- <el-table-column prop="deliverGoodsQuantity" label="已发货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="发货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.deliverGoodsDetailList">
- <el-table-column
- label="发货时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="物流单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="deliverGoodsQuantity"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.deliverGoodsQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <!-- <el-table-column prop="arrivalQuantity" label="已到货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="到货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.arrivalDetailList">
- <el-table-column
- label="到货时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="物流单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="count"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.arrivalQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column> -->
- <el-table-column prop="receiptQuantity" label="已入库">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="入库详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.receiptList">
- <el-table-column
- label="入库时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="入库单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="quantity"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.receiptQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="purchaseBackQuantity" label="退货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="退货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.purchaseBackDetailsList">
- <el-table-column
- label="申请时间"
- prop="createTime"
- width="155"
- />
- <el-table-column label="申请数量" prop="quantity" />
- <el-table-column
- label="已退数量"
- prop="returnedQuantity"
- />
- <el-table-column
- label="操作"
- width="90"
- align="center"
- >
- <template #default="{ row, $index }">
- <el-button
- type="primary"
- text
- @click="handleClickStatus(row)"
- >查看关联</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.purchaseBackQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="qualityQuantity" label="已质检数量" />
- <el-table-column prop="noQualifiedCount" label="不合格数量" />
- </el-table>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisibleOne = false" size="large"
- >取 消</el-button
- >
- </template>
- </el-dialog>
- <el-dialog
- :title="'采购退货'"
- v-model="dialogVisibleTwo"
- width="60%"
- destroy-on-close
- >
- <byForm
- :formConfig="formConfigTwo"
- :formOption="formOption"
- v-model="formData.dataTwo"
- :rules="rulesTwo"
- ref="byformTwo"
- v-loading="loadingTwo"
- >
- <template #detailSlot>
- <div style="width: 100%">
- <el-table :data="formData.dataTwo.purchaseBackDetailsList">
- <el-table-column
- prop="subscribeCode"
- label="申购单号"
- width="110"
- />
- <el-table-column
- prop="planArrivalTime"
- label="要求到货时间"
- width="160"
- />
- <el-table-column
- prop="productCustomCode"
- label="物品编码"
- width="110"
- />
- <el-table-column
- prop="productName"
- label="物品名称"
- width="160"
- />
- <el-table-column
- prop="productUnit"
- label="物品单位"
- width="80"
- :formatter="
- (row) => dictValueLabel(row.productUnit, productUnit)
- "
- />
- <el-table-column
- prop="price"
- label="单价"
- width="60"
- :formatter="
- (row) => dictValueLabel(row.productUnit, productUnit)
- "
- />
- <el-table-column prop="count" label="采购数量" width="100" />
- <el-table-column
- prop="defectiveQuantity"
- label="次品数量"
- width="100"
- />
- <el-table-column
- prop="quantity"
- label="退货数量"
- min-width="150"
- fixed="right"
- >
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'purchaseBackDetailsList.' + $index + '.quantity'"
- :rules="rulesTwo.quantity"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.quantity"
- :precision="0"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- />
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #countryId>
- <div>
- <el-select
- v-model="formData.dataTwo.countryId"
- placeholder="国家"
- @change="(val) => getCityData(val, '20', true)"
- style="width: 100%"
- >
- <el-option
- v-for="item in countryData"
- :label="item.chineseName"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </div>
- </template>
- <template #provinceId>
- <div style="width: 100%">
- <selectCity
- placeholder="省/洲"
- @change="(val) => getCityData(val, '30', true)"
- addressId="provinceId"
- addressName="provinceName"
- v-model="formData.dataTwo"
- :data="provinceData"
- >
- </selectCity>
- </div>
- </template>
- <template #cityId>
- <div style="width: 100%">
- <selectCity
- placeholder="城市"
- addressId="cityId"
- addressName="cityName"
- v-model="formData.dataTwo"
- :data="cityData"
- >
- </selectCity>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisibleTwo = false" size="large"
- >取 消</el-button
- >
- <el-button
- type="primary"
- @click="submitFormTwo()"
- size="large"
- :loading="loadingTwo"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- <el-dialog
- :title="'高级检索'"
- v-model="dialogVisibleThree"
- width="500px"
- destroy-on-close
- >
- <el-form
- :model="sourceList.pagination"
- label-width="100px"
- label-position="top"
- >
- <el-form-item label="采购单号">
- <el-input
- v-model="sourceList.pagination.contractCode"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="供应商">
- <el-select
- v-model="sourceList.pagination.supplyId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in supplierData"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="收货仓库">
- <el-select
- v-model="sourceList.pagination.receiptWarehouseId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in warehouseList"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="采购金额">
- <el-row>
- <el-col :span="8">
- <el-input-number
- v-model="sourceList.pagination.startAmount"
- placeholder="请输入"
- :controls="false"
- :min="1"
- :precision="2"
- style="width: 100%"
- onmousewheel="return false;"
- />
- </el-col>
- <el-col :span="2" style="text-align: center"> 到 </el-col>
- <el-col :span="8">
- <el-input-number
- v-model="sourceList.pagination.endAmount"
- placeholder="请输入"
- :controls="false"
- :min="1"
- :precision="2"
- style="width: 100%"
- onmousewheel="return false;"
- />
- </el-col>
- </el-row>
- </el-form-item>
- <el-form-item label="采购人">
- <el-select
- v-model="sourceList.pagination.purchaseUserId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in userList"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="采购时间">
- <!-- <el-date-picker
- v-model="sourceList.pagination.arr"
- type="datetimerange"
- range-separator="到"
- start-placeholder="请选择"
- end-placeholder="请选择"
- /> -->
- <el-date-picker
- v-model="sourceList.pagination.arr"
- type="daterange"
- range-separator="到"
- start-placeholder="请选择"
- end-placeholder="请选择"
- value-format="YYYY-MM-DD HH:mm:ss"
- />
- </el-form-item>
- <el-row>
- <el-col :span="7">
- <el-form-item label="采购状态">
- <el-select
- v-model="sourceList.pagination.purchaseStatus"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in statusData"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1"></el-col>
- <el-col :span="7">
- <el-form-item label="到货状态">
- <el-select
- v-model="sourceList.pagination.arrivalStatus"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in arrivalStatus"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1"></el-col>
- <el-col :span="7">
- <el-form-item label="付款状态">
- <el-select
- v-model="sourceList.pagination.payStatus"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in paymentStatus"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <template #footer>
- <el-button @click="handleReset" size="large">重置</el-button>
- <el-button @click="handleQuery" type="primary" size="large"
- >搜索</el-button
- >
- </template>
- </el-dialog>
- <el-dialog
- :title="'查看'"
- v-model="recordDialog"
- width="900"
- destroy-on-close
- >
- <byForm
- :formConfig="recordFormConfig"
- :formOption="recordFormOption"
- v-model="recordFormData.data"
- >
- <template #products>
- <div style="width: 100%">
- <el-table :data="recordFormData.data.list">
- <el-table-column
- prop="logisticsCompanyName"
- label="物流/快递公司"
- />
- <el-table-column prop="code" label="物流/快递单号" />
- <el-table-column
- prop="logisticsStatus"
- label="物流状态"
- width="100"
- :formatter="(row) => handleShowKdStatus(row.logisticsStatus)"
- />
- <el-table-column prop="createTime" label="创建时间" width="155" />
- <el-table-column label="操作" width="90" align="center">
- <template #default="{ row, $index }">
- <el-button type="primary" text @click="pushKdRoute(row)"
- >查看</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="recordDialog = false" size="large">取 消</el-button>
- </template>
- </el-dialog>
- <!-- <el-drawer v-model="dialogVisibleThree" direction="rtl">
- <template #header>
- <h4>高级检索</h4>
- </template>
- <template #default>
- <byForm
- :formConfig="formConfig"
- :formOption="ListOption"
- v-model="sourceList.pagination"
- >
- <template #slot> 可自定义所需功能 </template>
- </byForm>
- </template>
- <template #footer>
- <div style="flex: auto">
- <el-button @click="handleReset" size="large">重置</el-button>
- <el-button @click="handleQuery" type="primary" size="large"
- >搜索</el-button
- >
- </div>
- </template>
- </el-drawer> -->
- <el-dialog
- :title="'修改合同'"
- v-model="purchaseDialog"
- width="1200"
- destroy-on-close
- >
- <byForm
- :formConfig="purchaseFormConfig"
- :formOption="formOption"
- v-model="formData.purchaseData"
- :rules="purchaseFormRules"
- ref="purchaseDom"
- >
- <template #details>
- <div style="width: 100%">
- <el-table :data="formData.purchaseData.purchaseDetailList">
- <el-table-column
- prop="productDefinition"
- label="物品类型"
- :formatter="
- (row) =>
- row.productDefinition == 1
- ? '产品'
- : row.productDefinition == 2
- ? '物料'
- : ''
- "
- width="100"
- />
- <el-table-column
- prop="productCustomCode"
- label="物品编码"
- min-width="150"
- />
- <el-table-column
- prop="productName"
- label="物品名称"
- min-width="160"
- />
- <el-table-column
- prop="productUnit"
- label="单位"
- :formatter="
- (row) => dictValueLabel(row.productUnit, productUnit)
- "
- width="80"
- />
- <el-table-column prop="count" label="采购数量" width="100" />
- <el-table-column prop="price" label="单价" min-width="150">
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'purchaseDetailList.' + $index + '.price'"
- :rules="purchaseFormRules.price"
- :inline-message="true"
- >
- <el-input-number
- :model-value="
- formData.purchaseData.purchaseDetailList[$index].price
- "
- :precision="4"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- @change="(val) => handleChangeMoney(val, $index, 'price')"
- />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop="amount" label="金额" width="120" />
- </el-table>
- </div>
- </template>
- <template #otherDetails>
- <div style="width: 100%">
- <el-table :data="formData.purchaseData.otherFeeList">
- <el-table-column prop="name" label="费用名称" min-width="150">
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'otherFeeList.' + $index + '.name'"
- :rules="purchaseFormRules.name"
- :inline-message="true"
- >
- <el-input v-model="row.name" placeholder="请输入" />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop="price" label="金额" min-width="150">
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'otherFeeList.' + $index + '.price'"
- :rules="purchaseFormRules.price"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.price"
- :precision="4"
- :controls="false"
- onmousewheel="return false;"
- @change="handleChangeAmount"
- />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop="remark" label="备注" min-width="150">
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'otherFeeList.' + $index + '.remark'"
- :inline-message="true"
- >
- <el-input v-model="row.remark" placeholder="请输入" />
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #fileSlot>
- <div style="width: 100%">
- <el-upload
- v-model:fileList="fileList"
- action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :data="uploadData"
- multiple
- :before-upload="handleBeforeUpload"
- :on-success="handleSuccess"
- :on-preview="onPreviewFile"
- >
- <el-button disabled>选择</el-button>
- </el-upload>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="purchaseDialog = false" size="large"
- >取 消</el-button
- >
- <el-button
- type="primary"
- @click="submitUpdate()"
- size="large"
- :loading="loadingTwo"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- </div>
- </template>
-
- <script setup>
- import { ElMessage, ElMessageBox } from "element-plus";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import { computed } from "vue";
- import selectCity from "@/components/selectCity/index.vue";
- import useUserStore from "@/store/modules/user";
- const loading = ref(false);
- const loadingTwo = ref(false);
- const submitLoading = ref(false);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 3,
- pageNum: 1,
- pageSize: 10,
- arr: [],
- },
- });
- const dialogVisible = ref(false);
- const dialogVisibleOne = ref(false);
- const dialogVisibleTwo = ref(false);
- const dialogVisibleThree = ref(false);
- const modalType = ref("add");
- let rules = ref({
- deliverGoodsId: [
- { required: true, message: "请选择快递单号", trigger: "change" },
- ],
- logisticsCompanyCode: [
- { required: true, message: "请选择物流公司", trigger: "change" },
- ],
- code: [{ required: true, message: "请输入物流/快递单号", trigger: "blur" }],
- deliverGoodsQuantity: [
- { required: true, message: "请输入本次发货", trigger: "blur" },
- ],
- aa: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
- });
- let rulesTwo = ref({
- contacts: [{ required: true, message: "请输入收件人", trigger: "blur" }],
- phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
- countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
- quantity: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
- detailedAddress: [
- { required: true, message: "请输入详细地址", trigger: "blur" },
- ],
- });
- const { proxy } = getCurrentInstance();
- const arrivalStatus = [
- {
- label: "未到货",
- value: "0",
- },
- {
- label: "部分到货",
- value: "10",
- },
- {
- label: "已到货",
- value: "20",
- },
- ];
- const statusData = ref([
- {
- label: "审批中",
- value: "10",
- },
- {
- label: "驳回",
- value: "20",
- },
- {
- label: "已采购",
- value: "30",
- },
- {
- label: "结束",
- value: "99",
- },
- {
- label: "已作废",
- value: "88",
- },
- ]);
- const paymentStatus = ref([
- {
- label: "未付款",
- value: "0",
- },
- {
- label: "部分付款",
- value: "10",
- },
- {
- label: "已付款",
- value: "20",
- },
- {
- label: "付款结束",
- value: "30",
- },
- ]);
- const inRransitData = ref([
- {
- label: "有在途",
- value: "1",
- },
- {
- label: "无在途",
- value: "0",
- },
- ]);
- const deptData = ref([]);
- const selectConfig = computed(() => [
- {
- label: "采购状态",
- prop: "purchaseStatus",
- data: statusData.value,
- },
- {
- label: "到货状态",
- prop: "arrivalStatus",
- data: arrivalStatus,
- },
- {
- label: "付款状态",
- prop: "payStatus",
- data: paymentStatus.value,
- },
- {
- label: "有无在途",
- prop: "isTransit",
- data: inRransitData.value,
- },
- {
- label: "项目组",
- prop: "deptId",
- data: deptData.value,
- },
- ]);
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "采购单号",
- prop: "contractCode",
- slot: "contractCode",
- },
- },
- {
- attrs: {
- label: "供应商",
- prop: "supplyName",
- },
- },
- {
- attrs: {
- label: "收货仓库",
- prop: "receiptWarehouseName",
- width: 140,
- },
- },
- {
- attrs: {
- label: "采购金额",
- prop: "amount",
- width: 120,
- },
- render(amount) {
- return proxy.moneyFormat(amount, 2);
- },
- },
- {
- attrs: {
- label: "采购人",
- prop: "purchaseName",
- width: 130,
- },
- },
- {
- attrs: {
- label: "项目组",
- prop: "deptName",
- width: 150,
- },
- },
- {
- attrs: {
- label: "采购时间",
- prop: "createTime",
- width: 160,
- },
- },
- {
- attrs: {
- label: "采购状态",
- prop: "purchaseStatus",
- width: 100,
- },
- render(status) {
- const current = statusData.value.find((x) => x.value == status);
- if (current) return current.label;
- },
- },
- {
- attrs: {
- label: "到货状态",
- prop: "arrivalStatus",
- slot: "arrivalStatus",
- width: 100,
- },
- },
- {
- attrs: {
- label: "付款状态",
- prop: "payStatus",
- width: 100,
- },
- render(status) {
- return proxy.dictValueLabel(status, paymentStatus.value);
- },
- },
- {
- attrs: {
- label: "操作",
- slot: "btn",
- width: "80",
- align: "center",
- fixed: "right",
- },
- },
- ];
- });
- let formData = reactive({
- data: {},
- dataOne: {},
- dataTwo: {},
- purchaseData: {},
- });
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- });
- const byform = ref(null);
- const byformTwo = ref(null);
- let formConfig = reactive([]);
- let formConfigOne = computed(() => [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "title",
- title: "采购明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- ]);
- let formConfigTwo = computed(() => [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "title",
- title: "采购明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- {
- type: "title",
- title: "收货信息",
- },
- {
- type: "input",
- prop: "contacts",
- label: "收件人",
- itemWidth: 20,
- placeholder: "收件人",
- },
- {
- type: "input",
- prop: "phone",
- label: " ",
- itemWidth: 80,
- placeholder: "联系电话",
- style: {
- width: "30%",
- },
- },
- {
- type: "slot",
- slotName: "countryId",
- prop: "countryId",
- label: "收件地址",
- itemWidth: 33.33,
- },
- {
- type: "slot",
- slotName: "provinceId",
- label: " ",
- itemWidth: 33.33,
- },
- {
- type: "slot",
- slotName: "cityId",
- prop: "cityId",
- label: " ",
- itemWidth: 33.33,
- },
- {
- type: "input",
- itemType: "textarea",
- prop: "detailedAddress",
- },
- ]);
- const logisticsData = ref([]);
- const getLogisticsData = (row) => {
- proxy.post("/companyInfo/list", { pageNum: 1, pageSize: 999 }).then((res) => {
- logisticsData.value = res.reverse();
- logisticsData.value = logisticsData.value.map((x) => ({
- label: x.name,
- value: x.code,
- }));
- });
- };
- const configData = computed(() => [
- [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "select",
- label: "物流信息",
- prop: "logisticsCompanyCode",
- filterable: true,
- data: logisticsData.value,
- itemWidth: 50,
- style: {
- width: "100%",
- },
- },
- {
- type: "input",
- label: " ",
- prop: "code",
- placeholder: "物流/快递单号",
- itemWidth: 50,
- },
- {
- type: "title",
- title: "发货明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- ],
- [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "select",
- label: "物流/快递单号",
- prop: "deliverGoodsId",
- itemWidth: 50,
- style: {
- width: "100%",
- },
- },
- {
- type: "title",
- title: "发货明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- ],
- ]);
- const deliverData = ref([]);
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy
- .post("/purchase/pageByWdly", sourceList.value.pagination)
- .then((message) => {
- sourceList.value.data = message.rows.map((x) => ({
- ...x,
- ...JSON.parse(x.victoriatouristJson),
- }));
- sourceList.value.pagination.total = message.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const submitForm = () => {
- byform.value.handleSubmit((valid) => {
- if (modalType.value === "add") {
- const list = formData.data.deliverGoodsDetailsList;
- const total = list.reduce(
- (total, x) => (total += Number(x.deliverGoodsQuantity)),
- 0
- );
- if (!(total > 0)) {
- return ElMessage({
- message: `本次发货不能为0!`,
- type: "info",
- });
- }
- // for (let i = 0; i < list.length; i++) {
- // const e = list[i];
- // if (
- // Number(e.alreadyDeliverGoodsQuantity) +
- // Number(e.deliverGoodsQuantity) >
- // Number(e.count)
- // ) {
- // return ElMessage({
- // message: `本次发货加累计发货不可大于采购数量!`,
- // type: "info",
- // });
- // }
- // }
- submitLoading.value = true;
- formData.data.deliverGoodsDetailsList = list.map((x) => ({
- purchaseDetailId: x.purchaseDetailId,
- deliverGoodsQuantity: x.deliverGoodsQuantity,
- }));
- proxy.post("/deliverGoods/add", formData.data).then((res) => {
- ElMessage({
- message: `操作成功!`,
- type: "success",
- });
- dialogVisible.value = false;
- submitLoading.value = false;
- getList();
- });
- } else if (modalType.value === "edit") {
- submitLoading.value = true;
- formData.data.arrivalDetailList = formData.data.arrivalDetailList.map(
- (x) => ({
- bussinessId: x.bussinessId,
- purchaseDetailId: x.purchaseDetailId,
- deliverGoodsDetailsId: x.deliverGoodsDetailsId,
- count: x.deliverGoodsQuantity,
- })
- );
- const victoriatouristJson = {
- deliverGoodsId: formData.data.deliverGoodsId,
- logisticsCompanyCode: formData.data.logisticsCompanyCode,
- code: formData.data.code,
- };
- formData.data.victoriatouristJson = JSON.stringify(victoriatouristJson);
- proxy.post("/arrival/addByWdly", formData.data).then((res) => {
- ElMessage({
- message: `操作成功!`,
- type: "success",
- });
- dialogVisible.value = false;
- submitLoading.value = false;
- getList();
- });
- }
- });
- };
- const submitFormTwo = () => {
- byformTwo.value.handleSubmit((valid) => {
- loadingTwo.value = true;
- let submitData = { ...formData.dataTwo };
- submitData.purchaseBackDetailsList = submitData.purchaseBackDetailsList.map(
- (x) => ({
- purchaseDetailsId: x.id,
- productId: x.bussinessId,
- quantity: x.quantity,
- })
- );
- proxy.post("/purchaseBack/add", submitData).then(
- (res) => {
- ElMessage({
- message: `操作成功!`,
- type: "success",
- });
- dialogVisibleTwo.value = false;
- loadingTwo.value = false;
- getList();
- },
- (err) => {
- loadingTwo.value = false;
- }
- );
- });
- };
- const getDtl = (row) => {
- modalType.value = "edit";
- proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
- formData.data = res;
- dialogVisible.value = true;
- });
- };
- const handleEdit = (row, status) => {
- let purchaseStatusName = status == 88 ? "作废" : "结束";
- const data = { ...row, purchaseStatus: status };
- // 弹窗提示是否删除
- ElMessageBox.confirm(
- `此操作将${purchaseStatusName}该数据, 是否继续?`,
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- ).then(() => {
- // 删除
- proxy.post("/purchase/edit", data).then((res) => {
- ElMessage({
- message: `${purchaseStatusName}成功`,
- type: "success",
- });
- getList();
- });
- });
- };
- const handleArrival = (row, type) => {
- modalType.value = type;
- if (type === "add") {
- formConfig = configData.value[0];
- proxy.post("/deliverGoodsDetails/detail", { id: row.id }).then((res) => {
- formData.data = {
- purchaseId: row.id,
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- supplyId: res.supplyId,
- code: "",
- logisticsCompanyCode: "",
- deliverGoodsDetailsList: res.map((x) => ({
- ...x,
- purchaseDetailId: x.id,
- alreadyDeliverGoodsQuantity: x.deliverGoodsQuantity,
- deliverGoodsQuantity:
- Number(x.count) - Number(x.deliverGoodsQuantity),
- })),
- };
- dialogVisible.value = true;
- });
- } else if (type === "edit") {
- formConfig = configData.value[1];
- proxy.post("/deliverGoods/list", { id: row.id }).then((res) => {
- deliverData.value = res;
- formConfig[3].data = res.map((x) => ({
- ...x,
- label: x.code,
- value: x.id,
- }));
- formData.data = {
- purchaseId: row.id,
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- supplyId: row.supplyId,
- code: "",
- logisticsCompanyCode: "",
- deliverGoodsId: "",
- arrivalDetailList: [],
- };
- dialogVisible.value = true;
- });
- }
- };
- watch(
- () => formData.data.deliverGoodsId,
- (val) => {
- if (val) {
- const current = deliverData.value.find((x) => x.id === val);
- formData.data.logisticsCompanyCode = current
- ? current.logisticsCompanyCode
- : "";
- formData.data.code = current ? current.code : "";
- proxy.post("/deliverGoods/detail", { id: val }).then((res) => {
- formData.data.arrivalDetailList = res.map((x) => ({
- count: x.count,
- productName: x.name,
- productSpec: x.spec,
- productUnit: x.unit,
- productType: x.type,
- productCode: x.code,
- bussinessId: x.productId,
- purchaseDetailId: x.purchaseDetailId,
- deliverGoodsDetailsId: x.id,
- transitQuantity: x.transitQuantity,
- deliverGoodsQuantity: x.deliverGoodsQuantity,
- productDefinition: x.definition,
- }));
- });
- }
- }
- );
- const handleClickContractCode = (row) => {
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: row.processInstanceId,
- id: row.flowId,
- businessId: row.id,
- processType: 20,
- random: proxy.random(),
- },
- });
- };
- const handleClickArrivalStatus = (row) => {
- proxy
- .post("/deliverGoods/arrivalDetail", { purchaseId: row.id })
- .then((res) => {
- formData.dataOne = {
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- purchaseDetailVoList: res.purchaseDetailVoList,
- };
- dialogVisibleOne.value = true;
- });
- };
- const handleReturnGoods = (row) => {
- proxy.post("/purchase/detail", { id: row.id }).then((res) => {
- formData.dataTwo = {
- purchaseId: row.id,
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- countryId: "44",
- purchaseBackDetailsList: res.purchaseDetailList.map((x) => ({
- ...x,
- planArrivalTime: res.planArrivalTime,
- subscribeCode: res.subscribeCode,
- })),
- };
- getCityData(formData.dataTwo.countryId, "20");
- dialogVisibleTwo.value = true;
- });
- };
- const countryData = ref([]);
- const provinceData = ref([]);
- const cityData = ref([]);
- const getCityData = (id, type, flag) => {
- proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
- if (type === "20") {
- provinceData.value = res;
- if (flag) {
- formData.data.provinceId = "";
- formData.data.provinceName = "";
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else if (type === "30") {
- cityData.value = res;
- if (flag) {
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else {
- countryData.value = res;
- }
- });
- };
- const productUnit = ref([]);
- const fundsPaymentMethod = ref([]);
- const supplierData = ref([]);
- const warehouseList = ref([]);
- const userList = ref([]);
- const getDict = () => {
- proxy.getDictOne(["unit", "funds_payment_method"]).then((res) => {
- productUnit.value = res["unit"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- });
- proxy
- .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
- .then((res) => {
- supplierData.value = res.rows;
- });
- proxy.get("/purchase/getDepts").then((res) => {
- deptData.value = res.data.map((x) => ({
- ...x,
- label: x.deptName,
- value: x.deptId,
- }));
- });
- proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- warehouseList.value = res.rows.map((item) => {
- return {
- label: item.name,
- value: item.id,
- };
- });
- }
- });
- proxy
- .get("/tenantUser/list", {
- pageNum: 1,
- pageSize: 10000,
- tenantId: useUserStore().user.tenantId,
- })
- .then((res) => {
- userList.value = res.rows.map((item) => {
- return {
- label: item.nickName,
- value: item.userId,
- };
- });
- });
- };
- getCityData("0");
- getList();
- getLogisticsData();
- getDict();
- const handleQuery = () => {
- if (
- sourceList.value.pagination.arr &&
- sourceList.value.pagination.arr.length > 1
- ) {
- sourceList.value.pagination.purchaseStartTime =
- sourceList.value.pagination.arr[0];
- sourceList.value.pagination.purchaseEndTime =
- sourceList.value.pagination.arr[1];
- }
- dialogVisibleThree.value = false;
- getList();
- };
- const handleReset = () => {
- sourceList.value.pagination = {
- pageNum: sourceList.value.pagination.pageNum,
- pageSize: sourceList.value.pagination.pageSize,
- arr: [],
- };
- handleQuery();
- };
- const kdStatusData = ref([
- {
- label: "在途",
- value: "0",
- },
- {
- label: "揽收",
- value: "1",
- },
- {
- label: "疑难",
- value: "2",
- },
- {
- label: "签收",
- value: "3",
- },
- {
- label: "退签",
- value: "4",
- },
- {
- label: "派件",
- value: "5",
- },
- {
- label: "退回",
- value: "6",
- },
- {
- label: "转投",
- value: "7",
- },
- {
- label: "清关",
- value: "8",
- },
- {
- label: "拒签",
- value: "14",
- },
- {
- label: "完成",
- value: "15",
- },
- ]);
- const recordDialog = ref(false);
- const recordFormOption = reactive({
- disabled: false,
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const recordFormConfig = reactive([
- {
- type: "title",
- title: "物流数据",
- },
- {
- type: "slot",
- slotName: "products",
- },
- ]);
- const recordFormData = reactive({
- data: {
- list: [],
- },
- });
- const handleClickStatus = (row) => {
- recordDialog.value = true;
- proxy
- .post("/purchaseBack/getLogisticsInfo", { id: row.purchaseBackId })
- .then((res) => {
- recordFormData.data.list = res;
- });
- };
- const handleShowKdStatus = (status) => {
- const current = kdStatusData.value.find((x) => x.value === status);
- if (current && current.label) {
- return current.label;
- } else {
- return "异常";
- }
- };
- const pushKdRoute = (row) => {
- proxy.$router.push({
- name: "Logistics",
- query: {
- keyword: row.code,
- },
- });
- };
- const purchaseDialog = ref(false);
- const fileList = ref([]);
- const purchaseDom = ref(null);
- const purchaseFormConfig = computed(() => [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "deptName",
- label: "采购部门",
- disabled: true,
- itemWidth: 25,
- },
- {
- type: "input",
- prop: "purchaseName",
- label: "采购人",
- disabled: true,
- itemWidth: 25,
- },
- {
- type: "date",
- itemType: "datetime",
- prop: "purchaseName",
- label: "采购时间",
- disabled: true,
- itemWidth: 25.01,
- style: {
- width: "100%",
- },
- },
- {
- type: "select",
- label: "供应商",
- prop: "supplyId",
- filterable: true,
- data: supplierData.value,
- disabled: true,
- itemWidth: 25,
- style: {
- width: "100%",
- },
- },
- {
- type: "select",
- label: "是否合同",
- prop: "isAgreement",
- data: [
- {
- label: "是",
- value: "1",
- },
- {
- label: "否",
- value: "0",
- },
- ],
- disabled: true,
- itemWidth: 25,
- style: {
- width: "100%",
- },
- },
- {
- type: "select",
- label: "付款方式",
- prop: "paymentMethod",
- data: fundsPaymentMethod.value,
- itemWidth: 25,
- disabled: true,
- style: {
- width: "100%",
- },
- },
- {
- type: "input",
- label: "采购单号",
- prop: "contractCode",
- disabled: true,
- itemWidth: 25,
- },
- {
- type: "input",
- itemType: "textarea",
- label: "采购说明",
- prop: "purchaseContent",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "title",
- title: "采购明细",
- },
- {
- type: "slot",
- slotName: "details",
- label: "",
- },
- {
- type: "title",
- title: "其他费用",
- },
- {
- type: "slot",
- slotName: "otherDetails",
- label: "",
- },
- {
- type: "number",
- prop: "freight",
- label: "运费",
- itemWidth: 25,
- precision: 2,
- min: -9999999,
- controls: false,
- fn: () => handleChangeAmount(),
- style: {
- width: "100%",
- },
- },
- {
- type: "number",
- prop: "preferential",
- label: "优惠",
- itemWidth: 25,
- precision: 2,
- min: -9999999,
- controls: false,
- fn: () => handleChangeAmount(),
- style: {
- width: "100%",
- },
- },
- {
- type: "input",
- prop: "amount",
- label: "采购总金额",
- disabled: true,
- itemWidth: 100,
- style: {
- width: "25%",
- },
- },
- {
- type: "slot",
- slotName: "fileSlot",
- label: "附件",
- },
- ]);
- const purchaseFormRules = ref({
- name: [{ required: true, message: "请输入费用名称", trigger: "blur" }],
- price: [{ required: true, message: "请输入单价/金额", trigger: "blur" }],
- freight: [{ required: true, message: "请输入运费", trigger: "blur" }],
- preferential: [{ required: true, message: "请输入优惠", trigger: "blur" }],
- });
- const handleUpdateData = (row) => {
- let val = row.id;
- purchaseDialog.value = true;
- proxy
- .post("/purchase/detail", {
- id: val,
- })
- .then((res) => {
- let jsonData = {};
- if (res.victoriatouristJson) {
- jsonData = JSON.parse(res.victoriatouristJson);
- }
- formData.purchaseData = { ...res, ...jsonData };
- formData.purchaseData.purchaseDetailList =
- formData.purchaseData.purchaseDetailList.map((x) => ({
- ...x,
- subscribeCount: x.subscribeQuantity,
- purchaseCount: x.purchaseQuantity,
- }));
- });
- proxy.post("/fileInfo/getList", { businessIdList: [val] }).then((fileObj) => {
- formData.purchaseData.fileList = fileObj[val] || [];
- if (
- formData.purchaseData.fileList &&
- formData.purchaseData.fileList.length > 0
- ) {
- fileList.value = formData.purchaseData.fileList.map((item) => {
- return {
- raw: item,
- name: item.fileName,
- url: item.fileUrl,
- };
- });
- }
- });
- };
- // 计算采购总金额
- const handleChangeAmount = () => {
- let sum = 0;
- for (let i = 0; i < formData.purchaseData.purchaseDetailList.length; i++) {
- const e = formData.purchaseData.purchaseDetailList[i];
- // e.amount = parseFloat(e.count * e.price).toFixed(4);
- sum += Number(e.amount);
- }
- for (let i = 0; i < formData.purchaseData.otherFeeList.length; i++) {
- const e = formData.purchaseData.otherFeeList[i];
- sum += Number(e.price);
- }
- sum += formData.purchaseData.freight;
- sum += formData.purchaseData.preferential;
- formData.purchaseData.amount = parseFloat(sum).toFixed(4);
- };
- const handleChangeMoney = (val, index, key) => {
- formData.purchaseData.purchaseDetailList[index][key] = val;
- for (let i = 0; i < formData.purchaseData.purchaseDetailList.length; i++) {
- formData.purchaseData.purchaseDetailList[i].amount = parseFloat(
- formData.purchaseData.purchaseDetailList[i].count *
- formData.purchaseData.purchaseDetailList[i].price
- ).toFixed(4);
- }
- handleChangeAmount();
- };
- const onPreviewFile = (file) => {
- window.open(file.raw.fileUrl, "_blank");
- };
- const submitUpdate = () => {
- purchaseDom.value.handleSubmit(() => {
- loadingTwo.value = true;
- const data = proxy.deepClone(formData.purchaseData);
- const jsonData = JSON.parse(data.victoriatouristJson);
- const victoriatouristJson = {
- ...jsonData,
- otherFeeList: data.otherFeeList,
- freight: data.freight,
- preferential: data.preferential,
- };
- data.victoriatouristJson = JSON.stringify(victoriatouristJson);
- proxy.post("/purchase/purchaseCorrect", data).then((res) => {
- ElMessage({
- message: `操作成功`,
- type: "success",
- });
- purchaseDialog.value = false;
- loadingTwo.value = false;
- getList();
- });
- });
- };
- </script>
-
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- </style>
|