秒杀,全折扣秒杀

This commit is contained in:
faiz 2024-11-20 11:38:03 +08:00
parent 3608823914
commit f558b80a61
8 changed files with 4996 additions and 494 deletions

View File

@ -199,6 +199,36 @@ const marketingRouter =
}
]
},
{
path: 'allDiscount',
name: 'allDiscount',
meta: {
title: '全折扣秒杀',
noCache: true
},
redirect: 'noRedirect',
component: () => import('@/views/marketing/allDiscount/index'),
children: [
{
path: 'seckillConfig',
name: 'SeckillConfig',
meta: {
title: '全折扣秒杀配置',
noCache: true
},
component: () => import('@/views/marketing/allDiscount/seckillConfig/index')
},
{
path: 'list',
name: 'SpikeList',
meta: {
title: '全折扣秒杀列表',
noCache: true
},
component: () => import('@/views/marketing/allDiscount/seckillGoods/index.vue')
}
]
},
{
path: 'presell',
name: 'preSell',

View File

@ -0,0 +1,3 @@
<template>
<router-view />
</template>

View File

@ -0,0 +1,201 @@
<template>
<div class="divBox">
<div class="selCard">
<el-form size="small" label-width="85px" :inline="true">
<el-form-item label="是否显示:">
<el-select
v-model="tableFrom.status"
placeholder="请选择"
class="selWidth"
clearable
@change="getList"
>
<el-option label="显示" :value="1" />
<el-option label="不显示" :value="0" />
</el-select>
</el-form-item>
</el-form>
</div>
<el-card class="mt14">
<div class="mb14">
<el-button size="small" type="primary" @click="addSpike">添加配置</el-button>
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
size="small"
highlight-current-row
>
<el-table-column prop="seckill_time_id" label="编号" min-width="100" />
<el-table-column prop="title" label="名称" min-width="120" />
<el-table-column label="开始时间(整数小时)" min-width="120">
<template slot-scope="scope">
<span>{{ scope.row.start_time }} :00</span>
</template>
</el-table-column>
<el-table-column label="结束时间(整点)" min-width="120">
<template slot-scope="scope">
<span>{{ scope.row.end_time }} :00</span>
</template>
</el-table-column>
<el-table-column label="图片" min-width="100">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.pic"
:preview-src-list="[scope.row.pic]"
/>
</div>
</template>
</el-table-column>
<el-table-column label="是否可用" min-width="120">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="禁用"
@click.native="onchangeIsShow(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" min-width="90" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
size="small"
class="mr10"
@click="handleEdit(scope.row.seckill_time_id)"
>编辑</el-button>
<el-button type="text" size="small" @click="handleDelete(scope.row.seckill_time_id,scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
background
:page-size="tableFrom.limit"
:current-page="tableFrom.page"
layout="total, prev, pager, next, jumper"
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
/>
</div>
</el-card>
</div>
</template>
<script>
import {
spikeConfigLstApi,
spikeConfigDeleteApi,
spikeConfigurationApi,
spikeConfigUpdateApi,
spikeConfigStatusApi
} from '@/api/marketing'
import { roterPre } from '@/settings'
export default {
name: 'CouponList',
data() {
return {
Loading: false,
dialogVisible: false,
roterPre: roterPre,
listLoading: true,
tableData: {
data: [],
total: 0
},
tableFrom: {
page: 1,
limit: 20,
status: ""
},
tableFromIssue: {
page: 1,
limit: 10,
coupon_id: 0
},
issueData: {
data: [],
total: 0
}
}
},
mounted() {
this.getList()
},
methods: {
//
addSpike() {
this.$modalForm(spikeConfigurationApi().then()).then(() =>
this.getList()
)
},
//
handleEdit(id) {
this.$modalForm(spikeConfigUpdateApi(id).then()).then(() =>
this.getList()
)
},
//
handleDelete(id, idx) {
this.$modalSure().then(() => {
spikeConfigDeleteApi(id)
.then(({ message }) => {
this.$message.success(message)
this.tableData.data.splice(idx, 1)
})
.catch(({ message }) => {
this.$message.error(message)
})
})
},
handleClose() {
this.dialogVisible = false
},
//
getList() {
this.listLoading = true
console.log(this.tableFrom)
spikeConfigLstApi(this.tableFrom)
.then((res) => {
this.tableData.data = res.data.list
this.tableData.total = res.data.count
this.listLoading = false
})
.catch((res) => {
this.listLoading = false
this.$message.error(res.message)
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
},
//
onchangeIsShow(row) {
spikeConfigStatusApi(row.seckill_time_id, row.status )
.then(({ message }) => {
this.$message.success(message)
this.getList()
})
.catch(({ message }) => {
this.$message.error(message)
})
}
}
}
</script>
<style scoped lang="scss">
@import '@/styles/form.scss';
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,358 @@
<template>
<el-dialog
v-if="dialogVisible"
title="商品审核"
:visible.sync="dialogVisible"
width="900px"
:before-close="handleClose"
class="projectInfo"
>
<el-tabs v-if="projectData && isShow" v-model="activeNames" v-loading="loading">
<el-tab-pane label="商品信息" name="first">
<div class="acea-row">
<span class="sp100">商品名称{{ projectData.store_name }}</span>
<span class="sp">平台分类{{ projectData.storeCategory?projectData.storeCategory.cate_name:'' }}</span>
<span class="sp">品牌{{ projectData.brand?projectData.brand.brand_name:'' }}</span>
<span class="sp">商品关键字{{ projectData.keyword }}</span>
<span class="sp">商品单位{{ projectData.unit_name }}</span>
<span class="sp">运费模板{{ projectData.temp?projectData.temp.name:'' }}</span>
<span class="sp100">运费说明{{ projectData.temp?projectData.temp.info:'' }}</span>
<span class="sp100">
商品分类
<template v-if="projectData.merCateId">
<span v-for="(item, index) in projectData.merCateId" :key="index" class="mr10">{{ item.category?item.category.cate_name:'' }}</span>
</template>
<span v-else>-</span>
</span>
<span class="sp100">商品简介{{ projectData.store_info }}</span>
<span class="sp100">
商品封面图
<div class="demo-image__preview">
<el-image
style="width: 60px; height: 60px"
:src="projectData.image"
:preview-src-list="[projectData.image]"
/>
</div>
</span>
<span class="sp100">商品轮播图
<div
v-for="(item,index) in projectData.slider_image"
:key="index"
class="pictrue"
>
<el-image
style="width: 60px; height: 60px"
:src="item"
:preview-src-list="[item]"
/>
</div>
</span>
</div>
</el-tab-pane>
<el-tab-pane label="商品详情" name="second">
<span class="sp100">商品详情</span>
<div class="contentPic" v-html="projectData.content" />
</el-tab-pane>
<el-tab-pane label="其他设置" name="third">
<span class="sp100">商品排序{{ projectData.sort }}</span>
<span v-if="projectData.guarantee && projectData.guarantee.templateValue.length" class="third mb20">
<span>服务保障</span>
<span v-for="(item,index) in projectData.guarantee.templateValue" :key="index">
<span v-if="item.value">{{index+1}}. {{item.value.guarantee_name}}</span>
</span>
</span>
</el-tab-pane>
<el-tab-pane label="商品规格" name="fourth">
<span class="sp">商品规格{{ projectData.spec_type === 0 ? '单规格' : '多规格' }}</span>
<!-- <span class="sp">佣金设置{{ projectData.extension_type === 0 ? '默认设置' : '单独设置' }}</span> -->
<span class="sp100">
<span class="mb15" style="display: block">商品规格:</span>
<template v-if="projectData.spec_type === 0">
<el-table :data="OneattrValue" border class="tabNumWidth" size="mini">
<el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 60px; height: 60px"
:src="scope.row.image"
/>
</div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="90">
<template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" />
</template>
</el-table-column>
<!-- <template v-if="projectData.extension_type === 1">
<el-table-column align="center" label="一级返佣(元)" min-width="90">
<template slot-scope="scope">
<span class="priceBox" v-text="scope.row.extension_one" />
<el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
</template>
</el-table-column>
<el-table-column align="center" label="二级返佣(元)" min-width="90">
<template slot-scope="scope">
<span class="priceBox" v-text="scope.row.extension_two" />
<el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
</template>
</el-table-column>
</template> -->
</el-table>
</template>
<template v-if="projectData.spec_type === 1">
<el-table :data="ManyAttrValue" border class="tabNumWidth" size="mini">
<el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope">
<div class="upLoadPicBox">
<div class="pictrue tabPic"><img :src="scope.row.image"></div>
</div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="90">
<template slot-scope="scope">
<span class="priceBox">{{ scope.row[iii] }}</span>
</template>
</el-table-column>
<!-- <template v-if="projectData.extension_type === 1">
<el-table-column align="center" label="一级返佣(元)" min-width="90">
<template slot-scope="scope">
<span class="priceBox">{{ scope.row.extension_one }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="二级返佣(元)" min-width="90">
<template slot-scope="scope">
<span class="priceBox">{{ scope.row.extension_two }}</span>
</template>
</el-table-column>
</template> -->
</el-table>
</template>
</span>
</el-tab-pane>
</el-tabs>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="80px" class="demo-ruleForm">
<el-form-item label="审核状态" prop="status">
<el-radio-group v-model="ruleForm.status">
<el-radio :label="1">通过</el-radio>
<el-radio :label="-1">拒绝</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="ruleForm.status===-1" label="原因" prop="refusal">
<el-input v-model="ruleForm.refusal" type="textarea" placeholder="请输入原因" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">提交</el-button>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
import { seckillProductDetailApi, seckillProductStatusApi } from '@/api/product'
const defaultObj = {
image: '',
slider_image: [],
store_name: '',
store_info: '',
keyword: '',
brand_id: '', // id
cate_id: '', // id
mer_cate_id: [], // id
unit_name: '',
sort: 0,
is_show: 0,
is_benefit: 0,
is_new: 0,
is_good: 0,
temp_id: '',
attrValue: [{
image: '',
price: null,
cost: null,
ot_price: null,
stock: null,
bar_code: '',
weight: null,
volume: null
}],
attr: [],
selectRule: '',
extension_type: 0,
content: '',
spec_type: 0
}
const objTitle = {
price: {
title: '售价'
},
cost: {
title: '成本价'
},
ot_price: {
title: '市场价'
},
stock: {
title: '库存'
},
bar_code: {
title: '商品编号'
},
weight: {
title: '重量KG'
},
volume: {
title: '体积(m³)'
}
}
const proOptions = [{ name: '热门榜单', value: 'is_hot' }, { name: '特惠专区', value: 'is_benefit' }, { name: '精品推荐', value: 'is_best' }, { name: '首发新品', value: 'is_new' }]
export default {
name: 'Info',
props: {
isShow: {
type: Boolean,
default: true
},
ids: {
type: Array,
default: () => []
}
},
data() {
return {
rules: {
status: [
{ required: true, message: '请选择审核状态', trigger: 'change' }
],
refusal: [
{ required: true, message: '请填写拒绝原因', trigger: 'blur' }
]
},
proId: 0,
ruleForm: {
refusal: '',
status: 1,
id: ''
},
formThead: Object.assign({}, objTitle),
manyTabDate: {},
manyTabTit: {},
loading: false,
dialogVisible: false,
activeNames: 'first',
projectData: {},
recommend: proOptions,
OneattrValue: [Object.assign({}, defaultObj.attrValue[0])], //
ManyAttrValue: [Object.assign({}, defaultObj.attrValue[0])] //
}
},
computed: {
attrValue() {
const obj = Object.assign({}, defaultObj.attrValue[0])
delete obj.image
return obj
},
oneFormBatch() {
const obj = [Object.assign({}, defaultObj.attrValue[0])]
delete obj[0].bar_code
return obj
}
},
methods: {
onSubmit() {
this.isShow ? this.ruleForm.id = this.proId : this.ruleForm.id = this.ids
seckillProductStatusApi(this.ruleForm).then(res => {
this.$message.success(res.message)
this.dialogVisible = false
this.activeNames = 'first'
this.$emit('subSuccess')
}).catch(res => {
this.listLoading = false
this.$message.error(res.message)
})
},
handleClose() {
this.dialogVisible = false
this.activeNames = 'first'
},
getInfo(id) {
this.proId = id
this.loading = true
seckillProductDetailApi(id).then(res => {
this.projectData = res.data
if (this.projectData.spec_type === 0) {
this.OneattrValue = res.data.attrValue
} else {
this.ManyAttrValue = res.data.attrValue
}
const tmp = {}
const tmpTab = {}
this.projectData.attr.forEach((o, i) => {
tmp['value' + i] = { title: o.value }
tmpTab['value' + i] = ''
})
this.manyTabDate = tmpTab
this.formThead = Object.assign({}, this.formThead, tmp)
this.loading = false
}).catch(res => {
this.$message.error(res.message)
this.loading = false
})
}
}
}
</script>
<style scoped lang="scss">
.projectInfo ::v-deep .el-tabs__content{
padding-left: 10px !important;
}
.projectInfo ::v-deep .el-dialog__body{
padding-top: 0 !important;
}
.tabPic{
width: 40px !important;
height: 40px !important;
img{
width: 100%;
height: 100%;
}
}
.sp {
display: block;
width: 33%;
margin-bottom: 20px;
}
.sp100 {
width: 100%;
margin-bottom: 15px;
display: inline-block;
}
.third{
width: 100%;
display: flex;
}
.pictrue {
width: 60px;
height: 60px;
border: 1px dotted rgba(0, 0, 0, 0.1);
margin-right: 10px;
position: relative;
cursor: pointer;
display: inline-block;
img {
width: 100%;
height: 100%;
}
}
.demo-image__preview{
display: inline-block;
}
.contentPic{
text-align: center;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff