Commit b12fe7bd authored by liwenhong's avatar liwenhong

add:团长-优惠券模块

parent 5acc2c10
...@@ -250,8 +250,7 @@ exports.colonelAddApplyPoint = async ctx => { ...@@ -250,8 +250,7 @@ exports.colonelAddApplyPoint = async ctx => {
//营销中心-活动列表 //营销中心-活动列表
exports.yingxiaoList = async ctx => { exports.yingxiaoList = async ctx => {
// const url = `${GOODS_URI}/marketing/background/yingxiaoList`; const url = `${GOODS_URI}/marketing/background/yingxiao_list`;
const url = 'https://www.fastmock.site/mock/54a26f3382fe445fd8a48d4c6b4ed65f/login/chart';
const opts = { const opts = {
url, url,
method: "POST", method: "POST",
...@@ -278,7 +277,33 @@ exports.toogleYingxiaoOnlineStatus = async ctx => { ...@@ -278,7 +277,33 @@ exports.toogleYingxiaoOnlineStatus = async ctx => {
//营销中心-充值 //营销中心-充值
exports.addAmount = async ctx => { exports.addAmount = async ctx => {
const url = `${GOODS_URI}/marketing/background/add_amount`; const url = `${GOODS_URI}/coupon/background/add_amount`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
const res = await req(ctx, opts);
ctx.body = res;
};
//营销中心-查看活动配置
exports.yingxiaoConfig = async ctx => {
const url = `${GOODS_URI}/marketing/background/yingxiao_config`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
const res = await req(ctx, opts);
ctx.body = res;
};
//营销中心-修改活动配置
exports.yingxiaoSaveConfig = async ctx => {
const url = `${GOODS_URI}/marketing/background/yingxiao_save_config`;
const opts = { const opts = {
url, url,
method: "POST", method: "POST",
......
...@@ -81,3 +81,29 @@ exports.user_new = async (ctx, next) => { ...@@ -81,3 +81,29 @@ exports.user_new = async (ctx, next) => {
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
}; };
//通过手机号获取小程序用户信息
exports.getPhoneWechat = async (ctx, next) => {
const url = `${API_INTERNAL_URI}/user/background/get_phone_wechat`;
const opts = {
url: url,
method: "POST",
json: true,
body: ctx.request.body,
};
ctx.body = await req(ctx, opts);
};
// 配置优惠券
exports.couponGrant = async (ctx, next) => {
const url = `${API_INTERNAL_URI}/coupon/background/grant`;
const opts = {
url: url,
method: "POST",
json: true,
body: ctx.request.body,
};
ctx.body = await req(ctx, opts);
};
...@@ -25,6 +25,11 @@ router.get(`${API_VERSION}/users`, user.user_list); ...@@ -25,6 +25,11 @@ router.get(`${API_VERSION}/users`, user.user_list);
router.get(`${API_VERSION}/users/detail`, user.user_detail); router.get(`${API_VERSION}/users/detail`, user.user_detail);
router.post(`${API_VERSION}/users/edit`, user.user_edit); router.post(`${API_VERSION}/users/edit`, user.user_edit);
router.post(`${API_VERSION}/users/new`, user.user_new); router.post(`${API_VERSION}/users/new`, user.user_new);
router.post(`${API_VERSION}/users/getPhoneWechat`, user.getPhoneWechat);
router.post(`${API_VERSION}/users/couponGrant`, user.couponGrant);
router.post(`${API_VERSION}/merchant/authority/role_list`, role.getRole_list) router.post(`${API_VERSION}/merchant/authority/role_list`, role.getRole_list)
router.post(`${API_VERSION}/merchant/authority/add_role`, role.getAdd_role) router.post(`${API_VERSION}/merchant/authority/add_role`, role.getAdd_role)
...@@ -70,10 +75,8 @@ router.post(`${API_VERSION}/colonelAddApplyPoint`, goods.colonelAddApplyPoint) ...@@ -70,10 +75,8 @@ router.post(`${API_VERSION}/colonelAddApplyPoint`, goods.colonelAddApplyPoint)
router.post(`${API_VERSION}/yingxiaoList`, goods.yingxiaoList); router.post(`${API_VERSION}/yingxiaoList`, goods.yingxiaoList);
router.post(`${API_VERSION}/addAmount`, goods.addAmount); router.post(`${API_VERSION}/addAmount`, goods.addAmount);
router.post(`${API_VERSION}/toogleYingxiaoOnlineStatus`, goods.toogleYingxiaoOnlineStatus); router.post(`${API_VERSION}/toogleYingxiaoOnlineStatus`, goods.toogleYingxiaoOnlineStatus);
router.post(`${API_VERSION}/yingxiaoConfig`, goods.yingxiaoConfig);
router.post(`${API_VERSION}/yingxiaoSaveConfig`, goods.yingxiaoSaveConfig);
//生活号 //生活号
......
...@@ -60,10 +60,51 @@ ...@@ -60,10 +60,51 @@
<el-button @click.stop="handleAddAmount(scope.row)" type="text">充值</el-button> <el-button @click.stop="handleAddAmount(scope.row)" type="text">充值</el-button>
<!-- <el-button>预算分配</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" @click="handleActivityOnline(scope.row)">{{scope.row.online_status==1?'活动下线':'活动上线'}}</el-button>
<el-button type="text">活动配置</el-button> <el-button type="text" @click="handleConfig(scope.row)">活动配置</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog
title="活动配置-团长分销"
v-model="showConfigDialog"
width="50%"
top="2%"
center
>
<el-form :model="configForm" :rules="rules">
<el-form-item label="设置时间:">
<el-date-picker
v-model="configForm.date"
type="datetime"
@change="expirDateChange"
placeholder="请设置时间"
>
</el-date-picker>
</el-form-item>
<el-form-item
class="config"
v-for="(config, index) in configForm.result"
:key="config.key"
:rules="{
required: true, message: '不能为空', trigger: 'blur'
}"
>
<h4>档位{{index + 1}}</h4>
<div class="form-item"><span>设置考核单量: </span><el-input size="mini" v-model="config.assess_order_num"></el-input></div>
<div class="form-item"><span>设置奖励金额: </span><el-input size="mini" v-model="config.reward_amount"></el-input><el-icon class="el-icon-delete" @click.prevent="removeDomain(config)"><delete /></el-icon></div>
</el-form-item>
<el-form-item>
<el-button @click="addDomain">新增档位</el-button>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showConfigDialog = false">取 消</el-button>
<el-button type="primary" @click="handleSaveConfig">确认</el-button>
</span>
</template>
</el-dialog>
</div> </div>
</layout> </layout>
</template> </template>
...@@ -74,7 +115,9 @@ import page from "@/components/Pagination" ...@@ -74,7 +115,9 @@ import page from "@/components/Pagination"
import { import {
yingxiaoList, yingxiaoList,
addAmount, addAmount,
toogleYingxiaoOnlineStatus toogleYingxiaoOnlineStatus,
yingxiaoConfig,
yingxiaoSaveConfig
} from "@/service/Goods/goods"; } from "@/service/Goods/goods";
// import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no"; // import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
...@@ -86,7 +129,17 @@ export default { ...@@ -86,7 +129,17 @@ export default {
}, },
data () { data () {
return { return {
rules: {
date: [
{ required: true, message: "时间不能为空", trigger: "blur" },
{ min: 0, max: 30, message: "长度在 0 到 30 个字符", trigger: "blur" }
],
},
activityList: [], activityList: [],
configForm: {
date: '',
result: []
},
anlysis: [{ anlysis: [{
title: '营销账户预算', title: '营销账户预算',
explain: '运营申请的用户业务增长的营销总预算', explain: '运营申请的用户业务增长的营销总预算',
...@@ -109,7 +162,13 @@ export default { ...@@ -109,7 +162,13 @@ export default {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
showConfigDialog: false,
listParams: {
marketing_id: '',
date: '',
type: 1,
config: []
}
} }
}, },
created () { created () {
...@@ -136,18 +195,50 @@ export default { ...@@ -136,18 +195,50 @@ export default {
let res = await toogleYingxiaoOnlineStatus({marketing_id: item.marketing_id, online_status: item.online_status == 1?2:1}) //1上线 2下线 let res = await toogleYingxiaoOnlineStatus({marketing_id: item.marketing_id, online_status: item.online_status == 1?2:1}) //1上线 2下线
this.getMarketingActivityList() this.getMarketingActivityList()
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success('操作成功');
}) })
}, },
async handleAddAmount(item) { async handleAddAmount(item) {
this.$prompt(`当前账户预算:${this.anlysisObj.total} \r 当前账户可用余额:${this.anlysisObj.balance}`, '充值', { this.$prompt(`当前账户预算:${this.anlysisObj.total} \n 当前账户可用余额:${this.anlysisObj.balance}`, '充值', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/, inputLabel: '输入调整后的账户总预算',
inputErrorMessage: '邮箱格式不正确' inputPattern: /\d{1,5}/,
inputErrorMessage: '格式不正确'
}).then(async ({ value }) => { }).then(async ({ value }) => {
let res = await addAmount({capital_pool_id: item.capital_pool_id, amount: value}) let res = await addAmount({capital_pool_id: item.capital_pool_id, amount: value})
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success('充值成功');
}) })
},
async handleConfig(item) {
this.listParams.marketing_id = item.marketing_id;
let res = await yingxiaoConfig({date: new Date()})
if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success('操作成功');
this.configForm = {result: res.result.list, date: res.result.date};
console.log('this.configForm',this.configForm)
this.showConfigDialog = true
},
removeDomain(item) {
var index = this.configForm.result.indexOf(item)
if (index !== -1) {
this.configForm.result.splice(index, 1)
}
},
addDomain() {
this.configForm.result.push({
value: '',
key: Date.now()
});
},
async handleSaveConfig() {
this.listParams.config = this.configForm.result;
this.listParams.date = this.configForm.date;
let res = await yingxiaoSaveConfig(this.listParams)
if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success('设置成功');
this.showConfigDialog = false
} }
} }
} }
...@@ -160,6 +251,28 @@ export default { ...@@ -160,6 +251,28 @@ export default {
justify-content: space-between; justify-content: space-between;
padding: 10px; padding: 10px;
} }
.config {
position: relative;
.form-item {
width: 50%;
span {
display: flex;
}
.el-input {
width: 100%;
}
.el-icon-delete {
position: absolute;
right: 10px;
top: 20px;
display: inline-block;
vertical-align: middle;
color: #f00;
margin: 0 10px;
line-height: 40px;
cursor: pointer;
}
}
}
} }
</style> </style>
...@@ -2,76 +2,57 @@ ...@@ -2,76 +2,57 @@
<template> <template>
<layout> <layout>
<div class="marketing"> <div class="marketing">
<!-- 表头 --> <el-form :inline="true" :model="searchParams" class="demo-form-inline" @submit.prevent>
<div class="header"> <el-form-item label="请输入手机号进行搜索">
<h2>账户信息</h2> <el-input
<el-button v-model="searchParams.phone"
>充值</el-button placeholder="请输入手机号"
> ></el-input>
</div> </el-form-item>
<!-- 列表区 --> <el-form-item >
<el-table class="goods_list" :data="goodsList" border stripe> <el-button @click="handleSearch" type="primary">搜索</el-button>
<el-table-column </el-form-item>
label="商品id" </el-form>
prop="goods_spu_id"
align="center"
></el-table-column>
<el-table-column
label="商品名称"
prop="goods_name"
align="center"
></el-table-column>
<el-table-column
label="一级分类"
prop="category_1_name"
align="center"
></el-table-column>
</el-table>
</div>
<div class="marketing">
<!-- 表头 -->
<div class="header">
<h2>活动列表</h2>
</div>
<!-- 列表区 --> <!-- 列表区 -->
<el-table class="goods_list" :data="goodsList" border stripe> <el-table class="user_list" :data="userList" border stripe>
<el-table-column <el-table-column
label="活动名称" label="用户昵称"
prop="goods_spu_id" prop="user_nick"
align="center" align="center"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
label="已消耗" label="用户头像"
prop="goods_name" prop="user_avatar"
align="center" align="center"
></el-table-column> >
<el-table-column <template #default="scope">
label="已占用" <img :src="scope.row.user_avatar" width="50" height="50">
prop="category_1_name" </template>
align="center" </el-table-column>
></el-table-column>
<el-table-column <el-table-column
label="状态" label="用户手机号"
prop="category_2_name" prop="phone"
align="center" align="center"
></el-table-column> ></el-table-column>
<!-- 操作快捷键 -->
<el-table-column label="操作" align="center" fixed="right" width="200"> <el-table-column label="操作" align="center" fixed="right" width="200">
<template> <template #default="scope">
<el-button <el-button @click="handleConfig(scope.row)" type="text">配置优惠券</el-button>
>预算分配</el-button
>
<el-button
>活动下线</el-button
>
<el-button
>活动配置</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog
title="配置优惠券"
v-model="showConfigDialog"
width="50%"
top="20%"
>
请选择优惠券: <el-check-tag @change="chooseCoupon(index)" v-for="(item, index) in 4" :key="index" checked style="margin-right: 8px;">{{index + 1}}元</el-check-tag>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="comCouponSave">确认</el-button>
</span>
</template>
</el-dialog>
</div> </div>
</layout> </layout>
</template> </template>
...@@ -80,8 +61,10 @@ ...@@ -80,8 +61,10 @@
import Layout from "../../Groupmeal/layout/index.vue"; import Layout from "../../Groupmeal/layout/index.vue";
import page from "@/components/Pagination" import page from "@/components/Pagination"
import { import {
getList, getPhoneWechat,
} from "@/service/Goods/goods"; couponGrant
} from "@/service/user";
// import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no"; // import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
export default { export default {
name: "MarketingCenter", name: "MarketingCenter",
...@@ -91,27 +74,39 @@ export default { ...@@ -91,27 +74,39 @@ export default {
}, },
data () { data () {
return { return {
goodsList: [], showConfigDialog: false,
params: { checkList: [],
page: 1, userList: [],
page_size: 20 listParams: {
user_id: 1,
amount: 20
}, },
searchParams: {}
} }
}, },
created () { created () {
this.getCommodityList()
}, },
methods: { methods: {
async getCommodityList() { async handleSearch() {
try { const res = await getPhoneWechat({ phone: this.searchParams.phone });
const res = await getList();
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
this.goodsList = res.result.list; this.userList = res.result;
} catch (error) {
console.error(error); },
} handleConfig(item) {
this.listParams.user_id = item.user_id;
this.showConfigDialog = true
}, },
chooseCoupon(index) {
this.listParams.amount = index +1;
},
async comCouponSave() {
const res = await couponGrant(this.listParams);
if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success('选择成功');
}
} }
} }
</script> </script>
...@@ -123,6 +118,11 @@ export default { ...@@ -123,6 +118,11 @@ export default {
justify-content: space-between; justify-content: space-between;
padding: 10px; padding: 10px;
} }
.user_list {
img {
border-radius: 50%;
}
}
} }
</style> </style>
...@@ -41,14 +41,7 @@ ...@@ -41,14 +41,7 @@
<el-table-column label="操作" align="center" fixed="right" width="200"> <el-table-column label="操作" align="center" fixed="right" width="200">
<!-- <el-button type="primary" size="small">审核</el-button> --> <!-- <el-button type="primary" size="small">审核</el-button> -->
<template #default="scope"> <template #default="scope">
<el-popconfirm <el-button type="primary" size="mini" @click="apply(scope.row)">审核</el-button>
:title="applyPopTitle"
@confirm="handleApply(scope.row.colonel_apply_id, scope.row.audit_status)"
>
<template #reference>
<el-button type="primary" size="mini" @click="apply(scope.row.contact_name)">审核</el-button>
</template>
</el-popconfirm>
<el-button type="text" size="small">通过</el-button> <el-button type="text" size="small">通过</el-button>
<el-button type="primary" size="small" @click="addPoint(scope.row.colonel_apply_id)">添加自提点</el-button> <el-button type="primary" size="small" @click="addPoint(scope.row.colonel_apply_id)">添加自提点</el-button>
<!-- v-if="scope.row.take_place_status==1" --> <!-- v-if="scope.row.take_place_status==1" -->
...@@ -215,8 +208,17 @@ export default { ...@@ -215,8 +208,17 @@ export default {
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
else return this.$message.success('添加成功') else return this.$message.success('添加成功')
}, },
apply(name) { apply(item) {
this.applyPopTitle = `您确认通过(${name})的团长申请吗` // this.applyPopTitle = `您确认通过(${name})的团长申请吗`
this.$confirm(`您确认通过(${item.contact_name})的团长申请吗`, '团长审核', {
confirmButtonText: '确定',
cancelButtonText: '取消',
center: true
}).then(async () => {
let res = await colonelAudit({colonel_apply_id: item.colonel_apply_id, audit_status: item.audit_status})
if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success('操作成功');
})
}, },
async addPoint(id) { async addPoint(id) {
let res = await colonelApplyPoint({colonel_apply_id: id}); let res = await colonelApplyPoint({colonel_apply_id: id});
...@@ -227,10 +229,6 @@ export default { ...@@ -227,10 +229,6 @@ export default {
this.pointObj.take_place_pic && (this.fileList[0] = this.pointObj.take_place_pic) this.pointObj.take_place_pic && (this.fileList[0] = this.pointObj.take_place_pic)
this.showAddPointDialog = true; this.showAddPointDialog = true;
}, },
async handleApply(id, status) {
let res = await colonelAudit({colonel_apply_id: id, audit_status: status})
if (res.code !== 0) return this.$message.error(res.reason);
},
async getColoneList() { async getColoneList() {
try { try {
const res = await ColoneList(this.params); const res = await ColoneList(this.params);
......
...@@ -143,3 +143,15 @@ export async function addAmount (params) { ...@@ -143,3 +143,15 @@ export async function addAmount (params) {
const res = await axios.post("/api/v1/addAmount", params); const res = await axios.post("/api/v1/addAmount", params);
return res; return res;
} }
// 营销中心-查看活动配置
export async function yingxiaoConfig (params) {
const res = await axios.post("/api/v1/yingxiaoConfig", params);
return res;
}
// 营销中心-修改活动配置
export async function yingxiaoSaveConfig (params) {
const res = await axios.post("/api/v1/yingxiaoSaveConfig", params);
return res;
}
...@@ -53,6 +53,20 @@ export async function createUser (data, appid) { ...@@ -53,6 +53,20 @@ export async function createUser (data, appid) {
return await axios(opts); return await axios(opts);
// return await axios.post("/api/v1/users/new", data); // return await axios.post("/api/v1/users/new", data);
} }
//通过手机号获取小程序用户信息
export async function getPhoneWechat (params) {
return await axios.post("/api/v1/users/getPhoneWechat", params);
}
// 配置优惠券
export async function couponGrant (params) {
return await axios.post("/api/v1/users/couponGrant", params);
}
//用户详情 //用户详情
// export async function getUser_detail (user_id) { // export async function getUser_detail (user_id) {
// const res = await axios.post(`/api/v1/merchant/authority/get_user_info`, { // const res = await axios.post(`/api/v1/merchant/authority/get_user_info`, {
......
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