| | |
| | | :title="title" |
| | | :visible.sync="visible" |
| | | :confirm-working="isWorking" |
| | | width="50%" |
| | | @confirm="confirm" |
| | | > |
| | | <el-alert title="如果从平台选择商品进行直播,建议类别选择从平台库选择,系统已做数据关联;" type="warning" effect="dark" :closable="false"></el-alert> |
| | | <h3 style="margin: 20px 0 10px 0;">基本信息</h3> |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="类别来源" prop="type"> |
| | | <el-radio-group v-model="form.type" @change="changeRadio"> |
| | | <el-radio-group v-model="form.type" :disabled="form.id ? true : false" @change="changeRadio"> |
| | | <el-radio :label="1">从平台库选择</el-radio> |
| | | <el-radio :label="0">企业自建</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="选择类别" prop="platCateId" v-if="form.type == 1"> |
| | | <el-select v-model="form.platCateId" placeholder="请选择" @change="changeCategory"> |
| | | <el-select v-model="form.platCateId" filterable placeholder="请选择" @change="changeCategory"> |
| | | <el-option |
| | | v-for="item in categoryList" |
| | | :key="item.id" |
| | |
| | | style="width: 100%"> |
| | | <el-table-column label="参数名"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.name" placeholder="请输入内容"></el-input> |
| | | <el-input v-model="scope.row.name" placeholder="请输入名称"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="设置为选项"> |
| | |
| | | v-model="scope.row.isselect" |
| | | active-color="#13ce66" |
| | | inactive-color="#ff4949" |
| | | @change="changeIsselect($event, scope.row)" |
| | | :active-value="1" |
| | | :inactive-value="0"> |
| | | </el-switch> |
| | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { create, updateById, baseCategoryList, companyCreate, companyUpdateById } from '@/api/business/category.js' |
| | | import { baseCategoryList, companyCreate, companyUpdateById } from '@/api/business/category.js' |
| | | export default { |
| | | name: 'OperaCategoryWindow', |
| | | extends: BaseOpera, |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | changeIsselect(e, item) { |
| | | let num = 0 |
| | | this.form.tableData.forEach(row => { |
| | | if (row.isselect === 1) { |
| | | num += 1 |
| | | } |
| | | }) |
| | | if (num > 2) { |
| | | item.isselect = 0 |
| | | this.$message.warning({ message: '只能设置两个选项' }) |
| | | } |
| | | }, |
| | | addItem() { |
| | | this.form.tableData.push({ name: '', isselect: 0, isshow: 1 }) |
| | | }, |
| | |
| | | // 调用新建接口 |
| | | this.isWorking = true |
| | | if (!this.form.id) { |
| | | let arr = [] |
| | | this.form.budgetList.forEach(item => { |
| | | if (item.maxamount || item.minamount) { |
| | | arr.push(item) |
| | | } |
| | | }) |
| | | companyCreate({ |
| | | paramList: this.form.tableData, |
| | | type: this.form.type, |
| | |
| | | platCateId: this.form.platCateId, |
| | | name: this.form.name, |
| | | imgurl: this.form.imgurl, |
| | | budgetList: this.form.budgetList |
| | | budgetList: arr |
| | | }) |
| | | .then(() => { |
| | | this.visible = false |
| | |
| | | this.isWorking = false |
| | | }) |
| | | } else { |
| | | let arr = [] |
| | | this.form.budgetList.forEach(item => { |
| | | if (item.maxamount || item.minamount) { |
| | | arr.push(item) |
| | | } |
| | | }) |
| | | companyUpdateById({ |
| | | id: this.form.id, |
| | | paramList: this.form.tableData, |
| | |
| | | platCateId: this.form.platCateId, |
| | | name: this.form.name, |
| | | imgurl: this.form.imgurl, |
| | | budgetList: this.form.budgetList |
| | | budgetList: arr |
| | | }) |
| | | .then(() => { |
| | | this.visible = false |
| | |
| | | this.form.sortnum = item.sortnum |
| | | let arr = [] |
| | | item.baseCateParamList.forEach((row, index) => { |
| | | arr.push({ name: row.name, isselect: index <= 1 ? 1 : 0, isshow: 1 }) |
| | | arr.push({ name: row.name, baseCateParamId: row.id, isselect: 0, isshow: 1 }) |
| | | }) |
| | | this.form.tableData = arr |
| | | this.form.imgurl = item.imgurl |