|
@@ -1,21 +1,22 @@
|
|
|
<template>
|
|
|
<div class="user-info">
|
|
|
<scroller>
|
|
|
- <h2 class="title">预约</h2>
|
|
|
+ <h2 class="title">{{type[serviceType]}}预约</h2>
|
|
|
<!--输入框-->
|
|
|
<div class="weui-cells weui-cells_form">
|
|
|
<!--姓名-->
|
|
|
- <div class="weui-cell">
|
|
|
+ <div class="weui-cell" v-if="iCreateCodeShow">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
|
|
|
<div class="weui-cell__bd"><input v-model="userName" class="weui-input" type="text" required="" maxlength="11"
|
|
|
+ disabled
|
|
|
placeholder="输入您的姓名">
|
|
|
</div>
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
|
</div>
|
|
|
<!--手机验证-->
|
|
|
- <div class="weui-cell">
|
|
|
+ <div class="weui-cell" v-if="iCreateCodeShow">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">手机</label></div>
|
|
|
- <div class="weui-cell__bd"><input class="weui-input" type="tel" v-model="number" required=""
|
|
|
+ <div class="weui-cell__bd"><input class="weui-input" type="tel" v-model="mobile" required="" disabled
|
|
|
pattern="^\d{11}$" maxlength="11" placeholder="输入您现在的手机号" emptytips="请输入手机号"
|
|
|
notmatchtips="请输入正确的手机号"></div>
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
@@ -37,7 +38,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--服务地址-->
|
|
|
- <div class="weui-cell" v-if="!iCodeShow">
|
|
|
+ <div class="weui-cell">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">服务地址</label></div>
|
|
|
<div class="weui-cell__bd"><input v-model="userAddress" class="weui-input" type="text" required=""
|
|
|
maxlength="11" placeholder="输入您需要上门服务的地址">
|
|
@@ -45,7 +46,7 @@
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
|
</div>
|
|
|
<!--所属门店-->
|
|
|
- <div class="weui-cell" v-if="!iCodeShow">
|
|
|
+ <div class="weui-cell">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">门店选择</label></div>
|
|
|
<div class="weui-cell__bd" @click='btnStore'>
|
|
|
<input class="weui-input select-time" type="button" required=""
|
|
@@ -54,7 +55,7 @@
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
|
</div>
|
|
|
<!--服务形式-->
|
|
|
- <div class="weui-cell" v-if="serviceType == 0 && !iCodeShow">
|
|
|
+ <div class="weui-cell" v-if="serviceType == 0">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">服务形式</label></div>
|
|
|
<div class="weui-cell__bd" @click='btnServiceForm'>
|
|
|
<input class="weui-input select-time" type="button" required=""
|
|
@@ -63,7 +64,7 @@
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
|
</div>
|
|
|
<!--服务时间-->
|
|
|
- <div class="weui-cell" v-if="serviceType == 0 && !iCodeShow">
|
|
|
+ <div class="weui-cell" v-if="serviceType == 0">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">服务时间</label></div>
|
|
|
<div class="weui-cell__bd">
|
|
|
<div class="service-time select-time" @click='btnServiceAM'>{{serviceTimeAM}}</div>
|
|
@@ -72,9 +73,7 @@
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
|
</div>
|
|
|
<!--服务技能-->
|
|
|
- <!--<div class="weui-cell" v-if="serviceType == 0 && !iCodeShow">-->
|
|
|
- <div class="weui-cell">
|
|
|
- <!--<div class="weui-cell">-->
|
|
|
+ <div class="weui-cell" v-if="serviceType == 0">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">服务技能</label></div>
|
|
|
<div class="weui-cell__bd" @click="showPopup=true">
|
|
|
<input class="weui-input select-time" type="button" required=""
|
|
@@ -84,7 +83,7 @@
|
|
|
</div>
|
|
|
|
|
|
<!--预产期-->
|
|
|
- <div v-if='serviceType == 1 && !iCodeShow' class="weui-cell">
|
|
|
+ <div v-if='serviceType == 1' class="weui-cell">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">预产期</label></div>
|
|
|
<div class="weui-cell__bd" @click='btn()'>
|
|
|
<input class="weui-input select-time" type="button" required=""
|
|
@@ -93,7 +92,7 @@
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
|
</div>
|
|
|
<!--孩子年龄-->
|
|
|
- <div v-if="serviceType == 2 && !iCodeShow" class="weui-cell">
|
|
|
+ <div v-if="serviceType == 2" class="weui-cell">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">孩子年龄</label></div>
|
|
|
<div class="weui-cell__bd"><input v-model="userAge" class="weui-input" type="text" required="" maxlength="11"
|
|
|
placeholder="输入您孩子的年龄">
|
|
@@ -101,7 +100,7 @@
|
|
|
<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
|
|
|
</div>
|
|
|
<!--备注-->
|
|
|
- <div class="weui-cell" v-if="!iCodeShow">
|
|
|
+ <div class="weui-cell">
|
|
|
<div class="weui-cell__hd"><label class="weui-label">备注</label></div>
|
|
|
<div class="weui-cell__bd"><input v-model="dec" class="weui-input" type="text" required="" maxlength="11"
|
|
|
placeholder="补充您的需求">
|
|
@@ -147,8 +146,9 @@
|
|
|
return {
|
|
|
msg: 'this is userInfo',
|
|
|
userName: '', // 客户姓名
|
|
|
- number: '', // 客户手机
|
|
|
- oldNumber: '', // 客户手机已验证
|
|
|
+ mobile: '', // 客户手机
|
|
|
+ type: {0: '钟点工', 1: '月嫂', 2: '育婴师', 3: '护理老人', 4: '全套家务'},
|
|
|
+// oldmobile: '', // 客户手机已验证
|
|
|
userAddress: '', // 服务地址
|
|
|
store: '请选择门店', // 门店
|
|
|
storeId: '', // 门店ID
|
|
@@ -159,10 +159,10 @@
|
|
|
resTime: '', // 已选择时间戳
|
|
|
createCode: '', // 验证码
|
|
|
iCreateCode: '', // 用户输入的验证码
|
|
|
- iCreateCodeShow: true, // show验证码
|
|
|
+ iCreateCodeShow: false, // show验证码
|
|
|
code: '', // 短信验证码
|
|
|
iCode: '', // 用户输入的短信验证码
|
|
|
- iCodeShow: true, // show短信验证码
|
|
|
+ iCodeShow: false, // show短信验证码
|
|
|
serviceType: null,
|
|
|
serviceArr: [
|
|
|
{label: '做一休一', value: 2},
|
|
@@ -172,7 +172,8 @@
|
|
|
resServiceArr: null, // 已选服务形式集合
|
|
|
serviceForm: '请选择', // 服务形式
|
|
|
serviceFormText: null, // 服务形式
|
|
|
- serviceTimeArr: [], // 服务时间
|
|
|
+ serviceTimeArrAM: [], // 开始服务时间
|
|
|
+ serviceTimeArrPM: [], // 结束服务时间
|
|
|
serviceTimeAM: '开始时间',
|
|
|
serviceTimePM: '结束时间',
|
|
|
serviceSkillsArr: [
|
|
@@ -201,28 +202,28 @@
|
|
|
Popup
|
|
|
},
|
|
|
watch: {
|
|
|
- number: function (val, oldVal) {
|
|
|
- if (val.length === 11) {
|
|
|
- if (val !== this.oldNumber) {
|
|
|
- this.iCodeShow = true;
|
|
|
- this.iCreateCodeShow = true;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+ /* mobile: function (val, oldVal) {
|
|
|
+ if (val.length === 11) {
|
|
|
+ if (val !== this.oldmobile) {
|
|
|
+ this.iCodeShow = true;
|
|
|
+ this.iCreateCodeShow = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },*/
|
|
|
// 短信验证码
|
|
|
- iCode: function (val, oldVal) {
|
|
|
- if (val.length === 4) {
|
|
|
- if (val == this.code) {
|
|
|
- this.iCodeShow = false;
|
|
|
- this.iCreateCodeShow = false;
|
|
|
- this.oldNumber = this.number;
|
|
|
- if (!this.iCodeShow) {
|
|
|
- weui.alert('手机号码验证成功,请您填写您的需求并提交!');
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+ /* iCode: function (val, oldVal) {
|
|
|
+ if (val.length === 4) {
|
|
|
+ if (val == this.code) {
|
|
|
+ this.iCodeShow = false;
|
|
|
+ this.iCreateCodeShow = false;
|
|
|
+ this.oldmobile = this.mobile;
|
|
|
+ if (!this.iCodeShow) {
|
|
|
+ weui.alert('手机号码验证成功,请您填写您的需求并提交!');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },*/
|
|
|
// 验证码
|
|
|
// iCreateCode: function (val, oldVal) {
|
|
|
// if(val.length === 4 ){
|
|
@@ -247,10 +248,16 @@
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ // 数据绑定
|
|
|
+ this.userName = config.userInfo.name;
|
|
|
+ this.mobile = config.userInfo.mobile;
|
|
|
this.createCode = createCode();
|
|
|
this.serviceType = config.serviceType;
|
|
|
- for (let i = 9; i < 20; i++) {
|
|
|
- this.serviceTimeArr.push(i + ':00');
|
|
|
+ for (let i = 6; i < 20; i++) {
|
|
|
+ this.serviceTimeArrAM.push(i + ':00');
|
|
|
+ }
|
|
|
+ for (let i = 7; i < 22; i++) {
|
|
|
+ this.serviceTimeArrPM.push(i + ':00');
|
|
|
}
|
|
|
axios.post(config.apiPath + 'j/HouseKeeping/GetStore').then(res => {
|
|
|
this.storeArr = res.data;
|
|
@@ -289,7 +296,7 @@
|
|
|
let newStoreArr = [];
|
|
|
for (let i = 0; i < that.storeArr.length; i++) {
|
|
|
newStoreArr.push({
|
|
|
- label: that.storeArr[i].store_name,
|
|
|
+ label: that.storeArr[i].store_name + '(' + that.storeArr[i].address + ')',
|
|
|
value: that.storeArr[i].store_id
|
|
|
})
|
|
|
}
|
|
@@ -310,7 +317,7 @@
|
|
|
// 时间选择
|
|
|
btnServiceAM() {
|
|
|
let that = this;
|
|
|
- weui.picker(that.serviceTimeArr, {
|
|
|
+ weui.picker(that.serviceTimeArrAM, {
|
|
|
className: 'custom-classname',
|
|
|
container: 'body',
|
|
|
defaultValue: [0],
|
|
@@ -324,7 +331,7 @@
|
|
|
},
|
|
|
btnServicePM() {
|
|
|
let that = this;
|
|
|
- weui.picker(that.serviceTimeArr, {
|
|
|
+ weui.picker(that.serviceTimeArrPM, {
|
|
|
className: 'custom-classname',
|
|
|
container: 'body',
|
|
|
defaultValue: [0],
|
|
@@ -378,12 +385,12 @@
|
|
|
// 获取短信验证码
|
|
|
getCode() {
|
|
|
// 检验手机号码
|
|
|
- if (!(/^1[34578]\d{9}$/.test(this.number)) || this.number === 0) {
|
|
|
+ if (!(/^1[34578]\d{9}$/.test(this.mobile)) || this.mobile === 0) {
|
|
|
weui.alert('输入的手机号码有误,请重新输入');
|
|
|
return
|
|
|
}
|
|
|
if (this.iCreateCode === this.createCode) {
|
|
|
- axios.get(config.apiPath + '/moonclub/reserve/code&number=' + this.number).then(res => {
|
|
|
+ axios.get(config.apiPath + '/moonclub/reserve/code&mobile=' + this.mobile).then(res => {
|
|
|
// 短信发送成功
|
|
|
if (res.data.success) {
|
|
|
weui.alert('短信已发送,请留意查收!');
|
|
@@ -405,19 +412,19 @@
|
|
|
let that = this,
|
|
|
skillsArray = [];
|
|
|
// 用户名判断
|
|
|
- if (!that.userName) {
|
|
|
- weui.alert('请输入您的姓名');
|
|
|
- return
|
|
|
- }
|
|
|
+ /* if (!that.userName) {
|
|
|
+ weui.alert('请输入您的姓名');
|
|
|
+ return
|
|
|
+ }*/
|
|
|
// 手机验证
|
|
|
- if (this.oldNumber.length !== 11) {
|
|
|
- weui.alert('您的手机号码输入有误!');
|
|
|
- return
|
|
|
- }
|
|
|
+ /* if (this.oldmobile.length !== 11) {
|
|
|
+ weui.alert('您的手机号码输入有误!');
|
|
|
+ return
|
|
|
+ }*/
|
|
|
// return;
|
|
|
|
|
|
// 短信验证码判断
|
|
|
-// if (Number.parseInt(that.iCode) !== that.code) {
|
|
|
+// if (mobile.parseInt(that.iCode) !== that.code) {
|
|
|
// weui.alert('输入的短信验证码有误,请重新输入');
|
|
|
// return
|
|
|
// }
|
|
@@ -450,7 +457,7 @@
|
|
|
}
|
|
|
|
|
|
// 服务技能
|
|
|
- if (that.skillsStr == '') {
|
|
|
+ if (that.serviceType == 0 && that.skillsStr == '') {
|
|
|
weui.alert('请选择服务技能');
|
|
|
return
|
|
|
} else {
|
|
@@ -471,12 +478,12 @@
|
|
|
if (that.serviceType === 2 && !that.userAge) {
|
|
|
weui.alert('请输入您孩子的年龄!');
|
|
|
return
|
|
|
- } else if (that.serviceType !== 2 ){
|
|
|
+ } else if (that.serviceType !== 2) {
|
|
|
that.userAge = 1
|
|
|
}
|
|
|
|
|
|
// 字符串拼接
|
|
|
- let stitching = `&user_id=${config.user_id}&mobile=${that.number}&user_name=${that.userName}&type=${that.serviceType + 1}&skill=${JSON.stringify(skillsArray)}&cart=${that.resServiceArr}&age=${that.userAge}&address=${that.userAddress}&store_id=${that.storeId}&desc=${that.dec}&yc_time=${that.resTime}&server_start_time=${time(that.serviceTimeAM)}&server_end_time=${time(that.serviceTimePM)}`;
|
|
|
+ let stitching = `&user_id=${config.user_id}&mobile=${that.mobile}&user_name=${that.userName}&type=${that.serviceType + 1}&skill=${JSON.stringify(skillsArray)}&cart=${that.resServiceArr}&age=${that.userAge}&address=${that.userAddress}&store_id=${that.storeId}&desc=${that.dec}&yc_time=${that.resTime}&server_start_time=${time(that.serviceTimeAM)}&server_end_time=${time(that.serviceTimePM)}`;
|
|
|
if (that)
|
|
|
axios.post(config.apiPath + 'j/HouseKeeping/Add' + stitching).then(res => {
|
|
|
console.log(res);
|
|
@@ -504,7 +511,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function createCode(Number) {
|
|
|
+ function createCode(mobile) {
|
|
|
let code = '';
|
|
|
let random = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; // 随机数
|
|
|
for (let i = 0; i < 4; i++) { // 循环操作
|