| | |
| | | </template> |
| | | |
| | | <script> |
| | | import PlusApi from '@/api/plus.js'; |
| | | import BusinessApi from '@/api/business.js'; |
| | | |
| | | export default { |
| | | data() { |
| | |
| | | // 加载数据 |
| | | loadData() { |
| | | this.loading = true; |
| | | PlusApi.gradeIndex().then(res => { |
| | | BusinessApi.gradeList().then(res => { |
| | | this.loading = false; |
| | | this.listData = res.data.list || []; |
| | | console.log(this.listData); |
| | |
| | | |
| | | if (params.grade_id) { |
| | | // 编辑 |
| | | PlusApi.gradeEdit(params).then(res => { |
| | | BusinessApi.gradeEdit(params).then(res => { |
| | | if (res.code === 1) { |
| | | this.$message.success('编辑成功'); |
| | | this.dialogVisible = false; |
| | |
| | | }); |
| | | } else { |
| | | // 添加 |
| | | PlusApi.gradeAdd(params).then(res => { |
| | | BusinessApi.gradeAdd(params).then(res => { |
| | | if (res.code === 1) { |
| | | this.$message.success('添加成功'); |
| | | this.dialogVisible = false; |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | PlusApi.gradeDelete({ grade_id: row.grade_id }).then(res => { |
| | | BusinessApi.gradeDelete({ grade_id: row.grade_id }).then(res => { |
| | | if (res.code === 1) { |
| | | this.$message.success('删除成功'); |
| | | this.loadData(); |
| | |
| | | price: row.price |
| | | }; |
| | | |
| | | PlusApi.gradeEdit(params).then(res => { |
| | | BusinessApi.gradeEdit(params).then(res => { |
| | | if (res.code !== 1) { |
| | | this.$message.error(res.msg || '更新权重失败'); |
| | | this.loadData(); // 重新加载数据 |