2020-06-04 08:21:34 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="manicure-order">
|
|
|
|
|
<view class="order-form">
|
2020-07-18 17:43:37 +08:00
|
|
|
|
<view class="order-name">
|
2020-06-04 08:21:34 +08:00
|
|
|
|
<view>美甲人:</view>
|
|
|
|
|
<input type="text" v-model="name" />
|
2020-07-18 17:43:37 +08:00
|
|
|
|
</view>
|
2020-06-04 08:21:34 +08:00
|
|
|
|
<view class="order-date" @click="show=true">
|
2020-07-10 09:03:19 +08:00
|
|
|
|
<view class="title">美甲时间:</view>
|
|
|
|
|
<image src="../static/mine/21.png" v-if="!time"></image>
|
|
|
|
|
<view v-else class="time">{{ time }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="order-address">
|
|
|
|
|
<view class="title">美甲地址:</view>
|
|
|
|
|
<input type="text" v-model="address" disabled />
|
2020-06-04 08:21:34 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2020-06-23 17:21:01 +08:00
|
|
|
|
<view class="order-btn" @click="addManicureOrder">确认订单</view>
|
2020-06-04 08:21:34 +08:00
|
|
|
|
<u-picker mode="time" v-model="show" :params="params" @confirm="chooseDate"></u-picker>
|
2020-06-23 17:21:01 +08:00
|
|
|
|
<u-toast ref="uToast" />
|
2020-06-04 08:21:34 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
name: '',
|
|
|
|
|
time: '',
|
2020-07-10 09:03:19 +08:00
|
|
|
|
address: '四川省攀枝花市银江镇',
|
2020-06-04 08:21:34 +08:00
|
|
|
|
params: {
|
|
|
|
|
year: true,
|
|
|
|
|
month: true,
|
|
|
|
|
day: true,
|
|
|
|
|
hour: true,
|
|
|
|
|
minute: true,
|
|
|
|
|
second: false
|
|
|
|
|
},
|
2020-07-20 17:17:41 +08:00
|
|
|
|
show: false,
|
|
|
|
|
addressInfo: {},
|
2020-06-04 08:21:34 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-07-20 17:17:41 +08:00
|
|
|
|
onLoad() {
|
|
|
|
|
this.getConfigInfo();
|
|
|
|
|
},
|
2020-06-04 08:21:34 +08:00
|
|
|
|
methods: {
|
2020-06-23 17:21:01 +08:00
|
|
|
|
validateValue() {
|
|
|
|
|
if(this.$u.test.isEmpty(this.name)) {
|
2020-07-20 17:17:41 +08:00
|
|
|
|
this.showToast('姓名不能为空', 'error');
|
2020-06-23 17:21:01 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(this.$u.test.isEmpty(this.time)) {
|
2020-07-20 17:17:41 +08:00
|
|
|
|
this.showToast('日期不能为空', 'error');
|
2020-06-23 17:21:01 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(new Date() > new Date(this.time)) {
|
2020-07-20 17:17:41 +08:00
|
|
|
|
this.showToast('日期错误', 'error');
|
2020-06-23 17:21:01 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
},
|
2020-06-23 09:00:04 +08:00
|
|
|
|
addManicureOrder() {
|
2020-06-23 17:21:01 +08:00
|
|
|
|
if(!this.validateValue()) return false;
|
2020-06-23 09:00:04 +08:00
|
|
|
|
this.$u.api.addManicure({
|
|
|
|
|
name: this.name,
|
2020-06-23 17:21:01 +08:00
|
|
|
|
time: new Date(this.time)
|
2020-06-23 09:00:04 +08:00
|
|
|
|
}).then((res)=>{
|
2020-06-24 16:39:31 +08:00
|
|
|
|
if(res.errCode == 0) {
|
2020-07-03 17:44:58 +08:00
|
|
|
|
uni.redirectTo({
|
2020-06-24 16:39:31 +08:00
|
|
|
|
url: '/pageE/tool/Manicure'
|
2020-07-03 17:44:58 +08:00
|
|
|
|
});
|
|
|
|
|
// this.$refs.uToast.show({
|
|
|
|
|
// title: res.message,
|
|
|
|
|
// type: 'success',
|
|
|
|
|
// url: '/pageE/tool/Manicure'
|
|
|
|
|
// })
|
2020-06-24 16:39:31 +08:00
|
|
|
|
} else {
|
|
|
|
|
this.showToast(res.message, 'error');
|
|
|
|
|
}
|
2020-06-23 09:00:04 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
2020-07-20 17:17:41 +08:00
|
|
|
|
getConfigInfo() {
|
|
|
|
|
this.$u.api.getConfigInfo({
|
|
|
|
|
code: 'manicure_address',
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if(res.errCode == 0) {
|
|
|
|
|
this.addressInfo = res.data.config;
|
|
|
|
|
this.address = this.addressInfo.value;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2020-06-04 08:21:34 +08:00
|
|
|
|
chooseDate(e) {
|
2020-06-23 17:21:01 +08:00
|
|
|
|
// let time = e.year + '年' + e.month + '月' + e.day + '日' + e.hour + '时' + e.minute + '分'
|
|
|
|
|
let time = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute
|
2020-06-04 08:21:34 +08:00
|
|
|
|
this.time = time
|
2020-06-23 17:21:01 +08:00
|
|
|
|
},
|
|
|
|
|
showToast(message, type) {
|
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
|
title: message,
|
|
|
|
|
type: type,
|
|
|
|
|
})
|
|
|
|
|
},
|
2020-06-04 08:21:34 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.manicure-order {
|
|
|
|
|
min-height: calc(100vh - var(--window-top));
|
|
|
|
|
background-color: #ECECEC;
|
|
|
|
|
padding-top: 1rpx;
|
|
|
|
|
.order-form {
|
|
|
|
|
> view {
|
|
|
|
|
height: 98rpx;
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
padding: 35rpx 30rpx;
|
|
|
|
|
&:not(:last-child) {
|
|
|
|
|
margin-bottom: 2rpx;
|
|
|
|
|
}
|
2020-07-10 09:03:19 +08:00
|
|
|
|
.title {
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
}
|
2020-06-04 08:21:34 +08:00
|
|
|
|
}
|
2020-07-20 17:17:41 +08:00
|
|
|
|
.order-name {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
> view {
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color: rgba(51,51,51,1);
|
|
|
|
|
}
|
|
|
|
|
> input {
|
|
|
|
|
padding-left: 20rpx;
|
|
|
|
|
flex: 1;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-10 09:03:19 +08:00
|
|
|
|
.order-address {
|
2020-06-04 08:21:34 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
> view {
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color: rgba(51,51,51,1);
|
|
|
|
|
}
|
|
|
|
|
> input {
|
2020-07-10 09:03:19 +08:00
|
|
|
|
padding-left: 20rpx;
|
2020-06-04 08:21:34 +08:00
|
|
|
|
flex: 1;
|
2020-07-10 09:03:19 +08:00
|
|
|
|
font-size: 28rpx;
|
2020-06-04 08:21:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.order-date {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
2020-07-10 09:03:19 +08:00
|
|
|
|
> image {
|
2020-06-04 08:21:34 +08:00
|
|
|
|
width: 14rpx;
|
|
|
|
|
height :24rpx;
|
|
|
|
|
}
|
2020-07-10 09:03:19 +08:00
|
|
|
|
.time {
|
|
|
|
|
padding-left: 20rpx;
|
|
|
|
|
flex: 1;
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
2020-06-04 08:21:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.order-btn {
|
|
|
|
|
width: 690rpx;
|
|
|
|
|
height: 98rpx;
|
|
|
|
|
background: rgba(255,120,15,1);
|
|
|
|
|
border-radius: 49rpx;
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
color: rgba(255,255,255,1);
|
|
|
|
|
line-height: 98rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 40rpx;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translate(-50%, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|