Commit ddcf72bf authored by xd's avatar xd

创建大转盘活动完成

parent 8d6981df
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
> >
<van-datetime-picker <van-datetime-picker
v-model="basicInfo.startTime" v-model="basicInfo.startTime"
type="datetime" type="date"
@cancel="basicInfo.startShow = false" @cancel="basicInfo.startShow = false"
@confirm="basicInfo.startShow = false" @confirm="basicInfo.startShow = false"
@change="startTimeChange" @change="startTimeChange"
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
v-model="basicInfo.endTime1" v-model="basicInfo.endTime1"
placeholder="选择活动结束时间" placeholder="选择活动结束时间"
readonly="readonly" readonly="readonly"
@click="endShow = true" @click="basicInfo.endShow = true"
/> />
<van-popup <van-popup
v-model="basicInfo.endShow" v-model="basicInfo.endShow"
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
> >
<van-datetime-picker <van-datetime-picker
v-model="basicInfo.endTime" v-model="basicInfo.endTime"
type="datetime" type="date"
@cancel="basicInfo.endShow = false" @cancel="basicInfo.endShow = false"
@confirm="basicInfo.endShow = false" @confirm="basicInfo.endShow = false"
@change="endTimeChange" @change="endTimeChange"
...@@ -165,17 +165,27 @@ ...@@ -165,17 +165,27 @@
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
<div class="title">奖品设置</div> <div class="title">奖品设置</div>
<van-cell-group class="all sz"> <van-cell-group
<van-cell class="all sz"
title="奖项名称" v-for="(list, index) in prizeList"
style="font-size:14px;" :key="index"
:value="LuckyDraw.name"
class="name"
> >
<van-icon v-if="prizeList.length>1" name="close" size="20" class="close" @click="removePrice(index)" />
<van-cell center>
<template slot="title">
<span class="custom-title">奖项名称</span>
</template>
<template slot="default">
<van-field
class="right"
v-model="prizeList[index].name"
placeholder="请输入奖项名称"
/>
</template>
</van-cell> </van-cell>
<van-cell title="优惠券类型" style="font-size:14px;" class="type"> <van-cell title="优惠券类型" style="font-size:14px;" class="type">
<template slot="default"> <template slot="default">
<van-radio-group v-model="type" class="right"> <van-radio-group v-model="prizeList[index].type" class="right">
<van-radio name="1" style="float:left;">代金券</van-radio> <van-radio name="1" style="float:left;">代金券</van-radio>
<van-radio name="2" style="float:right;">折扣券</van-radio> <van-radio name="2" style="float:right;">折扣券</van-radio>
</van-radio-group> </van-radio-group>
...@@ -187,39 +197,39 @@ ...@@ -187,39 +197,39 @@
class="tm" class="tm"
readonly readonly
clickable clickable
:value="LuckyDraw.probability" :value="prizeList[index].discountsMoney"
@touchstart.native.stop="LuckyDraw.show3 = true" @touchstart.native.stop="prizeList[index].discountsShow = true"
placeholder="输入金额" placeholder="输入金额"
/> />
<van-number-keyboard <van-number-keyboard
v-model="LuckyDraw.probability" v-model="prizeList[index].discountsMoney"
:show="LuckyDraw.show3" :show="prizeList[index].discountsShow"
@blur="LuckyDraw.show3 = false" @blur="prizeList[index].discountsShow = false"
/> />
</div> </div>
<span class="word">元优惠</span> <span class="word">元优惠</span>
<van-checkbox v-model="limit2"></van-checkbox> <van-checkbox v-model="prizeList[index].full"></van-checkbox>
<span class="word"></span> <span class="word"></span>
<div class="je"> <div class="je">
<van-field <van-field
class="tm" class="tm"
readonly readonly
clickable clickable
:value="LuckyDraw.probability" :value="prizeList[index].fullMoney"
@touchstart.native.stop="LuckyDraw.show3 = true" @touchstart.native.stop="prizeList[index].fullShow = true"
placeholder="输入金额" placeholder="输入金额"
/> />
<van-number-keyboard <van-number-keyboard
v-model="LuckyDraw.probability" v-model="prizeList[index].fullMoney"
:show="LuckyDraw.show3" :show="prizeList[index].fullShow"
@blur="LuckyDraw.show3 = false" @blur="prizeList[index].fullShow = false"
/> />
</div> </div>
<span class="word end">元可用</span> <span class="word end">元可用</span>
</div> </div>
<van-cell title="券有效期" style="font-size:14px;" > <van-cell title="券有效期" style="font-size:14px;">
<template slot="default"> <template slot="default">
<van-radio-group v-model="type" class="right"> <van-radio-group v-model="prizeList[index].validity" class="right">
<van-radio name="1" style="float:left;">指定日期</van-radio> <van-radio name="1" style="float:left;">指定日期</van-radio>
<van-radio name="2" style="float:right;">有效天数</van-radio> <van-radio name="2" style="float:right;">有效天数</van-radio>
</van-radio-group> </van-radio-group>
...@@ -229,18 +239,22 @@ ...@@ -229,18 +239,22 @@
<template slot="default"> <template slot="default">
<van-field <van-field
class="right" class="right"
v-model="startTime1" v-model="prizeList[index].startTime1"
placeholder="选择活动结束时间" placeholder="选择活动开始时间"
readonly="readonly" readonly="readonly"
@click="startShow = true" @click="prizeList[index].startShow = true"
/> />
<van-popup v-model="startShow" position="bottom" :overlay="true"> <van-popup
v-model="prizeList[index].startShow"
position="bottom"
:overlay="true"
>
<van-datetime-picker <van-datetime-picker
v-model="startTime" v-model="prizeList[index].startTime"
type="datetime" type="date"
@cancel="startShow = false" @cancel="prizeList[index].startShow = false"
@confirm="startShow = false" @confirm="prizeList[index].startShow = false"
@change="startTimeChange" @change="startTimeChange2(prizeList[index].startTime, index)"
/> />
</van-popup> </van-popup>
</template> </template>
...@@ -249,18 +263,22 @@ ...@@ -249,18 +263,22 @@
<template slot="default"> <template slot="default">
<van-field <van-field
class="right" class="right"
v-model="endTime1" v-model="prizeList[index].endTime1"
placeholder="选择活动结束时间" placeholder="选择活动结束时间"
readonly="readonly" readonly="readonly"
@click="endShow = true" @click="prizeList[index].endShow = true"
/> />
<van-popup v-model="endShow" position="bottom" :overlay="true"> <van-popup
v-model="prizeList[index].endShow"
position="bottom"
:overlay="true"
>
<van-datetime-picker <van-datetime-picker
v-model="endTime" v-model="prizeList[index].endTime"
type="datetime" type="date"
@cancel="endShow = false" @cancel="prizeList[index].endShow = false"
@confirm="endShow = false" @confirm="prizeList[index].endShow = false"
@change="endTimeChange" @change="endTimeChange2(prizeList[index].endTime, index)"
/> />
</van-popup> </van-popup>
</template> </template>
...@@ -271,15 +289,15 @@ ...@@ -271,15 +289,15 @@
class="right noborder" class="right noborder"
readonly readonly
clickable clickable
:value="cashCoupon" :value="prizeList[index].prize"
placeholder="请输入数量" placeholder="请输入数量"
@touchstart.native.stop="show = true" @touchstart.native.stop="prizeList[index].prizeShow = true"
/> />
<van-number-keyboard <van-number-keyboard
v-model="cashCoupon" v-model="prizeList[index].prize"
:show="show" :show="prizeList[index].prizeShow"
:maxlength="6" :maxlength="6"
@blur="show = false" @blur="prizeList[index].prizeShow = false"
/> />
</template> </template>
</van-cell> </van-cell>
...@@ -293,18 +311,22 @@ ...@@ -293,18 +311,22 @@
class="right noborder" class="right noborder"
readonly readonly
clickable clickable
:value="LuckyDraw.number" :value="prizeList[index].limit"
placeholder="请输入次数" placeholder="请输入次数"
@touchstart.native.stop="LuckyDraw.show = true" @touchstart.native.stop="prizeList[index].limitShow = true"
/> />
<van-number-keyboard <van-number-keyboard
v-model="LuckyDraw.number" v-model="prizeList[index].limit"
:show="LuckyDraw.show" :show="prizeList[index].limitShow"
@blur="LuckyDraw.show = false" @blur="prizeList[index].limitShow = false"
/> />
</template> </template>
</van-cell> </van-cell>
<div class="des">描述</div> <div class="add" @click="addPrice">添加奖项</div>
</van-cell-group>
<div class="detail">
<div class="border">
<div class="des">活动描述</div>
<van-field <van-field
class="area" class="area"
v-model="message" v-model="message"
...@@ -314,8 +336,12 @@ ...@@ -314,8 +336,12 @@
placeholder="请输入描述" placeholder="请输入描述"
show-word-limit show-word-limit
/> />
</van-cell-group> </div>
<div class="add">添加奖项</div> </div>
<div class="detail" style="margin-top:0;">
<div class="des">活动图片</div>
<van-uploader v-model="fileList" multiple :max-count="9" />
</div>
<div class="creat">创建活动</div> <div class="creat">创建活动</div>
</div> </div>
</template> </template>
...@@ -334,7 +360,7 @@ export default { ...@@ -334,7 +360,7 @@ export default {
endShow: false endShow: false
}, },
LuckyDraw: { LuckyDraw: {
name: "一等奖", name: "",
number: "", number: "",
winningNumber: "", winningNumber: "",
probability: "", probability: "",
...@@ -344,36 +370,64 @@ export default { ...@@ -344,36 +370,64 @@ export default {
show2: false, show2: false,
show3: false show3: false
}, },
prizeList: {}, prizeList: [
{
name: "",
type: "",
discountsMoney: "",
discountsShow: false,
full: "",
fullMoney: "",
fullShow: false,
validity: "",
startTime: "",
startTime1: "",
startShow: false,
endTime: "",
endTime1: "",
endShow: false,
prize: "",
prizeShow: false,
limit: "",
limitShow: false
}
],
title: "", title: "",
title2: "", title2: "",
coupon: "", coupon: "",
newCustomer: "", newCustomer: "",
condition: "", condition: "",
type: "", type: "",
show: false,
show2: false,
cashCoupon: "",
limit: "",
limit2: "",
startTime: new Date(),
startTime1: "",
endTime: "",
endTime1: "",
startShow: false, startShow: false,
endShow: false, endShow: false,
message: "" message: "",
fileList: []
}; };
}, },
methods: { methods: {
startTimeChange(e) { startTimeChange(e) {
let startTimeArr = e.getValues(); let startTimeArr = e.getValues();
this.basicInfo.startTime1 = `${startTimeArr[0]}-${startTimeArr[1]}-${startTimeArr[2]} ${startTimeArr[3]}:${startTimeArr[4]}:00`; this.basicInfo.startTime1 = `${startTimeArr[0]}-${startTimeArr[1]}-${startTimeArr[2]}`;
},
startTimeChange2(e, index) {
this.prizeList[index].startTime1 = this.timeFormat(e)
//let startTimeArr = e.getValues();
//this.prizeList[index].startTime1 = `${startTimeArr[0]}-${startTimeArr[1]}-${startTimeArr[2]} ${startTimeArr[3]}:${startTimeArr[4]}:00`;
},
timeFormat(time) { // 时间格式化 2019-09-08
let year = time.getFullYear();
let month = time.getMonth() + 1;
let day = time.getDate();
return year + '年' + month + '月' + day + '日'
}, },
endTimeChange(e) { endTimeChange(e) {
let endTimeArr = e.getValues(); let endTimeArr = e.getValues();
this.basicInfo.endTime1 = `${endTimeArr[0]}-${endTimeArr[1]}-${endTimeArr[2]} ${endTimeArr[3]}:${endTimeArr[4]}:00`; this.basicInfo.endTime1 = `${endTimeArr[0]}-${endTimeArr[1]}-${endTimeArr[2]}`;
}, },
endTimeChange2(e, index) {
this.prizeList[index].endTime1 = this.timeFormat(e)
},
// 数字大写转小写
numberToUpperCase(textIndex) { numberToUpperCase(textIndex) {
let newString = ""; let newString = "";
let newTextIndex = textIndex + ""; let newTextIndex = textIndex + "";
...@@ -425,7 +479,33 @@ export default { ...@@ -425,7 +479,33 @@ export default {
newString += sum(newTextIndex.substring(i, i + 1), i); newString += sum(newTextIndex.substring(i, i + 1), i);
} }
return newString; return newString;
} },
addPrice() {
this.prizeList.push({
name: "",
type: "",
discountsMoney: "",
discountsShow: false,
full: "",
fullMoney: "",
fullShow: false,
validity: "",
startTime: "",
startTime1: "",
startShow: false,
endTime: "",
endTime1: "",
endShow: false,
prize: "",
prizeShow: false,
limit: "",
limitShow: false
});
},
removePrice(index) {
this.prizeList.splice(index,1)
},
}, },
mounted() {} mounted() {}
}; };
...@@ -444,8 +524,8 @@ export default { ...@@ -444,8 +524,8 @@ export default {
.small { .small {
font-size: 10px; font-size: 10px;
} }
.creat,.add{ .creat,
margin-top: 80px; .add {
width: 96%; width: 96%;
height: 40px; height: 40px;
background: rgba(117, 178, 253, 1); background: rgba(117, 178, 253, 1);
...@@ -455,18 +535,22 @@ export default { ...@@ -455,18 +535,22 @@ export default {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
margin-left: 2%; margin: 0 auto;
margin-top: 80px;
margin-bottom: 16px; margin-bottom: 16px;
} }
.add { .add {
margin-top: 12px; margin: 12px auto;
} }
.van-field__body textarea { .area {
background: rgba(248, 248, 248, 1); background-color: #f8f8f8;
width: 100%;
} }
.des { .des {
padding: 6px 16px;
font-size: 14px; font-size: 14px;
font-weight: bold;
color: rgba(45, 71, 106, 1);
margin-bottom: 12px;
} }
.phone { .phone {
...@@ -530,6 +614,7 @@ export default { ...@@ -530,6 +614,7 @@ export default {
} }
.sz { .sz {
position: relative; position: relative;
padding-top: 10px;
} }
.je { .je {
width: 88px; width: 88px;
...@@ -555,6 +640,22 @@ export default { ...@@ -555,6 +640,22 @@ export default {
display: none; display: none;
} }
.all { .all {
box-shadow:0px 1px 3px 0px rgba(221,221,221,1); box-shadow: 0px 1px 3px 0px rgba(221, 221, 221, 1);
padding-bottom: 1px;
}
.detail {
margin-top: 12px;
background-color: #fff;
/* height: 135px; */
padding: 12px 16px 0 16px;
}
.border {
border-bottom: 1px solid #ebedf0;
padding-bottom: 9px;
}
.close {
position: absolute;
z-index: 999;
top: 0;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment