Commit d93b434a by crushh

update: 暂停按钮

parent 8515677d
......@@ -123,3 +123,9 @@ export const aiTransformStoreGroupSplit = params => requests('/api-marketing/sta
// 客户明细导出
export const exportAiCustomDetail = '/api-marketing/statistics/export-ai-custom-detail';
// 【Ai活动计划】手动开启活动计划
export const continueActivityPlan = params => requests('/api-marketing/ai/continue-activity-plan', params, true, false, 'get');
// 【Ai活动计划】手动暂停活动计划
export const suspendActivityPlan = params => requests('/api-marketing/ai/suspend-activity-plan', params, true, false, 'get');
......@@ -14,7 +14,7 @@
</div>
<div class="account">
<span>
账户可用余额:<span style="font-size:16px;">{{ (money / 100) | amount }}</span>
账户可用余额:<span style="font-size:16px;">{{ money | amount }}</span>
</span>
<el-button v-if="$getButtonLimit($buttonCode.marketingAiRecharge)" :limit-code="$buttonCode.marketingAiRecharge" type="text" @click="recharge">立即充值</el-button>
</div>
......@@ -90,7 +90,7 @@
</template>
<script>
import { page, rechargeCenter, stopActivityPlan, startActivityPlan, pageStatistics, aiAccountCheck } from '@/service/api/aiApi.js';
import { page, rechargeCenter, stopActivityPlan, startActivityPlan, pageStatistics, aiAccountCheck, getAiCalcSingle, continueActivityPlan, suspendActivityPlan } from '@/service/api/aiApi.js';
import { formatDateTimeByType } from '@/utils/index.js';
import filterAvater from '@/mixins/filterAvater.js';
......@@ -128,6 +128,13 @@ export default {
handler: row => this.$router.push('/ai/info/' + row.activityId)
},
{
text: '暂停',
visible: row => {
return row.activityPlanStatus == 2;
},
handler: row => this.handleSuspend(row)
},
{
text: '编辑',
props: {
limitCode: this.$buttonCode.marketingAiEdit
......@@ -153,7 +160,7 @@ export default {
limitCode: this.$buttonCode.marketingAiStart
},
visible: row => {
return row.activityPlanStatus === 5 && this.$getButtonLimit(this.$buttonCode.marketingAiStart);
return (row.activityPlanStatus === 5 || row.activityPlanStatus === 6) && this.$getButtonLimit(this.$buttonCode.marketingAiStart);
},
handler: row => this.rebootTask(row)
},
......@@ -275,6 +282,10 @@ export default {
{
value: 5,
label: '欠费暂停'
},
{
value: 6,
label: '手动暂停'
}
],
money: 0,
......@@ -284,8 +295,10 @@ export default {
2: 'dm-status--primary--flash',
3: 'dm-status--error',
4: 'dm-status--info',
5: 'dm-status--warning'
}
5: 'dm-status--warning',
6: 'dm-status--warning'
},
isWhite: false
};
},
created() {
......@@ -297,6 +310,7 @@ export default {
this.getTableData();
this.getRechargeCenter();
this.getAiAccountCheck();
this.getAiCalcSingle();
},
activated() {
if (this.$route.meta.refresh) {
......@@ -344,6 +358,8 @@ export default {
break;
case 5:
str = '欠费暂停';
case 6:
str = '手动暂停';
break;
}
return str;
......@@ -369,6 +385,12 @@ export default {
}
},
methods: {
async getAiCalcSingle() {
const { result } = await getAiCalcSingle();
if (!result) return;
this.isWhite = result.white;
},
create(scene, id) {
if (!this.canCreate) {
this.$confirm(`当前账户已无可用余额,请充值后再${id ? '复制' : '创建'}外呼任务`, '提示', {
......@@ -389,7 +411,7 @@ export default {
// 获取余额
async getRechargeCenter() {
const { result } = await rechargeCenter();
this.money = result.account.balance;
this.money = (result.account.balance || 0) / 100;
},
search() {
this.form.pageNum = 1;
......@@ -466,15 +488,15 @@ export default {
});
});
},
rebootTask(row) {
this.$confirm('重新开启任务后,将会对未外呼的客户进行外呼,是否确定重新开启营销活动?', '提示', {
confirmButtonText: '确定',
cancelBUttonText: '取消',
handleSuspend({ planId }) {
this.$confirm('任务正在进行中,暂停任务后,计划将中止', '提示', {
confirmButtonText: '暂停',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).then(_ => {
this.loading = true;
startActivityPlan({ planId: row.planId })
.then(res => {
suspendActivityPlan({ planId })
.then(_ => {
this.$message.success('操作成功');
this.getTableData();
})
......@@ -483,6 +505,51 @@ export default {
});
});
},
rebootTask(row) {
if (row.activityPlanStatus === 5) {
this.$confirm('重新开启任务后,将会对未外呼的客户进行外呼,是否确定重新开启营销活动?', '提示', {
confirmButtonText: '确定',
cancelBUttonText: '取消',
type: 'warning'
}).then(() => {
this.loading = true;
startActivityPlan({ planId: row.planId })
.then(res => {
this.$message.success('操作成功');
this.getTableData();
})
.finally(_ => {
this.loading = false;
});
});
} else if (row.activityPlanStatus === 6) {
if (this.money > row.fee || this.isWhite) {
this.$confirm(`本次外呼预计营销人数${row.peopleCount}人费用预计需要消费${row.fee}元,是否继续启动?`, '提示', {
confirmButtonText: '启动',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
this.loading = true;
continueActivityPlan({ planId: row.planId })
.then(res => {
this.$message.success('操作成功');
this.getTableData();
})
.finally(_ => {
this.loading = false;
});
});
} else {
this.$confirm(`任务外呼预计消费${row.fee},当前余额${this.money.toLocaleString()},请前往充值中心充值。`, '提示', {
confirmButtonText: '充值',
cancelButtonText: '取消',
type: 'warning'
}).then(_ => {
this.recharge();
});
}
}
},
editPlan(row) {
this.$router.push('/ai/edit/' + row.activityId);
}
......
......@@ -348,6 +348,7 @@ export default {
getUserData() {
getUserLogin().then(res => {
this.userData = res.result || {};
console.log(this.userData);
});
},
// 生成短连接
......
......@@ -154,7 +154,6 @@ import varDialog from './variables.vue';
import innerUrl from '@/components/innerUrl/innerUrl';
import linktoolspage from '@/components/linktools/linktoolspage.vue';
import integralChange from './module/integral-change';
import { enableAccessControl, confirmInfo, alertInfo } from '@/utils/auth.js';
export default {
name: 'add-record',
......@@ -204,11 +203,7 @@ export default {
created() {
this.listTemplateVariables();
},
mounted() {
if (enableAccessControl()) {
alertInfo();
}
},
watch: {
'info.urlType'(val) {
if (this.info.urlType === 1) {
......@@ -474,11 +469,7 @@ export default {
type: 'warning'
})
.then(() => {
if (enableAccessControl()) {
confirmInfo(this.updateTempAdvice);
} else {
this.updateTempAdvice();
}
this.updateTempAdvice();
})
.catch(err => {});
},
......
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