| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- <template id="com-double-copy">
- <div class="com-double-copy">
- <el-card class="edit-card" shadow="never">
- <div slot="header" class="clearfix">
- <div class="card-title">二二复制<span class="card-sub-title"></span></div>
- </div>
- <el-form :model="form" size="small">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane v-for="(config,key) in form" :label="commission_type_map2[key]" v-if="commission_type_map2[key]" :name="key" :key="key">
- <el-form-item label="是否参与二二复制" prop="is_partake">
- <el-switch :active-value="1" :inactive-value="0" v-model="config.is_partake"></el-switch>
- </el-form-item>
- <el-form-item label="独立设置分红" prop="is_enable" v-if="config.is_partake == 1">
- <el-switch :active-value="1" :inactive-value="0" v-model="config.is_enable"></el-switch>
- </el-form-item>
- <el-row :gutter="24" v-if="config.is_enable == 1 && config.is_partake == 1">
- <el-col :span="24">
- <el-card shadow="always">
- <el-form-item label="奖励类型" prop="is_percent">
- <el-radio-group v-model="config.is_percent">
- <el-radio :label="0" class="grid-content bg-purple">百分比</el-radio>
- <el-radio :label="1"
- class="grid-content bg-purple">固定{{commission_type_map2[config.commission_type]}}</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <template v-if="config.settings == 0 || is_attr == 0">
- <el-table ref="normal" :data="level_arr.DoubleCopy" border stripe
- style="width: 100%;" @selection-change="handleSelectionChange">
- <el-table-column width="100" label="等级名称" prop="name"></el-table-column>
- <el-table-column label="直推奖" width="300">
- <template slot-scope="scope">
- <el-input type="text"
- v-model="config.detail[scope.row.level].first_prize"
- @input="firstPrizeViolationNumInput($event, key, scope.row.level)">
- <template slot="append"
- v-if="config.is_percent == 0">%</template>
- <template slot="append" v-if="config.is_percent == 1">
- <template
- v-if="config.commission_type == 'commission'">元</template>
- <template
- v-if="config.commission_type == 'score'">{{commission_type_map2[config.commission_type]}}</template>
- </template>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column label="间推奖" width="300">
- <template slot-scope="scope">
- <el-input type="text"
- v-model="config.detail[scope.row.level].indirect_prize"
- @input="indirectPrizeViolationNumInput($event, key, scope.row.level)">
- <template slot="append"
- v-if="config.is_percent == 0">%</template>
- <template slot="append" v-if="config.is_percent == 1">
- <template
- v-if="config.commission_type == 'commission'">元</template>
- <template
- v-if="config.commission_type == 'score'">{{commission_type_map2[config.commission_type]}}</template>
- </template>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column label="平台补贴" width="300">
- <template slot-scope="scope">
- <el-input type="text"
- v-model="config.detail[scope.row.level].second_prize"
- @input="secondPrizeViolationNumInput($event, key, scope.row.level)">
- <template slot="append"
- v-if="config.is_percent == 0">%</template>
- <template slot="append" v-if="config.is_percent == 1">
- <template
- v-if="config.commission_type == 'commission'">元</template>
- <template
- v-if="config.commission_type == 'score'">{{commission_type_map2[config.commission_type]}}</template>
- </template>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column label="培育奖" width="300">
- <template slot-scope="scope">
- <el-input type="text"
- v-model="config.detail[scope.row.level].equal_prize"
- @input="peerAwardPrizeViolationNumInput($event, key, scope.row.level)">
- <template slot="append"
- v-if="config.is_percent == 0">%</template>
- <template slot="append" v-if="config.is_percent == 1">
- <template
- v-if="config.commission_type == 'commission'">元</template>
- <template
- v-if="config.commission_type == 'score'">{{commission_type_map2[config.commission_type]}}</template>
- </template>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column label="津贴奖" width="300">
- <template slot-scope="scope">
- <el-input type="text"
- v-model="config.detail[scope.row.level].allowance_price"
- @input="allowancePrizeViolationNumInput($event, key, scope.row.level)">
- <template slot="append"
- v-if="config.is_percent == 0">%</template>
- <template slot="append" v-if="config.is_percent == 1">
- <template
- v-if="config.commission_type == 'commission'">元</template>
- <template
- v-if="config.commission_type == 'score'">{{commission_type_map2[config.commission_type]}}</template>
- </template>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column label="平级奖" width="300">
- <template slot-scope="scope">
- <el-input type="text"
- v-model="config.detail[scope.row.level].equal_level_prize"
- @input="peerAwardLevelPrizeViolationNumInput($event, key, scope.row.level)">
- <template slot="append"
- v-if="config.is_percent == 0">%</template>
- <template slot="append" v-if="config.is_percent == 1">
- <template
- v-if="config.commission_type == 'commission'">元</template>
- <template
- v-if="config.commission_type == 'score'">{{commission_type_map2[config.commission_type]}}</template>
- </template>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column label="复购奖" width="300">
- <template slot-scope="scope">
- <el-input type="text"
- v-model="config.detail[scope.row.level].repurchase_prize"
- @input="peerRepurchasePrizeViolationNumInput($event, key, scope.row.level)">
- <template slot="append"
- v-if="config.is_percent == 0">%</template>
- <template slot="append" v-if="config.is_percent == 1">
- <template
- v-if="config.commission_type == 'commission'">元</template>
- <template
- v-if="config.commission_type == 'score'">{{commission_type_map2[config.commission_type]}}</template>
- </template>
- </el-input>
- </template>
- </el-table-column>
- </el-table>
- </template>
- </el-form-item>
- </el-card>
- </el-col>
- </el-row>
- </el-tab-pane>
- </el-tabs>
- </el-form>
- </el-card>
- </div>
- </template>
- <script>
- Vue.component('com-double-copy', {
- template: "#com-double-copy",
- props: {
- is_show_additional_score: {
- type: Number,
- default: 0
- },
- level_arr: {
- type: Object,
- default: () => {
- return {};
- }
- },
- setting: {
- type: Object,
- default: () => {
- return {};
- }
- },
- commission_type_map: {
- type: Object,
- default: () => {
- return {};
- }
- },
- commission_type_map2: {
- type: Object,
- default: () => {
- return { commission: "佣金", score:"积分" };
- }
- },
- },
- data() {
- return {
- activeName: 'commission',
- form: {
- },
- is_attr: 0,
- install: {// 初始化数据
- is_enable: 0,
- is_partake: 0,
- is_percent: 0,
- item_type: 'goods',
- commission_type: 'commission',
- settings: 0,
- detail: {}
- },
- copy_commission_type: {}
- }
- },
- mounted() {
- this.getCurrencyText()
- },
- watch: {
- setting: {
- deep: true,
- immediate: true,
- handler(value) {
- if (!isEmpty(value)) {
- this.form = value;
- }
- }
- },
- level_arr: {
- deep: true,
- immediate: true,
- handler(value) {
- if (this.is_show_additional_score == 1) {
- this.commission_type_map2['additional_score'] = '额外积分'
- }
- // alert(123)
- if (!isEmpty(value)) {
- let self = this;
- var data = value.DoubleCopy;
- // 初始化赋值
- for (let name in self.commission_type_map2) {
- let detail = {};
- var prize = isEmpty(self.form[name]) ? {} : self.form[name].detail;
- Object.keys(data).forEach(function (key) {
- var formKey = data[key].level;
- Object.assign(detail, {
- [formKey]: {
- level: data[key].level,
- first_prize: !isEmpty(prize[formKey]) ? prize[formKey].first_prize : 0,
- indirect_prize: !isEmpty(prize[formKey]) ? prize[formKey].indirect_prize : 0,
- second_prize: !isEmpty(prize[formKey]) ? prize[formKey].second_prize : 0,
- equal_prize: !isEmpty(prize[formKey]) ? prize[formKey].equal_prize : 0,
- allowance_price: !isEmpty(prize[formKey]) ? prize[formKey].allowance_price : 0,
- equal_level_prize: !isEmpty(prize[formKey]) ? prize[formKey].equal_level_prize : 0,
- repurchase_prize: !isEmpty(prize[formKey]) ? prize[formKey].repurchase_prize : 0,
- }
- });
- });
- self.install = {
- is_partake: isEmpty(self.form[name]) ? 0 : self.form[name].is_partake,
- is_enable: isEmpty(self.form[name]) ? 0 : self.form[name].is_enable,
- is_percent: isEmpty(self.form[name]) ? 0 : self.form[name].is_percent,
- item_type: isEmpty(self.form[name]) ? 'goods' : self.form[name].item_type,
- commission_type: name,
- detail: detail
- };
- this.$set(self.form, name, JSON.parse(JSON.stringify(self.install)));
- }
- }
- }
- },
- form: {
- deep: true,
- immediate: true,
- handler(value) {
- this.$emit("change", JSON.stringify(value), "DoubleCopy");
- }
- },
- commission_type_map2: {
- deep: true,
- immediate: true,
- handler(value) {
- this.copy_commission_type = value
- }
- }
- },
- methods: {
- handleSelectionChange() { },
- handleClick(tab, event) {
- console.log(tab, event);
- },
- //检测当前输入的违规次数--输入的时候
- firstPrizeViolationNumInput(value, v_key, level) {
- this.form[v_key].detail[level].first_prize = numberHandle(value, 2, 2);
- },
- //检测当前输入的违规次数--输入的时候
- indirectPrizeViolationNumInput(value, v_key, level) {
- this.form[v_key].detail[level].indirect_prize = numberHandle(value, 2, 2);
- },
- //检测当前输入的违规次数--输入的时候
- secondPrizeViolationNumInput(value, v_key, level) {
- this.form[v_key].detail[level].second_prize = numberHandle(value, 2, 2);
- },
- //检测当前输入的违规次数--输入的时候
- peerAwardPrizeViolationNumInput(value, v_key, level) {
- this.form[v_key].detail[level].equal_prize = numberHandle(value, 2, 2);
- },
- allowancePrizeViolationNumInput(value, v_key, level) {
- this.form[v_key].detail[level].equal_prize = numberHandle(value, 2, 2);
- },
- //检测当前输入的违规次数--输入的时候
- peerAwardLevelPrizeViolationNumInput(value, v_key, level) {
- this.form[v_key].detail[level].equal_level_prize = numberHandle(value, 2, 2);
- },
- //检测当前输入的违规次数--输入的时候
- peerRepurchasePrizeViolationNumInput(value, v_key, level) {
- this.form[v_key].detail[level].repurchase_prize = numberHandle(value, 2, 2);
- },
- getCurrencyText() {
- request({
- params: {
- r: 'mall/setting/get-currency-text',
- currency: Object.keys(this.copy_commission_type)
- },
- method: 'get',
- }).then(e => {
- if (e.data.code == 0) {
- let data = e.data.data
- for (let key in this.copy_commission_type) {
- if(key in data) {
- this.copy_commission_type[key] = data[key];
- }
- }
- }
- })
- },
- }
- });
- </script>
|