Commit 7653ea2c by liuchenxi

update: 短信分权

parent 7f2db37e
......@@ -12,6 +12,13 @@ if (process.env.NODE_ENV == 'development') { // eslint-disable-line
} else {
Vue.config.devtools = false;
}
Vue.prototype.$getButtonLimit = () => true;
Vue.prototype.$buttonCode = {
marketingExportMarketing: 'marketingExportMarketing',
marketingExportSms: 'marketingExportSms',
marketingExportRecord: 'marketingExportRecord',
marketingExportCall: 'marketingExportCall'
};
Vue.prototype.axios = axios;
Vue.prototype.axios.withCredentials = true;
......
export default {
computed: {
getCodeAuth() {
return code => this.$getButtonLimit(this.getCode(code));
},
getCode() {
return code => this.$buttonCode[code];
}
}
};
......@@ -9,7 +9,7 @@
</el-select>
</div>
<div class="right">
<el-button type="primary" @click="addDepartDialog.visible = true">增加独立计费部门</el-button>
<el-button v-if="$getButtonLimit($buttonCode.marketingAddAccountDepart)" :limit-code="$buttonCode.marketingAddAccountDepart" type="primary" @click="addDepartDialog.visible = true">增加独立计费部门</el-button>
</div>
</div>
<div class="content mt20">
......@@ -22,11 +22,11 @@
</el-table-column>
<el-table-column label="操作" min-width="130">
<template slot-scope="{ row }">
<el-button type="text" @click="showStore(row)">查看门店</el-button>
<el-button type="text" @click="toRecord(row)">记录</el-button>
<template v-if="row.accountDepartId != 1">
<el-button type="text" v-if="row.status == 0" @click="updateStatus(row, 'open')">启用</el-button>
<el-button type="text" v-if="row.status == 1" @click="updateStatus(row, 'freeze')">停用</el-button>
<el-button v-if="$getButtonLimit($buttonCode.marketingShowStore)" :limit-code="$buttonCode.marketingShowStore" type="text" @click="showStore(row)">查看门店</el-button>
<el-button v-if="$getButtonLimit($buttonCode.marketingAccountDetailRecord)" :limit-code="$buttonCode.marketingAccountDetailRecord" type="text" @click="toRecord(row)">记录</el-button>
<template v-if="row.accountDepartId != 1 && $getButtonLimit($buttonCode.marketingUpdateStatus)">
<el-button type="text" v-if="row.status == 0" :limit-code="$buttonCode.marketingUpdateStatus" @click="updateStatus(row, 'open')">启用</el-button>
<el-button type="text" v-if="row.status == 1" :limit-code="$buttonCode.marketingUpdateStatus" @click="updateStatus(row, 'freeze')">停用</el-button>
</template>
</template>
</el-table-column>
......@@ -191,7 +191,6 @@ export default {
}
},
showStore(row) {
console.log(row);
this.viewStoreDialog.departId = row.departmemtId;
this.viewStoreDialog.visible = true;
},
......
......@@ -28,30 +28,35 @@
<div class="mark" />
短信
</h2>
<el-form-item label="短信营销:" prop="smsPlanRule">
<el-form-item label="短信营销:" prop="smsPlanRule" class="mb20">
<el-radio-group v-model="form.smsPlanRule">
<el-radio :label="2">会员所属服务门店</el-radio>
<el-radio :label="3">活动创建人</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="智能营销发送短信:" prop="smsEcmRule">
<el-form-item label="智能营销发送短信:" prop="smsEcmRule" class="mb20">
<el-radio-group v-model="form.smsEcmRule">
<el-radio :label="2">会员所属服务门店</el-radio>
<el-radio :label="3">活动创建人</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="会员修改手机号:" prop="smsValidCodeRule">
<el-form-item label="会员修改手机号:" prop="smsValidCodeRule" class="mb20">
<el-radio-group v-model="form.smsValidCodeRule">
<el-radio :label="2">会员所属服务门店</el-radio>
<el-radio :label="1">总部</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="会员认证开卡:" prop="smsOpenCardRule">
<el-form-item label="会员认证开卡:" prop="smsOpenCardRule" class="mb20">
<el-radio-group v-model="form.smsOpenCardRule">
<el-radio :label="1">总部</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="好办-导购绑定手机号:" prop="smsHaobanRule">
<el-form-item label="登录观云台小程序:" prop="lcx" class="mb20">
<el-radio-group v-model="form.lcx">
<el-radio :label="1">总部</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="好办-导购绑定手机号:" prop="smsHaobanRule" class="mb20">
<el-radio-group v-model="form.smsHaobanRule">
<el-radio :label="4">导购所在门店</el-radio>
</el-radio-group>
......@@ -63,7 +68,7 @@
<div class="mark" />
双向呼叫&录音
</h2>
<el-form-item label="双向呼叫&录音:" prop="callRule">
<el-form-item label="双向呼叫&录音:" prop="callRule" class="mb20">
<el-radio-group v-model="form.callRule">
<el-radio :label="4">导购所在门店</el-radio>
<el-radio :label="3">活动创建人</el-radio>
......@@ -72,7 +77,7 @@
</template>
</template>
</el-form>
<div class="demo-drawer__footer footer">
<div class="footer">
<el-button @click="close">取 消</el-button>
<el-button type="primary" @click="save">保 存</el-button>
</div>
......@@ -100,7 +105,8 @@ export default {
smsValidCodeRule: 1, // 修改手机号
smsOpenCardRule: 1, // 认证
smsHaobanRule: 4, // 好办
callRule: 4 // 双向呼叫
callRule: 4, // 双向呼叫
lcx: 1 // 观云台小程序
},
isMoreAccount: false,
rules: {
......@@ -108,6 +114,7 @@ export default {
smsEcmRule: [{ required: true, validator: (rule, val, cb) => validate(val, cb, [2, 3]) }],
smsValidCodeRule: [{ required: true, validator: (rule, val, cb) => validate(val, cb, [2, 1]) }],
smsOpenCardRule: [{ required: true, validator: (rule, val, cb) => validate(val, cb, [1]) }],
lcx: [{ required: true, validator: (rule, val, cb) => validate(val, cb, [1]) }],
smsHaobanRule: [{ required: true, validator: (rule, val, cb) => validate(val, cb, [4]) }],
callRule: [{ required: true, validator: (rule, val, cb) => validate(val, cb, [3, 4]) }]
}
......@@ -123,14 +130,18 @@ export default {
const options1 = { confirmButtonText: '确认开启', cancelButtonText: '取消', type: 'warning' };
const options2 = { confirmButtonText: '立即设置', cancelButtonText: '稍后设置', type: 'success' };
try {
// 单商户转多商户二次弹窗确认
if (!this.isMoreAccount) await this.$confirm('开启多账户计费模式次日凌晨生效,并且开启', '确认开启多账户模式?', options1);
// 单商户转多商户二次弹窗确认,不存在多切单的情况
const para = this.form.status ? this.form : { status: 0 };
await saveAccountRule(para);
// 如果从单商户切换多商户保存了那么就修改isMoreAccount得状态,组件此时不会重新render.同时发送给父组件让父组件重新调用获取商户配置接口
if (para.status == 1 && !this.isMoreAccount) {
this.isMoreAccount = true;
this.$emit('getNewData');
// 比较字段值是否有改变
if (this.compareIsEdit(para, this.data)) {
if (!this.isMoreAccount) await this.$confirm('开启多账户计费模式次日凌晨生效,并且开启', '确认开启多账户模式?', options1);
await saveAccountRule(para);
this.$emit('getNewData', !this.isMoreAccount);
} else {
if (!this.isMoreAccount) {
this.$emit('update:visible', false);
return this.$message.success('保存成功');
}
}
try {
await this.$confirm('赶紧去设置不同的计费账户吧,也可点击【计费中心-账户明细】配置不同的计费账户', '保存成功', options2);
......@@ -152,6 +163,14 @@ export default {
},
beforeClose() {
this.$emit('update:visible', false);
},
compareIsEdit(data, all) {
for (let key in data) {
if (data[key] != all[key]) {
return true;
}
}
return false;
}
},
watch: {
......@@ -171,6 +190,9 @@ export default {
<style lang="scss" scoped>
.drawer {
position: relative;
/deep/ .el-form-item {
margin-bottom: 20px;
}
}
h2 {
color: #303133;
......@@ -228,15 +250,15 @@ h2 {
}
}
.footer {
box-shadow: 0px -2px 8px 0px rgba(220, 223, 230, 0.6);
position: absolute;
bottom: 0;
padding: 0 20px;
box-shadow: 0px -2px 8px 0px rgba(220, 223, 230, 0.6);
box-sizing: border-box;
height: 56px;
position: absolute;
width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
bottom: 0;
}
</style>
......@@ -3,6 +3,7 @@
<div class="alert">
<i class="iconfont icon-warning-circle-fill"></i>
<span class="ml10">若要修改门店请前往【企业管理-权限管理-用户列表】进行修改</span>
<el-button v-if="$getButtonLimit($buttonCode.marketingToUserList)" :limit-code="$buttonCode.marketingToUserList" type="text" class="ml10" @click="toUserList">立即前往</el-button>
</div>
<el-input class="mt20 mb20 w260" v-model="search" clearable prefix-icon="el-icon-search" placeholder="请输入门店名称或code" @change="onSearch" />
<el-table :data="tableData.data" element-loading-text="拼命加载中" max-height="288">
......@@ -79,6 +80,9 @@ export default {
this.$emit('update:visible', false);
this.search = '';
this.tableData.currentPage = 1;
},
toUserList() {
window.open('/gic-web/#/userManager');
}
},
computed: {
......@@ -105,7 +109,7 @@ export default {
display: flex;
align-items: center;
background: #f7f8fa;
width: 475px;
width: 520px;
height: 32px;
padding: 0 16px;
box-sizing: border-box;
......
......@@ -19,7 +19,7 @@
<select-depart v-if="isMoreAccount && config.showAllDepartment" :data="deparment" @load="load" @getDepartId="getDepartId" @remote-search="remoteSearch" :loading="deparment.loading" />
<span class="fz12 gray">* 此处仅支持筛选近半年的统计数据</span>
</div>
<el-button type="primary" class="btn h32" @click="exportDialog.dialogVisible = true"><i class="iconfont icon-xiazai" style="marginRight:6px;fontSize:14px" />导出</el-button>
<el-button v-if="getCodeAuth" :limit-code="getCode($route.params.type)" type="primary" class="btn h32" @click="exportDialog.dialogVisible = true"><i class="iconfont icon-xiazai" style="marginRight:6px;fontSize:14px" />导出</el-button>
</div>
<p class="tips" v-if="$route.params.type === 'video'">共消耗流量{{ sumCount }}MB 累计支出{{ sumFee }}</p>
<p class="tips" v-if="['record', 'call'].includes($route.params.type)">
......@@ -374,8 +374,9 @@ export default {
},
async created() {
this.getDepartmentList();
await this.getAuth();
await this.getRule();
const config = await this.getAuth(); // rechartge_mixin
this.deparment.departId = config.accountDepartId;
await this.getRule(); // 该接口调取完后select-depart组件挂载所以在之前一步初始化departId
this.loadAll();
this.$store.commit('mutations_breadcrumb', [{ name: '企业管理', path: '' }, { name: '计费中心', path: '/recharge' }, { name: '消费详情', path: '' }]); // eslint-disable-line
},
......@@ -599,7 +600,7 @@ export default {
this.tableList = [];
}
} else if (type === 'charts') {
this.sumCount = res.result.sumCallTime || 0;
this.sumCount = res.result.sumCallTime * 60 || 0;
this.sumFee = res.result.sumFee;
}
} catch (err) {}
......@@ -682,6 +683,32 @@ export default {
4: '导购所属服务门店'
};
return id => map[id] || '--';
},
accountDepartName() {
return row => (row.accountDepartName ? row.accountDepartName : row.accountDepartId == 1 ? '总部' : '--');
},
getCodeAuth() {
return this.$getButtonLimit(this.getCode(this.$route.params.type));
},
getCode() {
return type => {
let code;
switch (type) {
case 'marketing':
code = 'marketingExportMarketing';
break;
case 'sms':
code = 'marketingExportSms';
break;
case 'call':
code = 'marketingExportCall';
break;
case 'record':
code = 'marketingExportRecord';
break;
}
return this.$buttonCode[code];
};
}
}
};
......
......@@ -26,7 +26,7 @@ export default {
let res = await rechargeCenter();
this.extend(this.config, res.result.account || {});
// this.config.showAllDepartment = false;
return true;
return this.config;
} catch (err) {
console.log(err);
}
......
......@@ -31,9 +31,11 @@
</template>
</el-table-column>
<el-table-column label="余额(元)" align="left" prop="totalFee">
<template slot-scope="scope"> {{ (scope.row.totalFee / 100).toFixed(2) }}</template>
<template slot-scope="scope"> {{ scope.row.totalFee ? (scope.row.totalFee / 100).toFixed(2) : '0.00' }}</template>
</el-table-column>
<el-table-column align="left" prop="reason" label="原因" show-overflow-tooltip>
<template slot-scope="{ row }">{{ row.reason || '--' }}</template>
</el-table-column>
<el-table-column align="left" prop="reason" label="原因" show-overflow-tooltip></el-table-column>
<el-table-column label="图片凭证">
<template slot-scope="scope">
<viewer :options="options" :images="getUrls(scope)" class="viewer" ref="viewer">
......@@ -98,8 +100,9 @@ export default {
this.deparment.departId = this.$route.query.id || '';
this.getDepartmentList();
this.$store.commit('mutations_breadcrumb', [{ name: '企业管理', path: '' }, { name: '计费中心', path: '/recharge' }, { name: '记录', path: '' }]); // eslint-disable-line
await this.getAuth();
await this.getRule();
const config = await this.getAuth(); // rechartge_mixin
this.deparment.departId = config.accountDepartId;
await this.getRule(); // 该接口调取完后select-depart组件挂载所以在之前一步初始化departId
this.rechargeRecord();
},
methods: {
......
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