Commit 5678ab8d authored by zhengke's avatar zhengke

修改

parent 84baf16f
<style>
.pintuan-share .box {
border-top: 1px solid #E8EAEE;
border-left: 1px solid #E8EAEE;
border-right: 1px solid #E8EAEE;
padding: 16px;
}
</style>
<template>
<div>
<el-form-item label="是否开启分销佣金" prop="individual_share">
<el-switch :active-value="1" :inactive-value="0" v-model="msg.individual_share">
</el-switch>
</el-form-item>
<template v-if="msg.individual_share == 1">
<!-- <el-form-item label="分销类型" prop="attr_setting_type" v-if="cForm.use_attr == 1 && ruleForm.type == 'goods'">
<el-radio v-model="ruleForm.attr_setting_type" :label="0">普通设置</el-radio>
<el-radio v-model="ruleForm.attr_setting_type" :label="1">详细设置</el-radio>
</el-form-item> -->
<el-form-item label="分销佣金类型" prop="share_type">
<el-radio v-model="msg.share_type" :label="0">固定金额</el-radio>
<el-radio v-model="msg.share_type" :label="1">百分比</el-radio>
</el-form-item>
<!-- <template v-if="sign !== 'pintuan'">
<app-goods-share v-model="ruleForm" :is_mch="is_mch" :attr-groups="attrGroups"
:attr_setting_type="cForm.attr_setting_type" :share_type="ruleForm.share_type" :use_attr="ruleForm.use_attr"
:sign="sign" pintuan_sign="单独购买"></app-goods-share>
</template>
<template v-if="sign === 'pintuan' && cForm.is_alone_buy == 1">
<app-goods-share v-model="ruleForm" :is_mch="is_mch" :attr-groups="attrGroups"
:attr_setting_type="ruleForm.attr_setting_type" :share_type="ruleForm.share_type"
:use_attr="ruleForm.use_attr" :sign="sign" pintuan_sign="单独购买"></app-goods-share>
</template> -->
<el-form-item>
<div class="pintuan-share">
<el-card>
<div slot="header" class="clearfix">
<div class="box">
<div style="display:inline-block;">
<el-tag type="danger">3人团</el-tag>
</div>
<label style="margin-bottom:0;padding:18px 10px;">批量设置</label>
<el-select placeholder="请选择层级" style="width:130px;" size="small">
<el-option label="一级分销" :value="1"></el-option>
<el-option label="二级分销" :value="2"></el-option>
</el-select>
<el-input type="text" size="small" style="width:150px;margin-top:5px;">
<el-button slot="append"></el-button>
</el-input>
<el-button size="small" type="primary">设置</el-button>
</div>
<el-table>
</el-table>
</div>
</el-card>
</div>
</el-form-item>
</template>
</div>
</template>
<script>
export default {
props: {
},
data() {
return {
msg: {
individual_share: 1,
share_type: 0
}
};
},
created() {
},
methods: {
},
mounted() {
},
computed: {
},
};
</script>
<style>
.header-require:before {
content: '*';
color: #F56C6C;
margin-right: 2px;
}
</style>
<template>
<div>
<el-form>
<el-form-item label-width="0">
<div>阶梯团设置</div>
<el-table style="margin-bottom: 15px;width: 100%" v-if="group_list.length > 0" :data="group_list" border>
<el-table-column width="200">
<template slot="header">
<div class="header-require">拼团人数</div>
</template>
<template slot-scope="scope">
<el-input v-model="scope.row.people_num" size="small" type="text" maxlength="5"
oninput="this.value = this.value.replace(/[^0-9]/, '')" placeholder="请输入拼团人数"></el-input>
</template>
</el-table-column>
<el-table-column label="团长优惠" width="200">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.preferential_price" size="small" placeholder="请输入团长优惠">
</el-input>
</template>
</el-table-column>
<el-table-column width="400">
<template slot="header">
<div class="header-require">拼团时间</div>
</template>
<template slot-scope="scope">
<el-input v-model="scope.row.pintuan_time" maxlength="4" type="text" size="small"
oninput="this.value = this.value.replace(/[^0-9]/, '')" placeholder="请输入拼团时间">
<template slot="append">小时</template>
</el-input>
</template>
</el-table-column>
<el-table-column label="最多开团数量" :render-header="delegation" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.group_num" type="text" size="small" maxlength="5"
oninput="this.value = this.value.replace(/[^0-9]/, '')" placeholder="请输入团长数量">
<template slot="append"></template>
</el-input>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="small" @click="destroyPintuan(scope.$index)" circle type="text">
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img src="../../../assets/img/userman/del.png" alt="">
</el-tooltip>
</el-button>
</template>
</el-table-column>
</el-table>
<el-button type="text" @click="addPintuan">
<i class="el-icon-plus" style="font-weight: bolder;margin-left: 5px;"></i>
<span style="color: #353535;font-size: 14px">新增阶梯团</span>
</el-button>
</el-form-item>
<el-card v-for="(item, index) in group_list" style="margin-top: 24px;" :key="index" shadow="never">
<div slot="header">
<el-tag type="danger">{{item.people_num}}人团</el-tag>
</div>
<el-form-item>
<div>价格与库存</div>
<priceAndGroup :attr-groups="new_attr_groups" v-model="item.attr" :list="{price: '拼团价', stock: '拼团库存'}"></priceAndGroup>
</el-form-item>
</el-card>
</el-form>
</div>
</template>
<script>
import priceAndGroup from "@/components/pintuan/pintuanPlugin/priceAndGroup.vue"
export default {
components: {
priceAndGroup //拼团与库存组件
},
data() {
return {
group_list: [],
//以下为写死-需要传入
newAttr: [],
defaultMemberPrice: [],
goods_stock: 0,
price: 0,
goods_no: '',
goods_weight: '',
new_attr_groups:[]
};
},
created() {
},
methods: {
//表头提示样式
delegation(h, {
column
}) {
return h(
"el-popover", {
props: {
placement: "top",
trigger: "hover",
popperClass: "popperClassResOut"
}
},
[
h(
"div",
[
`可发起拼团的次数(包括正在拼团中、拼团完成),`,
h('br'),
`0代表不限制次数`,
]
),
h(
"span", {
slot: "reference"
},
[
column.label,
h("i", {
class: "el-icon-info",
style: {
marginLeft: "4px",
cursor: "pointer",
}
})
]
),
]
)
},
//新增阶梯团
addPintuan() {
let data = {};
if (this.newAttr.length === 0) {
data = [{
attr_list: [{
attr_group_id: -1,
attr_group_name: '规格',
attr_name: this.attr_default_name ? this.attr_default_name : '默认',
attr_id: -1,
}],
stock: this.goods_stock,
price: this.price,
no: this.goods_no,
weight: this.goods_weight,
pic_url: '',
pintuan_stock: this.goods_stock,
pintuan_price: this.price,
goodsAttr: {
id: undefined
}
}];
} else {
data = JSON.parse(JSON.stringify(this.newAttr));
data.forEach((item) => {
item.pintuan_price = item.price;
item.pintuan_stock = item.stock;
item.goodsAttr = {
id: item.id
}
});
}
this.group_list.push({
people_num: 2,
preferential_price: 1,
pintuan_time: 1,
goods_id: 0,
attr: JSON.parse(JSON.stringify(data)),
member_price: JSON.parse(JSON.stringify(this.defaultMemberPrice)),
shareLevelList: {
share_commission_first: 0,
share_commission_second: 0,
share_commission_third: 0,
},
});
},
//删除拼团
destroyPintuan(index) {
this.group_list.splice(index, 1);
}
},
mounted() {
}
};
</script>
<style>
.app-attr .box {
line-height: 64px;
border-top: 1px solid #E8EAEE;
border-left: 1px solid #E8EAEE;
border-right: 1px solid #E8EAEE;
padding: 0 16px;
}
.app-attr .box .batch {
margin-left: -10px;
margin-right: 20px;
}
.app-attr .el-select .el-input {
width: 130px;
}
.app-attr .input-with-select .el-input-group__prepend {
background-color: #fff;
}
.app-attr .header-require:before {
content: '*';
color: #F56C6C;
margin-right: 2px;
}
</style>
<template>
<div class="app-attr">
<div class="box">
<el-form label-width="180px">
<el-checkbox v-model="attrBatch" @change="selectClick" :disabled="!cData || cData.length == 0"
style="position:absolute">全选
</el-checkbox>
<el-form-item label="批量设置" size="small" style="margin-bottom:0;padding:18px 0;display:inline-block;">
<el-input @keyup.enter.native="batchAttr(selectData)" size="small" :type="selectData == 'no' ? 'text' : 'number'"
v-model="batch">
<el-select v-model="selectData" slot="prepend">
<el-option v-for="(item, index) in cList" :value="index" :key="item" v-if="index!='pic_url'" :label="item">
{{item}}
</el-option>
</el-select>
<template slot="append">
<el-button @click="batchAttr(selectData)">
确定
</el-button>
</template>
</el-input>
</el-form-item>
</el-form>
</div>
<el-table ref="multipleTable" :data="cData" border stripe style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column v-for="(item, index) in attrGroups" :key="item.id" :prop="'attr_list['+index+'].attr_name'"
:label="item.attr_group_name">
</el-table-column>
<el-table-column v-if="cList" v-for="(item, key, index) in cList" :key="item.id" :property="key"
:label="item + (append ? '(' + append + ')' : '')">
<template slot="header" v-if="requiredArray.indexOf(key) !== -1">
<div class="header-require">{{item}}</div>
</template>
<template slot-scope="scope">
<template v-if="!isLevel">
<div flex="box:first" v-if="scope.column.property == 'pic_url'" style="padding: 10px;">
<div flex="cross:center" style="margin-right: 10px;position: relative;">
<app-attachment :multiple="false" :params="scope.row" :max="1"
v-model="scope.row[scope.column.property]">
<app-gallery :url="scope.row[scope.column.property]" width="50px" height="50px"></app-gallery>
</app-attachment>
<el-button v-if="scope.row[scope.column.property]"
style="position: absolute; right: -8px; top: -8px; padding: 4px 4px;" size="mini" type="danger"
icon="el-icon-close" circle @click="scope.row[scope.column.property] = ''"></el-button>
</div>
</div>
<el-input v-else-if="scope.column.property == 'no'" v-model="scope.row[scope.column.property]"></el-input>
<el-input v-else-if="scope.column.property == 'stock'"
oninput="this.value = this.value.replace(/[^0-9]/g, '');" v-model="scope.row[scope.column.property]">
</el-input>
<el-input v-else-if="scope.column.property.indexOf('price') > -1 || scope.column.property.indexOf('level')"
type="number" v-model="scope.row[scope.column.property]"></el-input>
<el-input v-else oninput="this.value = this.value.replace(/[^0-9]/g, '');"
v-model="scope.row[scope.column.property]">
<template v-if="append" slot="append">{{append}}</template>
</el-input>
</template>
<template v-else>
<el-input :data-id="scope.row[scope.column.label]" type="number"
v-model="scope.row[paramKey][scope.column.property]">
</el-input>
</template>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
props: {
value: Array, // 商品规格信息
attrGroups: Array, // 商品规格组
extra: Object, // 额外的数据信息
list: Object | Array, // 从排列数据信息
isLevel: Boolean, // 是否是会员
members: Array, // 会员等级列表
share: Array, // 分销等级列表
append: String, // 输入框后缀
requiredExtra: {
type: Array,
default () {
return []
}
},
paramKey: {
type: String,
default () {
return 'member_price';
}
}
},
data() {
return {
requiredArray: [`price`, `stock`].concat(this.requiredExtra),
attrBatch: false,
data: {
price: '价格',
stock: '库存',
weight: '重量(克)',
no: '货号',
//pic_url: '规格图片',
},
selectData: '',
batch: 0,
selectList: [],
};
},
created() {
},
watch: {
'selectList': function () {
const self = this;
let sign = 0;
this.value.forEach(function (item, index) {
self.selectList.map((item1) => {
if (JSON.stringify(item1.attr_list) === JSON.stringify(item.attr_list)) {
sign++;
}
});
});
self.attrBatch = self.value.length === sign;
}
},
methods: {
//全选
selectClick() {
this.$refs.multipleTable.toggleAllSelection();
},
handleSelectionChange(data) {
this.selectList = data;
},
batchAttr(param) {
if (!param) {
this.$message.warning('请选择批量设置');
return;
}
if (!this.selectList || this.selectList.length === 0) {
this.$message.warning('请勾选商品规格');
return;
}
let self = this;
let batch = self.batch;
this.value.forEach((item, index) => {
let sign = false;
self.selectList.map((item1) => {
if (JSON.stringify(item1.attr_list) === JSON.stringify(item.attr_list)) {
sign = true;
}
});
if (sign) {
// 批量设置会员价
// 判断字符串是否出现过,并返回位置
if (param.indexOf('level') !== -1) {
item[this.paramKey][param] = batch;
} else {
item[param] = batch;
}
}
});
}
},
mounted() {
},
computed: {
cList() {
// TODO 分销数据暂时
if (this.share) {
let share = JSON.parse(JSON.stringify(this.share));
let obj = {};
for (let i = 0; i < share.length; i++) {
obj[share[i].value] = share[i].label;
}
return obj;
}
// TODO 会员数据暂时
if (this.isLevel) {
let members = JSON.parse(JSON.stringify(this.members));
let obj = {};
for (let i = 0; i < members.length; i++) {
obj['level' + members[i].level] = members[i].name
}
return obj;
} else {
if (this.extra) {
return Object.assign(this.data, JSON.parse(JSON.stringify(this.extra)));
} else if (this.list) {
return JSON.parse(JSON.stringify(this.list))
} else {
return this.data;
}
}
},
cData() {
if (this.attrGroups && this.attrGroups.length > 0 && this.attrGroups[0].attr_list.length === 0) {
return [];
} else {
return this.value;
}
}
},
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment