| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-dialog-select');
- ComponentHelper::loadComponentView('com-select-cat');
- $diyPath = dirname(__DIR__) . '/components';
- ComponentHelper::loadComponentView('free-goods-choice', $diyPath);
- ComponentHelper::loadComponentView('com-dialog-select-store');
- ?>
- <div id="app" v-cloak>
- <el-card class="box-card" v-loading="cardLoading" shadow="never" style="border:0;min-width: 1200px;"
- body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <el-breadcrumb separator="/">
- <el-breadcrumb-item>
- <span style="color: #409EFF;cursor: pointer"
- @click="$navigate({r:'cloud-stock/level/index'})">
- 代理商等级
- </span>
- </el-breadcrumb-item>
- <el-breadcrumb-item>{{titleName}}</el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- <div class="form-body">
- <el-form :model="ruleForm" :rules="rules" size="small" ref="ruleForm" label-width="150px" v-loading="btnLoading">
- <el-row>
- <el-col :span="24">
- <el-form-item label="代理商等级权重" prop="level">
- <el-select style="width: 100%" v-model="ruleForm.level" @change="levelChangeFun" placeholder="请选择">
- <el-option
- v-for="item in weights"
- :key="item.level"
- :label="item.name"
- :value="item.level"
- :disabled="item.is_can_choose == 0?true:false">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="代理商等级名称" prop="name">
- <el-input v-model="ruleForm.name" placeholder="请输入代理商等级名称" maxlength="10"></el-input>
- </el-form-item>
- <el-form-item label="代理进货数量限制" prop="name">
- <el-switch
- v-model="ruleForm.is_open_fill_min"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- <el-input v-model="ruleForm.fill_min" placeholder="请输入限制数量" maxlength="10"></el-input>
- </el-form-item>
- <el-form-item label="一次性提货数量限制" prop="is_open_fill_min_once">
- <el-switch
- v-model="ruleForm.is_open_fill_min_once"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <template v-if="ruleForm.is_open_fill_min_once">
- <el-form-item label="最低" prop="fill_min_once">
- <el-input v-model="ruleForm.fill_min_once" placeholder="请输入限制数量" maxlength="10"></el-input>
- </el-form-item>
- <el-form-item label="最高" prop="fill_max_once">
- <el-input v-model="ruleForm.fill_max_once" placeholder="请输入限制数量" maxlength="10"></el-input>
- </el-form-item>
- </template>
- <el-form-item label="是否开启越级奖" prop="is_over" required>
- <el-switch
- v-model="ruleForm.is_over"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <el-form-item label="是否开启平级奖" prop="is_equal" required>
- <el-switch
- v-model="ruleForm.is_equal"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <el-form-item label="补货奖" prop="is_fill" required>
- <el-switch
- v-model="ruleForm.is_fill"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <template>
- <el-form-item label="购买商品升级">
- <el-form-item>
- <el-switch v-model="ruleForm.upgrade_type_goods" :active-value="1"
- :inactive-value="0" active-text="开启" inactive-text="关闭">
- </el-switch>
- </el-form-item>
- <el-form-item v-if="ruleForm.upgrade_type_goods==1">
- <el-radio-group v-model="ruleForm.upgrade_goods_list.buy_goods_type">
- <el-radio :label="0">订单完成
- </el-radio>
- <el-radio :label="1">支付完成
- </el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item v-if="ruleForm.upgrade_type_goods==1">
- <el-radio-group v-model="ruleForm.upgrade_goods_list.goods_type">
- <el-radio :label="1">任意商品
- </el-radio>
- <el-radio :label="2">
- <div style="display: inline-block;">
- <div flex="cross:center">
- <div>指定商品</div>
- <div style="margin-left: 10px;" v-if="ruleForm.upgrade_goods_list.goods_type==2">
- <com-dialog-select :multiple="true" @selected="goodsUpgradeSelect"
- title="商品选择">
- <el-button type="primary" style="margin-left: 20px;">选择商品</el-button>
- </com-dialog-select>
- </div>
- </div>
- </div>
- </el-radio>
- </el-radio-group>
- </el-form-item>
- </el-form-item>
- <el-form-item prop="goods_ids" v-if="ruleForm.upgrade_type_goods==1">
- <template v-if="ruleForm.upgrade_goods_list.goods_type==2">
- <div style="color: #ff4544;">最多可添加20个商品</div>
- <div style="max-height: 300px;overflow-y: auto">
- <el-table :data="ruleForm.upgrade_goods_list.goods_list" border style="100%">
- <el-table-column type="index" align="center" label="序号" width="50"></el-table-column>
- <el-table-column prop="name,cover_pic" label="商品名称" >
- <template slot-scope="scope">
- <div flex="box:first">
- <div style="padding-right: 10px;">
- <com-image mode="aspectFill" :src="scope.row.cover_pic"></com-image>
- </div>
- <div style="display:flex;flex-direction:column;align-items:flex-start;">
- <div>{{scope.row.goods_name}}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" label="商品件数" width="200">
- <template #header>
- <div style="display: flex; align-items: center; justify-content: center;">
- <span>商品件数</span>
- <el-tooltip class="item" effect="dark" content="开启之后计算以往所有商品购买件数" placement="top">
- <i class="el-icon-info" style="margin-right: 5px; margin-bottom: 5px;"></i>
- </el-tooltip>
- <el-switch v-model="ruleForm.upgrade_goods_list.is_custom_condition_num" :active-value="1" :inactive-value="0">
- </el-switch>
- </div>
- </template>
- <template slot-scope="scope">
- <el-input-number :disabled="!Number(ruleForm.upgrade_goods_list.is_custom_condition_num)" v-model="scope.row.condition_num" :precision="0" size="mini" :min="1"></el-input-number>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="100">
- <template slot-scope="scope">
- <el-button @click="deleteUpgradeGoods(scope.$index)" type="primary" size="mini">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </el-form-item>
- </template>
- <el-form-item label="购买门店商品升级">
- <el-form-item>
- <el-switch v-model="ruleForm.upgrade_type_store_goods" :active-value="1"
- :inactive-value="0" active-text="开启" inactive-text="关闭">
- </el-switch>
- </el-form-item>
- <el-form-item v-if="ruleForm.upgrade_type_store_goods==1">
- <el-radio-group v-model="ruleForm.upgrade_store_goods_list.buy_store_goods_type">
- <el-radio :label="0">订单完成
- </el-radio>
- <el-radio :label="1">支付完成
- </el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item v-if="ruleForm.upgrade_type_store_goods==1">
- <el-radio-group v-model="ruleForm.upgrade_store_goods_list.store_goods_type">
- <el-radio :label="1">任意商品</el-radio>
- <el-radio :label="2">指定商品</el-radio>
- </el-radio-group>
- <div style="margin-top: 10px; display: flex;" v-if="ruleForm.upgrade_store_goods_list.store_goods_type==2">
- <com-dialog-select-store :multiple="true" @selected="storeGoodsSelect" title="商品选择" :is_show_store_name="true" url="store/store-goods/search-with-store">
- <el-button type="primary" plain>选择商品</el-button>
- </com-dialog-select-store>
- <com-dialog-select-store :multiple="true" @selected="storeGoodsSelectDelete" title="批量删除" :is_show_store_name="true" url="store/store-goods/search-with-store">
- <el-button type="primary" plain style="margin-left: 10px">批量删除</el-button>
- </com-dialog-select-store>
- <!-- <div style="color: #ff4544; margin-left: 10px;">最多可添加99个商品</div>-->
- </div>
- </el-form-item>
- </el-form-item>
- <el-form-item prop="store_goods_ids" v-if="ruleForm.upgrade_type_store_goods==1">
- <template v-if="ruleForm.upgrade_store_goods_list.store_goods_type==2">
- <div style="max-height: 300px;overflow-y: auto;width: 60%;">
- <el-table :data="ruleForm.upgrade_store_goods_list.store_goods_list" border style="width: 100%">
- <el-table-column type="index" align="center" label="序号" width="50"></el-table-column>
- <el-table-column prop="id" align="center" label="商品id" width="100"></el-table-column>
- <el-table-column prop="name,cover_pic" label="商品名称" >
- <template slot-scope="scope">
- <div flex="box:first">
- <div style="padding-right: 10px;">
- <com-image mode="aspectFill" :src="scope.row.cover_pic"></com-image>
- </div>
- <div style="display:flex;flex-direction:column;align-items:flex-start;">
- <div>{{scope.row.name}}</div>
- <div>
- <span style="color: #ff4544;" v-if="scope.row.price">¥{{ scope.row.price }}</span>
- <span style="margin-left: 20px;" v-if="scope.row.stock">库存:{{ scope.row.stock }}</span>
- </div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="100">
- <template slot-scope="scope">
- <el-button @click="deleteStoreGoods(scope.$index)" type="primary" size="mini">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </el-form-item>
- <el-form-item label="条件升级">
- <el-form-item>
- <el-switch
- v-model="ruleForm.upgrade_type_condition"
- @change="upgradeTypeSwitch"
- :active-value="1"
- :inactive-value="0"
- active-text="开启"
- inactive-text="关闭"
- >
- </el-switch>
- </el-form-item>
- <el-form-item v-if="ruleForm.upgrade_type_condition==1">
- <el-radio-group v-model="ruleForm.condition_type">
- <el-radio :label="1">满足其一条件可升级</el-radio>
- <el-radio :label="2">满足所有条件可升级</el-radio>
- </el-radio-group>
- </el-form-item>
- <div v-if="ruleForm.upgrade_type_condition==1">
- <div style="margin-bottom: 20px;display: flex;">
- <el-checkbox v-model="checkbox1isCheck" label="条件1:购买指定商品"></el-checkbox>
- <com-dialog-select :multiple="true" @selected="goodsSelect"
- title="商品选择">
- <el-button v-if="checkbox1isCheck" type="primary" style="margin-left: 20px;">选择商品</el-button>
- </com-dialog-select>
- </div>
- <el-form-item v-if="checkbox1isCheck">
- <template>
- <div style="color: #ff4544;">最多可添加10个商品 当前已经选择 <span style="font-size: 18px;">{{ruleForm.goods_list.length}}</span> 个商品</div>
- <div style="max-height: 300px;overflow-y: auto" >
- <el-table :data="ruleForm.goods_list" border style="width: 100%">
- <el-table-column type="index" align="center" label="序号" width="50"></el-table-column>
- <el-table-column prop="goods_id" align="center" label="商品id" width="100"></el-table-column>
- <el-table-column prop="name,cover_pic" label="商品名称" >
- <template slot-scope="scope">
- <div flex="box:first">
- <div style="padding-right: 10px;">
- <com-image mode="aspectFill" :src="scope.row.cover_pic"></com-image>
- </div>
- <div style="display:flex;flex-direction:column;align-items:flex-start;">
- <div>{{scope.row.goods_name}}</div>
- <div>
- <span style="color: #ff4544;" v-if="scope.row.price">¥{{ scope.row.price }}</span>
- <span style="margin-left: 20px;" v-if="scope.row.stock">库存:{{ scope.row.stock }}</span>
- </div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="100">
- <template slot-scope="scope">
- <el-button @click="deleteGoods(scope.$index)" type="primary" size="mini">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </el-form-item>
- <el-col>
- <el-checkbox v-model="checkbox2isCheck" label="条件2:代理商渠道满足指定人数"></el-checkbox>
- <div v-if="checkbox2isCheck" style="margin-left: 23px;" style="background-color: red;">
- <div v-for="(item,index) in ruleForm.checked_condition_values[1].value" :key="index" style="margin-bottom: 10px;width: 400px" v-if="item.is_use == 1">
- <el-input v-model="item.num" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请填入数量"><!-- conditionNum -->
- <div slot="prepend"><span style="color:#03C5FF">{{item.name}}</span> 的人数满</div>
- <template slot="append">个</template>
- </el-input>
- </div>
- </div>
- </el-col>
- <div style="display: inline-block;">
- <div style="display: flex;">
- <el-checkbox v-model="checkbox3isCheck" label="条件3:商品补货升级" @change="editCheckbox3isCheck"></el-checkbox>
- <com-dialog-select :multiple="true" @selected="addGoodsTree"
- title="商品选择">
- <el-button v-if="checkbox3isCheck" style="background: none;border: 0;color: #0373ff;" type="primary" style="margin-left: 20px;">选择商品</el-button>
- </com-dialog-select>
- </div>
- <div style="margin-left: 10px;font-size: 12px;color: #666;margin-left: 20px;">商品补货升级包含云库存代理商在商城购买的商品和云库存补货的商品</div>
- </div>
- <div v-if="checkbox3isCheck">
- <el-radio-group v-if="ruleForm.checked_condition_values[2]" v-model="ruleForm.checked_condition_values[2].radio_type">
- <el-radio :label="1">或</el-radio>
- <el-radio :label="2">与</el-radio>
- </el-radio-group>
- <template>
- <div style="max-height: 300px;overflow-y: auto;max-width: 514px;" v-if="ruleForm.checked_condition_values[2]">
- <el-table ref="goodsInfos" :data="ruleForm.checked_condition_values[2].value" style="width: 100%" @selection-change="selectionGoods">
- <el-table-column
- type="selection"
- width="55"
- >
- </el-table-column>
- <el-table-column
- label="商品"
- width="200">
- <template slot-scope="scope">
- <div style="display: flex;align-items: center;">
- <el-image style="height:40px;width:40px;min-height:40px;min-width:40px;margin-right:10px;" :src="scope.row.cover_pic"></el-image>
- <div>
- <div style="color: #000;">{{scope.row.name}}</div>
- <div style="font-size: 12px;">
- <label>{{scope.row.cost_price}}</label>
- -
- <label>{{scope.row.original_price}}</label>
- </div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="数量"
- width="120">
- <template slot-scope="scope">
- <el-input v-model.number="scope.row.num" onkeyup="value=value.replace(/[^\d]/g,'')" style="width: 110px;">
- <template slot="append">件</template>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column
- fixed="right"
- label="操作"
- width="120">
- <template slot-scope="scope">
- <el-button
- @click.native.prevent="deleteGoodsThree(scope.$index)"
- type="text"
- size="small">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </div>
- <el-col>
- <el-checkbox v-model="checkbox4isCheck" label="条件4:渠道补货商品数量达到N件">
- </el-checkbox>
- <div v-if="checkbox4isCheck" style="margin-left: 23px;" style="background-color: red;">
- <el-input v-model="ruleForm.checked_condition_values[3].nums" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请填入数量"><!-- conditionNum -->
- <template slot="append">件</template>
- </el-input>
- </div>
- </el-col>
- <el-col>
- <el-checkbox v-model="checkbox5isCheck" label="条件5:直推XX等级N人,且N人中每人伞下产生xx等级N人">
- </el-checkbox>
- <div v-if="checkbox5isCheck" style="margin-left: 23px;margin-bottom: 10px;">
- <span style="margin-right:10px;">直推</span>
- <el-select style="width: 150px;" v-model="ruleForm.checked_condition_values[4].level" placeholder="请选择">
- <el-option v-for="item in levels" :key="item.level" :label="item.name" :value="item.level">
- </el-option>
- </el-select>
- <span style="margin:0 10px;">数量</span>
- <el-input style="width: 150px;" v-model="ruleForm.checked_condition_values[4].nums" type="number">
- <template slot="append">个</template>
- </el-input>
- </div>
- <div v-if="checkbox5isCheck" style="margin-left: 23px;" style="background-color: red;">
- <span style="margin-right:10px;">伞下</span>
- <el-select style="width: 150px;" v-model="ruleForm.checked_condition_values[4].c_level" placeholder="请选择">
- <el-option v-for="item in levels" :key="item.level" :label="item.name" :value="item.level">
- </el-option>
- </el-select>
- <span style="margin:0 10px;">数量</span>
- <el-input style="width: 150px;" v-model="ruleForm.checked_condition_values[4].c_nums" type="number">
- <template slot="append">个</template>
- </el-input>
- </div>
- </el-col>
- <el-col>
- <el-checkbox v-model="checkbox6isCheck" label="条件6:二二复制XX等级直推XX等级N人,渠道产生xx等级N人">
- </el-checkbox>
- <div v-if="checkbox6isCheck" style="margin-left: 23px;margin-bottom: 10px;">
- <span style="margin-right:10px;">自身等级</span>
- <el-select style="width: 150px;" v-model="ruleForm.checked_condition_values[5].self_level" placeholder="请选择">
- <el-option v-for="item in double_copy_levels" :key="item.level" :label="item.name" :value="item.level">
- </el-option>
- </el-select>
- </div>
- <div v-if="checkbox6isCheck" style="margin-left: 23px;margin-bottom: 10px;">
- <span style="margin-right:10px;">直推</span>
- <el-select style="width: 150px;" v-model="ruleForm.checked_condition_values[5].level" placeholder="请选择">
- <el-option v-for="item in double_copy_levels" :key="item.level" :label="item.name" :value="item.level">
- </el-option>
- </el-select>
- <span style="margin:0 10px;">数量</span>
- <el-input style="width: 150px;" v-model="ruleForm.checked_condition_values[5].nums" type="number">
- <template slot="append">个</template>
- </el-input>
- </div>
- <div v-if="checkbox6isCheck" style="margin-left: 23px;" style="background-color: red;">
- <span style="margin-right:10px;">渠道</span>
- <el-select style="width: 150px;" v-model="ruleForm.checked_condition_values[5].c_level" placeholder="请选择">
- <el-option v-for="item in double_copy_levels" :key="item.level" :label="item.name" :value="item.level">
- </el-option>
- </el-select>
- <span style="margin:0 10px;">数量</span>
- <el-input style="width: 150px;" v-model="ruleForm.checked_condition_values[5].c_nums" type="number">
- <template slot="append">个</template>
- </el-input>
- </div>
- </el-col>
- <el-col>
- <div style="display: flex;">
- <el-checkbox v-model="checkbox7isCheck" label="条件7:个人补货指定商品数量,直推指定等级代理N人" @change="editCheckbox3isCheck"></el-checkbox>
- <free-goods-choice :multiple="true" @selected="addGoodsTree7"
- title="商品选择">
- <el-button v-if="checkbox7isCheck" style="background: none;border: 0;color: #0373ff;" type="primary" style="margin-left: 20px;">选择商品</el-button>
- </free-goods-choice>
- </div>
- <div v-if="checkbox7isCheck">
- <template>
- <div style="max-height: 300px;overflow-y: auto;max-width: 514px;" v-if="ruleForm.checked_condition_values[6]">
- <el-table ref="goodsInfos7" :data="ruleForm.checked_condition_values[6].value" style="width: 100%" @selection-change="selectionGoods7">
- <el-table-column
- type="selection"
- width="55"
- >
- </el-table-column>
- <el-table-column
- label="商品"
- width="200">
- <template slot-scope="scope">
- <div style="display: flex;align-items: center;">
- <el-image style="height:40px;width:40px;min-height:40px;min-width:40px;" :src="scope.row.cover_pic"></el-image>
- <div>
- <div style="color: #000;">{{scope.row.name}}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- fixed="right"
- label="操作"
- width="120">
- <template slot-scope="scope">
- <el-button
- @click.native.prevent="deleteGoodsThree7(scope.$index)"
- type="text"
- size="small">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </div>
- <div v-if="checkbox7isCheck" style="margin-top: 10px;" style="background-color: red;">
- <span style="margin-right:10px;">合计补货数量</span>
- <el-input style="width: 300px;" v-model="ruleForm.checked_condition_values[6].num" type="number">
- <template slot="append">个</template>
- </el-input>
- </div>
- <div v-if="checkbox7isCheck" style="margin-left: 23px;margin: 10px 0;">
- <span style="margin-right:10px;">直推</span>
- <el-select style="width: 150px;" v-model="ruleForm.checked_condition_values[6].level" placeholder="请选择">
- <el-option v-for="item in levels" :key="item.level" :label="item.name" :value="item.level">
- </el-option>
- </el-select>
- <span style="margin:0 10px;">数量</span>
- <el-input style="width: 150px;" v-model="ruleForm.checked_condition_values[6].nums" type="number">
- <template slot="append">个</template>
- </el-input>
- </div>
- </el-col>
- <el-col>
- <el-checkbox v-model="checkbox8isCheck" label="条件8:所有商品进货金额累计达到N元">
- </el-checkbox>
- <div v-if="checkbox8isCheck" style="margin-left: 23px;" style="background-color: red;">
- <el-input v-model="ruleForm.checked_condition_values[7].nums" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请填入数量">
- <template slot="append">元</template>
- </el-input>
- </div>
- </el-col>
- </div>
- </el-form-item>
- <el-form-item label="赠送等级" v-if="ruleForm.give_quota.length && is_show_give">
- <div style="display: flex;flex-wrap: wrap;width: 400px;justify-content: space-between;">
- <el-input v-for="(item,index) in ruleForm.give_quota" v-if="item.is_use == 1" :key="index" v-model="item.num" style="margin-top: 10px;" placeholder="请填入数量" onkeyup="value=value.replace(/[^\d]/g,'')">
- <div slot="prepend"><span style="color:#03C5FF">{{item.name}}</span> 赠送</div><!-- 因为这里的等级名称长度不确定 不能固定input的长度 prepend文字不会换行 所以input竖着排列 -->
- <template slot="append">个</template>
- </el-input>
- </div>
- </el-form-item>
- <el-form-item label="是否启用" prop="status">
- <el-switch
- v-model="ruleForm.status"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <el-form-item label="等级说明" >
- <el-input
- type="textarea"
- :autosize="{ minRows: 4, maxRows: 4}"
- placeholder="请输入等级说明"
- v-model="ruleForm.detail">
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </div>
- <el-button class="button-item" :loading="btnLoading" type="primary" @click="saveFun"
- size="small">保存
- </el-button>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- titleName:'添加代理商等级',
- msg: 1,
- options: [],//会员等级列表
- enable_level_list:[], //可用等级列表
- level: 0,
- form: {
- type: [],
- },
- checked_condition_keys: [],
- showConditionMsg: false,
- conditionMsg: '',
- weights: [],//等级权重列表
- ruleForm: {
- id:'',
- level: '',//权重 1 2 3等
- name: '',
- is_open_fill_min: 0,
- fill_min: 0,
- status: 1,
- is_equal: 1,
- is_over: 1,
- is_fill: 1,
- condition_type: 1,//1=满足其一可升级 2=满足所有条件可升级
- service_price: 0,
- is_auto_upgrade: 1,
- service_price_type: 0,
- upgrade_type_condition: 0,//条件升级
- sub_stock_rate: 100,
- rule: '',
- checked_condition_keys: [],//升级条件选中的key集合 ["0","1"]
- goodsNum:1,//指定购买商品的数量
- detail:'',//等级说明
- checked_condition_values:[//条件升级的数据upgradeData
- {"key":"0","value":[]},//{"goods_id":1},{"goods_id":2}条件1的数据 商品的数据id列表
- {"key":"1","value":[]},//{"level":1,"num":2},{"level":2,"num":3}条件2的数据 等级id和人数
- {"key":"2","value":[]},
- {"key":"3","value":[]},
- {"key":"4","value":[]},
- {"key":"5","value":[]},
- {"key":"6","value":[]},
- {"key":"7","value":[]},
- ],
- goods_list:[],
- give_quota:[],
- is_open_fill_min_once:0,
- fill_min_once:0,
- fill_max_once:0,
- upgrade_type_goods: 0, // 是否开启购买商品升级
- upgrade_goods_list: {
- buy_goods_type: 0, // 支付类型0订单完成1订单支付完成
- goods_type: 1, // 商品类型1任意商品 2 指定商品
- goods_list: [],
- goods_ids: [],
- },
- upgrade_type_store_goods:0,
- upgrade_store_goods_list: {
- buy_store_goods_type:0, // 支付类型0订单完成1订单支付完成
- store_goods_type: 1, // 门店商品类型1任意商品 2 指定商品
- store_goods_ids:[],
- store_goods_list:[],
- },
- },
- rules: {
- level: [
- {required: true, message: '请选择代理商等级', trigger: 'change'},
- ],
- name: [
- {required: true, message: '请输入代理商等级名称', trigger: 'change'},
- ],
- is_use: [
- {required: true, message: '请选择代理商等级状态', trigger: 'change'},
- ],
- detail: [
- {required: true, message: '等级说明不能为空', trigger: 'change'},
- ],
- },
- btnLoading: false,
- cardLoading: false,
- checkList:[],
- checkbox1isCheck:false,//条件1 购买指定商品 是否勾选
- checkbox2isCheck:false,//条件2 代理商渠道满足指定的人数 是否勾选
- checkbox3isCheck: false, //条件3 商品补货升级
- checkbox4isCheck: false, //条件4 商品补货升级
- checkbox5isCheck:false,//条件5 伞下渠道等级数量升级
- checkbox6isCheck:false,//条件6 伞下二二复制等级数量升级
- checkbox7isCheck:false,//条件7 个人补货指定商品
- checkbox8isCheck:false,//条件8 所有商品进货金额累计达到N元
- goods:null,
- conditionNum:'',//条件2 代理商权重指定满足的人数
- //lowerLevel:[],//比当前选中的等级低的等级列表
- is_show_give:true,
- getWeightsLevel:'', //编辑的时候传进来的level
- radio_type: 1,
- goodsInfos: [],//商品假数据
- levels:[],
- double_copy_levels:[],
- };
- },
- mounted() {
- if (getQuery('id')) {
- this.titleName="编辑代理商等级";
- this.getWeightsLevel = getQuery('level');
- this.loadData();//请求详情的数据
- }
- this.getWeights();//获取权重列表
- this.getLevelList();//获取等级列表
- this.getDoubleCopyLevelList();//获取等级列表
- },
- methods: {
- getWeights(){
- let that = this;
- request({
- params: {
- r: 'cloud-stock/level/get-can-choose-level-list',
- level:this.getWeightsLevel
- },
- method: 'get',
- }).then(e => {
- if(e.data.code == 0){
- that.weights = e.data.data;
- }else{
- that.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- close(e) {
- this.visible = false;
- },
- levelChangeFun(e){
- this.getLowerLevel();//获取代理商等级下级等级列表
- },
- getLowerLevel(){//获取代理商等级下级等级列表
- request({
- params: {
- r: 'cloud-stock/level/get-less-level-list',
- level:this.ruleForm.level
- },
- method: 'get',
- }).then(e => {
- if(e.data.code == 0){
- let arr = e.data.data;
- arr.forEach((item,index)=>{
- item.num = '';
- })
- this.ruleForm.give_quota = arr;
- /* 判断是否显示 等级赠送 start */
- let arr2 = [];
- arr2 = this.ruleForm.give_quota.filter((item)=>{
- return item.is_use == 1;
- })
- if(arr2.length){
- this.is_show_give=true;
- }else{
- this.is_show_give=false;
- }
- console.log(arr2.length)
- console.log(this.is_show_give)
- /* 判断是否显示 等级赠送 end */
- this.ruleForm.checked_condition_values[1].value = JSON.parse(JSON.stringify(arr))
- }else{
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- saveFun(){
- //console.log('请求了保存的函数')
- this.ruleForm.checked_condition_keys = [];
- if(this.checkbox1isCheck){//条件1 购买指定商品 是否勾选
- this.ruleForm.checked_condition_keys.push("0");
- }
- if(this.checkbox2isCheck){//条件2 代理商渠道满足指定的人数 是否勾选
- this.ruleForm.checked_condition_keys.push("1");
- }
- if(this.checkbox3isCheck){
- this.ruleForm.checked_condition_keys.push("2");
- }
- if(this.checkbox4isCheck){
- this.ruleForm.checked_condition_keys.push("3");
- }
- if(this.checkbox5isCheck){
- this.ruleForm.checked_condition_keys.push("4");
- }
- if(this.checkbox6isCheck){
- this.ruleForm.checked_condition_keys.push("5");
- }
- if(this.checkbox7isCheck){
- this.ruleForm.checked_condition_keys.push("6");
- }
- if(this.checkbox8isCheck){
- this.ruleForm.checked_condition_keys.push("7");
- }
- if(this.ruleForm.level == ''){
- return this.$message.error('请选择代理商等级权重');
- }
- if(this.ruleForm.name == ''){
- return this.$message.error('请输入代理商等级名称');
- }
- if(this.ruleForm.upgrade_type_condition == 1){//勾选了条件升级
- if(!this.ruleForm.checked_condition_keys.length){//为空数组 没有勾选任何一个条件
- return this.$message.error('请勾选升级条件');
- }
- if(this.ruleForm.condition_type == 1 && this.ruleForm.checked_condition_keys.length == 0){//选择了满足其一条件
- return this.$message.error('请填写其中一个升级条件');
- }
- /* if(this.ruleForm.condition_type == 2 && this.ruleForm.checked_condition_keys.length == 1){//选择了满足所有条件
- return this.$message.error('请勾选升级条件1和条件2');
- } */
- if(this.checkbox1isCheck && !this.ruleForm.goods_list.length){//勾选条件1 没有选择商品
- return this.$message.error('请选择商品');
- }
- /* if(this.checkbox1isCheck && this.ruleForm.upgradeData[0].value.val1 <= 0){//勾选条件1 商品数量不对
- return this.$message.error('请填写正确的商品数量');
- } */
- if(this.checkbox2isCheck){//勾选条件2 但是没有可用下级代理商列表
- let is_use_arr = [];
- let judge_arr = [];
- is_use_arr = this.ruleForm.checked_condition_values[1].value.filter((item)=>{
- return item.is_use == 1
- })
- judge_arr = this.ruleForm.checked_condition_values[1].value.filter((item)=>{
- return item.num == '' || item.num == 0
- })
- //console.log('judge_arr='+JSON.stringify(judge_arr))
- if(is_use_arr.length == 0){
- return this.$message.error('升级条件2暂不可选');
- }
- if(judge_arr.length == this.ruleForm.checked_condition_values[1].value.length){
- return this.$message.error('升级条件2:代理商渠道指定满足的人数,至少填一个大于0的数字');
- }
- }
- }
- for(var i=0;i<this.ruleForm.checked_condition_values[1].value.length;i++){
- if(this.ruleForm.checked_condition_values[1].value[i].num < 0){
- return this.$message.error('请正确填写升级条件2的数据');
- break;
- }
- }
- for(var i=0;i<this.ruleForm.give_quota.length;i++){
- if(this.ruleForm.give_quota[i].num < 0){
- return this.$message.error('赠送等级:请填写正确的赠送数量');
- break;
- }
- }
- //let give_quota_arr=[];
- this.ruleForm.give_quota.forEach((item,index)=>{
- if(item.num == ''){
- item.num = 0
- }
- /* let obj ={
- level:item.level,
- num:item.num
- }
- give_quota_arr.push(obj) */
- })
- //console.log('赠送名额='+JSON.stringify(give_quota_arr))
- this.ruleForm.checked_condition_values[1].value.forEach((item,index)=>{
- if(item.num == ''){
- item.num = 0
- }
- })
- if (this.ruleForm.upgrade_store_goods_list.store_goods_type == 1) {
- this.ruleForm.upgrade_store_goods_list.store_goods_ids = [];
- this.ruleForm.upgrade_store_goods_list.store_goods_list = [];
- }
- let submitObj={};//提交给后台的对象
- submitObj.level = this.ruleForm.level;
- submitObj.name = this.ruleForm.name;
- submitObj.fill_min = this.ruleForm.fill_min;
- submitObj.is_open_fill_min = this.ruleForm.is_open_fill_min;
- submitObj.is_use = this.ruleForm.is_use;
- submitObj.checked_condition_keys = JSON.stringify(this.ruleForm.checked_condition_keys);
- submitObj.condition_type = this.ruleForm.condition_type;
- submitObj.checked_condition_values =JSON.stringify(this.ruleForm.checked_condition_values);
- submitObj.give_quota =JSON.stringify(this.ruleForm.give_quota);
- submitObj.is_over = this.ruleForm.is_over;
- submitObj.is_equal = this.ruleForm.is_equal;
- submitObj.is_fill = this.ruleForm.is_fill;
- submitObj.upgrade_type_condition = this.ruleForm.upgrade_type_condition;
- submitObj.detail = this.ruleForm.detail;
- submitObj.status = this.ruleForm.status;
- submitObj.is_open_fill_min_once = this.ruleForm.is_open_fill_min_once;
- submitObj.fill_min_once = this.ruleForm.fill_min_once;
- submitObj.fill_max_once = this.ruleForm.fill_max_once;
- submitObj.upgrade_type_goods = this.ruleForm.upgrade_type_goods;
- submitObj.upgrade_goods_list = JSON.stringify(this.ruleForm.upgrade_goods_list);
- submitObj.upgrade_type_store_goods = this.ruleForm.upgrade_type_store_goods;
- submitObj.upgrade_store_goods_list = JSON.stringify(this.ruleForm.upgrade_store_goods_list);
- if(getQuery('id')){
- submitObj.id = this.ruleForm.id
- }
- this.btnLoading = true;
- request({
- params: {
- r: 'cloud-stock/level/edit'
- },
- method: 'post',
- data:submitObj
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code == 0) {
- this.$message.success('保存成功');
- navigateTo({
- r: 'cloud-stock/level/index'
- })
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.$message.error(e.data.msg);
- this.btnLoading = false;
- });
- },
- submitForm(formName) {
- let self = this;
- self.showConditionMsg = false;
- if (this.ruleForm.upgrade_type_condition == 1) {
- if (this.ruleForm.checked_condition_keys.length == 0) {
- this.$message.error('请完善升级条件');
- return;
- }
- let checked_condition_values = this.ruleForm.checked_condition_values;
- this.ruleForm.checked_condition_keys.forEach(v => {
- self.conditionMsg = '请完善条件:' + (parseInt(v) + 1);
- if (v == 0) {
- if (!checked_condition_values[v].value.val || !checked_condition_values[v].value.val1) {
- self.showConditionMsg = true;
- return;
- }
- }
- if (v > 0) {
- if (!checked_condition_values[v].value.val) {
- self.showConditionMsg = true;
- return;
- }
- }
- })
- if (self.showConditionMsg) {
- return
- }
- if (this.ruleForm.checked_condition_keys.length > 0) {
- if (this.ruleForm.condition_type == 0) {
- this.$message.error('请选择条件升级的方式升级类型');
- return;
- }
- }
- }
- this.$refs[formName].validate((valid) => {
- if (valid) {
- self.btnLoading = true;
- request({
- params: {
- r: 'plugin/stock/mall/level/edit'
- },
- method: 'post',
- data: {
- form: self.ruleForm,
- }
- }).then(e => {
- self.btnLoading = false;
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- navigateTo({
- r: 'plugin/stock/mall/level/index'
- })
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.$message.error(e.data.msg);
- self.btnLoading = false;
- });
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- loadData() {//请求详情的数据
- this.cardLoading = true;
- //console.log('请求详情前的参数=='+getQuery('id'))
- request({
- params: {
- r: 'cloud-stock/level/edit',//'plugin/stock/mall/level/edit',
- id: getQuery('id'),
- },
- method: 'get'
- }).then(e => {
- this.cardLoading = false;
- //console.log('请求详情的结果='+JSON.stringify(e))
- if (e.data.code == 0) {
- let data = e.data.data;
- this.ruleForm.id = data.id;
- this.ruleForm.level = data.level;
- this.ruleForm.name = data.name;
- this.ruleForm.is_open_fill_min = data.is_open_fill_min;
- this.ruleForm.fill_min = data.fill_min;
- this.ruleForm.status = data.status;
- this.ruleForm.checked_condition_keys = data.checked_condition_keys;
- this.ruleForm.checked_condition_keys.forEach((item)=>{
- if(item == 0){
- this.checkbox1isCheck = true;
- }
- if(item == 1){
- this.checkbox2isCheck = true;
- }
- if(item == 2){
- this.checkbox3isCheck = true;
- localStorage.setItem("booType",1);
- this.editCheckbox3isCheck(true);
- }
- if(item == 3){
- this.checkbox4isCheck = true;
- }
- if(item == 4){
- this.checkbox5isCheck = true;
- }
- if(item == 5){
- this.checkbox6isCheck = true;
- }
- if(item == 6){
- this.checkbox7isCheck = true;
- localStorage.setItem("booType7",1);
- this.editCheckbox7isCheck(true);
- }
- if(item == 7){
- this.checkbox8isCheck = true;
- }
- })
- this.ruleForm.condition_type = data.condition_type;
- this.ruleForm.goods_list = data.checked_condition_values[0].value;//给商品进行赋值
- if(!data.checked_condition_values[2]){
- data.checked_condition_values.push({
- key: 2,
- radio_type: 1,
- value: []
- })
- }
- if(data.checked_condition_values[2] && data.checked_condition_values[2].value){
- data.checked_condition_values[2].value.forEach(v => {
- if(typeof(v.num) == "undefined"){
- this.$set(v,'num',1);
- }
- })
- }
- this.ruleForm.checked_condition_values = data.checked_condition_values;
- // 判断商品升级条件
- this.ruleForm.upgrade_type_goods = data.upgrade_type_goods ?? 0;
- let goods_list = data.upgrade_goods_list;
- if (goods_list.length > 0) {
- this.ruleForm.upgrade_goods_list = JSON.parse(goods_list);
- }
- // 判断门店商品升级条件
- this.ruleForm.upgrade_type_store_goods = data.upgrade_type_store_goods ?? 0;
- let store_goods_list = data.upgrade_store_goods_list;
- if (store_goods_list.length > 0) {
- this.ruleForm.upgrade_store_goods_list = JSON.parse(store_goods_list);
- }
- let arr = [];
- this.ruleForm.checked_condition_values[0].value.forEach((item)=>{
- let obj={
- goods_id:item.goods_id,
- cover_pic:item.cover_pic,
- goods_name:item.goods_name,
- price:item.price,
- stock:item.stock
- }
- arr.push(obj)
- })
- this.ruleForm.checked_condition_values[0].value = arr;
- /* end */
- this.ruleForm.give_quota = data.give_quota;
- /* 判断是否显示 等级赠送 start */
- let arr2 = [];
- arr2 = this.ruleForm.give_quota.filter((item)=>{
- return item.is_use == 1;
- })
- if(arr2.length){
- this.is_show_give=true;
- }else{
- this.is_show_give=false;
- }
- this.ruleForm.is_over = data.is_over;
- this.ruleForm.is_equal = data.is_equal;
- this.ruleForm.is_fill = data.is_fill;
- this.ruleForm.upgrade_type_condition = data.upgrade_type_condition;
- this.ruleForm.detail = data.detail;
- this.ruleForm.is_open_fill_min_once = data.is_open_fill_min_once;
- this.ruleForm.fill_min_once = data.fill_min_once;
- this.ruleForm.fill_max_once = data.fill_max_once;
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- goodsSelect(param){
- for (let j in param) {
- let item = param[j];
- if (this.ruleForm.goods_list.length >= 10) {
- this.$message.error('指定商品不能大于10个');
- return;
- }
- let flag = true;
- for (let i in this.ruleForm.checked_condition_values[0].value) {
- if (this.ruleForm.checked_condition_values[0].value[i].goods_id == item.id) {
- flag = false;
- break;
- }
- }
- if (flag) {
- let obj={};
- obj.goods_id = item.id;
- obj.goods_name = item.goods_name;
- obj.cover_pic = item.cover_pic;
- obj.price = item.price;
- obj.stock = item.stock;
- obj.stock = item.stock;
- this.ruleForm.checked_condition_values[0].value.push(obj);
- this.ruleForm.goods_list.push({
- goods_id: item.id,
- goods_name: item.goods_name,
- cover_pic: item.cover_pic,
- price: item.price,
- stock: item.stock,
- });
- }
- }
- },
- deleteGoods(index) {
- //this.goods = null;
- this.ruleForm.checked_condition_values[0].value.splice(index, 1);
- this.ruleForm.goods_list.splice(index, 1);
- },
- goodsUpgradeSelect(param){
- for (let j in param) {
- let item = param[j];
- if (this.ruleForm.upgrade_goods_list.goods_list.length >= 20) {
- this.$message.error('指定商品不能大于20个');
- return;
- }
- // 判断当前商品是否已经存在
- if (this.ruleForm.upgrade_goods_list.goods_ids.includes(item.id)){
- continue;
- }
- let obj={};
- obj.goods_id = item.id;
- obj.goods_name = item.goods_name;
- obj.cover_pic = item.cover_pic;
- obj.price = item.price;
- obj.stock = item.stock;
- obj.condition_num = 1;
- this.ruleForm.upgrade_goods_list.goods_ids.push(item.id);
- this.ruleForm.upgrade_goods_list.goods_list.push({
- goods_id: item.id,
- goods_name: item.goods_name,
- cover_pic: item.cover_pic,
- price: item.price,
- stock: item.stock,
- condition_num: 1,
- });
- console.log("ggggggvv",this.ruleForm.upgrade_goods_list)
- }
- },
- deleteUpgradeGoods(index) {
- //this.goods = null;
- this.ruleForm.upgrade_goods_list.goods_ids.splice(index, 1);
- this.ruleForm.upgrade_goods_list.goods_list.splice(index, 1);
- },
- deleteGoodsThree(index) {
- this.ruleForm.checked_condition_values[2].value.splice(index, 1);
- },
- addGoodsTree(param){
- for (let j in param) {
- let item = param[j];
- let obj = {
- id: item.id,
- name: item.goods_name,
- cover_pic: item.cover_pic,
- cost_price: item.cost_price,
- original_price: item.original_price,
- }
- this.$set(obj,'num',1);
- this.ruleForm.checked_condition_values[2].value.push(obj);
- console.info(this.ruleForm.checked_condition_values[2]);
- }
- console.log(obj);
- },
- selectionGoods(val){
- let boo = localStorage.getItem("booType");
- if(boo) return;
- let that = this;
- this.ruleForm.checked_condition_values[2].value.forEach((v,i) => {
- let index = val.findIndex(vv => vv.id == v.id);
- if(index != -1){
- v.isSelected = true;
- }else{
- v.isSelected = false;
- }
- })
- },
- editCheckbox3isCheck(v){
- if(v){
- // 等模板渲染完毕再加载
- this.$nextTick( () => {
- console.info(this.$refs,this.ruleForm.checked_condition_values[2].value);
- if(!this.ruleForm.checked_condition_values[2]) return
- this.ruleForm.checked_condition_values[2].value.forEach((v,i) => {
- if (v.isSelected) {
- this.$refs.goodsInfos.toggleRowSelection(v);
- }else {
- this.$refs.goodsInfos.clearSelection();
- }
- })
- localStorage.removeItem("booType");
- })
- }
- },
- upgradeTypeSwitch(boo){
- if(boo == 1 && this.checkbox3isCheck){
- this.editCheckbox3isCheck(true)
- }
- },
- deleteGoodsThree7(index) {
- this.ruleForm.checked_condition_values[6].value.splice(index, 1);
- },
- addGoodsTree7(param){
- for (let j in param) {
- let item = param[j];
- let obj = {
- id: item.id,
- goods_id:item.goods_id,
- name: item.goods_name,
- cover_pic: item.cover_pic,
- cost_price: item.cost_price,
- original_price: item.original_price,
- }
- this.$set(obj,'num',1);
- if(!this.ruleForm.checked_condition_values[6].value){
- this.ruleForm.checked_condition_values[6].value = [];
- }
- this.ruleForm.checked_condition_values[6].value.push(obj);
- console.info(this.ruleForm.checked_condition_values[6]);
- }
- console.log(obj);
- },
- selectionGoods7(val){
- let boo = localStorage.getItem("booType7");
- if(boo) return;
- let that = this;
- this.ruleForm.checked_condition_values[6].value.forEach((v,i) => {
- let index = val.findIndex(vv => vv.id == v.id);
- if(index != -1){
- v.isSelected = true;
- }else{
- v.isSelected = false;
- }
- })
- },
- editCheckbox7isCheck(v){
- if(v){
- // 等模板渲染完毕再加载
- this.$nextTick( () => {
- console.info(this.$refs,this.ruleForm.checked_condition_values[6].value);
- if(!this.ruleForm.checked_condition_values[6]) return
- this.ruleForm.checked_condition_values[6].value.forEach((v,i) => {
- if (v.isSelected) {
- this.$refs.goodsInfos7.toggleRowSelection(v);
- }else {
- this.$refs.goodsInfos7.clearSelection();
- }
- })
- localStorage.removeItem("booType7");
- })
- }
- },
- upgradeTypeSwitch(boo){
- if(boo == 1 && this.checkbox7isCheck){
- this.editCheckbox7isCheck(true)
- }
- },
- getLevelList(){//获取二二复制等级下级等级列表
- request({
- params: {
- r: 'cloud-stock/level/get-level-list',
- },
- method: 'get',
- }).then(e => {
- if(e.data.code == 0){
- this.levels = e.data.data;
- }else{
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- getDoubleCopyLevelList(){//获取代理商等级下级等级列表
- request({
- params: {
- r: 'cloud-stock/level/get-double-copy-level-list',
- },
- method: 'get',
- }).then(e => {
- if(e.data.code == 0){
- this.double_copy_levels = e.data.data;
- }else{
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- //选择商品
- storeGoodsSelect(param) {
- for (let j in param) {
- let item = param[j];
- // if (this.ruleForm.upgrade_store_goods_list.store_goods_ids.length >= 99) {
- // this.$message.error('指定商品不能大于99个');
- // return;
- // }
- let flag = true;
- for (let i in this.ruleForm.upgrade_store_goods_list.store_goods_ids) {
- if (this.ruleForm.upgrade_store_goods_list.store_goods_ids[i] == param[j].id) {
- flag = false;
- break;
- }
- }
- if (flag) {
- this.ruleForm.upgrade_store_goods_list.store_goods_ids.push(param[j].id);
- this.ruleForm.upgrade_store_goods_list.store_goods_list.push({
- id: param[j].id,
- name: param[j].goods_name,
- cover_pic: param[j].cover_pic,
- price: param[j].price,
- stock: param[j].stock,
- });
- }
- }
- console.log('选择商品 ======>' ,this.ruleForm.store_goods_list);
- },
- //批量删除商品
- storeGoodsSelectDelete(param) {
- if (param === undefined || param.length === 0) {
- alert('未勾选商品');
- } else {
- let store_goods_ids = this.ruleForm.upgrade_store_goods_list.store_goods_ids;
- for (let j = 0; j < param.length; j++) {
- let item = param[j];
- let itemId = item.id;
- let index = store_goods_ids.indexOf(itemId);
- if (index !== -1) {
- this.deleteStoreGoods(index);
- }
- }
- }
- console.log('删除完选择商品 ======>' ,this.ruleForm.store_goods_list);
- },
- //删除商品
- deleteStoreGoods(index) {
- this.ruleForm.upgrade_store_goods_list.store_goods_list.splice(index, 1);
- this.ruleForm.upgrade_store_goods_list.store_goods_ids.splice(index, 1);
- },
- clickSelectCheckConditionGoods() {
- this.$refs.checkgoods.$el.click()
- },
- conditionGoodsSelectCheck(param) {
- let ckey;
- this.ruleForm.checked_condition_values.forEach(function(item, index) {
- if (item.key == 2) {
- ckey = index;
- }
- })
- let gval = this.ruleForm.checked_condition_values[2].value.val0;
- let garr = [];
- if (gval.length > 0) {
- garr = gval.split(",")
- }
- for (let j in param) {
- let item = param[j];
- let isHave = false;
- garr.forEach(element => {
- if (element == param[j].id) {
- isHave = true;
- }
- });
- if (!isHave) {
- garr.push(param[j].id);
- }
- }
- gval = garr.join(',');
- this.ruleForm.checked_condition_values[2].value.val0 = gval;
- console.log(gval);
- },
- conditionGoodsSelect(param) {
- let ckey;
- this.ruleForm.checked_condition_values.forEach(function(item, index) {
- if (item.key == 2) {
- ckey = index;
- }
- })
- let gval = this.ruleForm.checked_condition_values[ckey].value.val0;
- let garr = [];
- if (gval.length > 0) {
- garr = gval.split(",")
- }
- for (let j in param) {
- let item = param[j];
- let isHave = false;
- garr.forEach(element => {
- if (element == param[j].id) {
- isHave = true;
- }
- });
- if (!isHave) {
- garr.push(param[j].id);
- }
- }
- gval = garr.join(',');
- console.log(gval);
- this.ruleForm.checked_condition_values[ckey].value.val0 = gval;
- },
- }
- });
- </script>
- <style>
- .form-body {
- padding: 20px;
- background-color: #fff;
- margin-bottom: 20px;
- padding-right: 20%;
- min-width: 900px;
- }
- .form-body .el-form-item {
- padding-right: 25%;
- min-width: 850px;
- }
- .form-button {
- margin: 0;
- }
- .form-button .el-form-item__content {
- margin-left: 0 !important;
- }
- .button-item {
- padding: 9px 25px;
- }
- .check-group {
- font-size: 14px !important;
- }
- .check-group .el-col {
- display: flex;
- }
- .check-group .el-input {
- margin: 0 5px;
- }
- .check-group .el-col .el-checkbox {
- display: flex;
- align-items: center;
- }
- .check-group .el-col .el-input {
- width: 100px;
- }
- .check-group .el-col .el-input .el-input__inner {
- height: 30px;
- width: 100px;
- }
- .el-checkbox-group .el-col {
- margin-bottom: 10px;
- }
- </style>
|