Browse Source

优化营销商品添加修改逻辑

master
xuwenbo 4 years ago
parent
commit
b6f9923618
  1. 11
      src/views/activity/combination/form.vue
  2. 44
      src/views/activity/combination/index.vue
  3. 24
      src/views/activity/seckill/form.vue
  4. 44
      src/views/activity/seckill/index.vue
  5. 37
      src/views/shop/goods/index.vue

11
src/views/activity/combination/form.vue

@ -208,7 +208,7 @@
</el-col> </el-col>
<el-col :span="24" v-if="formValidate.is_sub === 1"> <el-col :span="24" v-if="formValidate.is_sub === 1">
<!--单规格返佣--> <!--单规格返佣-->
<el-form-item label="商品属性:" v-if="formValidate.spec_type === 0"> <el-form-item label="" v-if="formValidate.spec_type === 0">
<el-table :data="oneFormValidate" border> <el-table :data="oneFormValidate" border>
<el-table-column prop="imageArr" label="图片" align="center"> <el-table-column prop="imageArr" label="图片" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -240,7 +240,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form-item> </el-form-item>
<el-form-item label="商品属性:" v-if="formValidate.spec_type === 1 && manyFormValidate.length"> <el-form-item label="" v-if="formValidate.spec_type === 1 && manyFormValidate.length">
<el-table :data="manyFormValidate" border> <el-table :data="manyFormValidate" border>
<el-table-column prop="imageArr" label="图片" align="center"> <el-table-column prop="imageArr" label="图片" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -441,7 +441,7 @@ export default {
// is_new: 0, // is_new: 0,
// is_good: 0, // is_good: 0,
// is_postage: 0, // is_postage: 0,
// is_sub: 0, is_sub: 0,
id: 0, id: 0,
combinationId: 0, combinationId: 0,
productId: '', productId: '',
@ -746,7 +746,6 @@ export default {
] ]
} }
} }
that.treeSelect = res.cateList; that.treeSelect = res.cateList;
that.ruleList = res.ruleList; that.ruleList = res.ruleList;
that.templateList = res.tempList; that.templateList = res.tempList;
@ -766,7 +765,6 @@ export default {
let id = that.$route.params.id || 0; let id = that.$route.params.id || 0;
getCombinationInfo(id).then(async res => { getCombinationInfo(id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
console.log('data:'+data)
if(data){ if(data){
let cate_id = parseInt(data.cate_id) || 0; let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || []; this.attrs = data.items || [];
@ -802,7 +800,8 @@ export default {
that.treeSelect = res.cateList; that.treeSelect = res.cateList;
that.ruleList = res.ruleList; that.ruleList = res.ruleList;
that.templateList = res.tempList; that.templateList = res.tempList;
that.form1.good.productId = data.productId;
that.form1.good.image = data.image
}).catch(res => { }).catch(res => {
console.log('err:'+res) console.log('err:'+res)
return this.$message({ return this.$message({

44
src/views/activity/combination/index.vue

@ -15,7 +15,6 @@
size="mini" size="mini"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
@click="add"
> >
<router-link :to="'/activity/combinationAdd'"> <router-link :to="'/activity/combinationAdd'">
新增 新增
@ -174,49 +173,6 @@ export default {
}) })
}) })
.catch(() => { }) .catch(() => { })
},
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,
merId: data.merId,
image: data.image,
images: data.images,
imageArr: data.image.split(','),
sliderImageArr: data.images.split(','),
title: data.title,
attr: data.attr,
people: data.people,
info: data.info,
price: data.price,
sort: data.sort,
sales: data.sales,
stock: data.stock,
addTime: data.addTime,
isHost: data.isHost,
isShow: data.isShow,
isDel: data.isDel,
combination: data.combination,
merUse: data.merUse,
isPostage: data.isPostage,
postage: data.postage,
description: data.description,
startTime: data.startTime,
stopTime: data.stopTime,
startTimeDate: new Date(data.startTimeDate),
endTimeDate: new Date(data.endTimeDate),
effectiveTime: data.effectiveTime,
cost: data.cost,
browse: data.browse,
unitName: data.unitName
}
_this.dialog = true
} }
} }
} }

24
src/views/activity/seckill/form.vue

@ -60,7 +60,7 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="产品主图片"> <el-form-item label="产品主图片">
<single-pic v-model="formValidate.imageArr" style="width: 500px" type="image" :num="1" :width="150" :height="150" /> <single-pic v-model="formValidate.image" style="width: 500px" type="image" :num="1" :width="150" :height="150" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -68,11 +68,6 @@
<MaterialList v-model="formValidate.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" /> <MaterialList v-model="formValidate.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="返积分">
<el-input-number v-model="formValidate.giveIntegral" />
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="活动状态"> <el-form-item label="活动状态">
<el-radio v-model="formValidate.status" :label="1">开启</el-radio> <el-radio v-model="formValidate.status" :label="1">开启</el-radio>
@ -218,7 +213,7 @@
</el-col> </el-col>
<el-col :span="24" v-if="formValidate.is_sub === 1"> <el-col :span="24" v-if="formValidate.is_sub === 1">
<!--单规格返佣--> <!--单规格返佣-->
<el-form-item label="商品属性:" v-if="formValidate.spec_type === 0"> <el-form-item label="" v-if="formValidate.spec_type === 0">
<el-table :data="oneFormValidate" border> <el-table :data="oneFormValidate" border>
<el-table-column prop="imageArr" label="图片" align="center"> <el-table-column prop="imageArr" label="图片" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -250,7 +245,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form-item> </el-form-item>
<el-form-item label="商品属性:" v-if="formValidate.spec_type === 1 && manyFormValidate.length"> <el-form-item label="" v-if="formValidate.spec_type === 1 && manyFormValidate.length">
<el-table :data="manyFormValidate" border> <el-table :data="manyFormValidate" border>
<el-table-column prop="imageArr" label="图片" align="center"> <el-table-column prop="imageArr" label="图片" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -470,8 +465,7 @@ export default {
browse: 0, browse: 0,
startTimeDate: '', startTimeDate: '',
endTimeDate: '', endTimeDate: '',
is_sub: '',
spec_type: 0, spec_type: 0,
temp_id: '', temp_id: '',
attrs: [], attrs: [],
@ -567,7 +561,6 @@ export default {
}, },
'form1.good': { 'form1.good': {
handler(val,oldVal){ handler(val,oldVal){
this.formValidate = val.cform
this.getInfoChooseGood (val.cform.id) this.getInfoChooseGood (val.cform.id)
}, },
deep:true// deep:true//
@ -710,7 +703,6 @@ export default {
that.formValidate.title = data.store_name that.formValidate.title = data.store_name
that.formValidate.info = data.store_info that.formValidate.info = data.store_info
that.formValidate.unitName = data.unit_name that.formValidate.unitName = data.unit_name
that.formValidate.imageArr = data.image
that.formValidate.sliderImageArr = data.slider_image that.formValidate.sliderImageArr = data.slider_image
that.formValidate.status = 1 that.formValidate.status = 1
that.formValidate.header = []; that.formValidate.header = [];
@ -758,7 +750,6 @@ export default {
let id = that.$route.params.id || 0; let id = that.$route.params.id || 0;
getSecKillInfo(id).then(async res => { getSecKillInfo(id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
console.log('data:'+data)
if(data){ if(data){
let cate_id = parseInt(data.cate_id) || 0; let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || []; this.attrs = data.items || [];
@ -766,6 +757,8 @@ export default {
that.formValidate.cate_id = cate_id; that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr]; that.oneFormValidate = [data.attr];
that.formValidate.header = []; that.formValidate.header = [];
that.formValidate.image = data.image
that.formValidate.sliderImageArr = data.slider_image
that.generate(data.productId); that.generate(data.productId);
that.manyFormValidate = data.attrs; that.manyFormValidate = data.attrs;
if(data.spec_type === 0){ if(data.spec_type === 0){
@ -790,7 +783,8 @@ export default {
] ]
} }
} }
that.form1.good.productId = data.productId
that.form1.good.image = data.image
that.treeSelect = res.cateList; that.treeSelect = res.cateList;
that.ruleList = res.ruleList; that.ruleList = res.ruleList;
that.templateList = res.tempList; that.templateList = res.tempList;
@ -826,7 +820,7 @@ export default {
type: 'success' type: 'success'
}); });
setTimeout(() => { setTimeout(() => {
this.$router.push({ path: '/activity/combination' }); this.$router.push({ path: '/activity/seckill' });
}, 500); }, 500);
}).catch(res => { }).catch(res => {
// this.$message({ // this.$message({

44
src/views/activity/seckill/index.vue

@ -15,7 +15,6 @@
size="mini" size="mini"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
@click="add"
> >
<router-link :to="'/activity/secKillAdd'"> <router-link :to="'/activity/secKillAdd'">
新增 新增
@ -24,7 +23,6 @@
</div> </div>
</div> </div>
<!--表单组件--> <!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染--> <!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;"> <el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="id" /> <el-table-column prop="id" label="id" />
@ -88,15 +86,12 @@
/> />
</div> </div>
</template> </template>
<script> <script>
import checkPermission from '@/utils/permission' import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud' import initData from '@/mixins/crud'
import { del } from '@/api/yxStoreSeckill' import { del } from '@/api/yxStoreSeckill'
import eForm from './form1'
import { formatTimeTwo, parseTime } from '@/utils/index' import { formatTimeTwo, parseTime } from '@/utils/index'
export default { export default {
components: { eForm },
mixins: [initData], mixins: [initData],
data() { data() {
return { return {
@ -142,45 +137,6 @@ export default {
this.$refs[id].doClose() this.$refs[id].doClose()
console.log(err.response.data.message) 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,
image: data.image,
images: data.images,
imageArr: data.image.split(','),
sliderImageArr: data.images.split(','),
title: data.title,
info: data.info,
price: data.price,
cost: data.cost,
otPrice: data.otPrice,
giveIntegral: data.giveIntegral,
sort: data.sort,
stock: data.stock,
sales: data.sales,
unitName: data.unitName,
postage: data.postage,
description: data.description,
startTime: data.startTime,
stopTime: data.stopTime,
addTime: data.addTime,
status: data.status,
isPostage: data.isPostage,
isHot: data.isHot,
isDel: data.isDel,
num: data.num,
isShow: data.isShow,
timeId: data.timeId
}
_this.dialog = true
} }
} }
} }

37
src/views/shop/goods/index.vue

@ -36,7 +36,6 @@
</div> </div>
</div> </div>
<!--表单组件--> <!--表单组件-->
<bargainForm ref="form5" :is-add="isAdd" />
<!--表格渲染--> <!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;"> <el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="商品id" /> <el-table-column prop="id" label="商品id" />
@ -100,13 +99,10 @@
import checkPermission from '@/utils/permission' import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud' import initData from '@/mixins/crud'
import { del, onsale } from '@/api/yxStoreProduct' import { del, onsale } from '@/api/yxStoreProduct'
import eForm from './form'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import killForm from '@/views/activity/seckill/form'
import bargainForm from '@/views/activity/bargain/form'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
export default { export default {
components: { eForm, Treeselect,killForm, bargainForm }, components: { Treeselect },
mixins: [initData], mixins: [initData],
data() { data() {
return { return {
@ -241,37 +237,6 @@ export default {
} }
_this.dialog = true _this.dialog = true
}, },
editC(data) {
this.isAdd = false
const _this = this.$refs.form3
_this.form = {
productId: data.id,
merId: data.merId,
image: data.image,
images: data.sliderImage,
imageArr: data.image.split(','),
sliderImageArr: data.sliderImage.split(','),
title: data.storeName,
info: data.storeInfo,
postage: data.postage,
unitName: data.unitName,
sort: data.sort,
sales: data.sales,
stock: data.stock,
isShow: data.isShow,
isHost: data.isHot,
description: data.description,
isPostage: data.isPostage,
people: 0,
price: 0,
effectiveTime: 24,
combination: 1,
cost: data.cost,
isDel: 0,
browse: 0
}
_this.dialog = true
},
attr(data) { attr(data) {
console.log(3333) console.log(3333)
this.isAttr = false this.isAttr = false

Loading…
Cancel
Save