Commit b12fe7bd authored by liwenhong's avatar liwenhong

add:团长-优惠券模块

parent 5acc2c10
......@@ -250,8 +250,7 @@ exports.colonelAddApplyPoint = async ctx => {
//营销中心-活动列表
exports.yingxiaoList = async ctx => {
// const url = `${GOODS_URI}/marketing/background/yingxiaoList`;
const url = 'https://www.fastmock.site/mock/54a26f3382fe445fd8a48d4c6b4ed65f/login/chart';
const url = `${GOODS_URI}/marketing/background/yingxiao_list`;
const opts = {
url,
method: "POST",
......@@ -278,7 +277,33 @@ exports.toogleYingxiaoOnlineStatus = 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 = {
url,
method: "POST",
......
......@@ -81,3 +81,29 @@ exports.user_new = async (ctx, next) => {
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);
router.get(`${API_VERSION}/users/detail`, user.user_detail);
router.post(`${API_VERSION}/users/edit`, user.user_edit);
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/add_role`, role.getAdd_role)
......@@ -70,10 +75,8 @@ 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);
router.post(`${API_VERSION}/yingxiaoConfig`, goods.yingxiaoConfig);
router.post(`${API_VERSION}/yingxiaoSaveConfig`, goods.yingxiaoSaveConfig);
//生活号
......
......@@ -60,10 +60,51 @@
<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>
<el-button type="text" @click="handleConfig(scope.row)">活动配置</el-button>
</template>
</el-table-column>
</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>
</layout>
</template>
......@@ -74,7 +115,9 @@ import page from "@/components/Pagination"
import {
yingxiaoList,
addAmount,
toogleYingxiaoOnlineStatus
toogleYingxiaoOnlineStatus,
yingxiaoConfig,
yingxiaoSaveConfig
} from "@/service/Goods/goods";
// import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
......@@ -86,7 +129,17 @@ export default {
},
data () {
return {
rules: {
date: [
{ required: true, message: "时间不能为空", trigger: "blur" },
{ min: 0, max: 30, message: "长度在 0 到 30 个字符", trigger: "blur" }
],
},
activityList: [],
configForm: {
date: '',
result: []
},
anlysis: [{
title: '营销账户预算',
explain: '运营申请的用户业务增长的营销总预算',
......@@ -109,7 +162,13 @@ export default {
page: 1,
page_size: 20,
},
showConfigDialog: false,
listParams: {
marketing_id: '',
date: '',
type: 1,
config: []
}
}
},
created () {
......@@ -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下线
this.getMarketingActivityList()
if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success('操作成功');
})
},
async handleAddAmount(item) {
this.$prompt(`当前账户预算:${this.anlysisObj.total} \r 当前账户可用余额:${this.anlysisObj.balance}`, '充值', {
this.$prompt(`当前账户预算:${this.anlysisObj.total} \n 当前账户可用余额:${this.anlysisObj.balance}`, '充值', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
inputErrorMessage: '邮箱格式不正确'
inputLabel: '输入调整后的账户总预算',
inputPattern: /\d{1,5}/,
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);
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 {
justify-content: space-between;
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>
......@@ -2,76 +2,57 @@
<template>
<layout>
<div class="marketing">
<!-- 表头 -->
<div class="header">
<h2>账户信息</h2>
<el-button
>充值</el-button
>
</div>
<!-- 列表区 -->
<el-table class="goods_list" :data="goodsList" border stripe>
<el-table-column
label="商品id"
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-form :inline="true" :model="searchParams" class="demo-form-inline" @submit.prevent>
<el-form-item label="请输入手机号进行搜索">
<el-input
v-model="searchParams.phone"
placeholder="请输入手机号"
></el-input>
</el-form-item>
<el-form-item >
<el-button @click="handleSearch" type="primary">搜索</el-button>
</el-form-item>
</el-form>
<!-- 列表区 -->
<el-table class="goods_list" :data="goodsList" border stripe>
<el-table class="user_list" :data="userList" border stripe>
<el-table-column
label="活动名称"
prop="goods_spu_id"
label="用户昵称"
prop="user_nick"
align="center"
></el-table-column>
<el-table-column
label="已消耗"
prop="goods_name"
label="用户头像"
prop="user_avatar"
align="center"
></el-table-column>
<el-table-column
label="已占用"
prop="category_1_name"
align="center"
></el-table-column>
>
<template #default="scope">
<img :src="scope.row.user_avatar" width="50" height="50">
</template>
</el-table-column>
<el-table-column
label="状态"
prop="category_2_name"
label="用户手机号"
prop="phone"
align="center"
></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="handleConfig(scope.row)" type="text">配置优惠券</el-button>
</template>
</el-table-column>
</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>
</layout>
</template>
......@@ -80,8 +61,10 @@
import Layout from "../../Groupmeal/layout/index.vue";
import page from "@/components/Pagination"
import {
getList,
} from "@/service/Goods/goods";
getPhoneWechat,
couponGrant
} from "@/service/user";
// import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
export default {
name: "MarketingCenter",
......@@ -91,27 +74,39 @@ export default {
},
data () {
return {
goodsList: [],
params: {
page: 1,
page_size: 20
showConfigDialog: false,
checkList: [],
userList: [],
listParams: {
user_id: 1,
amount: 20
},
searchParams: {}
}
},
created () {
this.getCommodityList()
},
methods: {
async getCommodityList() {
try {
const res = await getList();
async handleSearch() {
const res = await getPhoneWechat({ phone: this.searchParams.phone });
if (res.code !== 0) return this.$message.error(res.reason);
this.goodsList = res.result.list;
} catch (error) {
console.error(error);
}
this.userList = res.result;
},
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>
......@@ -123,6 +118,11 @@ export default {
justify-content: space-between;
padding: 10px;
}
.user_list {
img {
border-radius: 50%;
}
}
}
</style>
......@@ -41,14 +41,7 @@
<el-table-column label="操作" align="center" fixed="right" width="200">
<!-- <el-button type="primary" size="small">审核</el-button> -->
<template #default="scope">
<el-popconfirm
: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="primary" size="mini" @click="apply(scope.row)">审核</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>
<!-- v-if="scope.row.take_place_status==1" -->
......@@ -215,8 +208,17 @@ export default {
if (res.code !== 0) return this.$message.error(res.reason);
else return this.$message.success('添加成功')
},
apply(name) {
this.applyPopTitle = `您确认通过(${name})的团长申请吗`
apply(item) {
// 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) {
let res = await colonelApplyPoint({colonel_apply_id: id});
......@@ -227,10 +229,6 @@ export default {
this.pointObj.take_place_pic && (this.fileList[0] = this.pointObj.take_place_pic)
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() {
try {
const res = await ColoneList(this.params);
......
......@@ -143,3 +143,15 @@ export async function addAmount (params) {
const res = await axios.post("/api/v1/addAmount", params);
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) {
return await axios(opts);
// 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) {
// 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