添加商品促销功能完善
This commit is contained in:
parent
e72245a58b
commit
e9be957d2a
8
src/api/memberLevel.js
Normal file
8
src/api/memberLevel.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
export function fetchList(params) {
|
||||||
|
return request({
|
||||||
|
url:'/memberLevel/list',
|
||||||
|
method:'get',
|
||||||
|
params:params
|
||||||
|
})
|
||||||
|
}
|
@ -10,8 +10,12 @@
|
|||||||
<add-product-sale v-show="showStatus[1]" v-model="productParam"></add-product-sale>
|
<add-product-sale v-show="showStatus[1]" v-model="productParam"></add-product-sale>
|
||||||
<add-product-attr v-show="showStatus[2]"></add-product-attr>
|
<add-product-attr v-show="showStatus[2]"></add-product-attr>
|
||||||
<add-product-relation v-show="showStatus[3]"></add-product-relation>
|
<add-product-relation v-show="showStatus[3]"></add-product-relation>
|
||||||
<el-button style="margin-top: 12px;" @click="prev">上一步</el-button>
|
<div style="display: block;text-align: center;margin-top: 50px">
|
||||||
<el-button style="margin-top: 12px;" @click="next">下一步</el-button>
|
<el-button-group>
|
||||||
|
<el-button icon="el-icon-arrow-left" @click="prev">上一步</el-button>
|
||||||
|
<el-button type="primary" @click="next">下一步<i class="el-icon-arrow-right el-icon--right"></i></el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -36,6 +40,7 @@
|
|||||||
flashPromotionPrice: 0,
|
flashPromotionPrice: 0,
|
||||||
flashPromotionSort: 0,
|
flashPromotionSort: 0,
|
||||||
giftPoint: 0,
|
giftPoint: 0,
|
||||||
|
giftGrowth: 0,
|
||||||
keywords: '',
|
keywords: '',
|
||||||
lowStock: 0,
|
lowStock: 0,
|
||||||
name: '',
|
name: '',
|
||||||
@ -48,6 +53,7 @@
|
|||||||
{
|
{
|
||||||
memberLevelId: 0,
|
memberLevelId: 0,
|
||||||
memberPrice: 0,
|
memberPrice: 0,
|
||||||
|
memberLevelName:null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
productFullReductionList: [
|
productFullReductionList: [
|
||||||
@ -102,7 +108,7 @@
|
|||||||
productSn: '',
|
productSn: '',
|
||||||
promotionEndTime: '',
|
promotionEndTime: '',
|
||||||
promotionPerLimit: 0,
|
promotionPerLimit: 0,
|
||||||
promotionPrice: 0,
|
promotionPrice: null,
|
||||||
promotionStartTime: '',
|
promotionStartTime: '',
|
||||||
promotionType: 0,
|
promotionType: 0,
|
||||||
publishStatus: 0,
|
publishStatus: 0,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="margin-top: 50px">
|
<div style="margin-top: 50px">
|
||||||
<el-form :model="value" :rules="rules" ref="productInfoForm" label-width="150px" style="width: 520px" size="small">
|
<el-form :model="value" :rules="rules" ref="productInfoForm" label-width="150px" style="width: 600px" size="small">
|
||||||
<el-form-item label="商品分类:" prop="productCategoryId">
|
<el-form-item label="商品分类:" prop="productCategoryId">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="selectProductCateValue"
|
v-model="selectProductCateValue"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="margin-top: 50px">
|
<div style="margin-top: 50px">
|
||||||
<el-form :model="value" ref="productSaleForm" label-width="150px" style="width: 520px" size="small">
|
<el-form :model="value" ref="productSaleForm" label-width="150px" style="width: 600px" size="small">
|
||||||
<el-form-item label="赠送积分:">
|
<el-form-item label="赠送积分:">
|
||||||
<el-input v-model="value.giftPoint"></el-input>
|
<el-input v-model="value.giftPoint"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="赠送成长值:">
|
<el-form-item label="赠送成长值:">
|
||||||
<el-input></el-input>
|
<el-input v-model="value.giftGrowth"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="积分购买限制:">
|
<el-form-item label="积分购买限制:">
|
||||||
<el-input v-model="value.usePointLimit"></el-input>
|
<el-input v-model="value.usePointLimit"></el-input>
|
||||||
@ -57,16 +57,136 @@
|
|||||||
<el-form-item label="商品备注:">
|
<el-form-item label="商品备注:">
|
||||||
<el-input v-model="value.note" type="textarea" :autoSize="true"></el-input>
|
<el-input v-model="value.note" type="textarea" :autoSize="true"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="选择优惠方式:">
|
||||||
|
<el-radio-group v-model="value.promotionType" size="small">
|
||||||
|
<el-radio-button :label="0">无优惠</el-radio-button>
|
||||||
|
<el-radio-button :label="1">特惠促销</el-radio-button>
|
||||||
|
<el-radio-button :label="2">会员价格</el-radio-button>
|
||||||
|
<el-radio-button :label="3">阶梯价格</el-radio-button>
|
||||||
|
<el-radio-button :label="4">满减价格</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-show="value.promotionType===1">
|
||||||
|
<div>
|
||||||
|
开始时间:
|
||||||
|
<el-date-picker
|
||||||
|
v-model="value.promotionStartTime"
|
||||||
|
value-format="timestamp"
|
||||||
|
type="datetime"
|
||||||
|
:picker-options="pickerOptions1"
|
||||||
|
placeholder="选择开始时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</div>
|
||||||
|
<div class="littleMargin">
|
||||||
|
结束时间:
|
||||||
|
<el-date-picker
|
||||||
|
v-model="value.promotionEndTime"
|
||||||
|
value-format="timestamp"
|
||||||
|
type="datetime"
|
||||||
|
:picker-options="pickerOptions1"
|
||||||
|
placeholder="选择结束时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</div>
|
||||||
|
<div class="littleMargin">
|
||||||
|
促销价格:
|
||||||
|
<el-input style="width: 220px"v-model="value.promotionPrice" placeholder="输入促销价格"></el-input>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-show="value.promotionType===2">
|
||||||
|
<div v-for="(item, index) in value.memberPriceList" :class="{littleMargin:index!==0}">
|
||||||
|
{{item.memberLevelName}}:<el-input v-model="item.memberPrice" style="width: 200px"></el-input>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-show="value.promotionType===3">
|
||||||
|
<el-table :data="value.productLadderList"
|
||||||
|
style="width: 80%" border>
|
||||||
|
<el-table-column
|
||||||
|
label="数量"
|
||||||
|
align="center"
|
||||||
|
width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.count"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="价格"
|
||||||
|
align="center"
|
||||||
|
width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.price"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" @click="handleRemoveProductLadder(scope.$index, scope.row)">删除</el-button>
|
||||||
|
<el-button type="text" @click="handleAddProductLadder(scope.$index, scope.row)">添加</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-show="value.promotionType===4">
|
||||||
|
<el-table :data="value.productFullReductionList"
|
||||||
|
style="width: 80%" border>
|
||||||
|
<el-table-column
|
||||||
|
label="满"
|
||||||
|
align="center"
|
||||||
|
width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.fullPrice"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="立减"
|
||||||
|
align="center"
|
||||||
|
width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.reducePrice"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" @click="handleRemoveFullReduction(scope.$index, scope.row)">删除</el-button>
|
||||||
|
<el-button type="text" @click="handleAddFullReduction(scope.$index, scope.row)">添加</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {fetchList as fetchMemberLevelList} from '@/api/memberLevel'
|
||||||
export default {
|
export default {
|
||||||
name: "addProductSale",
|
name: "addProductSale",
|
||||||
props: {
|
props: {
|
||||||
value: Object
|
value: Object
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectServiceList: [],
|
||||||
|
pickerOptions1: {
|
||||||
|
disabledDate(time) {
|
||||||
|
return time.getTime() < Date.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created(){
|
||||||
|
fetchMemberLevelList({defaultStatus:0}).then(response=>{
|
||||||
|
let memberPriceList=[];
|
||||||
|
for(let i=0;i<response.data.length;i++){
|
||||||
|
let item = response.data[i];
|
||||||
|
memberPriceList.push({memberLevelId:item.id,memberLevelName:item.name})
|
||||||
|
}
|
||||||
|
this.value.memberPriceList=memberPriceList;
|
||||||
|
});
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectServiceList: function (newValue) {
|
selectServiceList: function (newValue) {
|
||||||
let serviceIds = '';
|
let serviceIds = '';
|
||||||
@ -84,14 +204,67 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
methods:{
|
||||||
return {
|
handleRemoveProductLadder(index,row){
|
||||||
selectServiceList: []
|
let productLadderList = this.value.productLadderList;
|
||||||
|
if(productLadderList.length===1){
|
||||||
|
productLadderList.pop();
|
||||||
|
productLadderList.push({
|
||||||
|
count: 0,
|
||||||
|
discount: 0,
|
||||||
|
price: 0
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
productLadderList.splice(index,1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAddProductLadder(index,row){
|
||||||
|
let productLadderList = this.value.productLadderList;
|
||||||
|
if(productLadderList.length<3){
|
||||||
|
productLadderList.push({
|
||||||
|
count: 0,
|
||||||
|
discount: 0,
|
||||||
|
price: 0
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.$message({
|
||||||
|
message: '最多只能添加三条',
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRemoveFullReduction(index,row){
|
||||||
|
let fullReductionList = this.value.productFullReductionList;
|
||||||
|
if(fullReductionList.length===1){
|
||||||
|
fullReductionList.pop();
|
||||||
|
fullReductionList.push({
|
||||||
|
fullPrice: 0,
|
||||||
|
reducePrice: 0
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
fullReductionList.splice(index,1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAddFullReduction(index,row){
|
||||||
|
let fullReductionList = this.value.productFullReductionList;
|
||||||
|
if(fullReductionList.length<3){
|
||||||
|
fullReductionList.push({
|
||||||
|
fullPrice: 0,
|
||||||
|
reducePrice: 0
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this.$message({
|
||||||
|
message: '最多只能添加三条',
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.littleMargin{
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user