Commit d30b982e authored by lihui's avatar lihui

feat: layout

parent f4f8ec98
<template> <template>
<layout> <Layout>
<div <div
class="manage-wrapper" class="manage-wrapper"
v-loading="tableLoading" v-loading="tableLoading"
...@@ -155,10 +155,10 @@ ...@@ -155,10 +155,10 @@
</div> </div>
</el-form> </el-form>
</div> </div>
</layout> </Layout>
</template> </template>
<script> <script>
import { layout } from "../../Groupmeal/layout/index.vue"; import { Layout } from "../../Groupmeal/layout/index.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import ActivityService from "@/service/Activity/index"; import ActivityService from "@/service/Activity/index";
import dayJs from "dayjs"; import dayJs from "dayjs";
...@@ -185,7 +185,7 @@ export default { ...@@ -185,7 +185,7 @@ export default {
}; };
}, },
components: { components: {
layout Layout
}, },
methods: { methods: {
/* API */ /* API */
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
<layout> <layout>
<el-card class="goods"> <el-card class="goods">
<!-- 筛选区 --> <!-- 筛选区 -->
<el-form <el-form inline class="search_condition">
inline
class="search_condition"
>
<!-- 商品id --> <!-- 商品id -->
<el-form-item label="商品id"> <el-form-item label="商品id">
<el-input v-model="searchProps.goods_spu_id"></el-input> <el-input v-model="searchProps.goods_spu_id"></el-input>
...@@ -66,21 +63,13 @@ ...@@ -66,21 +63,13 @@
</el-form-item> </el-form-item>
<!-- 按钮操作 --> <!-- 按钮操作 -->
<el-form-item style="justify-self: flex-end;"> <el-form-item style="justify-self: flex-end;">
<el-button <el-button @click="searchList" type="primary">搜索</el-button>
@click="searchList"
type="primary"
>搜索</el-button>
<el-button @click="resetList">重置</el-button> <el-button @click="resetList">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- 列表区 --> <!-- 列表区 -->
<el-table <el-table class="goods_list" :data="goodsList" border stripe>
class="goods_list"
:data="goodsList"
border
stripe
>
<el-table-column <el-table-column
label="商品id" label="商品id"
prop="goods_spu_id" prop="goods_spu_id"
...@@ -116,36 +105,33 @@ ...@@ -116,36 +105,33 @@
prop="publish_user_id" prop="publish_user_id"
align="center" align="center"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column label="状态" align="center">
label="状态"
align="center"
>
<template #default="scope"> <template #default="scope">
<span <span v-if="scope.row.audit_status == 0" style="color:#FF982C;"
v-if="scope.row.audit_status == 0" >待审核</span
style="color:#FF982C;" >
>待审核</span> <span v-if="scope.row.audit_status == 1" style="color:#5CC247;"
<span >审核通过</span
v-if="scope.row.audit_status == 1" >
style="color:#5CC247;" <span v-if="scope.row.audit_status == 2" style="color:#FD6B6F;"
>审核通过</span> >审核驳回</span
<span >
v-if="scope.row.audit_status == 2"
style="color:#FD6B6F;"
>审核驳回</span>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<span <span
v-if="scope.row.online_status == 0 && scope.row.audit_status != 2" v-if="scope.row.online_status == 0 && scope.row.audit_status != 2"
style="color:#FF982C;" style="color:#FF982C;"
>未上架</span> >未上架</span
>
<span <span
v-if="scope.row.online_status == 1 && scope.row.audit_status != 2" v-if="scope.row.online_status == 1 && scope.row.audit_status != 2"
style="color:#5CC247;" style="color:#5CC247;"
>已上架</span> >已上架</span
>
<span <span
v-if="scope.row.online_status == 2 && scope.row.audit_status != 2" v-if="scope.row.online_status == 2 && scope.row.audit_status != 2"
style="color:#FD6B6F;" style="color:#FD6B6F;"
>已下架</span> >已下架</span
>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -159,26 +145,23 @@ ...@@ -159,26 +145,23 @@
align="center" align="center"
></el-table-column> ></el-table-column>
<!-- 操作快捷键 --> <!-- 操作快捷键 -->
<el-table-column <el-table-column label="操作" align="center" fixed="right" width="200">
label="操作"
align="center"
fixed="right"
width="200"
>
<template #default="scope"> <template #default="scope">
<el-button <el-button
type="text" type="text"
@click="goDetail(`EDIT`, scope.row.goods_spu_id)" @click="goDetail(`EDIT`, scope.row.goods_spu_id)"
>编辑</el-button> >编辑</el-button
>
<el-button <el-button
v-if="scope.row.audit_status == 0" v-if="scope.row.audit_status == 0"
type="text" type="text"
@click="goDetail(`AUDIT`, scope.row.goods_spu_id)" @click="goDetail(`AUDIT`, scope.row.goods_spu_id)"
>审核</el-button> >审核</el-button
>
<el-popconfirm <el-popconfirm
v-if="scope.row.online_status == 2 " v-if="scope.row.online_status == 2"
title="您确定要上架该商品吗?" title="您确定要上架该商品吗?"
cancelButtonType="default" cancelButtonType="default"
@confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)" @confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)"
...@@ -189,7 +172,10 @@ ...@@ -189,7 +172,10 @@
</el-popconfirm> </el-popconfirm>
<el-popconfirm <el-popconfirm
v-if=" scope.row.online_status != 2 && (scope.row.audit_status == 1 || scope.row.online_status == 1) " v-if="
scope.row.online_status != 2 &&
(scope.row.audit_status == 1 || scope.row.online_status == 1)
"
title="您确定要下架该商品吗?" title="您确定要下架该商品吗?"
cancelButtonType="default" cancelButtonType="default"
@confirm=" @confirm="
...@@ -202,9 +188,10 @@ ...@@ -202,9 +188,10 @@
</el-popconfirm> </el-popconfirm>
<el-button <el-button
@click="goDetail(`DETAIL`,scope.row.goods_spu_id)" @click="goDetail(`DETAIL`, scope.row.goods_spu_id)"
type="text" type="text"
>详情</el-button> >详情</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -240,14 +227,14 @@ export default { ...@@ -240,14 +227,14 @@ export default {
Layout Layout
}, },
created () { created() {
// 获取级联选择 // 获取级联选择
this.getOptionList(); this.getOptionList();
// 获取商品列表 // 获取商品列表
this.getCommodityList(); this.getCommodityList();
}, },
data () { data() {
return { return {
// 级联选择器参数 // 级联选择器参数
cascaderProps: { cascaderProps: {
...@@ -300,7 +287,7 @@ export default { ...@@ -300,7 +287,7 @@ export default {
methods: { methods: {
// 获取级联选择 // 获取级联选择
async getOptionList () { async getOptionList() {
try { try {
const res = await getGoodsList(); const res = await getGoodsList();
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
...@@ -310,20 +297,20 @@ export default { ...@@ -310,20 +297,20 @@ export default {
} }
}, },
// 获取数组返回值并转换为字符串 // 获取数组返回值并转换为字符串
getVal (value, index = 0) { getVal(value, index = 0) {
const valueArray = value.map(item => { const valueArray = value.map(item => {
return item[index]; return item[index];
}); });
return valueArray.join(); return valueArray.join();
}, },
getValue (value) { getValue(value) {
const values = value.map(item => { const values = value.map(item => {
return item; return item;
}); });
return values.join(); return values.join();
}, },
// 获取列表 // 获取列表
async getCommodityList () { async getCommodityList() {
try { try {
const res = await getList(this.searchProps); const res = await getList(this.searchProps);
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
...@@ -335,25 +322,25 @@ export default { ...@@ -335,25 +322,25 @@ export default {
} }
}, },
// 所属分类赋值 // 所属分类赋值
handleTypeChange (val) { handleTypeChange(val) {
this.searchProps.category_1_id = this.getVal(val, 0); this.searchProps.category_1_id = this.getVal(val, 0);
this.searchProps.category_2_id = this.getVal(val, 1); this.searchProps.category_2_id = this.getVal(val, 1);
}, },
// 审核状态赋值 // 审核状态赋值
handleStatusChange (val) { handleStatusChange(val) {
this.searchProps.audit_status = this.getValue(val); this.searchProps.audit_status = this.getValue(val);
}, },
// 上架状态赋值 // 上架状态赋值
handleOnlineStatusChange (val) { handleOnlineStatusChange(val) {
this.searchProps.online_status = this.getValue(val); this.searchProps.online_status = this.getValue(val);
}, },
// 按条件搜索 // 按条件搜索
searchList () { searchList() {
console.log(this.searchProps); console.log(this.searchProps);
this.getCommodityList(); this.getCommodityList();
}, },
// 重置表单 // 重置表单
resetList () { resetList() {
this.searchProps = { this.searchProps = {
page: 1, // 页码 page: 1, // 页码
page_size: 20, // 页数大小 page_size: 20, // 页数大小
...@@ -372,7 +359,7 @@ export default { ...@@ -372,7 +359,7 @@ export default {
this.getCommodityList(); this.getCommodityList();
}, },
// 上架/下架操作 // 上架/下架操作
async changeGoodsState (state, spuId) { async changeGoodsState(state, spuId) {
// 上架操作 // 上架操作
if (state === "GROUNDING") { if (state === "GROUNDING") {
const res = await putOnline(spuId); const res = await putOnline(spuId);
...@@ -389,14 +376,14 @@ export default { ...@@ -389,14 +376,14 @@ export default {
}, },
// 页码变化 // 页码变化
handleCurrentChange (e) { handleCurrentChange(e) {
this.searchProps.page = e; this.searchProps.page = e;
// 获取信息 // 获取信息
this.getCommodityList(); this.getCommodityList();
}, },
// 去往详情页 // 去往详情页
goDetail (operation, spuId) { goDetail(operation, spuId) {
console.log(spuId); console.log(spuId);
this.$router.push({ name: "GoodsDetail", params: { operation, spuId } }); this.$router.push({ name: "GoodsDetail", params: { operation, spuId } });
} }
......
...@@ -200,13 +200,8 @@ ...@@ -200,13 +200,8 @@
></el-input> ></el-input>
<div style="margin: 20px 0"></div> <div style="margin: 20px 0"></div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item prop="commission_mode" label="金额计算方式:">
prop="commission_mode" <el-radio-group v-model="ruleForm.commission_mode">
label="金额计算方式:"
>
<el-radio-group
v-model="ruleForm.commission_mode"
>
<el-radio :label="2">按金额</el-radio> <el-radio :label="2">按金额</el-radio>
<el-radio :label="1">按比例</el-radio> <el-radio :label="1">按比例</el-radio>
</el-radio-group> </el-radio-group>
...@@ -218,7 +213,9 @@ ...@@ -218,7 +213,9 @@
@input="changeValue($event, 'first_commission_value')" @input="changeValue($event, 'first_commission_value')"
:disabled="shopStart !== 0" :disabled="shopStart !== 0"
> >
<template #append>{{ruleForm.commission_mode == 1? '%' : '¥'}}</template> <template #append>{{
ruleForm.commission_mode == 1 ? "%" : "¥"
}}</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="分享者佣金: " prop="second_commission_value"> <el-form-item label="分享者佣金: " prop="second_commission_value">
...@@ -228,7 +225,9 @@ ...@@ -228,7 +225,9 @@
@input="changeValue($event, 'second_commission_value')" @input="changeValue($event, 'second_commission_value')"
:disabled="shopStart !== 0" :disabled="shopStart !== 0"
> >
<template #append>{{ruleForm.commission_mode == 1? '%' : '¥'}}</template> <template #append>{{
ruleForm.commission_mode == 1 ? "%" : "¥"
}}</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="活动生效时间:"> <el-form-item label="活动生效时间:">
...@@ -345,13 +344,13 @@ import { ...@@ -345,13 +344,13 @@ import {
getFindGoodsList, getFindGoodsList,
getAddMarketingList, getAddMarketingList,
getMarketingInfo, getMarketingInfo,
updateMarketingList, updateMarketingList
} from "@/service/Goods/goods"; } from "@/service/Goods/goods";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
// 开启关闭防抖 // 开启关闭防抖
function debounce(callback, delay) { function debounce(callback, delay) {
let timer = null; let timer = null;
return function (...args) { return function(...args) {
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer);
} }
...@@ -364,7 +363,7 @@ function debounce(callback, delay) { ...@@ -364,7 +363,7 @@ function debounce(callback, delay) {
export default { export default {
name: "GoodsRetail", name: "GoodsRetail",
components: { components: {
Layout, Layout
}, },
data() { data() {
var commission = (rule, value, callback) => { var commission = (rule, value, callback) => {
...@@ -373,7 +372,7 @@ export default { ...@@ -373,7 +372,7 @@ export default {
(this.ruleForm.first_commission_value + (this.ruleForm.first_commission_value +
this.ruleForm.second_commission_value > this.ruleForm.second_commission_value >
50 || 50 ||
value > 50 ) value > 50)
) { ) {
callback(new Error("上线佣金与分享者佣金之和不可大于50%")); callback(new Error("上线佣金与分享者佣金之和不可大于50%"));
} else { } else {
...@@ -388,14 +387,14 @@ export default { ...@@ -388,14 +387,14 @@ export default {
first_commission_value: "", first_commission_value: "",
second_commission_value: "", second_commission_value: "",
start_time: "", start_time: "",
end_time: "", end_time: ""
}, },
goods_list: [], goods_list: [],
options: [ options: [
{ value: 0, label: "全部" }, { value: 0, label: "全部" },
{ value: 1, label: "启用" }, { value: 1, label: "启用" },
{ value: 2, label: "关闭" }, { value: 2, label: "关闭" },
{ value: 3, label: "到期" }, { value: 3, label: "到期" }
], ],
// 搜索条件 // 搜索条件
retailActivitie: { retailActivitie: {
...@@ -405,7 +404,7 @@ export default { ...@@ -405,7 +404,7 @@ export default {
online_status: [], online_status: [],
page: 1, page: 1,
page_size: 20, page_size: 20,
count: 0, count: 0
}, },
ruleForm: { ruleForm: {
...@@ -415,33 +414,33 @@ export default { ...@@ -415,33 +414,33 @@ export default {
second_commission_value: "", second_commission_value: "",
start_time: "", start_time: "",
end_time: "", end_time: "",
goods_spu_id: [], goods_spu_id: []
}, },
timeSelect: [], timeSelect: [],
ruleIdForm: { ruleIdForm: {
life_account_id: "", life_account_id: "",
goods_spu_id: "", goods_spu_id: "",
start_time: "", start_time: "",
end_time: "", end_time: ""
}, },
rules: { rules: {
marketing_name: [ marketing_name: [
{ required: true, message: "请输入活动名称", trigger: "blur" }, { required: true, message: "请输入活动名称", trigger: "blur" },
{ min: 1, max: 50, message: "活动名称不能大于50", trigger: "blur" }, { min: 1, max: 50, message: "活动名称不能大于50", trigger: "blur" }
], ],
second_commission_value: [ second_commission_value: [
{ {
required: true, required: true,
message: "请填写分享者佣金", message: "请填写分享者佣金",
trigger: "blur", trigger: "blur"
}, },
{ type: "number", message: "必须为数值型" }, { type: "number", message: "必须为数值型" },
{ validator: commission }, { validator: commission }
], ],
first_commission_value: [ first_commission_value: [
{ type: "number", message: "必须为数值型" }, { type: "number", message: "必须为数值型" },
{ validator: commission }, { validator: commission }
], ]
}, },
allList: [], allList: [],
dialogFormVisible: false, dialogFormVisible: false,
...@@ -450,7 +449,7 @@ export default { ...@@ -450,7 +449,7 @@ export default {
endTime: "", endTime: "",
marketing_id: "", marketing_id: "",
marketing_info: {}, marketing_info: {},
disabled: false, disabled: false
}; };
}, },
methods: { methods: {
...@@ -494,11 +493,11 @@ export default { ...@@ -494,11 +493,11 @@ export default {
} }
}, },
// 开启关闭 // 开启关闭
handelEnable: debounce(async function (row, type) { handelEnable: debounce(async function(row, type) {
try { try {
const res = await updateMarketingList({ const res = await updateMarketingList({
marketing_id: row.marketing_id, marketing_id: row.marketing_id,
online_status: type, online_status: type
}); });
if (res.code !== 0) { if (res.code !== 0) {
ElMessage.error(res.reason); ElMessage.error(res.reason);
...@@ -523,7 +522,7 @@ export default { ...@@ -523,7 +522,7 @@ export default {
goods_sku_id: "", goods_sku_id: "",
online_status: [], online_status: [],
page: 1, page: 1,
page_size: 20, page_size: 20
}), }),
this.$refs[retailActivitie].resetFields(); this.$refs[retailActivitie].resetFields();
this.getMarketingList({}); this.getMarketingList({});
...@@ -581,7 +580,7 @@ export default { ...@@ -581,7 +580,7 @@ export default {
goods_spu_id, goods_spu_id,
life_account_id, life_account_id,
start_time, start_time,
end_time, end_time
}; };
try { try {
// 发请求 // 发请求
...@@ -594,18 +593,18 @@ export default { ...@@ -594,18 +593,18 @@ export default {
} }
}, },
selectGoodsChange(e) { selectGoodsChange(e) {
this.ruleForm.goods_spu_id = e.map((item) => item.goods_sku_id); this.ruleForm.goods_spu_id = e.map(item => item.goods_sku_id);
}, },
async getAllList() { async getAllList() {
let all = await getMarketingList({ let all = await getMarketingList({
page: 1, page: 1,
page_size: this.retailActivitie.count, page_size: this.retailActivitie.count
}); });
this.allList = all.result; this.allList = all.result;
}, },
// 添加活动列表 // 添加活动列表
async addList() { async addList() {
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async valid => {
if (valid) { if (valid) {
console.log(this.ruleForm.goods_spu_id); console.log(this.ruleForm.goods_spu_id);
if (this.ruleForm.goods_spu_id.length <= 0) { if (this.ruleForm.goods_spu_id.length <= 0) {
...@@ -620,7 +619,7 @@ export default { ...@@ -620,7 +619,7 @@ export default {
marketing_name, marketing_name,
first_commission_value, first_commission_value,
commission_mode, commission_mode,
second_commission_value, second_commission_value
} = this.ruleForm; } = this.ruleForm;
let [start_time, end_time] = this.timeSelect || []; let [start_time, end_time] = this.timeSelect || [];
if ( if (
...@@ -639,7 +638,7 @@ export default { ...@@ -639,7 +638,7 @@ export default {
first_commission_value: first_commission_value + "", first_commission_value: first_commission_value + "",
second_commission_value: second_commission_value + "", second_commission_value: second_commission_value + "",
start_time: this.formatTime(start_time), start_time: this.formatTime(start_time),
end_time: this.formatTime(end_time), end_time: this.formatTime(end_time)
}; };
try { try {
const res = await getAddMarketingList(addParams); const res = await getAddMarketingList(addParams);
...@@ -666,7 +665,7 @@ export default { ...@@ -666,7 +665,7 @@ export default {
second_commission_value: "", second_commission_value: "",
start_time: "", start_time: "",
end_time: "", end_time: "",
goods_spu_id: [], goods_spu_id: []
}), }),
(this.timeSelect = []), (this.timeSelect = []),
(this.goods_list = []), (this.goods_list = []),
...@@ -674,7 +673,7 @@ export default { ...@@ -674,7 +673,7 @@ export default {
life_account_id: "", life_account_id: "",
goods_spu_id: "", goods_spu_id: "",
start_time: "", start_time: "",
end_time: "", end_time: ""
}); });
}, },
// 取消 // 取消
...@@ -682,12 +681,12 @@ export default { ...@@ -682,12 +681,12 @@ export default {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.resetDate(); this.resetDate();
this.getMarketingList(); this.getMarketingList();
}, }
}, },
created() { created() {
this.getMarketingList(); this.getMarketingList();
this.getAllList(); this.getAllList();
}, }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
<div class="main"> <div class="main">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import PageHeader from '../components/PageHeader'; import PageHeader from "../components/PageHeader";
export default { export default {
components: { PageHeader }, components: { PageHeader }
}; };
</script> </script>
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
<div class="main"> <div class="main">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import PageHeader from '../components/PageHeader'; import PageHeader from "../components/PageHeader";
export default { export default {
components: { PageHeader }, components: { PageHeader }
}; };
</script> </script>
......
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