Commit 4d9402d2 by huaying

fix: 接口调整

parent 520ade94
...@@ -77,7 +77,7 @@ import limitInput from '@/components/limit-input.vue'; ...@@ -77,7 +77,7 @@ import limitInput from '@/components/limit-input.vue';
import showMsg from '@/common/js/showmsg'; import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public'; import { _debounce } from '@/common/js/public';
import { postRequest, getRequest } from '@/api/api'; import { postRequest } from '@/api/api';
export default { export default {
name: 'app-detail', name: 'app-detail',
props: { props: {
...@@ -102,7 +102,8 @@ export default { ...@@ -102,7 +102,8 @@ export default {
formData: { formData: {
templateId: '', templateId: '',
templateName: '', templateName: '',
groupIds: [] groupIds: [],
topFlags: []
}, },
rules: { rules: {
templateName: [{ required: true, message: '请输入模板名称', trigger: 'blur' }], templateName: [{ required: true, message: '请输入模板名称', trigger: 'blur' }],
...@@ -126,42 +127,45 @@ export default { ...@@ -126,42 +127,45 @@ export default {
methods: { methods: {
// 获取置顶数 // 获取置顶数
getToppingNum(val) { getToppingNum(val) {
getRequest('/haoban-app-customer-web/get-template-top-count', { templateId: this.$route.query.templateId }).then(res => { // getRequest('/haoban-app-customer-web/get-template-top-count', { templateId: this.$route.query.templateId }).then(res => {
if (res.data.errorCode == 1) { // if (res.data.errorCode == 1) {
this.toppingNum = res.data.result; // this.toppingNum = res.data.result;
} // }
}); // });
// let sortList = val.filter(item => item.topFlag == 1); let sortList = val.filter(item => item.topFlag == 1);
// this.toppingNum = sortList.length; this.toppingNum = sortList.length;
}, },
// 置顶事件 // 置顶事件
isTopping(itemIndex, item, n) { isTopping(itemIndex, item, n) {
let para = { // let para = {
memberTagGroupId: item.memberTagGroupId, // memberTagGroupId: item.memberTagGroupId,
templateId: this.$route.query.templateId, // templateId: this.$route.query.templateId,
topFlag: n // topFlag: n
}; // };
this.loading = true; this.loading = true;
getRequest('/haoban-app-customer-web/update-template-group-topflag', para) // getRequest('/haoban-app-customer-web/update-template-group-topflag', para)
.then(res => { // .then(res => {
if (res.data.errorCode == 1) { // if (res.data.errorCode == 1) {
this.tableData[itemIndex].topFlag = n; this.tableData[itemIndex].topFlag = n;
let setItem = this.tableData[itemIndex]; let setItem = this.tableData[itemIndex];
this.tableData.splice(itemIndex, 1); this.tableData.splice(itemIndex, 1);
if (n == 1) { if (n == 1) {
this.tableData.splice(0, 0, setItem); this.tableData.splice(0, 0, setItem);
} else if (n == 0) { } else if (n == 0) {
this.tableData.splice(this.toppingNum - 1, 0, setItem); this.tableData.splice(this.toppingNum - 1, 0, setItem);
} }
this.$message.success('操作成功!'); setTimeout(() => {
// this.getTemplateSet(this.brandId); this.loading = false;
} else { this.$message.success('操作成功!');
this.$message.error(res.data.message); }, 500);
} // this.getTemplateSet(this.brandId);
}) // } else {
.finally(() => { // this.$message.error(res.data.message);
this.loading = false; // }
}); // })
// .finally(() => {
// this.loading = false;
// });
}, },
/** /**
* 确认新建 * 确认新建
...@@ -171,6 +175,7 @@ export default { ...@@ -171,6 +175,7 @@ export default {
that.loadingBtn = true; that.loadingBtn = true;
if (that.tableData.length) { if (that.tableData.length) {
that.formData.groupIds = that.tableData.map(ele => ele.memberTagGroupId); that.formData.groupIds = that.tableData.map(ele => ele.memberTagGroupId);
that.formData.topFlags = that.tableData.map(ele => ele.topFlag);
} }
that.$refs[formName].validate(valid => { that.$refs[formName].validate(valid => {
...@@ -187,6 +192,8 @@ export default { ...@@ -187,6 +192,8 @@ export default {
templateId: that.formData.templateId, templateId: that.formData.templateId,
templateName: that.formData.templateName, templateName: that.formData.templateName,
groupIds: that.tableData.map(ele => ele.memberTagGroupId).join(','), groupIds: that.tableData.map(ele => ele.memberTagGroupId).join(','),
// topFlags: that.tableData.map(ele => ele.topFlag).join(','),
topFlags: that.tableData.map(ele => ele.topFlag),
editPerson: that.editPerson, editPerson: that.editPerson,
enterpriseId: that.brandId enterpriseId: that.brandId
}; };
...@@ -313,7 +320,8 @@ export default { ...@@ -313,7 +320,8 @@ export default {
that.formData = { that.formData = {
templateId: '', templateId: '',
templateName: '', templateName: '',
groupIds: [] groupIds: [],
topFlags: []
}; };
that.tableData = []; that.tableData = [];
} }
......
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