Commit 27ae43ee authored by guoyou's avatar guoyou

租车价格日历

parent c8074be3
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
>{{ dayobject.day.getDate() }}</span> >{{ dayobject.day.getDate() }}</span>
<!--如果是本月 还需要判断是不是这一天--> <!--如果是本月 还需要判断是不是这一天-->
<span v-else> <span v-else ref="allDays">
<span <span
v-if="dayobject.day.getFullYear() == new Date().getFullYear() && dayobject.day.getMonth() == new Date().getMonth() && dayobject.day.getDate() == new Date().getDate()" v-if="dayobject.day.getFullYear() == new Date().getFullYear() && dayobject.day.getMonth() == new Date().getMonth() && dayobject.day.getDate() == new Date().getDate()"
class="active" class="active"
...@@ -85,19 +85,6 @@ ...@@ -85,19 +85,6 @@
<span v-else>{{ dayobject.day.getDate() }}</span> <span v-else>{{ dayobject.day.getDate() }}</span>
</span> </span>
<p style="color:red">{{matching(GMTToStr(dayobject.day))}}</p> <p style="color:red">{{matching(GMTToStr(dayobject.day))}}</p>
<!-- <p style="color:red">{{GMTToStr(dayobject.day)}}</p> -->
<!-- <p
v-if="new Date(dayobject.day).getDay()+1 == 1 || new Date(dayobject.day).getDay()+1 == 7"
style="color:red"
>{{GMTToStr(dayobject.day)}}</p>-->
<!--显示剩余多少数量-->
<!-- <p v-if="leftobj[dayobject.index]">
剩余:
<span style="color: red">{{leftobj[dayobject.index].count}}</span>
</p>-->
<!---->
<!-- <button @click="order(dayobject)" v-if="leftobj[dayobject.index]">预定</button> -->
</li> </li>
</ul> </ul>
...@@ -327,10 +314,6 @@ export default { ...@@ -327,10 +314,6 @@ export default {
type: this.setForm.type type: this.setForm.type
}) })
} }
// else {
// this.$message.error('请设置不同车型不同价格1')
// return false
// }
} else if (this.setForm.type == 2) { } else if (this.setForm.type == 2) {
if (!!element.price || !!element.freeDays) { if (!!element.price || !!element.freeDays) {
params.push({ params.push({
...@@ -343,10 +326,6 @@ export default { ...@@ -343,10 +326,6 @@ export default {
type: this.setForm.type type: this.setForm.type
}) })
} }
// else {
// this.$message.error('请设置不同车型不同价格2')
// return false
// }
} else { } else {
if (!!element.level || !!element.freeDays) { if (!!element.level || !!element.freeDays) {
params.push({ params.push({
...@@ -359,15 +338,11 @@ export default { ...@@ -359,15 +338,11 @@ export default {
type: this.setForm.type type: this.setForm.type
}) })
} }
// else {
// this.$message.error('请设置不同车型不同价格3')
// return false
// }
} }
}) })
} }
if (params == '') { if (params == '') {
add_edit('',this.activeTime).then(data => { add_edit('', this.activeTime).then(data => {
if (data.status == 200) { if (data.status == 200) {
this.$message.success('设置成功') this.$message.success('设置成功')
this.chooseData = [] this.chooseData = []
...@@ -377,7 +352,9 @@ export default { ...@@ -377,7 +352,9 @@ export default {
} }
}) })
} else { } else {
add_edit(params,this.activeTime).then(data => { // console.log(params);
add_edit(params, this.activeTime).then(data => {
if (data.status == 200) { if (data.status == 200) {
this.$message.success('设置成功') this.$message.success('设置成功')
this.chooseData = [] this.chooseData = []
...@@ -398,8 +375,9 @@ export default { ...@@ -398,8 +375,9 @@ export default {
}) })
}, },
setVal(val, index, isClick) { setVal(val, index, isClick) {
//val:当前日期 index:当前索引 isClick:不置灰
if (!isClick) { if (!isClick) {
this.activeTime = val this.activeTime = val.length == 1 ? '0' + val : val
if (this.calendarStatus == 1 && this.setForm.isGlobal == 0) { if (this.calendarStatus == 1 && this.setForm.isGlobal == 0) {
dayList(val).then(data => { dayList(val).then(data => {
data.data.forEach(element => { data.data.forEach(element => {
...@@ -564,7 +542,7 @@ export default { ...@@ -564,7 +542,7 @@ export default {
this.days.push(dayobject) //将日期放入data 中的days数组 供页面渲染使用 this.days.push(dayobject) //将日期放入data 中的days数组 供页面渲染使用
} }
//其他周 //其他周
for (var i = 1; i <= 35 - this.currentWeek+7; i++) { for (var i = 1; i <= 35 - this.currentWeek + 7; i++) {
var d = new Date(str) var d = new Date(str)
d.setDate(d.getDate() + i) d.setDate(d.getDate() + i)
var dayobject = {} var dayobject = {}
...@@ -588,14 +566,34 @@ export default { ...@@ -588,14 +566,34 @@ export default {
d.setDate(0) d.setDate(0)
this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1)) this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
this.getList() this.getList()
this.changeIsGlobal(0)
this.chooseData = []
}, },
pickNext: function(year, month) { pickNext: function(year, month) {
var d = new Date(this.formatDate(year, month, 1)) var d = new Date(this.formatDate(year, month, 1))
d.setDate(35) d.setDate(35)
this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1)) this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
this.getList() this.getList()
},
this.changeIsGlobal(0)
this.chooseData = []
// this.reset()
},
// reset() {
// if ((this.calendarStatus = 1)) {
// let activeStatus = this.$refs.activeDay
// let allDays = this.$refs.allDays
// for (let index = 0; index < activeStatus.length; index++) {
// if (
// this.days[index].day.getMonth() + 1 !=
// this.currentMonth
// ) {
// activeStatus[index].className = '';
// }
// }
// }
// },
// 返回 类似 2016-01-02 格式的字符串 // 返回 类似 2016-01-02 格式的字符串
formatDate: function(year, month, day) { formatDate: function(year, month, day) {
var y = year var y = year
......
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