只能提两天之后的日期

main
lion 1 year ago
parent 49648332e5
commit 990bb4bf1e

@ -34,29 +34,30 @@
</view> </view>
</view> </view>
<view class="orderInfo-status"> <view class="orderInfo-status">
<u-form-item label="发货时间" :label-style="{'display':'none','width':0,'flex':0}" :border-bottom="false" style="width:100%" prop="send_date" <u-form-item label="发货时间" :label-style="{'display':'none','width':0,'flex':0}"
label-position="left"> :border-bottom="false" style="width:100%" prop="send_date" label-position="left">
<view style="display: flex;align-items: center;justify-content: space-between;"> <view style="display: flex;align-items: center;justify-content: space-between;">
<view> <view>
<view>发货时间</view> <view>发货时间</view>
</view> </view>
<view class="hh" @click="openDatePicker"> <view class="hh" @click="openDatePicker">
<view class="" v-if="form.send_date"> <view class="" v-if="form.send_date">
<!-- <view>{{form.express}}</view> --> <!-- <view>{{form.express}}</view> -->
<view>{{form.ymd}} <text style="color:#b62828;margin:0 10rpx">[{{form.week}}]</text> <view>{{form.ymd}} <text
<!-- {{form.hh}} --> style="color:#b62828;margin:0 10rpx">[{{form.week}}]</text>
</view> <!-- {{form.hh}} -->
</view> </view>
<view v-else> </view>
<view>选择发货时间</view> <view v-else>
</view> <view>选择发货时间</view>
<view> </view>
<u-icon name="arrow-down-fill" color="#ccc" size='28'></u-icon> <view>
</view> <u-icon name="arrow-down-fill" color="#ccc" size='28'></u-icon>
</view> </view>
</view> </view>
</view>
<view style="color:#b62828;font-size:24rpx">非到货时间预计发货后48小时左右可到货</view> <view style="color:#b62828;font-size:24rpx">非到货时间预计发货后48小时左右可到货</view>
</u-form-item> </u-form-item>
</view> </view>
@ -69,7 +70,7 @@
<u-input type="number" :maxlength="11" v-model="form.mobile" placeholder="请填写手机号码" /> <u-input type="number" :maxlength="11" v-model="form.mobile" placeholder="请填写手机号码" />
</u-form-item> </u-form-item>
<u-form-item label="备用号码" prop="mobile2" label-position="left"> <u-form-item label="备用号码" prop="mobile2" label-position="left">
<u-input v-model="form.mobile2" type="number" :maxlength="11" placeholder="请填写备用号码" /> <u-input v-model="form.mobile2" type="number" :maxlength="11" placeholder="请填写备用号码" />
</u-form-item> </u-form-item>
<u-form-item label="所在地区" prop="area" label-position="left"> <u-form-item label="所在地区" prop="area" label-position="left">
<u-input type="select" v-model="form.area" placeholder="请选择所在地区" @click="openArea" /> <u-input type="select" v-model="form.area" placeholder="请选择所在地区" @click="openArea" />
@ -97,7 +98,7 @@
<u-input v-model="form.buy_name" placeholder="选填" /> <u-input v-model="form.buy_name" placeholder="选填" />
</u-form-item> </u-form-item>
<u-form-item label="购卡人电话" :border-bottom="false" prop="buy_mobile" label-position="left"> <u-form-item label="购卡人电话" :border-bottom="false" prop="buy_mobile" label-position="left">
<u-input v-model="form.buy_mobile" type="number" :maxlength="11" placeholder="选填" /> <u-input v-model="form.buy_mobile" type="number" :maxlength="11" placeholder="选填" />
</u-form-item> </u-form-item>
</view> </view>
@ -115,11 +116,12 @@
<view class="agreeinfo" v-if="showagree"> <view class="agreeinfo" v-if="showagree">
<view class="agreeinfo-wrap"> <view class="agreeinfo-wrap">
<view class="agreeinfo-title">温馨提示</view> <view class="agreeinfo-title">温馨提示</view>
<view class="agreeinfo-content"> <view class="agreeinfo-content">
<view v-html="tips"></view> <view v-html="tips"></view>
</view> </view>
<view class="agreeinfo-btn"> <view class="agreeinfo-btn">
<view @click="closeAgree" :class="isAgree?'canAgree':''">我同意<text v-if="isAgreeTime>0">({{isAgreeTime}})</text></view> <view @click="closeAgree" :class="isAgree?'canAgree':''">我同意<text
v-if="isAgreeTime>0">({{isAgreeTime}})</text></view>
</view> </view>
</view> </view>
</view> </view>
@ -129,8 +131,8 @@
<view class="confirmpicinfo"> <view class="confirmpicinfo">
<view class="imgbox"> <view class="imgbox">
<image <image
:src="cardInfo.sku?(cardInfo.sku.image_url?cardInfo.sku.image_url:require('@/static/logo-xietaitai.png')):require('@/static/logo-xietaitai.png')" :src="cardInfo.sku?(cardInfo.sku.image_url?cardInfo.sku.image_url:require('@/static/logo-xietaitai.png')):require('@/static/logo-xietaitai.png')">
></image> </image>
</view> </view>
<view class="pictitle">{{cardInfo.sku?cardInfo.sku.name:''}}</view> <view class="pictitle">{{cardInfo.sku?cardInfo.sku.name:''}}</view>
<text>{{cardInfo.sku?cardInfo.sku.specs:''}}</text> <text>{{cardInfo.sku?cardInfo.sku.specs:''}}</text>
@ -143,14 +145,14 @@
<view class="confirmright"> <view class="confirmright">
<text class="confirmmarker">发货时间</text> <text class="confirmmarker">发货时间</text>
<view class="flex-li confirmdate"> <view class="flex-li confirmdate">
<text>{{form.ymd}} <text>{{form.ymd}}
<text class="smallfont" style="color:#b62828">[{{form.week}}]</text> <text class="smallfont" style="color:#b62828">[{{form.week}}]</text>
</text> </text>
<text class="smallfont">{{form.lunarData}}</text> <text class="smallfont">{{form.lunarData}}</text>
</view> </view>
<view class="flex-li confirmdate"> <view class="flex-li confirmdate">
<!-- <text>{{form.hh}}</text> --> <!-- <text>{{form.hh}}</text> -->
</view> </view>
</view> </view>
</view> </view>
@ -223,15 +225,15 @@
data() { data() {
return { return {
showinfo: false, showinfo: false,
showagree: false, showagree: false,
isAgree:false, isAgree: false,
isAgreeTime:10, isAgreeTime: 10,
agreeTimer:null, agreeTimer: null,
showAddress: false, showAddress: false,
listAddress: [], listAddress: [],
addressInfo: '', addressInfo: '',
cardInfo: {}, cardInfo: {},
tips:'', tips: '',
type: '', type: '',
form: { form: {
card_number: '', card_number: '',
@ -315,12 +317,12 @@
onReady() { onReady() {
this.$refs.uForm.setRules(this.rules); this.$refs.uForm.setRules(this.rules);
}, },
onUnload() { onUnload() {
if(this.agreeTimer){ if (this.agreeTimer) {
clearInterval(this.agreeTimer) clearInterval(this.agreeTimer)
this.agreeTimer = null this.agreeTimer = null
} }
}, },
onLoad(option) { onLoad(option) {
let that = this let that = this
@ -350,12 +352,12 @@
this.form.password = uni.getStorageSync("vuex_card") ? uni.getStorageSync("vuex_card").password : '' this.form.password = uni.getStorageSync("vuex_card") ? uni.getStorageSync("vuex_card").password : ''
// uni.removeStorageSync("vuex_card") // uni.removeStorageSync("vuex_card")
} }
// //
const configs = uni.getStorageSync("configs") const configs = uni.getStorageSync("configs")
configs.map(item=>{ configs.map(item => {
if(item.key==='tips'){ if (item.key === 'tips') {
this.tips = item.value this.tips = item.value
} }
}) })
this.getAddress() this.getAddress()
this.getDates() this.getDates()
@ -406,12 +408,17 @@
let data = res.card let data = res.card
if (data.open_dates) { if (data.open_dates) {
for (var k in data.open_dates) { for (var k in data.open_dates) {
if (data.open_dates[k]['quantity'] - data.open_dates[k]['booked'] > 0) { // 0
let _k = this.momentDay(k)
this.listDates.push({ if (data.open_dates[k]['quantity'] - data.open_dates[k]['booked'] > 0) {
canUse: data.open_dates[k], if(this.isAfterTwoDays(k)){
..._k let _k = this.momentDay(k)
}) this.listDates.push({
canUse: data.open_dates[k],
..._k
})
}
} }
} }
} }
@ -419,6 +426,13 @@
}) })
}, },
isAfterTwoDays(open_dates) {
const dateToCheck = this.$moment(open_dates, 'YYYY-MM-DD');
const today = this.$moment();
const twoDaysAfterToday = today.add(2, 'days');
return dateToCheck >= twoDaysAfterToday;
},
momentDay(date) { momentDay(date) {
if (date) { if (date) {
const weeks = ["周日", '周一', '周二', '周三', '周四', '周五', '周六', ] const weeks = ["周日", '周一', '周二', '周三', '周四', '周五', '周六', ]
@ -515,7 +529,7 @@
}) })
}, },
backShow() { backShow() {
let that = this let that = this
that.showinfo = false that.showinfo = false
}, },
saveDefalutAddress() { saveDefalutAddress() {
@ -564,108 +578,108 @@
} }
} }
},
openShowInfo(){
let that = this
if (!isNull(this.form.mobile2) && this.form.mobile2.length > 0) {
if (!isMobile(this.form.mobile2)) {
toast('备用电话不正确')
return
}
}
if (!isNull(this.form.buy_mobile) && this.form.buy_mobile.length > 0) {
if (!isMobile(this.form.buy_mobile)) {
toast('购买人电话不正确')
return
}
}
this.$refs.uForm.validate(valid => {
// console.log('');
if (valid) {
if (!this.showinfo) {
uni.setNavigationBarTitle({
title: '信息确认',
success: function() {
console.log('标题设置成功');
that.showinfo = true
},
fail: function(err) {
console.error('标题设置失败', err);
}
});
}
} else {
console.log('验证失败');
// toast('')
}
});
},
closeAgree(){
if(this.isAgreeTime>0){
return
}else{
this.isAgree = true
this.showagree = false
}
},
reduceAgreeTime(){
let that = this
if(that.isAgreeTime>0){
this.agreeTimer = setInterval(function(){
that.isAgreeTime--
if(that.isAgreeTime===0){
that.isAgree = true
that.isAgreeTime = 0
clearInterval(that.agreeTimer)
that.agreeTimer = null
}
},1000)
}
}, },
submit() { openShowInfo() {
let that = this
if (!isNull(this.form.mobile2) && this.form.mobile2.length > 0) {
if (!isMobile(this.form.mobile2)) {
toast('备用电话不正确')
return
}
}
if (!isNull(this.form.buy_mobile) && this.form.buy_mobile.length > 0) {
if (!isMobile(this.form.buy_mobile)) {
toast('购买人电话不正确')
return
}
}
this.$refs.uForm.validate(valid => {
// console.log('');
if (valid) {
if (!this.showinfo) {
uni.setNavigationBarTitle({
title: '信息确认',
success: function() {
console.log('标题设置成功');
that.showinfo = true
},
fail: function(err) {
console.error('标题设置失败', err);
}
});
}
} else {
console.log('验证失败');
// toast('')
}
});
},
closeAgree() {
if (this.isAgreeTime > 0) {
return
} else {
this.isAgree = true
this.showagree = false
}
},
reduceAgreeTime() {
let that = this let that = this
if(!this.isAgree){ if (that.isAgreeTime > 0) {
this.showagree = true this.agreeTimer = setInterval(function() {
this.isAgreeTime = 10 that.isAgreeTime--
this.reduceAgreeTime() if (that.isAgreeTime === 0) {
}else{ that.isAgree = true
if(this.isAgree){ that.isAgreeTime = 0
this.form.show = 0 clearInterval(that.agreeTimer)
if (this.type == 'edit') { that.agreeTimer = null
console.log("this.form", this.form) }
this.$u.api.saveUserOrder(this.form).then(res => { }, 1000)
uni.removeStorageSync('vuex_update_card') }
toast(res.msg, 1000, function() {
setTimeout(function() { },
that.saveDefalutAddress() submit() {
}, 500) let that = this
if (!this.isAgree) {
}) this.showagree = true
this.isAgreeTime = 10
}).then(res => { this.reduceAgreeTime()
console.log('res1', res) } else {
if (this.isAgree) {
}) this.form.show = 0
} else { if (this.type == 'edit') {
this.$u.api.addUserOrder(this.form).then(res => { console.log("this.form", this.form)
console.log("res", res) this.$u.api.saveUserOrder(this.form).then(res => {
uni.removeStorageSync('vuex_card') uni.removeStorageSync('vuex_update_card')
toast(res.msg, 1000, function() { toast(res.msg, 1000, function() {
setTimeout(function() { setTimeout(function() {
that.saveDefalutAddress() that.saveDefalutAddress()
}, 500) }, 500)
}) })
}).then(res => { }).then(res => {
console.log('res1', res) console.log('res1', res)
}) })
} } else {
this.$u.api.addUserOrder(this.form).then(res => {
} console.log("res", res)
uni.removeStorageSync('vuex_card')
toast(res.msg, 1000, function() {
setTimeout(function() {
that.saveDefalutAddress()
}, 500)
})
}).then(res => {
console.log('res1', res)
})
}
}
} }
} }
} }
@ -792,13 +806,15 @@
padding: 0; padding: 0;
.u-form-item__body { .u-form-item__body {
align-items: baseline; align-items: baseline;
.u-form-item--left{
width:0!important; .u-form-item--left {
flex:0!important; width: 0 !important;
flex: 0 !important;
} }
} }
} }
.hh { .hh {
&:last-child { &:last-child {
text-align: right; text-align: right;
@ -920,8 +936,8 @@
} }
.imgbox { .imgbox {
width: 150rpx; width: 150rpx;
height:150rpx; height: 150rpx;
margin: 0 auto; margin: 0 auto;
border-radius: 10rpx; border-radius: 10rpx;
border: 1px solid #ba8b45; border: 1px solid #ba8b45;
@ -930,8 +946,8 @@
} }
.imgbox image { .imgbox image {
width: 150rpx; width: 150rpx;
height:150rpx; height: 150rpx;
vertical-align: middle; vertical-align: middle;
} }
@ -982,7 +998,7 @@
font-size: 32rpx; font-size: 32rpx;
color: #000; color: #000;
font-weight: bold; font-weight: bold;
margin-bottom: 8rpx; margin-bottom: 8rpx;
text-align: center; text-align: center;
} }
@ -1051,22 +1067,22 @@
&-title { &-title {
font-size: 32rpx; font-size: 32rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
color:#b62828; color: #b62828;
text-align: center; text-align: center;
} }
&-content { &-content {
line-height: 1.8; line-height: 1.8;
font-size: 30rpx; font-size: 30rpx;
height:300rpx; height: 300rpx;
overflow: scroll; overflow: scroll;
} }
&-btn { &-btn {
>view { >view {
background-color: rgba(0,0,0,0.5); background-color: rgba(0, 0, 0, 0.5);
color: #fff; color: #fff;
border-radius: 40rpx; border-radius: 40rpx;
width: 60%; width: 60%;
@ -1075,9 +1091,10 @@
text-align: center; text-align: center;
line-height: 75rpx; line-height: 75rpx;
margin: 20rpx auto; margin: 20rpx auto;
} }
.canAgree{
background-color: #ba8b45; .canAgree {
background-color: #ba8b45;
} }
} }
} }

Loading…
Cancel
Save