Commit 5a92a08c by huaying

Merge branch 'feature/十月我的客户' into dev

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