Commit 520ade94 by huaying

fix: 我的客户

parent e21a1a8a
......@@ -8,6 +8,13 @@
*/
module.exports = {
proxyList: {
'/api-admin': {
target: 'https://www.gicdev.com/api-admin/',
changeOrigin: true,
pathRewrite: {
'^/api-admin': ''
}
},
'/haoban-manage3-web/': {
target: 'https://www.gicdev.com/haoban-manage3-web/',
changeOrigin: true,
......
......@@ -52,6 +52,12 @@
<el-table-column prop="" label="操作">
<template slot-scope="scope">
<el-button type="text" @click="delRow(scope.$index, scope.row)">移除</el-button>
<dm-delete tips="确定置顶?" @confirm="isTopping(scope.$index, scope.row, 1)" v-if="isEdit && scope.row.topFlag == 0">
<el-button type="text" style="padding: 0 14px" :disabled="toppingNum >= 5">置顶</el-button>
</dm-delete>
<dm-delete tips="确定取消置顶?" @confirm="isTopping(scope.$index, scope.row, 0)" v-if="isEdit && scope.row.topFlag == 1">
<el-button type="text">取消置顶</el-button>
</dm-delete>
</template>
</el-table-column>
</el-table>
......@@ -71,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 } from '@/api/api';
import { postRequest, getRequest } from '@/api/api';
export default {
name: 'app-detail',
props: {
......@@ -112,10 +118,51 @@ export default {
pageSize: 20,
total: 0,
groupShow: false,
loadingBtn: false
loadingBtn: false,
toppingNum: 0,
isEdit: false
};
},
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;
},
// 置顶事件
isTopping(itemIndex, item, 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;
});
},
/**
* 确认新建
*/
......@@ -173,10 +220,14 @@ export default {
type: 'warning'
})
.then(() => {
this.loading = true;
that.tableData.splice(index, 1);
if (that.tableData.length) {
that.formData.groupIds = that.tableData.map(ele => ele.memberTagGroupId);
}
setTimeout(() => {
this.loading = false;
}, 500);
})
.catch(() => {});
},
......@@ -285,10 +336,22 @@ export default {
if (newData && !!that.$route.query.templateId) {
that.getTemplateSet(that.brandId);
}
},
tableData: {
handler: function(val) {
const that = this;
if (val) {
if (that.isEdit) {
that.getToppingNum(val);
}
}
},
deep: true
}
},
mounted() {
const that = this;
that.isEdit = that.$route.query.templateId ? true : false;
that.$emit('showTab', '12');
if (that.brandId && !!that.$route.query.templateId) {
that.getTemplateSet(that.brandId);
......
......@@ -70,18 +70,41 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="{ row }">
<dm-delete tips="确定置顶?" @confirm="isTopping(row, 1)" v-if="row.topFlag == 0">
<el-button type="text" style="padding: 0 14px" :disabled="toppingNum >= 5">置顶</el-button>
</dm-delete>
<dm-delete tips="确定取消置顶?" @confirm="isTopping(row, 0)" v-if="row.topFlag == 1">
<el-button type="text">取消置顶</el-button>
</dm-delete>
<el-button type="text" @click="sortNumBtn(row)">设置排序值</el-button>
</template>
</el-table-column>
</el-table>
<div class="block common-wrap__page text-right m-t-24" v-if="groupListData.length != 0">
<dm-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </dm-pagination>
</div>
</div>
<el-dialog title="设置排序值" :visible.sync="setSortShow" width="450px" @close="customCancel">
<el-form :model="sortForm" ref="sortForm" class="sortClass" label-width="80px">
<el-form-item label="排序值" prop="sortNum" :rules="[{ required: true, message: '请输入排序值', trigger: 'blur' }]">
<el-input-number v-model="sortForm.sortNum" placeholder="请设置大于0的数字" :controls="false" min="1"></el-input-number>
<span class="tips">/*排序值越小越靠前*/</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="sortLoading" @click="customCancel">取消</el-button>
<el-button :loading="sortLoading" type="primary" @click="customConfirm">保存</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public';
import { postRequest } from '@/api/api';
import { postRequest, getRequest } from '@/api/api';
export default {
name: 'app-detail',
props: {
......@@ -110,10 +133,78 @@ export default {
loading: false,
// 最近同步时间
syncDate: '',
loadingBtn: false
loadingBtn: false,
toppingNum: 0,
currentGroupId: '',
setSortShow: false,
sortForm: {
sortNum: undefined
},
sortLoading: false
};
},
methods: {
// 设置排序值
sortNumBtn(item) {
this.setSortShow = true;
this.currentGroupId = item.memberTagGroupId;
this.sortForm.sortNum = item.sortNum || undefined;
},
// 设置排序值取消按钮
customCancel() {
this.setSortShow = false;
this.sortForm.sortNum = undefined;
this.currentGroupId = '';
this.$refs.sortForm.clearValidate();
},
// 设置排序值确认按钮
customConfirm() {
this.sortLoading = true;
this.$refs.sortForm.validate(valid => {
if (valid) {
let para = {
memberTagGroupId: this.currentGroupId,
sortNum: this.sortForm.sortNum
};
getRequest('/haoban-app-customer-web/memberGroup/update-tag-group-sortnum', para)
.then(res => {
if (res.data.errorCode == 1) {
this.$message.success('排序成功');
this.customCancel();
this.getGroupList(this.brandId);
} else {
this.$message.error('排序失败');
}
})
.finally(() => {
this.sortLoading = false;
});
}
});
},
// 获取置顶数
getToppingNum() {
getRequest('/haoban-app-customer-web/memberGroup/get-tag-group-top-count', {}).then(res => {
if (res.data.errorCode == 1) {
this.toppingNum = res.data.result;
}
});
},
// 置顶事件
isTopping(item, n) {
let para = {
memberTagGroupId: item.memberTagGroupId,
topFlag: n
};
getRequest('/haoban-app-customer-web/memberGroup/update-tag-group-topflag', para).then(res => {
if (res.data.errorCode == 1) {
this.$message.success('操作成功!');
this.getGroupList(this.brandId);
} else {
this.$message.error(res.data.message);
}
});
},
/**
* 获取同步时间
*/
......@@ -306,6 +397,7 @@ export default {
let resData = res.data;
that.loading = false;
if (resData.errorCode == 1) {
that.getToppingNum();
if (resData.result.list && resData.result.list.length) {
resData.result.list.forEach(ele => {
ele.isSendTemplate = ele.isSendTemplate == 1 ? true : false;
......@@ -337,7 +429,20 @@ export default {
}
};
</script>
<style lang="less">
.sortClass {
.el-input,
.el-input-number .el-input__inner {
text-align: left;
}
}
</style>
<style lang="scss" scoped>
.tips {
margin-left: 10px;
font-size: 12px;
color: #909399;
}
.w-500 {
width: 500px;
}
......
......@@ -14,10 +14,11 @@
<template>
<div class="app-detail-wrap">
<el-tabs v-model="activeName">
<el-tab-pane label="客户分组列表" name="first">
<el-tab-pane label="所有门店可见分组" name="first">
<member-group-list :brand-id="brandId"></member-group-list>
</el-tab-pane>
<el-tab-pane label="分组展示设置" name="second">
<el-tab-pane name="second">
<span slot="label">设置分组模板 <span class="tips">/*设置后指定门店只可见选中的分组*/</span></span>
<member-group-set-list :brand-id="brandId"></member-group-set-list>
</el-tab-pane>
</el-tabs>
......@@ -43,6 +44,10 @@ export default {
};
</script>
<style lang="scss" scoped>
.tips {
font-size: 12px;
color: #909399;
}
.app-detail-wrap {
height: 100%;
background: #fff;
......
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