|
@@ -3,7 +3,7 @@
|
|
|
<!-- <h2>折扣设置</h2> -->
|
|
|
<div class="m-core">
|
|
|
<div class='newBand' v-permission="'chargeType/upSet'"
|
|
|
- @click="openTypes('create')">添加</div>
|
|
|
+ @click="createVisible = true">添加</div>
|
|
|
<!-- 列表 -->
|
|
|
<div class="tableWrap">
|
|
|
<el-table :data='tableList'
|
|
@@ -11,10 +11,12 @@
|
|
|
<el-table-column align='center'
|
|
|
prop="chargeTypeId"
|
|
|
label="收费类型">
|
|
|
+ <template slot-scope="scope">{{ typesListById[scope.row.chargeTypeId] }}</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
prop="subjectId"
|
|
|
label="声部组合">
|
|
|
+ <template slot-scope="scope">{{ subjectListById[scope.row.subjectId] }}</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
prop="goodsDiscountRate"
|
|
@@ -78,11 +80,11 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="折扣(%)"
|
|
|
- prop="discount"
|
|
|
+ prop="goodsDiscountRate"
|
|
|
:label-width="formLabelWidth">
|
|
|
- <el-input-number v-model.trim="form.discount"
|
|
|
+ <el-input-number v-model.trim="form.goodsDiscountRate"
|
|
|
autocomplete="off"
|
|
|
- placeholder="请输入折扣 1-100"
|
|
|
+ placeholder="请输入折扣 1%-100%"
|
|
|
controls-position="right"
|
|
|
class="number-input"
|
|
|
:min="1"
|
|
@@ -98,35 +100,50 @@
|
|
|
@click="onTypesSubmit('ruleForm')">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ :visible.sync="createVisible"
|
|
|
+ title="添加折扣"
|
|
|
+ width="400px"
|
|
|
+ >
|
|
|
+ <createDiscount
|
|
|
+ @close="createVisible = false"
|
|
|
+ :typesList="typesList"
|
|
|
+ :subjectList="subjectList"
|
|
|
+ />
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import pagination from '@/components/Pagination/index'
|
|
|
import { chargeTypeList, subjectListTree, insertChargeTypeSubjectMapper, updateChargeTypeSubjectMapper, delChargeTypeSubjectMapper, chargeTypeSubjectMapper } from '@/api/specialSetting'
|
|
|
+import createDiscount from './modals/create-discount'
|
|
|
export default {
|
|
|
name: 'typesManager',
|
|
|
- components: { pagination },
|
|
|
+ components: { pagination, createDiscount },
|
|
|
data () {
|
|
|
return {
|
|
|
tableList: [],
|
|
|
typesList: [],
|
|
|
+ typesListById: {},
|
|
|
subjectList: [], // 声部列表
|
|
|
+ subjectListById: {}, // 声部列表
|
|
|
formActionTitle: 'create',
|
|
|
formTitle: {
|
|
|
- create: '添加收费类型',
|
|
|
- update: '修改收费类型'
|
|
|
+ create: '添加折扣',
|
|
|
+ update: '修改折扣'
|
|
|
},
|
|
|
+ createVisible: false,
|
|
|
typeStatus: false, // 添加教学点
|
|
|
formLabelWidth: '100px',
|
|
|
form: {
|
|
|
name: null, //
|
|
|
subjectId: null,
|
|
|
- discount: null,
|
|
|
+ goodsDiscountRate: null,
|
|
|
},
|
|
|
rules: {
|
|
|
chargeTypeId: [{ required: true, message: '请选择收费类型', trigger: 'blur' }],
|
|
|
subjectId: [{ required: true, message: '请选择声部组合', trigger: 'change' }],
|
|
|
- discount: [{ required: true, message: '请输入折扣', trigger: 'blur' }],
|
|
|
+ goodsDiscountRate: [{ required: true, message: '请输入折扣', trigger: 'blur' }],
|
|
|
},
|
|
|
pageInfo: {
|
|
|
// 分页规则
|
|
@@ -154,7 +171,7 @@ export default {
|
|
|
this.messageTips('添加', res)
|
|
|
})
|
|
|
} else if (this.formActionTitle == 'update') {
|
|
|
- updateChargeTypeSubjectMapper(this.form).then(res => {
|
|
|
+ updateChargeTypeSubjectMapper([this.form]).then(res => {
|
|
|
this.messageTips('修改', res)
|
|
|
})
|
|
|
}
|
|
@@ -183,12 +200,15 @@ export default {
|
|
|
page: 1
|
|
|
}).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
+ const typesListById = {}
|
|
|
res.data.rows.forEach(item => {
|
|
|
+ typesListById[item.id] = item.name
|
|
|
this.typesList.push({
|
|
|
label: item.name,
|
|
|
value: item.id
|
|
|
})
|
|
|
})
|
|
|
+ this.typesListById = typesListById
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -222,9 +242,9 @@ export default {
|
|
|
if (type == 'update') {
|
|
|
this.form = {
|
|
|
id: row.id,
|
|
|
- name: row.name,
|
|
|
+ chargeTypeId: row.chargeTypeId,
|
|
|
subjectId: row.subjectId,
|
|
|
- discount: row.discount,
|
|
|
+ goodsDiscountRate: row.goodsDiscountRate,
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -232,7 +252,7 @@ export default {
|
|
|
this.form = {
|
|
|
name: null, // 作业模块名称
|
|
|
subjectId: null,
|
|
|
- discount: null,
|
|
|
+ goodsDiscountRate: null,
|
|
|
}
|
|
|
this.$refs[formName].resetFields()
|
|
|
},
|
|
@@ -241,6 +261,7 @@ export default {
|
|
|
delFlag: 0,
|
|
|
rows: 9999
|
|
|
}).then(res => {
|
|
|
+ const subjectListById = {}
|
|
|
let result = res.data
|
|
|
if (res.code == 200) {
|
|
|
let tempArray = []
|
|
@@ -248,6 +269,7 @@ export default {
|
|
|
let subject = []
|
|
|
if (item.subjects) {
|
|
|
item.subjects.forEach(s => {
|
|
|
+ subjectListById[s.id] = s.name
|
|
|
subject.push({
|
|
|
value: s.id,
|
|
|
label: s.name
|
|
@@ -260,6 +282,7 @@ export default {
|
|
|
options: subject
|
|
|
}
|
|
|
})
|
|
|
+ this.subjectListById = subjectListById
|
|
|
this.subjectList = tempArray
|
|
|
}
|
|
|
})
|