Commit 5acc2c10 authored by liwenhong's avatar liwenhong

add

parent fab26efb
......@@ -248,9 +248,37 @@ exports.colonelAddApplyPoint = async ctx => {
ctx.body = res;
};
//营销中心-活动列表
exports.yingxiaoList = async ctx => {
const url = `${GOODS_URI}/marketing/background/yingxiao_list`;
// const url = `${GOODS_URI}/marketing/background/yingxiaoList`;
const url = 'https://www.fastmock.site/mock/54a26f3382fe445fd8a48d4c6b4ed65f/login/chart';
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
const res = await req(ctx, opts);
ctx.body = res;
};
//营销中心-活动列表
exports.toogleYingxiaoOnlineStatus = async ctx => {
const url = `${GOODS_URI}/marketing/background/toogle_yingxiao_online_status`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
const res = await req(ctx, opts);
ctx.body = res;
};
//营销中心-充值
exports.addAmount = async ctx => {
const url = `${GOODS_URI}/marketing/background/add_amount`;
const opts = {
url,
method: "POST",
......@@ -260,3 +288,5 @@ exports.yingxiaoList = async ctx => {
const res = await req(ctx, opts);
ctx.body = res;
};
......@@ -68,6 +68,8 @@ router.post(`${API_VERSION}/colonelAudit`, goods.colonelAudit)
router.post(`${API_VERSION}/colonelApplyPoint`, goods.colonelApplyPoint)
router.post(`${API_VERSION}/colonelAddApplyPoint`, goods.colonelAddApplyPoint)
router.post(`${API_VERSION}/yingxiaoList`, goods.yingxiaoList);
router.post(`${API_VERSION}/addAmount`, goods.addAmount);
router.post(`${API_VERSION}/toogleYingxiaoOnlineStatus`, goods.toogleYingxiaoOnlineStatus);
......
......@@ -5,25 +5,19 @@
<!-- 表头 -->
<div class="header">
<h2>账户信息</h2>
<el-button
>充值</el-button
>
</div>
<!-- 列表区 -->
<el-table class="goods_list" :data="activityList" border stripe :tab-position="left">
<el-table class="goods_list" :data="anlysis" border stripe>
<el-table-column
label="商品id"
prop="goods_spu_id"
prop="title"
align="center"
></el-table-column>
<el-table-column
label="商品名称"
prop="goods_name"
prop="total"
align="center"
></el-table-column>
<el-table-column
label="一级分类"
prop="category_1_name"
prop="explain"
align="center"
></el-table-column>
</el-table>
......@@ -62,18 +56,11 @@
></el-table-column>
<!-- 操作快捷键 -->
<el-table-column label="操作" align="center" fixed="right" width="200">
<template>
<el-button
>预算分配</el-button
>
<el-button
>活动下线</el-button
>
<el-button
>活动配置</el-button
>
<template #default="scope">
<el-button @click.stop="handleAddAmount(scope.row)" type="text">充值</el-button>
<!-- <el-button>预算分配</el-button> -->
<el-button type="text" @click="handleActivityOnline(scope.row)">{{scope.row.online_status==1?'活动下线':'活动上线'}}</el-button>
<el-button type="text">活动配置</el-button>
</template>
</el-table-column>
</el-table>
......@@ -86,6 +73,8 @@ import Layout from "../../Groupmeal/layout/index.vue";
import page from "@/components/Pagination"
import {
yingxiaoList,
addAmount,
toogleYingxiaoOnlineStatus
} from "@/service/Goods/goods";
// import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
......@@ -98,9 +87,27 @@ export default {
data () {
return {
activityList: [],
anlysis: [{
title: '营销账户预算',
explain: '运营申请的用户业务增长的营销总预算',
total: ''
},{
title: '已消耗(T+1更新)',
explain: '目前已经确认消耗的营销预算',
total: ''
},{
title: '已占用(每10分钟更新)',
explain: '分享裂变活动中派发出的有效优惠券的总额',
total: ''
},{
title: '可用余额',
explain: '目前平台可使用的余额',
total: ''
}],
anlysisObj: {},
params: {
page: 1,
page_size: 20
page_size: 20,
},
}
......@@ -110,14 +117,38 @@ export default {
},
methods: {
async getMarketingActivityList() {
try {
const res = await yingxiaoList();
if (res.code !== 0) return this.$message.error(res.reason);
this.activityList = res.result.list;
} catch (error) {
console.error(error);
this.anlysisObj = res.result.anlysis;
let list = [];
for(let k in this.anlysisObj) {
list.push(this.anlysisObj[k])
}
this.anlysis.map((item, index) => item.total = list[index])
},
handleActivityOnline(item) {
this.$confirm(`您确定要${item.online_status == 1?'下线':'上线'}${item.marketing_name}吗`, `活动${item.online_status == 1?'下线':'上线'}`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
center: true
}).then(async () => {
let res = await toogleYingxiaoOnlineStatus({marketing_id: item.marketing_id, online_status: item.online_status == 1?2:1}) //1上线 2下线
this.getMarketingActivityList()
if (res.code !== 0) return this.$message.error(res.reason);
})
},
async handleAddAmount(item) {
this.$prompt(`当前账户预算:${this.anlysisObj.total} \r 当前账户可用余额:${this.anlysisObj.balance}`, '充值', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
inputErrorMessage: '邮箱格式不正确'
}).then(async ({ value }) => {
let res = await addAmount({capital_pool_id: item.capital_pool_id, amount: value})
if (res.code !== 0) return this.$message.error(res.reason);
})
}
}
}
</script>
......
......@@ -131,3 +131,15 @@ export async function yingxiaoList (params) {
const res = await axios.post("/api/v1/yingxiaoList", params);
return res;
}
// 营销中心-活动下线
export async function toogleYingxiaoOnlineStatus (params) {
const res = await axios.post("/api/v1/toogleYingxiaoOnlineStatus", params);
return res;
}
// 营销中心-充值
export async function addAmount (params) {
const res = await axios.post("/api/v1/addAmount", params);
return res;
}
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