1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429 |
- <template>
- <div class="app-container">
- <div class="main-top">
- <div class="title">选择置换方式</div>
- <el-radio-group v-model="type" @change="changeType">
- <!-- <el-radio :label="1">订单置换</el-radio> -->
- <el-radio :label="2">批量置换</el-radio>
- </el-radio-group>
- </div>
- <div class="main-title">
- <div class="title">被置换产品信息</div>
- <div>
- <el-button size="mini" type="primary" @click="openBeiGoodsDialog">选择机型</el-button>
- </div>
- </div>
- <div class="table">
- <el-table :data="beiGoodsList" border fit highlight-current-row stripe>
- <el-table-column
- align="left"
- label="物料编码"
- prop="number"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品编码"
- prop="oldNumber"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="350"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="单位"
- prop="baseUnitId"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column align="center" label="操作" min-width="100" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="deleteBeiGoodsList(scope.$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="main-title">
- <div class="title">可置换产品信息</div>
- <div>
- <!-- <el-radio-group v-model="isEquivalent" :disabled="orderList.length">
- <el-radio
- v-for="item in [
- { label: '同价置换', value: 0 },
- { label: '非同价置换', value: 1 }
- ]"
- :key="item.value"
- :label="item.value"
- >{{ item.label }}</el-radio
- >
- </el-radio-group> -->
- <el-button size="mini" type="primary" @click="openKeGoodsDialog">选择机型</el-button>
- </div>
- </div>
- <div class="table">
- <el-table v-show="isEquivalent === 0" :data="keGoodsList" border fit highlight-current-row stripe>
- <el-table-column
- align="left"
- label="物料编码"
- prop="number"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品编码"
- prop="oldNumber"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="350"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="单位"
- prop="baseUnitId"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column align="center" label="操作" min-width="100" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="deleteKeGoodsList(scope.$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-table v-show="isEquivalent === 1" :data="keGoodsList" border fit highlight-current-row stripe>
- <el-table-column align="left" label="销售类型" prop="saleTypeCode" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.saleTypeCode"
- placeholder="请选择"
- size="mini"
- clearable
- filterable
- @change="handleChange($event, scope.row)"
- >
- <el-option v-for="item in saleList" :key="item.saleCode" :label="item.saleName" :value="item.saleCode" />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="物料编码"
- prop="number"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品编码"
- prop="oldNumber"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="350"
- show-overflow-tooltip
- />
- <el-table-column align="left" label="置换单价" prop="price" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-input
- v-model.number="scope.row.price"
- type="number"
- placeholder="请输入"
- size="mini"
- clearable
- @change=""
- />
- </template>
- </el-table-column>
- <el-table-column align="left" label="格力折扣" prop="discAmount" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-input
- v-model.number="scope.row.discAmount"
- type="number"
- placeholder="请输入"
- size="mini"
- clearable
- @change=""
- />
- </template>
- </el-table-column>
- <el-table-column align="left" label="返利类型" prop="walletRebateId" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.walletRebateId"
- placeholder="请选择"
- size="mini"
- clearable
- filterable
- @change="handleChangeRebate($event, scope.row)"
- >
- <el-option
- v-for="item in rebateSaletypelist"
- :key="item.walletRebateId"
- :label="item.name"
- :value="item.walletRebateId"
- />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作" min-width="100" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="deleteKeGoodsList(scope.$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="main-title">
- <div class="title">被置换订单信息</div>
- <div>
- <el-button size="mini" type="primary" @click="openOrderDialog">选择置换订单</el-button>
- </div>
- </div>
- <div class="table">
- <el-table :data="orderList" border fit highlight-current-row stripe>
- <el-table-column align="left" label="订单号" prop="id" min-width="120" show-overflow-tooltip />
- <el-table-column align="left" label="经销商信息" prop="displaceOrderId" min-width="250" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.customerName + '(' + scope.row.customerNumber + ')' }}
- </template>
- </el-table-column>
- <el-table-column align="center" label="被置换机型" prop="displaceOrderId" min-width="160" show-overflow-tooltip>
- <el-table-column
- align="left"
- label="销售类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="materialName"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="250"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="单价"
- prop="price"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="可被置换数量"
- prop="refundableQty"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="返利类型"
- prop="rebateWalletName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="使用返利金额"
- prop="payRebateAmount"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="格力折扣"
- prop="totalDiscAmount"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="现金钱包"
- prop="walletName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="实付金额"
- prop="payAmount"
- min-width="100"
- show-overflow-tooltip
- />
- </el-table-column>
- <el-table-column align="center" label="置换机型" prop="displaceOrderId" min-width="160" show-overflow-tooltip>
- <el-table-column
- align="left"
- label="销售类型"
- prop="ke_saleTypeName"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="ke_materialName"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="ke_specification"
- min-width="350"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="单价"
- prop="ke_price"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column align="right" label="置换数量" prop="ke_refundableQty" min-width="100" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-input v-model="scope.row.ke_refundableQty" size="mini" type="number" />
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="返利类型"
- prop="ke_rebateWalletName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="使用返利金额"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <!-- {{ scope.row.singleRebateAmount * scope.row.ke_refundableQty }} -->
- {{
- (scope.row.ke_price * scope.row.ke_refundableQty -
- scope.row.ke_discAmount * scope.row.ke_refundableQty) *
- scope.row.ke_rebateRate
- }}
- </template>
- </el-table-column>
- <el-table-column align="right" label="格力折扣" prop="ke_discAmount" min-width="100" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.ke_discAmount * scope.row.ke_refundableQty }}
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="现金钱包"
- prop="walletName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column align="right" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip>
- <template slot-scope="scope">
- <!-- {{
- scope.row.ke_price * scope.row.ke_refundableQty -
- scope.row.singleRebateAmount * scope.row.ke_refundableQty -
- scope.row.ke_discAmount
- }} -->
- {{
- scope.row.ke_price * scope.row.ke_refundableQty -
- scope.row.ke_discAmount * scope.row.ke_refundableQty -
- (scope.row.ke_price * scope.row.ke_refundableQty -
- scope.row.ke_discAmount * scope.row.ke_refundableQty) *
- scope.row.ke_rebateRate
- }}
- </template>
- </el-table-column>
- </el-table-column>
- <el-table-column align="center" label="操作" min-width="100" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="deleteOrderList(scope.$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="page-footer">
- <div class="footer">
- <el-button type="primary" @click="submitForm">提交置换</el-button>
- <el-popconfirm title="确定要重置吗?" style="margin-left: 10px" @onConfirm="resetForm">
- <el-button slot="reference">重 置</el-button>
- </el-popconfirm>
- </div>
- </div>
- <el-dialog title="选择被置换产品" :visible.sync="beiGoodsDialog_show" width="80%">
- <el-form
- ref="beiGoodsDialog_screenForm"
- :model="beiGoodsDialog_screenForm"
- size="mini"
- label-position="left"
- label-width="80px"
- >
- <el-row :gutter="20">
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="number" label="物料编码">
- <el-input v-model="beiGoodsDialog_screenForm.number" placeholder="请输入物料编码" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="oldNumber" label="产品编码">
- <el-input v-model="beiGoodsDialog_screenForm.oldNumber" placeholder="请输入产品编码" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="keyword" label="产品名称">
- <el-input v-model="beiGoodsDialog_screenForm.keyword" placeholder="请输入产品名称" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item label="规格型号" prop="specification">
- <el-input v-model="beiGoodsDialog_screenForm.specification" placeholder="请输入规格型号" />
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :lg="24" class="tr">
- <el-form-item label="">
- <el-button @click="resetBeiGoodsDialogScreenForm">清空</el-button>
- <el-button type="primary" @click="submitBeiGoodsDialogScreenForm">搜索</el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="table">
- <el-table
- :data="beiGoodsDialog_list"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- height="400"
- >
- <el-table-column align="center" width="80">
- <template slot-scope="scope">
- <el-button
- type="primary"
- size="mini"
- :disabled="scope.row.selected"
- @click="submitChooseBeiGoods(scope.row)"
- >选择
- </el-button>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="物料编码"
- prop="number"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品编码"
- prop="oldNumber"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="是否可被置换"
- prop="unit"
- min-width="80"
- show-overflow-tooltip
- />
- </el-table>
- <div class="pagination clearfix" style="margin-top: 10px">
- <div class="fr">
- <el-pagination
- :current-page="beiGoodsDialog_currentPage"
- :page-size="100"
- background
- layout="prev, pager, next"
- :total="beiGoodsDialog_listTotal"
- @current-change="changeBeiGoodsDialogPage"
- />
- </div>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closeBeiGoodsDialog">取 消</el-button>
- </span>
- </el-dialog>
- <el-dialog title="选择可置换产品" :visible.sync="keGoodsDialog_show" width="80%">
- <el-form
- ref="keGoodsDialog_screenForm"
- :model="keGoodsDialog_screenForm"
- size="mini"
- label-position="left"
- label-width="80px"
- >
- <el-row :gutter="20">
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="number" label="物料编码">
- <el-input v-model="keGoodsDialog_screenForm.number" placeholder="请输入物料编码" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="oldNumber" label="产品编码">
- <el-input v-model="keGoodsDialog_screenForm.oldNumber" placeholder="请输入产品编码" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="keyword" label="产品名称">
- <el-input v-model="keGoodsDialog_screenForm.keyword" placeholder="请输入产品名称" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item label="规格型号" prop="specification">
- <el-input v-model="keGoodsDialog_screenForm.specification" placeholder="请输入规格型号" />
- </el-form-item>
- </el-col>
- <!-- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item label="置换产品价格类型" prop="displaceType" label-width="125px">
- <el-select v-model="keGoodsDialog_screenForm.displaceType" placeholder="请选择置换产品价格类型">
- <el-option
- v-for="item in displaceTypeList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col> -->
- <el-col :xs="24" :sm="24" :lg="24" class="tr">
- <el-form-item label="">
- <el-button @click="resetKeGoodsDialogScreenForm">清空</el-button>
- <el-button type="primary" @click="submitKeGoodsDialogScreenForm">搜索</el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="table">
- <el-table
- v-show="type === 1"
- :data="keGoodsDialog_list"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- height="400"
- @selection-change="changeKeGoodsDialogSelection"
- >
- <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect" />
- <el-table-column
- align="left"
- label="物料编码"
- prop="number"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品编码"
- prop="oldNumber"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="160"
- show-overflow-tooltip
- />
- </el-table>
- <el-table
- v-show="type === 2"
- :data="keGoodsDialog_list"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- height="400"
- >
- <el-table-column align="center" width="80">
- <template slot-scope="scope">
- <el-button
- type="primary"
- size="mini"
- :disabled="scope.row.selected"
- @click="submitChooseKeGoods(scope.row)"
- >选择
- </el-button>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="物料编码"
- prop="number"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品编码"
- prop="oldNumber"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="160"
- show-overflow-tooltip
- />
- </el-table>
- <div class="pagination clearfix" style="margin-top: 10px">
- <div class="fr">
- <el-pagination
- :current-page="keGoodsDialog_currentPage"
- :page-size="100"
- background
- layout="prev, pager, next"
- :total="keGoodsDialog_listTotal"
- @current-change="changeKeGoodsDialogPage"
- />
- </div>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closeKeGoodsDialog">取 消</el-button>
- <el-button v-if="type === 1" type="primary" @click="submitChooseKeGoods">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="选择被置换订单" :visible.sync="orderDialog_show" width="80%">
- <el-form
- ref="orderDialog_screenForm"
- :model="orderDialog_screenForm"
- size="mini"
- label-position="left"
- label-width="85px"
- >
- <el-row :gutter="20">
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="id" label="订单号">
- <el-input v-model="orderDialog_screenForm.id" placeholder="请输入订单号" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="customerName" label="经销商名称">
- <el-input v-model="orderDialog_screenForm.customerName" placeholder="请输入经销商名称" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="customerNumber" label="经销商编号">
- <el-input v-model="orderDialog_screenForm.customerNumber" placeholder="请输入经销商编号" />
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="priceType" label="价格类型">
- <el-select
- v-model="orderDialog_screenForm.priceType"
- placeholder="请选择价格类型"
- size="mini"
- clearable
- filterable
- >
- <el-option
- v-for="item in priceTypeLilst"
- :key="item.priceTypeId"
- :label="item.priceTypeName"
- :value="item.priceTypeName"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :lg="24" class="tr">
- <el-form-item label="">
- <el-button @click="resetOrderDialogScreenForm">清空</el-button>
- <el-button type="primary" @click="submitOrderDialogScreenForm">搜索</el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="table">
- <el-table
- v-show="type === 1"
- :data="orderDialog_list"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- height="400"
- >
- <el-table-column align="center" width="80">
- <template slot-scope="scope">
- <el-button
- type="primary"
- size="mini"
- :disabled="scope.row.selected"
- @click="submitChooseOrder(scope.row)"
- >选择
- </el-button>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="订单号"
- prop="id"
- min-width="120"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="直调状态"
- prop="directTransferStatusName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column align="left" label="经销商信息" prop="materialName" min-width="250" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.customerName + '(' + scope.row.customerNumber + ')' }}
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="销售类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="materialName"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="250"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="可被置换数量"
- prop="refundableQty"
- min-width="100"
- show-overflow-tooltip
- />
- </el-table>
- <el-table
- v-show="type === 2"
- :data="orderDialog_list"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- height="400"
- @selection-change="changeOrderDialogSelection"
- >
- <el-table-column
- v-if="type === 2"
- align="center"
- type="selection"
- width="55"
- :selectable="checkboxSelect"
- />
- <el-table-column
- align="left"
- label="订单号"
- prop="id"
- min-width="120"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="直调状态"
- prop="directTransferStatusName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column align="left" label="经销商信息" prop="materialName" min-width="250" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.customerName + '(' + scope.row.customerNumber + ')' }}
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="销售类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="产品名称"
- prop="materialName"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="规格型号"
- prop="specification"
- min-width="250"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="价格类型"
- prop="priceType"
- min-width="250"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="可被置换数量"
- prop="refundableQty"
- min-width="100"
- show-overflow-tooltip
- />
- </el-table>
- <div class="pagination clearfix" style="margin-top: 10px">
- <div class="fr">
- <el-pagination
- :current-page="orderDialog_currentPage"
- :page-size="100"
- background
- layout="prev, pager, next"
- :total="orderDialog_listTotal"
- @current-change="changeOrderDialogPage"
- />
- </div>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closeOrderDialog">取 消</el-button>
- <el-button v-if="type === 2" type="primary" @click="submitChooseOrder">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import { getTypeList } from '@/api/common.js'
- import { getProductPriceListV2 } from '@/api/priceType.js'
- import { getWalletRebateSaletypelist } from '@/api/policy_list'
- import { getGoodsList, getOrderList, addDisplace } from '@/api/supply/displace'
- export default {
- data() {
- return {
- // 主表单信息
- type: 2,
- beiGoodsList: [], // 被置换产品列表
- keGoodsList: [], // 可置换产品列表
- orderList: [], // 被置换订单列表
- // 被置换产品弹窗信息
- beiGoodsDialog_show: false,
- beiGoodsDialog_screenForm: {
- number: '',
- oldNumber: '',
- name: '',
- specification: ''
- },
- beiGoodsDialog_list: [],
- beiGoodsDialog_currentPage: 1,
- beiGoodsDialog_listTotal: 0,
- // 可置换产品弹窗信息
- keGoodsDialog_show: false,
- keGoodsDialog_screenForm: {
- number: '',
- oldNumber: '',
- name: '',
- specification: ''
- },
- keGoodsDialog_list: [],
- keGoodsDialog_selection: [],
- keGoodsDialog_currentPage: 1,
- keGoodsDialog_listTotal: 0,
- // 被置换订单弹窗信息
- orderDialog_show: false,
- orderDialog_screenForm: {
- id: '',
- customerName: '',
- customerNumber: '',
- priceType: ''
- },
- orderDialog_list: [],
- orderDialog_selection: [],
- orderDialog_currentPage: 1,
- orderDialog_listTotal: 0,
- // 其他
- displaceTypeList: [
- { label: '基础产品价格表', value: '1' },
- { label: '家用产品价格表', value: '2' },
- { label: '商用产品价格表', value: '3' }
- ],
- isEquivalent: 1,
- saleList: [],
- rebateSaletypelist: [],
- priceTypeLilst: []
- }
- },
- watch: {
- keGoodsList: {
- deep: true,
- handler: function(val, oal) {
- if (this.orderList.length && this.type === 2) {
- this.orderList.forEach(item => {
- item.ke_materialName = val[0].name
- item.ke_specification = val[0].specification
- item.ke_refundableQty = ''
- item.ke_saleTypeName = val[0].saleTypeName
- item.ke_saleTypeCode = val[0].saleTypeCode
- item.ke_saleTypeId = val[0].saleTypeId
- item.ke_price = val[0].price
- item.ke_rebateWalletName = val[0].rebateWalletName
- item.ke_walletRebateId = val[0].walletRebateId
- item.ke_discAmount = val[0].discAmount
- item.ke_rebateRate = val[0].rebateRate
- })
- }
- }
- }
- },
- created() {
- this.getTypeList()
- },
- methods: {
- // 切换置换类型
- changeType() {
- this.resetForm()
- },
- // 查询重复值并禁选
- checkboxSelect(row, rowIndex) {
- if (row.selected) {
- return false // 禁用
- } else {
- return true // 不禁用
- }
- },
- handleChange(e, row) {
- if (e) {
- const item = this.saleList.find(k => e == k.saleCode)
- if (Object.keys(item).length) {
- this.$set(row, 'saleTypeName', item.saleName)
- this.$set(row, 'saleTypeCode', item.saleCode)
- this.$set(row, 'saleTypeId', item.id)
- }
- this.getWalletRebateSaletypelist(e)
- } else {
- this.$set(row, 'saleTypeName', '')
- this.$set(row, 'saleTypeCode', '')
- this.$set(row, 'saleTypeId', '')
- }
- },
- handleChangeRebate(e, row) {
- if (e) {
- const item = this.rebateSaletypelist.find(k => e == k.walletRebateId)
- if (Object.keys(item).length) {
- this.$set(row, 'rebateWalletName', item.name)
- this.$set(row, 'walletRebateId', item.walletRebateId)
- this.$set(row, 'rebateRate', item.rebateRate)
- }
- } else {
- this.$set(row, 'rebateWalletName', '')
- this.$set(row, 'walletRebateId', '')
- }
- },
- getTypeList() {
- getTypeList({ pageNum: 1, pageSize: -1 }).then(res => {
- this.saleList = res.data.records
- })
- return this.saleList
- },
- getWalletRebateSaletypelist(saleTypeCode) {
- getWalletRebateSaletypelist({ pageNum: 1, pageSize: -1, saleTypeCode, status: 1 }).then(res => {
- this.rebateSaletypelist = res.data.records
- })
- },
- getProductPriceListV2() {
- getProductPriceListV2({ pageNum: 1, pageSize: -1 }).then(res => {
- this.priceTypeLilst = res.data.records
- })
- },
- // 获取列表 - 被置换产品
- getBeiGoodsList() {
- getGoodsList({
- pageNum: this.beiGoodsDialog_currentPage,
- pageSize: 100,
- ...this.beiGoodsDialog_screenForm
- }).then(res => {
- const oldGoodsList = this.beiGoodsList
- 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.id === oldItem.id) {
- newGoodsList[j].selected = true
- break
- }
- }
- }
- this.beiGoodsDialog_list = newGoodsList
- this.beiGoodsDialog_listTotal = res.data.total
- })
- },
- // 收藏商品
- handleCollect(id) {
- if (!this.token) {
- return console.log('请先登录')
- }
- collectData({ id }).then(res => {
- // api请求
- console.log('收藏成功', res.data)
- })
- },
- // 加入购物车
- addToCart(id) {
- if (!this.token) {
- return console.log('请先登录')
- }
- addData({ id }).then(res => {
- // api请求
- console.log('加入购物车成功', res.data)
- })
- },
- // 立即购买
- bug() {
- if (!this.token) {
- return console.log('请先登录')
- }
- buyData({ id }).then(res => {
- // api请求
- console.log('下单成功', res.data)
- wx.requestPayment({
- // 支付
- timeStamp: '',
- nonceStr: '',
- package: '',
- signType: 'MD5',
- paySign: '',
- success(res) {},
- fail(res) {}
- })
- })
- },
- // 打开弹窗 - 被置换产品
- openBeiGoodsDialog() {
- if (this.orderList.length > 0) {
- return this.$errorMsg('已选择订单不可更改产品')
- }
- this.beiGoodsDialog_show = true
- this.getBeiGoodsList()
- },
- // 关闭弹窗 - 被置换产品
- closeBeiGoodsDialog() {
- this.beiGoodsDialog_show = false
- },
- // 提交筛选表单 - 被置换产品
- submitBeiGoodsDialogScreenForm() {
- this.beiGoodsDialog_currentPage = 1
- this.getBeiGoodsList()
- },
- // 重置筛选表单 - 被置换产品
- resetBeiGoodsDialogScreenForm() {
- this.$refs.beiGoodsDialog_screenForm.resetFields()
- this.beiGoodsDialog_currentPage = 1
- this.beiGoodsDialog_list = []
- this.getBeiGoodsList()
- },
- // 更改列表页码 - 被置换产品
- changeBeiGoodsDialogPage(val) {
- this.beiGoodsDialog_currentPage = val
- this.getBeiGoodsList()
- },
- // 确认选择产品 - 被置换产品
- submitChooseBeiGoods(item) {
- this.beiGoodsList = [item]
- this.closeBeiGoodsDialog()
- },
- // 删除产品 - 被置换产品
- deleteBeiGoodsList(index) {
- if (this.orderList.length > 0) {
- return this.$errorMsg('已选择订单不可更改产品')
- }
- this.beiGoodsList.splice(index, 1)
- },
- // 获取列表 - 可置换产品
- getKeGoodsList() {
- getGoodsList({
- pageNum: this.keGoodsDialog_currentPage,
- pageSize: 100,
- ...this.keGoodsDialog_screenForm
- }).then(res => {
- const oldGoodsList = this.keGoodsList
- 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.id === oldItem.id) {
- newGoodsList[j].selected = true
- break
- }
- }
- }
- this.keGoodsDialog_list = newGoodsList
- this.keGoodsDialog_listTotal = res.data.total
- })
- },
- // 打开弹窗 - 可置换产品
- openKeGoodsDialog() {
- if (this.orderList.length > 0) {
- return this.$errorMsg('已选择订单不可更改产品')
- }
- this.keGoodsDialog_show = true
- this.getKeGoodsList()
- },
- // 关闭弹窗 - 可置换产品
- closeKeGoodsDialog() {
- this.keGoodsDialog_show = false
- },
- // 提交筛选表单 - 可置换产品
- submitKeGoodsDialogScreenForm() {
- this.keGoodsDialog_currentPage = 1
- this.getKeGoodsList()
- },
- // 重置筛选表单 - 可置换产品
- resetKeGoodsDialogScreenForm() {
- this.$refs.keGoodsDialog_screenForm.resetFields()
- this.keGoodsDialog_currentPage = 1
- this.keGoodsDialog_list = []
- this.getKeGoodsList()
- },
- // 更改列表页码 - 可置换产品
- changeKeGoodsDialogPage(val) {
- this.keGoodsDialog_currentPage = val
- this.getKeGoodsList()
- },
- // 选择列 - 可置换产品
- changeKeGoodsDialogSelection(val) {
- this.keGoodsDialog_selection = val
- },
- // 确认选择产品 - 可置换产品
- submitChooseKeGoods(item) {
- // 订单置换(多选)
- if (this.type === 1) {
- this.keGoodsList = this.keGoodsList.concat(this.keGoodsDialog_selection)
- }
- // 批量置换(单选)
- else {
- this.$set(item, 'saleTypeName', '')
- this.$set(item, 'saleTypeCode', '')
- this.$set(item, 'saleTypeId', '')
- this.$set(item, 'price', 0)
- this.$set(item, 'discAmount', 0)
- this.$set(item, 'rebateWalletName', '')
- this.$set(item, 'walletRebateId', '')
- this.$set(item, 'rebateRate', '')
- this.keGoodsList = [item]
- }
- this.closeKeGoodsDialog()
- },
- // 删除产品 - 可置换产品
- deleteKeGoodsList(index) {
- if (this.orderList.length > 0) {
- return this.$errorMsg('已选择订单不可更改产品')
- }
- this.keGoodsList.splice(index, 1)
- },
- // 获取列表 - 被置换订单
- getOrderList() {
- getOrderList({
- pageNum: this.orderDialog_currentPage,
- pageSize: 100,
- type: 2,
- materialOldNumber: this.beiGoodsList[0].oldNumber,
- isOver: false,
- ...this.orderDialog_screenForm
- }).then(res => {
- const oldGoodsList = this.orderList
- 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.orderItemId === oldItem.orderItemId) {
- newGoodsList[j].selected = true
- break
- }
- }
- }
- this.orderDialog_list = newGoodsList
- this.orderDialog_listTotal = res.data.total
- })
- },
- // 打开弹窗 - 被置换订单
- openOrderDialog() {
- if (this.beiGoodsList.length < 1) {
- return this.$errorMsg('请先选择被置换产品')
- }
- if (this.keGoodsList.length < 1) {
- return this.$errorMsg('请先选择可置换产品')
- }
- this.orderDialog_show = true
- this.getOrderList()
- this.getProductPriceListV2()
- },
- // 关闭弹窗 - 被置换订单
- closeOrderDialog() {
- this.orderDialog_show = false
- },
- // 提交筛选表单 - 被置换订单
- submitOrderDialogScreenForm() {
- this.orderDialog_currentPage = 1
- this.getOrderList()
- },
- // 重置筛选表单 - 被置换订单
- resetOrderDialogScreenForm() {
- this.$refs.orderDialog_screenForm.resetFields()
- this.orderDialog_currentPage = 1
- this.orderDialog_list = []
- this.getOrderList()
- },
- // 更改列表页码 - 被置换订单
- changeOrderDialogPage(val) {
- this.orderDialog_currentPage = val
- this.getOrderList()
- },
- // 选择列 - 被置换订单
- changeOrderDialogSelection(val) {
- this.orderDialog_selection = val
- },
- // 确认选择产品 - 被置换订单
- submitChooseOrder(item) {
- // 订单置换(单选)
- if (this.type === 1) {
- this.orderList = [item]
- }
- // 批量置换(多选)
- else {
- const orderList = JSON.parse(JSON.stringify(this.orderDialog_selection))
- orderList.forEach(item => {
- item.ke_materialName = this.keGoodsList[0].name
- item.ke_specification = this.keGoodsList[0].specification
- item.ke_refundableQty = ''
- item.ke_saleTypeName = this.keGoodsList[0].saleTypeName
- item.ke_saleTypeCode = this.keGoodsList[0].saleTypeCode
- item.ke_saleTypeId = this.keGoodsList[0].saleTypeId
- item.ke_price = this.keGoodsList[0].price
- item.ke_rebateWalletName = this.keGoodsList[0].rebateWalletName
- item.ke_walletRebateId = this.keGoodsList[0].walletRebateId
- item.ke_discAmount = this.keGoodsList[0].discAmount
- item.ke_rebateRate = this.keGoodsList[0].rebateRate
- })
- this.orderList = this.orderList.concat(orderList)
- }
- this.closeOrderDialog()
- },
- // 删除产品 - 被置换订单
- deleteOrderList(index) {
- this.orderList.splice(index, 1)
- },
- // 判断是否存在被置换订单
- checkOrder() {
- if (this.orderList.length > 0) {
- return this.$errorMsg('已选择订单不可更改产品')
- }
- return true
- },
- // 提交
- submitForm() {
- for (let i = 0; i < this.orderList.length; i++) {
- if (!this.orderList[i].ke_refundableQty || this.orderList[i].ke_refundableQty < 1) {
- this.$errorMsg('置换数量需大于0')
- return
- }
- }
- const params = {
- type: this.type,
- newDiscAmount: this.keGoodsList[0].discAmount,
- newPrice: this.keGoodsList[0].price,
- saleTypeId: this.keGoodsList[0].saleTypeId,
- walletId2: this.keGoodsList[0].walletRebateId,
- newMaterialIds: this.keGoodsList.map(item => {
- return item.id
- }),
- orderItems: this.orderList.map(item => {
- return {
- orderId: item.id,
- orderItemId: item.orderItemId,
- displaceQty: item.ke_refundableQty
- }
- })
- }
- console.log(params, 999)
- addDisplace(params).then(res => {
- this.$successMsg('提交成功')
- this.resetForm()
- })
- },
- // 重置
- resetForm() {
- this.beiGoodsList = []
- this.keGoodsList = []
- this.orderList = []
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .main-top {
- display: flex;
- align-items: center;
- height: 60px;
- border-bottom: 1px solid #dcdfe6;
- margin-bottom: 20px;
- .title {
- font-size: 16px;
- padding-left: 10px;
- font-weight: 600;
- }
- }
- .el-radio-group {
- margin: 0 30px;
- }
- </style>
|