Browse Source

拼团秒杀砍价支持链接图

master
1304317391@qq.com 2 years ago
parent
commit
ac6ccbbb16
  1. 7
      src/api/bxg/yxStoreBargain.js
  2. 52
      src/views/bxg/activity/bargain/form.vue
  3. 31
      src/views/bxg/activity/combination/form.vue
  4. 20
      src/views/bxg/activity/seckill/form.vue

7
src/api/bxg/yxStoreBargain.js

@ -15,6 +15,13 @@ export function del(id) {
}) })
} }
export function getBargainInfo(id) {
return request({
url: '/bxg/api/yxStoreBargain/info/' + id,
method: 'get'
})
}
export function edit(data) { export function edit(data) {
return request({ return request({
url: '/bxg/api/yxStoreBargain', url: '/bxg/api/yxStoreBargain',

52
src/views/bxg/activity/bargain/form.vue

@ -36,9 +36,17 @@
/> />
</template> </template>
</el-form-item> </el-form-item>
<el-col :span="12">
<el-form-item label="砍价产品主图片"> <el-form-item label="砍价产品主图片">
<single-pic v-model="form.image" style="width: 500px" type="image" :num="1" :width="150" :height="150" /> <single-pic v-model="form.image" type="image" :num="1" :width="150" :height="150" />
</el-form-item> </el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产品链接图">
<single-pic v-model="form.linkImage" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
</el-col>
<el-form-item label="砍价产品轮播图"> <el-form-item label="砍价产品轮播图">
<MaterialList v-model="form.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" /> <MaterialList v-model="form.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" />
</el-form-item> </el-form-item>
@ -63,15 +71,16 @@
<el-form-item label="单次砍最低价"> <el-form-item label="单次砍最低价">
<el-input-number v-model="form.bargainMinPrice" /> <el-input-number v-model="form.bargainMinPrice" />
</el-form-item> --> </el-form-item> -->
<el-form-item label="单用户砍价次数"> <el-form-item label="成本价">
<el-input-number v-model="form.bargainNum" /> <el-input-number v-model="form.cost" />
</el-form-item> </el-form-item>
<el-form-item label="砍价状态"> <el-form-item label="砍价状态">
<el-radio v-model="form.status" :label="1">开启</el-radio> <el-radio v-model="form.status" :label="1">开启</el-radio>
<el-radio v-model="form.status" :label="0" style="width: 110px;">关闭</el-radio> <el-radio v-model="form.status" :label="0" style="width: 110px;">关闭</el-radio>
</el-form-item> </el-form-item>
<el-form-item label="成本价">
<el-input-number v-model="form.cost" /> <el-form-item label="砍价人数">
<el-input-number v-model="form.bargainNum" />
</el-form-item> </el-form-item>
<el-form-item label="排序"> <el-form-item label="排序">
<el-input-number v-model="form.sort" /> <el-input-number v-model="form.sort" />
@ -102,7 +111,7 @@
<script> <script>
import cgood from '@/views/components/good' import cgood from '@/views/components/good'
import { add, edit } from '@/api/bxg/yxStoreBargain' import { add, edit ,getBargainInfo} from '@/api/bxg/yxStoreBargain'
import editor from '../../components/Editor' import editor from '../../components/Editor'
import MaterialList from '@/components/material' import MaterialList from '@/components/material'
import singlePic from '@/components/singlematerial' import singlePic from '@/components/singlematerial'
@ -139,6 +148,7 @@ export default {
productId: '', productId: '',
title: '', title: '',
image: '', image: '',
linkImage:'',
unitName: '', unitName: '',
stock: '', stock: '',
sales: '', sales: '',
@ -181,6 +191,12 @@ export default {
this.form1.good.image = this.form.image this.form1.good.image = this.form.image
this.form1.good.productId = this.form.productId this.form1.good.productId = this.form.productId
},
'form.linkImage': function(val) {
if(val){
this.form.linkImage=val
}
}, },
'form.sliderImageArr': function(val) { 'form.sliderImageArr': function(val) {
console.log("aaa:"+val) console.log("aaa:"+val)
@ -191,20 +207,37 @@ export default {
'form1.good.productId': { 'form1.good.productId': {
handler(val,oldVal){ handler(val,oldVal){
if(val){ if(val){
this.getBargainInfo()
this.getInfoChooseGood (val) this.getInfoChooseGood (val)
} }
}, },
deep:true// deep:true//
}, },
}, },
// mounted() {
// this.getBargainInfo()
// },
methods: { methods: {
//
getBargainInfo(){
let that=this
let id=this.form.id
getBargainInfo(id).then(res=>{
console.log('res',res,this.form.linkImage)
if(res.linkImage==null||res.linkImage==undefined){
that.form.linkImage=''
}else{
that.form.linkImage=res.linkImage;
}
})
},
// //
getInfoChooseGood (id) { getInfoChooseGood (id) {
let that = this; let that = this;
getInfo(id).then(async res => { getInfo(id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
console.info('data:'+JSON.stringify(data)) // console.info('data:'+JSON.stringify(data))
if(data){ if(data){
let cate_id = parseInt(data.cate_id) || 0; let cate_id = parseInt(data.cate_id) || 0;
//that.form = data; //that.form = data;
@ -219,7 +252,7 @@ export default {
that.form.imageArr = data.image that.form.imageArr = data.image
that.form.sliderImageArr = data.slider_image that.form.sliderImageArr = data.slider_image
that.form.status = 1 that.form.status = 1
//that.form.minPrice = 0 // //that.form.minPrice = 0
//that.form.num = 1 //that.form.num = 1
//that.form.bargainMaxPrice = 0 //that.form.bargainMaxPrice = 0
//that.form.bargainMinPrice = 0 //that.form.bargainMinPrice = 0
@ -293,6 +326,7 @@ export default {
productId: '', productId: '',
title: '', title: '',
image: '', image: '',
linkImage:'',
unitName: '', unitName: '',
stock: '', stock: '',
sales: '', sales: '',

31
src/views/bxg/activity/combination/form.vue

@ -11,23 +11,23 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="拼团商品名称" prop="title" > <el-form-item label="拼团商品名称" prop="title" >
<el-input v-model="formValidate.title" @input="onInput()" disabled="true" style="width: 500px;" placeholder="请输入拼团名称"/> <el-input v-model="formValidate.title" @input="onInput()" :disabled="true" style="width: 500px;" placeholder="请输入拼团名称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="拼团简介" prop="info" > <el-form-item label="拼团简介" prop="info" >
<el-input v-model="formValidate.info" disabled="true" @input="onInput()" style="width: 500px;" placeholder="请输入拼团简介"/> <el-input v-model="formValidate.info" :disabled="true" @input="onInput()" style="width: 500px;" placeholder="请输入拼团简介"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="单位" prop="unitName" > <el-form-item label="单位" prop="unitName" >
<el-input v-model="formValidate.unitName" disabled="true" @input="onInput()" style="width: 500px;" placeholder="请输入单位"/> <el-input v-model="formValidate.unitName" :disabled="true" @input="onInput()" style="width: 500px;" placeholder="请输入单位"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="商品原价" > <el-form-item label="商品原价" >
<!-- oneFormValidate[0].cost--> <!-- oneFormValidate[0].cost-->
<el-input type="text" style="width: 500px;" disabled v-model="formValidate.productPrice" /> <el-input type="text" style="width: 500px;" :disabled="true" v-model="formValidate.productPrice" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -58,12 +58,18 @@
<el-radio v-model="formValidate.isShow" :label="0" style="width: 200px;">关闭</el-radio> <el-radio v-model="formValidate.isShow" :label="0" style="width: 200px;">关闭</el-radio>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="12">
<el-form-item label="产品主图片" prop="image"> <el-form-item label="产品主图片" prop="image">
<single-pic v-model="formValidate.image" style="width: 500px" type="image" :num="1" :width="150" <single-pic v-model="formValidate.image" style="width: 500px" type="image" :num="1" :width="150"
:height="150"/> :height="150"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="产品链接图" prop="image">
<single-pic v-model="formValidate.linkImage" style="width: 500px" type="image" :num="1" :width="150"
:height="150"/>
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="产品轮播图" prop="slider_image"> <el-form-item label="产品轮播图" prop="slider_image">
<MaterialList v-model="formValidate.slider_image" style="width: 500px" type="image" :num="4" :width="150" <MaterialList v-model="formValidate.slider_image" style="width: 500px" type="image" :num="4" :width="150"
@ -282,6 +288,7 @@ export default {
productId: '', productId: '',
merId: '', merId: '',
image: '', image: '',
linkImage:'',
images: '', images: '',
imageArr: [], imageArr: [],
sliderImageArr: [], sliderImageArr: [],
@ -408,11 +415,11 @@ export default {
} }
}, },
watch: { watch: {
// 'formValidate.imageArr': function(val) { 'formValidate.linkImage': function(val) {
// if (val) { if (val) {
// this.form.image = val.join(',') this.formValidate.linkImage = val
// } }
// }, },
'formValidate.slider_image': function (val) { 'formValidate.slider_image': function (val) {
if (val && Array.isArray(val)) { if (val && Array.isArray(val)) {
@ -616,6 +623,9 @@ export default {
let cate_id = parseInt(data.cate_id) || 0; let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || []; this.attrs = data.items || [];
that.formValidate = data; that.formValidate = data;
if(data.linkImage==null||data.linkImage){
that.formValidate.linkImage=''
}
that.formValidate.cate_id = cate_id; that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr]; that.oneFormValidate = [data.attr];
that.formValidate.productPrice = that.oneFormValidate[0].cost that.formValidate.productPrice = that.oneFormValidate[0].cost
@ -729,6 +739,7 @@ export default {
productId: '', productId: '',
merId: '', merId: '',
image: '', image: '',
linkImage:'',
images: '', images: '',
imageArr: [], imageArr: [],
sliderImageArr: [], sliderImageArr: [],

20
src/views/bxg/activity/seckill/form.vue

@ -58,14 +58,19 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="12">
<el-form-item label="产品主图片"> <el-form-item label="产品主图片">
<single-pic v-model="formValidate.image" 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="12">
<el-form-item label="产品链接图">
<single-pic v-model="formValidate.linkImage" style="width: 500px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="产品轮播图"> <el-form-item label="产品轮播图">
<MaterialList v-model="formValidate.slider_image" style="width: 500px" type="image" :num="4" :width="150" :height="150" /> <MaterialList v-model="formValidate.slider_image" type="image" :num="4" :width="150" :height="150" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -275,6 +280,7 @@ export default {
productId: '', productId: '',
merId: '', merId: '',
image: '', image: '',
linkImage:'',
images: '', images: '',
imageArr:[], imageArr:[],
sliderImageArr: [], sliderImageArr: [],
@ -397,6 +403,11 @@ export default {
this.formValidate.images = val.join(',') this.formValidate.images = val.join(',')
} }
}, },
'formValidate.linkImage': function(val) {
if (val) {
this.formValidate.linkImage = val
}
},
'form1.good.productId': { 'form1.good.productId': {
handler(val,oldVal){ handler(val,oldVal){
if(val){ if(val){
@ -601,6 +612,10 @@ export default {
let cate_id = parseInt(data.cate_id) || 0; let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || []; this.attrs = data.items || [];
that.formValidate = data; that.formValidate = data;
console.log('data111111111',data)
// if(data.linkImage==null){
// that.formValidate.linkImage = '';
// }
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 = [];
@ -610,7 +625,6 @@ export default {
that.form1.good.image = data.image that.form1.good.image = data.image
that.generate(data.productId); that.generate(data.productId);
that.manyFormValidate = data.attrs; that.manyFormValidate = data.attrs;
console.log(data)
if(data.spec_type === 0){ if(data.spec_type === 0){
that.manyFormValidate = []; that.manyFormValidate = [];
}else { }else {

Loading…
Cancel
Save