123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428 |
- <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} ( ${item.saleCode} )`" :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
- />
- </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
- />
- </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', '')
- }
- this.$set(row, 'walletRebateId', '')
- },
- 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>
|