Commit b09f2bb6 authored by lihui's avatar lihui

feat: mearge lihui+chenglong

parents 23651259 d69677f3
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -17,6 +17,7 @@
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"dayjs": "^1.10.6",
"element-plus": "^1.0.2-beta.44",
"form-data": "^4.0.0",
"json-bigint": "^1.0.0",
......
......@@ -3,32 +3,79 @@ const req = require("../utils/request").httpReq;
// 获取商家列表
exports.getBusinessList = async ctx => {
const url = `${ACTIVITY_URI}/goods/background/ota_list`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
const url = `${ACTIVITY_URI}/goods/background/ota_list`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
};
// 添加商品
exports.addGoods = async ctx => {
const url = `${ACTIVITY_URI}/goods/background/add_goods`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
const url = `${ACTIVITY_URI}/goods/background/add_goods`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
};
// 商品库列表
exports.pindanGoods = async ctx => {
const url = `${ACTIVITY_URI}/goods/background/pindan_goods`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
};
\ No newline at end of file
const url = `${ACTIVITY_URI}/goods/background/pindan_goods`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
};
// 获取活动过列表
exports.getActivityList = async ctx => {
const url = `${ACTIVITY_URI}/marketing/background/marketing_list`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
};
// 修改商品
exports.editGoodsDetail = async ctx => {
const url = `${ACTIVITY_URI}/goods/background/edit_goods`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
};
// 关闭/开启 活动
exports.updateActivity = async ctx => {
const url = `${ACTIVITY_URI}/marketing/background/update_marketing`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
console.log(ctx.body);
};
// 查看活动订单
exports.checkActivityDetail = async ctx => {
const url = `${ACTIVITY_URI}/marketing/background/marketing_info`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
};
......@@ -62,6 +62,11 @@ router.post(`${API_VERSION}/merchant/lifeinner/life_info`, life.get_life_info)
router.get(`${API_VERSION}/merchant/lifeinner/life_list`, life.get_life_list)
//用户
router.post(`${API_VERSION}/merchant/authority/get_user_info`, user.getUser_detail)
// 后台运营管理
router.get(`${API_VERSION}/marketing/background/marketing_list`, activity.getActivityList)
router.post(`${API_VERSION}/goods/background/edit_goods`, activity.editGoodsDetail)
router.post(`${API_VERSION}/marketing/background/update_marketing`, activity.updateActivity)
router.post(`${API_VERSION}/marketing/background/marketing_info`, activity.checkActivityDetail)
//活动管理
router.get(`${API_VERSION}/goods/background/ota_list`, activity.getBusinessList);
......
<template>
<div>
<div class="app-wrapper">
<router-view v-slot="{ Component }">
<keep-alive v-if="$route.meta.keepAlive">
<component :is="Component"> </component>
......@@ -10,24 +10,27 @@
</template>
<script>
import { fetchCurrentUser } from './service/user';
import { redirectToLogin } from './utils/util';
import { fetchCurrentUser } from "./service/user";
import { redirectToLogin } from "./utils/util";
export default {
async mounted () {
console.log("master debug 2 !!!!!!")
if (this.$store.state.permissions && this.$store.state.userInfo) return
async mounted() {
console.log("master debug 2 !!!!!!");
if (this.$store.state.permissions && this.$store.state.userInfo) return;
const { status, user } = await fetchCurrentUser();
if (status === 'success') {
this.$store.commit('updateUserInfo', user);
this.$store.dispatch('updateUserPermission', { email: user.email })
if (status === "success") {
this.$store.commit("updateUserInfo", user);
this.$store.dispatch("updateUserPermission", { email: user.email });
} else {
redirectToLogin();
}
},
}
};
</script>
<style lang="less" src="./global.less"></style>
<style lang="less" scoped>
.app-wrapper {
height: 100%;
}
</style>
<template>
<div class="wrapper">
<div
class="wrapper"
v-loading="pageLoading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<div class="activityDetail">
<header class="header">
<div class="my-header">
<h3>
本周六四月三日 洞鞋子 周日就可以常抓这是给 请仔细阅读下面的文字
关注中澳提示
</h3>
<p class="endTime">距结束 22:77:88</p>
</header>
</div>
<section class="content">
<el-card class="activityGoods box-card">
<p class="title">拼单商品</p>
<div>
<el-image class="activityImage"
<el-image
class="activityImage"
style="width: 100px; height: 100px"
:src="url"
:fit="fit"
fit="fit"
></el-image>
<el-image class="activityImage"
<el-image
class="activityImage"
style="width: 100px; height: 100px"
:src="url"
:fit="fit"
fit="fit"
></el-image>
</div>
</el-card>
......@@ -31,25 +39,31 @@
布拉布拉这是一大片介绍信息 布拉布拉这是一大片介绍信息
布拉布拉这是一大片介绍信息 布拉布拉这是一大片介绍信息 布拉布拉
</p>
<el-image class="activityImage"
style="width: 500px; height: 400px"
:src="url"
:fit="fit"
></el-image>
<el-image
class="activityImage"
style="width: 500px; height: 400px"
:src="url"
fit="fit"
></el-image>
</el-card>
<el-card class="activities box-card">
<div v-for="(item,index) in activityDetailList" :key="index" class="activityItem">
<el-image class="activityImage"
<div
v-for="(item, index) in activityDetailList"
:key="index"
class="activityItem"
>
<el-image
class="activityImage"
style="width: 100px; height: 100px"
:src="url"
:fit="fit"
fit="fit"
></el-image>
<div class="itemIntroduce">
<p>f发布写干洗 戏内除菌 消毒 数遍洗干净</p>
<p>
<span>$99</span>
<span>$999</span>
</p>
<p>f发布写干洗 戏内除菌 消毒 数遍洗干净</p>
<p>
<span>$99</span>
<span>$999</span>
</p>
</div>
<div>
<div class="detail"></div>
......@@ -63,21 +77,43 @@
</template>
<script>
import ActivityService from "@/service/Activity/index";
import { ElMessage } from "element-plus";
export default {
components: {},
props: {},
data() {
return {
fits: ["fill", "contain", "cover", "none", "scale-down"], // 图片属性
url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
activityDetailList:[1,2,3]
pageLoading: false,
activityDetailInfo: {},
url:
"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
activityDetailList: [1, 2, 3]
};
},
watch: {},
computed: {},
methods: {},
created() {},
mounted() {},
methods: {
async checkActivityDetail() {
try {
this.pageLoading = true;
let data = await ActivityService.checkActivityDetail({
marketing_id: this.$route.query.marketing_id,
marketing_type: this.$route.query.marketing_type
});
console.log(data.result);
this.pageLoading = false;
} catch {
this.pageLoading = false;
ElMessage.error("加载失败");
}
}
},
created() {
this.checkActivityDetail();
},
mounted() {}
};
</script>
<style lang="less" scoped>
......@@ -87,47 +123,44 @@ export default {
padding: 45px 10px 0;
.activityDetail {
width: 500px;
.header {
.my-header {
.endTime {
margin: 5px 0;
font-size: 15px;
color: red;
}
}
.content{
.box-card{
margin: 10px 0;
}
.activityGoods{
.title{
}
.activityImage{
margin: 10px 10px 0 0;
}
.content {
.box-card {
margin: 10px 0;
}
.activityGoods {
.activityImage {
margin: 10px 10px 0 0;
}
.activityIntroduce{
padding: 5px 0;
.introduceText{
margin-bottom: 20px;
}
}
.activityIntroduce {
padding: 5px 0;
.introduceText {
margin-bottom: 20px;
}
.activities{
.activityItem{
display: flex;
margin:15px 0;
.itemIntroduce{
display: flex;
flex-direction: column;
justify-content: space-around;
margin-left: 10px;
>p{
width: 200px;
}
}
}
.activities {
.activityItem {
display: flex;
margin: 15px 0;
.itemIntroduce {
display: flex;
flex-direction: column;
justify-content: space-around;
margin-left: 10px;
> p {
width: 200px;
}
}
}
}
}
}
}
</style>
\ No newline at end of file
</style>
<template>
<div>
<el-card class="header">
<el-form ref="form" :model="activity" inline label-width="80px">
<div
class="manage-wrapper"
v-loading="tableLoading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<el-form
ref="form"
:model="activity"
inline
label-width="80px"
class="form-wrapper"
>
<!-- 表单控件 -->
<div class="formitem-wrapper">
<el-form-item label="活动名称">
<el-input v-model="activity.activityName"></el-input>
</el-form-item>
......@@ -16,11 +29,18 @@
</el-select>
</el-form-item>
<el-form-item style="margin-left: 50px">
<el-button type="primary">搜索</el-button>
<el-button type="primary" @click="getActivityList">搜索</el-button>
</el-form-item>
<el-button type="primary" @click="goReleaseProduc">发布拼单</el-button>
<!-- 列表 -->
<el-table :data="manageList" border style="width: 100%">
<el-form-item>
<el-button type="primary" @click="goReleaseProduc"
>发布拼单</el-button
>
</el-form-item>
</div>
<!-- 列表 -->
<div class="table-wrapper">
<el-table :data="tableActivityList" border style="width: 100%">
<el-table-column
align="center"
prop="activiteId"
......@@ -32,9 +52,18 @@
align="center"
prop="activiteHead"
label="活动标题"
@header-click="handleHeadline"
width="width"
>
<template #default="scope">
<div @click="handleHeadline(scope.row)" class="activityTitle">
<div>
{{ scope.row.activiteHead }}
</div>
<div class="activityPrice">
{{ ` ¥ ${scope.row.minPrice}~¥${scope.row.maxPrice} ` }}
</div>
</div>
</template>
</el-table-column>
<el-table-column
align="center"
......@@ -42,17 +71,6 @@
label="活动状态"
width="width"
>
<template #default="scope">
<span>
{{
scope.row.online_status == 2
? "进行中"
: scope.row.online_status == 1
? "未开始"
: "已结束"
}}
</span>
</template>
</el-table-column>
<el-table-column
align="center"
......@@ -96,91 +114,270 @@
width="width"
>
</el-table-column>
<el-table-column align="center" prop="prop" label="操作" width="250">
<el-table-column align="center" prop="scope" label="操作" width="250">
<template #default="scope">
<div class="button-one">
<el-button
type="primary"
size="small"
@click="handleModify(scope.row)"
>修改</el-button
>
<el-popconfirm
title="确定要结束本次拼单吗?"
@confirm="updateActivity"
>
<template #reference>
<el-button
v-show="scope.row.status === 1"
type="primary"
size="small"
@click="handleEnd(scope.row)"
>结束</el-button
>
</template>
</el-popconfirm>
<el-popconfirm
title="确定要开启本次拼单吗?"
@confirm="updateActivity"
>
<template #reference>
<el-button
v-show="scope.row.status === 2 || scope.row.status === 3"
type="primary"
size="small"
@click="handleStart(scope.row)"
>开始</el-button
>
</template>
</el-popconfirm>
</div>
<el-button
type="primary"
size="small"
@click="handleModify(scope.row)"
>修改</el-button>
<el-popconfirm title="确定要结束本次拼单吗?">
<template #reference>
<el-button
type="primary"
size="small"
@click="handleEnd(scope.row)"
>结束</el-button>
</template>
</el-popconfirm>
<el-popconfirm title="确定要开启本次拼单吗?">
<template #reference>
<el-button
type="primary"
size="small"
@click="handleStart(scope.row)"
>开始</el-button>
</template>
</el-popconfirm>
<el-button
class="checkButton"
type="primary"
size="small"
@click="handleLook(scope.row)"
>查看订单</el-button>
>查看订单</el-button
>
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
</div>
<!-- 分页 -->
<div class="pagination-wrapper">
<el-pagination
background
layout="prev, pager, next"
:total="pageCount"
:page-size="10"
@current-change="handleCurrentChange"
>
</el-pagination>
</div>
</el-form>
</div>
</template>
<script>
import { ElMessage } from "element-plus";
import ActivityService from "@/service/Activity/index";
import dayJs from "dayjs";
export default {
name: "Manage",
data() {
return {
activity: {
activityName: "",
online_status: [],
online_status: ""
},
manageList: [
{
activiteId: "413315",
activiteHead: "生活圈7月29午饭",
activiteStatus: "进行中",
orderNumber: "345",
soldGoods: "",
pay: "",
discounts: "",
refund: "",
realized: "4000",
},
],
pageCount: 0, // 总条数
currentPage: 1, //当前页码
pageSize: 10, // 每页条数
storeQuery: {}, // 存储开始 结束 参数
tableActivityList: [],
tableLoading: false,
options: [
{ value: "0", label: "未开始" },
{ value: "1", label: "进行中" },
{ value: "2", label: "已结束" },
],
{ value: "", label: "全部" },
{ value: "1", label: "未开始" },
{ value: "2", label: "进行中" },
{ value: "3", label: "已结束" }
]
};
},
methods: {
// 点击活动标题
handleHeadline() {},
/* API */
// 获取商品列表
async getActivityList() {
let params = {
marketing_name: this.activity.activityName,
activity_status: this.activity.online_status, //1 未开始,2进行中,3已结束 空值 全部
marketing_type: 4, //1分销 2团购 3秒杀 4团餐 默认传4
// marketing_id: "",
page: this.currentPage,
page_size: this.pageSize
};
try {
this.tableLoading = true;
let data = await ActivityService.getActivityList(params);
this.filterTableActiveList(data.result);
this.pageCount = data.count;
this.tableLoading = false;
} catch {
this.tableLoading = false;
ElMessage.error("加载失败");
}
},
/* API */
// 结束 开始
async updateActivity() {
try {
this.tableLoading = true;
let data = await ActivityService.updateActivity(this.storeQuery);
if (data.code === 0) {
await this.getActivityList();
} else {
this.tableLoading = false;
ElMessage.error(data.reason);
}
} catch {
this.tableLoading = false;
}
},
/* API */
// 修改
/* API */
// 查看订单
// 数据转换成tableData格式
filterTableActiveList(tableData) {
this.tableActivityList = tableData.map(item => {
let activityStatusText = "";
let dateNow = dayJs();
if (dateNow.diff(dayJs(item.start_time)) < 0) {
// 开始时间大于当前时间 return 未开始
activityStatusText = "未开始";
} else if (dayJs(item.end_time).diff(dayJs(item.start_time)) > 0) {
// 结束时间大于开始时间 return 进行中
activityStatusText = "进行中";
} else if (dateNow.diff(dayJs(item.end_time)) > 0) {
// 当前时间大于结束时间 return 已结束
activityStatusText = "已结束";
}
return {
activiteId: item.marketing_id,
activiteHead: item.marketing_name,
activiteStatus: activityStatusText,
status: item.online_status,
minPrice: item.min_price,
maxPrice: item.max_price,
marketing_type: 4,
orderNumber: 33,
soldGoods: "",
pay: "",
discounts: "",
refund: "",
realized: "4000"
};
});
},
// 更改页数
handleCurrentChange(val) {
this.currentPage = val;
this.getActivityList();
},
// 点击活动标题
async handleHeadline(val) {
console.log(val);
this.$router.push({
name: "ActivityDetail",
query: {
marketing_id: val.activiteId,
marketing_type: val.marketing_type
}
});
},
// 发布拼单
goReleaseProduc() {
this.$router.push('/op/activity/releaseProduc')
this.$router.push("/op/activity/releaseProduc");
},
// 修改
handleModify() {},
handleModify(val) {
this.$router.push({
path: "/op/activity/releaseProduc",
query: {
marketing_id: val.activiteId,
marketing_type: val.marketing_type
}
});
},
// 结束
handleEnd() {},
handleEnd(val) {
this.storeQuery = {
marketing_id: val.activiteId,
online_status: 2 // 1 启用 2 关闭
};
},
// 开始
handleStart() {},
handleStart(val) {
this.storeQuery = {
marketing_id: val.activiteId,
online_status: 1 // 1 启用 2 关闭
};
},
// 查看详情
handleLook() {},
handleLook() {}
},
created(){
created() {
this.getActivityList();
}
};
</script>
<style lang="less" src="./index.less" scope></style>
\ No newline at end of file
<style lang="less" src="./index.less" scope></style>
<style lang="less" scoped>
.manage-wrapper {
height: 100%;
}
.header {
height: 100%;
}
.form-wrapper {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
.el-card__body {
height: 100%;
}
.formitem-wrapper {
height: 100px;
display: flex;
align-items: flex-end;
}
.table-wrapper {
flex: 1;
overflow-y: scroll;
}
.pagination-wrapper {
width: 100%;
height: 100px;
bottom: 20px;
display: flex;
justify-content: center;
align-items: center;
}
}
.checkButton {
margin-top: 5px;
}
.activityTitle {
cursor: pointer;
}
.activityPrice {
color: red;
}
</style>
/**
* 活动管理
*/
const activityRouters = [
{
path: "/op/activity",
redirect: "/op/activity/manage"
},
{
path: "/op/activity/manage",
name: "ManageList",
component: () => import(/* webpackChunkName: "activity" */ "@/pages/Activity/Manage")
},
const activityRouters = [
{
path: "/op/activity",
redirect: "/op/activity/manage"
},
{
path: "/op/activity/manage",
name: "ManageList",
component: () =>
import(/* webpackChunkName: "activity" */ "@/pages/Activity/Manage")
},
// 发布拼单
{
path: "/op/activity/releaseProduc",
name: "releaseProduc",
component: () => import(/* webpackChunkName: "activity" */ "@/pages/Activity/releaseProduc")
},
// 标题详情
{
path:"/op/activity/activityDetail",
name:"ActivityDetail",
component: () => import(/* webpackChunkName: "activity" */ "@/pages/Activity/ActivityDetail")
// 发布拼单
{
path: "/op/activity/releaseProduc",
name: "releaseProduc",
component: () =>
import(
/* webpackChunkName: "activity" */ "@/pages/Activity/releaseProduc"
)
},
// 标题详情
{
path: "/op/activity/activityDetail",
name: "ActivityDetail",
component: () =>
import(
/* webpackChunkName: "activity" */ "@/pages/Activity/ActivityDetail"
)
},
{
path: "/op/activity/releaseProduc/spellOrderSet",
name: "spellOrderSet",
component: () =>
import(
/* webpackChunkName: "activity" */ "@/pages/Activity/releaseProduc/components/spellOrderSet"
)
}
];
},
{
path: "/op/activity/releaseProduc/spellOrderSet",
name: "spellOrderSet",
component: () => import(/* webpackChunkName: "activity" */ "@/pages/Activity/releaseProduc/components/spellOrderSet")
},
];
export default activityRouters;
\ No newline at end of file
export default activityRouters;
......@@ -2,25 +2,62 @@ import axios from "@/utils/request";
// 获取商家列表
export async function getBusinessList(params) {
const res = await axios.get("/api/v1/goods/background/ota_list",{
params
});
return res;
const res = await axios.get("/api/v1/goods/background/ota_list", {
params
});
return res;
}
// 添加商品
export async function addGoods(params) {
const res = await axios.post(
"/api/v1/goods/background/add_goods",
params
);
return res;
const res = await axios.post("/api/v1/goods/background/add_goods", params);
return res;
}
// 商品库列表
export async function pindanGoods(params) {
const res = await axios.get("/api/v1/goods/background/pindan_goods",{
const res = await axios.get("/api/v1/goods/background/pindan_goods", {
params
});
return res;
}
class ActivityService {
// 获取活动列表
static async getActivityList(params) {
const res = await axios.get("/api/v1/marketing/background/marketing_list", {
params
});
return res;
}
\ No newline at end of file
}
// 修改商品
static async editGoodsDetail(query) {
const res = await axios.post("/api/v1/goods/background/edit_goods", {
...query
});
return res;
}
// 关闭/开启 活动
static async updateActivity(query) {
const res = await axios.post(
"/api/v1/marketing/background/update_marketing",
{
...query
}
);
return res;
}
// 查看活动订单
static async checkActivityDetail(query) {
const res = await axios.post(
"/api/v1/marketing/background/marketing_info",
{
...query
}
);
return res;
}
}
export default ActivityService;
import axios from "axios";
import store from "@/store"
import { v1 as uuidv1 } from 'uuid';
import store from "@/store";
import { v1 as uuidv1 } from "uuid";
// import jsonBig from 'json-bigint'
// import { ElMessage } from "element-plus";
......@@ -32,17 +32,16 @@ export const defaultConfig = {
*/
const getDefaultParams = () => {
return {
'op_cur_user': store.state.userInfo && store.state.userInfo.email,
'reqid': uuidv1().replace(/-/g, '')
}
op_cur_user: store.state.userInfo && store.state.userInfo.email,
reqid: uuidv1().replace(/-/g, "")
};
};
const getDefaultHeaders = (config) => {
const getDefaultHeaders = config => {
const { method } = config;
if (method.toLowerCase() === 'post') {
if (method.toLowerCase() === "post") {
return {
"Content-Type": "application/json"
}
};
}
};
......@@ -56,7 +55,7 @@ const instance = axios.create(defaultConfig);
* axios instance interceptors
*/
instance.interceptors.request.use(
function (config) {
function(config) {
// network error
if (navigator.onLine !== undefined && navigator.onLine === false) {
return Promise.reject({ message: "网络未链接", code: -1 });
......@@ -65,7 +64,7 @@ instance.interceptors.request.use(
/**
* merge headers
*/
config.headers = { ...getDefaultHeaders(config), ...config.headers }
config.headers = { ...getDefaultHeaders(config), ...config.headers };
/**
* merge params
......@@ -74,7 +73,7 @@ instance.interceptors.request.use(
return config;
},
function (error) {
function(error) {
// handle error
return Promise.reject(error);
}
......@@ -84,7 +83,7 @@ instance.interceptors.request.use(
* axios response instance
*/
instance.interceptors.response.use(
function (response) {
function(response) {
const { data = {} } = response;
// const code = data.code ?? -1;
// if (code !== 0) {
......@@ -106,8 +105,7 @@ instance.interceptors.response.use(
// return data;
// }
return data;
},
}
// function (error) {
// if (!(error.code && error.code === -1)) error.message = "接口请求错误";
// showErrorMessage(error.message);
......
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