管理、商家,添加删除秒杀商品接口,管理端切换账号菜单权限不生效问题,代码优化
parent
3e505a8a4e
commit
e9163e4247
|
@ -38,7 +38,7 @@
|
|||
<TabPane label="已选商品" name="goodsChecked">
|
||||
<Table stripe :columns="goodsColumns" :data="goodsData.records">
|
||||
<template slot-scope="{ row }" slot="name">
|
||||
<div class="goods-msg" @click="linkTo(`/goodsDetail?skuId=${row.skuId}&goodsId=${row.id}`)"><img style="vertical-align:top;" :src="row.thumbnail" width="60" height="60" alt=""> {{row.goodsName}}</div>
|
||||
<div class="goods-msg" @click="linkTo(`/goodsDetail?skuId=${row.skuId}&goodsId=${row.goodsId}`)"><img style="vertical-align:top;" :src="row.thumbnail" width="60" height="60" alt=""> {{row.goodsName}}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="price">
|
||||
<span> ¥{{ row.price | unitPrice }}</span>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<TabPane label="未选商品" name="goodsUncheck">
|
||||
<Table stripe :columns="goodsColumns" :data="goodsData.records">
|
||||
<template slot-scope="{ row }" slot="name">
|
||||
<div class="goods-msg" @click="linkTo(`/goodsDetail?skuId=${row.skuId}&goodsId=${row.id}`)"><img style="vertical-align:top;" :src="row.thumbnail" width="60" height="60" alt=""> {{row.goodsName}}</div>
|
||||
<div class="goods-msg" @click="linkTo(`/goodsDetail?skuId=${row.skuId}&goodsId=${row.goodsId}`)"><img style="vertical-align:top;" :src="row.thumbnail" width="60" height="60" alt=""> {{row.goodsName}}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="price">
|
||||
<span> ¥{{ row.price | unitPrice }}</span>
|
||||
|
@ -289,7 +289,7 @@ export default {
|
|||
})
|
||||
},
|
||||
fenxiao (row) { // 分销商品
|
||||
this.qrcode = `${location.origin}/goodsDetail?skuId=${row.skuId}&goodsId=${row.id}&distributionId=${this.result.id}`
|
||||
this.qrcode = `${location.origin}/goodsDetail?skuId=${row.skuId}&goodsId=${row.goodsId}&distributionId=${this.result.id}`
|
||||
this.goodsNameCurr = row.goodsName
|
||||
this.qrcodeShow = true;
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
deleteRequest
|
||||
} from "@/libs/axios";
|
||||
|
||||
// 获取限时抢购申请列表
|
||||
// 获取秒杀活动申请列表
|
||||
|
||||
export const getPromotionSeckill = params => {
|
||||
return getRequest(`/promotion/seckill/apply`, params);
|
||||
|
@ -118,10 +118,12 @@ export const getActivityCouponList = params => {
|
|||
export const getCouponActivityList = params => {
|
||||
return getRequest("/promotion/couponActivity", params);
|
||||
};
|
||||
// 作废优惠券
|
||||
// 关闭优惠券活动
|
||||
export const closeActivity = id => {
|
||||
return deleteRequest(`/promotion/couponActivity/${id}`);
|
||||
};
|
||||
|
||||
|
||||
// 更新优惠券活动
|
||||
export const updateCouponActivity = params => {
|
||||
return putRequest(`/promotion/couponActivity/status`, params);
|
||||
|
@ -131,42 +133,45 @@ export const getCouponActivity = id => {
|
|||
return getRequest(`/promotion/couponActivity/${id}`);
|
||||
};
|
||||
|
||||
// 获取限时抢购数据
|
||||
// 获取秒杀活动数据
|
||||
export const getSeckillList = params => {
|
||||
return getRequest("/promotion/seckill", params);
|
||||
};
|
||||
|
||||
// 获取限时抢购审核列表
|
||||
// 获取秒杀活动审核列表
|
||||
export const seckillGoodsList = params => {
|
||||
return getRequest("/promotion/seckill/apply", params);
|
||||
};
|
||||
|
||||
// 获取限时抢购详情数据
|
||||
// 获取秒杀活动详情数据
|
||||
export const seckillDetail = (id, params) => {
|
||||
return getRequest(`/promotion/seckill/${id}`, params);
|
||||
};
|
||||
|
||||
// 删除限时抢购
|
||||
// 删除秒杀活动
|
||||
export const delSeckill = id => {
|
||||
return deleteRequest(`/promotion/seckill/${id}`);
|
||||
};
|
||||
|
||||
// 保存限时抢购
|
||||
// 保存秒杀活动
|
||||
export const saveSeckill = params => {
|
||||
return postRequest("/promotion/seckill", params);
|
||||
};
|
||||
|
||||
// 修改限时抢购
|
||||
// 修改秒杀活动
|
||||
export const updateSeckill = params => {
|
||||
return putRequest("/promotion/seckill", params);
|
||||
};
|
||||
|
||||
// 关闭限时抢购
|
||||
// 关闭秒杀活动
|
||||
export const closeSeckill = id => {
|
||||
return putRequest(`/promotion/seckill/close/${id}`);
|
||||
};
|
||||
|
||||
// 审核限时抢购
|
||||
// 删除秒杀商品
|
||||
export const delSeckillGoods = params => {
|
||||
return deleteRequest(`/promotion/seckill/apply/${params.seckillId}/${params.id}`);
|
||||
};
|
||||
// 审核秒杀活动
|
||||
export const auditApplySeckill = params => {
|
||||
return putRequest(`/promotion/seckill/apply/audit/${params.ids}`, params);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import axios from 'axios';
|
||||
import { getCurrentPermissionList } from '@/api/index';
|
||||
import {
|
||||
getCurrentPermissionList
|
||||
} from '@/api/index';
|
||||
import lazyLoading from './lazyLoading.js';
|
||||
import router from '@/router/index';
|
||||
import Cookies from "js-cookie";
|
||||
|
@ -12,46 +14,7 @@ util.title = function (title) {
|
|||
title = title || 'lili 运营后台';
|
||||
window.document.title = title;
|
||||
};
|
||||
|
||||
util.millsToTime = function (mills) {
|
||||
if (!mills) {
|
||||
return "";
|
||||
}
|
||||
let s = mills / 1000;
|
||||
if (s < 60) {
|
||||
return s.toFixed(0) + " 秒"
|
||||
}
|
||||
let m = s / 60;
|
||||
if (m < 60) {
|
||||
return m.toFixed(0) + " 分钟"
|
||||
}
|
||||
let h = m / 60;
|
||||
if (h < 24) {
|
||||
return h.toFixed(0) + " 小时"
|
||||
}
|
||||
let d = h / 24;
|
||||
if (d < 30) {
|
||||
return d.toFixed(0) + " 天"
|
||||
}
|
||||
let month = d / 30
|
||||
if (month < 12) {
|
||||
return month.toFixed(0) + " 个月"
|
||||
}
|
||||
let year = month / 12
|
||||
return year.toFixed(0) + " 年"
|
||||
|
||||
};
|
||||
|
||||
util.inOf = function (arr, targetArr) {
|
||||
let res = true;
|
||||
arr.forEach(item => {
|
||||
if (targetArr.indexOf(item) < 0) {
|
||||
res = false;
|
||||
}
|
||||
});
|
||||
return res;
|
||||
};
|
||||
|
||||
// 判断元素是否存在于数组中
|
||||
util.oneOf = function (ele, targetArr) {
|
||||
if (targetArr.indexOf(ele) >= 0) {
|
||||
return true;
|
||||
|
@ -60,141 +23,7 @@ util.oneOf = function (ele, targetArr) {
|
|||
}
|
||||
};
|
||||
|
||||
util.getRouterObjByName = function (routers, name) {
|
||||
if (!name || !routers || !routers.length) {
|
||||
return null;
|
||||
}
|
||||
let routerObj = null;
|
||||
for (let item of routers) {
|
||||
if (item.name == name) {
|
||||
return item;
|
||||
}
|
||||
routerObj = util.getRouterObjByName(item.children, name);
|
||||
if (routerObj) {
|
||||
return routerObj;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
util.handleTitle = function (vm, item) {
|
||||
if (typeof item.title == 'object') {
|
||||
return vm.$t(item.title.i18n);
|
||||
} else {
|
||||
return item.title;
|
||||
}
|
||||
};
|
||||
|
||||
util.setCurrentPath = function (vm, name) {
|
||||
let title = '';
|
||||
let isOtherRouter = false;
|
||||
vm.$store.state.app.routers.forEach(item => {
|
||||
if (item.children.length == 1) {
|
||||
if (item.children[0].name == name) {
|
||||
title = util.handleTitle(vm, item);
|
||||
if (item.name == 'otherRouter') {
|
||||
isOtherRouter = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.children.forEach(child => {
|
||||
if (child.name == name) {
|
||||
title = util.handleTitle(vm, child);
|
||||
if (item.name == 'otherRouter') {
|
||||
isOtherRouter = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
let currentPathArr = [];
|
||||
if (name == 'home_index') {
|
||||
currentPathArr = [
|
||||
{
|
||||
title: util.handleTitle(vm, util.getRouterObjByName(vm.$store.state.app.routers, 'home_index')),
|
||||
path: '',
|
||||
name: 'home_index'
|
||||
}
|
||||
];
|
||||
} else if ((name.indexOf('_index') >= 0 || isOtherRouter) && name !== 'home_index') {
|
||||
currentPathArr = [
|
||||
{
|
||||
title: util.handleTitle(vm, util.getRouterObjByName(vm.$store.state.app.routers, 'home_index')),
|
||||
path: '/home',
|
||||
name: 'home_index'
|
||||
},
|
||||
{
|
||||
title: title,
|
||||
path: '',
|
||||
name: name
|
||||
}
|
||||
];
|
||||
} else {
|
||||
let currentPathObj = vm.$store.state.app.routers.filter(item => {
|
||||
if (item.children.length <= 1) {
|
||||
return item.children[0].name == name;
|
||||
} else {
|
||||
let i = 0;
|
||||
let childArr = item.children;
|
||||
let len = childArr.length;
|
||||
while (i < len) {
|
||||
if (childArr[i].name == name) {
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})[0];
|
||||
if (currentPathObj.children.length <= 1 && currentPathObj.name == 'home') {
|
||||
currentPathArr = [
|
||||
{
|
||||
title: '首页',
|
||||
path: '',
|
||||
name: 'home_index'
|
||||
}
|
||||
];
|
||||
} else if (currentPathObj.children.length <= 1 && currentPathObj.name !== 'home') {
|
||||
currentPathArr = [
|
||||
{
|
||||
title: '首页',
|
||||
path: '/home',
|
||||
name: 'home_index'
|
||||
},
|
||||
{
|
||||
title: currentPathObj.title,
|
||||
path: '',
|
||||
name: name
|
||||
}
|
||||
];
|
||||
} else {
|
||||
let childObj = currentPathObj.children.filter((child) => {
|
||||
return child.name == name;
|
||||
})[0];
|
||||
currentPathArr = [
|
||||
{
|
||||
title: '首页',
|
||||
path: '/home',
|
||||
name: 'home_index'
|
||||
},
|
||||
{
|
||||
title: currentPathObj.title,
|
||||
path: '',
|
||||
name: currentPathObj.name
|
||||
},
|
||||
{
|
||||
title: childObj.title,
|
||||
path: currentPathObj.path + '/' + childObj.path,
|
||||
name: name
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
vm.$store.commit('setCurrentPath', currentPathArr);
|
||||
|
||||
return currentPathArr;
|
||||
};
|
||||
|
||||
// 打开新的页面
|
||||
util.openNewPage = function (vm, name, argu, query) {
|
||||
if (!vm.$store) {
|
||||
return;
|
||||
|
@ -235,7 +64,6 @@ util.openNewPage = function (vm, name, argu, query) {
|
|||
vm.$store.commit('increateTag', tag);
|
||||
}
|
||||
}
|
||||
vm.$store.commit('setCurrentPageName', name);
|
||||
};
|
||||
|
||||
util.toDefaultPage = function (routers, name, route, next) {
|
||||
|
@ -258,54 +86,6 @@ util.toDefaultPage = function (routers, name, route, next) {
|
|||
}
|
||||
};
|
||||
|
||||
// 将Csv文件解析为二维数组
|
||||
export const getArrayFromFile = (file) => {
|
||||
let nameSplit = file.name.split('.')
|
||||
let format = nameSplit[nameSplit.length - 1]
|
||||
return new Promise((resolve, reject) => {
|
||||
let reader = new FileReader()
|
||||
reader.readAsText(file) // 以文本格式读取
|
||||
let arr = []
|
||||
reader.onload = function (evt) {
|
||||
let data = evt.target.result // 读到的数据
|
||||
let pasteData = data.trim()
|
||||
arr = pasteData.split((/[\n\u0085\u2028\u2029]|\r\n?/g)).map(row => {
|
||||
return row.split('\t')
|
||||
}).map(item => {
|
||||
return item[0].split(',')
|
||||
})
|
||||
if (format == 'csv') resolve(arr)
|
||||
else reject(new Error('[Format Error]:不是Csv文件'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 将二维数组转为表格数据
|
||||
export const getTableDataFromArray = (array) => {
|
||||
let columns = []
|
||||
let tableData = []
|
||||
if (array.length > 1) {
|
||||
let titles = array.shift()
|
||||
columns = titles.map(item => {
|
||||
return {
|
||||
title: item,
|
||||
key: item
|
||||
}
|
||||
})
|
||||
tableData = array.map(item => {
|
||||
let res = {}
|
||||
item.forEach((col, i) => {
|
||||
res[titles[i]] = col
|
||||
})
|
||||
return res
|
||||
})
|
||||
}
|
||||
return {
|
||||
columns,
|
||||
tableData
|
||||
}
|
||||
}
|
||||
|
||||
util.initRouter = function (vm) { // 初始化路由
|
||||
const constRoutes = [];
|
||||
const otherRoutes = [];
|
||||
|
@ -456,10 +236,8 @@ util.initRouterNode = function (routers, data) { // data为所有子菜单数
|
|||
}
|
||||
|
||||
let meta = {};
|
||||
// 给页面添加权限、标题、第三方网页链接
|
||||
meta.permTypes = menu.permTypes ? menu.permTypes : null;
|
||||
// 给页面添加标题、父级菜单name(方便左侧菜单选中)
|
||||
meta.title = menu.title ? menu.title + " - lilishop 运营后台" : null;
|
||||
meta.url = menu.url ? menu.url : null;
|
||||
meta.firstRouterName = item.firstRouterName
|
||||
menu.meta = meta;
|
||||
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
import { otherRouter } from '@/router/router';
|
||||
import { router } from '@/router/index';
|
||||
import {
|
||||
otherRouter
|
||||
} from '@/router/router';
|
||||
import {
|
||||
router
|
||||
} from '@/router/index';
|
||||
import Util from '@/libs/util';
|
||||
import Vue from 'vue';
|
||||
|
||||
const app = {
|
||||
state: {
|
||||
styleStore: "", // 移动端楼层装修中选择风格存储
|
||||
loading: false, // 全局加载动画
|
||||
added: false, // 加载路由标识
|
||||
navList: [], // 顶部菜单
|
||||
currNav: "", // 当前顶部菜单name
|
||||
|
@ -18,14 +21,6 @@ const app = {
|
|||
path: '',
|
||||
name: 'home_index'
|
||||
}],
|
||||
currentPageName: '',
|
||||
currentPath: [
|
||||
{
|
||||
title: '首页',
|
||||
path: '',
|
||||
name: 'home_index'
|
||||
}
|
||||
],
|
||||
// 面包屑数组 左侧菜单
|
||||
menuList: [],
|
||||
tagsList: [...otherRouter.children], //这块是面包屑的内容不能删除
|
||||
|
@ -44,9 +39,6 @@ const app = {
|
|||
updateDefaultRouter(state, routes) {
|
||||
router.addRoutes(routes);
|
||||
},
|
||||
setLoading(state, v) {
|
||||
state.loading = v;
|
||||
},
|
||||
setAdded(state, v) {
|
||||
state.added = v;
|
||||
},
|
||||
|
@ -123,12 +115,6 @@ const app = {
|
|||
setOpenedList(state) {
|
||||
state.pageOpenedList = localStorage.pageOpenedList ? JSON.parse(localStorage.pageOpenedList) : [otherRouter.children[0]];
|
||||
},
|
||||
setCurrentPath(state, pathArr) {
|
||||
state.currentPath = pathArr;
|
||||
},
|
||||
setCurrentPageName(state, name) {
|
||||
state.currentPageName = name;
|
||||
},
|
||||
setAvatarPath(state, path) {
|
||||
localStorage.avatorImgPath = path;
|
||||
},
|
||||
|
|
|
@ -132,6 +132,7 @@ export default {
|
|||
// 退出登录
|
||||
else if (name === "loginOut") {
|
||||
this.$store.commit("logout", this);
|
||||
this.$store.commit('setAdded', false);
|
||||
this.setStore("accessToken", "");
|
||||
this.setStore("refreshToken", "");
|
||||
this.$router.push({ path: "/login" });
|
||||
|
@ -167,7 +168,6 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
this.$store.commit("setCurrentPageName", to.name);
|
||||
this.checkTag(to.name);
|
||||
localStorage.currentPageName = to.name;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ export default {
|
|||
item.selected = false;
|
||||
item.___type = "goods"; //设置为goods让pc wap知道标识
|
||||
this.selectedWay.forEach(e => {
|
||||
if (e.id === item.id) {
|
||||
if (e.id && e.id === item.id) {
|
||||
item.selected = true
|
||||
}
|
||||
})
|
||||
|
|
|
@ -3,11 +3,7 @@
|
|||
<template v-if="flag">
|
||||
<goodsDialog @selected="(val) => {goodsData = val;}"
|
||||
v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/>
|
||||
<linkDialog @selectedLink="
|
||||
(val) => {
|
||||
linkData = val;
|
||||
}
|
||||
" v-else class="linkDialog" />
|
||||
<linkDialog @selectedLink="(val) => { linkData = val; }" v-else class="linkDialog" />
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
|
|
|
@ -9,26 +9,6 @@
|
|||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{ item }}</Tag>
|
||||
</template>
|
||||
</Table>
|
||||
|
||||
<Row class="operation">
|
||||
<Button @click="auditAll">批量审核</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
@click="
|
||||
() => {
|
||||
openTip = !openTip;
|
||||
}
|
||||
"
|
||||
>{{ openTip ? "关闭提示" : "开启提示" }}
|
||||
</Button
|
||||
>
|
||||
</Row>
|
||||
<Row v-show="openTip">
|
||||
<Alert show-icon>
|
||||
已选择 <span class="select-count">{{ selectCount }}</span> 项
|
||||
<a class="select-clear" @click="clearSelectAll">清空</a>
|
||||
</Alert>
|
||||
</Row>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
|
@ -36,8 +16,6 @@
|
|||
:columns="goodsColumns"
|
||||
:data="goodsList"
|
||||
ref="table"
|
||||
sortable="custom"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="originalPrice">
|
||||
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
|
||||
|
@ -51,29 +29,6 @@
|
|||
<div>{{ row.price | unitPrice("¥") }}</div>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row }" slot="promotionApplyStatus">
|
||||
<Badge
|
||||
status="success"
|
||||
v-if="row.promotionApplyStatus == 'PASS'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<Badge
|
||||
status="blue"
|
||||
v-if="row.promotionApplyStatus == 'APPLY'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<Badge
|
||||
status="error"
|
||||
v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<span
|
||||
v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
@click="showReason(row.failReason)"
|
||||
class="reason"
|
||||
>(拒绝原因)</span
|
||||
>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="time">
|
||||
<Tag>{{ row.timeLine + ":00" }}</Tag>
|
||||
</template>
|
||||
|
@ -86,24 +41,13 @@
|
|||
alt=""
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<Button
|
||||
type="success"
|
||||
size="small"
|
||||
style="margin-right: 10px"
|
||||
:disabled="row.promotionApplyStatus != 'APPLY'"
|
||||
@click="pass(row)"
|
||||
>通过
|
||||
</Button
|
||||
>
|
||||
<template slot-scope="{ row, index }" slot="action">
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
:disabled="row.promotionApplyStatus != 'APPLY'"
|
||||
@click="refuse(row)"
|
||||
>拒绝
|
||||
</Button
|
||||
>
|
||||
@click="delGoods(index,row)"
|
||||
>删除
|
||||
</Button>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
|
@ -121,40 +65,6 @@
|
|||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
<Modal v-model="showModal" title="审核商品">
|
||||
<Form ref="form" :model="params" :rules="rules">
|
||||
<FormItem label="审核状态">
|
||||
<RadioGroup v-model="params.applyStatus" type="button" button-style="solid">
|
||||
<Radio label="PASS">通过</Radio>
|
||||
<Radio label="REFUSE">拒绝</Radio>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="拒绝原因"
|
||||
prop="failReason"
|
||||
v-if="params.applyStatus == 'REFUSE'"
|
||||
>
|
||||
<Input
|
||||
type="textarea"
|
||||
v-model="params.failReason"
|
||||
maxlength="50"
|
||||
style="width: 260px"
|
||||
show-word-limit
|
||||
/>
|
||||
</FormItem>
|
||||
</Form>
|
||||
<div slot="footer">
|
||||
<Button size="small" @click="showModal = false">取消</Button>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="sureAudit"
|
||||
>确定
|
||||
</Button
|
||||
>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -162,6 +72,7 @@
|
|||
seckillGoodsList,
|
||||
seckillDetail,
|
||||
auditApplySeckill,
|
||||
delSeckillGoods
|
||||
} from "@/api/promotion.js";
|
||||
|
||||
export default {
|
||||
|
@ -246,7 +157,6 @@
|
|||
},
|
||||
],
|
||||
goodsColumns: [ // 商品表单
|
||||
{type: "selection", width: 60, align: "center"},
|
||||
{
|
||||
title: "商品名称",
|
||||
key: "goodsName",
|
||||
|
@ -281,13 +191,11 @@
|
|||
width: 100,
|
||||
slot: "time",
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
slot: "promotionApplyStatus",
|
||||
minWidth: 30,
|
||||
width: 90,
|
||||
},
|
||||
|
||||
// {
|
||||
// title: "状态",
|
||||
// slot: "promotionApplyStatus",
|
||||
// width: 90,
|
||||
// },
|
||||
{
|
||||
title: "操作",
|
||||
slot: "action",
|
||||
|
@ -328,16 +236,6 @@
|
|||
clearSelectAll() {
|
||||
this.$refs.table.selectAll(false);
|
||||
},
|
||||
changeSelect(e) {
|
||||
// 获取选择数据
|
||||
this.selectList = e;
|
||||
this.selectCount = e.length;
|
||||
let ids = [];
|
||||
this.selectList.forEach((item) => {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.params.ids = ids.toString();
|
||||
},
|
||||
|
||||
getDataList() {
|
||||
// 获取商品详情
|
||||
|
@ -363,11 +261,25 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
delGoods(index) {
|
||||
delGoods(index, row) {
|
||||
// 删除商品
|
||||
this.goodsList.list.splice(index, 1);
|
||||
this.$Modal.confirm({
|
||||
title: "确认删除",
|
||||
content: "您确认要删除该商品吗?删除后不可恢复",
|
||||
onOk: () => {
|
||||
const params = {
|
||||
seckillId: row.seckillId,
|
||||
id: row.id
|
||||
}
|
||||
delSeckillGoods(params).then(res => {
|
||||
if (res.success) {
|
||||
this.goodsList.splice(index, 1);
|
||||
this.$Message.success("删除成功!");
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
unixDate(time) {
|
||||
// 处理报名截止时间
|
||||
return this.$options.filters.unixToDate(new Date(time) / 1000);
|
||||
|
@ -379,88 +291,8 @@
|
|||
hourArr[i] += ":00";
|
||||
}
|
||||
return hourArr;
|
||||
},
|
||||
// 格式化申请状态
|
||||
promotionApplyStatus(key) {
|
||||
switch (key) {
|
||||
case "APPLY":
|
||||
return "申请";
|
||||
case "PASS":
|
||||
return "通过";
|
||||
case "REFUSE":
|
||||
return "拒绝";
|
||||
}
|
||||
},
|
||||
pass(row) {
|
||||
// 通过
|
||||
let params = {
|
||||
seckillId: this.$route.query.id,
|
||||
applyStatus: "PASS",
|
||||
failReason: "",
|
||||
ids: row.id,
|
||||
};
|
||||
auditApplySeckill(params).then((res) => {
|
||||
if (res && res.success) {
|
||||
this.$Message.success("已通过该商品审核");
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
refuse(row) {
|
||||
// 拒绝
|
||||
this.params.applyStatus = "REFUSE";
|
||||
this.selectList.push(row);
|
||||
this.showModal = true;
|
||||
},
|
||||
auditAll() {
|
||||
// 批量审核
|
||||
if (this.selectCount <= 0) {
|
||||
this.$Message.warning("您还未选择要审核的商品");
|
||||
return;
|
||||
}
|
||||
this.showModal = true;
|
||||
},
|
||||
// 确认审批
|
||||
sureAudit() {
|
||||
this.selectCount = this.selectList.length;
|
||||
// 批量审核
|
||||
if (this.selectCount <= 0) {
|
||||
this.$Message.warning("您还未选择要审核的商品");
|
||||
return;
|
||||
}
|
||||
this.params.ids = this.selectList
|
||||
.filter((i) => i.promotionApplyStatus === "APPLY")
|
||||
.map((i) => i.id);
|
||||
if (this.params.ids.length <= 0) {
|
||||
this.$Message.warning("当前没有可审核的商品");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
this.params.applyStatus == "REFUSE" &&
|
||||
this.params.failReason === ""
|
||||
) {
|
||||
this.$Message.warning("审核拒绝理由不能为空");
|
||||
return;
|
||||
}
|
||||
this.submitLoading = true;
|
||||
auditApplySeckill(this.params).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
this.showModal = false;
|
||||
this.$Message.success("审核成功");
|
||||
this.selectList = [];
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 展示拒绝原因
|
||||
showReason(reason) {
|
||||
this.$Modal.info({
|
||||
title: "拒绝原因",
|
||||
content: reason,
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
|
|
|
@ -228,7 +228,7 @@ import {
|
|||
searchPermission,
|
||||
} from "@/api/index";
|
||||
import util from "@/libs/util.js";
|
||||
|
||||
import Cookies from "js-cookie";
|
||||
export default {
|
||||
name: "menu-manage",
|
||||
data() {
|
||||
|
@ -486,7 +486,7 @@ export default {
|
|||
if (res.success) {
|
||||
this.$Message.success("编辑成功");
|
||||
// 标记重新获取菜单数据
|
||||
this.$store.commit("setAdded", false);
|
||||
this.$store.commit('setAdded', false);
|
||||
util.initRouter(this);
|
||||
this.init();
|
||||
this.menuModalVisible = false;
|
||||
|
@ -506,7 +506,7 @@ export default {
|
|||
if (res.success) {
|
||||
this.$Message.success("添加成功");
|
||||
// 标记重新获取菜单数据
|
||||
this.$store.commit("setAdded", false);
|
||||
this.$store.commit('setAdded', false);
|
||||
util.initRouter(this);
|
||||
this.init();
|
||||
this.menuModalVisible = false;
|
||||
|
@ -579,7 +579,7 @@ export default {
|
|||
if (res.success) {
|
||||
this.$Message.success("删除成功");
|
||||
// 标记重新获取菜单数据
|
||||
this.$store.commit("setAdded", false);
|
||||
this.$store.commit('setAdded', false);
|
||||
util.initRouter(this);
|
||||
this.selectList = [];
|
||||
this.selectCount = 0;
|
||||
|
|
|
@ -111,7 +111,7 @@ import {
|
|||
saveRoleMenu,
|
||||
} from "@/api/index";
|
||||
import util from "@/libs/util.js";
|
||||
|
||||
import Cookies from "js-cookie";
|
||||
export default {
|
||||
name: "role-manage",
|
||||
data() {
|
||||
|
@ -597,7 +597,7 @@ export default {
|
|||
if (res.success) {
|
||||
this.$Message.success("操作成功");
|
||||
// 标记重新获取菜单数据
|
||||
this.$store.commit("setAdded", false);
|
||||
this.$store.commit('setAdded', false);
|
||||
util.initRouter(this);
|
||||
this.getRoleList();
|
||||
this.permModalVisible = false;
|
||||
|
|
|
@ -150,7 +150,10 @@ export const removeSeckillGoods = (seckillId, ids) => {
|
|||
export const seckillDetail = (seckillId) => {
|
||||
return getRequest(`/promotion/seckill/${seckillId}`)
|
||||
}
|
||||
|
||||
// 删除秒杀商品
|
||||
export const delSeckillGoods = params => {
|
||||
return deleteRequest(`/promotion/seckill/apply/${params.seckillId}/${params.id}`);
|
||||
};
|
||||
// 满减满赠活动列表
|
||||
export const getFullDiscountList = (params) => {
|
||||
return getRequest(`/promotion/fullDiscount`,params)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<Row class="operation">
|
||||
<template v-if="promotionStatus == 'NEW'">
|
||||
<Button type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button @click="delAll">批量删除</Button>
|
||||
<!-- <Button @click="delAll">批量删除</Button> -->
|
||||
</template>
|
||||
</Row>
|
||||
<Row class="operation">
|
||||
|
@ -98,7 +98,7 @@
|
|||
v-if="promotionStatus === 'NEW'"
|
||||
size="small"
|
||||
ghost
|
||||
@click="delGoods(index, row.id)"
|
||||
@click="delGoods(index, row)"
|
||||
>删除</Button
|
||||
>
|
||||
</template>
|
||||
|
@ -130,6 +130,7 @@ import {
|
|||
seckillGoodsList,
|
||||
seckillDetail,
|
||||
setSeckillGoods,
|
||||
delSeckillGoods
|
||||
} from "@/api/promotion.js";
|
||||
import skuSelect from "@/views/lili-dialog";
|
||||
export default {
|
||||
|
@ -170,7 +171,6 @@ export default {
|
|||
},
|
||||
],
|
||||
goodsColumns: [
|
||||
{ type: "selection", width: 60, align: "center" },
|
||||
{
|
||||
title: "商品名称",
|
||||
key: "goodsName",
|
||||
|
@ -245,8 +245,8 @@ export default {
|
|||
clearSelectAll() {
|
||||
this.$refs.table.selectAll(false);
|
||||
},
|
||||
changeSelect(e) {
|
||||
// 获取选择数据
|
||||
changeSelect(e) {
|
||||
this.selectList = e;
|
||||
this.selectCount = e.length;
|
||||
},
|
||||
|
@ -255,7 +255,6 @@ export default {
|
|||
// 获取商品详情
|
||||
this.loading = true;
|
||||
this.searchForm.seckillId = this.$route.query.id;
|
||||
|
||||
// 处理过的时间 为‘1:00’
|
||||
let hours = this.unixHours(this.data[0].hours);
|
||||
hours.forEach((e) => {
|
||||
|
@ -294,33 +293,23 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
delGoods(index) {
|
||||
delGoods(index, row) {
|
||||
// 删除商品
|
||||
if (row.promotionApplyStatus === 'PASS') {
|
||||
const params = {
|
||||
seckillId: row.seckillId,
|
||||
id: row.id
|
||||
}
|
||||
delSeckillGoods(params).then(res => {
|
||||
if (res.success) {
|
||||
this.goodsList[this.tabIndex].list.splice(index, 1);
|
||||
this.$Message.success("删除成功!");
|
||||
},
|
||||
delAll() { // 删除当前时段全部数据
|
||||
if (this.selectCount <= 0) {
|
||||
this.$Message.warning("您还未选择要删除的数据");
|
||||
return;
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: "确认删除",
|
||||
content: "您确认要删除所选的 " + this.selectCount + " 条数据?",
|
||||
onOk: () => {
|
||||
let ids = [];
|
||||
this.selectList.forEach(function (e) {
|
||||
if (e.promotionApplyStatus !== 'PASS') {
|
||||
ids.push(e.id);
|
||||
})
|
||||
} else {
|
||||
this.goodsList[this.tabIndex].list.splice(index, 1);
|
||||
this.$Message.success("删除成功!");
|
||||
}
|
||||
});
|
||||
this.goodsList[this.tabIndex].list = this.goodsList[
|
||||
this.tabIndex
|
||||
].list.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
selectedGoodsData(item) {
|
||||
// 选择器添加商品
|
||||
|
|
Loading…
Reference in New Issue