装起全部商城菜单

This commit is contained in:
2022-04-21 18:07:40 +08:00
parent 1b6f8f0ed9
commit 05fdb1d9e7
436 changed files with 50845 additions and 63 deletions
+320
View File
@@ -0,0 +1,320 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '开启砍价'" width="900px">
<el-form ref="form" :model="form" :rules="rules" :inline="true" size="small" label-width="140px">
<el-col :span="24">
<el-form-item label="选择商品:" prop="good">
<cgood v-model="form1.good" :disabled="true" ></cgood>
</el-form-item>
</el-col>
<el-form-item label="砍价名称">
<el-input v-model="form.title" style="width: 500px;" />
</el-form-item>
<el-form-item label="砍价简介">
<el-input v-model="form.info" style="width: 500px;" rows="5" type="textarea" />
</el-form-item>
<el-form-item label="单位">
<el-input v-model="form.unitName" style="width: 500px;" />
</el-form-item>
<el-form-item label="活动开始时间">
<template>
<el-date-picker
v-model="form.startTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
<el-form-item label="活动结束时间">
<template>
<el-date-picker
v-model="form.stopTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
<el-form-item label="砍价产品主图片">
<single-pic v-model="form.image" style="width: 500px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="砍价产品轮播图">
<MaterialList v-model="form.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" />
</el-form-item>
<el-form-item label="库存">
<el-input-number v-model="form.stock" maxlength="7"/>
</el-form-item>
<el-form-item label="销量">
<el-input-number v-model="form.sales" />
</el-form-item>
<el-form-item label="砍价金额">
<el-input-number v-model="form.price" />
</el-form-item>
<el-form-item label="允许砍到最低价">
<el-input-number v-model="form.minPrice" />
</el-form-item>
<el-form-item label="限购">
<el-input-number v-model="form.num" />
</el-form-item>
<el-form-item label="单次砍最高价">
<el-input-number v-model="form.bargainMaxPrice" />
</el-form-item>
<el-form-item label="单次砍最低价">
<el-input-number v-model="form.bargainMinPrice" />
</el-form-item>
<el-form-item label="用户每次砍价的次数">
<el-input-number v-model="form.bargainNum" />
</el-form-item>
<el-form-item label="砍价状态">
<el-radio v-model="form.status" :label="1">开启</el-radio>
<el-radio v-model="form.status" :label="0" style="width: 110px;">关闭</el-radio>
</el-form-item>
<el-form-item label="成本价">
<el-input-number v-model="form.cost" />
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="form.sort" />
</el-form-item>
<el-col :span="24">
<el-form-item label="运费模板:" prop="temp_id">
<div class="acea-row">
<el-select v-model="form.temp_id" class="mr20" :disabled="true">
<el-option v-for="(item,index) in templateList" :value="item.id" :key="index" :label="item.name">
</el-option>
</el-select>
</div>
</el-form-item>
</el-col>
<el-form-item label="砍价规则">
<editor v-model="form.rule" />
</el-form-item>
<el-form-item label="砍价详情">
<editor v-model="form.description" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import cgood from '@/views/components/good'
import { add, edit } from '@/api/bxg/yxStoreBargain'
import editor from '../../components/Editor'
import MaterialList from '@/components/material'
import singlePic from '@/components/singlematerial'
import { getInfo } from '@/api/bxg/yxStoreProduct'
export default {
components: { editor, MaterialList,cgood,singlePic },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
templateList: [],
form1: {
good:{
productId: null,
storeName: null,
image: null,
otPrice: null,
price: null,
}
},
form: {
//that.form.minPrice = 0
//that.form.num = 1
//that.form.bargainMaxPrice = 0
//that.form.bargainMinPrice = 0
//that.form.bargainNum = 1
id: '',
productId: '',
title: '',
image: '',
unitName: '',
stock: '',
sales: '',
images: '',
imageArr: [],
sliderImageArr: [],
startTime: '',
stopTime: '',
storeName: '',
price: '',
minPrice: 0,
num: 1,
bargainMaxPrice: 0,
bargainMinPrice: 0,
bargainNum: 1,
status: 1,
description: '',
giveIntegral: 0,
info: '',
cost: '',
sort: 0,
isHot: 0,
isDel: 0,
addTime: '',
isPostage: 1,
postage: '',
rule: '',
look: '',
share: '',
startTimeDate: '',
endTimeDate: '',
temp_id: ''
},
rules: {
}
}
},
watch: {
'form.image': function(val) {
this.form1.good.image = this.form.image
this.form1.good.productId = this.form.productId
},
'form.sliderImageArr': function(val) {
console.log("aaa:"+val)
if (val && Array.isArray(val)) {
this.form.images = val.join(',')
}
},
'form1.good.productId': {
handler(val,oldVal){
if(val){
this.getInfoChooseGood (val)
}
},
deep:true//对象内部的属性监听,也叫深度监听
},
},
methods: {
// 详情选择商品生成规格用
getInfoChooseGood (id) {
let that = this;
getInfo(id).then(async res => {
let data = res.productInfo;
console.info('data:'+JSON.stringify(data))
if(data){
let cate_id = parseInt(data.cate_id) || 0;
//that.form = data;
Object.keys(that.form).forEach(key=>{
if(data[key]) that.form[key] = data[key];
})
that.form.productId = data.id
that.form.cate_id = cate_id;
that.form.title = data.store_name
that.form.info = data.store_info
that.form.unitName = data.unit_name
that.form.imageArr = data.image
that.form.sliderImageArr = data.slider_image
that.form.status = 1
//that.form.minPrice = 0
//that.form.num = 1
//that.form.bargainMaxPrice = 0
//that.form.bargainMinPrice = 0
//that.form.bargainNum = 1
}
that.templateList = res.tempList;
}).catch(res => {
console.log('err:'+res)
return this.$message({
message:res.msg,
type: 'error'
});
})
},
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
productId: '',
title: '',
image: '',
unitName: '',
stock: '',
sales: '',
images: '',
imageArr: [],
sliderImageArr: [],
startTime: '',
stopTime: '',
storeName: '',
price: '',
minPrice: '',
num: '',
bargainMaxPrice: '',
bargainMinPrice: '',
bargainNum: '',
status: 1,
description: '',
giveIntegral: '',
info: '',
cost: '',
sort: '',
isHot: '',
isDel: '',
addTime: '',
isPostage: '',
postage: '',
rule: '',
look: '',
share: '',
temp_id: '',
}
}
}
}
</script>
<style scoped>
</style>
+185
View File
@@ -0,0 +1,185 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container" >
<div style="display: inline-block;margin: 0px 2px;">
<el-button
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="砍价产品ID" />
<el-table-column prop="title" label="砍价名称" />
<el-table-column prop="image" label="砍价图片">
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="price" label="砍价价格" />
<el-table-column prop="price" label="砍价区间">
<template slot-scope="scope">
<span>{{ scope.row.bargainMinPrice }}~{{ scope.row.bargainMaxPrice }}</span>
</template>
</el-table-column>
<el-table-column prop="minPrice" label="最低价" />
<el-table-column prop="stock" label="库存" />
<el-table-column prop="statusStr" label="砍价状态" />
<el-table-column prop="startTime" label="开始时间">
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.startTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="stopTime" label="结束时间">
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.stopTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="sales" label="销量" />
<el-table-column prop="look" label="浏览量" />
<el-table-column prop="share" label="分享量" />
<el-table-column v-if="checkPermission(['admin','YXSTOREBARGAIN_ALL','YXSTOREBARGAIN_EDIT','YXSTOREBARGAIN_DELETE'])" label="操作" width="150px" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSTOREBARGAIN_ALL','YXSTOREBARGAIN_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTOREBARGAIN_ALL','YXSTOREBARGAIN_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreBargain'
import eForm from './form'
import { formatTimeTwo, parseTime } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
parseTime,
formatTimeTwo,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreBargain'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
productId: data.productId,
title: data.title,
image: data.image,
unitName: data.unitName,
stock: data.stock,
sales: data.sales,
images: data.images,
imageArr: data.image.split(','),
sliderImageArr: data.images.split(','),
startTime: data.startTime,
stopTime: data.stopTime,
storeName: data.storeName,
price: data.price,
minPrice: data.minPrice,
num: data.num,
bargainMaxPrice: data.bargainMaxPrice,
bargainMinPrice: data.bargainMinPrice,
bargainNum: data.bargainNum,
status: data.status,
description: data.description,
giveIntegral: data.giveIntegral,
info: data.info,
cost: data.cost,
sort: data.sort,
isHot: data.isHot,
isDel: data.isDel,
addTime: data.addTime,
isPostage: data.isPostage,
postage: data.postage,
rule: data.rule,
look: data.look,
share: data.share,
startTimeDate: new Date(data.startTimeDate),
endTimeDate: new Date(data.endTimeDate)
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,124 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="用户ID">
<el-input v-model="form.uid" style="width: 370px;" />
</el-form-item>
<el-form-item label="砍价产品id">
<el-input v-model="form.bargainId" style="width: 370px;" />
</el-form-item>
<el-form-item label="砍价的最低价">
<el-input v-model="form.bargainPriceMin" style="width: 370px;" />
</el-form-item>
<el-form-item label="砍价金额">
<el-input v-model="form.bargainPrice" style="width: 370px;" />
</el-form-item>
<el-form-item label="砍掉的价格">
<el-input v-model="form.price" style="width: 370px;" />
</el-form-item>
<el-form-item label="状态 1参与中 2 活动结束参与失败 3活动结束参与成功">
<el-input v-model="form.status" style="width: 370px;" />
</el-form-item>
<el-form-item label="参与时间">
<el-input v-model="form.addTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="是否取消">
<el-input v-model="form.isDel" style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStoreBargainUser'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
uid: '',
bargainId: '',
bargainPriceMin: '',
bargainPrice: '',
price: '',
status: '',
addTime: '',
isDel: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
uid: '',
bargainId: '',
bargainPriceMin: '',
bargainPrice: '',
price: '',
status: '',
addTime: '',
isDel: ''
}
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,131 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSTOREBARGAINUSER_ALL','YXSTOREBARGAINUSER_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="用户参与砍价表ID" />
<el-table-column prop="uid" label="用户ID" />
<el-table-column prop="bargainId" label="砍价产品id" />
<el-table-column prop="bargainPriceMin" label="砍价的最低价" />
<el-table-column prop="bargainPrice" label="砍价金额" />
<el-table-column prop="price" label="砍掉的价格" />
<el-table-column prop="status" label="状态 1参与中 2 活动结束参与失败 3活动结束参与成功" />
<el-table-column prop="addTime" label="参与时间" />
<el-table-column prop="isDel" label="是否取消" />
<el-table-column v-if="checkPermission(['admin','YXSTOREBARGAINUSER_ALL','YXSTOREBARGAINUSER_EDIT','YXSTOREBARGAINUSER_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSTOREBARGAINUSER_ALL','YXSTOREBARGAINUSER_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTOREBARGAINUSER_ALL','YXSTOREBARGAINUSER_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreBargainUser'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreBargainUser'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
uid: data.uid,
bargainId: data.bargainId,
bargainPriceMin: data.bargainPriceMin,
bargainPrice: data.bargainPrice,
price: data.price,
status: data.status,
addTime: data.addTime,
isDel: data.isDel
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+763
View File
@@ -0,0 +1,763 @@
<template>
<div class="app-container">
<el-card :bordered="false">
<el-form ref="formValidate" :rules="ruleValidate" :model="formValidate" label-width="130px">
<el-row :gutter="24">
<!-- 商品信息-->
<el-col :span="24">
<el-form-item label="选择商品:" prop="good">
<cgood v-model="form1.good"></cgood>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团名称" prop="title">
<el-input v-model="formValidate.title" @input="onInput()" style="width: 500px;" placeholder="请输入拼团名称"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团简介" prop="info">
<el-input v-model="formValidate.info" @input="onInput()" style="width: 500px;" placeholder="请输入拼团简介"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单位" prop="unitName">
<el-input v-model="formValidate.unitName" @input="onInput()" style="width: 500px;" placeholder="请输入单位"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品原价">
<!-- oneFormValidate[0].cost-->
<el-input type="text" style="width: 500px;" disabled v-model="formValidate.productPrice" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团开始时间" prop="startTime">
<template>
<el-date-picker
v-model="formValidate.startTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团结束时间" prop="stopTime">
<template>
<el-date-picker
v-model="formValidate.stopTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动状态" prop="isShow">
<el-radio v-model="formValidate.isShow" :label="1">开启</el-radio>
<el-radio v-model="formValidate.isShow" :label="0" style="width: 200px;">关闭</el-radio>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="产品主图片" prop="image">
<single-pic v-model="formValidate.image" style="width: 500px" type="image" :num="1" :width="150"
:height="150"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="产品轮播图" prop="slider_image">
<MaterialList v-model="formValidate.slider_image" style="width: 500px" type="image" :num="4" :width="150"
:height="150"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团时效(小时)" prop="effectiveTime">
<el-input-number v-model="formValidate.effectiveTime" style="width: 500px;"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团人数" prop="people">
<el-input-number :min="1" :max="99" v-model="formValidate.people"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品规格:" props="spec_type">
<el-radio-group v-model="formValidate.spec_type" @change="changeSpec" :disabled="true">
<el-radio :label="0" class="radio">单规格</el-radio>
<el-radio :label="1">多规格{{ formValidate.spec_typ }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 多规格设置-->
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24"
v-if="manyFormValidate.length && formValidate.header.length!==0 && attrs.length!==0">
<!-- 多规格表格-->
<el-col :span="24">
<el-form-item label="商品属性:" class="labeltop">
<el-table :data="manyFormValidate" size="small" style="width: 90%;">
<el-table-column type="myindex" v-for="(item,index) in formValidate.header" :key="index"
:label="item.title" :property="item.slot" align="center">
<template slot-scope="scope">
<div v-if="scope.column.property == 'pic'">
<single-pic v-model="scope.row[scope.column.property]" type="image" :num="1" :width="60"
:height="60" align="center"/>
</div>
<div v-else-if="scope.column.property.indexOf('value') != -1">
{{ scope.row[scope.column.property] }}
</div>
<div v-else-if="scope.column.property == 'pink_price'||scope.column.property == 'pink_stock'">
<el-input v-model="scope.row[scope.column.property]" align="center"/>
</div>
<div v-else-if="scope.column.property == 'action'" align="center">
<a :disabled="true" align="center">不可删除</a>
</div>
<div v-else>
<el-input v-model="scope.row[scope.column.property]" :disabled="true" align="center"/>
</div>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
</el-col>
<!-- 单规格表格-->
<el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="formValidate.spec_type === 0">
<el-form-item>
<el-table :data="oneFormValidate" size="small" style="width: 90%;">
<el-table-column prop="pic" label="图片" align="center">
<template slot-scope="scope">
<single-pic v-model="scope.row.pic" type="image" :num="1" :width="60" :height="60"/>
</template>
</el-table-column>
<el-table-column prop="bar_code" label="商品编号" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.bar_code" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="price" label="售价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.price" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="cost" label="成本价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.cost" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="ot_price" label="原价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.ot_price" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="stock" label="库存" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.stock" maxlength="7" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="stock" label="拼团价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.pink_price"/>
</template>
</el-table-column>
<el-table-column prop="stock" label="拼团库存" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.pink_stock" maxlength="7"/>
</template>
</el-table-column>
<el-table-column prop="weight" label="重量(KG" align="center ">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.weight" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="体积(m³)" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.volume" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="所需兑换积分" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.integral"/>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="运费模板:" prop="temp_id">
<div class="acea-row">
<el-select v-model="formValidate.temp_id" class="mr20" :disabled="true">
<el-option v-for="(item,index) in templateList" :value="item.id" :key="index" :label="item.name">
</el-option>
</el-select>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="商品详情:">
<ueditor-wrap v-model="formValidate.description" :config="myConfig" @beforeInit="addCustomDialog"
style="width: 90%;"></ueditor-wrap>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import cgood from '@/views/components/good'
import {getInfo, isFormatAttrForActivity} from '@/api/bxg/yxStoreProduct'
import {add, edit, getCombinationInfo, onsaleCombination, delCombination} from '@/api/bxg/yxStoreCombination'
import editor from '../../components/Editor'
import picUpload from '@/components/pic-upload'
import mulpicUpload from '@/components/mul-pic-upload'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import MaterialList from '@/components/material'
import singlePic from '@/components/singlematerial'
import UeditorWrap from 'vue-ueditor-wrap';
export default {
components: {editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic, cgood},
data() {
return {
spinShow: false,
// 批量设置表格data
oneFormBatch: [
{
pic: '',
price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
pink_stock: 0,
pink_price: 0,
weight: 0,
volume: 0,
integral: 0
}
],
// 规格数据
formDynamic: {
attrsName: '',
attrsVal: ''
},
formDynamicNameData: [],
isBtn: false,
myConfig: {
autoHeightEnabled: false, // 编辑器不自动被内容撑高
initialFrameHeight: 500, // 初始容器高度
initialFrameWidth: '100%', // 初始容器宽度
UEDITOR_HOME_URL: '/UEditor/',
serverUrl: ''
},
form1: {
good: {
productId: null,
storeName: null,
image: null,
otPrice: null,
price: null,
}
},
formValidate: {
slider_image: [],
is_sub: 0,
id: 0,
combinationId: 0,
productId: '',
merId: '',
image: '',
images: '',
imageArr: [],
sliderImageArr: [],
productPrice:0,
title: '',
attr: '',
people: 1,
info: '',
price: '',
sort: 0,
integral: 0,
sales: '',
stock: '',
addTime: '',
isHost: '',
isShow: 1,
isDel: 0,
merUse: '',
isPostage: '',
postage: '',
description: '',
startTime: '',
stopTime: '',
effectiveTime: 1,
cost: '',
unitName: '',
combination: 1,
browse: 0,
startTimeDate: '',
endTimeDate: '',
spec_type: 0,
temp_id: '',
attrs: [],
items: [
{
pic: '',
price: 0,
pink_stock: 0,
pink_price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
integral: 0
}
],
header: [],
selectRule: ''
},
ruleList: [],
templateList: [],
createBnt: false,
showIput: false,
manyFormValidate: [],
// 单规格表格data
oneFormValidate: [
{
imageArr: [],
pic: '',
price: 0,
cost: 0,
ot_price: 0,
stock: 0,
pink_stock: 0,
pink_price: 0,
seckill_stock: 0,
seckill_price: 0,
bar_code: '',
weight: 0,
volume: 0,
brokerage: 0,
brokerage_two: 0,
integral: 0
}
],
images: [],
loading: false,
treeSelect: [],
tableIndex: 0,
ruleValidate: {
title: [
{required: true, message: '请输入拼团名称', trigger: 'blur'}
],
info: [
{required: true, message: '请输入拼团简介', trigger: 'blur'}
],
unitName: [
{required: true, message: '请输入单位', trigger: 'blur'}
],
startTime: [
{required: true, message: '请选择开团时间', trigger: 'blur'}
],
stopTime: [
{required: true, message: '请选择开团结束时间', trigger: 'blur'}
],
isShow: [
{required: true, message: '请选择活动状态', trigger: 'change'}
],
temp_id: [
{required: true, message: '请选择运费模板', trigger: 'change', type: 'number'}
],
price: [
{required: true, message: '请输入拼团价格', trigger: 'blur'}
],
people: [
{required: true, message: '请选择拼团人数', trigger: 'change', type: 'number'}
],
spec_type: [
{required: true, message: '请选择商品规格', trigger: 'change'}
],
effectiveTime: [
{required: true, message: '请选择拼团时效', trigger: 'blur'}
]
},
attrs: []
}
},
watch: {
// 'formValidate.imageArr': function(val) {
// if (val) {
// this.form.image = val.join(',')
// }
// },
'formValidate.slider_image': function (val) {
if (val && Array.isArray(val)) {
this.formValidate.images = val.join(',')
}
},
'form1.good.productId': {
handler(val, oldVal) {
console.info("val:" + val)
console.info("oldval:" + oldVal)
if (val) {
this.getInfoChooseGood(val)
}
},
},
},
mounted() {
this.getInfo();
},
methods: {
onInput() {
this.$forceUpdate();
},
confirm() {
let that = this;
that.createBnt = true;
if (that.formValidate.selectRule.trim().length <= 0) {
return this.$message({
message: '请选择属性',
type: 'error'
});
}
that.ruleList.forEach(function (item, index) {
if (item.ruleName === that.formValidate.selectRule) {
that.attrs = item.ruleValue;
}
});
},
// 删除表格中的属性
delAttrTable(index) {
this.manyFormValidate.splice(index, 1);
},
// 添加按钮
addBtn() {
this.clearAttr();
this.createBnt = false;
this.showIput = true;
},
// 立即生成
generate(data) {
isFormatAttrForActivity(data === null ? this.formValidate.productId : data, {attrs: this.attrs}).then(res => {
this.manyFormValidate = res.value;
let headerdel = {
title: '操作',
slot: 'action',
fixed: 'right',
width: 220
};
res.header.push(headerdel);
this.formValidate.header = res.header;
//this.formValidate.attrs = res.attr;
let header = res.header;
header.pop();
if (!this.$route.params.id && this.formValidate.spec_type === 1) {
this.manyFormValidate.map((item) => {
item.pic = this.formValidate.image
});
this.oneFormBatch[0].pic = this.formValidate.image;
}
}).catch(res => {
this.$message.error(res.msg);
})
},
// 取消
offAttrName() {
this.showIput = false;
this.createBnt = true;
},
clearAttr() {
this.formDynamic.attrsName = '';
this.formDynamic.attrsVal = '';
},
// 删除规格
handleRemoveRole(index) {
this.attrs.splice(index, 1);
this.manyFormValidate.splice(index, 1);
},
// 删除属性
handleRemove2(item, index) {
item.splice(index, 1);
},
// 添加规则名称
createAttrName() {
if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
let data = {
value: this.formDynamic.attrsName,
detail: [
this.formDynamic.attrsVal
]
};
this.attrs.push(data);
var hash = {};
this.attrs = this.attrs.reduce(function (item, next) {
hash[next.value] ? '' : hash[next.value] = true && item.push(next);
return item
}, [])
this.clearAttr();
this.showIput = false;
this.createBnt = true;
} else {
this.$message.warning('请添加完整的规格!');
}
},
// 添加属性
createAttr(num, idx) {
if (num) {
this.attrs[idx].detail.push(num);
var hash = {};
this.attrs[idx].detail = this.attrs[idx].detail.reduce(function (item, next) {
hash[next] ? '' : hash[next] = true && item.push(next);
return item
}, [])
} else {
this.$message.warning('请添加属性!');
}
},
// 改变规格
changeSpec() {
},
// 详情选择商品生成规格用
getInfoChooseGood(id) {
let that = this;
let cid = that.$route.params.id || 0;
getInfo(id == null ? 0 : id).then(async res => {
let data = res.productInfo;
if (data) {
that.attrs = data.items || [];
//that.formValidate = data;
Object.keys(that.formValidate).forEach(key => {
if (data[key]) that.formValidate[key] = data[key];
})
that.formValidate.id = cid;
//that.formValidate.id = 0;
that.formValidate.productId = id
that.formValidate.title = data.store_name
that.formValidate.info = data.store_info
that.formValidate.unitName = data.unit_name
that.formValidate.isShow = 1
// that.formValidate.people = 0
// that.formValidate.effectiveTime = 0
that.oneFormValidate = [data.attr];
that.formValidate.productPrice = that.oneFormValidate[0].cost
that.formValidate.header = [];
that.generate(null);
that.manyFormValidate = data.attrs;
if (data.spec_type === 0) {
that.manyFormValidate = [];
} else {
that.createBnt = true;
that.oneFormValidate = [
{
pic: '',
price: 0,
seckill_stock: 0,
seckill_price: 0,
pink_stock: 0,
pink_price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
weight: 0,
volume: 0,
brokerage: 0,
brokerage_two: 0
}
]
}
}
that.treeSelect = res.cateList;
that.ruleList = res.ruleList;
that.templateList = res.tempList;
}).catch(res => {
this.$message.error(res.msg);
})
},
// 详情
getInfo() {
let that = this;
let id = that.$route.params.id || 0;
that.formValidate.id = id;
getCombinationInfo(id).then(async res => {
let data = res.productInfo;
if (data) {
let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || [];
that.formValidate = data;
that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr];
that.formValidate.productPrice = that.oneFormValidate[0].cost
that.formValidate.header = [];
that.generate(data.productId);
that.manyFormValidate = data.attrs;
that.form1.good.productId = data.productId;
that.form1.good.image = data.image
if (data.spec_type === 0) {
that.manyFormValidate = [];
} else {
that.createBnt = true;
that.oneFormValidate = [
{
pic: '',
price: 0,
seckill_stock: 0,
seckill_price: 0,
pink_stock: 0,
pink_price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
weight: 0,
volume: 0,
brokerage: 0,
brokerage_two: 0
}
]
}
}
that.treeSelect = res.cateList;
that.ruleList = res.ruleList;
that.templateList = res.tempList;
}).catch(res => {
this.$message.error(res.msg);
})
},
// 提交
handleSubmit(name) {
this.$refs[name].validate((valid) => {
if (valid) {
if (this.formValidate.spec_type === 0) {
this.formValidate.attrs = this.oneFormValidate;
this.formValidate.header = [];
this.formValidate.items = [];
} else {
this.formValidate.items = this.attrs;
this.formValidate.attrs = this.manyFormValidate;
}
if (this.formValidate.spec_type === 1 && this.manyFormValidate.length === 0) {
return this.$message.warning('请点击生成规格!');
}
add(this.formValidate).then(async res => {
this.$message({
message: '操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({path: '/activity/combination'});
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
} else {
if (!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword
|| !this.formValidate.unit_name || !this.formValidate.store_info
|| !this.formValidate.image || !this.formValidate.slider_image) {
this.$message.warning("请填写完整商品信息!");
}
}
})
},
// 表单验证
validate(prop, status, error) {
if (status === false) {
this.$message.warning(error);
}
},
addCustomDialog() {
window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index',
editor: editor,
name: uiName,
title: '上传图片',
cssRules: 'width:1200px;height:500px;padding:20px;'
});
this.dialog = dialog;
var btn = new window.UE.ui.Button({
name: 'dialog-button',
title: '上传图片',
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
onclick: function () {
dialog.render();
dialog.open();
}
});
return btn;
}, 37);
},
cancel() {
this.resetForm()
}
}
}
</script>
<style scoped lang="stylus">
.submission
margin-left 10px;
.color-list .tip {
color: #c9c9c9;
}
.color-list .color-item {
height: 30px;
line-height: 30px;
padding: 0 10px;
color: #fff;
margin-right: 10px;
}
.color-list .color-item.blue {
background-color: #1E9FFF;
}
.color-list .color-item.yellow {
background-color: rgb(254, 185, 0);
}
.color-list .color-item.green {
background-color: #009688;
}
.columnsBox
margin-right 10px
.priceBox
width 100%
.rulesBox
display flex
flex-wrap: wrap;
.curs
cursor pointer
</style>
@@ -0,0 +1,187 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="toAddURL"
>
新增
</el-button>
</div>
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<!-- <eForm ref="form" :is-add="isAdd" />-->
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="id" />
<el-table-column prop="productId" label="商品id" />
<el-table-column prop="image" label="产品主图">
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="title" label="拼团名称" />
<el-table-column prop="people" label="参团人数" />
<el-table-column prop="price" label="拼团价" />
<el-table-column prop="cost" label="原价" />
<el-table-column prop="stock" label="库存" />
<el-table-column prop="browse" label="浏览量" />
<el-table-column prop="countPeopleAll" label="参与人数" />
<el-table-column prop="countPeoplePink" label="成团数量" />
<el-table-column prop="countPeopleBrowse" label="访客人数" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div @click="onSale(scope.row.id,scope.row.isShow)">
<el-tag v-if="scope.row.isShow === 1" style="cursor: pointer" :type="''">已开启</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">已关闭</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="stopTime" label="结束时间">
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.stopTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT','YXSTORECOMBINATION_DELETE'])" label="操作" width="150px" align="center" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="toUpdateURL(scope.row.id)"
>
编辑
</el-button>
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onsale } from '@/api/bxg/yxStoreCombination'
import { formatTimeTwo, parseTime } from '@/utils/index'
export default {
components: { },
mixins: [initData],
data() {
return {
delLoading: false,
queryTypeOptions: [
{ key: 'title', display_name: '活动标题' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
toAddURL(){
this.$router.push({ path: '/activity/combinationAdd' })
},
toUpdateURL(id){
this.$router.push({ path: '/activity/combinationEdit/'+id })
},
parseTime,
formatTimeTwo,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreCombination'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
onSale(id, status) {
this.$confirm(`确定进行[${status ? '下架' : '上架'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onsale(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
}
}
}
</script>
<style scoped>
</style>
+159
View File
@@ -0,0 +1,159 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="用户id">
<el-input v-model="form.uid" style="width: 370px;" />
</el-form-item>
<el-form-item label="订单id 生成">
<el-input v-model="form.orderId" style="width: 370px;" />
</el-form-item>
<el-form-item label="订单id 数据库">
<el-input v-model="form.orderIdKey" style="width: 370px;" />
</el-form-item>
<el-form-item label="购买商品个数">
<el-input v-model="form.totalNum" style="width: 370px;" />
</el-form-item>
<el-form-item label="购买总金额">
<el-input v-model="form.totalPrice" style="width: 370px;" />
</el-form-item>
<el-form-item label="拼团产品id">
<el-input v-model="form.cid" style="width: 370px;" />
</el-form-item>
<el-form-item label="产品id">
<el-input v-model="form.pid" style="width: 370px;" />
</el-form-item>
<el-form-item label="拼图总人数">
<el-input v-model="form.people" style="width: 370px;" />
</el-form-item>
<el-form-item label="拼团产品单价">
<el-input v-model="form.price" style="width: 370px;" />
</el-form-item>
<el-form-item label="开始时间">
<el-input v-model="form.addTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="stopTime">
<el-input v-model="form.stopTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="团长id 0为团长">
<el-input v-model="form.kId" style="width: 370px;" />
</el-form-item>
<el-form-item label="是否发送模板消息0未发送1已发送">
<el-input v-model="form.isTpl" style="width: 370px;" />
</el-form-item>
<el-form-item label="是否退款 0未退款 1已退款">
<el-input v-model="form.isRefund" style="width: 370px;" />
</el-form-item>
<el-form-item label="状态1进行中2已完成3未完成">
<el-input v-model="form.status" style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStorePink'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
uid: '',
orderId: '',
orderIdKey: '',
totalNum: '',
totalPrice: '',
cid: '',
pid: '',
people: '',
price: '',
addTime: '',
stopTime: '',
kId: '',
isTpl: '',
isRefund: '',
status: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
uid: '',
orderId: '',
orderIdKey: '',
totalNum: '',
totalPrice: '',
cid: '',
pid: '',
people: '',
price: '',
addTime: '',
stopTime: '',
kId: '',
isTpl: '',
isRefund: '',
status: ''
}
}
}
}
</script>
<style scoped>
</style>
+162
View File
@@ -0,0 +1,162 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column
label="序号"
type="index"
width="50"
align="center">
</el-table-column>
<el-table-column prop="uid" label="参与人" width="150" >
<template slot-scope="scope">
头像<a :href="scope.row.userImg" style="color: #42b983" target="_blank"><img :src="scope.row.userImg" alt="点击打开" class="el-avatar"></a><br>
昵称{{ scope.row.nickname }}<br>
用户ID{{ scope.row.uid }}<br>
手机号{{ scope.row.phone }}
</template>
</el-table-column>
<el-table-column prop="createTime" label="开团时间" />
<el-table-column label="拼团产品"width="200">
<template slot-scope="scope">
产品主图<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a><br>
拼团名称{{ scope.row.product }}<br>
拼团 ID{{ scope.row.cid }}
</template>
</el-table-column>
<el-table-column prop="orderId" label="订单号" width="150" />
<el-table-column prop="totalPrice" label="拼团价" />
<el-table-column prop="people" label="几人团" />
<el-table-column prop="countPeople" label="几人参加" />
<el-table-column label="结束时间">
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.stopTime) }}</span>
</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<span v-if="scope.row.status == 1">进行中</span>
<span v-else-if="scope.row.status == 2">已完成</span>
<span v-else>未完成</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStorePink'
import eForm from './form'
import { formatTimeTwo, parseTime } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
queryTypeOptions: [
{ key: 'cid', display_name: '拼团id' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
parseTime,
formatTimeTwo,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStorePink'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
uid: data.uid,
orderId: data.orderId,
orderIdKey: data.orderIdKey,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
cid: data.cid,
pid: data.pid,
people: data.people,
price: data.price,
addTime: data.addTime,
stopTime: data.stopTime,
kId: data.kId,
isTpl: data.isTpl,
isRefund: data.isRefund,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+151
View File
@@ -0,0 +1,151 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="800px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
<el-form-item label="优惠券类型">
<el-radio-group v-model="form.type" @change="couponsType">
<el-radio :label=0>通用券</el-radio>
<el-radio :label=1>商品券</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择商品" v-if="form.type == 1">
<cgood v-model="form.product" @selectGoods="getGoods"></cgood>
</el-form-item>
<el-form-item label="优惠券名称">
<el-input v-model="form.title" style="width: 300px;" />
</el-form-item>
<el-form-item label="优惠券面值">
<el-input-number v-model="form.couponPrice" style="width: 300px;" />
</el-form-item>
<el-form-item label="优惠券最低消费">
<el-input-number v-model="form.useMinPrice" style="width: 300px;" />
</el-form-item>
<el-form-item label="优惠券有效期限(天)">
<el-input-number v-model="form.couponTime" style="width: 300px;" />
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="状态">
<el-radio v-model="form.status" :label="1">开启</el-radio>
<el-radio v-model="form.status" :label="0">关闭</el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStoreCoupon'
import cgood from '@/views/components/goods'
export default {
components: { cgood },
props: {
isAdd: {
type: Boolean,
required: true
}
},
watch: {
"form.product":function(val){
if(val){
this.getGoods(val)
}
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
title: '',
integral: 0,
couponPrice: 0,
useMinPrice: 0,
couponTime: 1,
sort: 0,
status: 1,
type: 0,
productId: '',
product: []
},
rules: {
}
}
},
methods: {
getGoods(p) {
var ids = []
p.forEach((item,index) => {
ids.push(item.id)
})
this.form.productId = ids.join(",")
},
couponsType() {
//alert(this.form.type)
},
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
title: '',
integral: 0,
couponPrice: 0,
useMinPrice: 0,
couponTime: 1,
sort: 0,
status: 1,
type: 0,
productId: '',
product: []
}
}
}
}
</script>
<style scoped>
</style>
+197
View File
@@ -0,0 +1,197 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSTORECOUPON_ALL','YXSTORECOUPON_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<eIForm ref="form2" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<!--<el-table-column prop="id" label="ID"/>-->
<el-table-column prop="title" label="优惠券名称" />
<el-table-column prop="type" label="优惠券类型">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.type === 1" style="cursor: pointer" :type="''">商品券</el-tag>
<el-tag v-else :type=" 'info' ">普通券</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="couponPrice" label="优惠券面值" />
<el-table-column prop="useMinPrice" label="优惠券最低消费" />
<el-table-column label="优惠券有效期限">
<template slot-scope="scope">
<span>{{ scope.row.couponTime }}</span>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" width="100" />
<el-table-column label="状态" width="100" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">开启</el-tag>
<el-tag v-else :type=" 'info' ">关闭</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="140">
<template slot-scope="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTORECOUPON_ALL','YXSTORECOUPON_EDIT','YXSTORECOUPON_DELETE'])" width="200" label="操作" align="center">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXSTORECOUPON_ALL','YXSTORECOUPON_EDIT']"
size="mini"
type="primary"
@click="edit2(scope.row)"
>
发布
</el-button>
<el-dropdown size="mini" split-button type="primary" trigger="click">
操作
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-button
v-permission="['admin','YXSTORECOUPON_ALL','YXSTORECOUPON_EDIT']"
size="mini"
type="primary"
icon="el-icon-edit"
@click="edit(scope.row)"
>编辑</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTORECOUPON_ALL','YXSTORECOUPON_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini">删除</el-button>
</el-popover>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreCoupon'
import eForm from './form'
import eIForm from '../couponissue/form'
import { formatTime } from '@/utils/index'
export default {
components: { eForm, eIForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTime,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreCoupon'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, isDel: 0 }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
title: data.title,
integral: data.integral,
couponPrice: data.couponPrice,
useMinPrice: data.useMinPrice,
couponTime: data.couponTime,
sort: data.sort,
status: data.status,
type: data.type,
productId: data.productId,
product: data.product
}
_this.dialog = true
},
edit2(data) {
this.isAdd = true
const _this = this.$refs.form2
_this.form = {
cid: data.id,
cname: data.title,
ctype: data.type,
isPermanent: 0,
status: 1,
totalCount: 0,
remainCount: 0,
isDel: 0
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+140
View File
@@ -0,0 +1,140 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '发布优惠券'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
<el-form-item label="优惠券ID">
<el-input v-model="form.cid" style="width: 300px;" :disabled="true" />
<el-input v-model="form.ctype" type="hidden" />
</el-form-item>
<el-form-item label="优惠券名称">
<el-input v-model="form.cname" style="width: 300px;" :disabled="true" />
</el-form-item>
<el-form-item label="领取开启时间">
<template>
<el-date-picker
v-model="form.startTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
<el-form-item label="券领结束时间">
<template>
<el-date-picker
v-model="form.endTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
<el-form-item label="发布数量">
<el-input v-model="form.totalCount" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否不限量">
<el-radio v-model="form.isPermanent" :label="1">不限量</el-radio>
<el-radio v-model="form.isPermanent" :label="0">限量</el-radio>
</el-form-item>
<el-form-item label="状态">
<el-radio v-model="form.status" :label="1">开启</el-radio>
<el-radio v-model="form.status" :label="0">关闭</el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStoreCouponIssue'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
cid: '',
cname: '',
ctype: 0,
startTimeDate: '',
endTimeDate: '',
totalCount: 0,
remainCount: 0,
isPermanent: 0,
status: 1,
isDel: 0,
addTime: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
cid: '',
startTime: '',
endTime: '',
totalCount: '',
remainCount: '',
isPermanent: '',
status: '',
isDel: '',
addTime: ''
}
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,108 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '修改状态'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
<el-form-item label="状态">
<el-radio v-model="form.status" :label="1">开启</el-radio>
<el-radio v-model="form.status" :label="0">关闭</el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStoreCouponIssue'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
cid: '',
cname: '',
startTimeDate: '',
endTimeDate: '',
totalCount: 0,
remainCount: 0,
isPermanent: 0,
status: 1,
isDel: 0,
addTime: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
// console.log(this.form)
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
cid: '',
startTime: '',
endTime: '',
totalCount: '',
remainCount: '',
isPermanent: '',
status: '',
isDel: '',
addTime: ''
}
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,154 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="id" />
<el-table-column prop="ctype" label="优惠券类型">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.ctype === 1" style="cursor: pointer" :type="''">商品券</el-tag>
<el-tag v-else :type=" 'info' ">普通券</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="cname" label="优惠券名称" />
<el-table-column label="领取日期" prop="startTime">
<template slot-scope="scope">
<p>{{ formatTimeTwo(scope.row.startTime) }}</p>
<p>{{ formatTimeTwo(scope.row.endTime) }}</p>
</template>
</el-table-column>
<el-table-column label="发布数量" prop="totalCount">
<template slot-scope="scope">
<p>发布:{{ scope.row.totalCount }}</p>
<p>剩余:{{ scope.row.remainCount }}</p>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">开启</el-tag>
<el-tag v-else :type=" 'info' ">关闭</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_EDIT','YXSTORECOUPONISSUE_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreCouponIssue'
import eForm from './formt'
import { formatTimeTwo } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTimeTwo,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreCouponIssue'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
cid: data.cid,
startTime: data.startTime,
endTime: data.endTime,
startTimeDate: data.startTimeDate,
endTimeDate: data.endTimeDate,
totalCount: data.totalCount,
remainCount: data.remainCount,
isPermanent: data.isPermanent,
status: data.status,
isDel: data.isDel,
addTime: data.addTime
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,99 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="领取优惠券用户ID">
<el-input v-model="form.uid" style="width: 370px;" />
</el-form-item>
<el-form-item label="优惠券前台领取ID">
<el-input v-model="form.issueCouponId" style="width: 370px;" />
</el-form-item>
<el-form-item label="领取时间">
<el-input v-model="form.addTime" style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStoreCouponIssueUser'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
uid: '',
issueCouponId: '',
addTime: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
uid: '',
issueCouponId: '',
addTime: ''
}
}
}
}
</script>
<style scoped>
</style>
+121
View File
@@ -0,0 +1,121 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="id" />
<el-table-column prop="uid" label="领取优惠券用户ID" />
<el-table-column prop="issueCouponId" label="优惠券前台领取ID" />
<el-table-column prop="addTime" label="领取时间" />
<el-table-column v-if="checkPermission(['admin','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_EDIT','YXSTORECOUPONISSUEUSER_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreCouponIssueUser'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreCouponIssueUser'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
uid: data.uid,
issueCouponId: data.issueCouponId,
addTime: data.addTime
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+125
View File
@@ -0,0 +1,125 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="姓名">
<el-input v-model="form.realName" disabled style="width: 370px;" />
</el-form-item>
<el-form-item label="提现金额">
<el-input-number v-model="form.extractPrice" disabled style="width: 370px;" />
</el-form-item>
<el-form-item label="审核状态">
<el-radio v-model="form.status" :label="-1">无效</el-radio>
<el-radio v-model="form.status" :label="1">通过</el-radio>
</el-form-item>
<el-form-item label="无效原因">
<el-input v-model="form.failMsg" style="width: 300px;" rows="5" type="textarea" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxUserExtract'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
uid: '',
realName: '',
extractType: '',
bankCode: '',
bankAddress: '',
alipayCode: '',
extractPrice: '',
mark: '',
balance: '',
failMsg: '',
failTime: '',
addTime: '',
status: '',
wechat: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
uid: '',
realName: '',
extractType: '',
bankCode: '',
bankAddress: '',
alipayCode: '',
extractPrice: '',
mark: '',
balance: '',
failMsg: '',
failTime: '',
addTime: '',
status: '',
wechat: ''
}
}
}
}
</script>
<style scoped>
</style>
+179
View File
@@ -0,0 +1,179 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="id" />
<el-table-column prop="extractPrice" label="提现金额" />
<el-table-column prop="extractType" label="提现方式">
<template slot-scope="scope">
<div v-if="scope.row.extractType=='weixin'">
姓名:{{ scope.row.realName }}<br>
微信号:{{ scope.row.wechat }}
</div>
<div v-else>
姓名:{{ scope.row.realName }}<br>
支付宝号:{{ scope.row.alipayCode }}
</div>
</template>
</el-table-column>
<el-table-column prop="addTime" label="添加时间">
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="status" label="审核状态">
<template slot-scope="scope">
<div v-if="scope.row.status==1">
提现通过
</div>
<div v-else-if="scope.row.status==-1">
提现未通过<br>
未通过原因{{ scope.row.failMsg }}
<br>
未通过时间{{ formatTimeTwo(scope.row.failTime) }}
</div>
<div v-else>
未提现
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXUSEREXTRACT_ALL','YXUSEREXTRACT_EDIT','YXUSEREXTRACT_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXUSEREXTRACT_ALL','YXUSEREXTRACT_EDIT']"
size="mini"
type="primary"
@click="edit(scope.row)"
>操作</el-button>
<!--<el-popover-->
<!--v-permission="['admin','YXUSEREXTRACT_ALL','YXUSEREXTRACT_DELETE']"-->
<!--:ref="scope.row.id"-->
<!--placement="top"-->
<!--width="180">-->
<!--<p>确定删除本条数据吗</p>-->
<!--<div style="text-align: right; margin: 0">-->
<!--<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>-->
<!--<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>-->
<!--</div>-->
<!--<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>-->
<!--</el-popover>-->
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxUserExtract'
import eForm from './form'
import { formatTimeTwo } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
queryTypeOptions: [
{ key: 'realName', display_name: '名称' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTimeTwo,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxUserExtract'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
uid: data.uid,
realName: data.realName,
extractType: data.extractType,
bankCode: data.bankCode,
bankAddress: data.bankAddress,
alipayCode: data.alipayCode,
extractPrice: data.extractPrice,
mark: data.mark,
balance: data.balance,
failMsg: data.failMsg,
failTime: data.failTime,
addTime: data.addTime,
status: data.status,
wechat: data.wechat
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+772
View File
@@ -0,0 +1,772 @@
<template>
<div class="app-container">
<el-card :bordered="false">
<el-form ref="formValidate" :rules="ruleValidate" :model="formValidate" label-width="130px" >
<el-row :gutter="24">
<!-- 商品信息-->
<el-col :span="24">
<el-form-item label="选择商品:" prop="good">
<cgood v-model="form1.good" ></cgood>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="秒杀名称">
<el-input v-model="formValidate.title" @input="onInput()" style="width: 500px;" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="秒杀简介">
<el-input v-model="formValidate.info" @input="onInput()" style="width: 500px;" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单位">
<el-input v-model="formValidate.unitName" @input="onInput()" style="width: 500px;" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="秒杀开始时间">
<template>
<el-date-picker
v-model="formValidate.startTime"
type="date"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="秒杀结束时间">
<template>
<el-date-picker
v-model="formValidate.stopTime"
type="date"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="开始时间" prop="storeId">
<el-select v-model="formValidate.timeId" style="width: 178px" placeholder="请先选择开始时间">
<el-option
v-for="(item, index) in myTimes"
:key="index"
:label="item.map.time + '点开始,持续' + item.map.continued + '小时'"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="产品主图片">
<single-pic v-model="formValidate.image" style="width: 500px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="产品轮播图">
<MaterialList v-model="formValidate.slider_image" style="width: 500px" type="image" :num="4" :width="150" :height="150" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动状态">
<el-radio v-model="formValidate.status" :label="1">开启</el-radio>
<el-radio v-model="formValidate.status" :label="0" style="width: 200px;">关闭</el-radio>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="限购">
<el-input-number v-model="formValidate.num" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品规格:" props="spec_type">
<el-radio-group v-model="formValidate.spec_type" @change="changeSpec" :disabled="true">
<el-radio :label="0" class="radio">单规格</el-radio>
<el-radio :label="1">多规格{{formValidate.spec_typ}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 多规格设置-->
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24" v-if="manyFormValidate.length && formValidate.header.length!==0 && attrs.length!==0">
<!-- 多规格表格-->
<el-col :span="24">
<el-form-item label="商品属性:" class="labeltop">
<el-table :data="manyFormValidate" size="small" style="width: 90%;">
<el-table-column type="myindex" v-for="(item,index) in formValidate.header" :key="index" :label="item.title" :property="item.slot" align="center">
<template slot-scope="scope">
<div v-if="scope.column.property == 'pic'">
<single-pic v-model="scope.row[scope.column.property]" type="image" :num="1" :width="60" :height="60" align="center"/>
</div>
<div v-else-if="scope.column.property.indexOf('value') != -1" align="center">
{{ scope.row[scope.column.property] }}
</div>
<div v-else-if="scope.column.property == 'seckill_price'||scope.column.property == 'seckill_stock'" align="center" >
<el-input v-model="scope.row[scope.column.property]"/>
</div>
<div v-else-if="scope.column.property == 'action'" align="center" >
<a :disabled="true">不可删除</a>
</div>
<div v-else>
<el-input v-model="scope.row[scope.column.property]" :disabled="true" align="center"/>
</div>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
</el-col>
<!-- 单规格表格-->
<el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="formValidate.spec_type === 0">
<el-form-item >
<el-table :data="oneFormValidate" size="small" style="width: 90%;">
<el-table-column prop="pic" label="图片" align="center">
<template slot-scope="scope">
<single-pic v-model="scope.row.pic" type="image" :num="1" :width="60" :height="60" />
</template>
</el-table-column>
<el-table-column prop="bar_code" label="商品编号" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.bar_code" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="price" label="售价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.price":disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="cost" label="成本价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.cost" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="ot_price" label="原价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.ot_price" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="stock" label="库存" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.stock" maxlength="7" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="stock" label="秒杀价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.seckill_price" />
</template>
</el-table-column>
<el-table-column prop="stock" label="秒杀库存" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.seckill_stock" maxlength="7"/>
</template>
</el-table-column>
<el-table-column prop="weight" label="重量(KG" align="center ">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.weight" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="体积(m³)" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.volume" :disabled="true"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="所需兑换积分" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.integral"/>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="运费模板:" prop="temp_id">
<div class="acea-row">
<el-select v-model="formValidate.temp_id" class="mr20" :disabled="true">
<el-option v-for="(item,index) in templateList" :value="item.id" :key="index" :label="item.name">
</el-option>
</el-select>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="商品详情:">
<ueditor-wrap v-model="formValidate.description" :config="myConfig" @beforeInit="addCustomDialog" style="width: 90%;"></ueditor-wrap>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import cgood from '@/views/components/good'
import { initData } from '@/api/bxg/data'
import { getInfo, isFormatAttrForActivity } from '@/api/bxg/yxStoreProduct'
import { add, edit,getSecKillInfo } from '@/api/bxg/yxStoreSeckill'
import editor from '../../components/Editor'
import picUpload from '@/components/pic-upload'
import mulpicUpload from '@/components/mul-pic-upload'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import MaterialList from '@/components/material'
import singlePic from '@/components/singlematerial'
import UeditorWrap from 'vue-ueditor-wrap';
export default {
components: { editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic,cgood },
data() {
return {
isAdd:false,// 是否是添加
spinShow: false,myTimes: [],
// 批量设置表格data
oneFormBatch: [
{
pic: '',
price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
seckill_stock: 0,
seckill_price: 0,
weight: 0,
volume: 0,
integral:0
}
],
// 规格数据
formDynamic: {
attrsName: '',
attrsVal: ''
},
isBtn: false,
myConfig: {
autoHeightEnabled: false, // 编辑器不自动被内容撑高
initialFrameHeight: 500, // 初始容器高度
initialFrameWidth: '100%', // 初始容器宽度
UEDITOR_HOME_URL: '/UEditor/',
serverUrl: ''
},
form1: {
good:{
productId: null,
storeName: null,
image: null,
otPrice: null,
price: null,
cform: null
}
},
formValidate: {
slider_image: [],
otPrice: '',
giveIntegral: '',
status: '',
num: 1,
id: 0,
timeId: null,
seckillId: 0,
productId: '',
merId: '',
image: '',
images: '',
imageArr:[],
sliderImageArr: [],
title: '',
attr: '',
people: '',
info: '',
price: '',
sort: 0,
sales: '',
stock: '',
integral: 0,
addTime: '',
isHost: '',
isShow: '',
isDel: 0,
merUse: '',
isPostage: '',
postage: 0,
description: '',
startTime: '',
stopTime: '',
effectiveTime: '',
cost: '',
unitName: '',
combination: 1,
browse: 0,
startTimeDate: '',
endTimeDate: '',
is_sub: '',
spec_type: 0,
temp_id: '',
attrs: [],
items: [
{
pic: '',
price: 0,
pink_stock: 0,
pink_price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
integral: 0
}
],
header: [],
selectRule: ''
},
ruleList: [],
templateList: [],
createBnt: false,
showIput: false,
manyFormValidate: [],
// 单规格表格data
oneFormValidate: [
{
imageArr: [],
pic: '',
price: 0,
cost: 0,
ot_price: 0,
stock: 0,
pink_stock: 0,
pink_price: 0,
seckill_stock: 0,
seckill_price: 0,
bar_code: '',
weight: 0,
volume: 0,
brokerage: 0,
integral: 0,
brokerage_two: 0
}
],
images: [],
grid: {
xl: 8,
lg: 8,
md: 12,
sm: 24,
xs: 24
},
loading: false,
treeSelect: [],
tableIndex: 0,
ruleValidate: {
store_name: [
{ required: true, message: '请输入商品名称', trigger: 'blur' }
],
cate_id: [
{ required: true, message: '请选择商品分类', trigger: 'change' }
],
keyword: [
{ required: true, message: '请输入商品关键字', trigger: 'blur' }
],
unit_name: [
{ required: true, message: '请输入单位', trigger: 'blur' }
],
store_info: [
{ required: true, message: '请输入商品简介', trigger: 'blur' }
],
spec_type: [
{ required: true, message: '请选择商品规格', trigger: 'change' }
],
selectRule: [
{ required: true, message: '请选择商品规格属性', trigger: 'change' }
],
temp_id: [
{ required: true, message: '请选择运费模板', trigger: 'change', type: 'number' }
]
},
attrs: []
}
},
watch: {
'formValidate.slider_image': function(val) {
if (val && Array.isArray(val)) {
this.formValidate.images = val.join(',')
}
},
'form1.good.productId': {
handler(val,oldVal){
if(val){
this.getInfoChooseGood (val)
}
},
},
},
mounted () {
this.getInfo(),
initData('api/yxSystemGroupData',{ groupName: 'yshop_seckill_time',status:1 }).then(res => {
this.myTimes = res.content
})
if(this.$route.params.id){
this.isAdd = false
} else {
this.isAdd = true
}
},
methods: {
onInput(){
this.$forceUpdate();
},
confirm () {
let that = this;
that.createBnt = true;
if (that.formValidate.selectRule.trim().length <= 0) {
return this.$message({
message:'请选择属性',
type: 'error'
});
}
that.ruleList.forEach(function (item, index) {
if (item.ruleName === that.formValidate.selectRule) {
that.attrs = item.ruleValue;
}
});
},
// 删除表格中的属性
delAttrTable (index) {
this.manyFormValidate.splice(index, 1);
},
// 添加按钮
addBtn () {
this.clearAttr();
this.createBnt = false;
this.showIput = true;
},
// 立即生成
generate (data) {
isFormatAttrForActivity(data===null?this.formValidate.productId:data, { attrs: this.attrs }).then(res => {
this.manyFormValidate = res.value;
let headerdel = {
title: '操作',
slot: 'action',
fixed: 'right',
width: 220
};
res.header.push(headerdel);
this.formValidate.header = res.header;
//this.formValidate.attrs = res.attr;
let header = res.header;
header.pop();
if (!this.$route.params.id && this.formValidate.spec_type === 1) {
this.manyFormValidate.map((item) => {
item.pic = this.formValidate.image
});
this.oneFormBatch[0].pic = this.formValidate.image;
}
}).catch(res => {
this.$message.error(res.msg);
})
},
// 取消
offAttrName () {
this.showIput = false;
this.createBnt = true;
},
clearAttr () {
this.formDynamic.attrsName = '';
this.formDynamic.attrsVal = '';
},
// 删除规格
handleRemoveRole (index) {
this.attrs.splice(index, 1);
this.manyFormValidate.splice(index, 1);
},
// 删除属性
handleRemove2 (item, index) {
item.splice(index, 1);
},
// 添加规则名称
createAttrName () {
if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
let data = {
value: this.formDynamic.attrsName,
detail: [
this.formDynamic.attrsVal
]
};
this.attrs.push(data);
var hash = {};
this.attrs = this.attrs.reduce(function (item, next) {
hash[next.value] ? '' : hash[next.value] = true && item.push(next);
return item
}, [])
this.clearAttr();
this.showIput = false;
this.createBnt = true;
} else {
this.$message.warning('请添加完整的规格!');
}
},
// 添加属性
createAttr (num, idx) {
if (num) {
this.attrs[idx].detail.push(num);
var hash = {};
this.attrs[idx].detail = this.attrs[idx].detail.reduce(function (item, next) {
hash[next] ? '' : hash[next] = true && item.push(next);
return item
}, [])
} else {
this.$message.warning('请添加属性!');
}
},
// 改变规格
changeSpec () {
},
// 详情选择商品生成规格用
getInfoChooseGood (id) {
let that = this;
let cid = that.$route.params.id || 0;
getInfo(id).then(async res => {
let data = res.productInfo;
console.log('data:'+data)
if(data){
let cate_id = parseInt(data.cate_id) || 0;
that.attrs = data.items || [];
//that.formValidate = data;
Object.keys(that.formValidate).forEach(key=>{
if(data[key]) that.formValidate[key] = data[key];
})
that.formValidate.id = cid;
that.formValidate.productId = id
that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr];
that.formValidate.title = data.store_name
that.formValidate.info = data.store_info
that.formValidate.unitName = data.unit_name
//that.formValidate.sliderImageArr = data.slider_image
that.formValidate.status = 1
//that.formValidate.num = 1
that.formValidate.header = [];
that.generate(null);
that.manyFormValidate = data.attrs;
if(data.spec_type === 0){
that.manyFormValidate = [];
}else {
that.createBnt = true;
that.oneFormValidate = [
{
pic: '',
price: 0,
seckill_stock: 0,
seckill_price: 0,
pink_stock: 0,
pink_price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
weight:0,
volume:0,
brokerage:0,
integral: 0,
brokerage_two:0
}
]
}
}
that.treeSelect = res.cateList;
that.ruleList = res.ruleList;
that.templateList = res.tempList;
}).catch(res => {
console.log('err:'+res)
this.$message.error(res.msg);
})
},
// 详情
getInfo () {
let that = this;
let id = that.$route.params.id || 0;
getSecKillInfo(id).then(async res => {
let data = res.productInfo;
if(data){
let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || [];
that.formValidate = data;
that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr];
that.formValidate.header = [];
that.formValidate.image = data.image
that.formValidate.sliderImageArr = data.slider_image
that.form1.good.productId = data.productId
that.form1.good.image = data.image
that.generate(data.productId);
that.manyFormValidate = data.attrs;
console.log(data)
if(data.spec_type === 0){
that.manyFormValidate = [];
}else {
that.createBnt = true;
that.oneFormValidate = [
{
pic: '',
price: 0,
seckill_stock: 0,
seckill_price: 0,
pink_stock: 0,
pink_price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
weight:0,
volume:0,
brokerage:0,
integral: 0,
brokerage_two:0
}
]
}
}
that.treeSelect = res.cateList;
that.ruleList = res.ruleList;
that.templateList = res.tempList;
}).catch(res => {
this.$message.error(res.msg);
})
},
// 提交
handleSubmit (name) {
this.$refs[name].validate((valid) => {
if (valid) {
if(this.formValidate.spec_type ===0 ){
this.formValidate.attrs = this.oneFormValidate;
this.formValidate.header = [];
this.formValidate.items = [];
}else{
this.formValidate.items = this.attrs;
this.formValidate.attrs = this.manyFormValidate;
}
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){
return this.$message.warning('请点击生成规格!');
}
// 判断是否是添加
if(this.isAdd){
console.log(this.formValidate)
add(this.formValidate).then(res=>{
this.$message({
message:'操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({ path: '/activity/seckill' });
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
}else{
add(this.formValidate).then(async res => {
this.$message({
message:'操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({ path: '/activity/seckill' });
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
}
} else {
if(!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword
|| !this.formValidate.unit_name || !this.formValidate.store_info
|| !this.formValidate.image || !this.formValidate.slider_image){
this.$message.warning("请填写完整商品信息!");
}
}
})
},
// 表单验证
validate (prop, status, error) {
if (status === false) {
this.$message.warning(error);
}
},
addCustomDialog () {
window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index',
editor: editor,
name: uiName,
title: '上传图片',
cssRules: 'width:1200px;height:500px;padding:20px;'
});
this.dialog = dialog;
var btn = new window.UE.ui.Button({
name: 'dialog-button',
title: '上传图片',
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
onclick: function () {
dialog.render();
dialog.open();
}
});
return btn;
}, 37);
},
cancel() {
this.resetForm()
}
}
}
</script>
<style scoped lang="stylus">
.submission
margin-left 10px;
.color-list .tip{
color: #c9c9c9;
}
.color-list .color-item{
height: 30px;
line-height: 30px;
padding: 0 10px;
color:#fff;
margin-right :10px;
}
.color-list .color-item.blue{
background-color: #1E9FFF;
}
.color-list .color-item.yellow{
background-color: rgb(254, 185, 0);
}
.color-list .color-item.green{
background-color: #009688;
}
.columnsBox
margin-right 10px
.priceBox
width 100%
.rulesBox
display flex
flex-wrap: wrap;
.curs
cursor pointer
</style>
+151
View File
@@ -0,0 +1,151 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="toAddURL"
>
新增
</el-button>
</div>
</div>
<!--表单组件-->
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="id" />
<el-table-column prop="image" label="产品主图">
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="title" label="产品标题" />
<el-table-column prop="price" label="秒杀价" />
<el-table-column prop="otPrice" label="原价" />
<el-table-column prop="stock" label="库存" />
<el-table-column prop="sales" label="销量" />
<el-table-column prop="num" label="限购" />
<el-table-column prop="statusStr" label="秒杀状态" />
<el-table-column prop="stopTime" label="开始时间">
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.startTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="stopTime" label="结束时间">
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.stopTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTORESECKILL_ALL','YXSTORESECKILL_EDIT','YXSTORESECKILL_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="toUpdateURL(scope.row.id)"
>
编辑
</el-button>
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTORESECKILL_ALL','YXSTORESECKILL_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreSeckill'
import { formatTimeTwo, parseTime } from '@/utils/index'
export default {
mixins: [initData],
data() {
return {
delLoading: false,
queryTypeOptions: [
{ key: 'title', display_name: '产品标题' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
toAddURL(){
this.$router.push({ path: '/activity/secKillAdd' })
},
toUpdateURL(id){
this.$router.push({ path: '/activity/secKillEdit/'+id })
},
parseTime,
formatTimeTwo,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreSeckill'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,139 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="兑换的项目id">
<el-input v-model="form.cid" style="width: 370px;" />
</el-form-item>
<el-form-item label="优惠券所属用户">
<el-input v-model="form.uid" style="width: 370px;" />
</el-form-item>
<el-form-item label="优惠券名称">
<el-input v-model="form.couponTitle" style="width: 370px;" />
</el-form-item>
<el-form-item label="优惠券的面值">
<el-input v-model="form.couponPrice" style="width: 370px;" />
</el-form-item>
<el-form-item label="最低消费多少金额可用优惠券">
<el-input v-model="form.useMinPrice" style="width: 370px;" />
</el-form-item>
<el-form-item label="优惠券创建时间">
<el-input v-model="form.addTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="优惠券结束时间">
<el-input v-model="form.endTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="使用时间">
<el-input v-model="form.useTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="获取方式">
<el-input v-model="form.type" style="width: 370px;" />
</el-form-item>
<el-form-item label="状态(0:未使用,1:已使用, 2:已过期)">
<el-input v-model="form.status" style="width: 370px;" />
</el-form-item>
<el-form-item label="是否有效">
<el-input v-model="form.isFail" style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStoreCouponUser'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
cid: '',
uid: '',
couponTitle: '',
couponPrice: '',
useMinPrice: '',
addTime: '',
endTime: '',
useTime: '',
type: '',
status: '',
isFail: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
cid: '',
uid: '',
couponTitle: '',
couponPrice: '',
useMinPrice: '',
addTime: '',
endTime: '',
useTime: '',
type: '',
status: '',
isFail: ''
}
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,158 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="couponTitle" label="优惠券名称" />
<el-table-column prop="nickname" label="所属用户" />
<el-table-column prop="couponPrice" label="优惠券的面值" />
<el-table-column prop="useMinPrice" label="优惠券最低消费" />
<el-table-column label="优惠券开始时间">
<template slot-scope="scope">
{{ formatTimeTwo(scope.row.addTime) }}
</template>
</el-table-column>
<el-table-column label="优惠券结束时间">
<template slot-scope="scope">
{{ formatTimeTwo(scope.row.endTime) }}
</template>
</el-table-column>
<el-table-column label="获取方式">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.type == 'get'" style="cursor: pointer" :type="''">手动领取</el-tag>
<el-tag v-else :type=" 'info' ">后台发放</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="是否可用">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status == 0 && scope.row.isFail == 0" style="cursor: pointer" :type="''">可用</el-tag>
<el-tag v-else :type=" 'info' ">不可用</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status == 2">已过期</el-tag>
<el-tag v-if="scope.row.status == 1">已使用</el-tag>
<el-tag v-else>未使用</el-tag>
</div>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreCouponUser'
import eForm from './form'
import { formatTimeTwo } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
queryTypeOptions: [
{ key: 'couponTitle', display_name: '优惠券名称' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTimeTwo,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreCouponUser'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
cid: data.cid,
uid: data.uid,
couponTitle: data.couponTitle,
couponPrice: data.couponPrice,
useMinPrice: data.useMinPrice,
addTime: data.addTime,
endTime: data.endTime,
useTime: data.useTime,
type: data.type,
status: data.status,
isFail: data.isFail
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>