Commit bd2a65df by wangql

修改样式

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