| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546 |
- <template>
- <div>
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList(0)"
- >返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small" v-if="editButton" @click="confirmEditing"
- >编 辑
- </el-button>
- <el-button
- class="el-button--small-yh"
- v-else
- style="margin-left: 6px;"
- type="primary"
- size="small"
- :disabled="isSaveBtn"
- @click="editCustomer"
- >保 存
- </el-button>
- <el-button
- class="el-button--small-yh"
- style="margin-left: 6px;"
- :type="buttonColor"
- size="small"
- :disabled="isDisabledTask || (form.status !== '待确认' && form.status !== '待收货')"
- @click="generateOutbound"
- >
- {{ buttonText }}
- </el-button>
- <el-button
- class="el-button--small-yh"
- style="margin-left: 6px;"
- type="info"
- size="small"
- :disabled="form.status != '已收货' || form.returnsNumber == form.goodsTotalNum || editButton"
- @click="getReturns"
- >
- 采购退货
- </el-button>
- <el-dropdown style="padding: 0 6px;line-height: 0">
- <el-button v-show="!(!form.id || viewDisabled)" type="danger" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
- 请 核<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="applySettlement('申请')" :disabled="isApplySettlement || form.status !== '录入'"
- >请核数据
- </el-dropdown-item>
- <!-- <el-dropdown-item @click.native="confirmRefundBtn('确认')" :disabled="isConfirmRefundBtn">确认退款
- </el-dropdown-item> -->
- <el-dropdown-item @click.native="revocationRequest('撤销')" :disabled="isRevocationRequest">撤销请核 </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-dropdown style="line-height: 0">
- <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
- 审 批<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="examineBtn('审批')" :disabled="(isExamineBtn && !detailData.check) || form.checkStatus == '审核完成'"
- >审批
- </el-dropdown-item>
- <el-dropdown-item @click.native="(checkScheduleDialog = true), (checkId = form.id)">审核进度 </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <!--<el-button class="el-button--small-yh" style="margin-left: 6px;" v-if="form.id"-->
- <!-- type="success" size="small"-->
- <!-- :disabled="form.shortcutWarehousingStatus == '1' || form.status != '录入' || editButton"-->
- <!-- @click="oneClickStorage" >一键采购入库-->
- <!--</el-button>-->
- </div>
- </div>
- <div style="margin-top: 50px">
- <trade-card title="基础信息">
- <avue-form :option="optionForm" v-model="form" ref="form">
- <template slot-scope="{ row, index }" slot="contacts">
- <!-- 联系人 -->
- <el-select
- v-model="form.contacts"
- placeholder="请选择"
- size="small"
- style="width:60%"
- clearable
- filterable
- allow-create
- default-first-option
- @change="contactsChange($event)"
- :disabled="isContacts"
- >
- <el-option v-for="item in contactsOption" :key="item.cname" :label="item.cname" :value="item.contacts" />
- </el-select>
- </template>
- <template slot-scope="{ row, index }" slot="recAddress">
- <!-- 地址 -->
- <el-select
- v-model="form.recAddress"
- placeholder="请选择"
- size="small"
- style="width:60%"
- clearable
- filterable
- allow-create
- default-first-option
- :disabled="isContacts"
- >
- <el-option
- v-for="item in recAddressOption"
- :key="item.id"
- :label="item.belongtoarea + item.detailedAddress"
- :value="item.belongtoarea + item.detailedAddress"
- />
- </el-select>
- </template>
- </avue-form>
- </trade-card>
- <trade-card title="明细信息">
- <el-tabs v-model="activeName" type="card">
- <el-tab-pane label="采购明细" name="sale_detail">
- <avue-crud
- :option="optionContacts"
- v-model="formContacts"
- ref="formContacts"
- :data="form.orderItemsList"
- :key="key"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @row-close="rowClose"
- :before-close="beforeClose"
- @selection-change="selectionContacts"
- @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
- @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
- >
- <template slot-scope="{ scope, row }" slot="menuLeft">
- <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn" @click="rowAdd(row)">添加商品</el-button>
- <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom" @click="excelDialogfun('名称')"
- >按名称导入
- </el-button>
- <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom" @click="excelDialogfun('code')"
- >按Code导入
- </el-button>
- <el-button type="primary" icon="el-icon-printer" size="small" @click="handlePrint">打印</el-button>
- <el-button type="danger" plain size="small" @click="batchDelete" :disabled="form.status != '录入' || editButton">一键删除</el-button>
- </template>
- <template slot="goodsId" slot-scope="{ row }">
- <!--<el-select v-if="row.$cellEdit" v-model="row.goodsId" allow-create filterable default-first-option >-->
- <!-- <el-option v-for="(item, index) in goodsIdoptions" :key="index" :label="item.cname"-->
- <!-- :value="item.id"></el-option>-->
- <!--</el-select>-->
- <span>{{ row.goodsName }}</span>
- </template>
- <template slot="goodsNum" slot-scope="{ row }">
- <el-input-number
- v-if="!mingxibaocun"
- size="small"
- v-model="row.goodsNum"
- :controls="false"
- :precision="numberDecimal"
- style="width: 100%"
- ></el-input-number>
- <span v-else>{{ row.goodsNum }}</span>
- </template>
- <template slot="sendNum" slot-scope="{ row }">
- <el-popover width="600" trigger="click">
- <avue-crud :data="areaData" :option="areaOption"></avue-crud>
- <span style="color: #409EFF;cursor: pointer" slot="reference" @click="viewArea(row)">{{ row.sendNum }}</span>
- </el-popover>
- </template>
- <template slot="price" slot-scope="{ row }">
- <el-input v-if="!mingxibaocun" size="small" v-model="row.price" style="width: 100%"></el-input>
- <span v-else>{{ row.price }}</span>
- </template>
- <template slot="rebatePrice" slot-scope="{ row }">
- <el-input v-if="!mingxibaocun" size="small" v-model="row.rebatePrice" style="width: 100%"></el-input>
- <span v-else>{{ row.rebatePrice }}</span>
- </template>
- <template slot="dot" slot-scope="{ row }">
- <el-select
- v-if="!mingxibaocun && row.whether == '1'"
- v-model="row.dot"
- allow-create
- filterable
- default-first-option
- @focus="picihaolistfun(row.goodsId)"
- >
- <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot" :value="item.dot"></el-option>
- </el-select>
- <span v-else>{{ row.dot }}</span>
- </template>
- <template slot="subTotalMoney" slot-scope="{ row }">{{ (row.goodsNum * row.price).toFixed(2) }}</template>
- <template slot="remarks" slot-scope="{ row }">
- <el-input v-if="!mingxibaocun" size="small" v-model="row.remarks" style="width: 100%"></el-input>
- <span v-else>{{ row.remarks }}</span>
- </template>
- <!-- <template slot-scope="{scope,row}" slot="goodsNum">
- <el-input size="small" v-model="formContacts.goodsNum" style="width: 100%">
- <template slot="inventory">{{ inventory }}吨</template>
- </el-input>
- </template> -->
- <!-- <template slot="goodsId" slot-scope="{ row, index }">
- <span style="display:flex">
- <el-select v-model="row.goodsId" placeholder="请选择" size="small" filterable
- style="width:60%" >
- <el-option v-for="item in goodsIdoptions" :key="item.id" :label="item.cname"
- :value="item.id">
- </el-option>
- </el-select>
- <el-button icon="el-icon-search" size="small" @click="rePick(row, index)"></el-button>
- </span>
- </template> -->
- <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
- <el-button
- v-if="mingxibaocun"
- :size="size"
- :disabled="disabled || isAdd"
- :type="type"
- :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
- @click="hangeditBtn(row, index)"
- >编辑
- </el-button>
- <el-button
- v-else
- :size="size"
- :disabled="disabled || isAdd"
- :type="type"
- :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
- @click="hangbaocun(row, index)"
- >保存
- </el-button>
- <el-button
- icon="el-icon-delete"
- :size="size"
- :disabled="disabled || isDisabled"
- :type="type"
- @click="rowDelBox(row, index, 'orderItemsList')"
- >删除
- </el-button>
- </template>
- </avue-crud>
- </el-tab-pane>
- <el-tab-pane label="付款明细" name="payment_details">
- <avue-crud
- :option="optionPaymentDetails"
- v-model="formContacts"
- ref="payment_details"
- :data="dataList"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
- @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
- >
- <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
- <el-button :size="size" :disabled="disabled" :type="type"
- :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
- @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
- </el-button>
- <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
- @click="rowDelBox(row, index, 'paymentRecordsList')">删除
- </el-button>
- </template> -->
- </avue-crud>
- </el-tab-pane>
- <el-tab-pane label="入库记录" name="outbound_records">
- <avue-crud
- :option="optionOutboundRecords"
- v-model="formContacts"
- ref="outbound_records"
- :data="form.outboundRecordsList"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
- @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
- >
- <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
- <el-button :size="size" :disabled="disabled" :type="type"
- :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
- @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
- </el-button>
- <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
- @click="rowDelBox(row, index)">删除
- </el-button>
- </template> -->
- </avue-crud>
- </el-tab-pane>
- </el-tabs>
- </trade-card>
- <report-dialog :switchDialog="switchDialog" reportName="轮胎商城-采购订单" :reportId="form.id" @onClose="onClose()"></report-dialog>
- <el-dialog
- append-to-body
- title="审批"
- class="el-dialogDeep"
- :visible.sync="checkDialog"
- width="50%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- v-dialog-drag
- >
- <check :checkData="checkData" :checkDetail="true" :idList="[]" @operationType="operationType" @choceCheckFun="choceCheckFun"> </check>
- </el-dialog>
- <el-dialog
- append-to-body
- title="审批进度"
- class="el-dialogDeep"
- :visible.sync="checkScheduleDialog"
- width="40%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- v-dialog-drag
- >
- <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
- </el-dialog>
- <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
- <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="uploadAfter">
- <template slot="excelTemplate">
- <el-button type="primary" @click="derivation"> 点击下载<i class="el-icon-download el-icon--right"></i> </el-button>
- </template>
- </avue-form>
- <p style="text-align: center;color: #DC0505">
- 温馨提示 第一次导入时请先下载模板
- </p>
- </el-dialog>
- </div>
- <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"
- >
- <el-row :style="{ height: rowHeight }">
- <el-col :span="5">
- <div>
- <el-scrollbar>
- <basic-container>
- <avue-tree style="height: 70vh;overflow-y: auto" :option="treeOption" :data="treeDataGoods" @node-click="nodeClick" />
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="19">
- <basic-container>
- <avue-crud
- :option="optionTwo"
- :table-loading="loading"
- :data="goodsListShow"
- ref="crud"
- :search.sync="SelectSearch"
- @refresh-change="refreshChange"
- @selection-change="selectionChange"
- @search-change="goodsSearch"
- :page.sync="page"
- @on-load="onLoadfun"
- @resetColumn="resetCrud"
- @saveColumn="saveCrud"
- >
- <template slot="menuLeft">
- <el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
- <el-tab-pane label="查询结果" name="searchList" />
- <el-tab-pane label="已选定数据" name="importStaging" />
- </el-tabs>
- </template>
- <template slot="goodsNum" slot-scope="{ row }">
- <el-input-number
- v-model="row.goodsNum"
- size="small"
- :controls="false"
- :precision="numberDecimal"
- @input="amountChange($event, row)"
- style="width: 100%"
- />
- </template>
- <template slot="dot" slot-scope="{ row }">
- <el-select
- v-if="row.whether == '1'"
- v-model="row.dot"
- allow-create
- filterable
- default-first-option
- @focus="picihaolistfun(row.id)"
- size="small"
- >
- <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot" :value="item.dot"></el-option>
- </el-select>
- <span v-else>{{ row.dot }}</span>
- </template>
- <template slot="price" slot-scope="{ row }">
- <el-input-number v-model="row.price" size="small" :controls="false" style="width: 100%" />
- <!--<span v-else>{{ row.price }}</span>-->
- </template>
- <template slot="rebatePrice" slot-scope="{ row }">
- <el-input-number v-model="row.rebatePrice" size="small" :controls="false" style="width: 100%" />
- <!--<span v-else>{{ row.price }}</span>-->
- </template>
- <template slot-scope="scope" slot="menu">
- <el-button
- type="text"
- icon="el-icon-edit"
- size="small"
- @click.stop="importStagList(scope.row, scope.index)"
- v-if="activeNameTabs == 'searchList'"
- :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
- >选择
- </el-button>
- <el-button type="text" icon="el-icon-delete" size="small" @click.stop="removeStagList(scope.row, scope.index)" v-else
- >移除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
- <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
- <!--<el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"-->
- <!-- :disabled="tableData.length !== 1">导入</el-button>-->
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation";
- import { getDetails as getDetailsLT } from "@/api/tirePartsMall/basicData/commodityInformation/index";
- import { dateFormat } from "@/util/date";
- import { getToken } from "@/util/auth";
- import {
- getDetails,
- submit,
- generateShipTask,
- tradingBox,
- delOrderItem,
- checkOrder,
- confirmRefund,
- goodsListXs,
- inboundTask,
- checkOrderCG,
- revokeCheckOrderCG,
- revokeInboundTask,
- goodsListAll,
- shortcutWarehousing,
- selectShipItemRecord
- } from "@/api/tirePartsMall/salesManagement/saleOrder";
- import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
- import reportDialog from "@/components/report-dialog/main";
- import checkSchedule from "@/components/checkL/checkSchedule";
- // import check from "@/components/checkL/check";
- import check from "../../../approveDataL/check.vue";
- import { getCorpType, getList } from "@/api/tirePartsMall/basicData/commodityInformation";
- import { isProcurement } from "@/api/basicData/configuration";
- import commodity from "../../configuration/commodity.json";
- export default {
- name: "detailsPage",
- data() {
- return {
- numberDecimal: 0,
- SelectSearch: {},
- // 编辑还是保存
- mingxibaocun: true,
- // 批次号请求到的数据
- picihaolist: [],
- // 添加商品弹窗
- dialogVisible: false,
- // 弹窗高度
- rowHeight: "",
- areaData: [],
- areaOption: {
- header: false,
- menu: false,
- column: [
- {
- label: "库区",
- prop: "reservoirAreaName",
- overHidden: true
- },
- {
- label: "批次号",
- prop: "dot",
- overHidden: true
- },
- {
- label: "数量",
- prop: "quantity",
- overHidden: true
- }
- ]
- },
- // 左侧选择搜索
- treeDataGoods: [],
- treeDeptId: "",
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 50, 100, 300, 500]
- },
- pageList: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- // 左侧选择
- treeOption: {
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- labelText: "标题",
- label: "title",
- value: "value"
- }
- },
- // 表格需要的配置
- optionTwo: commodity,
- loading: false,
- // 商品列表数据合计
- goodsListShow: [],
- // 商品列表暂存
- goodsListSave: [],
- saveLoading: false,
- commodityData: false,
- surplusRouteQuantityOption: [],
- tableData: [],
- // tabs切换
- activeNameTabs: "searchList",
- data: [],
- inventory: 0,
- isStatus: 1,
- excelBox: false,
- // 商品名称
- goodsIdoptions: [],
- dataList: [],
- dicUrlWithCustomId: "",
- sharedCompanyId: 0,
- isAddBtn: true,
- viewDisabled: false, // 请核和大审批按钮是否禁用
- isApplySettlement: false, // 请核数据按钮是否禁用
- isRevocationRequest: true, // 撤销审核
- isExamineBtn: true, // 审批
- isAdd: false,
- editButton: true, // 编辑按钮和保存按钮的显示隐藏
- isSaveBtn: false, // 保存的禁用
- isDisabledTask: false, // 生成,撤销任务按钮是否禁用
- buttonText: "生成任务",
- buttonColor: "success", // 初始颜色为success
- isContacts: false, // 基础信息插槽禁用
- goods: [],
- isDisabled: false,
- //地址
- recAddressOption: [],
- contactsOption: [],
- checkData: {},
- checkScheduleDialog: false,
- isConfirmRefundBtn: true,
- checkDialog: false,
- checkId: "",
- batchNo: "",
- switchDialog: false,
- activeName: "sale_detail",
- disabled: false,
- key: 0,
- excelOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: "模板下载",
- prop: "excelTemplate",
- formslot: true,
- span: 24
- },
- {
- label: "导入明细",
- prop: "excelFile",
- type: "upload",
- drag: true,
- loadText: "上传中,请稍等",
- accept: ".xls,.xlsx",
- span: 24,
- propsHttp: {
- res: "data"
- },
- tip: "请上传 .xls,.xlsx 标准格式文件",
- action: "/api/blade-sales-part/ship/import-item"
- }
- ]
- },
- templateUrl: "/api/blade-sales-part/ship/export-item", // 模板url
- form: {
- orderItemsList: [],
- paymentRecordsList: [],
- outboundRecordsList: []
- },
- optionForm: {
- menuBtn: false,
- span: 8,
- disabled: false,
- column: [
- {
- label: "供应商",
- prop: "customerId",
- disabled: false,
- remote: true,
- type: "select",
- props: {
- label: "cname",
- value: "id"
- },
- cascader: ["recAddress"],
- click: () => {
- this.$refs.form.dicInit();
- },
- change: data => {
- if (!this.onLoad.id) {
- // this.$set(this.optionContactsBack, "addBtn", true)
- // this['optionContacts'] = this['optionContactsBack'];
- // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
- }
- if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
- getCustom({ id: data.value }).then(res => {
- this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : "";
- // this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
- // this.form.storageId = res.data.data.deliveryWarehouseId
- this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId;
- this.form.contacts = res.data.data.corpsAttnList[0].cname;
- this.form.phone = res.data.data.corpsAttnList[0].tel;
- //联系人
- this.contactsOption = res.data.data.corpsAttnList;
- //地址
- this.recAddressOption = res.data.data.corpsAddrList;
- console.log("contactsOption", this.contactsOption);
- this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress;
- });
- }
- // if (this.$refs.form.DIC.customerId || data.value) {
- // for (let item of this.$refs.form.DIC.customerId) {
- // if (item.id == data.value) {
- // console.log(data);
- // console.log(this.$refs.form);
- // console.log(item);
- // // 后端返回数据暂无联系人、地址等数据,无法下拉默认
- // this.form.phone = item.tel
- // }
- // }
- // }
- },
- dicUrl: "/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=GYS&enableOrNot=1",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "仓库",
- prop: "storageId",
- type: "select",
- disabled: false,
- // placeholder: '仓库为空即为异地销售',
- props: {
- label: "cname",
- value: "id"
- },
- dicUrl: "/api/blade-sales-part/storageDesc/listAll",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- // {
- // label: '来源单号',
- // prop: "srcOrdNo",
- // disabled: true
- // }, {
- // label: '业务来源',
- // prop: "businessSource",
- // disabled: true
- // },
- {
- label: "业务日期",
- prop: "businesDate",
- searchProp: "businesDateList",
- disabled: false,
- type: "datetime",
- value: dateFormat(new Date(), "yyyy-MM-dd"),
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ]
- },
- {
- label: "联系人",
- type: "select",
- prop: "contacts",
- disabled: false,
- allowCreate: true,
- filterable: true,
- props: {
- label: "address",
- value: "id"
- },
- dicUrl: "/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}"
- },
- {
- label: "电话",
- disabled: false,
- prop: "phone"
- },
- {
- label: "地址",
- prop: "recAddress",
- type: "select",
- allowCreate: true,
- filterable: true,
- disabled: false,
- props: {
- label: "address",
- value: "address"
- },
- dicUrl: "/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}"
- },
- // {
- // label: '配送方式',
- // type: 'select',
- // prop: "shipType",
- // disabled: false,
- // dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
- // props: {
- // label: "dictValue",
- // value: "dictValue"
- // },
- // value: '物流'
- // }, {
- // label: '物流公司',
- // disabled: false,
- // prop: "logisticsCorpName"
- // },
- // {
- // label: '成本',
- // prop: "cost",
- // display: true,
- // disabled: true
- // }, {
- // label: '毛利',
- // prop: "grossProfit",
- // disabled: true
- // },
- // {
- // label: '采购金额',
- // prop: "salesAmount",
- // disabled: true
- // },
- // {
- // label: '运费',
- // prop: "freight",
- // disabled: true
- // },
- {
- label: "应付类别",
- prop: "receivableType",
- type: "select",
- disabled: false,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
- props: {
- label: "dictValue",
- value: "dictValue"
- },
- value: "网络支付"
- },
- {
- label: "总金额",
- prop: "totalMoney",
- disabled: true
- },
- {
- label: "已付金额",
- prop: "paymentAmountTl",
- disabled: true
- },
- {
- label: "单据编号",
- prop: "ordNo",
- disabled: true
- },
- {
- label: "退货数量",
- prop: "returnsNumber",
- disabled: true
- },
- {
- label: "退货金额",
- prop: "returnsAmount",
- disabled: true
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- disabled: false,
- span: 16,
- minRows: 1
- }
- ]
- },
- formContacts: {},
- optionContacts: {},
- optionContactsBack: {
- disabled: false,
- border: true,
- align: "center",
- index: true,
- addBtnText: "添加商品",
- updateBtnText: "保存",
- refreshBtn: false,
- dialogDrag: true,
- addBtn: false,
- span: 8,
- height: 500,
- // 添加
- addRowBtn: false,
- // 保存按钮
- editBtn: false,
- // 航编辑开启
- cellBtn: true,
- rowKey: "ids",
- delBtn: false,
- menuWidth: 140,
- dialogTop: 25,
- dialogWidth: "80%",
- summaryText: this.$t("land118n.total"),
- showSummary: true,
- selection: true,
- sumColumnList: [
- {
- name: "goodsNum",
- type: "sum"
- },
- {
- name: "price",
- type: "sum",
- decimals: 2
- },
- {
- name: "sendNum",
- type: "sum",
- decimals: 2
- },
- {
- name: "subTotalMoney",
- type: "sum",
- decimals: 2
- },
- {
- name: "returnsNumber",
- type: "sum"
- },
- {
- name: "returnsAmount",
- type: "sum"
- }
- ],
- column: [
- {
- label: "商品名称",
- prop: "goodsId",
- width: 200,
- disabled: false,
- remote: true,
- hide: true,
- overHidden: true,
- type: "select",
- // dicData: [],
- props: {
- label: "cname",
- value: "id"
- },
- // dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll?cname={{key}}'
- dicUrl: "/api/blade-sales-part/goodsDesc/list?current=1&size=10&cname={{key}}&enableOrNot=1"
- // dicUrl: "/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}"
- },
- {
- label: "商品名称",
- prop: "goodsName",
- width: 200,
- disabled: false,
- remote: true,
- overHidden: true
- },
- {
- label: "数量",
- prop: "goodsNum",
- overHidden: true,
- disabled: false,
- cell: true,
- width: 100,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- },
- {
- validator: (rule, value, callback) => {
- console.log(this.formContacts.inventory);
- if (value < 0) {
- callback(new Error("数量不能小于0"));
- } else {
- callback();
- }
- },
- trigger: "blur"
- }
- ]
- },
- {
- label: "价格",
- prop: "price",
- overHidden: true,
- width: 100,
- disabled: false,
- cell: true,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- },
- {
- validator: (rule, value, callback) => {
- if (value < 0) {
- callback(new Error("价格不能小于0"));
- } else {
- callback();
- }
- },
- trigger: "blur"
- }
- ]
- },
- {
- label: "库存",
- prop: "inventory",
- overHidden: true,
- width: 100
- },
- {
- label: "批次号",
- prop: "dot",
- cell: true,
- width: 120,
- type: "select",
- disabled: true,
- allowCreate: true,
- filterable: true,
- dicData: [],
- props: {
- label: "dot",
- value: "dot"
- },
- dicUrl: "/api/blade-sales-part/stockDesc/dotList",
- overHidden: true
- },
- {
- label: "小计",
- prop: "subTotalMoney",
- overHidden: true,
- width: 100,
- disabled: true,
- editDisplay: false,
- addDisplay: false
- },
- {
- label: "商品编码",
- prop: "goodsNo",
- overHidden: true,
- disabled: false,
- width: 100
- },
- {
- label: "品牌",
- prop: "brandName",
- disabled: false,
- width: 100,
- overHidden: true
- },
- {
- label: "规格型号",
- prop: "propertyName",
- overHidden: true,
- disabled: false,
- width: 100
- },
- {
- label: "花纹",
- prop: "pattern",
- overHidden: true,
- disabled: false,
- width: 100
- },
- {
- label: "商品描述",
- prop: "goodsDescription",
- disabled: false,
- overHidden: true,
- width: 100
- },
- {
- label: "单位",
- prop: "units",
- type: "select",
- disabled: false,
- props: {
- label: "dictValue",
- value: "dictValue"
- },
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
- overHidden: true,
- width: 100
- },
- {
- label: "收货数量",
- prop: "sendNum",
- overHidden: true,
- width: 100,
- disabled: true,
- editDisplay: false,
- addDisplay: false
- },
- {
- label: "返利后单价",
- prop: "rebatePrice",
- overHidden: true,
- width: 100,
- cell: true
- },
- {
- label: "返利后成本价",
- prop: "rebateCostprie",
- overHidden: true,
- width: 100,
- disabled: true,
- editDisplay: false,
- addDisplay: false
- },
- {
- label: "返利后利润",
- prop: "rebateProfit",
- overHidden: true,
- width: 100,
- disabled: true,
- editDisplay: false,
- addDisplay: false
- },
- {
- label: "退货数量",
- prop: "returnsNumber",
- overHidden: true,
- width: 100,
- disabled: true
- },
- {
- label: "退货金额",
- prop: "returnsAmount",
- overHidden: true,
- width: 100,
- disabled: true
- },
- // {
- // label: '利润',
- // prop: 'profit',
- // overHidden: true,
- // width: 100
- // },
- // {
- // label: '返利',
- // prop: 'thisAmount',
- // overHidden: true,
- // width: 100
- // },
- // {
- // label: '成本',
- // prop: 'costprie',
- // overHidden: true,
- // width: 100,
- // disabled: true,
- // editDisplay: false,
- // addDisplay: false
- // },
- // {
- // label: '毛利',
- // prop: 'grossProfit',
- // overHidden: true,
- // width: 100,
- // disabled: true,
- // editDisplay: false,
- // addDisplay: false
- // },
- {
- label: "备注",
- prop: "remarks",
- overHidden: true,
- width: 100,
- disabled: false
- }
- ]
- },
- selectionMultilist: [], // 多选数据
- optionPaymentDetails: {},
- optionPaymentDetailsBack: {
- align: "center",
- index: true,
- addBtnText: "录入明细",
- menu: false,
- refreshBtn: false,
- dialogDrag: true,
- addBtn: false,
- span: 8,
- height: 600,
- addRowBtn: false,
- editBtn: false,
- delBtn: false,
- menuWidth: 140,
- dialogTop: 25,
- dialogWidth: "80%",
- column: [
- {
- label: "支付编号",
- prop: "serialNumber"
- },
- {
- label: "金额",
- prop: "amount"
- },
- {
- label: "类型",
- prop: "type"
- },
- {
- label: "支付时间",
- prop: "createTime"
- }
- ]
- },
- optionOutboundRecords: {},
- optionOutboundRecordsBack: {
- align: "center",
- index: true,
- menu: false,
- addBtnText: "录入明细",
- refreshBtn: false,
- dialogDrag: true,
- addBtn: false,
- span: 8,
- height: 600,
- addRowBtn: false,
- editBtn: false,
- delBtn: false,
- // menuWidth: 140,
- dialogTop: 25,
- dialogWidth: "80%",
- column: [
- {
- label: "入库单号",
- prop: "billno"
- },
- // {
- // label: '来源单号',
- // prop: 'ordNo'
- // },
- {
- label: "数量",
- prop: "goodsTotalNum"
- },
- {
- label: "实际数量",
- prop: "sendTotalNum"
- },
- {
- label: "业务类型",
- prop: "bizTypeName"
- },
- {
- label: "状态",
- prop: "statusName"
- },
- {
- label: "业务时间",
- prop: "createTime"
- }
- ]
- }
- };
- },
- components: { reportDialog, check, checkSchedule },
- props: {
- onLoad: Object,
- detailData: Object
- },
- async created() {
- this.findObject(this.optionContactsBack.column, "goodsId").click = ({ value, column }) => {
- this.$refs.formContacts.dicInit();
- };
- this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
- if (this.formContacts.goodsId !== value) {
- goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : "" }).then(res => {
- this.goods = res.data.data;
- this.formContacts.goodsNo = res.data.data.code;
- this.formContacts.brandId = res.data.data.brandId;
- this.formContacts.inventory = res.data.data.inventory;
- // this.formContacts.brandId = res.data.data.brandName
- // this.formContacts.brandName = res.data.data.brandId
- this.formContacts.propertyName = res.data.data.specificationAndModel;
- this.formContacts.pattern = res.data.data.brandItem;
- this.formContacts.goodsDescription = res.data.data.goodsDescription;
- this.formContacts.units = res.data.data.unit;
- this.formContacts.price = res.data.data.price;
- //
- this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId;
- console.log(res.data.data.sharedCompanyId);
- console.log(res.data.data.sharedCompanyName);
- this.form.sharedCompanyId = res.data.data.sharedCompanyId;
- this.form.sharedCompanyName = res.data.data.sharedCompanyName;
- this.sharedCompanyId = res.data.data.sharedCompanyId;
- console.log(res.data.data.sharedCompanyId);
- console.log(this.form.orderItemsList);
- for (let i = 0; i < this.form.orderItemsList.length; i++) {
- console.log(Number(this.form.orderItemsList[i].sharedCompanyId));
- if (Number(this.form.orderItemsList[i].sharedCompanyId) != Number(res.data.data.sharedCompanyId)) {
- this.isStatus = 0;
- }
- }
- if (res.data.data.whether == 0) {
- this.findObject(this.optionContactsBack.column, "dot").disabled = true;
- } else {
- this.findObject(this.optionContactsBack.column, "dot").disabled = false;
- dotList({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => {
- this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data;
- });
- }
- // this.formContacts.goodsId = res.data.data.cname
- // this.formContacts.goodsName = res.data.data.id
- });
- }
- };
- this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
- isProcurement({ param: "whether.model" }).then(res => {
- if (res.data.data == 1) {
- this.findObject(this.optionContacts.column, "pattern").label = "规格型号1";
- this.findObject(this.optionTwo.column, "brandItem").label = "规格型号1";
- this.findObject(this.optionTwo.column, "originalFactory").search = false;
- this.findObject(this.optionTwo.column, "explosionProof").search = false;
- this.findObject(this.optionTwo.column, "selfRecovery").search = false;
- this.findObject(this.optionTwo.column, "explosionProof").hide = true;
- this.findObject(this.optionTwo.column, "originalFactory").hide = true;
- this.findObject(this.optionTwo.column, "selfRecovery").hide = true;
- this.findObject(this.optionTwo.column, "explosionProof").showColumn = false;
- this.findObject(this.optionTwo.column, "originalFactory").showColumn = false;
- this.findObject(this.optionTwo.column, "selfRecovery").showColumn = false;
- }
- });
- this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
- if (this.formContacts.goodsId !== value) {
- goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : "" }).then(res => {
- this.goods = res.data.data;
- this.formContacts.goodsNo = res.data.data.code;
- this.formContacts.brandId = res.data.data.brandId;
- this.formContacts.inventory = res.data.data.inventory;
- // this.formContacts.brandId = res.data.data.brandName
- // this.formContacts.brandName = res.data.data.brandId
- this.formContacts.propertyName = res.data.data.specificationAndModel;
- this.formContacts.pattern = res.data.data.brandItem;
- this.formContacts.goodsDescription = res.data.data.goodsDescription;
- this.formContacts.units = res.data.data.unit;
- this.sharedCompanyId = res.data.data.sharedCompanyId;
- this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId;
- //
- this.form.sharedCompanyId = res.data.data.sharedCompanyId;
- this.form.sharedCompanyName = res.data.data.sharedCompanyName;
- for (let i = 0; i < this.form.orderItemsList.length; i++) {
- if (this.form.orderItemsList[i].sharedCompanyId != res.data.data.sharedCompanyId) {
- this.isStatus = 0;
- }
- }
- if (res.data.data.whether == 0) {
- this.findObject(this.optionContacts.column, "dot").disabled = true;
- } else {
- this.findObject(this.optionContacts.column, "dot").disabled = false;
- dotList({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => {
- this.findObject(this.optionContacts.column, "dot").dicData = res.data.data;
- });
- }
- // this.formContacts.goodsId = res.data.data.cname
- // this.formContacts.goodsName = res.data.data.id
- });
- }
- };
- this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
- this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
- this.key++;
- if (this.onLoad.id && this.detailData.id) {
- this.$set(this.optionForm, "disabled", true);
- this.$set(this.optionContactsBack, "disabled", true);
- this.isContacts = true;
- this.isDisabled = true;
- //添加删除按钮禁用
- this.isAdd = true;
- this.refresh(this.onLoad.id, true);
- } else if (this.onLoad.id) {
- this.refresh(this.onLoad.id, true);
- }
- // 由 from 改为 onLoad
- if (!this.onLoad.id) {
- this.editButton = false; // 第一次录入显示保存按钮
- this.optionContactsBack.column.forEach(its => {
- if (its.prop == "goodsId" || its.prop == "goodsNum" || its.prop == "price" || its.prop == "dot" || its.prop == "remarks") {
- its.disabled = false;
- } else {
- its.disabled = true;
- }
- });
- this.isDisabledTask = true;
- // this.$set(this.optionContactsBack, "addBtn", false)
- // this['optionContacts'] = this['optionContactsBack'];
- // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
- }
- if (!this.detailData.id) {
- this.isAddBtn = false;
- this.isDisabledTask = false;
- this.form.businessSource = "内部销售";
- }
- if (this.detailData.check) {
- console.log("this.detailData.check", this.detailData.check);
- this.isExamineBtn = false;
- // this.batchNo = this.detailData.check.batchNo
- }
- // if (this.detailData.id) {
- // this.getDetailsfun()
- // }
- isProcurement({ param: "number.decimal" }).then(res => {
- this.numberDecimal = res.data.data ? Number(res.data.data) : 0;
- });
- },
- watch: {
- "form.sharedCompanyId"(newSharedCompanyId, oldSharedCompanyId) {
- console.log(newSharedCompanyId, oldSharedCompanyId);
- if (newSharedCompanyId != oldSharedCompanyId) {
- console.log("不能添加");
- }
- console.log(this.sharedCompanyId);
- },
- $route(to, from) {
- if (this.onLoad.id && this.detailData.id) {
- this.$set(this.optionForm, "disabled", true);
- this.$set(this.optionContactsBack, "disabled", true);
- this.isContacts = true;
- this.isDisabled = true;
- this.isAdd = true;
- this.refresh(this.onLoad.id, true);
- } else if (this.onLoad.id) {
- console.log(2);
- this.refresh(this.onLoad.id, true);
- }
- // if (!this.form.id) {
- // console.log(3);
- // // this.$set(this.optionContactsBack, "addBtn", false)
- // this['optionContacts'] = this['optionContactsBack'];
- // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
- // }
- // if (!this.detailData.id) {
- // this.form.businessSource = '内部销售'
- // }
- if (this.detailData.status == 1) {
- this.isExamineBtn = false;
- }
- // if (to.name == '销售订单') {
- // console.log('销售订单');
- // this.isExamineBtn = false;
- // }
- }
- },
- mounted() {
- this.$nextTick(() => {
- // 监听浏览器高度变化,改变表格高度
- window.onresize = () => {
- this.rowHeight = window.innerHeight - 130 + "px";
- };
- });
- },
- methods: {
- viewArea(row) {
- this.areaData = [];
- selectShipItemRecord({
- shipItemId: row.id
- }).then(res => {
- this.areaData = res.data.data;
- });
- },
- rowSum(row) {
- row.subTotalMoney = row.goodsNum * row.price;
- return row.subTotalMoney;
- },
- //生成退货单
- getReturns() {
- this.$confirm("您确定要退货吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$router.push({
- path: "/tirePartsMall/purchaseService/returns/index",
- query: {
- bsType: "TKCG",
- id: this.form.id
- }
- });
- });
- },
- // 一键入库
- oneClickStorage() {
- if (this.form.orderItemsList.length == 0) {
- this.$message.warning("请先添加采购明细");
- return;
- }
- // 计算合计用于展示
- let goodsNumhe = 0;
- let subTotalMoneyhe = 0;
- for (let item of this.form.orderItemsList) {
- goodsNumhe += Number(item.goodsNum);
- subTotalMoneyhe += Number(item.subTotalMoney);
- }
- this.$alert(
- `<div style="text-align: center"><span style="color: #d85542">一件采购入库不可撤销,请确认无误在操作</span><br><span>本次入库金额:${subTotalMoneyhe.toFixed(
- 2
- )}</span><br><span>本次入库数量:${goodsNumhe}</span><br><span>是否要一件采购入库?</span></div>`,
- "提示",
- {
- dangerouslyUseHTMLString: true
- }
- ).then(() => {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- shortcutWarehousing(this.form)
- .then(res => {
- this.$message.success("保存成功");
- this.isAddBtn = true; // 表格的添加商品禁用
- this.refresh(res.data.data.id);
- loading.close();
- })
- .catch(() => {
- loading.close();
- });
- });
- },
- // 获取明细信息
- getDetailsfun() {
- getDetails({
- id: this.detailData.id
- }).then(res => {
- this.form = res.data.data;
- this.form.orderItemsList = res.data.data.orderItemsList;
- this.editButton = true; //显示编辑按钮
- });
- },
- // 获取左侧筛选
- getAllWorkDicts() {
- getCorpType({ corpType: "SP", whetherIntegral: "0" }).then(res => {
- this.treeDataGoods = res.data.data;
- });
- },
- //导入页左商品类型查询
- nodeClick(data) {
- this.treeDeptId = data.id;
- this.page.currentPage = 1;
- this.onLoadfun(this.page, { ...this.SelectSearch, goodsTypeId: this.treeDeptId });
- },
- closeGoods() {
- this.treeDataGoods = [];
- this.treeDeptId = "";
- this.activeNameTabs = "searchList";
- },
- //刷新触发
- refreshChange() {
- this.page.currentPage = 1;
- this.onLoadfun(this.page);
- },
- // 这个方法是解决 this.onLoad is not a function 的问题
- onaloadfun(page, params = { artsVision: this.form.belongToCorpId }) {
- this.loading = true;
- getList({
- ...params,
- current: page.currentPage,
- size: page.pageSize,
- whetherIntegral: "0"
- }).then(res => {
- console.log(res, 1213);
- const data = res.data.data;
- this.page.total = data.total;
- this.pageList.total = data.total;
- this.data = data.records;
- this.goodsListShow = data.records;
- this.loading = false;
- });
- // getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId, null).then(res => {
- // const data = res.data.data;
- // this.page.total = data.total;
- // this.pageList.total = data.total
- // this.data = data.records;
- // this.goodsListShow = data.records;
- // this.loading = false;
- // });
- },
- //选中触发
- selectionChange(list) {
- this.tableData = list;
- },
- // 点击搜索触发
- goodsSearch(params, done) {
- this.page.currentPage = 1;
- params = {
- ...params,
- artsVision: this.form.belongToCorpId
- };
- this.onLoadfun(this.page, params);
- done();
- },
- // 标签页切换
- tabHandle(data) {
- if (data.name == "searchList") {
- this.goodsListShow = this.data;
- this.page.total = this.pageList.total;
- } else if (data.name == "importStaging") {
- this.goodsListShow = this.goodsListSave;
- this.page.total = 0;
- }
- },
- // 商品信息价格计算
- amountChange(value, row) {
- if (value > 0) {
- this.$refs.crud.toggleRowSelection(row, true);
- } else {
- this.$refs.crud.toggleRowSelection(row, false);
- }
- // 价格
- // if (!row.price) {
- // row.price = 0;
- // }
- },
- importStagList(row, index, type) {
- this.goodsListSave.push(row);
- },
- removeStagList(row, index, type) {
- this.goodsListSave.splice(row.$index, 1);
- },
- //确认导入触发
- async importGoods() {
- this.surplusRouteQuantityOption.push({ storageQuantity: "0" });
- if (this.goodsListSave.length > 0) {
- this.goodsListSaveHandle();
- } else {
- if (this.tableData.length > 0) {
- this.tableDataHandle();
- }
- }
- },
- // 导入按钮事件
- tableDataHandle() {
- // 循环获取库存数量
- for (let item of this.tableData) {
- console.log(item, "循环导入");
- let page = {};
- if (this.form.storageId) {
- page.storageId = this.form.storageId;
- }
- page.goodsId = item.id;
- dotList(page).then(res => {
- console.log(res.data, "获取到的数据");
- var obj = {};
- if (res.data.data.length > 0) {
- obj.inventory = res.data.data[0].balanceQuantity;
- if (item.dot) {
- obj.dot = item.dot;
- } else {
- obj.dot = "";
- }
- }
- this.form.orderItemsList.push({
- ...obj,
- price: item.price,
- goodsId: item.id,
- goodsName: item.cname,
- dot: item.dot,
- brandName: item.brandName,
- brandId: item.brandId,
- goodsNo: item.code,
- // propertyName:item.typeno,
- // 规格型号
- propertyName: item.specificationAndModel,
- // 花纹
- pattern: item.brandItem,
- // 商品描述
- goodsDescription: item.goodsDescription,
- goodsNum: item.goodsNum,
- units: item.unit,
- inventory: item.inventory,
- // sendNum:res.data.data[0],
- // 小计
- subTotalMoney: item.goodsNum * item.price,
- //
- // inventory:item.balanceQuantity,
- // 备注
- remarks: item.remarks,
- // 判断批次号是否可以编辑
- whether: item.whether,
- rebatePrice: item.rebatePrice,
- // 批次号的状态
- dotedittype: false,
- // 价格数量
- goodsNumtype: false,
- // 价格
- pricetype: false,
- // 是否是编辑状态
- mingxibaocun: true
- });
- console.log(this.form.orderItemsList);
- });
- }
- this.mingxibaocun = false;
- this.dialogVisible = false;
- },
- // 导入
- goodsListSaveHandle() {
- this.tableData = this.goodsListSave;
- this.tableDataHandle();
- },
- //导入商品弹窗列表查询
- onLoadfun(page, params = {}) {
- console.log(params);
- this.loading = true;
- getList({
- ...params,
- current: page.currentPage,
- size: page.pageSize,
- customId: this.form.customerId,
- stock: this.form.storageId,
- enableOrNot: 1,
- artsVision: this.form.belongToCorpId,
- goodsTypeId: this.treeDeptId,
- whetherIntegral: "0",
- ...Object.assign(params, this.SelectSearch)
- }).then(res => {
- res.data.data.records.forEach(e => {
- e.rebatePrice = 0;
- });
- const data = res.data.data;
- this.page.total = data.total;
- this.pageList.total = data.total;
- this.data = data.records;
- this.goodsListShow = data.records;
- // 获取单价数据
- for (let item of this.goodsListShow) {
- let page = {};
- item.goodsNum = item.goodsNum ? item.goodsNum : 0;
- if (this.form.storageId) {
- page.storageId = this.form.storageId;
- }
- page.goodsId = item.id;
- if (this.form.storageId) {
- dotList(page).then(res => {
- item.price = res.data.data[0].inventoryCostPrice ? res.data.data[0].inventoryCostPrice : 0;
- });
- }
- }
- this.loading = false;
- });
- },
- // 采购明细行编辑
- hangeditBtn(row, index) {
- for (let item of this.form.orderItemsList) {
- this.picihaolistfun(item.goodsId);
- getDetailsLT({ id: item.goodsId }).then(res => {
- this.$set(item, "whether", res.data.data.whether);
- });
- }
- row.dotedittype = true;
- // 价格数量
- row.goodsNumtype = true;
- row.pricetype = true;
- // 编辑和保存状态切换
- this.mingxibaocun = false;
- },
- // 保存按钮
- hangbaocun(row) {
- row.dotedittype = false;
- row.goodsNumtype = false;
- row.pricetype = false;
- this.mingxibaocun = true;
- },
- // 批次号获取数据
- picihaolistfun(goodsId) {
- dotList({
- storageId: this.form.storageId,
- goodsId: goodsId,
- whether: 1
- }).then(res => {
- this.picihaolist = res.data.data;
- });
- },
- // 编辑
- editBtn(row, index) {
- this.confirmEditing();
- this.$refs.formContacts.dicInit();
- dotList({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => {
- this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data;
- });
- },
- //表头编辑
- confirmEditing() {
- this.editButton = false; // 让保存按钮出来
- this.viewDisabled = true; // 请核审批禁用
- goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : "").then(res => {
- this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data;
- });
- if (this.form.status == "已收货") {
- this.viewDisabled = false;
- return;
- }
- if (this.form.status == "审核中") {
- this.$set(this.optionForm, "disabled", false);
- this.findObject(this.optionForm.column, "customerId").disabled = true;
- this.findObject(this.optionForm.column, "storageId").disabled = true;
- this.findObject(this.optionForm.column, "businesDate").disabled = true;
- this.findObject(this.optionForm.column, "phone").disabled = true;
- this.findObject(this.optionForm.column, "receivableType").disabled = true;
- this.isRevocationRequest = false; // 撤销请核按钮放开
- this.viewDisabled = false; // 请核审批大按钮可点击
- return;
- }
- this.isAddBtn = false;
- if (this.form.status == "已收货") {
- return;
- }
- if (this.form.status == "已取消" || this.form.status == "退款请核") {
- this.isAddBtn = true;
- }
- if (this.form.status == "待发货") {
- this.isAddBtn = true;
- this.isDisabledTask = false;
- }
- this.optionContactsBack.column.forEach(its => {
- if (its.prop == "goodsId" || its.prop == "goodsNum" || its.prop == "price" || its.prop == "dot" || its.prop == "remarks") {
- its.disabled = false;
- } else {
- its.disabled = true;
- }
- });
- // this.$set(this.optionForm, 'disabled', false)
- // this.$set(this.optionContactsBack, 'disabled', false)
- this.isDisabled = false;
- this.isAdd = false;
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- if (this.form.status == "待收货" || this.form.status == "已收货") {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- this.optionForm.column.forEach(its => {
- if (its.prop != "remarks") {
- its.disabled = true;
- } else {
- its.disabled = false;
- }
- });
- this.optionContactsBack.column.forEach(its => {
- if (its.prop != "remarks") {
- its.disabled = true;
- } else {
- its.disabled = false;
- }
- });
- loading.close();
- } else if (this.form.status == "录入") {
- this.isDisabledTask = false;
- this.viewDisabled = false;
- this.$set(this.optionForm, "disabled", false);
- this.$set(this.optionContactsBack, "disabled", false);
- this.isContacts = false;
- //删除按钮
- this.isDisabled = false;
- loading.close();
- } else if (this.form.status == "待确认") {
- this.isDisabledTask = false;
- this.isAddBtn = false;
- this.isAdd = false;
- this.isDisabled = false;
- this.viewDisabled = false;
- // this.isDisabled = true
- this.buttonText = "生成任务";
- loading.close();
- }
- if (this.form.status == "待收货") {
- this.isDisabledTask = false;
- this.viewDisabled = false;
- }
- this.form.outboundRecordsList.forEach(item => {
- if (item.statusName == "待出库") {
- this.isDisabledTask = true;
- }
- });
- if (this.form.checkStatus == "审核完成") {
- this.$set(this.optionForm, "disabled", false);
- this.$set(this.optionContactsBack, "disabled", true);
- this.findObject(this.optionForm.column, "customerId").disabled = true;
- this.findObject(this.optionForm.column, "storageId").disabled = true;
- this.findObject(this.optionForm.column, "businesDate").disabled = true;
- this.findObject(this.optionForm.column, "phone").disabled = true;
- this.findObject(this.optionForm.column, "receivableType").disabled = true;
- this.isContacts = true;
- this.isDisabled = true;
- //添加删除按钮禁用
- this.isAdd = true;
- this.isAddBtn = true;
- }
- loading.close();
- },
- generateOutbound() {
- if (!this.form.id) {
- this.$message.error("请先保存");
- } else {
- if (this.buttonText === "生成任务") {
- //生成任务逻辑
- if (this.form.orderItemsList.length <= 0) {
- this.$message.error("请录入明细");
- } else {
- this.$set(this.optionForm, "disabled", true);
- this.$set(this.optionContactsBack, "disabled", true);
- this.$refs["form"].validate((valid, done) => {
- if (valid) {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- inboundTask({
- bsType: "CG",
- ...this.form
- })
- .then(res => {
- this.refresh(res.data.data.id);
- // this.isDisabledTask = false
- this.editButton = true;
- this.isDisabledTask = true;
- // 将按钮文本更改为"撤销任务"
- this.buttonText = "撤销任务";
- // 将按钮颜色更改为对应的颜色
- this.buttonColor = "warning"; // 比如改为warning
- this.refresh(res.data.data.id, true);
- this.isContacts = true;
- this.isAdd = true;
- this.isDisabled = true;
- // this.findObject(this.optionForm,'disabled') = true
- // this.findObject(this.optionContactsBack,'disabled') = true
- this.$message.success("生成入库任务成功");
- this.isApplySettlement = false;
- loading.close();
- // generateShipTask(this.form).then(res => {
- // console.log(res.data);
- // // 将按钮文本更改为"撤销任务"
- // this.buttonText = '撤销任务';
- // // 将按钮颜色更改为对应的颜色
- // this.buttonColor = 'warning'; // 比如改为warning
- // this.refresh(res.data.data.id, true)
- // this.isContacts = true
- // this.isAdd = true
- // this.isDisabled = true
- // // this.findObject(this.optionForm,'disabled') = true
- // // this.findObject(this.optionContactsBack,'disabled') = true
- // this.$message.success("生成入库任务成功");
- // this.isApplySettlement = false
- // loading.close();
- //
- // }).finally(() => {
- // loading.close();
- // });
- })
- .finally(() => {
- loading.close();
- });
- } else {
- return false;
- }
- });
- done();
- } else {
- this.$message.error("请选择仓库");
- }
- });
- }
- } else {
- this.$refs["form"].validate((valid, done) => {
- console.log(valid);
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- revokeInboundTask(this.form)
- .then(res => {
- this.isDisabledTask = true;
- this.editButton = true;
- // 将按钮文本更改为"生成任务"
- this.buttonText = "生成任务";
- // 将按钮颜色还原为success
- this.buttonColor = "success";
- this.$message.success("撤销入库成功");
- this.refresh(res.data.data.id);
- this.isApplySettlement = false;
- loading.close();
- })
- .catch(err => {
- console.log(err);
- if (err instanceof TooManyResultsException) {
- // 不显示错误消息
- return;
- }
- // 显示其他错误消息
- this.$message.error("发生错误,请稍后重试");
- })
- .finally(() => {
- loading.close();
- });
- done();
- }
- });
- }
- }
- },
- //联系人change
- contactsChange(e) {
- console.log(e);
- console.log(this.contactsOption);
- // 假设this.contactsOption是你的数组对象
- let matchedContact = this.contactsOption.find(item => item.contacts == e);
- // 判断是否找到匹配的对象
- this.$set(this.form, "phone", matchedContact.tel);
- // this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate((valid, done) => {
- done();
- let picihao = false;
- if (valid) {
- for (let i in this.form.orderItemsList) {
- this.form.orderItemsList[i].subTotalMoney = this.form.orderItemsList[i].goodsNum * this.form.orderItemsList[i].price;
- if (this.form.orderItemsList[i].goodsNum <= 0) {
- this.$message.warning(`采购明细序号${Number(i) + 1}的数量不能为零`);
- picihao = true;
- }
- if (!this.form.orderItemsList[i].sendNum) {
- this.form.orderItemsList[i].sendNum = 0;
- }
- }
- this.mingxibaocun = true;
- if (picihao) {
- return;
- }
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- this.form.storageName = this.form.$storageId ? this.form.$storageId : "";
- submit({
- bsType: "CG",
- ...this.form
- })
- .then(res => {
- if (res.data.code === 601) {
- if (this.onLoad.id) {
- console.log(2);
- this.refresh(this.onLoad.id, true);
- }
- this.$message({
- type: "error",
- message: res.data.msg
- });
- return true;
- }
- this.$message.success("保存成功");
- this.refresh(res.data.data.id);
- this.isDisabledTask = false;
- // this.editButton = true // 让编辑按钮出来
- // this.isDisabledTask = false;
- // this.viewDisabled = false;
- this.isAddBtn = false; // 表格的添加商品禁用
- this.$set(this.optionForm, "disabled", false);
- this.$set(this.optionContactsBack, "disabled", false);
- this.isContacts = true; // 基础信息联系人 和地址插槽禁用
- // 表格的删除按钮禁用
- this.isDisabled = false;
- this.isAdd = false; // 表格的编辑和保存按钮禁用
- loading.close();
- })
- .finally(() => {
- loading.close();
- });
- } else {
- return false;
- }
- });
- },
- //保存
- save() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- inboundTask({
- bsType: "CG",
- ...this.form
- })
- .then(res => {
- console.log(1);
- this.refresh(res.data.data.id);
- this.isDisabledTask = false;
- loading.close();
- })
- .finally(() => {
- loading.close();
- });
- } else {
- return false;
- }
- });
- },
- inBtn() {},
- //关闭弹窗表单
- beforeClose(done, type) {
- console.log(type);
- // if(row == "add"){
- // this.form.sharedCompanyId = this.form.sharedCompanyId?this.form.sharedCompanyId:''
- // this.form.sharedCompanyName = this.form.sharedCompanyName?this.form.sharedCompanyName:''
- // }
- console.log("this.form.sharedCompanyId", this.form.sharedCompanyId);
- console.log("this.form.sharedCompanyName", this.form.sharedCompanyName);
- done();
- },
- refresh(id, type) {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- getDetails({ id: id })
- .then(res => {
- this.form = res.data.data;
- let ordForm = { srcBillNo: this.form.ordNo };
- let _this = this;
- this.dataList = res.data.data.paymentRecordsList ? res.data.data.paymentRecordsList : [];
- this.$nextTick(() => {
- this.$refs.formContacts.doLayout();
- });
- // if (this.form.status !== '录入' &&
- // this.form.status !== '退款中' &&
- // this.form.status !== '已取消' &&
- // this.form.status !== '退款请核' &&
- // this.form.status !== '已退款' &&
- // this.form.status !== '待确认' &&
- // this.form.status !== '待收货') {
- // this.isApplySettlement = false;
- // }
- if (this.form.status == "审核中") {
- this.isApplySettlement = false;
- this.isRevocationRequest = false; // 撤销请核能点击
- }
- // if (this.form.status == '待确认') {
- // this.isApplySettlement = true;
- // }
- // if (this.form.status === '已退款' || this.form.status === '已收货' || this.form.status === '已取消') {
- // // 禁用编辑按钮
- // console.log('按钮全部禁用');
- // this.isDisabledTask = true;
- // this.viewDisabled = true;
- // }
- // if (this.form.status === '已收货') {
- // this.isDisabledTask = true;
- // this.viewDisabled = true;
- // }
- //
- // if (this.form.status == '退款中') {
- // this.isConfirmRefundBtn = false;
- // }
- // if (this.form.status == '已取消') {
- // this.isConfirmRefundBtn = true;
- // }
- //
- if (this.form.generateTask == "已生成") {
- this.buttonText = "撤销任务";
- // this.isDisabledTask = false;
- this.buttonColor = "warning";
- }
- // if (this.form.status == '退款请核' || this.form.status == '退款中') {
- // this.isRevocationRequest = false;
- // }
- //成本、毛利对销售角色隐藏
- this.optionForm.column.forEach(its => {
- if (
- JSON.parse(localStorage.getItem("saber-userInfo"))
- .content.role_name.split(",")
- .includes("销售")
- ) {
- if (its.prop == "cost" || its.prop == "grossProfit") {
- this.$set(its, "display", false);
- }
- }
- });
- this.form.orderItemsList.forEach(items => {
- if (!items.subTotalMoney) {
- items.subTotalMoney = items.goodsNum * items.price;
- items.grossProfit = items.subTotalMoney - items.costprie;
- }
- });
- if (res.data.data.checkStatus == "审核完成") {
- console.log("审核完成");
- this.$set(this.optionForm, "disabled", true);
- this.$set(this.optionContactsBack, "disabled", true);
- this.isContacts = true;
- this.isDisabled = true;
- //添加删除按钮禁用
- this.isAdd = true;
- }
- loading.close();
- })
- .catch(() => {
- loading.close();
- });
- },
- operationType() {},
- //请核关闭
- choceScheduleFun() {
- this.checkScheduleDialog = false;
- },
- //关闭审核
- choceCheckFun() {
- this.refresh(this.onLoad.id);
- // this.isDisabledTask = false
- this.isExamineBtn = !this.isExamineBtn;
- this.checkDialog = false;
- },
- //请核数据qing
- applySettlement(type) {
- this.$confirm("您确定请核吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- const data = {
- id: this.form.id,
- url: "/tirePartsMall/salesManagement/purchaseOrder/index",
- pageStatus: "this.$store.getters.purchaseStatus",
- pageLabel: "采购订单"
- };
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- checkOrderCG({ ...data })
- .then(res => {
- this.refresh(res.data.data.id);
- this.$message.success("请核成功");
- this.isApplySettlement = !this.isApplySettlement;
- loading.close();
- console.log(res);
- })
- .catch(() => {
- loading.close();
- });
- }
- });
- });
- },
- //确认退款
- confirmRefundBtn() {
- this.$confirm("您确定退款吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- // this.form.orderItemsList.forEach((items) => {
- // let brandName = items.brandId
- // items.brandId = items.brandName
- // items.brandName = brandName
- // let goodsName = items.goodsId
- // items.goodsId = items.goodsName
- // items.goodsName = goodsName
- // })
- confirmRefund({ ...this.form })
- .then(res => {
- loading.close();
- this.$message.success("确定退款成功");
- })
- .catch(() => {
- loading.close();
- });
- });
- },
- //审批
- examineBtn() {
- this.checkData = this.$route.query.check;
- console.info("this.checkData---11111---", this.checkData);
- this.checkDialog = true;
- },
- //撤销请核
- revocationRequest() {
- this.$confirm("您确定撤回此次申请吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: "加载中",
- spinner: "el-icon-loading",
- background: "rgba(255,255,255,0.7)"
- });
- // this.form.orderItemsList.forEach((items) => {
- // if (!items.subTotalMoney) {
- // items.subTotalMoney = items.goodsNum * items.price
- // items.grossProfit = items.subTotalMoney - items.costprie
- // }
- // let brandName = items.brandId
- // items.brandId = items.brandName
- // items.brandName = brandName
- // let goodsName = items.goodsId
- // items.goodsId = items.goodsName
- // items.goodsName = goodsName
- // })
- revokeCheckOrderCG({ ...this.form })
- .then(res => {
- this.isRevocationRequest = !this.isRevocationRequest;
- this.refresh(res.data.data.id);
- this.$message.success("撤回成功");
- loading.close();
- })
- .catch(() => {
- loading.close();
- });
- });
- },
- rowDelBox(row, index, type) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- delOrderItem({ ids: row.id }).then(res => {
- this.form.orderItemsList.splice(index, 1);
- this.$message.success("操作成功!");
- });
- } else {
- this.form[type].splice(index, 1);
- this.$message.success("操作成功!");
- }
- });
- },
- // 明细信息多选
- selectionContacts(list) {
- this.selectionMultilist = list;
- },
- // 一键删除
- batchDelete() {
- if (this.selectionMultilist.length == 0) {
- return this.$message.warning("请选择要删除的数据");
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- let multiList = this.selectionMultilist;
- let arr = this.form.orderItemsList;
- // 获取有id 的数据
- const itemsWithId = multiList.filter(item => item.hasOwnProperty("id"));
- let arrIds = itemsWithId.map(item => item.id); // 获取id 数据
- // 把选中的删除掉
- multiList.forEach(item => {
- for (let index in arr) {
- if (JSON.stringify(item) == JSON.stringify(arr[index])) {
- arr.splice(Number(index), 1);
- }
- }
- });
- // 有id 的处理
- if (itemsWithId.length != 0) {
- delOrderItem({ ids: arrIds.join(",") }).then(res => {
- this.$message.success("操作成功!");
- });
- }
- });
- },
- rowSave(form, done, loading) {
- form.subTotalMoney = form.goodsNum * form.price;
- form.goodsName = form.$goodsId;
- if (this.isStatus) {
- console.log(form);
- done(form);
- } else {
- this.$message.error("请选择相同商户的商品");
- }
- console.log(form);
- // this.form.sharedCompanyId = res.data.data.sharedCompanyId
- // this.form.sharedCompanyName = res.data.data.sharedCompanyName
- },
- rowUpdate(form, index, done, loading) {
- this.$set(form, "goodsName", form.$goodsId);
- console.log(form);
- done(form);
- },
- // 新增商品
- rowAdd(row) {
- if (!this.form.customerId) {
- this.$message.error("请选择供应商");
- return;
- }
- this.optionContactsBack.column.forEach(its => {
- if (its.prop == "goodsId" || its.prop == "goodsNum" || its.prop == "price" || its.prop == "dot" || its.prop == "remarks") {
- its.disabled = false;
- } else {
- its.disabled = true;
- }
- });
- console.log("新增了", row);
- this.getAllWorkDicts();
- this.refreshChange();
- this.goodsListSave = [];
- this.dialogVisible = true;
- // this.$refs.formContacts.rowAdd()
- },
- uploadAfter(res, done, loading, column) {
- if (Array.isArray(res)) {
- if (res instanceof Array) {
- this.form.orderItemsList = this.form.orderItemsList.concat(res);
- res.forEach(item => {
- dotList({
- storageId: this.form.storageId,
- goodsId: res.goodsId
- }).then(e => {
- this.findObject(this.optionContactsBack.column, "dot").dicData = e.data.data;
- });
- });
- }
- } else {
- this.$message.error(res);
- }
- this.excelBox = false;
- loading = false;
- done(res);
- },
- derivation() {
- window.open(`${this.templateUrl}?${this.website.tokenHeader}=${getToken()}`);
- },
- uploadBefore(file, done, loading) {
- done();
- loading = true;
- },
- // 采购明细 导入按钮
- excelDialogfun(name) {
- if (name == "名称") {
- this.findObject(this.excelOption.column, "excelFile").action = "/api/blade-sales-part/ship/import-item";
- this.templateUrl = "/api/blade-sales-part/ship/export-item";
- } else if (name == "code") {
- this.findObject(this.excelOption.column, "excelFile").action = "/api/blade-sales-part/ship/import-item-code";
- this.templateUrl = "/api/blade-sales-part/ship/export-item-code";
- }
- this.excelBox = true;
- },
- //打印
- handlePrint() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- isProcurement({ param: "whether.model" }).then(res => {
- if (res.data.data == 1) {
- this.findObject(this.optionContacts.column, "pattern").label = "规格型号1";
- }
- });
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- isProcurement({ param: "whether.model" }).then(res => {
- if (res.data.data == 1) {
- this.findObject(this.optionContacts.column, "pattern").label = "规格型号1";
- }
- });
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- backToList(type) {
- this.$emit("backToList", type);
- },
- // 弹框的重置
- resetCrud() {
- this.$message.success("重置成功");
- },
- // 弹窗的保存
- saveCrud() {
- this.$message.success("保存成功");
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- </style>
|