| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057 |
- <template>
- <trade-card title="商品信息">
- <avue-crud
- ref="crud"
- :data="data"
- :option="tableOption"
- @row-del="rowDel"
- :summary-method="summaryMethod"
- :cell-style="cellStyle"
- v-model="goodsForm"
- :before-close="beforeClose"
- @row-save="handleRowSave"
- @row-update="handleRowUpdate"
- @resetColumn="resetColumn('crud', 'tableOption', 'tableOptionBack', 1)"
- @saveColumn="saveColumn('crud', 'tableOption', 'tableOptionBack', 1)"
- >
- <template slot="menuLeft">
- <el-row>
- <!-- <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addGoods"
- :disabled="detailData.status == 1">导入商品</el-button> -->
- <!-- <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addLibrary"
- :disabled="detailData.status == 1">出口价格库</el-button> -->
- <el-button type="primary" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印 </el-button>
- <el-button type="warning" size="small" @click.stop="savePurchase" :disabled="detailData.status == 1">
- 采购询价
- </el-button>
- <el-button type="warning" size="small" @click.stop="saveShipping" :disabled="detailData.status == 1">
- 船务询价
- </el-button>
- <el-button type="warning" size="small" @click="cnameData">刷新基础资料</el-button>
- <el-button type="success" size="small" @click="calculate(1)" :disabled="detailData.status == 1" :loading="calculateLoading"
- >分摊国内费用
- </el-button>
- <el-button type="success" size="small" @click="calculate(2)" :disabled="detailData.status == 1" :loading="calculateLoading"
- >分摊海运费到单价
- </el-button>
- <el-button type="success" size="small" @click="oceanUSD" :disabled="detailData.status == 1">海运费单列 </el-button>
- <!-- <el-popover placement="top" width="160" v-model="visible">
- <div style="text-align: center;">
- <el-input-number v-model="priceAD" size="small" :controls="false"></el-input-number> %
- </div>
- <div style="text-align: right; margin: 0">
- <el-button size="mini" type="text" @click="visible = false">取消</el-button>
- <el-button size="mini" type="text" @click="submitPriceAD">确定</el-button>
- </div>
- <el-button type="success" size="small" slot="reference"
- :disabled="detailData.status == 1">调整出厂价</el-button>
- </el-popover> -->
- <el-button type="success" size="small" @click="inPriceAD" :disabled="detailData.status == 1">调整出厂价</el-button>
- </el-row>
- </template>
- <template slot="headerSerial">
- <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow" :disabled="detailData.status == 1" circle></el-button>
- </template>
- <template slot="codeHeader" slot-scope="{ column }">
- <span style="color: #409EFF;cursor: pointer" @click.stop="khEdit('cname')">{{ column.label }}</span>
- </template>
- <template slot="orderQuantity" slot-scope="{ row }">
- {{ row.orderQuantity | decimalFormat2 }}
- </template>
- <template slot="amount" slot-scope="{ row }">
- {{ row.amount | decimalFormat2 }}
- </template>
- <template slot="partsCost" slot-scope="{ row }">
- {{ row.partsCost | decimalFormat2 }}
- </template>
- <template slot="partsPrice" slot-scope="{ row }">
- {{ row.partsPrice | decimalFormat2 }}
- </template>
- <template slot="productPrice" slot-scope="{ row }">
- {{ row.productPrice | decimalFormat2 }}
- </template>
- <template slot="outFactoryPrice" slot-scope="{ row }">
- {{ row.outFactoryPrice }}
- </template>
- <template slot="shareAmount" slot-scope="{ row }">
- {{ row.shareAmount | decimalFormat2 }}
- </template>
- <template slot="internationalAmount" slot-scope="{ row }">
- {{ row.internationalAmount | decimalFormat2 }}
- </template>
- <template slot="price" slot-scope="{ row }">
- {{ row.price | decimalFormat2 }}
- </template>
- <template slot="purchaseCost" slot-scope="{ row }">
- {{ row.purchaseCost | decimalFormat2 }}
- </template>
- <template slot="purchaseAmount" slot-scope="{ row }">
- {{ row.purchaseAmount | decimalFormat2 }}
- </template>
- //操作栏
- <template slot="menu" slot-scope="{ row, index }">
- <div style="display:flex;justify-content: center;">
- <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)" :disabled="disabled || detailData.status == 1"
- >{{ row.$cellEdit ? "保存" : "修改" }}
- </el-button>
- <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)" :disabled="detailData.status == 1">删除</el-button>
- <div v-if="!goodsEditShow" style="display:flex;flex-direction: column;justify-content: center;margin-left: 10px;">
- <el-tooltip effect="dark" content="向上移动" placement="top">
- <i v-if="index != 0" :disabled="detailData.status == 1" class="el-icon-arrow-up" @click="moveUp(row, index)" style="color:#409EFF;"></i>
- </el-tooltip>
- <el-tooltip effect="dark" content="向下移动" placement="bottom">
- <i
- v-if="index != data.length - 1"
- :disabled="detailData.status == 1"
- class="el-icon-arrow-down"
- @click="moveDown(row, index)"
- style="color:#409EFF;"
- ></i>
- </el-tooltip>
- </div>
- </div>
- </template>
- //产品名称
- <template slot="cnameForm" slot-scope="{ type, disabled }">
- <span style="display:flex">
- <!-- <el-select v-model="goodsForm.itemId" placeholder="请选择" size="small" filterable
- @change="cnameChange(goodsForm)">
- <el-option v-for="item in goodsoptions" :key="item.itemId" :label="item.cname"
- :value="item.itemId">
- </el-option>
- </el-select> -->
- <dic-select
- v-model="goodsForm.cname"
- placeholder="产品名称"
- key="id"
- label="cname"
- res="records"
- :url="'/blade-mocha-item/pricebank/pageListAllV1?current=1&size=30&billType=CG&statusTime=' + statusTime"
- :filterable="true"
- :remote="true"
- dataName="cname"
- style="width: 100%;"
- :slotRight="true"
- rightLabel="corpName"
- @selectChange="cnameChange('cname', $event)"
- ></dic-select>
- <el-button icon="el-icon-search" size="small" @click="pickGoods"></el-button>
- </span>
- </template>
- //螺纹
- <template slot="remarksOneForm" slot-scope="{ type, disabled }">
- <el-select v-model="goodsForm.remarksOne" placeholder="请选择" size="small" :disabled="disabled" @change="propsChange(goodsForm)">
- <el-option v-for="item in ThreadList" :key="item.id" :label="item.dictValue" :value="item.dictValue"> </el-option>
- </el-select>
- </template>
- //介质
- <template slot="customTwoForm" slot-scope="{ type, disabled }">
- <el-select v-model="goodsForm.customTwo" placeholder="请选择" size="small" :disabled="disabled" @change="propsChange(goodsForm)">
- <el-option v-for="item in mediumList" :key="item.id" :label="item.dictValue" :value="item.dictValue"> </el-option>
- </el-select>
- </template>
- //颜色
- <template slot="customThreeForm" slot-scope="{ type, disabled }">
- <el-select v-model="goodsForm.customThree" placeholder="请选择" size="small" :disabled="disabled" @change="propsChange(goodsForm)">
- <el-option v-for="item in colorList" :key="item.id" :label="item.dictValue" :value="item.dictValue"> </el-option>
- </el-select>
- </template>
- //电压
- <template slot="customFourForm" slot-scope="{ type, disabled }">
- <el-select v-model="goodsForm.customFour" placeholder="请选择" size="small" :disabled="disabled" @change="propsChange(goodsForm)">
- <el-option v-for="item in stencilList" :key="item.id" :label="item.dictValue" :value="item.dictValue"> </el-option>
- </el-select>
- </template>
- //产品属性
- <template slot="itemPropForm" slot-scope="{ type, disabled }">
- <el-input type="textarea" :rows="2" v-model="goodsForm.itemProp" size="small" placeholder="" @change="editChange(goodsForm)"> </el-input>
- </template>
- //阀门配件
- <template slot="partsValveNameForm" slot-scope="{ type, disabled }">
- <div style="display:flex;">
- <el-input v-model="goodsForm.partsValveName" size="small" placeholder="" :disabled="disabled">
- <template slot="append">{{ goodsForm.partsValveSalePrice ? goodsForm.partsValveSalePrice : 0 }}</template>
- </el-input>
- <el-button icon="el-icon-edit" size="mini" @click="openpart(0, goodsForm.partsValveValue)" :disabled="disabled"></el-button>
- </div>
- </template>
- //瓶帽配件
- <template slot="partsCapNameForm" slot-scope="{ type, disabled }">
- <div style="display:flex;">
- <el-input v-model="goodsForm.partsCapName" size="small" placeholder="" :disabled="disabled">
- <template slot="append">{{ goodsForm.partsCapSalePrice ? goodsForm.partsCapSalePrice : 0 }}</template>
- </el-input>
- <el-button icon="el-icon-edit" size="mini" @click="openpart(1, goodsForm.partsCapValue)" :disabled="disabled"></el-button>
- </div>
- </template>
- //特殊处理
- <template slot="partsHandleNameForm" slot-scope="{ type, disabled }">
- <div style="display:flex;">
- <el-input v-model="goodsForm.partsHandleName" size="small" placeholder="" :disabled="disabled">
- <template slot="append">{{ goodsForm.partsHandleSalePrice ? goodsForm.partsHandleSalePrice : 0 }}</template>
- </el-input>
- <el-button icon="el-icon-edit" size="mini" @click="openpart(2, goodsForm.partsHandleValue)" :disabled="disabled"></el-button>
- </div>
- </template>
- //包装方式
- <template slot="partsColourNameForm" slot-scope="{ type, disabled }">
- <div style="display:flex;">
- <el-input v-model="goodsForm.partsColourName" size="small" placeholder="" :disabled="disabled">
- <template slot="append">{{ goodsForm.partsColourSalePrice ? goodsForm.partsColourSalePrice : 0 }}</template>
- </el-input>
- <el-button icon="el-icon-edit" size="mini" @click="openpart(3, goodsForm.partsColourValue)" :disabled="disabled"></el-button>
- </div>
- </template>
- //特殊颜色
- <template slot="partsModeNameForm" slot-scope="{ type, disabled }">
- <div style="display:flex;">
- <el-input v-model="goodsForm.partsModeName" size="small" placeholder="" :disabled="disabled">
- <template slot="append">{{ goodsForm.partsModeSalePrice ? goodsForm.partsModeSalePrice : 0 }}</template>
- </el-input>
- <el-button icon="el-icon-edit" size="mini" @click="openpart(4, goodsForm.partsModeValue)" :disabled="disabled"></el-button>
- </div>
- </template>
- //认证
- <template slot="partsAuthenticationNameForm" slot-scope="{ type, disabled }">
- <div style="display:flex;">
- <el-input v-model="goodsForm.partsAuthenticationName" size="small" placeholder="" :disabled="disabled">
- <template slot="append">{{ goodsForm.partsAuthenticationSalePrice ? goodsForm.partsAuthenticationSalePrice : 0 }}</template>
- </el-input>
- <el-button icon="el-icon-edit" size="mini" @click="openpart(5, goodsForm.partsAuthenticationValue)" :disabled="disabled"> </el-button>
- </div>
- </template>
- //其他
- <template slot="partsOtherNameForm" slot-scope="{ type, disabled }">
- <div style="display:flex;">
- <el-input v-model="goodsForm.partsOtherName" size="small" placeholder="" :disabled="disabled">
- <template slot="append">{{ goodsForm.partsOtherSalePrice ? goodsForm.partsOtherSalePrice : 0 }}</template>
- </el-input>
- <el-button icon="el-icon-edit" size="mini" @click="openpart(6, goodsForm.partsOtherValue)" :disabled="disabled"></el-button>
- </div>
- </template>
- //配件信息
- <template slot="partsDescribeForm" slot-scope="{ type, disabled }">
- <el-input type="textarea" :rows="2" v-model="goodsForm.partsDescribe" size="small" placeholder="" @change="editChange(goodsForm)"> </el-input>
- </template>
- //英文名称
- <template slot="enameForm" slot-scope="{ type, disabled }">
- <el-input
- type="textarea"
- :rows="2"
- v-model="goodsForm.ename"
- size="small"
- placeholder="请点击右边按钮"
- @change="editChange(goodsForm)"
- ></el-input>
- </template>
- //产品描述
- <template slot="itemDescriptionForm" slot-scope="{ type, disabled }">
- <el-input type="textarea" :rows="2" v-model="goodsForm.itemDescription" size="small" placeholder="请输入" @change="editChange(goodsForm)">
- </el-input>
- </template>
- //采购单价
- <template slot="purchaseAmountForm" slot-scope="{ type, disabled }">
- <el-input
- v-model="goodsForm.purchaseAmount"
- size="small"
- placeholder="请输入"
- @change="purchaseAmountChange(goodsForm)"
- :disabled="disabled"
- ></el-input>
- </template>
- //出厂费用
- <template slot="outFactoryPriceForm" slot-scope="{ type, disabled }">
- <el-input
- v-model="goodsForm.outFactoryPrice"
- size="small"
- oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d\d).*$/,'$1$2.$3')"
- @change="priceChange(goodsForm)"
- ></el-input>
- </template>
- //分摊金额
- <template slot="shareAmountForm" slot-scope="{ type, disabled }">
- <el-input-number
- v-model="goodsForm.shareAmount"
- size="small"
- style="width:100%"
- @change="priceChange(goodsForm)"
- :controls="false"
- :precision="10"
- ></el-input-number>
- </template>
- //分摊金额
- <template slot="internationalAmountForm" slot-scope="{ type, disabled }">
- <el-input-number
- v-model="goodsForm.internationalAmount"
- size="small"
- style="width:100%"
- @change="priceChange(goodsForm)"
- :controls="false"
- :precision="10"
- ></el-input-number>
- </template>
- //单价
- <template slot="priceForm" slot-scope="{ type, disabled }">
- <el-input
- v-model="goodsForm.price"
- size="small"
- oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
- @change="priceChange(goodsForm)"
- ></el-input>
- </template>
- //数量
- <template slot="orderQuantityForm" slot-scope="{ type, disabled }">
- <el-input
- v-model="goodsForm.orderQuantity"
- size="small"
- oninput='this.value=this.value.replace(/[^\d.]/g,"")'
- @change="priceChange(goodsForm)"
- >
- </el-input>
- </template>
- //折扣
- <template slot="discountForm" slot-scope="{ type, disabled }">
- <el-input
- v-model="goodsForm.discount"
- size="small"
- oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
- @change="discountChange(goodsForm)"
- ></el-input>
- </template>
- //税率
- <template slot="taxRateForm" slot-scope="{ type, disabled }">
- <el-input
- v-model="goodsForm.taxRate"
- size="small"
- oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
- @change="taxRateChange(goodsForm)"
- ></el-input>
- </template>
- //产品型号
- <template slot="itemTypeForm" slot-scope="{ type, disabled }">
- <el-input v-model="goodsForm.itemType" placeholder="请输入内容"></el-input>
- <!-- <el-select v-model="goodsForm.itemType" filterable allow-create default-first-option placeholder="请输入"-->
- <!-- size="small" @focus="itemTypeFocus(goodsForm)">-->
- <!-- <el-option v-for="(item, index) in itemtypeList" :key="index" :label="item.value"-->
- <!-- :value="item.value">-->
- <!-- </el-option>-->
- <!-- </el-select>-->
- </template>
- </avue-crud>
- <!-- <el-dialog title="导入商品" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
- :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods"
- top="5vh" v-dialog-drag>
- <span>
- <el-row>
- <el-col :span="4">
- <div>
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="treeOption" @node-click="nodeClick" :style="treeStyle" />
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="20">
- <avue-crud :option="goodsOption" :table-loading="loading" :data="goodsList" ref="goodsCrud"
- :search.sync="search" @search-change="searchChange" @refresh-change="refreshChange"
- @selection-change="selectionChange" @row-click="rowClick" :page.sync="page"
- @on-load="onLoad" @saveColumn="saveGoodsColumn" @resetColumn="resetGoodsColumn"
- :cell-style="cellStyle"></avue-crud>
- </el-col>
- </el-row>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="importGoods" :disabled="selectionList.length !=1">导入</el-button>
- </span>
- </el-dialog> -->
- <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="报价单明细(E)" @onClose="onClose()"> </report-dialog>
- <part-library ref="partLibrary" @importPart="importPart"></part-library>
- <price-library ref="library" @importLibray="importLibray" />
- </trade-card>
- </template>
- <script>
- import goodsOption from "../config/commodity.json";
- import tableOption from "../config/customerContact.json";
- import reportDialog from "@/components/report-dialog/main";
- import partLibrary from "@/components/part-library/main";
- import priceLibrary from "@/components/price-Library/main";
- import propertyDialog from "@/components/property-dialog/main";
- import dicSelect from "@/components/dicSelect/main";
- import { dateFormat } from "@/util/date";
- import {
- delItem,
- getDeptLazyTree,
- getGoods,
- savePurchase,
- saveShipping,
- getSpecification,
- getPricebank,
- calculationDomesticFees,
- getPricebankAll
- } from "@/api/basicData/customerInquiry";
- import {
- sum,
- multiply,
- partSum,
- productCal,
- sellingCal,
- amountCal,
- grossProfitCal,
- goodsGrossProfitCal,
- costCal,
- addPrice,
- divide,
- priceaAjustment
- } from "@/util/calculate";
- import { micrometerFormat2, decimalFormat2 } from "@/util/validate";
- import _ from "lodash";
- export default {
- name: "customerInformation",
- data() {
- return {
- statusTime: dateFormat(new Date(), "yyyy-MM-dd"),
- priceAD: 0,
- visible: false,
- calculateLoading: false,
- switchDialog: false,
- loading: false,
- itemtypeList: [],
- goodsForm: {},
- tableOption: {},
- tableOptionBack: {
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: false,
- editBtn: false,
- addBtn: false,
- delBtn: false,
- headerAlign: "center",
- menuWidth: 150,
- refreshBtn: false,
- showSummary: true,
- indexSlot: true,
- dialogDrag: true,
- summaryText: "合计",
- dialogWidth: "80%",
- dialogTop: "25",
- column: [
- {
- label: "产品名称",
- prop: "cname",
- index: 1,
- width: 200,
- span: 12,
- overHidden: true
- },
- {
- label: "产品编号",
- prop: "code",
- index: 2,
- width: 100,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "产品类别",
- prop: "priceCategory",
- index: 3,
- width: 100,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "英文名称",
- prop: "ename",
- index: 4,
- width: 200,
- span: 12,
- overHidden: true
- },
- {
- label: "产品描述",
- prop: "itemDescription",
- index: 5,
- width: 100,
- span: 12,
- overHidden: true
- },
- {
- label: "螺纹",
- prop: "remarksOne",
- index: 6,
- width: 100,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "介质",
- prop: "customTwo",
- index: 7,
- width: 100,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "颜色",
- prop: "customThree",
- index: 8,
- width: 100,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "电压",
- prop: "customFour",
- index: 9,
- width: 100,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "产品属性",
- prop: "itemProp",
- index: 10,
- width: 200,
- span: 24,
- overHidden: true
- },
- {
- label: "特殊颜色",
- prop: "partsModeName",
- index: 11,
- width: 200,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "特殊处理",
- prop: "partsHandleName",
- index: 12,
- width: 200,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "瓶帽配件",
- prop: "partsCapName",
- index: 13,
- width: 200,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "阀门配件",
- prop: "partsValveName",
- index: 14,
- width: 200,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "包装方式",
- prop: "partsColourName",
- index: 15,
- width: 200,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "认证",
- prop: "partsAuthenticationName",
- index: 16,
- width: 200,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "其他",
- prop: "partsOtherName",
- index: 17,
- width: 200,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "配件信息",
- prop: "partsDescribe",
- index: 18,
- width: 200,
- span: 24,
- overHidden: true
- },
- {
- label: "商品信息",
- prop: "productRemark",
- type: "textarea",
- index: 19,
- width: 100,
- overHidden: true,
- minRows: 2,
- span: 24
- },
- {
- label: "数量",
- prop: "orderQuantity",
- index: 20,
- width: 100,
- align: "right",
- span: 6,
- overHidden: true
- },
- {
- label: "计价单位",
- prop: "unit",
- index: 21,
- width: 100,
- overHidden: true,
- span: 6,
- type: "select",
- dicData: [],
- props: {
- label: "dictValue",
- value: "dictValue"
- }
- },
- {
- label: "出厂价格",
- prop: "outFactoryPrice",
- index: 22,
- width: 100,
- align: "right",
- span: 6,
- overHidden: true
- },
- {
- label: "国内分摊费用",
- prop: "shareAmount",
- index: 23,
- width: 100,
- align: "right",
- span: 6,
- overHidden: true
- },
- {
- label: "国外分摊费用",
- prop: "internationalAmount",
- index: 24,
- width: 100,
- align: "right",
- span: 6,
- overHidden: true
- },
- {
- label: "销售价",
- prop: "price",
- index: 25,
- width: 100,
- span: 6,
- align: "right",
- overHidden: true
- },
- {
- label: "金额",
- prop: "amount",
- index: 26,
- width: 100,
- span: 6,
- align: "right",
- overHidden: true
- },
- {
- label: "单品毛利",
- prop: "goodsGrossProfit",
- index: 26.1,
- width: 100,
- span: 6,
- align: "right",
- overHidden: true
- },
- {
- label: "产品型号",
- prop: "itemType",
- index: 27,
- width: 100,
- span: 6,
- overHidden: true
- },
- {
- label: "采购成本",
- prop: "purchaseCost",
- index: 28,
- width: 100,
- align: "right",
- span: 6,
- hide: true,
- // showColumn: false,
- disabled: true,
- display: false,
- overHidden: true
- },
- {
- label: "采购单价",
- prop: "purchaseAmount",
- index: 29,
- width: 100,
- align: "right",
- span: 6,
- hide: true,
- // showColumn: false,
- disabled: true,
- display: false,
- overHidden: true
- },
- {
- label: "配件成本",
- prop: "partsCost",
- index: 30,
- width: 100,
- align: "right",
- span: 6,
- hide: true,
- // showColumn: false,
- disabled: true,
- display: false,
- overHidden: true
- },
- {
- label: "配件价格",
- prop: "partsPrice",
- index: 31,
- width: 100,
- align: "right",
- span: 6,
- hide: true,
- // showColumn: false,
- disabled: true,
- overHidden: true
- },
- {
- label: "配件价格描述",
- prop: "partsPriceDescribe",
- index: 32,
- width: 120,
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "供应商",
- prop: "corpName",
- index: 33,
- width: 200,
- span: 6,
- hide: true,
- // showColumn: false,
- disabled: true,
- display: false,
- overHidden: true
- },
- {
- label: "重点推荐",
- prop: "priorityReferrer",
- index: 34,
- width: 100,
- span: 6,
- overHidden: true
- },
- {
- label: "推荐理由",
- prop: "referrerReason",
- index: 35,
- width: 100,
- overHidden: true,
- span: 6
- },
- {
- label: "产品价格",
- prop: "productPrice",
- index: 36,
- width: 100,
- align: "right",
- span: 6,
- hide: true,
- // showColumn: false,
- display: false,
- disabled: true,
- overHidden: true
- },
- {
- label: "单品毛利率",
- prop: "itemMargin",
- index: 37,
- width: 100,
- align: "right",
- span: 6,
- disabled: true,
- overHidden: true
- },
- {
- label: "折扣",
- prop: "discount",
- index: 38,
- width: 100,
- align: "right",
- span: 6,
- overHidden: true
- },
- {
- label: "税率",
- prop: "taxRate",
- index: 39,
- width: 100,
- align: "right",
- span: 6,
- overHidden: true
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 2,
- index: 40,
- width: 100,
- overHidden: true,
- span: 12
- }
- ]
- },
- goodsoptions: [],
- partList: [],
- ThreadList: [],
- mediumList: [],
- colorList: [],
- stencilList: [],
- selectionList: [],
- dialogVisible: false,
- treeDeptId: null,
- treeStyle: "height:" + (window.innerHeight - 315) + "px",
- goodsOption: {},
- goodsList: [],
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- treeOption: {
- nodeKey: "id",
- lazy: true,
- treeLoad: function(node, resolve) {
- const parentId = node.level === 0 ? 0 : node.data.id;
- getDeptLazyTree(parentId).then(res => {
- resolve(
- res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- };
- })
- );
- });
- },
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- label: "title",
- value: "value",
- children: "children"
- }
- }
- };
- },
- props: {
- data: {
- type: Array
- },
- detailData: {
- type: Object
- },
- form: {
- type: Object
- },
- orderFeesList: {
- type: Array
- }
- },
- components: {
- partLibrary,
- propertyDialog,
- priceLibrary,
- reportDialog,
- dicSelect
- },
- filters: {
- decimalFormat2(num) {
- return decimalFormat2(num);
- }
- },
- async created() {
- // this.tableOption = await this.getColumnData(this.getColumnName(1), tableOption);
- this.tableOption = await this.getColumnData(this.getColumnName(1), this.tableOptionBack);
- this.goodsOption = await this.getColumnData(this.getColumnName(26), goodsOption);
- if (localStorage.getItem("roleName").indexOf("贸易") == -1 && localStorage.getItem("roleName").indexOf("运营") == -1) {
- this.findObject(this.tableOption.column, "purchaseCost").hide = false;
- // this.findObject(this.tableOption.column, "purchaseCost").showColumn = true;
- this.findObject(this.tableOption.column, "partsPrice").hide = false;
- // this.findObject(this.tableOption.column, "partsPrice").showColumn = true;
- this.findObject(this.tableOption.column, "partsCost").hide = false;
- // this.findObject(this.tableOption.column, "partsCost").showColumn = true;
- this.findObject(this.tableOption.column, "purchaseAmount").hide = false;
- // this.findObject(this.tableOption.column, "purchaseAmount").showColumn = true;
- this.findObject(this.tableOption.column, "corpName").hide = false;
- // this.findObject(this.tableOption.column, "corpName").showColumn = true;
- this.findObject(this.tableOption.column, "productPrice").hide = false;
- // this.findObject(this.tableOption.column, "productPrice").showColumn = true;
- this.findObject(this.tableOption.column, "productPrice").display = true;
- }
- this.getWorkDicts("Thread").then(res => {
- this.ThreadList = res.data.data;
- });
- this.getWorkDicts("medium").then(res => {
- this.mediumList = res.data.data;
- });
- this.getWorkDicts("property_color").then(res => {
- this.colorList = res.data.data;
- });
- this.getWorkDicts("stencil").then(res => {
- this.stencilList = res.data.data;
- });
- this.getWorkDicts("unit").then(res => {
- this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
- });
- getPricebankAll({ billType: "CG", statusTime: dateFormat(new Date(), "yyyy-MM-dd") }).then(res => {
- this.goodsoptions = res.data.data;
- });
- // getPricebank(1, 10, { billType: "CG", statusTime: dateFormat(new Date(), "yyyy-MM-dd") }).then(res => {
- // if (res.data.data.total > 0) {
- // this.goodsoptions = res.data.data.records;
- // if (Math.ceil(res.data.data.total / 10) > 1) {
- // for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
- // getPricebank(i, 10, { billType: "CG", statusTime: dateFormat(new Date(), "yyyy-MM-dd") }).then(e => {
- // this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
- // });
- // }
- // }
- // }
- // });
- },
- methods: {
- cellStyle() {
- return "padding:0;height:40px;";
- },
- pickGoods() {
- // this.dialogVisible = !this.dialogVisible;
- this.$refs.library.search = {};
- this.$refs.library.init(false);
- },
- nodeClick(data) {
- this.treeDeptId = data.id;
- this.page.currentPage = 1;
- this.onLoad(this.page);
- },
- //费用查询
- onLoad(page, params = {}) {
- let obj = this.deepClone(Object.assign(params, this.search));
- this.loading = true;
- getGoods(page.currentPage, page.pageSize, this.treeDeptId, obj)
- .then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.goodsList = data.records;
- if (this.page.total) {
- this.goodsOption.height = window.innerHeight - 350;
- }
- })
- .finally(() => {
- this.loading = false;
- });
- },
- rowClick(row) {
- this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
- },
- // importGoods() {
- // this.upDataOption()
- // this.selectionList.forEach(e => {
- // this.goodsForm.itemId = e.id;
- // this.goodsForm.ename = e.ename;
- // this.goodsForm.code = e.code;
- // this.goodsForm.cname = e.cname;
- // this.goodsForm.corpId = e.corpId;
- // this.goodsForm.corpName = e.corpCode;
- // this.goodsForm.priceCategory = e.goodsTypeName;
- // this.goodsForm.itemUrl = e.url;
- // this.goodsForm.itemProp = null;
- // this.goodsForm.remarksOne = null;
- // this.goodsForm.customTwo = null;
- // this.goodsForm.customThree = null;
- // this.goodsForm.customFour = null;
- // this.goodsForm.customFive = null;
- // this.goodsForm.customSix = null;
- // this.goodsForm.customSeven = null;
- // this.goodsForm.customEight = null;
- // this.goodsForm.customNine = null;
- // this.goodsForm.customTen = null;
- // this.goodsForm.itemDescription = e.cnameDescription;
- // this.goodsForm.partsList = [];
- // this.goodsForm.partsPrice = 0;
- // this.goodsForm.itemType = null;
- // this.goodsForm.tradeTerms = null;
- // this.goodsForm.purchaseCost = 0;
- // this.goodsForm.purchaseAmount = 0;
- // this.goodsForm.price = 0;
- // this.goodsForm.orderQuantity = 0;
- // this.goodsForm.insurance = 0;
- // this.goodsForm.freight = 0;
- // this.goodsForm.discount = null;
- // this.goodsForm.amount = 0;
- // this.goodsForm.taxRate = 0;
- // this.goodsForm.unit = e.unit;
- // this.goodsForm.itemMargin = 0;
- // this.goodsForm.remarks = null;
- // this.goodsForm.exchangeRate = this.form.exchangeRate;
- // this.goodsForm.partsDescribe = null;
- // this.goodsForm.productRemark = e.ename;
- // this.goodsForm.attributeList = this.getAttribute(e.goodsSpecificationList);
- // })
- // this.dialogVisible = false
- // },
- closeGoods() {
- this.selectionList = [];
- this.treeDeptId = "";
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- refreshTable() {
- this.$refs.crud.refreshTable();
- },
- openpart(val, list) {
- this.$refs.partLibrary.init(val, list);
- },
- addRow() {
- if (!this.form.corpId) {
- return this.$message.error("请选择客户名称");
- }
- this.$refs.crud.rowAdd();
- },
- cnameChange(name, row) {
- this.upDataOption();
- this.goodsForm.itemId = row.itemId;
- this.goodsForm.code = row.code;
- this.goodsForm.cname = row.cname;
- this.goodsForm.ename = row.ename;
- this.goodsForm.priceCategory = row.goodsTypeName;
- this.goodsForm.purchaseCost = costCal(row.price, row.taxRate);
- this.goodsForm.purchaseAmount = row.purchaseAmount;
- this.goodsForm.itemProp = null;
- this.goodsForm.remarksOne = null;
- this.goodsForm.customTwo = null;
- this.goodsForm.customThree = null;
- this.goodsForm.customFour = null;
- this.goodsForm.customFive = null;
- this.goodsForm.customSix = null;
- this.goodsForm.customSeven = null;
- this.goodsForm.customEight = null;
- this.goodsForm.customNine = null;
- this.goodsForm.customTen = null;
- this.goodsForm.partsValveName = null;
- this.goodsForm.partsValveValue = null;
- this.goodsForm.partsValveCostPrice = 0;
- this.goodsForm.partsValveSalePrice = 0;
- this.goodsForm.partsCapName = null;
- this.goodsForm.partsCapValue = null;
- this.goodsForm.partsCapCostPrice = 0;
- this.goodsForm.partsCapSalePrice = 0;
- this.goodsForm.partsHandleName = null;
- this.goodsForm.partsHandleValue = null;
- this.goodsForm.partsHandleCostPrice = 0;
- this.goodsForm.partsHandleSalePrice = 0;
- this.goodsForm.partsColourName = null;
- this.goodsForm.partsColourValue = null;
- this.goodsForm.partsColourCostPrice = 0;
- this.goodsForm.partsColourSalePrice = 0;
- this.goodsForm.partsModeName = null;
- this.goodsForm.partsModeValue = null;
- this.goodsForm.partsModeCostPrice = 0;
- this.goodsForm.partsModeSalePrice = 0;
- this.goodsForm.partsAuthenticationName = null;
- this.goodsForm.partsAuthenticationValue = null;
- this.goodsForm.partsAuthenticationCostPrice = 0;
- this.goodsForm.partsAuthenticationSalePrice = 0;
- this.goodsForm.partsOtherName = null;
- this.goodsForm.partsOtherValue = null;
- this.goodsForm.partsOtherCostPrice = 0;
- this.goodsForm.partsOtherSalePrice = 0;
- this.goodsForm.partsCost = 0;
- this.goodsForm.corpId = row.corpId;
- this.goodsForm.corpName = row.corpCode;
- this.goodsForm.itemDescription = row.cnameDescription;
- this.goodsForm.partsPrice = 0;
- this.goodsForm.itemType = row.specs;
- this.goodsForm.tradeTerms = null;
- this.goodsForm.productPrice = productCal(row.purchaseAmount, 0, this.form.coefficient);
- this.goodsForm.outFactoryPrice = sellingCal(productCal(row.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate, 3);
- this.goodsForm.shareAmount = 0;
- this.goodsForm.internationalAmount = 0;
- this.goodsForm.orderQuantity = 1;
- this.goodsForm.insurance = 0;
- this.goodsForm.freight = 0;
- this.goodsForm.discount = null;
- this.goodsForm.price = sellingCal(productCal(row.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate);
- this.goodsForm.amount = sellingCal(productCal(row.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate);
- this.goodsForm.taxRate = 0;
- this.goodsForm.unit = row.unit;
- this.goodsForm.itemMargin = grossProfitCal(
- row.purchaseAmount,
- 0,
- sellingCal(productCal(row.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate),
- this.form.exchangeRate
- );
- this.goodsForm.goodsGrossProfit = goodsGrossProfitCal(
- row.purchaseAmount,
- 0,
- sellingCal(productCal(row.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate),
- this.form.exchangeRate
- );
- this.goodsForm.partsDescribe = null;
- this.goodsForm.remarks = null;
- this.goodsForm.exchangeRate = this.form.exchangeRate;
- this.goodsForm.productRemark = row.ename;
- this.goodsForm.attributeList = this.getAttribute(row.goodsSpecificationList);
- this.goodsForm.referrerReason = row.referrerReason;
- // for (let e of this.goodsoptions) {
- // if (e.itemId == row.itemId) {
- // row.itemId = e.itemId;
- // row.code = e.code;
- // row.cname = e.cname;
- // row.ename = e.ename;
- // row.priceCategory = e.goodsTypeName;
- // row.purchaseCost = costCal(e.price, e.taxRate);
- // row.purchaseAmount = e.purchaseAmount;
- // row.itemProp = null;
- // row.remarksOne = null;
- // row.customTwo = null;
- // row.customThree = null;
- // row.customFour = null;
- // row.customFive = null;
- // row.customSix = null;
- // row.customSeven = null;
- // row.customEight = null;
- // row.customNine = null;
- // row.customTen = null;
- // row.partsValveName = null;
- // row.partsValveValue = null;
- // row.partsValveCostPrice = 0;
- // row.partsValveSalePrice = 0;
- // row.partsCapName = null;
- // row.partsCapValue = null;
- // row.partsCapCostPrice = 0;
- // row.partsCapSalePrice = 0;
- // row.partsHandleName = null;
- // row.partsHandleValue = null;
- // row.partsHandleCostPrice = 0;
- // row.partsHandleSalePrice = 0;
- // row.partsColourName = null;
- // row.partsColourValue = null;
- // row.partsColourCostPrice = 0;
- // row.partsColourSalePrice = 0;
- // row.partsModeName = null;
- // row.partsModeValue = null;
- // row.partsModeCostPrice = 0;
- // row.partsModeSalePrice = 0;
- // row.partsAuthenticationName = null;
- // row.partsAuthenticationValue = null;
- // row.partsAuthenticationCostPrice = 0;
- // row.partsAuthenticationSalePrice = 0;
- // row.partsOtherName = null;
- // row.partsOtherValue = null;
- // row.partsOtherCostPrice = 0;
- // row.partsOtherSalePrice = 0;
- // row.partsCost = 0;
- // row.corpId = e.corpId;
- // row.corpName = e.corpCode;
- // row.itemDescription = e.cnameDescription;
- // row.partsPrice = 0;
- // row.itemType = e.specs;
- // row.tradeTerms = null;
- // row.productPrice = productCal(e.purchaseAmount, 0, this.form.coefficient);
- // row.outFactoryPrice = sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate, 3);
- // row.shareAmount = 0;
- // row.internationalAmount = 0;
- // row.orderQuantity = 1;
- // row.insurance = 0;
- // row.freight = 0;
- // row.discount = null;
- // row.price = sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate);
- // row.amount = sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate);
- // row.taxRate = 0;
- // row.unit = e.unit;
- // row.itemMargin = grossProfitCal(e.purchaseAmount, 0, sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate), this.form.exchangeRate);
- // row.goodsGrossProfit = goodsGrossProfitCal(e.purchaseAmount, 0, sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate), this.form.exchangeRate);
- // row.partsDescribe = null;
- // row.remarks = null;
- // row.exchangeRate = this.form.exchangeRate;
- // row.productRemark = e.ename;
- // row.attributeList = this.getAttribute(e.goodsSpecificationList);
- // row.referrerReason = e.referrerReason
- // }
- // }
- },
- importLibray(rows) {
- this.upDataOption();
- rows.forEach(e => {
- this.goodsForm = {
- itemId: e.itemId,
- code: e.code,
- cname: e.cname,
- ename: e.ename,
- priceCategory: e.goodsTypeName,
- purchaseCost: costCal(e.price, e.taxRate),
- purchaseAmount: e.purchaseAmount,
- itemProp: null,
- remarksOne: null,
- customTwo: null,
- customThree: null,
- customFour: null,
- customFive: null,
- customSix: null,
- customSeven: null,
- customEight: null,
- customNine: null,
- customTen: null,
- partsValveName: null,
- partsValveValue: null,
- partsValveCostPrice: 0,
- partsValveSalePrice: 0,
- partsCapName: null,
- partsCapValue: null,
- partsCapCostPrice: 0,
- partsCapSalePrice: 0,
- partsHandleName: null,
- partsHandleValue: null,
- partsHandleCostPrice: 0,
- partsHandleSalePrice: 0,
- partsColourName: null,
- partsColourValue: null,
- partsColourCostPrice: 0,
- partsColourSalePrice: 0,
- partsModeName: null,
- partsModeValue: null,
- partsModeCostPrice: 0,
- partsModeSalePrice: 0,
- partsAuthenticationName: null,
- partsAuthenticationValue: null,
- partsAuthenticationCostPrice: 0,
- partsAuthenticationSalePrice: 0,
- partsOtherName: null,
- partsOtherValue: null,
- partsOtherCostPrice: 0,
- partsOtherSalePrice: 0,
- corpId: e.corpId,
- corpName: e.corpCode,
- itemDescription: e.cnameDescription,
- partsPrice: 0,
- partsCost: 0,
- itemType: e.specs,
- tradeTerms: null,
- productPrice: productCal(e.purchaseAmount, 0, this.form.coefficient),
- outFactoryPrice: sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate, 3),
- shareAmount: 0,
- internationalAmount: 0,
- orderQuantity: 1,
- insurance: 0,
- freight: 0,
- discount: null,
- price: sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate),
- amount: sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate),
- taxRate: 0,
- unit: "PCS",
- itemMargin: grossProfitCal(
- e.purchaseAmount,
- 0,
- sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate),
- this.form.exchangeRate
- ),
- goodsGrossProfit: goodsGrossProfitCal(
- e.purchaseAmount,
- 0,
- sellingCal(productCal(e.purchaseAmount, 0, this.form.coefficient), this.form.exchangeRate),
- this.form.exchangeRate
- ),
- partsDescribe: null,
- remarks: null,
- exchangeRate: this.form.exchangeRate,
- productRemark: e.ename,
- attributeList: this.getAttribute(e.goodsSpecificationList),
- referrerReason: e.referrerReason
- };
- });
- this.$refs.crud.rowAdd();
- },
- openProperty(row) {
- this.$refs.property.init(row);
- },
- addLibrary() {
- if (!this.form.corpId) {
- return this.$message.error("请选择客户名称");
- }
- if (!this.form.currency) {
- return this.$message.error("请选择币别");
- }
- this.$refs.library.init(false);
- },
- openReport() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- },
- savePurchase() {
- if (!this.form.id) {
- return this.$message.error("此单据没有提交记录,请先提交");
- }
- if (!this.form.buyerId) {
- return this.$message.error("采购员必填");
- }
- this.$confirm("是否生成采购询价单?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- savePurchase(this.form.id).then(res => {
- if (res.data.code == 200) {
- this.$message.success("生成成功");
- }
- });
- });
- },
- saveShipping() {
- if (!this.form.id) {
- return this.$message.error("此单据没有提交记录,请先提交");
- }
- if (!this.form.documenterId) {
- return this.$message.error("船务员必填");
- }
- this.$confirm("是否生成船务询价单?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- let obj = {};
- obj = {
- id: this.form.id,
- srcBillType: "BJ"
- };
- saveShipping(obj).then(res => {
- if (res.data.code == 200) {
- this.$message.success("生成成功");
- this.$emit("retrieve");
- }
- });
- });
- },
- cnameData() {
- this.goodsoptions = [];
- getPricebankAll({ billType: "CG", statusTime: dateFormat(new Date(), "yyyy-MM-dd") }).then(res => {
- this.goodsoptions = res.data.data;
- });
- // getGoods(1, 10).then(res => {
- // if (res.data.data.total > 0) {
- // this.goodsoptions = res.data.data.records;
- // if (Math.ceil(res.data.data.total / 10) > 1) {
- // for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
- // getGoods(i, 10).then(e => {
- // this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
- // });
- // }
- // }
- // }
- // });
- },
- oceanUSD() {
- this.$confirm("是否将应付的海运费(USD)复制到应收?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$emit("oceanUSD");
- });
- },
- calculate(val) {
- this.form.totalValue = 0;
- this.data.forEach((e, index) => {
- e.sort = Number(index) + 1;
- this.form.totalValue = sum(multiply(e.outFactoryPrice, e.orderQuantity), this.form.totalValue);
- });
- if (val == 1) {
- let numSum = 0;
- this.orderFeesList.forEach(e => {
- if (e.feesType == 2 && e.currency == "CNY") {
- numSum = sum(numSum, e.amount);
- }
- });
- let num = 0;
- num = divide(divide(numSum, this.form.totalValue, 10), this.form.exchangeRate, 10);
- this.$confirm("总运费:" + divide(numSum, this.form.exchangeRate) + ",单价分摊运费:" + num + ",是否继续更新?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.data.forEach(e => {
- e.shareAmount = multiply(num, e.outFactoryPrice, 10);
- e.price = addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.internationalAmount);
- e.amount = amountCal(
- addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.internationalAmount),
- e.orderQuantity,
- e.freight,
- e.insurance,
- e.discount
- );
- e.itemMargin = grossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- e.goodsGrossProfit = goodsGrossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- // 处理单品毛利率是 -00.00 的问题
- if (Number(e.itemMargin) === 0) {
- e.itemMargin = Number(e.itemMargin) + "";
- }
- if (Number(e.goodsGrossProfit) == 0) {
- e.goodsGrossProfit = Number(e.goodsGrossProfit);
- }
- });
- });
- } else {
- let numSum = 0;
- this.orderFeesList.forEach(e => {
- if (e.feesType == 2 && e.currency == "USD") {
- numSum = sum(numSum, e.amount);
- }
- });
- let num = 0;
- num = divide(numSum, this.form.totalValue, 10);
- this.$confirm("总运费:" + numSum + ",单价分摊运费:" + num + ",是否继续更新?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.data.forEach(e => {
- e.internationalAmount = multiply(num, e.outFactoryPrice, 10);
- e.price = addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.shareAmount);
- e.amount = amountCal(
- addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.shareAmount),
- e.orderQuantity,
- e.freight,
- e.insurance,
- e.discount
- );
- e.itemMargin = grossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- e.goodsGrossProfit = goodsGrossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- // 处理单品毛利率是 -00.00 的问题
- if (Number(e.itemMargin) === 0) {
- e.itemMargin = Number(e.itemMargin) + "";
- }
- if (Number(e.goodsGrossProfit) == 0) {
- e.goodsGrossProfit = Number(e.goodsGrossProfit);
- }
- });
- });
- }
- },
- khEdit(status) {
- if (status == "cname") {
- this.$router.push({
- path: "/basicData/commodityType/index"
- });
- }
- },
- rowCell(row, index) {
- this.getAttribute(JSON.parse(row.attributeList));
- this.$refs.crud.rowEdit(row, index);
- },
- rowDel(row) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- delItem(row.id).then(res => {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(row.$index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(row.$index, 1);
- }
- });
- },
- moveUp(row, index) {
- this.data[index] = this.data.splice(index - 1, 1, row)[0];
- },
- moveDown(row, index) {
- this.data[index] = this.data.splice(index + 1, 1, row)[0];
- },
- inPriceAD() {
- this.$DialogForm.show({
- title: "调整出厂价",
- width: "30%",
- menuPosition: "right",
- option: {
- submitText: "确定",
- emptyText: "取消",
- span: 24,
- column: [
- {
- label: "出厂价(%)",
- prop: "value",
- min: 0,
- value: 0,
- type: "number",
- controls: false,
- rules: [
- {
- required: true,
- message: "请输入出厂价",
- trigger: "blur"
- }
- ]
- }
- ]
- },
- beforeClose: done => {
- done();
- },
- callback: res => {
- res.done();
- this.data.forEach(e => {
- e.outFactoryPrice = priceaAjustment(e.outFactoryPrice, res.data.value, 3);
- e.totalValue = multiply(e.outFactoryPrice, e.orderQuantity);
- e.price = addPrice(e.outFactoryPrice, e.shareAmount, e.internationalAmount);
- e.amount = amountCal(
- addPrice(e.outFactoryPrice, e.shareAmount, e.internationalAmount),
- e.orderQuantity,
- e.freight,
- e.insurance,
- e.discount
- );
- e.itemMargin = grossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- e.goodsGrossProfit = goodsGrossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- // 处理单品毛利率是 -00.00 的问题
- if (Number(e.itemMargin) === 0) {
- e.itemMargin = Number(e.itemMargin) + "";
- }
- if (Number(e.goodsGrossProfit) == 0) {
- e.goodsGrossProfit = Number(e.goodsGrossProfit);
- }
- // 出厂价格为零,单品毛利润为零
- if (e.outFactoryPrice == 0) {
- e.itemMargin = 0;
- }
- });
- res.close();
- }
- });
- },
- submitPriceAD() {
- this.visible = false;
- this.data.forEach(e => {
- e.outFactoryPrice = priceaAjustment(e.outFactoryPrice, this.priceAD, 3);
- e.totalValue = multiply(e.outFactoryPrice, e.orderQuantity);
- e.price = addPrice(e.outFactoryPrice, e.shareAmount, e.internationalAmount);
- e.amount = amountCal(addPrice(e.outFactoryPrice, e.shareAmount, e.internationalAmount), e.orderQuantity, e.freight, e.insurance, e.discount);
- e.itemMargin = grossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- e.goodsGrossProfit = goodsGrossProfitCal(e.purchaseAmount, e.partsPrice, e.outFactoryPrice, this.form.exchangeRate);
- // 处理单品毛利率是 -00.00 的问题
- if (Number(e.itemMargin) === 0) {
- e.itemMargin = Number(e.itemMargin) + "";
- }
- if (Number(e.goodsGrossProfit) == 0) {
- e.goodsGrossProfit = Number(e.goodsGrossProfit);
- }
- // 出厂价格为零,单品毛利润为零
- if (e.outFactoryPrice == 0) {
- e.itemMargin = 0;
- }
- });
- this.priceAD = 0;
- },
- purchaseAmountChange(row) {
- row.productPrice = productCal(row.purchaseAmount, row.partsPrice, this.form.coefficient);
- row.outFactoryPrice = sellingCal(row.productPrice, this.form.exchangeRate, 3);
- row.price = addPrice(row.outFactoryPrice, row.shareAmount, row.internationalAmount);
- row.amount = amountCal(row.price, row.orderQuantity, row.freight, row.insurance, row.discount);
- row.itemMargin = grossProfitCal(row.purchaseAmount, row.partsPrice, row.outFactoryPrice, this.form.exchangeRate);
- row.goodsGrossProfit = goodsGrossProfitCal(row.purchaseAmount, row.partsPrice, row.outFactoryPrice, this.form.exchangeRate);
- if (Number(row.goodsGrossProfit) == 0) {
- row.goodsGrossProfit = Number(row.goodsGrossProfit);
- }
- },
- priceChange(row) {
- row.price = addPrice(row.outFactoryPrice, row.shareAmount, row.internationalAmount);
- row.amount = amountCal(
- addPrice(row.outFactoryPrice, row.shareAmount, row.internationalAmount),
- row.orderQuantity,
- row.freight,
- row.insurance,
- row.discount
- );
- row.itemMargin = grossProfitCal(row.purchaseAmount, row.partsPrice, row.outFactoryPrice, this.form.exchangeRate);
- row.goodsGrossProfit = goodsGrossProfitCal(row.purchaseAmount, row.partsPrice, row.outFactoryPrice, this.form.exchangeRate);
- if (Number(row.goodsGrossProfit) == 0) {
- row.goodsGrossProfit = Number(row.goodsGrossProfit);
- }
- },
- itemTypeFocus(row) {
- this.itemtypeList = [];
- getSpecification({ goodId: row.itemId }).then(res => {
- const data = res.data.data;
- this.itemtypeList = data.map(item => ({ value: item }));
- });
- },
- getAttribute(rows) {
- let data = [];
- rows.forEach(e => {
- if (e.attributeNo == "Thread" && e.status == 0) {
- this.findObject(this.tableOption.column, "remarksOne").disabled = false;
- }
- if (e.attributeNo == "medium" && e.status == 0) {
- this.findObject(this.tableOption.column, "customTwo").disabled = false;
- }
- if (e.attributeNo == "property_color" && e.status == 0) {
- this.findObject(this.tableOption.column, "customThree").disabled = false;
- }
- if (e.attributeNo == "stencil" && e.status == 0) {
- this.findObject(this.tableOption.column, "customFour").disabled = false;
- }
- if (e.attributeName == "阀门配件" && e.status == 0) {
- this.findObject(this.tableOption.column, "partsValveName").disabled = false;
- }
- if (e.attributeName == "瓶帽配件" && e.status == 0) {
- this.findObject(this.tableOption.column, "partsCapName").disabled = false;
- }
- if (e.attributeName == "特殊处理" && e.status == 0) {
- this.findObject(this.tableOption.column, "partsHandleName").disabled = false;
- }
- if (e.attributeName == "包装方式" && e.status == 0) {
- this.findObject(this.tableOption.column, "partsColourName").disabled = false;
- }
- if (e.attributeName == "特殊颜色" && e.status == 0) {
- this.findObject(this.tableOption.column, "partsModeName").disabled = false;
- }
- if (e.attributeName == "认证" && e.status == 0) {
- this.findObject(this.tableOption.column, "partsAuthenticationName").disabled = false;
- }
- if (e.attributeName == "其他" && e.status == 0) {
- this.findObject(this.tableOption.column, "partsOtherName").disabled = false;
- }
- data.push({
- type: e.type,
- attributeName: e.attributeName,
- attributeNo: e.attributeNo,
- status: e.status
- });
- });
- return JSON.stringify(data);
- },
- // importProperty(row) {
- // const arr = [];
- // for (let key in row) {
- // if (row[key]) {
- // arr.push(row[key]);
- // }
- // }
- // this.goodsForm.itemProp = arr.join(" ");
- // this.goodsForm.remarksOne = row.remarksOne;
- // this.goodsForm.customTwo = row.customTwo;
- // this.goodsForm.customThree = row.customThree;
- // this.goodsForm.customFour = row.customFour;
- // this.goodsForm.customFive = row.customFive;
- // this.goodsForm.customSix = row.customSix;
- // this.goodsForm.customSeven = row.customSeven;
- // this.goodsForm.customEight = row.customEight;
- // this.goodsForm.customNine = row.customNine;
- // this.goodsForm.customTen = row.customTen;
- // this.goodsForm.productRemark = this.getproductRemark(this.goodsForm)
- // },
- importPart(rows, type) {
- if (type == 0) {
- this.goodsForm.partsValveCostPrice = 0;
- this.goodsForm.partsValveSalePrice = 0;
- let names = [];
- rows.forEach(e => {
- names.push(e.goodName);
- this.goodsForm.partsValveCostPrice = sum(this.goodsForm.partsValveCostPrice, multiply(e.partsCost, e.goodNumber));
- this.goodsForm.partsValveSalePrice = sum(this.goodsForm.partsValveSalePrice, e.amout);
- });
- this.goodsForm.partsValveName = names.join(" ");
- this.goodsForm.partsValveValue = JSON.stringify(rows);
- }
- if (type == 1) {
- this.goodsForm.partsCapCostPrice = 0;
- this.goodsForm.partsCapSalePrice = 0;
- let names = [];
- rows.forEach(e => {
- names.push(e.goodName);
- this.goodsForm.partsCapCostPrice = sum(this.goodsForm.partsCapCostPrice, multiply(e.partsCost, e.goodNumber));
- this.goodsForm.partsCapSalePrice = sum(this.goodsForm.partsCapSalePrice, e.amout);
- });
- this.goodsForm.partsCapName = names.join(" ");
- this.goodsForm.partsCapValue = JSON.stringify(rows);
- }
- if (type == 2) {
- this.goodsForm.partsHandleCostPrice = 0;
- this.goodsForm.partsHandleSalePrice = 0;
- let names = [];
- rows.forEach(e => {
- names.push(e.goodName);
- this.goodsForm.partsHandleCostPrice = sum(this.goodsForm.partsHandleCostPrice, multiply(e.partsCost, e.goodNumber));
- this.goodsForm.partsHandleSalePrice = sum(this.goodsForm.partsHandleSalePrice, e.amout);
- });
- this.goodsForm.partsHandleName = names.join(" ");
- this.goodsForm.partsHandleValue = JSON.stringify(rows);
- }
- if (type == 3) {
- this.goodsForm.partsColourCostPrice = 0;
- this.goodsForm.partsColourSalePrice = 0;
- let names = [];
- rows.forEach(e => {
- names.push(e.goodName);
- this.goodsForm.partsColourCostPrice = sum(this.goodsForm.partsColourCostPrice, multiply(e.partsCost, e.goodNumber));
- this.goodsForm.partsColourSalePrice = sum(this.goodsForm.partsColourSalePrice, e.amout);
- });
- this.goodsForm.partsColourName = names.join(" ");
- this.goodsForm.partsColourValue = JSON.stringify(rows);
- }
- if (type == 4) {
- this.goodsForm.partsModeCostPrice = 0;
- this.goodsForm.partsModeSalePrice = 0;
- let names = [];
- rows.forEach(e => {
- names.push(e.goodName);
- this.goodsForm.partsModeCostPrice = sum(this.goodsForm.partsModeCostPrice, multiply(e.partsCost, e.goodNumber));
- this.goodsForm.partsModeSalePrice = sum(this.goodsForm.partsModeSalePrice, e.amout);
- });
- this.goodsForm.partsModeName = names.join(" ");
- this.goodsForm.partsModeValue = JSON.stringify(rows);
- }
- if (type == 5) {
- this.goodsForm.partsAuthenticationCostPrice = 0;
- this.goodsForm.partsAuthenticationSalePrice = 0;
- let names = [];
- rows.forEach(e => {
- names.push(e.goodName);
- this.goodsForm.partsAuthenticationCostPrice = sum(this.goodsForm.partsAuthenticationCostPrice, multiply(e.partsCost, e.goodNumber));
- this.goodsForm.partsAuthenticationSalePrice = sum(this.goodsForm.partsAuthenticationSalePrice, e.amout);
- });
- this.goodsForm.partsAuthenticationName = names.join(" ");
- this.goodsForm.partsAuthenticationValue = JSON.stringify(rows);
- }
- if (type == 6) {
- this.goodsForm.partsOtherCostPrice = 0;
- this.goodsForm.partsOtherSalePrice = 0;
- let names = [];
- rows.forEach(e => {
- names.push(e.goodName);
- this.goodsForm.partsOtherCostPrice = sum(this.goodsForm.partsOtherCostPrice, multiply(e.partsCost, e.goodNumber));
- this.goodsForm.partsOtherSalePrice = sum(this.goodsForm.partsOtherSalePrice, e.amout);
- });
- this.goodsForm.partsOtherName = names.join(" ");
- this.goodsForm.partsOtherValue = JSON.stringify(rows);
- }
- this.goodsForm.partsCost = partSum(
- this.goodsForm.partsValveCostPrice,
- this.goodsForm.partsCapCostPrice,
- this.goodsForm.partsHandleCostPrice,
- this.goodsForm.partsColourCostPrice,
- this.goodsForm.partsModeCostPrice,
- this.goodsForm.partsAuthenticationCostPrice,
- this.goodsForm.partsOtherCostPrice
- );
- this.goodsForm.partsPrice = partSum(
- this.goodsForm.partsValveSalePrice,
- this.goodsForm.partsCapSalePrice,
- this.goodsForm.partsHandleSalePrice,
- this.goodsForm.partsColourSalePrice,
- this.goodsForm.partsModeSalePrice,
- this.goodsForm.partsAuthenticationSalePrice,
- this.goodsForm.partsOtherSalePrice
- );
- // 销售价=(配件采购价格+产品价格)/汇率 *(1+客户FOB系数/100)
- this.goodsForm.productPrice = productCal(this.goodsForm.purchaseAmount, this.goodsForm.partsPrice, this.form.coefficient);
- this.goodsForm.outFactoryPrice = sellingCal(this.goodsForm.productPrice, this.form.exchangeRate, 3);
- this.goodsForm.price = addPrice(this.goodsForm.outFactoryPrice, this.goodsForm.shareAmount, this.goodsForm.internationalAmount);
- this.goodsForm.amount = amountCal(
- this.goodsForm.price,
- this.goodsForm.orderQuantity,
- this.goodsForm.freight,
- this.goodsForm.insurance,
- this.goodsForm.discount
- );
- this.goodsForm.itemMargin = grossProfitCal(
- this.goodsForm.purchaseAmount,
- this.goodsForm.partsPrice,
- this.goodsForm.outFactoryPrice,
- this.form.exchangeRate
- );
- this.goodsForm.goodsGrossProfit = goodsGrossProfitCal(
- this.goodsForm.purchaseAmount,
- this.goodsForm.partsPrice,
- this.goodsForm.outFactoryPrice,
- this.form.exchangeRate
- );
- if (Number(this.goodsForm.goodsGrossProfit) == 0) {
- this.goodsForm.goodsGrossProfit = Number(this.goodsForm.goodsGrossProfit);
- }
- const names = [
- this.goodsForm.partsModeName,
- this.goodsForm.partsHandleName,
- this.goodsForm.partsCapName,
- this.goodsForm.partsValveName,
- this.goodsForm.partsColourName,
- this.goodsForm.partsAuthenticationName,
- this.goodsForm.partsOtherName
- ];
- const name = [];
- names.forEach(e => {
- if (e) {
- name.push(e);
- }
- });
- this.goodsForm.partsDescribe = name.join("; ");
- this.goodsForm.productRemark = this.getproductRemark(this.goodsForm);
- },
- propsChange(row) {
- const data = {
- remarksOne: row.remarksOne,
- customTwo: row.customTwo,
- customThree: row.customThree,
- customFour: row.customFour,
- customFive: row.customFive,
- customSix: row.customSix,
- customSeven: row.customSeven,
- customEight: row.customEight,
- customNine: row.customNine,
- customTen: row.customTen
- };
- const arr = [];
- for (let key in data) {
- if (row[key]) {
- arr.push(row[key]);
- }
- }
- this.goodsForm.itemProp = arr.join(", ");
- this.goodsForm.productRemark = this.getproductRemark(this.goodsForm);
- },
- editChange(row) {
- row.productRemark = this.getproductRemark(row);
- },
- getproductRemark(row) {
- const ename = row.ename ? row.ename : "";
- const itemDescription = row.itemDescription ? row.itemDescription : "";
- const itemProp = row.itemProp ? row.itemProp : "";
- const partsDescribe = row.partsDescribe ? row.partsDescribe : "";
- const productRemark = ename + "\n" + itemDescription + "\n" + itemProp + "\n" + partsDescribe;
- return productRemark;
- },
- beforeClose(done) {
- this.upDataOption();
- done();
- },
- upDataOption() {
- this.findObject(this.tableOption.column, "remarksOne").disabled = true;
- this.findObject(this.tableOption.column, "customTwo").disabled = true;
- this.findObject(this.tableOption.column, "customThree").disabled = true;
- this.findObject(this.tableOption.column, "customFour").disabled = true;
- this.findObject(this.tableOption.column, "partsValveName").disabled = true;
- this.findObject(this.tableOption.column, "partsCapName").disabled = true;
- this.findObject(this.tableOption.column, "partsHandleName").disabled = true;
- this.findObject(this.tableOption.column, "partsColourName").disabled = true;
- this.findObject(this.tableOption.column, "partsModeName").disabled = true;
- this.findObject(this.tableOption.column, "partsAuthenticationName").disabled = true;
- this.findObject(this.tableOption.column, "partsOtherName").disabled = true;
- },
- discountChange(row) {
- if (row.discount >= 10) {
- row.discount = null;
- this.$message.error("请正确输入折扣");
- }
- this.priceChange(row);
- },
- taxRateChange(row) {
- if (row.taxRate > 100) {
- row.taxRate = 0;
- this.$message.error("请正确输入税率");
- }
- },
- handleRowSave(row, done, loading) {
- this.data.push(row);
- loading();
- done();
- },
- handleRowUpdate(row, index, done, loading) {
- // this.data[index] = row
- this.$set(this.data, index, row);
- // this.$refs.crud.rowUpdate(row)
- loading();
- done();
- },
- summaryMethod({ columns, data }) {
- const sums = [];
- if (columns.length > 0) {
- columns.forEach((column, index) => {
- let prop = column.property;
- if (["orderQuantity", "amount", "partsCost", "partsPrice", "productPrice"].includes(prop)) {
- let values = this.data.map(item => Number(item[prop] || 0));
- let all =
- values.length !== 0
- ? (sums[index] = values.reduce((a, b) => {
- return a + b;
- }))
- : 0;
- if (prop == "orderQuantity") {
- sums[index] = micrometerFormat2(all);
- }
- if (prop == "amount") {
- sums[index] = micrometerFormat2(all);
- }
- if (prop == "partsCost") {
- sums[index] = micrometerFormat2(all);
- }
- if (prop == "partsPrice") {
- sums[index] = micrometerFormat2(all);
- }
- if (prop == "productPrice") {
- sums[index] = micrometerFormat2(all);
- }
- }
- });
- }
- return sums;
- },
- async saveColumn(ref, option, optionBack, code) {
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (localStorage.getItem("roleName").indexOf("贸易") == -1 && localStorage.getItem("roleName").indexOf("运营") == -1) {
- this.findObject(this.tableOption.column, "purchaseCost").hide = false;
- // this.findObject(this.tableOption.column, "purchaseCost").showColumn = true;
- this.findObject(this.tableOption.column, "partsPrice").hide = false;
- // this.findObject(this.tableOption.column, "partsPrice").showColumn = true;
- this.findObject(this.tableOption.column, "partsCost").hide = false;
- // this.findObject(this.tableOption.column, "partsCost").showColumn = true;
- this.findObject(this.tableOption.column, "purchaseAmount").hide = false;
- // this.findObject(this.tableOption.column, "purchaseAmount").showColumn = true;
- this.findObject(this.tableOption.column, "corpName").hide = false;
- // this.findObject(this.tableOption.column, "corpName").showColumn = true;
- this.findObject(this.tableOption.column, "productPrice").hide = false;
- // this.findObject(this.tableOption.column, "productPrice").showColumn = true;
- this.findObject(this.tableOption.column, "productPrice").display = true;
- }
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.getWorkDicts("cargo_type").then(res => {
- this.findObject(this.tableOption.column, "cargoType").dicData = res.data.data;
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("重置成功");
- if (localStorage.getItem("roleName").indexOf("贸易") == -1 && localStorage.getItem("roleName").indexOf("运营") == -1) {
- this.findObject(this.tableOption.column, "purchaseCost").hide = false;
- // this.findObject(this.tableOption.column, "purchaseCost").showColumn = true;
- this.findObject(this.tableOption.column, "partsPrice").hide = false;
- // this.findObject(this.tableOption.column, "partsPrice").showColumn = true;
- this.findObject(this.tableOption.column, "partsCost").hide = false;
- // this.findObject(this.tableOption.column, "partsCost").showColumn = true;
- this.findObject(this.tableOption.column, "purchaseAmount").hide = false;
- // this.findObject(this.tableOption.column, "purchaseAmount").showColumn = true;
- this.findObject(this.tableOption.column, "corpName").hide = false;
- // this.findObject(this.tableOption.column, "corpName").showColumn = true;
- this.findObject(this.tableOption.column, "productPrice").hide = false;
- // this.findObject(this.tableOption.column, "productPrice").showColumn = true;
- this.findObject(this.tableOption.column, "productPrice").display = true;
- }
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- async saveGoodsColumn() {
- const inSave = await this.saveColumnData(this.getColumnName(26), this.goodsOption);
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.goodsCrud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetGoodsColumn() {
- this.goodsOption = goodsOption;
- const inSave = await this.delColumnData(this.getColumnName(26), goodsOption);
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.goodsCrud.doLayout();
- });
- this.$message.success("重置成功");
- //关闭窗口
- setTimeout(() => {
- this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
- }, 1000);
- }
- }
- },
- watch: {}
- };
- </script>
- <style scoped>
- ::v-deep .select-component {
- display: flex;
- }
- .page-crad ::v-deep .basic-container__card {
- height: 94.2vh;
- }
- .itemTable ::v-deep .el-table {
- width: 738px;
- }
- ::v-deep .el-input-group__append,
- .el-input-group__prepend {
- padding: 0 5px;
- }
- </style>
|