12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159 |
- <template>
- <div class="detail-container">
- <el-page-header :content="listItem ? '编辑' : '新增'" @back="goBack" />
- <div class="main-title">
- <div class="title">订单信息</div>
- </div>
- <el-form
- ref="mainForm"
- :model="mainForm"
- label-width="120px"
- size="small"
- label-position="right"
- >
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="12">
- <el-form-item label="销售政策编号" prop="policyCode">
- <div style="display: flex">
- <el-input
- v-model="policyId"
- placeholder="销售政策编号"
- disabled
- />
- <el-button
- style="margin-left: 10px"
- size="small"
- @click="handleShow"
- >引用</el-button
- >
- </div>
- </el-form-item>
- </el-col>
- <!-- <el-col :xs="24" :sm="12" :lg="8" v-else>
- <el-form-item label="销售政策编号" prop="policyCode">
- <el-input
- disabled
- v-model="mainForm.policyId"
- placeholder="销售政策编号"
- ></el-input>
- </el-form-item>
- </el-col> -->
- <el-col :xs="24" :sm="12" :lg="12" style="height: 51px">
- <el-form-item label="单据日期" prop="date">
- <el-date-picker
- v-model="mainForm.date"
- type="datetime"
- disabled
- style="width: 100%"
- placeholder="选择日期"
- />
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="12">
- <el-form-item label="表头备注" prop="remark">
- <el-input v-model="mainForm.remark" placeholder="请输入表头备注" />
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="12">
- <el-form-item label="文件编号" prop="fileNum">
- <el-input
- v-model="mainForm.fileNum"
- placeholder="请输入文件编号"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="12">
- <el-form-item label="业务员" prop="k3ServiceName">
- <el-select
- v-model="mainForm.k3ServiceName"
- placeholder="选择业务员"
- style="width: 100%"
- filterable
- @change="handleUser"
- >
- <el-option
- v-for="item in userList"
- :key="item.adminUserId"
- :label="item.nickName"
- :value="item.adminUserId"
- />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="main-title">
- <div class="title">货品信息</div>
- <div>
- <el-select
- v-model="warehouseValue"
- placeholder="请选择发货仓库"
- size="small"
- style="margin-right: 10px"
- >
- <el-option
- v-for="(item, index) in warehouseList"
- :key="index"
- :label="item.name"
- :value="item.id"
- />
- </el-select>
- <el-button
- type="primary"
- size="small"
- icon="el-icon-search"
- @click="checkStock"
- >检查库存</el-button
- >
- <el-divider direction="vertical" />
- </div>
- </div>
- <div class="table">
- <el-table
- :data="goodsList"
- element-loading-text="Loading"
- border
- fit
- show-summary
- :summary-method="$getSummaries"
- highlight-current-row
- stripe
- max-height="400"
- >
- <el-table-column align="left" label="序号" type="index" width="50" />
- <el-table-column
- align="left"
- label="销售类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="物料编码"
- prop="materialNumber"
- min-width="200"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <CopyButton
- :copyText="
- scope.row.materialNumber
- ? scope.row.materialNumber
- : scope.row.materialCode
- "
- />
- <span>
- {{
- scope.row.materialNumber
- ? scope.row.materialNumber
- : scope.row.materialCode
- }}</span
- >
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="产品名称"
- prop="materialName"
- min-width="200"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <CopyButton :copyText="scope.row.materialName" />
- <span> {{ scope.row.materialName }}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="200"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <CopyButton :copyText="scope.row.specification" />
- <span> {{ scope.row.specification }}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="单位"
- prop="unit"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="单价"
- prop="price"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="总数量"
- prop="qty"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-input class="yinput" v-model="scope.row.qty" size="small" />
- </template>
- </el-table-column>
- <el-table-column
- align="right"
- label="订单金额"
- min-width="100"
- prop="compute_amount"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ (scope.row.price * scope.row.qty) | numToFixed }}
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="返利钱包"
- prop="customerWalletId2"
- min-width="160"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.customerWalletId2"
- placeholder="选择返利钱包"
- clearable
- size="small"
- @remove-tag="clearWallet($event, scope.row)"
- @change="changeWallet($event, scope.row)"
- >
- <el-option
- v-for="item in scope.row.rebateWallets"
- :key="item.customerWalletId"
- :label="item.name"
- :value="item.customerWalletId"
- />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- align="right"
- label="返利金额"
- min-width="100"
- prop="compute_flAmount"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{
- ((scope.row.price - scope.row.discAmount) *
- scope.row.qty *
- ((scope.row.rebateRate || 0) * 100)) /
- 100
- }}
- </template>
- </el-table-column>
- <el-table-column
- align="right"
- label="格力折扣"
- min-width="100"
- prop="compute_zkAmount"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ (scope.row.qty * scope.row.discAmount) | numToFixed }}
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="现金钱包"
- prop="customerWalletId"
- min-width="160"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.customerWalletId"
- placeholder="选择现金钱包"
- clearable
- size="small"
- @change="handleWallets($event, scope.row, scope.$index)"
- >
- <el-option
- v-for="item in scope.row.wallets"
- :key="item.customerWalletId"
- :label="item.name"
- :value="item.customerWalletId"
- />
- </el-select>
- </template>
- </el-table-column>
- <!-- <el-table-column-->
- <!-- align="left"-->
- <!-- label="业务员"-->
- <!-- prop="retiredQty"-->
- <!-- min-width="160"-->
- <!-- show-overflow-tooltip-->
- <!-- >-->
- <!-- <template slot-scope="scope">-->
- <!-- <el-select-->
- <!-- v-model="scope.row.serviceName"-->
- <!-- size="small"-->
- <!-- disabled-->
- <!-- placeholder="选择业务员"-->
- <!-- style="width: 100%"-->
- <!-- @change="handleUser2($event,scope.row)"-->
- <!-- >-->
- <!-- <el-option-->
- <!-- v-for="item in scope.row.userList"-->
- <!-- :key="item.adminUserId"-->
- <!-- :label="item.nickName"-->
- <!-- :value="item.adminUserId"-->
- <!-- />-->
- <!-- </el-select>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <el-table-column
- align="right"
- label="可用返利"
- prop="rebateAmount"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <div>{{ scope.row.rebateAmount | numToFixed }}</div>
- </template>
- </el-table-column>
- <el-table-column
- align="right"
- label="使用返利金额"
- prop="compute_flAmount"
- min-width="120"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{
- (((scope.row.price - scope.row.discAmount) *
- scope.row.qty *
- (scope.row.rebateRate * 100)) /
- 100)
- | numToFixed
- }}
- </template>
- </el-table-column>
- <el-table-column
- align="right"
- label="实付金额"
- min-width="100"
- prop="compute_sfAmount"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ comTatol(scope.row) | numToFixed }}
- <!-- {{(scope.row.price - (scope.row.qty * scope.row.discAmount) -(((scope.row.price - scope.row.discAmount) * scope.row.qty * ((scope.row.rebateRate || 0) * 100)) / 100))*scope.row.qty | numToFixed }} -->
- <!-- {{ (((scope.row.price * scope.row.qty) * 100 - ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 - ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) / 100) | numToFixed }} -->
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="是否直调"
- prop="isDirectTransfer"
- min-width="100"
- >
- <template slot-scope="scope">
- <el-checkbox v-model="scope.row.isDirectTransfer" />
- </template>
- </el-table-column>
- <!-- <el-table-column
- align="left"
- label="直调数量"
- prop="directTransferQty"
- min-width="100"
- >
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.directTransferQty"
- size="small"
- ></el-input>
- </template>
- </el-table-column> -->
- <el-table-column
- align="left"
- label="表体备注"
- prop="remark"
- min-width="160"
- >
- <template slot-scope="scope">
- <el-input v-model="scope.row.remark" size="small" />
- </template>
- </el-table-column>
- <el-table-column
- align="right"
- label="税率"
- prop="tax"
- min-width="100"
- show-overflow-tooltip
- />
- <!-- <el-table-column-->
- <!-- v-if="!listItem"-->
- <!-- align="left"-->
- <!-- label="总仓库"-->
- <!-- prop="status1"-->
- <!-- min-width="100"-->
- <!-- show-overflow-tooltip-->
- <!-- >-->
- <!-- <template slot-scope="scope">-->
- <!-- <div>{{ scope.row.status1 | status1Filter }}</div>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <el-table-column
- v-if="!listItem"
- align="left"
- label="仓库状态"
- prop="status2"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <div>{{ status2Filter(scope.row) }}</div>
- </template>
- </el-table-column>
- <el-table-column align="left" label="操作" width="100" fixed="right">
- <template slot-scope="scope">
- <!-- <el-button
- type="text"
- @click="(dialogVisible = true), (cid = scope.row.id)"
- >修改</el-button
- > -->
- <el-button
- type="text"
- @click="deleteItem(scope.$index, scope.row.id)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="page-footer">
- <div class="footer" :class="classObj">
- <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
- <el-popconfirm
- title="确定关闭吗?"
- style="margin-left: 10px"
- @onConfirm="goBack"
- >
- <el-button slot="reference">返回列表</el-button>
- </el-popconfirm>
- </div>
- </div>
- <el-dialog
- :visible.sync="isShowDialog"
- width="80%"
- :close-on-click-modal="false"
- title="引用销售政策"
- @close="handleClose"
- >
- <template>
- <el-form
- ref="screenForm"
- :model="screenForm"
- label-width="120px"
- label-position="left"
- size="small"
- >
- <el-row
- v-if="factor.length && !dataList.length"
- style="margin: 0 0 20px 0; font-size: 20px"
- >
- 引用销售政策表头备注:{{
- !remark ? factor[0].name : remark
- }}
- 配提比例:{{ pop }}
- </el-row>
- <el-row
- v-if="factor.length && !dataList.length && factor[0].remark"
- style="margin: 0 0 20px 0; font-size: 20px"
- >
- 备注:{{ factor[0].remark }}
- </el-row>
- <el-row :gutter="20">
- <el-col :xs="24" :sm="8" :lg="11">
- <el-form-item label="规格型号">
- <div style="display:flex">
- <el-input
- v-model="screenForm.specification"
- placeholder="请输入型号规格型号"
- />
- <el-button style="margin-left:10px" type="primary" size="mini" @click="handleGetPolicyList">查询</el-button>
- </div>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="11">
- <el-form-item label="销售政策" class="myselect">
- <el-select
- v-model="screenForm.policyId"
- placeholder="选择销售政策"
- filterable
- :disabled="disabled"
- style="width: 100%"
- @change="handlePolicy"
- >
- <el-option
- v-for="item in policyList"
- :key="item.code"
- :label="item.title"
- :value="item.code"
- >
- <span>{{ item.title }}</span>
- <span
- v-if="item.policyRemark"
- style="margin-left: 15px; color: #f00; font-size: 12px"
- >( {{ item.policyRemark }} )</span
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="8" :lg="11">
- <el-form-item label="规格型号">
- <div style="display:flex">
- <el-input
- v-model="screenForm.specifications"
- placeholder="请输入型号规格型号"
- />
- </div>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="11">
- <el-form-item label="销售类型">
- <el-select
- v-model="screenForm.saleTypeCode"
- filterable
- placeholder="选择销售类型"
- style="width: 100%"
- clearable
- >
- <el-option
- v-for="item in ztypeList"
- :key="item.id"
- :label="item.saleName"
- :value="item.saleCode"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="22" :sm="22" :lg="22" class="tr">
- <!-- <el-button
- type="primary"
- size="small"
- @click="handlePolicyTypeList"
- >查询</el-button> -->
- <el-button
- type="primary"
- size="small"
- @click="handlePolicyTypeList"
- >查询</el-button
- >
- </el-col>
- </el-row>
- </el-form>
- <template v-if="!dataList.length">
- <div v-for="(item, index) in popDataArr" :key="index">
- <div style="padding: 20px 0">
- <div v-if="index == 0">限定机型</div>
- <div v-else>配提机型{{ index }}</div>
- </div>
- <el-table
- ref="singleTable"
- v-loading="listLoading"
- class="table"
- :data="item"
- element-loading-text="Loading"
- max-height="500"
- border
- fit
- highlight-current-row
- stripe
- @select-all="handleSelectionChange($event, 1, index)"
- @selection-change="handleSelectionChange($event, 1, index)"
- >
- <el-table-column
- align="left"
- type="selection"
- :selectable="selectable"
- width="55"
- />
- <template v-for="col in columns">
- <el-table-column
- v-if="col.num"
- :align="col.align"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-input
- v-model.lazy="scope.row.qty"
- type="number" @mousewheel.native.prevent
- size="small"
- class="yinput"
- @blur="blurQty(scope.row.qty, scope.row)"
- @input="funQty(scope.row.qty, scope.row, index)"
- />
- </template>
- </el-table-column>
- <el-table-column
- v-else-if="col.jie"
- :align="col.align"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ scope.row.qty * scope.row.price || 0 | numToFixed }}
- </template>
- </el-table-column>
- <el-table-column
- v-else
- :align="col.align"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <template
- v-if="col.lable == '产品名称' || col.lable == '规格型号'"
- >
- <CopyButton :copyText="scope.row[col.prop]" />
- <span> {{ scope.row[col.prop] }}</span>
- </template>
- <template v-else>
- {{ scope.row[col.prop] || 0 | numToFixed }}
- </template>
- </template>
- </el-table-column>
- </template>
- <template #append>
- <div class="mybox">
- <el-row class="mybox-row" type="flex">
- <el-col style="width: 55px">合计</el-col>
- <el-col />
- <el-col />
- <el-col />
- <el-col>{{ totalArr[index].totalQty }}</el-col>
- <el-col>{{
- totalArr[index].totalPrice | numToFixed
- }}</el-col>
- <el-col>{{
- totalArr[index].totalAmount | numToFixed
- }}</el-col>
- </el-row>
- </div>
- </template>
- </el-table>
- <!-- <div style="margin: 10px 0">
- 分页
- <el-pagination
- @size-change="
- popfun['handleSizeChange' + (index + 1)]($event, index + 1)
- "
- @current-change="
- popfun['handleCurrentChange' + (index + 1)]($event, index + 1)
- "
- :current-page="popcun['cun' + (index + 1)]"
- :page-sizes="[10]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="poptotal['total' + (index + 1)]"
- >
- </el-pagination>
- </div> -->
- </div>
- <!-- <div v-if="factor.length">-->
- <!-- 引用销售政策说明:{{ factor.length ? factor[0].name : "" }} 配提比列:{{pop}}-->
- <!-- </div>-->
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="hanlePopData">完成</el-button>
- </span>
- </template>
- <template v-else>
- <el-table
- ref="singleTable"
- v-loading="listLoading2"
- class="table"
- :data="dataList"
- element-loading-text="Loading"
- border
- fit
- max-height="500"
- highlight-current-row
- stripe
- @select-all="handleSelectionChange"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- align="left"
- type="selection"
- :selectable="selectable2"
- width="55"
- />
- <template v-for="col in columns">
- <el-table-column
- v-if="col.num"
- :align="col.align"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-input
- v-model.lazy="scope.row.qty"
- type="number" @mousewheel.native.prevent
- class="yinput"
- size="small"
- @blur="blurQty(scope.row.qty, scope.row)"
- @input="funQty(scope.row.qty, scope.row)"
- />
- </template>
- </el-table-column>
- <el-table-column
- v-else-if="col.jie"
- :align="col.align"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ scope.row.qty * scope.row.price || 0 | numToFixed }}
- </template>
- </el-table-column>
- <el-table-column
- v-else
- :align="col.align"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <template
- v-if="col.lable == '产品名称' || col.lable == '规格型号'"
- >
- <CopyButton :copyText="scope.row[col.prop]" />
- <span> {{ scope.row[col.prop] }}</span>
- </template>
- <template v-else>
- {{ scope.row[col.prop] || 0 | numToFixed }}
- </template>
- </template>
- </el-table-column>
- </template>
- <template #append>
- <div class="mybox">
- <el-row class="mybox-row" type="flex">
- <el-col style="width: 55px">合计</el-col>
- <el-col />
- <el-col />
- <el-col />
- <el-col>{{ totalQty }}</el-col>
- <el-col>{{ totalPrice | numToFixed }}</el-col>
- <el-col>{{ totalAmount | numToFixed }}</el-col>
- </el-row>
- </div>
- </template>
- </el-table>
- <!-- <div style="margin: 10px 0">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[10]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div> -->
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="hanlePopData">完成</el-button>
- </span>
- </template>
- </template>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- addData,
- checkStock,
- editData,
- getConditionList,
- getDetail,
- getGoodsList,
- getMaterialTypeList,
- getPolicyConditionList,
- getpolicyList,
- getpolicyTypeList,
- getSalesTypeList,
- getUserList,
- getWalletList,
- getWarehouseList,
- policyList,
- typeList,
- } from "@/api/supply/policy";
- import { getDictList } from "@/api/common";
- export default {
- name: "RetailForm",
- componentName: "RetailForm",
- filters: {
- status1Filter(val) {
- if (val === "" || val === null || val === undefined) return "未检查";
- else if (val === 0) return "无货";
- else if (val > 0 && val <= 30) return val;
- else if (val > 30 && val <= 1000) return "有货";
- else if (val > 1000) return "充足";
- },
- },
- props: ["listItem"],
- data() {
- return {
- tableData: [],
- currentPage: 1, // 当前页码
- pageSize: 10, // 每页数量
- listTotal: 0, // 列表总数
- cusIndex: 0,
- total: 0,
- radio: "",
- pop: "",
- dialogVisible: false,
- factor: [],
- popArr: [],
- mainForm: {
- id: "",
- date: "",
- type: "",
- ztype: "",
- remark: "",
- fileNum: "",
- policyCode: "",
- policyRemark: "",
- policyId: "",
- k3ServiceId: "",
- k3ServiceName: "",
- },
- // mainFormRules: {
- // type: [{ required: true, message: "请选择品类", trigger: "change" }],
- // },
- goodsList: [],
- warehouseList: [],
- warehouseValue: "",
- isShowDialog: false,
- screenForm: {
- policyId: "",
- saleTypeCode: "",
- factorId: "",
- specification: "",
- specifications:""
- },
- currentPage: 1,
- listTotal: 0,
- salesTypeList: [],
- typeList: [],
- ztypeList: [],
- leftGoodsList: [],
- rightGoodsList: [],
- leftSelection: [],
- rightSelection: [],
- policyList: [],
- xjWalletList: [],
- flWalletList: [],
- dataList: [],
- columns: [
- {
- prop: "saleTypeName",
- lable: "销售类型",
- widht: 200,
- align: "left",
- },
- {
- prop: "materialName",
- lable: "产品名称",
- widht: 200,
- align: "left",
- },
- {
- prop: "specification",
- lable: "规格型号",
- widht: 350,
- align: "left",
- },
- {
- prop: "qty",
- lable: "数量",
- widht: 200,
- num: true,
- align: "right",
- },
- {
- prop: "price",
- lable: "单价",
- widht: 200,
- align: "right",
- },
- {
- prop: "zong",
- widht: 200,
- lable: "金额",
- jie: true,
- align: "right",
- },
- ],
- listLoading: false,
- listLoading2: false,
- popDataArr: [],
- radioObj: {},
- step: 0,
- policyId: "",
- policyConditionId: "",
- multipleSelection: [],
- multipleSelections: [],
- multipleData: [],
- disabled: false,
- cid: "",
- newDataList: [],
- userList: [],
- fang: false,
- popfun: {},
- poptotal: {},
- popcun: {},
- totalQty: 0,
- totalPrice: 0,
- totalAmount: 0,
- totalArr: [],
- type: 1,
- newMultipleSelections: [],
- remark: "",
- };
- },
- computed: {
- sidebar() {
- // console.log(11145454);
- return this.$store.state.app.sidebar;
- },
- classObj() {
- return {
- hideSidebar: !this.sidebar.opened,
- openSidebar: this.sidebar.opened,
- };
- },
- comxjWalletList() {
- return (c) => {
- // // consloe(c, "现金钱包");
- const walle = [];
- const ovalVall = c == undefined || !c.length ? [] : c;
- for (let i = 0; i < this.xjWalletList.length; i++) {
- for (let j = 0; j < ovalVall.length; j++) {
- if (this.xjWalletList[i].walletRebateId == ovalVall[j].walletId) {
- walle.push(this.xjWalletList[i]);
- }
- }
- }
- return walle;
- };
- },
- comText() {
- return (val) => {
- if (this.cusIndex - 1 == 0) {
- const params = this.radio.split("&");
- return this.dataList.filter((k) => {
- return k.id == params[0];
- })[0][val];
- } else {
- const params =
- this.radioObj["radio" + (this.cusIndex - 1)].split("&");
- return this.popDataArr[this.cusIndex - 2].filter((k) => {
- return k.id == params[0];
- })[0][val];
- }
- };
- },
- // pickerOptions({ $props }) {
- // return {
- // disabledDate: (time) => {
- // return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000;
- // },
- // };
- // },
- comTatol() {
- return (row) => {
- return (
- row.price * row.qty -
- row.qty * row.discAmount -
- ((row.price - row.discAmount) *
- row.qty *
- ((row.rebateRate || 0) * 100)) /
- 100
- );
- };
- },
- },
- watch: {
- goodsList: {
- handler(newValue, oldValue) {
- if (newValue && newValue.length) {
- newValue.forEach((item, index) => {
- this.goodsList[index].compute_amount = item.price * item.qty;
- this.goodsList[index].compute_flAmount =
- ((item.price - item.discAmount) *
- item.qty *
- (item.rebateRate * 100)) /
- 100;
- this.goodsList[index].compute_zkAmount = item.qty * item.discAmount;
- this.goodsList[index].compute_sfAmount =
- item.price * item.qty -
- item.qty * item.discAmount -
- ((item.price - item.discAmount) *
- item.qty *
- ((item.rebateRate || 0) * 100)) /
- 100;
- });
- }
- this.goodsList = newValue;
- },
- immediate: true,
- deep: true,
- },
- },
- created() {
- this.getDictList();
- this.getWalletList();
- this.getWarehouseList();
- this.getTypeList();
- this.getUserList();
- if (this.listItem) {
- this.getDetail();
- }
- },
- methods: {
- blurQty(e, row) {
- if (!e) {
- this.$set(row, "qty", 1);
- }
- },
- funQty(qty, row, index) {
- if (row.fang) {
- if (this.type == 1) {
- this.$set(this.totalArr, index, {
- totalQty: 0,
- totalPrice: 0,
- totalAmount: 0,
- });
- let sum = 0;
- for (let j = 0; j < this.multipleSelections[index].length; j++) {
- this.multipleSelections[index][j].fang = true;
- sum += +this.multipleSelections[index][j].qty;
- this.totalArr[index].totalPrice +=
- +this.multipleSelections[index][j].price;
- this.totalArr[index].totalAmount +=
- +this.multipleSelections[index][j].price * +qty;
- }
- this.totalArr[index].totalQty = sum;
- } else {
- let sum = 0;
- this.totalQty = this.totalPrice = this.totalAmount = 0;
- for (let i = 0; i < this.multipleSelection.length; i++) {
- sum += +this.multipleSelection[i].qty;
- this.totalPrice += +this.multipleSelection[i].price;
- this.totalAmount += +this.multipleSelection[i].price * +qty;
- }
- this.totalQty += sum;
- }
- }
- },
- getUserList() {
- getUserList({
- pageNum: 1,
- pageSize: -1,
- adminWebsitId: "",
- isCustomer: 0,
- roleId: "",
- status: true,
- userName: "",
- }).then((res) => {
- this.userList = res.data.records;
- // // consloe(this.userList,'122');
- });
- },
- handleUser(e) {
- const user = this.userList.filter((k) => {
- return k.adminUserId == e;
- })[0];
- this.mainForm.k3ServiceId = user.adminUserId;
- this.mainForm.k3ServiceName = user.nickName;
- },
- handleUser2(e, row) {
- const user = this.userList.filter((k) => {
- return k.adminUserId == e;
- })[0];
- this.$set(row, "serviceId", user.adminUserId);
- this.$set(row, "serviceName", user.nickName);
- this.$set(this.mainForm, "k3ServiceId", user.adminUserId);
- this.$set(this.mainForm, "k3ServiceName", user.nickName);
- },
- // 返回列表
- goBack() {
- this.$emit("backListFormDetail");
- },
- handleWallets(e, row, index) {
- if (e) {
- const service = row.wallets.filter((k) => {
- return e == k.customerWalletId;
- })[0];
- if (index == 0 && !this.mainForm.k3ServiceId) {
- this.$set(this.mainForm, "k3ServiceId", service.serviceId);
- this.$set(this.mainForm, "k3ServiceName", service.serviceName);
- }
- this.$set(row, "serviceId", service.serviceId);
- this.$set(row, "serviceName", service.serviceName);
- // this.$set(row,'amount',service.amount || 0)
- } else {
- console.log(index);
- if (index === 0) {
- this.$set(this.mainForm, "k3ServiceId", "");
- this.$set(this.mainForm, "k3ServiceName", "");
- }
- this.$set(row, "serviceId", "");
- this.$set(row, "serviceName", "");
- // this.$set(row,'amount',0 )
- }
- },
- // 选择销售政策获取政策条件列表
- async handlePolicy(e) {
- console.log(e);
- this.totalArr = [];
- this.multipleSelections = [];
- this.dataList = [];
- this.popDataArr = [];
- this.screenForm.saleTypeCode = "";
- const type = this.policyList.filter((k) => {
- return k.code === e;
- })[0].type;
- console.log(type=="PROVISION");
- if (type == "PROVISION") {
- // PROVISION 配提
- // 选择销售政策PolidcyId改变获取条件列表
- const { data } = await getPolicyConditionList({ policyId: e });
- this.factor = data;
- this.pop = data[0].pop;
- this.remark = data[0].remark || "";
- this.popArr = data[0].pop.split(":");
- if (this.policyId) {
- this.screenForm.policyId = this.policyId;
- if (this.listItem) {
- this.policyConditionId = data[0].id;
- }
- } else {
- this.screenForm.policyId = data[0].policyId;
- this.policyConditionId = data[0].id;
- }
- for (let i = 0; i < this.popArr.length; i++) {
- await this.getConditionList(this.policyConditionId, i + 1);
- }
- } else {
- // LIMIT 限量
- this.getMaterialTypeList("sProvision");
- }
- },
- hendleEdit(val, index) {
- this.dialogVisible = false;
- // let params = {
- // id: this.cid,
- // theTime: this.mainForm.date,
- // mainId: this.mainForm.type,
- // mainName: this.mainForm.mainName,
- // remark: this.mainForm.remark,
- // type: 2,
- // retailOrderItemList: this.goodsList,
- // policyId: this.policyId,
- // };
- // editData(params).then((res) => {
- // this.$successMsg("编辑成功");
- // this.getDetail();
- // });
- },
- // 获取条件相对应的比列
- handleFactor(e) {
- const data = this.factor.filter((k) => {
- return k.id == e;
- })[0];
- // // consloe(data, "kkkk");
- this.pop = data.pop;
- this.popArr = data.pop.split(":");
- this.screenForm.policyId = data.policyId;
- this.policyConditionId = data.id;
- },
- async handleGetPolicyList(){
- const {data} = await policyList({
- pageNum: 1,
- pageSize: -1,
- status:1,
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- specification: this.screenForm.specification,
- })
- this.policyList = data.records
- if (data.records.length) {
- this.handlePolicy(data.records[0].code);
- }
- },
- // 获取某一个比例下的数据 ,查询popType 当前 this.cusIndex+1
- async getConditionList(policyConditionId, popType, fang) {
- this.listLoading = true;
- const { data } = await getConditionList({
- pageNum: this.currentPage,
- pageSize: -1,
- policyConditionId,
- popType,
- specification: this.screenForm.specifications,
- saleTypeCode: this.screenForm.saleTypeCode,
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- });
- if (!fang) {
- this.poptotal["total" + popType] = data.total;
- this.popcun["cun" + popType] = 1;
- this.popfun["handleSizeChange" + popType] = (val, index) => {
- this.popcun["cun" + index] = val;
- this.currentPage = 1;
- this.getConditionList(this.policyConditionId, index, true);
- };
- this.popfun["handleCurrentChange" + popType] = (val, index) => {
- this.popcun["cun" + index] = val;
- this.getConditionList(this.policyConditionId, index, true);
- };
- }
- const datas = data.records;
- if (this.listItem) {
- for (let i = 0; i < this.goodsList.length; i++) {
- for (let j = 0; j < datas.length; j++) {
- if (datas[j].id == this.goodsList[i].policyMaterialId) {
- this.$set(datas[j], "disabled", true);
- }
- }
- }
- }
- // this.total = data.total;
- // console.log(this.goodsList,'4555');
- if (this.goodsList.length) {
- for (let p = 0; p < this.goodsList.length; p++) {
- for (let q = 0; q < datas.length; q++) {
- if ((this.goodsList[p].id || this.goodsList[p].policyMaterialId) == datas[q].id ) {
- this.$set(datas[q], "disabled", true);
- }
- }
- }
- }
- for (let i = 0; i < data.records.length; i++) {
- data.records[i].qty = 1;
- data.records[i].policyMaterialId = data.records[i].id;
- this.$set(
- data.records[i],
- "zong",
- data.records[i].qty * data.records[i].price
- );
- data.records[i].sums1 = ["price", "qty", "zong"];
- // this.$set(data.records[i],'userList',this.userList)
- }
- if (fang) {
- this.popDataArr[popType] = datas;
- } else {
- console.log(datas,'89');
- this.popDataArr.push(datas);
- }
- this.totalArr.push({
- totalQty: 0,
- totalPrice: 0,
- totalAmount: 0,
- });
- // this.$set(this.totalArr,[...this.totalArr])
- this.listLoading = false;
- // consloe(this.popDataArr);
- },
- // 获取政策列表
- getMaterialTypeList(val) {
- this.listLoading2 = true;
- getMaterialTypeList({
- pageNum: 1,
- pageSize: -1,
- policyId: this.screenForm.policyId,
- saleTypeCode: this.screenForm.saleTypeCode,
- specification: this.screenForm.specifications,
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- [val]: true,
- }).then((res) => {
- this.dataList = res.data.records;
- if (this.listItem) {
- for (let i = 0; i < this.goodsList.length; i++) {
- for (let j = 0; j < this.dataList.length; j++) {
- if (this.dataList[j].id == this.goodsList[i].policyMaterialId) {
- this.$set(this.dataList[i], "disabled", true);
- }
- }
- }
- }
- for (let i = 0; i < res.data.records.length; i++) {
- this.$set(res.data.records[i], "qty", 1);
- res.data.records[i].sums1 = ["price", "qty", "zong"];
- res.data.records[i].userList = this.userList;
- res.data.records[i].policyMaterialId = res.data.records[i].id;
- for (let j = 0; j < this.goodsList.length; j++) {
- if ((this.goodsList[j].id || this.goodsList[j].policyMaterialId) == res.data.records[i].id) {
- res.data.records[i].disabled = false;
- }
- }
- }
- this.dataList = res.data.records;
- this.total = res.data.total;
- this.listLoading2 = false;
- this.popDataArr = [];
- this.popArr = [];
- // // consloe(this.dataList, "kkkk");
- });
- },
- // 下一步获取某个政策条件比例数据
- handleCondition() {
- if (this.multipleSelection.length) {
- this.cusIndex += 1;
- this.disabled = true;
- this.multipleData.push(this.multipleSelection);
- this.getConditionList(this.policyConditionId, this.cusIndex + 1);
- } else {
- this.$errorMsg("请选择");
- }
- // // consloe(this.cusIndex,'下');
- },
- // 上一步
- handleShang() {
- this.cusIndex == 0 ? (this.disabled = false) : "";
- this.multipleData.splice(this.cusIndex, 1);
- this.popDataArr.splice(this.cusIndex, 1);
- this.cusIndex -= 1;
- // // consloe(this.cusIndex,'上');
- },
- /**
- * 根据条件禁用行复选框
- * 函数返回值为false则禁用选择(反之亦然)
- * @param {Object} row - 行数据
- * @param {String} index - 索引值
- * @return Boolean
- */
- selectable: function (row, index) {
- // row.disabled == undefined 才能被选中
- if (row.disabled == undefined) {
- return true;
- }
- // 函数必须有返回值且是布尔值
- // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
- // 如果没有返回值则默认返回false(全部无法选中)
- },
- /**
- * 根据条件禁用行复选框
- * 函数返回值为false则禁用选择(反之亦然)
- * @param {Object} row - 行数据
- * @param {String} index - 索引值
- * @return Boolean
- */
- selectable2: function (row, index) {
- // row.disabled == undefined 才能被选中
- if (row.disabled == undefined) {
- return true;
- }
- // 函数必须有返回值且是布尔值
- // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
- // 如果没有返回值则默认返回false(全部无法选中)
- },
- // 条件数据多选
- handleSelectionChange(val, type, index) {
- if (type === 1) {
- this.type = 1;
- if (!this.multipleSelections.length) {
- this.multipleSelections = new Array(index).fill([]);
- } else {
- for (let i = 0; i < this.multipleSelections.length; i++) {
- if (
- !this.multipleSelections[i] ||
- !this.multipleSelections[i].length
- ) {
- this.multipleSelections[i] = [];
- }
- }
- }
- this.$set(this.multipleSelections, index, val);
- this.$set(this.totalArr, index, {
- totalQty: 0,
- totalPrice: 0,
- totalAmount: 0,
- });
- for (let j = 0; j < this.multipleSelections[index].length; j++) {
- this.multipleSelections[index][j].fang = true;
- this.totalArr[index].totalQty +=
- +this.multipleSelections[index][j].qty;
- this.totalArr[index].totalPrice +=
- +this.multipleSelections[index][j].price;
- this.totalArr[index].totalAmount +=
- +this.multipleSelections[index][j].price *
- +this.multipleSelections[index][j].qty;
- }
- // consloe(this.multipleSelections);
- } else {
- this.type = 2;
- this.multipleSelection = val;
- console.log(this.multipleSelection);
- this.totalQty = this.totalPrice = this.totalAmount = 0;
- for (let i = 0; i < this.multipleSelection.length; i++) {
- this.multipleSelection[i].fang = true;
- this.totalQty += +this.multipleSelection[i].qty;
- this.totalPrice += +this.multipleSelection[i].price;
- this.totalAmount +=
- +this.multipleSelection[i].price * +this.multipleSelection[i].qty;
- }
- }
- },
- hanlePopData() {
- console.log(this.multipleSelections);
- this.multipleData.push(this.multipleSelection);
- if (this.multipleData.length && this.multipleSelection.length) {
- let arrData = [];
- for (let i = 0; i < this.multipleData.length; i++) {
- if (
- this.multipleData[i].wallets &&
- this.multipleData[i].wallets.length
- ) {
- this.multipleData[i].id = null;
- this.$set(
- this.multipleData[i],
- "customerWalletId",
- this.multipleData[i].wallets[0].customerWalletId
- );
- this.$set(
- this.multipleData[i],
- "serviceName",
- this.multipleData[i].wallets[0].serviceName
- );
- this.$set(
- this.multipleData[i],
- "serviceId",
- this.multipleData[i].wallets[0].serviceId
- );
- this.$set(this.multipleData[i], "amount", 0);
- }
- arrData = [...arrData, ...this.multipleData[i]];
- }
- if (this.goodsList.length) {
- this.goodsList = [...this.goodsList, ...arrData];
- } else {
- this.goodsList = arrData;
- }
- if (this.dataList.length) {
- for (let u = 0; u < this.goodsList.length; u++) {
- this.goodsList[u].disabled = true;
- }
- this.newDataList = this.multipleSelection;
- this.disabled = true;
- }
- this.goodsList.forEach((item) => {
- item.sums1 = ["qty", "directTransferQty"];
- item.sums2 = [
- "price",
- "rebateAmount",
- "compute_amount",
- "compute_flAmount",
- "compute_zkAmount",
- "compute_sfAmount",
- ];
- this.$set(item, "status1", "");
- this.$set(item, "status2", "");
- this.$set(item, "userList", this.userList);
- });
- if (this.goodsList.length && this.goodsList[0].wallets.length) {
- console.log(555555);
- this.mainForm.k3ServiceName =
- this.goodsList[0].wallets[0].serviceName || "";
- this.mainForm.k3ServiceId =
- this.goodsList[0].wallets[0].serviceId || "";
- }
- // if (this.goodsList.length>4) {
- // this.newGoodsList = this.goodsList
- // this.newGoodsList.length = 4
- // }
- this.cusIndex = 0;
- this.total = 0;
- this.popDataArr = [];
- this.multipleData = [];
- this.multipleSelection = [];
- this.policyId = this.screenForm.policyId;
- this.totalQty = this.totalPrice = this.totalAmount = 0;
- this.isShowDialog = false;
- this.$refs.singleTable.clearSelection();
- // consloe(this.goodsList, "kkkk");
- } else if (this.multipleSelections.length) {
- let arrData = [];
- this.newMultipleSelections = this.multipleSelections;
- for (let i = 0; i < this.multipleSelections.length; i++) {
- for (let j = 0; j < this.multipleSelections[i].length; j++) {
- this.multipleSelections[i][j].disabled = true;
- this.multipleSelections[i][j].id = null;
- if (this.multipleSelections[i][j].wallets.length) {
- this.$set(
- this.multipleSelections[i][j],
- "customerWalletId",
- this.multipleSelections[i][j].wallets[0].customerWalletId
- );
- this.$set(
- this.multipleSelections[i][j],
- "serviceName",
- this.multipleSelections[i][j].wallets[0].serviceName
- );
- this.$set(
- this.multipleSelections[i][j],
- "serviceId",
- this.multipleSelections[i][j].wallets[0].serviceId
- );
- this.$set(this.multipleSelections[i][j], "amount", 0);
- }
- arrData = [...arrData, this.multipleSelections[i][j]];
- }
- }
- if (this.goodsList.length) {
- this.goodsList = [...this.goodsList, ...arrData];
- } else {
- this.goodsList = arrData;
- }
- if (this.goodsList.length && this.goodsList[0].wallets.length) {
- this.mainForm.k3ServiceName =
- this.goodsList[0].wallets[0].serviceName || "";
- this.mainForm.k3ServiceId =
- this.goodsList[0].wallets[0].serviceId || "";
- }
- this.goodsList.forEach((item) => {
- this.$set(item, "status1", "");
- this.$set(item, "status2", "");
- this.$set(item, "userList", this.userList);
- item.sums1 = ["qty", "directTransferQty"];
- item.sums2 = [
- "price",
- "rebateAmount",
- "compute_amount",
- "compute_flAmount",
- "compute_zkAmount",
- "compute_sfAmount",
- ];
- });
- this.disabled = true;
- // this.popDataArr = [];
- this.multipleData = [];
- this.multipleSelection = [];
- this.policyId = this.screenForm.policyId;
- this.totalQty = this.totalPrice = this.totalAmount = 0;
- this.isShowDialog = false;
- this.$refs.singleTable.forEach((k) => {
- k.clearSelection();
- });
- // this.$refs.singleTable.clearSelection();
- } else {
- this.$errorMsg("请选择");
- }
- },
- // 获取详情
- getDetail() {
- getUserList({
- pageNum: 1,
- pageSize: -1,
- adminWebsitId: "",
- isCustomer: 0,
- roleId: "",
- status: true,
- userName: "",
- }).then((res) => {
- this.userList = res.data.records;
- getDetail({ id: this.listItem.id }).then((res) => {
- const data = res.data;
- this.mainForm.date = data.theTime;
- this.mainForm.type = data.mainId;
- this.mainForm.remark = data.remark;
- this.mainForm.policyId = data.policyId;
- this.policyId = data.policyId;
- this.mainForm.k3ServiceName = data.k3ServiceName;
- (this.mainForm.k3ServiceId = data.k3ServiceId),
- (this.mainForm.fileNum = data.fileNum);
- // this.mainForm.k3ServiceName = data.retailOrderItemList[0].wallets[0].serviceName
- // this.mainForm.k3ServiceId = data.retailOrderItemList[0].wallets[0].serviceId
- data.retailOrderItemList.forEach((item) => {
- item.status1 = "";
- item.status2 = "";
- item.sums1 = ["qty", "directTransferQty"];
- item.sums2 = [
- "price",
- "rebateAmount",
- "compute_amount",
- "compute_flAmount",
- "compute_zkAmount",
- "compute_sfAmount",
- ];
- this.$set(item, "userList", this.userList);
- item.rebateWallets.forEach((j) => {
- if (j.customerWalletId2 === data.customerWalletId2) {
- this.$set(item, "amount", j.amount || 0);
- }
- });
- item.wallets.forEach((k) => {
- if (k.customerWalletId === data.customerWalletId) {
- this.$set(item, "serviceId", k.serviceId);
- this.$set(item, "serviceName", k.serviceName);
- }
- });
- });
- this.goodsList = data.retailOrderItemList;
- });
- });
- },
- // 获取销售政策
- getPolicyList() {
- policyList({
- pageNum: 1,
- pageSize: -1,
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- status: true,
- }).then((res) => {
- if (this.policyId) {
- this.screenForm.policyId = this.policyId;
- this.disabled = true;
- } else {
- this.screenForm.policyId = res.data.records[0].code;
- }
- this.policyList = res.data.records;
- console.log( res.data.records);
- if (this.policyList.length) {
- this.screenForm.saleTypeCode = ''
- this.screenForm.specifications = ''
- this.handlePolicy(this.screenForm.policyId)
- // const type = this.policyList.find(e=>e.code==this.screenForm.policyId).type
- // if (type === "PROVISION") {
- // // this.handlePolicy( res.data.records[0].id);
- // }else{
- // }
- }
- });
- },
- // 引用销售政策搜索
- async handlePolicyTypeList() {
- if (!this.screenForm.policyId) {
- this.$errorMsg("请选择销售政策");
- return;
- }
- if (this.popArr.length) {
- this.popDataArr = [];
- this.dataList = [];
- for (let i = 0; i < this.popArr.length; i++) {
- await this.getConditionList(this.policyConditionId, i + 1, false);
- }
- } else {
- // sProvision = true
- this.getMaterialTypeList("sProvision");
- }
- },
- // 获取销售类型
- getTypeList() {
- const params = {
- pageNum: 1,
- pageSize: -1,
- saleCode: "",
- saleName: "",
- status: "",
- };
- typeList(params).then((res) => {
- this.ztypeList = res.data.records;
- // // consloe(this.ztypeList, "type1111");
- });
- },
- // 获取仓库列表
- getWarehouseList() {
- getWarehouseList({
- pageNum: 1,
- pageSize: -1,
- }).then((res) => {
- this.warehouseList = res.data.records;
- });
- },
- // 获取限定机型
- getpolicyTypeList() {
- getpolicyTypeList({
- pageNum: 1,
- pageSize: 10,
- policyId: this.screenForm.policyId,
- saleTypeCode: this.screenForm.saleTypeCode,
- }).then((res) => {
- for (let i = 0; i < res.data.records.length; i++) {
- this.$set(res.data.records[i], "qty", 1);
- res.data.records[i].sums2 = ["price", "qty", "zong"];
- res.data.records[i].userList = this.userList;
- }
- this.dataList = res.data.records;
- this.total = res.data.total;
- });
- },
- // 打开引用
- handleShow() {
- this.isShowDialog = true;
- this.getPolicyList();
- },
- // 获取钱包列表
- getWalletList() {
- getWalletList({
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- type: "COMMONLY",
- }).then((res) => {
- this.xjWalletList = res.data;
- });
- getWalletList({
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- type: "REBATE",
- }).then((res) => {
- this.flWalletList = res.data;
- });
- },
- // 获取销售类型列表
- getSalesTypeList() {
- getSalesTypeList({
- pageNum: 1,
- pageSize: -1,
- }).then((res) => {
- this.salesTypeList = res.data.records;
- });
- },
- getDictList() {
- getDictList({ sysDictEnum: "PRODUCT_TYPE" }).then((res) => {
- this.typeList = res.data;
- });
- },
- // 获取商品列表
- getGoodsList() {
- getGoodsList({
- pageNum: this.currentPage,
- pageSize: 10,
- mainId: this.screenForm.type,
- saleId: this.screenForm.salesType,
- materialCode: this.screenForm.proNum,
- materialName: this.screenForm.proName,
- specification: this.screenForm.proModel,
- price1: this.screenForm.price1,
- price2: this.screenForm.price2,
- }).then((res) => {
- const oldGoodsList = this.goodsList;
- const newGoodsList = res.data.records;
- for (let i = 0; i < oldGoodsList.length; i++) {
- const oldItem = oldGoodsList[i];
- for (let j = 0; j < newGoodsList.length; j++) {
- const newItem = newGoodsList[j];
- if (newItem.materialId === oldItem.materialId) {
- newGoodsList[j].selected = true;
- break;
- }
- }
- }
- res.data.records.forEach((item) => {
- item.materialName = item.name;
- item.materialCode = item.number;
- item.saleTypeName = item.saleName;
- item.unit = item.baseUnit;
- item.price = item.batchPrice;
- item.tax = item.taxRate;
- item.isDirectTransfer = false;
- item.directTransferQty = "";
- item.status1 = "";
- item.status2 = "";
- item.rebateAmount = "";
- item.rebateRate = "";
- item.productPriceId = item.id;
- });
- this.leftGoodsList = res.data.records;
- this.listTotal = res.data.total;
- });
- },
- // 查询重复值并禁选
- checkboxSelect(row, rowIndex) {
- if (row.selected) {
- return false; // 禁用
- } else {
- return true; // 不禁用
- }
- },
- // 点击 选择商品
- openDialog() {
- this.getSalesTypeList();
- this.getGoodsList();
- this.isShowDialog = true;
- },
- // 提交筛选表单
- submitScreenForm() {
- this.currentPage = 1;
- this.getGoodsList();
- },
- // 重置筛选表单
- resetScreenForm() {
- this.$refs.screenForm.resetFields();
- this.currentPage = 1;
- this.getGoodsList();
- },
- // 关闭 弹窗
- closeDialog() {
- this.isShowDialog = false;
- this.popDataArr = [];
- },
- // 删除
- deleteGoods() {
- const rightGoodsList = this.rightGoodsList;
- const rightSelection = this.rightSelection;
- for (let i = 0; i < rightGoodsList.length; i++) {
- for (let j = 0; j < rightSelection.length; j++) {
- if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
- this.rightGoodsList.splice(i, 1);
- }
- }
- }
- },
- // 确定 添加产品
- submitAddGoods() {
- if (this.radio) {
- const params = this.radio.split("&");
- this.screenForm.policyId = params[1];
- this.mainForm.policyId = params[1];
- this.cusIndex += 1;
- getpolicyList({
- materialId: params[2],
- policyId: params[1],
- }).then((res) => {
- this.pop = res.data.pop;
- this.popArr = res.data.pop.split(":");
- this.popArr.splice(0, 1);
- for (let i = 0; i < this.popArr.length; i++) {
- this.$set(this.radioObj, "radio" + (i + 1), "");
- }
- this.step = this.cusIndex + 1;
- this.getConditionList(params[3], this.step);
- });
- } else {
- this.$errorMsg("请选择");
- }
- },
- // 更改每页数量
- handleSizeChange(val) {
- this.pageSize = val;
- this.currentPage = 1;
- this.getConditionList(this.policyConditionId, this.cusIndex + 1);
- },
- // 更改当前页
- handleCurrentChange(val) {
- this.currentPage = val;
- this.getConditionList(this.policyConditionId, this.cusIndex + 1);
- },
- // 更改列表当前页
- handleTableCurrentChange(val) {
- this.currentPage = val;
- this.getConditionList(this.policyConditionId, this.cusIndex + 1);
- },
- handleClose() {
- this.totalQty = this.totalPrice = this.totalAmount = 0;
- // this.dataList = [];
- // this.popDataArr = [];
- // this.screenForm.policyId = "";
- // this.screenForm.saleTypeCode = "";
- },
- // 删除产品
- deleteItem(index, id) {
- this.goodsList.splice(index, 1);
- // this.dataList
- this.newDataList.splice(index, 1);
- if (!this.goodsList.length) {
- this.disabled = false;
- this.policyId = "";
- this.mainForm.policyId = "";
- }
- // this.popDataArr.splice(index,1)
- },
- // 修改返利钱包
- changeWallet(e, row) {
- if (e) {
- const obj = row.rebateWallets.filter((k) => {
- return e === k.customerWalletId;
- })[0];
- this.$set(row, "rebateRate", obj.rebateRate || 0);
- this.$set(row, "amount", obj.amount || 0);
- } else {
- this.$set(row, "rebateRate", 0);
- this.$set(row, "amount", 0);
- }
- },
- clearWallet(e) {
- console.log(e);
- // const obj = row.rebateWallets.filter(k => {
- // return e === k.customerWalletId
- // })[0]
- this.$set(row, "rebateRate", 0);
- },
- // 检查库存
- checkStock() {
- if (!this.warehouseValue) {
- return this.$errorMsg("请选择仓库");
- }
- if (!this.goodsList) {
- return this.$errorMsg("请添加货品");
- }
- const ids = [];
- this.goodsList.forEach((item) => {
- ids.push(item.materialId);
- });
- checkStock({
- correspondId: this.warehouseValue,
- materialId: ids.join(","),
- }).then((res) => {
- if (res.data) {
- this.goodsList.forEach((item, index) => {
- item.status1 = res.data[index].allStockNum;
- item.status2 = res.data[index].stockNum;
- // // consloe(item.status1, item.status2);
- });
- }
- });
- },
- status2Filter(item) {
- if (
- item.status2 === "" ||
- item.status2 === null ||
- item.status2 === undefined
- )
- return "未检查";
- if (item.status2 <= 0) {
- return "无货";
- } else if (item.status2 >= 1 && item.status2 <= 30) {
- return item.status2;
- } else if (item.status2 >= 31 && item.status2 <= 1000) {
- return "有货";
- } else {
- return "充足";
- }
- // else if (item.status2 >= item.qty) return '可用'
- // else return '短缺'
- },
- // 保存
- clickSubmitForm() {
- this.$refs.mainForm.validate((valid) => {
- if (valid) {
- // let mainName =
- // this.typeList[
- // findElem(this.typeList, "dictCode", this.mainForm.type)
- // ].dictValue;
- this.goodsList.userList = [];
- this.goodsList.forEach((k) => {
- delete k.userList;
- });
- const params = {
- theTime: this.mainForm.date,
- k3ServiceId: this.mainForm.k3ServiceId,
- k3ServiceName: this.mainForm.k3ServiceName,
- remark: this.mainForm.remark,
- type: 2, // 1:普通零售单,2:政策零售单
- retailOrderItemList: this.goodsList,
- policyId: this.policyId,
- fileNo: this.mainForm.fileNum,
- };
- console.log(params);
- if (this.listItem) {
- console.log(params.listItem);
- params.id = this.listItem.id;
- editData(params).then((res) => {
- this.$successMsg("编辑成功");
- this.goBack();
- this.$parent.getList();
- });
- } else {
- params.retailOrderItemList.forEach((k) => {
- k.id = null;
- });
- addData(params).then((res) => {
- this.$successMsg("添加成功");
- this.goBack();
- this.$parent.getList();
- });
- }
- }
- });
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .yinput {
- ::v-deep .el-input__inner {
- text-align: right;
- }
- }
- .fr {
- margin: 10px;
- overflow: hidden;
- }
- .detail-container {
- width: 100%;
- height: 100%;
- margin-bottom: 80px;
- ::v-deep .el-table__append-wrapper {
- overflow: initial;
- }
- }
- .table {
- margin-top: 20px 0 0 0;
- background-color: rgb(237 237 237);
- }
- .page-footer .footer.hideSidebar {
- margin-left: 0;
- width: 100%;
- }
- .mybox {
- padding: 20px 0;
- text-align: right;
- div:first-child {
- flex: 0 0 55px;
- }
- div {
- flex: 1 0 200px;
- padding-right: 10px;
- text-align: right;
- }
- }
- .myselect {
- ::v-deep .el-select-dropdown__item {
- max-width: 500px;
- }
- }
- .main-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 20px;
- height: 60px;
- border-bottom: 1px solid #dcdfe6;
- margin-bottom: 20px;
- .title {
- font-size: 16px;
- font-weight: 600;
- padding-left: 10px;
- }
- }
- .tables {
- display: flex;
- margin-top: 10px;
- .table {
- width: 45%;
- }
- .buttons {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding: 0 10px;
- button {
- margin: 0;
- margin-top: 10px;
- }
- }
- }
- .ellipsis {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- </style>
|