圣诞快乐

# v1.3 更新列表
    1. 【新增】砍价
	2. 【新增】拼团
	3. 【新增】一号通
	4. 【修复】商品sku 编辑时出现商品属性对应错误的问题
	5. 【修复】商品推广海报生成二维码可能会出错的问题【小程序调试中】
	6. 【修复】微信公众号和小程序头像可能获取不到的问题
	7. 【修复】下单时可能会出错的问题
	8. 【修复】pc管理端用户访问量
	9. 【修复】微信退款
	10. 【修复】管理端订单状态可能出现不正确的情况
	11. 【修复】WEB管理端-菜单色调,短信API更新,首页用户访问量,系统设置tab是自动选择下一及表单
	12. 【修复】系统设置出现更新不正确的问题
This commit is contained in:
337031187
2020-12-23 15:56:45 +08:00
parent 61c394c7ba
commit 451f8a765e
768 changed files with 40200 additions and 46123 deletions

View File

@@ -0,0 +1,869 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-steps :active="currentTab" align-center finish-status="success">
<el-step title="选择秒杀商品" />
<el-step title="填写基础信息" />
<el-step title="修改商品详情" />
</el-steps>
</div>
<el-form
ref="formValidate"
v-loading="fullscreenLoading"
class="formValidate mt20"
:rules="ruleValidate"
:model="formValidate"
label-width="150px"
@submit.native.prevent
>
<!-- 砍价商品-->
<div v-show="currentTab === 0">
<el-form-item label="选择商品:" prop="image">
<div class="upLoadPicBox" @click="changeGood">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont"/>
</div>
</div>
</el-form-item>
</div>
<!-- 商品信息-->
<div v-show="currentTab === 1">
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="商品主图:" prop="image">
<div class="upLoadPicBox" @click="modalPicTap('1')">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品轮播图:" prop="images">
<div class="acea-row">
<div
v-for="(item,index) in formValidate.imagess"
:key="index"
class="pictrue"
draggable="true"
@dragstart="handleDragStart($event, item)"
@dragover.prevent="handleDragOver($event, item)"
@dragenter="handleDragEnter($event, item)"
@dragend="handleDragEnd($event, item)"
>
<img :src="item">
<i class="el-icon-error btndel" @click="handleRemove(index)" />
</div>
<div v-if="formValidate.imagess.length<10" class="upLoadPicBox" @click="modalPicTap('2')">
<div class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价活动名称:" prop="title">
<el-input v-model="formValidate.title" placeholder="请输入商品名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价活动简介:">
<el-input v-model="formValidate.info" maxlength="250" type="textarea" :rows="3" placeholder="请输入商品简介" />
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="单位:" prop="unitName">
<el-input v-model="formValidate.unitName" placeholder="请输入单位" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="排序:" prop="sort">
<el-input v-model="formValidate.sort" placeholder="请输入排序" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动时间:">
<el-date-picker
class="mr20"
v-model="timeVal"
type="daterange"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="onchangeTime">
</el-date-picker>
<span>设置活动开启结束时间用户可以在设置时间内发起参与砍价</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价人数:" prop="peopleNum">
<el-input-number v-model="formValidate.peopleNum" :min="1" :step="1" step-strictly step-strictly placeholder="请输入砍价人数" class="selWidthd mr20"/>
<span>需邀请多少人砍价成功</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="帮砍次数:" prop="bargainNum">
<el-input-number v-model="formValidate.bargainNum" :min="1" :step="1" step-strictly placeholder="请输入帮砍次数" class="selWidthd mr20"/>
<span>单个商品用户可以帮砍的次数次数设置为1甲和乙同时将商品A的砍价链接发给丙丙只能帮甲或乙其中一个人砍价</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="购买数量限制:" prop="num">
<el-input-number v-model="formValidate.num" :min="1" :step="1" step-strictly placeholder="请输入购买数量限制" class="selWidthd mr20"/>
<span>单个活动每个用户发起砍价次数限制</span>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="运费模板:" prop="tempId">
<div class="acea-row">
<el-select v-model="formValidate.tempId" placeholder="请选择" class="selWidthd">
<el-option
v-for="item in shippingList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<!--<el-button class="mr15" @click="addTem">添加运费模板</el-button>-->
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动状态:" required>
<el-radio-group v-model="formValidate.status">
<el-radio :label="0" class="radio">关闭</el-radio>
<el-radio :label="1">开启</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 规格表格-->
<el-col :span="24">
<el-form-item label="商品属性:" class="labeltop" required>
<el-table
ref="multipleTable"
:data="formValidate.ManyAttrValue"
tooltip-effect="dark"
style="width: 100%">
<el-table-column label="选择" min-width="60">
<template slot-scope="scope">
<el-radio v-model="radio" :label="scope.row"
@change.native="changeType(scope.row)"
>&nbsp;
</el-radio>
</template>
</el-table-column>
<template v-if="manyTabDate && formValidate.specType">
<el-table-column v-for="(item,iii) in manyTabDate" :key="iii" align="center" :label="manyTabTit[iii].title" min-width="80">
<template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" />
</template>
</el-table-column>
</template>
<el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope">
<div class="upLoadPicBox" @click="modalPicTap('1','duo',scope.$index)">
<div v-if="scope.row.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
<div v-else class="upLoad tabPic">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="140">
<template slot-scope="{row,$index}">
<template v-if="formThead[iii].title === '砍价起始金额'">
<el-form-item
:prop="`multipleSelection.${$index}.price`"
:rules="ruleValidate.price"
class="inpBox"
>
<el-input-number
size="small"
v-model="row[iii]"
:min="0"
:precision="2" :step="0.1"
class="priceBox"
/>
</el-form-item>
</template>
<template v-else-if="formThead[iii].title === '砍价最低价'">
<el-form-item
:prop="`ManyAttrValue.${$index}.minPrice`"
:rules="ruleValidate.minPrice"
class="inpBox"
>
<el-input-number
size="small"
v-model="row[iii]"
:min="0"
:max="parseFloat(row.price)"
:precision="2" :step="0.1"
class="priceBox"
/>
</el-form-item>
</template>
<template v-else-if="formThead[iii].title === '限量'">
<el-form-item
:prop="`ManyAttrValue.${$index}.quota`"
:rules="ruleValidate.quota"
class="inpBox"
>
<el-input-number
size="small"
v-model="row[iii]"
type="number"
:min="1"
:max="row.stock"
:step="1" step-strictly
class="priceBox"
@change="inpChange(row[iii], row.id)"
/>
</el-form-item>
</template>
<span v-else v-text="row[iii]" class="priceBox" />
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
</el-row>
</div>
<!-- 商品详情-->
<div v-show="currentTab === 2">
<el-form-item label="商品详情:">
<ueditor-from v-model="formValidate.content" :content="formValidate.content" />
</el-form-item>
<el-form-item label="商品规则:">
<ueditor-from v-model="formValidate.rule" :content="formValidate.rule" />
</el-form-item>
</div>
<el-form-item style="margin-top:30px;">
<el-button
v-show="(!$route.params.id && currentTab > 0) || ($route.params.id && currentTab===2)"
type="primary"
class="submission"
size="small"
@click="handleSubmitUp"
>上一步</el-button>
<el-button
v-show="currentTab == 0"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest1('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab == 1"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest2('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab===2"
:loading="loading"
type="primary"
class="submission"
size="small"
@click="handleSubmit('formValidate')"
>提交</el-button>
</el-form-item>
</el-form>
</el-card>
<CreatTemplates ref="addTemplates" @getList="getShippingList" />
</div>
</template>
<script>
import { productDetailApi, categoryApi } from '@/api/store'
import { shippingTemplatesList } from '@/api/logistics'
import { getSeckillList } from '@/libs/public'
import { bargainSaveApi, bargainUpdateApi, bargainInfoApi } from '@/api/marketing'
import CreatTemplates from '@/views/systemSetting/logistics/shippingTemplates/creatTemplates'
const defaultObj = {
image: '',
images: '',
imagess: [],
title: '',
info: '',
num: 1,
unitName: '',
sort: 0,
giveIntegral: 0,
ficti: 0,
isShow: false,
tempId: '',
attrValue: [{
image: '',
price: 0,
minPrice: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}],
attr: [],
selectRule: '',
content: '',
specType: false,
id: 0,
// productId: 0,
timeId: '',
startTime: '',
stopTime: '',
timeVal: [],
status: 0,
rule: '',
ManyAttrValue: [{
image: '',
price: 0,
minPrice: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}], // 多规格
multipleSelection: [{
image: '',
price: 0,
minPrice: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}]
}
const objTitle = {
price: {
title: '砍价起始金额'
},
minPrice: {
title: '砍价最低价'
},
cost: {
title: '成本价'
},
otPrice: {
title: '原价'
},
stock: {
title: '库存'
},
quota: {
title: "限量",
},
weight: {
title: '重量KG'
},
volume: {
title: '体积(m³)'
},
barCode: {
title: '商品编号'
}
}
export default {
name: "creatSeckill",
components: { CreatTemplates },
data() {
return {
props2: {
children: 'child',
label: 'name',
value: 'id',
multiple: true,
emitPath: false
},
grid2: {
xl: 8,
lg: 10,
md: 12,
sm: 24,
xs: 24
},
currentTab: 0,
formThead: Object.assign({}, objTitle),
formValidate: {},
loading: false,
fullscreenLoading: false,
merCateList: [], // 商户分类筛选
shippingList: [], // 运费模板
seckillTime: [],
ruleValidate: {
productId: [
{ required: true, message: '请选择商品', trigger: 'change' }
],
title: [
{ required: true, message: '请输入商品标题', trigger: 'blur' }
],
attrValue: [
{ required: true, message: '请选择商品属相', trigger: 'change', type: 'array', min: '1' }
],
num: [
{ required: true, message: '请输入购买数量限制', trigger: 'blur' }
],
unitName: [
{ required: true, message: '请输入单位', trigger: 'blur' }
],
info: [
{ required: true, message: '请输入秒杀商品简介', trigger: 'blur' }
],
tempId: [
{ required: true, message: '请选择运费模板', trigger: 'change' }
],
timeId: [
{ required: true, message: '请选择活动时间', trigger: 'change' }
],
image: [
{ required: true, message: '请上传商品图', trigger: 'change' }
],
imagess: [
{ required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }
],
specType: [
{ required: true, message: '请选择商品规格', trigger: 'change' }
],
timeVal:[
{ required: true, message: '请选择活动日期', trigger: 'change', type: 'array'}
],
bargainNum:[
{ required: true, message: '请输入帮砍次数', trigger: 'blur'}
],
peopleNum: [
{ required: true, message: '请输入砍价人数', trigger: 'blur'}
],
price: [
{ required: true, message: '请输入砍价起始金额', trigger: 'blur'}
],
minPrice: [
{ required: true, message: '请输入砍价最低金额', trigger: 'blur'}
],
quota: [
{ required: true, message: '请输入限量', trigger: 'blur'}
]
},
manyTabDate: {},
manyTabTit: {},
attrInfo: {},
tempRoute: {},
multipleSelection: [Object.assign({}, defaultObj.attrValue[0])],
productId: 0,
timeVal: [],
radio: '',
ManyAttrValue: [Object.assign({}, defaultObj.attrValue[0])], // 多规格
}
},
computed: {
attrValue() {
const obj = Object.assign({}, defaultObj.attrValue[0])
delete obj.image
return obj
}
},
created() {
this.$watch('formValidate.attr', this.watCh)
this.tempRoute = Object.assign({}, this.$route)
},
mounted() {
getSeckillList(1).then((res) => {
this.seckillTime = res.list
})
this.formValidate.imagess = []
if ( this.$route.params.id ) {
this.setTagsViewTitle()
this.getInfo()
this.currentTab = 1
}
this.getShippingList()
this.getCategorySelect()
},
methods: {
changeType(row, index){
row.checked = true;
this.formValidate.multipleSelection = [row];
},
inpChange(currentValue, id){
// this.ManyAttrValue.map(item => {
// if(!currentValue && item.id ===id){
// item.quota = 1
// this.$set(item, 'quota', 1)
// this.ManyAttrValue = Object.assign([], this.ManyAttrValue)
// }
// })
console.log(this.ManyAttrValue)
// if(!currentValue) item.quota = 1
},
watCh(val) {
const tmp = {}
const tmpTab = {}
this.formValidate.attr.forEach((o, i) => {
tmp['value' + i] = { title: o.attrName }
tmpTab['value' + i] = ''
})
this.manyTabTit = tmp
this.manyTabDate = tmpTab
this.formThead = Object.assign({}, this.formThead, tmp)
},
handleRemove (i) {
this.formValidate.imagess.splice(i, 1)
},
// 点击商品图
modalPicTap (tit, num, i) {
const _this = this
this.$modalUpload(function(img) {
if(tit==='1'&& !num){
_this.formValidate.image = img[0].sattDir
_this.formValidate.ManyAttrValue[0].image = img[0].sattDir
}
if(tit==='2'&& !num){
if(img.length>10) return this.$message.warning("最多选择10张图片");
if(img.length + _this.formValidate.imagess.length > 10) return this.$message.warning("最多选择10张图片");
img.map((item) => {
_this.formValidate.imagess.push(item.sattDir)
});
}
if(tit==='1'&& num === 'duo' ){
_this.specType ? _this.formValidate.ManyAttrValue[i].image = img[0].sattDir : _this.formValidate.ManyAttrValue[0].image = img[0].sattDir
}
},tit, 'content')
},
// 具体日期
onchangeTime(e) {
this.formValidate.timeVal = e;
this.formValidate.startTime = e ? e[0] : "";
this.formValidate.stopTime = e ? e[1] : "";
},
changeGood(){
const _this = this
this.$modalGoodList(function(row) {
_this.formValidate.image = row.image
_this.productId = row.id
// _this.formValidate.productId = row.id
})
},
handleSubmitNest1() {
if (!this.formValidate.image) {
this.$message.warning("请选择商品!");
return;
} else {
this.currentTab++;
if (!this.$route.params.id) this.getProdect(this.productId);
}
},
// 商品分类;
getCategorySelect() {
categoryApi({ status: -1, type: 1 }).then(res => {
this.merCateList = this.filerMerCateList(res)
})
},
filerMerCateList(treeData) {
return treeData.map((item) => {
if(!item.child){
item.disabled = true
}
item.label = item.name
return item
})
},
// 运费模板;
getShippingList() {
shippingTemplatesList(this.tempData).then(res => {
this.shippingList = res.list
})
},
// 运费模板
addTem() {
this.$refs.addTemplates.dialogVisible = true
this.$refs.addTemplates.getCityList()
},
// 商品详情
getInfo () {
if(!this.$route.params.id){
this.getProdect(this.productId)
}else{
this.getSekllProdect(this.$route.params.id)
}
},
getProdect(id) {
this.fullscreenLoading = true
productDetailApi(id).then(async res => {
let info = res
this.formValidate = info;
this.formValidate.imagess = JSON.parse(info.sliderImage);
this.formValidate.title = info.storeName;
this.formValidate.proName = info.storeName;
this.formValidate.info = info.storeInfo;
this.formValidate.productId = info.id;
this.formValidate.timeId = this.$route.params.id ? Number(info.timeId) : this.$route.params.timeId ? Number(this.$route.params.timeId) : '';
this.formValidate.startTime = info.startTime || '';
this.formValidate.stopTime = info.stopTime || '';
this.formValidate.timeVal = [];
this.formValidate.status = 0;
this.formValidate.num = 1;
this.formValidate.rule = '';
this.formValidate.peopleNum = 1;
this.formValidate.bargainNum = 1;
if(info.specType){
info.attrValues.forEach((row) => {
row.quota = row.stock;
});
this.formValidate.ManyAttrValue = info.attrValues
this.multipleSelection = info.attrValues
}else{
info.attrValue.forEach((row) => {
row.quota = row.stock;
});
this.formValidate.ManyAttrValue = info.attrValue
this.radio = info.attrValue[0]
this.formValidate.attr = []
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
getSekllProdect(id) {
this.fullscreenLoading = true
bargainInfoApi({id:id}).then(async res => {
let info = res;
this.formValidate = info;
this.formValidate.proName = info.title;
this.formValidate.imagess = JSON.parse(info.sliderImage);
this.formValidate.timeId = Number(info.timeId);
this.timeVal = info.startTime && info.stopTime ? [info.startTime, info.stopTime] : []
if(info.specType){
this.formValidate.ManyAttrValue = info.attrValues;
this.$nextTick(() => {
this.formValidate.ManyAttrValue.forEach((item, index) => {
if (item.checked) {
this.$set(item, 'price', item.price)
this.$set(item, 'quota', item.quota)
this.radio = item
}
})
});
}else{
this.formValidate.ManyAttrValue = info.attrValue;
this.formValidate.attr = [];
this.radio = info.attrValue[0];
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
handleSubmitNest2(name) {
this.$refs[name].validate((valid) => {
if (valid) {
if(this.formValidate.specType && this.multipleSelection.length ===0 ) return this.$message.warning("请选择至少一个商品属性!");
return this.$message.warning("请填写完整信息!");
this.currentTab++;
// this.multipleSelection.every((value, index) => {
// if(!value.quota){
// this.$message.warning("请填选择至少一个商品属性!");
// return false;
// }else{
// this.currentTab++;
// return true;
// }
// });
// for(i = 0; i < this.multipleSelection.length; i++){
// if(!this.multipleSelection[i].quota){
// break;
// }else{
// this.currentTab++;
// }
// }
} else {
return false;
}
});
},
// 提交
handleSubmit(name) {
if(!this.formValidate.specType){
this.formValidate.attr = []
this.formValidate.attrValue = this.formValidate.ManyAttrValue
}else{
this.formValidate.attrValue = this.multipleSelection
}
this.formValidate.images = JSON.stringify(this.formValidate.imagess)
this.$refs[name].validate((valid) => {
if (valid) {
this.fullscreenLoading = true;
this.loading = true;
this.$route.params.id
? bargainUpdateApi({id: this.$route.params.id}, this.formValidate)
.then(async () => {
this.fullscreenLoading = false;
this.$message.success('编辑成功');
this.$router.push({
path: "/marketing/bargain/bargainGoods",
});
this.$refs[name].resetFields();
this.formValidate.images = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
})
: bargainSaveApi(this.formValidate)
.then(async (res) => {
this.fullscreenLoading = false;
this.$message.success('新增成功');
this.$router.push({
path: "/marketing/bargain/bargainGoods",
});
this.$refs[name].resetFields();
this.formValidate.images = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
});
} else {
if (
!this.formValidate.storeName ||
!this.formValidate.unitName ||
!this.formValidate.store_info ||
!this.formValidate.image ||
!this.formValidate.images
) {
this.$message.warning("请填写完整商品信息!");
}
}
});
},
handleSubmitUp() {
if (this.currentTab-- < 0) this.currentTab = 0;
},
setTagsViewTitle() {
const title = '编辑秒杀商品'
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.$route.params.id}` })
this.$store.dispatch('tagsView/updateVisitedView', route)
},
}
}
</script>
<style scoped lang="scss">
.inpBox{
/deep/.el-form-item__error {
line-height: 20px !important;
position: static !important;
}
}
.labeltop{
/deep/.el-input-number--small{
/*width: 172px !important;*/
min-width: 132px !important;
}
}
.proCoupon{
/deep/.el-form-item__content{
margin-top: 5px;
}
}
.tabPic{
width: 40px !important;
height: 40px !important;
img{
width: 100%;
height: 100%;
}
}
.noLeft{
/deep/.el-form-item__content{
margin-left: 0 !important;
}
}
.tabNumWidth{
/deep/.el-input-number--medium{
width: 121px !important;
}
/deep/.el-input-number__increase{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number__decrease{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number--medium .el-input__inner {
padding-left: 25px !important;
padding-right: 25px !important;
}
/deep/ thead{
line-height: normal !important;
}
/deep/ .el-table .cell{
line-height: normal !important;
}
}
.selWidth{
width: 80%;
}
.selWidthd{
width: 350px;
}
.button-new-tag {
height: 28px;
line-height: 26px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.pictrue{
width: 60px;
height: 60px;
border: 1px dotted rgba(0,0,0,0.1);
margin-right: 10px;
position: relative;
cursor: pointer;
img{
width: 100%;
height: 100%;
}
}
.btndel{
position: absolute;
z-index: 1;
width :20px !important;
height: 20px !important;
left: 46px;
top: -4px;
}
.labeltop{
/deep/.el-form-item__label{
/*float: none !important;*/
/*display: inline-block !important;*/
/*margin-left: 120px !important;*/
/*width: auto !important;*/
}
}
</style>

View File

@@ -0,0 +1,865 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-steps :active="currentTab" align-center finish-status="success">
<el-step title="选择砍价商品" />
<el-step title="填写基础信息" />
<el-step title="修改商品详情" />
</el-steps>
</div>
<el-form
ref="formValidate"
v-loading="fullscreenLoading"
class="formValidate mt20"
:rules="ruleValidate"
:model="formValidate"
label-width="150px"
@submit.native.prevent
>
<!-- 砍价商品-->
<div v-show="currentTab === 0">
<el-form-item label="选择商品:" prop="image">
<div class="upLoadPicBox" @click="changeGood">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont"/>
</div>
</div>
</el-form-item>
</div>
<!-- 商品信息-->
<div v-show="currentTab === 1">
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="商品主图:" prop="image">
<div class="upLoadPicBox" @click="modalPicTap('1')">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品轮播图:" prop="images">
<div class="acea-row">
<div
v-for="(item,index) in formValidate.imagess"
:key="index"
class="pictrue"
draggable="true"
@dragstart="handleDragStart($event, item)"
@dragover.prevent="handleDragOver($event, item)"
@dragenter="handleDragEnter($event, item)"
@dragend="handleDragEnd($event, item)"
>
<img :src="item">
<i class="el-icon-error btndel" @click="handleRemove(index)" />
</div>
<div v-if="formValidate.imagess.length<10" class="upLoadPicBox" @click="modalPicTap('2')">
<div class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价活动名称:" prop="title">
<el-input v-model="formValidate.title" maxlength="249" placeholder="请输入砍价活动名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价活动简介:" prop="info">
<el-input v-model="formValidate.info" maxlength="250" type="textarea" :rows="3" placeholder="请输入砍价活动简介" />
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="单位:" prop="unitName">
<el-input v-model="formValidate.unitName" placeholder="请输入单位" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="排序:" prop="sort">
<el-input-number v-model="formValidate.sort" :max="9999" placeholder="请输入排序" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动日期:" prop="timeVal">
<el-date-picker
class="mr20"
v-model="formValidate.timeVal"
type="daterange"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
@change="onchangeTime">
</el-date-picker>
<span>设置活动开启结束时间用户可以在设置时间内发起参与砍价</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价人数:" prop="peopleNum">
<el-input-number v-model="formValidate.peopleNum" :min="2" :step="1" step-strictly step-strictly placeholder="请输入砍价人数" class="selWidthd mr20"/>
<span>需邀请多少人砍价成功</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="帮砍次数:" prop="bargainNum">
<el-input-number v-model="formValidate.bargainNum" :min="1" :step="1" step-strictly placeholder="请输入帮砍次数" class="selWidthd mr20"/>
<span>单个商品用户可以帮砍的次数次数设置为1甲和乙同时将商品A的砍价链接发给丙丙只能帮甲或乙其中一个人砍价</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="购买数量限制:" prop="num">
<el-input-number v-model="formValidate.num" :min="1" :step="1" step-strictly placeholder="请输入购买数量限制" class="selWidthd mr20"/>
<span>单个活动每个用户发起砍价次数限制</span>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="运费模板:" prop="tempId">
<div class="acea-row">
<el-select v-model="formValidate.tempId" placeholder="请选择" class="selWidthd">
<el-option
v-for="item in shippingList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<!--<el-button class="mr15" @click="addTem">添加运费模板</el-button>-->
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动状态:" required>
<el-radio-group v-model="formValidate.status">
<el-radio :label="0" class="radio">关闭</el-radio>
<el-radio :label="1">开启</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 规格表格-->
<el-col :span="24">
<el-form-item label="商品属性:" class="labeltop" required>
<el-table
ref="multipleTable"
:data="ManyAttrValue"
tooltip-effect="dark"
style="width: 100%">
<el-table-column label="选择" width="50">
<template slot-scope="scope">
<el-radio v-model="radio" :label="scope.row"
@change.native="changeType(scope.row)"
>&nbsp;
</el-radio>
</template>
</el-table-column>
<template v-if="manyTabDate && formValidate.specType">
<el-table-column v-for="(item,iii) in manyTabDate" :key="iii" align="center" :label="manyTabTit[iii].title" min-width="80">
<template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" />
</template>
</el-table-column>
</template>
<el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope">
<div class="upLoadPicBox" @click="modalPicTap('1','duo',scope.$index)">
<div v-if="scope.row.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
<div v-else class="upLoad tabPic">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="140">
<template slot-scope="{row,$index}">
<el-input-number
v-if="formThead[iii].title === '砍价起始金额'"
size="small"
v-model="row[iii]"
:min="0"
:precision="2" :step="0.1"
class="priceBox"
/>
<el-input-number
size="small"
v-else-if="formThead[iii].title === '砍价最低价'"
v-model="row[iii]"
:min="0"
:max="parseFloat(row.price)"
:precision="2" :step="0.1"
class="priceBox"
/>
<el-input-number
size="small"
v-else-if="formThead[iii].title === '限量'"
v-model="row[iii]"
type="number"
:min="1"
:max="row.stock"
:step="1" step-strictly
class="priceBox"
@change="inpChange(row[iii], row.id)"
/>
<span v-else v-text="row[iii]" class="priceBox" />
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
</el-row>
</div>
<!-- 商品详情-->
<div v-show="currentTab === 2">
<el-form-item label="商品详情:">
<ueditor-from v-model="formValidate.content" :content="formValidate.content" />
</el-form-item>
<el-form-item label="商品规则:">
<ueditor-from v-model="formValidate.rule" :content="formValidate.rule" />
</el-form-item>
</div>
<el-form-item style="margin-top:30px;">
<el-button
v-show="(!$route.params.id && currentTab > 0) || ($route.params.id && currentTab===2)"
type="primary"
class="submission"
size="small"
@click="handleSubmitUp"
>上一步</el-button>
<el-button
v-show="currentTab == 0"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest1('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab == 1"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest2('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab===2"
:loading="loading"
type="primary"
class="submission"
size="small"
@click="handleSubmit('formValidate')"
>提交</el-button>
</el-form-item>
</el-form>
</el-card>
<CreatTemplates ref="addTemplates" @getList="getShippingList" />
</div>
</template>
<script>
import { productDetailApi, categoryApi } from '@/api/store'
import { shippingTemplatesList } from '@/api/logistics'
import { getSeckillList } from '@/libs/public'
import { bargainSaveApi, bargainUpdateApi, bargainInfoApi } from '@/api/marketing'
import CreatTemplates from '@/views/systemSetting/logistics/shippingTemplates/creatTemplates'
const defaultObj = {
image: '',
images: '',
imagess: [],
title: '',
info: '',
num: 1,
unitName: '',
sort: 0,
giveIntegral: 0,
ficti: 0,
isShow: false,
tempId: '',
attrValue: [{
image: '',
price: 0,
minPrice: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}],
attr: [],
selectRule: '',
content: '',
specType: false,
id: 0,
// productId: 0,
timeId: '',
startTime: '',
stopTime: '',
timeVal: [],
status: 0,
rule: ''
}
const objTitle = {
price: {
title: '砍价起始金额'
},
minPrice: {
title: '砍价最低价'
},
cost: {
title: '成本价'
},
otPrice: {
title: '原价'
},
stock: {
title: '库存'
},
quota: {
title: "限量",
},
weight: {
title: '重量KG'
},
volume: {
title: '体积(m³)'
},
barCode: {
title: '商品编号'
}
}
export default {
name: "creatSeckill",
components: { CreatTemplates },
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() < new Date().setTime(new Date().getTime() - 3600 * 1000 * 24);
}
},
props2: {
children: 'child',
label: 'name',
value: 'id',
multiple: true,
emitPath: false
},
grid2: {
xl: 8,
lg: 10,
md: 12,
sm: 24,
xs: 24
},
currentTab: 0,
formThead: Object.assign({}, objTitle),
formValidate: Object.assign({}, defaultObj),
loading: false,
fullscreenLoading: false,
merCateList: [], // 商户分类筛选
shippingList: [], // 运费模板
seckillTime: [],
ruleValidate: {
productId: [
{ required: true, message: '请选择商品', trigger: 'change' }
],
title: [
{ required: true, message: '请输入砍价活动名称', trigger: 'blur' }
],
attrValue: [
{ required: true, message: '请选择商品属相', trigger: 'change', type: 'array', min: '1' }
],
num: [
{ required: true, message: '请输入购买数量限制', trigger: 'blur' }
],
unitName: [
{ required: true, message: '请输入单位', trigger: 'blur' }
],
info: [
{ required: true, message: '请输入砍价商品简介', trigger: 'blur' }
],
tempId: [
{ required: true, message: '请选择运费模板', trigger: 'change' }
],
timeId: [
{ required: true, message: '请选择活动时间', trigger: 'change' }
],
image: [
{ required: true, message: '请上传商品图', trigger: 'change' }
],
imagess: [
{ required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }
],
specType: [
{ required: true, message: '请选择商品规格', trigger: 'change' }
],
timeVal:[
{ required: true, message: '请选择活动日期', trigger: 'change', type: 'array'}
],
bargainNum:[
{ required: true, message: '请输入帮砍次数', trigger: 'blur'}
],
peopleNum: [
{ required: true, message: '请输入砍价人数', trigger: 'blur'}
],
price: [
{ required: true, message: '333333', trigger: 'blur'}
]
},
manyTabDate: {},
manyTabTit: {},
attrInfo: {},
tempRoute: {},
multipleSelection: [],
productId: 0,
radio: '',
ManyAttrValue: [Object.assign({}, defaultObj.attrValue[0])], // 多规格
}
},
computed: {
attrValue() {
const obj = Object.assign({}, defaultObj.attrValue[0])
delete obj.image
return obj
}
},
created() {
this.$watch('formValidate.attr', this.watCh)
this.tempRoute = Object.assign({}, this.$route)
},
mounted() {
getSeckillList(1).then((res) => {
this.seckillTime = res.list
})
this.formValidate.imagess = []
if ( this.$route.params.id ) {
this.setTagsViewTitle()
this.getInfo()
this.currentTab = 1
}
this.getShippingList()
this.getCategorySelect()
},
methods: {
changeType(row, index){
row.checked = true;
this.multipleSelection = [row];
},
inpChange(currentValue, id){
// this.ManyAttrValue.map(item => {
// if(!currentValue && item.id ===id){
// item.quota = 1
// this.$set(item, 'quota', 1)
// this.ManyAttrValue = Object.assign([], this.ManyAttrValue)
// }
// })
console.log(this.ManyAttrValue)
// if(!currentValue) item.quota = 1
},
watCh(val) {
const tmp = {}
const tmpTab = {}
this.formValidate.attr.forEach((o, i) => {
tmp['value' + i] = { title: o.attrName }
tmpTab['value' + i] = ''
})
this.manyTabTit = tmp
this.manyTabDate = tmpTab
this.formThead = Object.assign({}, this.formThead, tmp)
},
handleRemove (i) {
this.formValidate.imagess.splice(i, 1)
},
// 点击商品图
modalPicTap (tit, num, i) {
const _this = this
this.$modalUpload(function(img) {
if(tit==='1'&& !num){
_this.formValidate.image = img[0].sattDir
_this.ManyAttrValue[0].image = img[0].sattDir
}
if(tit==='2'&& !num){
if(img.length>10) return this.$message.warning("最多选择10张图片");
if(img.length + _this.formValidate.imagess.length > 10) return this.$message.warning("最多选择10张图片");
img.map((item) => {
_this.formValidate.imagess.push(item.sattDir)
});
}
if(tit==='1'&& num === 'duo' ){
_this.specType ? _this.ManyAttrValue[i].image = img[0].sattDir : _this.ManyAttrValue[0].image = img[0].sattDir
}
},tit, 'content')
},
// 具体日期
onchangeTime(e) {
this.formValidate.timeVal = e;
this.formValidate.startTime = e ? e[0] : "";
this.formValidate.stopTime = e ? e[1] : "";
},
changeGood(){
const _this = this
this.$modalGoodList(function(row) {
_this.formValidate.image = row.image
_this.productId = row.id
// _this.formValidate.productId = row.id
})
},
handleSubmitNest1() {
if (!this.formValidate.image) {
this.$message.warning("请选择商品!");
return;
} else {
this.currentTab++;
if (!this.$route.params.id) this.getProdect(this.productId);
}
},
// 商品分类;
getCategorySelect() {
categoryApi({ status: -1, type: 1 }).then(res => {
this.merCateList = this.filerMerCateList(res)
})
},
filerMerCateList(treeData) {
return treeData.map((item) => {
if(!item.child){
item.disabled = true
}
item.label = item.name
return item
})
},
// 运费模板;
getShippingList() {
shippingTemplatesList(this.tempData).then(res => {
this.shippingList = res.list
})
},
// 运费模板
addTem() {
this.$refs.addTemplates.dialogVisible = true
this.$refs.addTemplates.getCityList()
},
// 商品详情
getInfo () {
if(!this.$route.params.id){
this.getProdect(this.productId)
}else{
this.getSekllProdect(this.$route.params.id)
}
},
getProdect(id) {
this.fullscreenLoading = true
productDetailApi(id).then(async res => {
this.formValidate = {
image: res.image,
imagess: JSON.parse(res.sliderImage),
title: res.storeName,
info: res.storeInfo,
proName: res.storeName,
unitName: res.unitName,
sort: res.sort,
tempId: res.tempId,
attr: res.attr,
selectRule: res.selectRule,
content: res.content,
specType: res.specType,
productId: res.id,
giveIntegral: res.giveIntegral,
ficti: res.ficti,
startTime: res.startTime || '',
stopTime: res.stopTime || '',
timeVal: [],
status: 0,
num : 1,
bargainNum : 2,
peopleNum : 1,
rule : ''
}
if(res.specType){
res.attrValues.forEach((row) => {
row.quota = row.stock;
});
this.ManyAttrValue = res.attrValues
this.multipleSelection = res.attrValues
}else{
res.attrValue.forEach((row) => {
row.quota = row.stock;
});
this.ManyAttrValue = res.attrValue
this.radio = res.attrValue[0]
this.formValidate.attr = []
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
getSekllProdect(id) {
this.fullscreenLoading = true
bargainInfoApi({id:id}).then(async res => {
this.formValidate = {
image: res.image,
imagess: res.sliderImage?JSON.parse(res.sliderImage):[],
title: res.title,
proName: res.title,
info: res.info,
unitName: res.unitName,
sort: res.sort,
tempId: res.tempId,
attr: res.attr,
selectRule: res.selectRule,
content: res.content,
specType: res.specType,
productId: res.productId,
giveIntegral: res.giveIntegral,
ficti: res.ficti,
startTime: res.startTime || '',
stopTime: res.stopTime || '',
timeVal: res.startTime && res.stopTime ? [res.startTime, res.stopTime] : [],
status: res.status,
num : res.num,
bargainNum : res.bargainNum,
peopleNum : res.peopleNum,
rule : res.rule
}
if(res.specType){
this.ManyAttrValue = res.attrValues;
this.$nextTick(() => {
this.ManyAttrValue.forEach((item, index) => {
if (item.checked) {
this.radio = item
}
})
});
}else{
this.ManyAttrValue = res.attrValue;
this.formValidate.attr = [];
this.radio = res.attrValue[0];
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
handleSubmitNest2(name) {
this.$refs[name].validate((valid) => {
if (valid) {
if(!this.radio){
return this.$message.warning("请选择一个商品属性!");
}else{
if(!this.radio.price) return this.$message.warning("请填写砍价起始金额!");
// if(!this.radio.minPrice) return this.$message.warning("请填写砍价最低价!");
if(!this.radio.quota) return this.$message.warning("请填写限量!");
}
this.currentTab++;
} else {
return false;
}
});
},
// 提交
handleSubmit(name) {
if(!this.formValidate.specType){
this.formValidate.attr = []
this.formValidate.attrValue = this.ManyAttrValue
}else{
this.formValidate.attrValue = [this.radio]
}
this.formValidate.images = JSON.stringify(this.formValidate.imagess)
this.$refs[name].validate((valid) => {
if (valid) {
this.fullscreenLoading = true;
this.loading = true;
this.$route.params.id
? bargainUpdateApi({id: this.$route.params.id}, this.formValidate)
.then(async () => {
this.fullscreenLoading = false;
this.$message.success('编辑成功');
this.$router.push({
path: "/marketing/bargain/bargainGoods",
});
this.$refs[name].resetFields();
this.formValidate.images = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
})
: bargainSaveApi(this.formValidate)
.then(async (res) => {
this.fullscreenLoading = false;
this.$message.success('新增成功');
this.$router.push({
path: "/marketing/bargain/bargainGoods",
});
this.$refs[name].resetFields();
this.formValidate.images = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
});
} else {
if (
!this.formValidate.storeName ||
!this.formValidate.unitName ||
!this.formValidate.store_info ||
!this.formValidate.image ||
!this.formValidate.images
) {
this.$message.warning("请填写完整商品信息!");
}
}
});
},
handleSubmitUp() {
if (this.currentTab-- < 0) this.currentTab = 0;
},
setTagsViewTitle() {
const title = '编辑砍价商品'
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.$route.params.id}` })
this.$store.dispatch('tagsView/updateVisitedView', route)
},
// 移动
handleDragStart (e, item) {
this.dragging = item;
},
handleDragEnd (e, item) {
this.dragging = null
},
handleDragOver (e) {
e.dataTransfer.dropEffect = 'move'
},
handleDragEnter (e, item) {
e.dataTransfer.effectAllowed = 'move'
if (item === this.dragging) {
return
}
const newItems = [...this.formValidate.imagess]
const src = newItems.indexOf(this.dragging)
const dst = newItems.indexOf(item)
newItems.splice(dst, 0, ...newItems.splice(src, 1))
this.formValidate.imagess = newItems;
}
}
}
</script>
<style scoped lang="scss">
.inpBox{
/deep/.el-form-item__error {
color: #ff4949;
font-size: 12px;
line-height: 20px;
padding-top: 4px;
position: static !important;
/* position: absolute; */
/* top: 100%; */
/* left: 0; */
}
}
.labeltop{
/deep/.el-input-number--small{
/*width: 172px !important;*/
min-width: 132px !important;
}
}
.proCoupon{
/deep/.el-form-item__content{
margin-top: 5px;
}
}
.tabPic{
width: 40px !important;
height: 40px !important;
img{
width: 100%;
height: 100%;
}
}
.noLeft{
/deep/.el-form-item__content{
margin-left: 0 !important;
}
}
.tabNumWidth{
/deep/.el-input-number--medium{
width: 121px !important;
}
/deep/.el-input-number__increase{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number__decrease{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number--medium .el-input__inner {
padding-left: 25px !important;
padding-right: 25px !important;
}
/deep/ thead{
line-height: normal !important;
}
/deep/ .el-table .cell{
line-height: normal !important;
}
}
.selWidth{
width: 80%;
}
.selWidthd{
width: 350px;
}
.button-new-tag {
height: 28px;
line-height: 26px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.pictrue{
width: 60px;
height: 60px;
border: 1px dotted rgba(0,0,0,0.1);
margin-right: 10px;
position: relative;
cursor: pointer;
img{
width: 100%;
height: 100%;
}
}
.btndel{
position: absolute;
z-index: 1;
width :20px !important;
height: 20px !important;
left: 46px;
top: -4px;
}
.labeltop{
/deep/.el-form-item__label{
/*float: none !important;*/
/*display: inline-block !important;*/
/*margin-left: 120px !important;*/
/*width: auto !important;*/
}
}
</style>

View File

@@ -0,0 +1,213 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form inline>
<el-form-item label="砍价状态:">
<el-select v-model="tableFrom.status" placeholder="请选择" class="filter-item selWidth mr20" @change="getList(1)" clearable>
<el-option label="关闭" :value="0" />
<el-option label="开启" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="商品搜索:">
<el-input v-model="tableFrom.keywords" placeholder="请输入商品名称、ID" class="selWidth" clearable>
<el-button slot="append" icon="el-icon-search" @click="getList(1)"/>
</el-input>
</el-form-item>
</el-form>
</div>
<router-link :to=" { path:'/marketing/bargain/creatBargain' }">
<el-button size="mini" type="primary" class="mr10">添加砍价商品</el-button>
</router-link>
<el-button size="mini" class="mr10" @click="exportList">导出</el-button>
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
style="width: 100%"
size="mini"
ref="multipleTable"
>
<el-table-column
prop="id"
label="ID"
min-width="50"
/>
<el-table-column label="砍价图片" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.image"
:preview-src-list="[scope.row.image]"
/>
</div>
</template>
</el-table-column>
<el-table-column
label="砍价名称"
prop="title"
min-width="100"
/>
<el-table-column
label="砍价价格"
prop="price"
min-width="100"
/>
<el-table-column
label="最低价"
prop="minPrice"
min-width="100"
/>
<el-table-column
label="参与人数"
prop="countPeopleAll"
min-width="100"
/>
<el-table-column
label="帮忙砍价人数"
prop="countPeopleHelp"
min-width="100"
/>
<el-table-column
label="砍价成功人数"
prop="countPeopleSuccess"
min-width="100"
/>
<el-table-column
label="限量"
min-width="100"
prop="quotaShow"
/>
<el-table-column
label="限量剩余"
prop="surplusQuota"
min-width="100"
/>
<el-table-column
prop="stopTime"
label="结束时间"
min-width="130"
/>
<el-table-column
label="砍价状态"
min-width="150"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:active-value="true"
:inactive-value="false"
active-text="开启"
inactive-text="关闭"
@change="onchangeIsShow(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" min-width="130" fixed="right" align="center">
<template slot-scope="scope">
<router-link :to="{ path:'/marketing/bargain/creatBargain/' + scope.row.id}">
<el-button type="text" size="small">编辑</el-button>
</router-link>
<el-button type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)" class="mr10">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block mb20">
<el-pagination
:page-sizes="[10, 20, 30, 40]"
:page-size="tableFrom.limit"
:current-page="tableFrom.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
/>
</div>
</el-card>
</div>
</template>
<script>
import { bargainListApi,bargainDeleteApi,bargainStatusApi,exportBargainApi } from '@/api/marketing'
export default {
name: "index",
data() {
return {
tableFrom: {
page: 1,
limit: 20,
keywords: '',
status: null
},
listLoading: true,
tableData: {
data: [],
total: 0
},
}
},
mounted() {
this.getList()
},
methods: {
//导出
exportList(){
exportBargainApi({keywords: this.tableFrom.keywords, status:this.tableFrom.status}).then((res) => {
window.open(res.fileName)
})
},
// 删除
handleDelete(id, idx) {
this.$modalSure().then(() => {
bargainDeleteApi({id: id}).then(() => {
this.$message.success('删除成功')
this.tableData.data.splice(idx, 1)
})
})
},
onchangeIsShow(row) {
bargainStatusApi({id:row.id, status: row.status})
.then(async () => {
this.$message.success('修改成功');
this.getList()
}).catch(()=>{
row.status = !row.status
})
},
// 列表
getList(num) {
this.listLoading = true
this.tableFrom.page = num ? num : this.tableFrom.page;
bargainListApi(this.tableFrom).then(res => {
this.tableData.data = res.list
this.tableData.total = res.total
this.listLoading = false
}).catch((res) => {
this.listLoading = false
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
},
add() {
this.isCreate = 0
this.dialogVisible = true
},
handleClose() {
this.dialogVisible = false
this.editData = {}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,246 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form size="small" label-width="100px">
<el-form-item label="时间选择:" class="width100">
<el-radio-group v-model="tableFrom.dateLimit" type="button" class="mr20" size="small" @change="selectChange(tableFrom.dateLimit)">
<el-radio-button v-for="(item,i) in fromList.fromTxt" :key="i" :label="item.val">{{ item.text }}</el-radio-button>
</el-radio-group>
<el-date-picker v-model="timeVal" value-format="yyyy-MM-dd" format="yyyy-MM-dd" size="small" type="daterange" placement="bottom-end" placeholder="自定义时间" style="width: 250px;" @change="onchangeTime" />
</el-form-item>
<el-form-item label="砍价状态:">
<el-select v-model="tableFrom.status" placeholder="请选择" class="filter-item selWidth mr20" @change="getList(1)" clearable>
<el-option label="进行中" :value="1" />
<el-option label="未完成" :value="2" />
<el-option label="已成功" :value="3" />
</el-select>
</el-form-item>
</el-form>
</div>
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
style="width: 100%"
size="mini"
ref="multipleTable"
>
<el-table-column
prop="id"
label="ID"
min-width="50"
/>
<el-table-column label="头像" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.avatar"
:preview-src-list="[scope.row.avatar]"
/>
</div>
</template>
</el-table-column>
<el-table-column
label="发起用户"
prop="nickname"
min-width="100"
/>
<el-table-column
label="开启时间"
prop="addTime"
min-width="150"
/>
<el-table-column
label="砍价商品"
prop="title"
min-width="100"
/>
<el-table-column
label="最低价"
prop="bargainPriceMin"
min-width="100"
/>
<el-table-column
label="当前价"
prop="nowPrice"
min-width="100"
/>
<el-table-column
label="总砍价次数"
prop="peopleNum"
min-width="100"
/>
<el-table-column
label="剩余砍价次数"
min-width="100"
prop="num"
/>
<el-table-column
prop="dataTime"
label="结束时间"
min-width="150"
/>
<el-table-column
label="砍价状态"
min-width="150"
>
<template slot-scope="scope">
<el-tag :type="scope.row.status | bargainColorFilter">{{scope.row.status | bargainStatusFilter}}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="150" fixed="right" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleLook(scope.row.id)" class="mr10">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<div class="block mb20">
<el-pagination
:page-sizes="[10, 20, 30, 40]"
:page-size="tableFrom.limit"
:current-page="tableFrom.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
/>
</div>
</el-card>
<el-dialog
title="查看详情"
:visible.sync="dialogVisible"
width="650px"
:before-close="handleClose">
<el-table
v-loading="listLoadingPink"
:data="tableDataPink.data"
style="width: 100%"
size="mini"
ref="multipleTable"
>
<el-table-column
prop="uid"
label="用户id"
min-width="50"
/>
<el-table-column label="用户头像" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.avatar"
:preview-src-list="[scope.row.avatar]"
/>
</div>
</template>
</el-table-column>
<el-table-column
label="用户名称"
prop="nickname"
min-width="100"
/>
<el-table-column
label="砍价金额"
prop="price"
min-width="100"
/>
<el-table-column
label="砍价时间"
prop="addTime"
min-width="180"
/>
</el-table>
</el-dialog>
</div>
</template>
<script>
import {fromList} from '@/utils/constants.js';
import { bargainListListApi,bargainOrderPinkApi } from '@/api/marketing'
export default {
name: "index",
data() {
return {
listLoadingPink: false,
dialogVisible: false,
tableDataPink: {
data: []
},
tableData: {
data: [],
total: 0
},
listLoading: false,
tableFrom: {
dateLimit: '',
status: '',
page: 1,
limit: 20
},
fromList: fromList,
timeVal: []
}
},
mounted() {
this.getList()
},
methods:{
handleClose(){
this.dialogVisible = false
},
handleLook(id){
this.dialogVisible = true;
this.getPink(id);
},
getPink(id) {
this.listLoadingPink = true;
bargainOrderPinkApi(id).then(res => {
this.tableDataPink.data = res
this.listLoadingPink = false
}).catch(() => {
this.listLoadingPink = false
})
},
selectChange(tab) {
this.tableFrom.dateLimit = tab
this.tableFrom.page = 1
this.timeVal = []
this.getList()
},
// 具体日期
onchangeTime(e) {
this.timeVal = e
this.tableFrom.dateLimit = e ? this.timeVal.join(',') : ''
this.tableFrom.page = 1
this.getList()
},
// 列表
getList(num) {
this.listLoading = true;
this.tableFrom.page = num ? num : this.tableFrom.page;
bargainListListApi(this.tableFrom).then(res => {
this.tableData.data = res.list
this.tableData.total = res.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -1,11 +1,13 @@
<template>
<div>砍价</div>
<div>
<router-view />
</div>
</template>
<script>
export default {
export default {
}
}
</script>
<style lang="sass" scoped>

View File

@@ -15,10 +15,10 @@
<el-form-item label="选择品类:" prop="primaryKey" v-if="ruleForm.useType === 3">
<el-cascader v-model="ruleForm.primaryKey" :options="merCateList" :props="props2" clearable class="selWidth" :show-all-levels="false" />
</el-form-item>
<el-form-item label="商品:" v-if="ruleForm.useType === 2">
<el-form-item label="商品:" v-if="ruleForm.useType === 2" prop="checked">
<div class="acea-row">
<template v-if="checked.length">
<div class="pictrue" v-for="(item, index) in checked" :key="index">
<template v-if="ruleForm.checked.length">
<div class="pictrue" v-for="(item, index) in ruleForm.checked" :key="index">
<img :src="item.image">
<i class="el-icon-error btndel" @click="handleRemove(index)" />
</div>
@@ -48,7 +48,7 @@
<el-radio :label="true">时间段</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="使用有效期限(天)" prop="resource" v-if="!ruleForm.isFixedTime">
<el-form-item label="使用有效期限(天)" prop="day" v-if="!ruleForm.isFixedTime">
<el-input-number v-model="ruleForm.day" :min="0" label="描述文字"></el-input-number>
</el-form-item>
<el-form-item label="使用有效期限" prop="resource" v-if="ruleForm.isFixedTime">
@@ -60,6 +60,7 @@
format="yyyy - MM - dd - HH : mm : ss"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
:picker-options="pickerOptions"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
@@ -77,6 +78,7 @@
range-separator=""
format="yyyy - MM - dd - HH : mm : ss"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
@@ -123,6 +125,11 @@
name: "creatCoupon",
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() < new Date().setTime(new Date().getTime() - 3600 * 1000 * 24);
}
},
loading: false,
threshold: false,
termTime: [],
@@ -154,14 +161,26 @@
receiveEndTime: '',
sort: 0,
total: 1,
status: false
status: false,
checked: []
},
rules: {
name: [
{ required: true, message: '请输入优惠券名称', trigger: 'blur' },
],
},
checked: []
day: [
{ required: true, message: '请输入使用有效期限(天)', trigger: 'blur' },
],
money: [
{ required: true, message: '请输入优惠券面值', trigger: 'blur' },
],
primaryKey: [
{ required: true, message: '请选择品类', trigger: 'change' },
],
checked: [
{ required: true, message: '请至少选择一个商品', trigger: 'change', type: 'array' },
]
}
}
},
mounted() {
@@ -195,9 +214,9 @@
sort: info.sort,
total: info.total,
status: info.status,
primaryKey: Number(info.primaryKey)
primaryKey: Number(info.primaryKey),
checked: res.product
}
this.checked = res.product
info.minPrice === 0 ? this.threshold = false : this.threshold = true
info.isForever ? this.isForeverTime = [info.receiveStartTime, info.receiveEndTime] : this.isForeverTime = []
info.isFixedTime ? this.termTime = [info.useStartTime, info.useEndTime] : this.termTime = []
@@ -208,16 +227,16 @@
})
},
handleRemove (i) {
this.checked.splice(i, 1)
this.ruleForm.checked.splice(i, 1)
},
changeGood(){
const _this = this
this.$modalGoodList(function(row) {
_this.checked = row
},'many',_this.checked)
_this.ruleForm.checked = row
},'many',_this.ruleForm.checked)
},
submitForm(formName) {
if( this.ruleForm.useType === 2 ) this.ruleForm.primaryKey = this.checked.map(item => {return item.id}).join(',')
if( this.ruleForm.useType === 2 ) this.ruleForm.primaryKey = this.ruleForm.checked.map(item => {return item.id}).join(',')
if( this.ruleForm.useType === 1 ) this.ruleForm.primaryKey = ''
if( !this.threshold ) this.ruleForm.minPrice = 0
if( !this.ruleForm.isLimited ) this.ruleForm.total = 0

View File

@@ -10,7 +10,7 @@
<el-option label="开启" :value="1" />
</el-select>
<span class="seachTiele">优惠券名称</span>
<el-input v-model="tableFrom.name" placeholder="请输入优惠券名称" class="selWidth">
<el-input v-model="tableFrom.name" placeholder="请输入优惠券名称" class="selWidth" clearable>
<el-button slot="append" icon="el-icon-search" @click="seachList" />
</el-input>
</div>
@@ -142,7 +142,7 @@
style="width: 100%"
>
<el-table-column
prop="user.nickname"
prop="nickname"
label="用户名"
min-width="120"
/>
@@ -271,6 +271,8 @@
couponIssueStatusApi({id:row.id, status:row.status}).then(() => {
this.$message.success('修改成功')
this.getList()
}).catch(()=>{
row.status = !row.status
})
}
}

View File

@@ -1,13 +0,0 @@
<template>
<div>拼团</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,901 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-steps :active="currentTab" align-center finish-status="success">
<el-step title="选择拼团商品" />
<el-step title="填写基础信息" />
<el-step title="修改商品详情" />
</el-steps>
</div>
<el-form
ref="formValidate"
v-loading="fullscreenLoading"
class="formValidate mt20"
:rules="ruleValidate"
:model="formValidate"
label-width="180px"
@submit.native.prevent
>
<!-- 砍价商品-->
<div v-show="currentTab === 0">
<el-form-item label="选择商品:" prop="image">
<div class="upLoadPicBox" @click="changeGood">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont"/>
</div>
</div>
</el-form-item>
</div>
<!-- 商品信息-->
<div v-show="currentTab === 1">
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="商品主图:" prop="image">
<div class="upLoadPicBox" @click="modalPicTap('1')">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品轮播图:" prop="imagelist">
<div class="acea-row">
<div
v-for="(item,index) in formValidate.imagelist"
:key="index"
class="pictrue"
draggable="true"
@dragstart="handleDragStart($event, item)"
@dragover.prevent="handleDragOver($event, item)"
@dragenter="handleDragEnter($event, item)"
@dragend="handleDragEnd($event, item)"
>
<img :src="item">
<i class="el-icon-error btndel" @click="handleRemove(index)" />
</div>
<div v-if="formValidate.imagelist.length<10" class="upLoadPicBox" @click="modalPicTap('2')">
<div class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团名称:" prop="title">
<el-input v-model="formValidate.title" maxlength="249" placeholder="请输入拼团名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团简介:" prop="info">
<el-input v-model="formValidate.info" maxlength="250" type="textarea" :rows="3" placeholder="请输入拼团简介" />
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="单位:" prop="unitName">
<el-input v-model="formValidate.unitName" placeholder="请输入单位" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动日期:" prop="timeVal">
<el-date-picker
class="mr20"
v-model="formValidate.timeVal"
type="daterange"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
@change="onchangeTime">
</el-date-picker>
<span>设置活动开启结束时间用户可以在设置时间内发起参与拼团</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团时效(单位 小时)" prop="effectiveTime">
<el-input-number v-model="formValidate.effectiveTime" :min="1" :step="1" step-strictly step-strictly placeholder="请输入拼团人数" class="selWidthd mr20"/>
<span>用户发起拼团后开始计时需在设置时间内邀请到规定好友人数参团超过时效时间则系统判定拼团失败自动发起退款</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拼团人数:" prop="people">
<el-input-number v-model="formValidate.people" :min="2" :step="1" step-strictly step-strictly placeholder="请输入拼团人数" class="selWidthd mr20"/>
<span>单次拼团需要参与的用户数</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="购买数量限制:" prop="num">
<el-input-number v-model="formValidate.num" :min="1" :step="1" step-strictly placeholder="请输入帮砍次数" class="selWidthd mr20"/>
<span>活动时间内每个用户参与拼团的次数限制例如设置为4表示本次活动有效期内每个用户最多可参与购买4次</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单次购买数量限制:" prop="onceNum">
<el-input-number v-model="formValidate.onceNum" :min="1" :step="1" step-strictly placeholder="请输入购买数量限制" class="selWidthd mr20"/>
<span>用户参与拼团时一次购买最大数量限制例如设置为2表示参与拼团时用户一次购买数量最大可选择2个</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="补齐人数:" prop="peopleNum">
<el-input-number v-model="formValidate.peopleNum" :min="0" :max="formValidate.people - 1" :step="1" step-strictly placeholder="请输入补齐人数" class="selWidthd mr20"/>
<span>当用户参与拼团后成团时效内未成团情况下设置补齐人数可虚拟成团例如成团人数为10人补齐人数为4人真实用户需要参与6人成团才可以在最后未成团时自动补齐虚拟人员</span>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="排序:" prop="sort">
<el-input-number v-model="formValidate.sort" :max="9999" placeholder="请输入排序" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="运费模板:" prop="tempId">
<div class="acea-row">
<el-select v-model="formValidate.tempId" placeholder="请选择" class="selWidthd">
<el-option
v-for="item in shippingList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<!--<el-button class="mr15" @click="addTem">添加运费模板</el-button>-->
</div>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="热门推荐:" required>
<el-radio-group v-model="formValidate.isHost">
<el-radio :label="false" class="radio">关闭</el-radio>
<el-radio :label="true">开启</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="活动状态:" required>
<el-radio-group v-model="formValidate.isShow">
<el-radio :label="false" class="radio">关闭</el-radio>
<el-radio :label="true">开启</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 规格表格-->
<el-col :span="24">
<el-form-item label="商品属性:" class="labeltop" required>
<el-table
ref="multipleTable"
:data="ManyAttrValue"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
key="1"
v-if="formValidate.specType"
width="55">
</el-table-column>
<template v-if="manyTabDate && formValidate.specType">
<el-table-column v-for="(item,iii) in manyTabDate" :key="iii" align="center" :label="manyTabTit[iii].title" min-width="80">
<template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" />
</template>
</el-table-column>
</template>
<el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope">
<div class="upLoadPicBox" @click="modalPicTap('1','duo',scope.$index)">
<div v-if="scope.row.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
<div v-else class="upLoad tabPic">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="140">
<template slot-scope="scope">
<el-input-number
size="small"
v-if="formThead[iii].title === '拼团价'"
v-model="scope.row[iii]"
:min="0"
:precision="2" :step="0.1"
class="priceBox"
/>
<el-input-number
size="small"
v-else-if="formThead[iii].title === '限量'"
v-model="scope.row[iii]"
type="number"
:min="1"
:max="scope.row.stock"
:step="1" step-strictly
class="priceBox"
@change="inpChange(scope.row[iii], scope.row.id)"
/>
<span v-else v-text="scope.row[iii]" class="priceBox" />
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
</el-row>
</div>
<!-- 商品详情-->
<div v-show="currentTab === 2">
<el-form-item label="商品详情:">
<ueditor-from v-model="formValidate.content" :content="formValidate.content" />
</el-form-item>
</div>
<el-form-item style="margin-top:30px;">
<el-button
v-show="(!$route.params.id && currentTab > 0) || ($route.params.id && currentTab===2)"
type="primary"
class="submission"
size="small"
@click="handleSubmitUp"
>上一步</el-button>
<el-button
v-show="currentTab == 0"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest1('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab == 1"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest2('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab===2"
:loading="loading"
type="primary"
class="submission"
size="small"
@click="handleSubmit('formValidate')"
>提交</el-button>
</el-form-item>
</el-form>
</el-card>
<CreatTemplates ref="addTemplates" @getList="getShippingList" />
</div>
</template>
<script>
import { productDetailApi, categoryApi } from '@/api/store'
import { shippingTemplatesList } from '@/api/logistics'
import { getSeckillList } from '@/libs/public'
import { combinationSaveApi, combinationUpdateApi, combinationInfoApi } from '@/api/marketing'
import CreatTemplates from '@/views/systemSetting/logistics/shippingTemplates/creatTemplates'
const defaultObj = {
image: '',
images: '',
imagelist: [],
title: '',
info: '',
num: 1,
unitName: '',
sort: 0,
giveIntegral: 0,
ficti: 0,
isShow: false,
tempId: '',
attrValue: [{
image: '',
price: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}],
attr: [],
selectRule: '',
content: '',
specType: false,
id: 0,
// productId: 0,
startTime: '',
stopTime: '',
timeVal: [],
effectiveTime: 0,
people: 2,
peopleNum: 0
}
const objTitle = {
price: {
title: '拼团价'
},
cost: {
title: '成本价'
},
otPrice: {
title: '原价'
},
stock: {
title: '库存'
},
quota: {
title: "限量",
},
barCode: {
title: '商品编号'
},
weight: {
title: '重量KG'
},
volume: {
title: '体积(m³)'
}
}
export default {
name: "creatSeckill",
components: { CreatTemplates },
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() < new Date().setTime(new Date().getTime() - 3600 * 1000 * 24);
}
},
props2: {
children: 'child',
label: 'name',
value: 'id',
multiple: true,
emitPath: false
},
grid2: {
xl: 8,
lg: 10,
md: 12,
sm: 24,
xs: 24
},
currentTab: 0,
formThead: Object.assign({}, objTitle),
formValidate: Object.assign({}, defaultObj),
loading: false,
fullscreenLoading: false,
merCateList: [], // 商户分类筛选
shippingList: [], // 运费模板
seckillTime: [],
ruleValidate: {
productId: [
{ required: true, message: '请选择商品', trigger: 'change' }
],
title: [
{ required: true, message: '请输入商品标题', trigger: 'blur' }
],
attrValue: [
{ required: true, message: '请选择商品属相', trigger: 'change', type: 'array', min: '1' }
],
num: [
{ required: true, message: '请输入购买数量限制', trigger: 'blur' }
],
unitName: [
{ required: true, message: '请输入单位', trigger: 'blur' }
],
info: [
{ required: true, message: '请输入拼团商品简介', trigger: 'blur' }
],
tempId: [
{ required: true, message: '请选择运费模板', trigger: 'change' }
],
image: [
{ required: true, message: '请上传商品图', trigger: 'change' }
],
imagelist: [
{ required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }
],
specType: [
{ required: true, message: '请选择商品规格', trigger: 'change' }
],
timeVal:[
{ required: true, message: '请选择活动日期', trigger: 'change', type: 'array'}
],
peopleNum:[
{ required: true, message: '请输入补齐人数', trigger: 'blur'}
],
onceNum: [
{ required: true, message: '请输入单次购买数量限制', trigger: 'blur'}
],
people: [
{ required: true, message: '请输入拼团人数', trigger: 'blur'}
],
effectiveTime: [
{ required: true, message: '请输入拼团时效', trigger: 'blur'}
]
},
manyTabDate: {},
manyTabTit: {},
attrInfo: {},
tempRoute: {},
multipleSelection: [],
productId: 0,
radio: '',
ManyAttrValue: [Object.assign({}, defaultObj.attrValue[0])], // 多规格
}
},
computed: {
attrValue() {
const obj = Object.assign({}, defaultObj.attrValue[0])
delete obj.image
return obj
}
},
created() {
this.$watch('formValidate.attr', this.watCh)
this.tempRoute = Object.assign({}, this.$route)
},
mounted() {
getSeckillList(1).then((res) => {
this.seckillTime = res.list
})
this.formValidate.imagelist = []
if ( this.$route.params.id ) {
this.setTagsViewTitle()
this.getInfo()
this.currentTab = 1
}
this.getShippingList()
this.getCategorySelect()
},
methods: {
handleSelectionChange(val) {
val.map(item => {
item.checked = true
})
this.multipleSelection = val;
},
inpChange(currentValue, id){
// this.ManyAttrValue.map(item => {
// if(!currentValue && item.id ===id){
// item.quota = 1
// this.$set(item, 'quota', 1)
// this.ManyAttrValue = Object.assign([], this.ManyAttrValue)
// }
// })
console.log(this.ManyAttrValue)
// if(!currentValue) item.quota = 1
},
watCh(val) {
const tmp = {}
const tmpTab = {}
this.formValidate.attr.forEach((o, i) => {
tmp['value' + i] = { title: o.attrName }
tmpTab['value' + i] = ''
})
this.manyTabTit = tmp
this.manyTabDate = tmpTab
this.formThead = Object.assign({}, this.formThead, tmp)
},
handleRemove (i) {
this.formValidate.imagelist.splice(i, 1)
// this.imagelist=[...this.imagelist];
},
// 点击商品图
modalPicTap (tit, num, i) {
const _this = this
this.$modalUpload(function(img) {
if(tit==='1'&& !num){
_this.formValidate.image = img[0].sattDir
_this.ManyAttrValue[0].image = img[0].sattDir
}
if(tit==='2'&& !num){
if(img.length>10) return this.$message.warning("最多选择10张图片");
if(img.length + _this.formValidate.imagelist.length > 10) return this.$message.warning("最多选择10张图片");
img.map((item) => {
_this.formValidate.imagelist.push(item.sattDir)
});
}
if(tit==='1'&& num === 'duo' ){
_this.specType ? _this.ManyAttrValue[i].image = img[0].sattDir : _this.ManyAttrValue[0].image = img[0].sattDir
}
},tit, 'content')
},
// 具体日期
onchangeTime(e) {
this.formValidate.timeVal = e;
this.formValidate.startTime = e ? e[0] : "";
this.formValidate.stopTime = e ? e[1] : "";
},
changeGood(){
const _this = this
this.$modalGoodList(function(row) {
_this.formValidate.image = row.image
_this.productId = row.id
// _this.formValidate.productId = row.id
})
},
handleSubmitNest1() {
if (!this.formValidate.image) {
this.$message.warning("请选择商品!");
return;
} else {
this.currentTab++;
if (!this.$route.params.id) this.getProdect(this.productId);
}
},
// 商品分类;
getCategorySelect() {
categoryApi({ status: -1, type: 1 }).then(res => {
this.merCateList = this.filerMerCateList(res)
})
},
filerMerCateList(treeData) {
return treeData.map((item) => {
if(!item.child){
item.disabled = true
}
item.label = item.name
return item
})
},
// 运费模板;
getShippingList() {
shippingTemplatesList(this.tempData).then(res => {
this.shippingList = res.list
})
},
// 运费模板
addTem() {
this.$refs.addTemplates.dialogVisible = true
this.$refs.addTemplates.getCityList()
},
// 商品详情
getInfo () {
if(!this.$route.params.id){
this.getProdect(this.productId)
}else{
this.getSekllProdect(this.$route.params.id)
}
},
getProdect(id) {
this.fullscreenLoading = true
productDetailApi(id).then(async res => {
this.formValidate = res;
this.formValidate = {
image: res.image,
imagelist: JSON.parse(res.sliderImage),
title: res.storeName,
info: res.storeInfo,
quota: '',
unitName: res.unitName,
sort: res.sort,
tempId: res.tempId,
attr: res.attr,
selectRule: res.selectRule,
content: res.content,
specType: res.specType,
productId: res.id,
giveIntegral: res.giveIntegral,
ficti: res.ficti,
startTime: res.startTime || '',
stopTime: res.stopTime || '',
timeVal: [],
status: 0,
isShow: false,
num : 1,
isHost : false,
people : 2,
onceNum : 1,
virtualRation : '',
effectiveTime : 0,
isPostage: false
}
if(res.specType){
res.attrValues.forEach((row) => {
row.quota = row.stock;
});
this.$nextTick(() => {
res.attrValues.forEach((row) => {
this.$refs.multipleTable.toggleRowSelection(row, true);
this.$set(row, 'checked', true)
});
});
this.ManyAttrValue = res.attrValues
this.multipleSelection = res.attrValues
}else{
res.attrValue.forEach((row) => {
row.quota = row.stock;
});
this.ManyAttrValue = res.attrValue
this.formValidate.attr = []
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
getSekllProdect(id) {
this.fullscreenLoading = true
combinationInfoApi({id:id}).then(async res => {
this.formValidate = res;
this.formValidate = {
image: res.image,
imagelist: JSON.parse(res.sliderImage),
title: res.title,
info: res.info,
unitName: res.unitName,
sort: res.sort,
tempId: res.tempId,
attr: res.attr,
selectRule: res.selectRule,
content: res.content,
specType: res.specType,
productId: res.productId,
giveIntegral: res.giveIntegral,
ficti: res.ficti,
timeVal: res.startTimeStr && res.stopTimeStr ? [res.startTimeStr, res.stopTimeStr] : [],
status: res.status,
isShow: res.isShow,
num : res.num,
isHost : res.isHost,
people : res.people,
onceNum : res.onceNum,
virtualRation : res.virtualRation,
effectiveTime : res.effectiveTime,
isPostage: false,
startTime: res.startTimeStr || '',
stopTime: res.stopTimeStr || '',
peopleNum : Math.floor(res.people-res.virtualRation/100*res.people)
}
if(res.specType){
this.ManyAttrValue = res.attrValues;
this.$nextTick(() => {
this.ManyAttrValue.forEach((item, index) => {
if (item.checked) {
this.$set(item, 'price', item.price)
this.$set(item, 'quota', item.quota)
this.$nextTick(() => {
this.$refs.multipleTable.toggleRowSelection(item, true)
})
}
})
});
}else{
this.ManyAttrValue = res.attrValue
this.formValidate.attr = []
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
handleSubmitNest2(name) {
this.$refs[name].validate((valid) => {
if (valid) {
if(this.formValidate.specType && this.multipleSelection.length ===0 ) return this.$message.warning("请选择至少一个商品属性!");
this.currentTab++;
// this.multipleSelection.every((value, index) => {
// if(!value.quota){
// this.$message.warning("请填选择至少一个商品属性!");
// return false;
// }else{
// this.currentTab++;
// return true;
// }
// });
// for(i = 0; i < this.multipleSelection.length; i++){
// if(!this.multipleSelection[i].quota){
// break;
// }else{
// this.currentTab++;
// }
// }
} else {
return false;
}
});
},
// 提交
handleSubmit(name) {
if(!this.formValidate.specType){
this.formValidate.attr = []
this.formValidate.attrValue = this.ManyAttrValue
}else{
this.formValidate.attrValue = this.multipleSelection
}
this.formValidate.images = JSON.stringify(this.formValidate.imagelist);
this.formValidate.virtualRation = Math.floor((this.formValidate.people - this.formValidate.peopleNum) / this.formValidate.people * 100)
this.$refs[name].validate((valid) => {
if (valid) {
this.fullscreenLoading = true;
this.loading = true;
this.$route.params.id
? combinationUpdateApi({id: this.$route.params.id}, this.formValidate)
.then(async () => {
this.fullscreenLoading = false;
this.$message.success('编辑成功');
this.$router.push({
path: "/marketing/groupBuy/groupGoods",
});
this.$refs[name].resetFields();
this.formValidate.imagelist = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
})
: combinationSaveApi(this.formValidate)
.then(async (res) => {
this.fullscreenLoading = false;
this.$message.success('新增成功');
this.$router.push({
path: "/marketing/groupBuy/groupGoods",
});
this.$refs[name].resetFields();
this.formValidate.imagelist = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
});
} else {
if (
!this.formValidate.storeName ||
!this.formValidate.unitName ||
!this.formValidate.store_info ||
!this.formValidate.image ||
!this.formValidate.images
) {
this.$message.warning("请填写完整商品信息!");
}
}
});
},
handleSubmitUp() {
if (this.currentTab-- < 0) this.currentTab = 0;
},
setTagsViewTitle() {
const title = '编辑拼团商品'
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.$route.params.id}` })
this.$store.dispatch('tagsView/updateVisitedView', route)
},
// 移动
handleDragStart (e, item) {
this.dragging = item;
},
handleDragEnd (e, item) {
this.dragging = null
},
handleDragOver (e) {
e.dataTransfer.dropEffect = 'move'
},
handleDragEnter (e, item) {
e.dataTransfer.effectAllowed = 'move'
if (item === this.dragging) {
return
}
const newItems = [...this.formValidate.imagelist]
const src = newItems.indexOf(this.dragging)
const dst = newItems.indexOf(item)
newItems.splice(dst, 0, ...newItems.splice(src, 1))
this.formValidate.imagelist = newItems;
}
}
}
</script>
<style scoped lang="scss">
.inpBox{
/deep/.el-form-item__error {
color: #ff4949;
font-size: 12px;
line-height: 20px;
padding-top: 4px;
position: static !important;
/* position: absolute; */
/* top: 100%; */
/* left: 0; */
}
}
.labeltop{
/deep/.el-input-number--small{
/*width: 172px !important;*/
min-width: 132px !important;
}
}
.proCoupon{
/deep/.el-form-item__content{
margin-top: 5px;
}
}
.tabPic{
width: 40px !important;
height: 40px !important;
img{
width: 100%;
height: 100%;
}
}
.noLeft{
/deep/.el-form-item__content{
margin-left: 0 !important;
}
}
.tabNumWidth{
/deep/.el-input-number--medium{
width: 121px !important;
}
/deep/.el-input-number__increase{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number__decrease{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number--medium .el-input__inner {
padding-left: 25px !important;
padding-right: 25px !important;
}
/deep/ thead{
line-height: normal !important;
}
/deep/ .el-table .cell{
line-height: normal !important;
}
}
.selWidth{
width: 80%;
}
.selWidthd{
width: 350px;
}
.button-new-tag {
height: 28px;
line-height: 26px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.pictrue{
width: 60px;
height: 60px;
border: 1px dotted rgba(0,0,0,0.1);
margin-right: 10px;
position: relative;
cursor: pointer;
img{
width: 100%;
height: 100%;
}
}
.btndel{
position: absolute;
z-index: 1;
width :20px !important;
height: 20px !important;
left: 46px;
top: -4px;
}
.labeltop{
/deep/.el-form-item__label{
/*float: none !important;*/
/*display: inline-block !important;*/
/*margin-left: 120px !important;*/
/*width: auto !important;*/
}
}
</style>

View File

@@ -0,0 +1,218 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form inline>
<el-form-item label="拼团状态:">
<el-select v-model="tableFrom.isShow" placeholder="请选择" class="filter-item selWidth mr20" @change="getList(1)" clearable>
<el-option label="关闭" :value="0" />
<el-option label="开启" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="商品搜索:">
<el-input v-model="tableFrom.keywords" placeholder="请输入商品名称、ID" class="selWidth" clearable>
<el-button slot="append" icon="el-icon-search" @click="getList(1)"/>
</el-input>
</el-form-item>
</el-form>
</div>
<router-link :to=" { path:'/marketing/groupBuy/creatGroup' }">
<el-button size="mini" type="primary" class="mr10">添加拼团商品</el-button>
</router-link>
<el-button size="mini" class="mr10" @click="exportList">导出</el-button>
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
style="width: 100%"
size="mini"
ref="multipleTable"
>
<el-table-column
prop="id"
label="ID"
min-width="50"
/>
<el-table-column label="拼图图片" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.image"
:preview-src-list="[scope.row.image]"
/>
</div>
</template>
</el-table-column>
<el-table-column
label="拼团名称"
prop="title"
min-width="100"
/>
<el-table-column
label="原价"
prop="otPrice"
min-width="100"
/>
<el-table-column
label="拼团价"
prop="price"
min-width="100"
/>
<el-table-column
label="拼团人数"
prop="countPeople"
min-width="100"
/>
<el-table-column
label="参与人数"
prop="countPeopleAll"
min-width="100"
/>
<el-table-column
label="成团数量"
prop="countPeoplePink"
min-width="100"
/>
<el-table-column
label="限量"
min-width="100"
prop="quotaShow"
/>
<el-table-column
label="限量剩余"
prop="remainingQuota"
min-width="100"
/>
<el-table-column
prop="stopTime"
label="结束时间"
min-width="130"
>
<template slot-scope="scope">
<span>{{ scope.row.stopTime| formatDate}}</span>
</template>
</el-table-column>
<el-table-column
label="拼团状态"
min-width="150"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
:active-value="true"
:inactive-value="false"
active-text="开启"
inactive-text="关闭"
@change="onchangeIsShow(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" min-width="150" fixed="right" align="center">
<template slot-scope="scope">
<router-link :to="{ path:'/marketing/groupBuy/creatGroup/' + scope.row.id}">
<el-button type="text" size="small">编辑</el-button>
</router-link>
<el-button type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)" class="mr10">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block mb20">
<el-pagination
:page-sizes="[10, 20, 30, 40]"
:page-size="tableFrom.limit"
:current-page="tableFrom.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
/>
</div>
</el-card>
</div>
</template>
<script>
import { combinationListApi, combinationDeleteApi, combinationStatusApi, exportcombiantionApi } from '@/api/marketing'
import { formatDates } from '@/utils/index';
export default {
name: "index",
filters: {
formatDate (time) {
if (time !== 0) {
const date = new Date(time);
return formatDates(date, 'yyyy-MM-dd hh:mm');
}
}
},
data() {
return {
tableFrom: {
page: 1,
limit: 20,
keywords: '',
isShow: ''
},
listLoading: true,
tableData: {
data: [],
total: 0
},
}
},
mounted() {
this.getList()
},
methods: {
//导出
exportList(){
exportcombiantionApi({keywords: this.tableFrom.keywords, isShow:this.tableFrom.isShow}).then((res) => {
window.open(res.fileName)
})
},
// 删除
handleDelete(id, idx) {
this.$modalSure().then(() => {
combinationDeleteApi({id: id}).then(() => {
this.$message.success('删除成功')
this.tableData.data.splice(idx, 1)
})
})
},
onchangeIsShow(row) {
combinationStatusApi({id:row.id,isShow: row.isShow})
.then(async () => {
this.$message.success('修改成功');
this.getList()
}).catch(()=>{
row.isShow = !row.isShow
})
},
// 列表
getList(num) {
this.listLoading = true
this.tableFrom.page = num ? num : this.tableFrom.page;
combinationListApi(this.tableFrom).then(res => {
this.tableData.data = res.list
this.tableData.total = res.total
this.listLoading = false
}).catch((res) => {
this.listLoading = false
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,265 @@
<template>
<div class="divBox">
<el-card class="box-card mb15">
<cards-data :cardLists="cardLists"></cards-data>
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form size="small" label-width="100px">
<el-form-item label="时间选择:" class="width100">
<el-radio-group v-model="tableFrom.dateLimit" type="button" class="mr20" size="small" @change="selectChange(tableFrom.dateLimit)">
<el-radio-button v-for="(item,i) in fromList.fromTxt" :key="i" :label="item.val">{{ item.text }}</el-radio-button>
</el-radio-group>
<el-date-picker v-model="timeVal" value-format="yyyy-MM-dd" format="yyyy-MM-dd" size="small" type="daterange" placement="bottom-end" placeholder="自定义时间" style="width: 250px;" @change="onchangeTime" />
</el-form-item>
<el-form-item label="拼团状态:">
<el-select v-model="tableFrom.status" placeholder="请选择" class="filter-item selWidth mr20" @change="getList(1)" clearable>
<el-option label="进行中" :value="1" />
<el-option label="已成功" :value="2" />
<el-option label="未完成" :value="3" />
</el-select>
</el-form-item>
</el-form>
</div>
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
style="width: 100%"
size="mini"
ref="multipleTable"
>
<el-table-column
prop="id"
label="ID"
min-width="50"
/>
<el-table-column label="头像" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.avatar"
:preview-src-list="[scope.row.avatar]"
/>
</div>
</template>
</el-table-column>
<el-table-column
label="开团团长"
prop="nickname"
min-width="100"
/>
<el-table-column
label="开团时间"
prop="addTime"
min-width="100"
/>
<el-table-column
label="拼团商品"
prop="title"
min-width="100"
/>
<el-table-column
label="几人团"
prop="people"
min-width="100"
/>
<el-table-column
label="几人参加"
prop="countPeople"
min-width="100"
/>
<el-table-column
prop="stopTime"
label="结束时间"
min-width="130"
/>
<el-table-column
label="拼团状态"
min-width="150"
>
<template slot-scope="scope">
<el-tag :type="scope.row.status | groupColorFilter">{{scope.row.status | groupStatusFilter}}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="150" fixed="right" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleLook(scope.row.id)" class="mr10">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<div class="block mb20">
<el-pagination
:page-sizes="[10, 20, 30, 40]"
:page-size="tableFrom.limit"
:current-page="tableFrom.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
/>
</div>
</el-card>
<el-dialog
title="查看详情"
:visible.sync="dialogVisible"
width="650px"
:before-close="handleClose">
<el-table
v-loading="listLoadingPink"
:data="tableDataPink.data"
style="width: 100%"
size="mini"
ref="multipleTable"
>
<el-table-column
prop="id"
label="ID"
min-width="50"
/>
<el-table-column label="头像" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.avatar"
:preview-src-list="[scope.row.avatar]"
/>
</div>
</template>
</el-table-column>
<el-table-column
label="用户名称"
prop="nickname"
min-width="100"
/>
<el-table-column
label="订单编号"
prop="orderId"
min-width="180"
/>
<el-table-column
label="金额"
prop="price"
min-width="100"
/>
<el-table-column
label="订单状态"
min-width="100"
>
<template slot-scope="scope">
<span>{{scope.row.status | orderStatusFilter}}</span>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import {fromList} from '@/utils/constants.js';
import { combineListApi, combineStatisticsApi,combineOrderPinkApi } from '@/api/marketing'
import cardsData from '@/components/cards/index'
export default {
name: "groupList",
components: {
cardsData
},
data() {
return {
listLoadingPink: false,
dialogVisible: false,
tableDataPink: {
data: []
},
tableData: {
data: [],
total: 0
},
listLoading: false,
tableFrom: {
dateLimit: '',
status: '',
page: 1,
limit: 20
},
fromList: fromList,
timeVal: [],
cardLists: []
}
},
mounted() {
this.getStatistics();
this.getList();
},
methods:{
handleClose(){
this.dialogVisible = false
},
handleLook(id){
this.dialogVisible = true;
this.getPink(id);
},
getPink(id) {
this.listLoadingPink = true;
combineOrderPinkApi(id).then(res => {
this.tableDataPink.data = res
this.listLoadingPink = false
}).catch(() => {
this.listLoadingPink = false
})
},
selectChange(tab) {
this.tableFrom.dateLimit = tab
this.tableFrom.page = 1
this.timeVal = []
this.getList()
},
// 具体日期
onchangeTime(e) {
this.timeVal = e
this.tableFrom.dateLimit = e ? this.timeVal.join(',') : ''
this.tableFrom.page = 1
this.getList()
},
// 列表
getList(num) {
this.listLoading = true;
this.tableFrom.page = num ? num : this.tableFrom.page;
combineListApi(this.tableFrom).then(res => {
this.tableData.data = res.list
this.tableData.total = res.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
},
// 统计
getStatistics() {
combineStatisticsApi().then(res => {
this.cardLists = [
{ name: '参与人数(人)', count: res.countPeople },
{ name: '成团数量(个)', count: res.countTeam }
]
}).catch(() => {
this.listLoading = false
})
},
}
}
</script>
<style scoped>
</style>

View File

@@ -11,7 +11,7 @@
</el-select>
</el-form-item>
<el-form-item label="秒杀名称:">
<el-input v-model="tableFrom.name" placeholder="请输入秒杀名称" class="selWidth">
<el-input v-model="tableFrom.name" placeholder="请输入秒杀名称" class="selWidth" clearable>
<el-button slot="append" icon="el-icon-search" @click="getList(1)"/>
</el-input>
</el-form-item>
@@ -187,7 +187,9 @@
.then(async () => {
this.$message.success('修改成功');
this.getList()
})
}).catch(()=>{
row.status = !row.status
})
},
onEditSort(row) {
this.$set(row, 'isEdit', true)

View File

@@ -42,7 +42,7 @@
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品轮播图:" prop="images">
<el-form-item label="商品轮播图:" prop="imagess">
<div class="acea-row">
<div
v-for="(item,index) in formValidate.imagess"
@@ -57,7 +57,7 @@
<img :src="item">
<i class="el-icon-error btndel" @click="handleRemove(index)" />
</div>
<div class="upLoadPicBox" @click="modalPicTap('2')">
<div v-if="formValidate.imagess.length<10" class="upLoadPicBox" @click="modalPicTap('2')">
<div class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
@@ -67,12 +67,12 @@
</el-col>
<el-col :span="24">
<el-form-item label="商品标题:" prop="title">
<el-input v-model="formValidate.title" placeholder="请输入商品名称" />
<el-input v-model="formValidate.title" maxlength="249" placeholder="请输入商品名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="秒杀活动简介:">
<el-input v-model="formValidate.info" type="textarea" :rows="3" placeholder="请输入商品简介" />
<el-input v-model="formValidate.info" type="textarea" maxlength="250" :rows="3" placeholder="请输入商品简介" />
</el-form-item>
</el-col>
<!--<el-col v-bind="grid2">-->
@@ -115,6 +115,7 @@
size="small"
type="daterange"
placement="bottom-end"
:picker-options="pickerOptions"
placeholder="请选择活动日期"
@change="onchangeTime"
/>
@@ -318,6 +319,11 @@
components: { CreatTemplates },
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() < new Date().setTime(new Date().getTime() - 3600 * 1000 * 24);
}
},
props2: {
children: 'child',
label: 'name',
@@ -451,6 +457,8 @@
_this.ManyAttrValue[0].image = img[0].sattDir
}
if(tit==='2'&& !num){
if(img.length>10) return this.$message.warning("最多选择10张图片");
if(img.length + _this.formValidate.imagess.length > 10) return this.$message.warning("最多选择10张图片");
img.map((item) => {
_this.formValidate.imagess.push(item.sattDir)
});
@@ -715,6 +723,27 @@
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.$route.params.id}` })
this.$store.dispatch('tagsView/updateVisitedView', route)
},
// 移动
handleDragStart (e, item) {
this.dragging = item;
},
handleDragEnd (e, item) {
this.dragging = null
},
handleDragOver (e) {
e.dataTransfer.dropEffect = 'move'
},
handleDragEnter (e, item) {
e.dataTransfer.effectAllowed = 'move'
if (item === this.dragging) {
return
}
const newItems = [...this.formValidate.imagess]
const src = newItems.indexOf(this.dragging)
const dst = newItems.indexOf(item)
newItems.splice(dst, 0, ...newItems.splice(src, 1))
this.formValidate.imagess = newItems;
}
}
}
</script>

View File

@@ -24,7 +24,7 @@
<!--</el-input>-->
</el-form-item>
<el-form-item label="商品搜索:">
<el-input v-model="tableFrom.keywords" placeholder="请输入商品ID/名称" class="selWidth">
<el-input v-model="tableFrom.keywords" placeholder="请输入商品ID/名称" class="selWidth" clearable>
<el-button slot="append" icon="el-icon-search" @click="getList(1)"/>
</el-input>
</el-form-item>
@@ -218,7 +218,9 @@
.then(async () => {
this.$message.success('修改成功');
this.getList()
})
}).catch(()=>{
row.status = !row.status
})
}
}
}