Commit bd2a65df by wangql

修改样式

1 parent 89e1ed6a
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing p-t-20">
<div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="position: relative;">
<div class="right_show">
<div class="card-top"></div>
......
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing p-t-20">
<div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="height: 630px; position: relative">
<div class="right_show">
<div class="card-top"></div>
......
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing p-t-20">
<div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="height: 630px;position: relative;">
<div class="right_show">
<div class="card-top"></div>
......
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing p-t-20">
<div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container">
<p class="edit-title">{{ title }}会员服务</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear!='couponAdd'">无有效期</el-radio><br>
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'">
<el-date-picker
v-model="editForm.effectiveTime"
type="daterange"
style="width:295px"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-radio>
</el-form-item>
<el-form-item prop="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
领取后<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />天内有效
</el-radio>
</el-form-item>
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear != 'couponAdd'">无有效期</el-radio>
<br />
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio>
</el-form-item>
<el-form-item prop="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后
<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
天内有效
</el-radio>
</el-form-item>
</template>
<template slot="useTypeHtml">
<el-radio v-model="editForm.useType" label="0" :disabled="apear!='couponAdd'">无限制</el-radio><br>
<el-form-item prop="usageTimes" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.useType" label="1" :disabled="apear!='couponAdd'">
有效期内可使用
<el-input v-model="editForm.usageTimes" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.useType != 1" />次
</el-radio>
</el-form-item>
<el-radio v-model="editForm.useType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="useLimitDays">
有效期内
<el-input v-model="editForm.useLimitDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.useType != 2" />
天可使用
</el-form-item>
<el-form-item prop="usageTimes2">
<el-input v-model="editForm.usageTimes2" style="width: 100px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.useType != 2" />次
</el-form-item>
</el-radio>
<el-radio v-model="editForm.useType" label="0" :disabled="apear != 'couponAdd'">无限制</el-radio>
<br />
<el-form-item prop="usageTimes" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.useType" label="1" :disabled="apear != 'couponAdd'">
有效期内可使用
<el-input v-model="editForm.usageTimes" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useType != 1" />
次
</el-radio>
</el-form-item>
<el-radio v-model="editForm.useType" label="2" :disabled="apear != 'couponAdd'">
<el-form-item prop="useLimitDays">
有效期内
<el-input v-model="editForm.useLimitDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useType != 2" />
天可使用
</el-form-item>
<el-form-item prop="usageTimes2">
<el-input v-model="editForm.usageTimes2" style="width: 100px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useType != 2" />
次
</el-form-item>
</el-radio>
</template>
<template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
<el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="200" :disabled="apear == 'couponSee'" />
</template>
</glsx-combi-form>
</div>
......@@ -67,9 +64,9 @@
</div>
</div> -->
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear=='couponSee'" @click="handleCancel">返回</el-button>
<el-button type="default" v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear != 'couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear == 'couponSee'" @click="handleCancel">返回</el-button>
</div>
</div>
</template>
......@@ -180,12 +177,12 @@ export default {
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'couponSee';
this.title = '查看';
}else if(addOrEdit == 2){
this.apear = 'couponEdit';
this.title = '编辑';
if (addOrEdit == 3) {
this.apear = 'couponSee'
this.title = '查看'
} else if (addOrEdit == 2) {
this.apear = 'couponEdit'
this.title = '编辑'
}
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
......@@ -193,52 +190,52 @@ export default {
this.editFormData[4].isDisabled = this.isDisabled
this.editFormData[5].isDisabled = this.isDisabled
} else {
this.apear = 'couponAdd';
this.title = '创建';
this.apear = 'couponAdd'
this.title = '创建'
this.isDisabled = false
}
},
watch: {
'editForm.effectiveDays'(newValue, oldValue){
'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.usageTimes'(newValue, oldValue){
'editForm.usageTimes'(newValue, oldValue) {
this.editForm.usageTimes = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.useLimitDays'(newValue, oldValue){
'editForm.useLimitDays'(newValue, oldValue) {
this.editForm.useLimitDays = limitPrice(newValue, oldValue, 4, 0)
},
'editForm.usageTimes2'(newValue, oldValue){
'editForm.usageTimes2'(newValue, oldValue) {
this.editForm.usageTimes2 = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.vipPrice'(newValue, oldValue){
'editForm.vipPrice'(newValue, oldValue) {
this.editForm.vipPrice = limitPrice(newValue, oldValue, 5, 2)
},
'editForm.shopPrice'(newValue, oldValue){
'editForm.shopPrice'(newValue, oldValue) {
this.editForm.shopPrice = limitPrice(newValue, oldValue, 5, 2)
},
'editForm.stock'(newValue, oldValue){
'editForm.stock'(newValue, oldValue) {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
},
'editForm.effectiveTime'(newValue, oldValue){
if(newValue && newValue.length > 0){
'editForm.effectiveTime'(newValue, oldValue) {
if (newValue && newValue.length > 0) {
this.couponTime = this.setDateString(newValue[0], true) + ' - ' + this.setDateString(newValue[1], true)
}else{
} else {
this.couponTime = ''
}
},
}
},
methods: {
setDateString(objField, special) {
var value = (typeof objField == 'string') ? objField.split(" ")[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value
},
getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res);
console.log(res)
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.useType = this.editForm.useType + ''
......@@ -246,88 +243,94 @@ export default {
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime]
this.editForm.effectiveTime = [this.editForm.effectiveStartTime, this.editForm.effectiveEndTime]
}
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
if (this.editForm.useType == 1) {
this.editForm.usageTimes = this.editForm.useAmount;
this.editForm.usageTimes = this.editForm.useAmount
} else if (this.editForm.useType == 2) {
this.editForm.usageTimes2 = this.editForm.useAmount;
this.editForm.usageTimes2 = this.editForm.useAmount
}
})
},
validateRules(){
validateRules() {
var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
}else {
this.editRule.effectiveTime[0].required = false
if (form.effectiveType == '2') {
//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
} else {
this.editRule.effectiveTime[0].required = false
}
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
}else {
this.editRule.effectiveDays[0].required = false
if (form.effectiveType == '1') {
//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
} else {
this.editRule.effectiveDays[0].required = false
}
if(form.useType == '1'){//判断 使用限制-有效期内使用次数是否验证
this.editRule.usageTimes[0].required = true
}else {
this.editRule.usageTimes[0].required = false
if (form.useType == '1') {
//判断 使用限制-有效期内使用次数是否验证
this.editRule.usageTimes[0].required = true
} else {
this.editRule.usageTimes[0].required = false
}
if(form.useType == '2'){//判断 使用限制-有效天数和使用次数是否验证
this.editRule.useLimitDays[0].required = true
this.editRule.usageTimes2[0].required = true
}else {
this.editRule.useLimitDays[0].required = false
this.editRule.usageTimes2[0].required = false
if (form.useType == '2') {
//判断 使用限制-有效天数和使用次数是否验证
this.editRule.useLimitDays[0].required = true
this.editRule.usageTimes2[0].required = true
} else {
this.editRule.useLimitDays[0].required = false
this.editRule.usageTimes2[0].required = false
}
},
getCouponInfoParams() {
var obj = {};
var obj = {}
var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm)
if (id) {
obj.couponId = id;
}else{//编辑时只允许编辑使用说明
obj.couponId = id
} else {
//编辑时只允许编辑使用说明
//优惠券名称
obj.couponName = form.couponName;
obj.couponName = form.couponName
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '7';
obj.discountType = '7'
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数
obj.effectiveDays = form.effectiveDays;
} else if (form.effectiveType == 2) {//时间段
if (form.effectiveType == 1) {
//固定天数
obj.effectiveDays = form.effectiveDays
} else if (form.effectiveType == 2) {
//时间段
const d = form.effectiveTime
if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00';
obj.effectiveEndTime = d[1] + ' 23:59:59';
obj.effectiveStartTime = d[0] + ' 00:00:00'
obj.effectiveEndTime = d[1] + ' 23:59:59'
}
}
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = form.useType;
obj.useType = form.useType
if (form.useType == 1) {
obj.useAmount = form.usageTimes;
obj.useAmount = form.usageTimes
} else if (form.useType == 2) {
obj.useLimitDays = form.useLimitDays;
obj.useAmount = form.usageTimes2;
obj.useLimitDays = form.useLimitDays
obj.useAmount = form.usageTimes2
}
//会员价
obj.vipPrice = form.vipPrice;
obj.vipPrice = form.vipPrice
//门店价
obj.shopPrice = form.shopPrice;
obj.shopPrice = form.shopPrice
//库存
obj.stock = form.stock;
obj.stock = form.stock
}
//使用描述
obj.useDescription = form.useDescription;
return obj;
obj.useDescription = form.useDescription
return obj
},
handleConfirm() {
......@@ -335,12 +338,12 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.getCouponInfoParams()
console.log(params);
console.log(params)
let method = ''
if(params.couponId){
method = 'updateCouponApi'//后台修改优惠券
}else {
method = 'createCouponApi'//后台创建优惠券
if (params.couponId) {
method = 'updateCouponApi' //后台修改优惠券
} else {
method = 'createCouponApi' //后台创建优惠券
}
this.$apis.couponManage[method](params).then(res => {
this.$message({
......@@ -364,53 +367,53 @@ export default {
</script>
<style scoped>
.left_show {
width: 400px;
/*min-height: 600px;*/
background: #fff;
/*border: 1px solid #eee;*/
position:relative;
display:flex;
flex-direction: column;
width: 400px;
/*min-height: 600px;*/
background: #fff;
/*border: 1px solid #eee;*/
position: relative;
display: flex;
flex-direction: column;
position: absolute;
top: 110px;
left: 50%;
position: absolute;
top: 110px;
left: 50%;
}
.left_show .card-panel-top {
/* margin-top: 200px; */
width: 365px;
height: 122px;
background-color: rgba(245, 154, 35, 0.7);
border: none;
text-align: center;
line-height: 24px;
position: relative;
/* margin-top: 200px; */
width: 365px;
height: 122px;
background-color: rgba(245, 154, 35, 0.7);
border: none;
text-align: center;
line-height: 24px;
position: relative;
}
.card-h-title {
position: absolute;
font-weight: 500;
font-size: 20px;
top: 20px;
transform: rotate(-45deg);
position: absolute;
font-weight: 500;
font-size: 20px;
top: 20px;
transform: rotate(-45deg);
}
.card-panel-bottom {
width: 353px;
min-height: 90px;
background-color: rgba(250, 205, 145, 1);
padding: 6px;
width: 353px;
min-height: 90px;
background-color: rgba(250, 205, 145, 1);
padding: 6px;
}
.card-extime {
margin-top: 10px;
margin-top: 10px;
}
.card-name {
margin: 16px 0px;
font-size: 16px;
margin: 16px 0px;
font-size: 16px;
}
.card-day {
margin-top: 10px;
margin-top: 10px;
}
.card-remark {
word-break: break-word;
word-break: break-word;
}
</style>
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing p-t-20">
<div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container">
<p class="edit-title">{{ title }}秒杀活动</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<glsx-combi-form class="edit-form-container" ref="editFormRef" :labelWidth="labelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="activityTimeHtml">
<!-- <el-form-item> -->
<el-date-picker
v-model="editForm.activityTime"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
:default-time="['00:00:00', '23:59:59']"
:disabled="isDisabled" clearable>
</el-date-picker>
<!-- </el-form-item> -->
<!-- <el-form-item> -->
<el-date-picker v-model="editForm.activityTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions" :default-time="['00:00:00', '23:59:59']" :disabled="isDisabled" clearable></el-date-picker>
<!-- </el-form-item> -->
</template>
<div slot="goodsHtml">
<el-button type="primary" v-if="apear!='see'" @click="handleRelateProClose">选择商品</el-button>
<div v-if="selectedProInfo.id && !specificationDetailList.length" style="margin-top:10px">
<p>
<img class="img-60" :src="selectedProInfo.goodsImage"/>
&nbsp;&nbsp;&nbsp;
零售价 {{(selectedProInfo.retailPrice/100).toFixed(2)}}元
&nbsp;&nbsp;&nbsp;
商品库存 {{selectedProInfo.goodsStock}}件
</p>
<el-form-item label="设置秒杀价" prop="activityPrice">
<el-input v-model="editForm.activityPrice" style="width: 150px" :disabled="isDisabled"><span slot="append">元</span></el-input>
</el-form-item>
<el-form-item label="活动库存" prop="goodsStock">
<el-input v-model="editForm.goodsStock" style="width: 150px" :disabled="isDisabled"><span slot="append">件</span></el-input>
</el-form-item>
</div>
<div v-if="specificationDetailList.length" class="flex" style="margin-top: 20px;" id="specificationDetailList">
<span class="spesc-label" :style="{ width: labelWidth }">规格明细:</span>
<div style="width: calc(100% - 100px);">
<table class="table-spesc">
<tbody>
<tr>
<td :style="{ width: specsWidth }" v-for="(subItem, subIndex) in specificationDetailList" :key="subIndex">{{ subItem.specificationName }}</td>
<td :style="{ width: specsWidth }">零售价(元)</td>
<td :style="{ width: specsWidth }">库存</td>
<td :style="{ width: specsWidth }">设置秒杀价</td>
<td :style="{ width: specsWidth }">活动库存</td>
</tr>
</tbody>
</table>
<table class="table-spesc" style="max-height: 400px;">
<tbody>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);" v-for="(item, index) in nameToValSpecsList" :key="index">
<td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td>
<td :style="{ width: specsWidth }">{{ item.retailPrice }}元</td>
<td :style="{ width: specsWidth }">{{ item.stock }}件</td>
<!-- <td :style="{ width: specsWidth }">
<el-button type="primary" v-if="apear != 'see'" @click="handleRelateProClose">选择商品</el-button>
<div v-if="selectedProInfo.id && !specificationDetailList.length" style="margin-top:10px">
<p>
<img class="img-60" :src="selectedProInfo.goodsImage" />
&nbsp;&nbsp;&nbsp; 零售价 {{ (selectedProInfo.retailPrice / 100).toFixed(2) }}元 &nbsp;&nbsp;&nbsp; 商品库存 {{ selectedProInfo.goodsStock }}件
</p>
<el-form-item label="设置秒杀价" prop="activityPrice">
<el-input v-model="editForm.activityPrice" style="width: 150px" :disabled="isDisabled"><span slot="append">元</span></el-input>
</el-form-item>
<el-form-item label="活动库存" prop="goodsStock">
<el-input v-model="editForm.goodsStock" style="width: 150px" :disabled="isDisabled"><span slot="append">件</span></el-input>
</el-form-item>
</div>
<div v-if="specificationDetailList.length" class="flex" style="margin-top: 20px;" id="specificationDetailList">
<span class="spesc-label" :style="{ width: labelWidth }">规格明细:</span>
<div style="width: calc(100% - 100px);">
<table class="table-spesc">
<tbody>
<tr>
<td :style="{ width: specsWidth }" v-for="(subItem, subIndex) in specificationDetailList" :key="subIndex">{{ subItem.specificationName }}</td>
<td :style="{ width: specsWidth }">零售价(元)</td>
<td :style="{ width: specsWidth }">库存</td>
<td :style="{ width: specsWidth }">设置秒杀价</td>
<td :style="{ width: specsWidth }">活动库存</td>
</tr>
</tbody>
</table>
<table class="table-spesc" :style="{ 'max-height': '400px', 'margin-left': labelWidth, width: `calc(100% - ${labelWidth} )` }">
<tbody>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);" v-for="(item, index) in nameToValSpecsList" :key="index">
<td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td>
<td :style="{ width: specsWidth }">{{ item.retailPrice }}元</td>
<td :style="{ width: specsWidth }">{{ item.stock }}件</td>
<!-- <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" :class="{ 'border-red': (!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted }" placeholder="零售价" v-model="item.retailPrice" @input.native="e => handleInput(e, index)">
<el-popover v-show="(!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(item.retailPrice + '') ? '零售价是必填项' : '零售价要大于供货价'">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
</el-input>
</td> -->
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="秒杀价" v-model="item.activityPrice" @input="item.activityPrice = activityPrice_input($event,item.retailPrice)">
<!-- <span slot="append">元</span> -->
</el-input>
</td>
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="活动库存" v-model="item.goodsStock" @input="item.goodsStock = goodsStock_input($event,item.stock)">
<!-- <span slot="append">件</span> -->
</el-input>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- <glsx-combi-form v-if="!specificationDetailList.length" class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form> -->
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="秒杀价" v-model="item.activityPrice" @input="item.activityPrice = activityPrice_input($event, item.retailPrice)">
<!-- <span slot="append">元</span> -->
</el-input>
</td>
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="活动库存" v-model="item.goodsStock" @input="item.goodsStock = goodsStock_input($event, item.stock)">
<!-- <span slot="append">件</span> -->
</el-input>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- <glsx-combi-form v-if="!specificationDetailList.length" class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form> -->
</div>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" v-if="apear!='see'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear!='see'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear=='see'" @click="handleCancel">返回</el-button>
<el-button type="default" v-if="apear != 'see'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear != 'see'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear == 'see'" @click="handleCancel">返回</el-button>
</div>
<select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose"></select-single-pro-dialog>
</div>
......@@ -106,9 +93,11 @@ export default {
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
labelWidth: '140px',
pickerOptions: {
disabledDate(v) {//禁用当前之前的日期
return v.getTime() < new Date().getTime() - 86400000;
disabledDate(v) {
//禁用当前之前的日期
return v.getTime() < new Date().getTime() - 86400000
}
},
routeInfo: {
......@@ -137,7 +126,7 @@ export default {
activityTime: [],
activityPrice: '',
goodsStock: '',
goodsId:''
goodsId: ''
},
//商品列表
tableParams: {
......@@ -170,7 +159,7 @@ export default {
activityTime: [{ required: true, message: '活动时间不能为空', trigger: 'change' }],
activityPrice: [{ required: true, message: '请设置秒杀价', trigger: 'change' }],
goodsStock: [{ required: true, message: '请设置活动库存', trigger: 'change' }],
goodsId: [{ required: true, message: '请选择商品', trigger: ['change', 'blur'] }],
goodsId: [{ required: true, message: '请选择商品', trigger: ['change', 'blur'] }]
},
editFormData: [
{
......@@ -178,7 +167,7 @@ export default {
name: 'activityName',
width: '320px',
type: 'input',
maxlength: 20,
maxlength: 20
},
{
label: '活动宣传图',
......@@ -213,7 +202,7 @@ export default {
label: '商品',
name: 'goodsId',
addHtml: 'goodsHtml'
},
}
]
}
},
......@@ -227,34 +216,33 @@ export default {
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'see';
this.title = '查看';
if (addOrEdit == 3) {
this.apear = 'see'
this.title = '查看'
this.isDisabled = true
this.editFormData[0].isDisabled = true
this.editFormData[1].isDisabled = true
this.editFormData[2].isDisabled = true
}else if(addOrEdit == 2){
this.apear = 'edit';
this.title = '编辑';
} else if (addOrEdit == 2) {
this.apear = 'edit'
this.title = '编辑'
}
} else {
this.apear = 'add';
this.title = '创建';
this.apear = 'add'
this.title = '创建'
}
},
watch: {
'editForm.activityPrice'(newValue, oldValue){
this.editForm.activityPrice = limitPrice(newValue, oldValue, 5, 2, 0, this.selectedProInfo.retailPrice/100)
'editForm.activityPrice'(newValue, oldValue) {
this.editForm.activityPrice = limitPrice(newValue, oldValue, 5, 2, 0, this.selectedProInfo.retailPrice / 100)
},
'editForm.goodsStock'(newValue, oldValue){
'editForm.goodsStock'(newValue, oldValue) {
this.editForm.goodsStock = limitPrice(newValue, oldValue, 5, 0, 0, this.selectedProInfo.goodsStock)
}
},
methods: {
limitPriceForInput(val, intergerDigit, pointDigit, minValue, maxValue, regRule) {
var _regRule = regRule || 'priceReg'
// if (val && (minValue && (val < minValue)) || (maxValue && (val > maxValue))) {
......@@ -262,12 +250,12 @@ export default {
// return maxValue ? maxValue : (minValue?minValue:'')
// }
if (val && this.reg[_regRule].test(val + '')) {
maxValue = typeof(maxValue) == 'string'?parseFloat(maxValue):maxValue
minValue = typeof(minValue) == 'string'?parseFloat(minValue):minValue
if (val && (minValue && (val < minValue)) || (maxValue && (val > maxValue))) {
return maxValue ? maxValue : (minValue?minValue:'')
maxValue = typeof maxValue == 'string' ? parseFloat(maxValue) : maxValue
minValue = typeof minValue == 'string' ? parseFloat(minValue) : minValue
if ((val && minValue && val < minValue) || (maxValue && val > maxValue)) {
return maxValue ? maxValue : minValue ? minValue : ''
}
if ((/\./).test(val)) {
if (/\./.test(val)) {
val = val + ''
var interger = val.split('.')[0]
var point = val.split('.')[1]
......@@ -297,7 +285,7 @@ export default {
// this.editForm.goodsName = selectedProInfo.goodsName
// this.editForm.goodsImage = selectedProInfo.goodsImage
this.handleSingleSelectClose()
if(selectedProInfo){
if (selectedProInfo) {
this.editForm.goodsId = selectedProInfo.id
this.getGoodInfo(selectedProInfo.id)
}
......@@ -325,12 +313,12 @@ export default {
// this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
// this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0
this.selectedProInfo = this.$common.utils.deepClone(res)
console.log(this.selectedProInfo);
if(this.selectedProInfo.specificationDetailList.length) {
console.log(this.selectedProInfo)
if (this.selectedProInfo.specificationDetailList.length) {
// this.specificationDetailList = this.$common.utils.deepClone(res.specificationList)
this.specificationDetailList = this.selectedProInfo.specificationList
this.recoverySpec()
}else{
} else {
this.nameToValSpecsList = []
this.specificationDetailList = []
}
......@@ -394,11 +382,11 @@ export default {
}
}
if(this.activityInfo && this.activityInfo.specificationDetailWithGoodsList){
if (this.activityInfo && this.activityInfo.specificationDetailWithGoodsList) {
for (var k = 0; k < this.activityInfo.specificationDetailWithGoodsList.length; k++) {
var templ = this.activityInfo.specificationDetailWithGoodsList[k]
if (templ.specificationData == item.specificationData) {
item.activityPrice = (templ.retailPrice/100).toFixed(2)
item.activityPrice = (templ.retailPrice / 100).toFixed(2)
item.goodsStock = templ.stock
break
}
......@@ -407,7 +395,6 @@ export default {
})
}
// console.log(this.nameToValSpecsList);
},
setLocaleCompare(params) {
let keys = []
......@@ -427,13 +414,13 @@ export default {
},
//规格-秒杀价输入控制
activityPrice_input(val,maxValue) {
return this.limitPriceForInput(val,5,2,0,maxValue)
activityPrice_input(val, maxValue) {
return this.limitPriceForInput(val, 5, 2, 0, maxValue)
},
//规格-活动库存输入控制
goodsStock_input(val,maxValue) {
return this.limitPriceForInput(val,5,0,0,maxValue)
goodsStock_input(val, maxValue) {
return this.limitPriceForInput(val, 5, 0, 0, maxValue)
},
getInfo() {
......@@ -444,20 +431,20 @@ export default {
form.activityName = info.activityName
form.activityImg = info.activityImg
form.promotion = info.promotion
form.activityTime = [info.startTime,info.endTime]
form.activityTime = [info.startTime, info.endTime]
this.getGoodInfo(info.goodsId)
if(info.activityPrice != null && info.goodsStock != null){
form.activityPrice = (info.activityPrice/100).toFixed(2)
if (info.activityPrice != null && info.goodsStock != null) {
form.activityPrice = (info.activityPrice / 100).toFixed(2)
form.goodsStock = info.goodsStock
}
})
},
validateRules(){
if(this.specificationDetailList.length){
validateRules() {
if (this.specificationDetailList.length) {
this.editRule.activityPrice[0].required = false
this.editRule.goodsStock[0].required = false
}else{
} else {
this.editRule.activityPrice[0].required = true
this.editRule.goodsStock[0].required = true
}
......@@ -467,36 +454,36 @@ export default {
var _this = this
var param = this.editForm
// param.activityPrice = (param.activityPrice*100).toFixed(2) //存的分,需乘100
param.activityPrice = param.activityPrice*100 //存的分,需乘100
if(this.routeInfo.id){
param.activityPrice = param.activityPrice * 100 //存的分,需乘100
if (this.routeInfo.id) {
param.id = this.routeInfo.id
}
const d = param.activityTime
if (d && d.length > 0) {
param.startTime = d[0];
param.endTime = d[1];
param.startTime = d[0]
param.endTime = d[1]
}
param.goodsId = this.selectedProInfo.id
if(this.nameToValSpecsList.length > 0){
if (this.nameToValSpecsList.length > 0) {
delete param.activityPrice
delete param.goodsStock
param.specificationDetailList = []
this.nameToValSpecsList.forEach(function (item) {
this.nameToValSpecsList.forEach(function(item) {
var obj = {
// retailPrice : (item.activityPrice*100).toFixed(0), //存的分,需乘100
retailPrice : item.activityPrice*100, //存的分,需乘100
stock : item.goodsStock,
specificationData : item.specificationData,
specificationKey : item.specificationKey
// retailPrice : (item.activityPrice*100).toFixed(0), //存的分,需乘100
retailPrice: item.activityPrice * 100, //存的分,需乘100
stock: item.goodsStock,
specificationData: item.specificationData,
specificationKey: item.specificationKey
}
if(_this.routeInfo.id){
if (_this.routeInfo.id) {
obj.activityId = _this.routeInfo.id
}
param.specificationDetailList.push(obj)
})
}
return param;
return param
},
handleConfirm() {
......@@ -509,39 +496,39 @@ export default {
// })
// flag = false
// }
if(this.nameToValSpecsList && this.nameToValSpecsList.length > 0){
if (this.nameToValSpecsList && this.nameToValSpecsList.length > 0) {
var list = this.nameToValSpecsList
for (var key = 0; key < list.length; key++) {
var item = list[key]
if(!item.activityPrice){
this.$message({
message: '有未设置秒杀价的项',
type: 'error'
})
flag = false
break
}
if(!item.goodsStock){
this.$message({
message: '有未设置活动库存的项',
type: 'error'
})
flag = false
break
}
var item = list[key]
if (!item.activityPrice) {
this.$message({
message: '有未设置秒杀价的项',
type: 'error'
})
flag = false
break
}
if (!item.goodsStock) {
this.$message({
message: '有未设置活动库存的项',
type: 'error'
})
flag = false
break
}
}
}
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
if(!flag){
if (!flag) {
return false
}
var params = this.getCouponInfoParams()
console.log(params);
console.log(params)
this.$apis.seckillActivity.addOrUpdateActivityApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : (res.message?res.message:'操作失败'),
message: res.code == '0' ? '操作成功' : res.message ? res.message : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!