|
@@ -6,9 +6,9 @@ var app = getApp();
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
- traceId:'',//视频号的traceid
|
|
|
- requireOrder:0,//视频号 是否需要推单,1:需要,0:不需要
|
|
|
- increaseSumPrice:0,
|
|
|
+ traceId: '', //视频号的traceid
|
|
|
+ requireOrder: 0, //视频号 是否需要推单,1:需要,0:不需要
|
|
|
+ increaseSumPrice: 0,
|
|
|
isRecommend: false,
|
|
|
isNoMatch: true,
|
|
|
codeShow: false,
|
|
@@ -23,8 +23,8 @@ Page({
|
|
|
popupType: 1, //1单次预约 2 选择服务频次 3选择首次预约时间
|
|
|
// timeList: check.getTimeList(1),
|
|
|
timeList: [],
|
|
|
- // dateList: util.getDateList(new Date(new Date().getTime() + 60 * 60 * 1000 * 24 * 0), 1, 21),
|
|
|
- dateList:[],
|
|
|
+ // dateList: util.getDateList(new Date(new Date().getTime() + 60 * 60 * 1000 * 24 * 0), 1, 21),
|
|
|
+ dateList: [],
|
|
|
// firstAppointList:util.getDateList(new Date(new Date().getTime()+60*60*1000*24),7),
|
|
|
firstAppointList: [],
|
|
|
timeIndex: '', //选中的时间段
|
|
@@ -99,8 +99,8 @@ Page({
|
|
|
orderTotalPrice: 0.00, //订单总价
|
|
|
actualPrice: 0.00, //实际需要支付的总价
|
|
|
cartId: 0,
|
|
|
- addressId: 0,
|
|
|
- addressMsg:'',
|
|
|
+ addressId: 0,
|
|
|
+ addressMsg: '',
|
|
|
couponId: 0,
|
|
|
userCouponId: 0,
|
|
|
message: '',
|
|
@@ -114,10 +114,16 @@ Page({
|
|
|
fraId: '', //加盟商id
|
|
|
rId: '', //阿姨推荐码
|
|
|
channelId: 5, //渠道id
|
|
|
- goodsType: 1 ,//商品类型 如果是6 可以不填写预约时间,
|
|
|
- serviceDuration:'',
|
|
|
- noonType: 1,
|
|
|
+ goodsType: 1, //商品类型 如果是6 可以不填写预约时间,
|
|
|
+ serviceDuration: '',
|
|
|
+ noonType: 1,
|
|
|
selectTimeValue: '',
|
|
|
+ date: '',
|
|
|
+ week: '',
|
|
|
+ time: '',
|
|
|
+ selectweek: '一周一次',
|
|
|
+ weekday: '周一',
|
|
|
+ selecttime: ''
|
|
|
},
|
|
|
//获取checkou信息
|
|
|
getCheckoutInfo: function (appType) {
|
|
@@ -146,8 +152,8 @@ Page({
|
|
|
freightPrice: res.data.freightPrice,
|
|
|
goodsTotalPrice: res.data.goodsTotalPrice,
|
|
|
orderTotalPrice: res.data.orderTotalPrice,
|
|
|
- addressId: res.data.addressId,
|
|
|
- addressMsg: res.data.addressMsg,
|
|
|
+ addressId: res.data.addressId,
|
|
|
+ addressMsg: res.data.addressMsg,
|
|
|
couponId: res.data.couponId,
|
|
|
userCouponId: res.data.userCouponId,
|
|
|
grouponRulesId: res.data.grouponRulesId,
|
|
@@ -156,11 +162,11 @@ Page({
|
|
|
popupType: res.data.checkedGoodsList[0].product.serviceTimes == 1 ? 1 : 2,
|
|
|
bookStartDate: res.data.bookStartDate,
|
|
|
bookEndDate: res.data.bookEndDate,
|
|
|
- goodsType: res.data.goodsType,
|
|
|
- increaseSumPrice:res.data.increaseSumPrice,
|
|
|
- serviceDuration:res.data.serviceDuration
|
|
|
+ goodsType: res.data.goodsType,
|
|
|
+ increaseSumPrice: res.data.increaseSumPrice,
|
|
|
+ serviceDuration: res.data.serviceDuration
|
|
|
});
|
|
|
- let serviceDuration =res.data.checkedGoodsList[0].product.serviceDuration;
|
|
|
+ let serviceDuration = res.data.checkedGoodsList[0].product.serviceDuration;
|
|
|
if (that.data.popupType == 2) {
|
|
|
let timeList = [];
|
|
|
if (res.data.timeRange != null && res.data.timeRange.length > 0) {
|
|
@@ -179,12 +185,12 @@ Page({
|
|
|
|
|
|
|
|
|
}
|
|
|
- if(res.data.addressId==null&&res.data.addressMsg!=null){
|
|
|
- wx.showToast({
|
|
|
- title: res.data.addressMsg,
|
|
|
- icon:'none'
|
|
|
- })
|
|
|
- }
|
|
|
+ if (res.data.addressId == null && res.data.addressMsg != null) {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.data.addressMsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
// that.LimitCanAppointmentDate();
|
|
|
|
|
|
}
|
|
@@ -351,8 +357,7 @@ Page({
|
|
|
var addressId = wx.getStorageSync('addressId');
|
|
|
if (addressId === "") {
|
|
|
addressId = 0;
|
|
|
- }else if (typeof addressId === 'number') {
|
|
|
- } else if ( (typeof addressId === 'string'&& addressId.indexOf("{") !== -1)||addressId.length>20) {
|
|
|
+ } else if (typeof addressId === 'number') {} else if ((typeof addressId === 'string' && addressId.indexOf("{") !== -1) || addressId.length > 20) {
|
|
|
addressId = JSON.parse(addressId).id;
|
|
|
}
|
|
|
var couponId = wx.getStorageSync('couponId');
|
|
@@ -410,18 +415,18 @@ Page({
|
|
|
submitOrder: function () {
|
|
|
let that = this;
|
|
|
if (that.data.addressId <= 0) {
|
|
|
- //所选地址无服务门店,或选择其他地址
|
|
|
- let errmsg=that.data.addressMsg==''?'请选择收货地址':that.data.addressMsg;
|
|
|
- //util.showErrorToast(errmsg);
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: errmsg,
|
|
|
- showCancel:false,
|
|
|
- });
|
|
|
+ //所选地址无服务门店,或选择其他地址
|
|
|
+ let errmsg = that.data.addressMsg == '' ? '请选择收货地址' : that.data.addressMsg;
|
|
|
+ //util.showErrorToast(errmsg);
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: errmsg,
|
|
|
+ showCancel: false,
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
// 检查是否已经预约
|
|
|
- if (that.data.goodsType != 6&&that.data.goodsType != 4 && that.data.isNeedAppoint && !that.data.isFinishAppoint) {
|
|
|
+ if (that.data.goodsType != 6 && that.data.goodsType != 4 && that.data.isNeedAppoint && !that.data.isFinishAppoint) {
|
|
|
// util.showErrorToast('请先预约服务时间');
|
|
|
wx.showToast({
|
|
|
title: '请先预约服务时间',
|
|
@@ -480,7 +485,7 @@ Page({
|
|
|
let params = {
|
|
|
weeks: weeks,
|
|
|
type: 0,
|
|
|
- startDate: this.data.isNeedAppoint?this.data.dateList[this.data.dateIndex].bookdate:null,
|
|
|
+ startDate: this.data.isNeedAppoint ? this.data.dateList[this.data.dateIndex].bookdate : null,
|
|
|
lng: this.data.checkedAddress.lng,
|
|
|
lat: this.data.checkedAddress.lat,
|
|
|
shopId: this.data.checkedAddress.shopId,
|
|
@@ -493,7 +498,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
orderPay(orderData) {
|
|
|
- let that=this;
|
|
|
+ let that = this;
|
|
|
var orderInfo = {
|
|
|
cartId: this.data.cartId,
|
|
|
addressId: this.data.addressId,
|
|
@@ -510,9 +515,9 @@ Page({
|
|
|
fraId: this.data.fraId, //加盟商id
|
|
|
channelId: this.data.channelId, //渠道码
|
|
|
//预约参数信息
|
|
|
- orderDate: orderData,
|
|
|
- requireOrder:this.data.requireOrder,
|
|
|
- traceId:this.data.traceId//视频号
|
|
|
+ orderDate: orderData,
|
|
|
+ requireOrder: this.data.requireOrder,
|
|
|
+ traceId: this.data.traceId //视频号
|
|
|
};
|
|
|
if (this.data.codeShow && !this.data.isNoMatch) {
|
|
|
orderInfo.recCode = this.data.recCode;
|
|
@@ -521,21 +526,21 @@ Page({
|
|
|
util.request(api.OrderSubmit, orderInfo, 'POST').then(res => {
|
|
|
|
|
|
|
|
|
- //视频号,校验 wx.checkBeforeAddOrder
|
|
|
- wx.checkBeforeAddOrder({
|
|
|
- success (res) {
|
|
|
- console.log("checkBeforeAddOrder-success:",res);
|
|
|
- if(res.data.errcode==0){
|
|
|
- that.setData({
|
|
|
- traceId:res.data.traceId,
|
|
|
- requireOrder:res.data.requireOrder
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- fail (res) {
|
|
|
- console.log("checkBeforeAddOrder-fail:",res);
|
|
|
- }
|
|
|
- })
|
|
|
+ //视频号,校验 wx.checkBeforeAddOrder
|
|
|
+ wx.checkBeforeAddOrder({
|
|
|
+ success(res) {
|
|
|
+ console.log("checkBeforeAddOrder-success:", res);
|
|
|
+ if (res.data.errcode == 0) {
|
|
|
+ that.setData({
|
|
|
+ traceId: res.data.traceId,
|
|
|
+ requireOrder: res.data.requireOrder
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ console.log("checkBeforeAddOrder-fail:", res);
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
|
|
|
|
|
@@ -562,85 +567,81 @@ Page({
|
|
|
}, 'POST').then(res => {
|
|
|
if (res.errno === 0) {
|
|
|
const payParam = res.data;
|
|
|
- console.log("支付过程开始");
|
|
|
- if(this.data.requireOrder==1){
|
|
|
- //视频号支付
|
|
|
- wx.requestOrderPayment({
|
|
|
- 'timeStamp': payParam.timeStamp,
|
|
|
- 'nonceStr': payParam.nonceStr,
|
|
|
- 'package': payParam.packageValue,
|
|
|
- 'signType': payParam.signType,
|
|
|
- 'paySign': payParam.paySign,
|
|
|
- 'success': res => {
|
|
|
- console.log("支付过程成功");
|
|
|
- if (grouponLinkId) {
|
|
|
- setTimeout(() => {
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/groupon/grouponDetail/grouponDetail?id=' + grouponLinkId
|
|
|
- })
|
|
|
- }, 1000);
|
|
|
- } else {
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/checkout/payResult/payResult?status=1&orderId=' + orderId + '&actualPrice=' + this.data.actualPrice
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- 'fail': res => {
|
|
|
- console.log("支付过程失败");
|
|
|
-
|
|
|
- // wx.redirectTo({
|
|
|
- // url: '/pages/checkout/payResult/payResult?status=0&orderId=' + orderId
|
|
|
- // });
|
|
|
- // 弹出支付失败
|
|
|
- this.setData({
|
|
|
- payFailShow: true,
|
|
|
- remarkDisable: true
|
|
|
-
|
|
|
- });
|
|
|
- },
|
|
|
- 'complete': function (res) {
|
|
|
- console.log("支付过程结束")
|
|
|
- }
|
|
|
- });
|
|
|
- }else{
|
|
|
- wx.requestPayment({
|
|
|
- 'timeStamp': payParam.timeStamp,
|
|
|
- 'nonceStr': payParam.nonceStr,
|
|
|
- 'package': payParam.packageValue,
|
|
|
- 'signType': payParam.signType,
|
|
|
- 'paySign': payParam.paySign,
|
|
|
- 'success': res => {
|
|
|
- console.log("支付过程成功");
|
|
|
- if (grouponLinkId) {
|
|
|
- setTimeout(() => {
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/groupon/grouponDetail/grouponDetail?id=' + grouponLinkId
|
|
|
- })
|
|
|
- }, 1000);
|
|
|
- } else {
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/checkout/payResult/payResult?status=1&orderId=' + orderId + '&actualPrice=' + this.data.actualPrice
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- 'fail': res => {
|
|
|
- console.log("支付过程失败");
|
|
|
-
|
|
|
- // wx.redirectTo({
|
|
|
- // url: '/pages/checkout/payResult/payResult?status=0&orderId=' + orderId
|
|
|
- // });
|
|
|
- // 弹出支付失败
|
|
|
- this.setData({
|
|
|
- payFailShow: true,
|
|
|
- remarkDisable: true
|
|
|
-
|
|
|
- });
|
|
|
- },
|
|
|
- 'complete': function (res) {
|
|
|
- console.log("支付过程结束")
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ console.log("支付过程开始");
|
|
|
+ if (this.data.requireOrder == 1) {
|
|
|
+ //视频号支付
|
|
|
+ wx.requestOrderPayment({
|
|
|
+ 'timeStamp': payParam.timeStamp,
|
|
|
+ 'nonceStr': payParam.nonceStr,
|
|
|
+ 'package': payParam.packageValue,
|
|
|
+ 'signType': payParam.signType,
|
|
|
+ 'paySign': payParam.paySign,
|
|
|
+ 'success': res => {
|
|
|
+ console.log("支付过程成功");
|
|
|
+ if (grouponLinkId) {
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/groupon/grouponDetail/grouponDetail?id=' + grouponLinkId
|
|
|
+ })
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/checkout/payResult/payResult?status=1&orderId=' + orderId + '&actualPrice=' + this.data.actualPrice
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'fail': res => {
|
|
|
+ console.log("支付过程失败");
|
|
|
+
|
|
|
+ // wx.redirectTo({
|
|
|
+ // url: '/pages/checkout/payResult/payResult?status=0&orderId=' + orderId
|
|
|
+ // });
|
|
|
+ // 弹出支付失败
|
|
|
+ this.setData({
|
|
|
+ payFailShow: true,
|
|
|
+ remarkDisable: true
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ 'complete': function (res) {
|
|
|
+ console.log("支付过程结束")
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.requestPayment({
|
|
|
+ 'timeStamp': payParam.timeStamp,
|
|
|
+ 'nonceStr': payParam.nonceStr,
|
|
|
+ 'package': payParam.packageValue,
|
|
|
+ 'signType': payParam.signType,
|
|
|
+ 'paySign': payParam.paySign,
|
|
|
+ 'success': res => {
|
|
|
+ console.log("支付过程成功");
|
|
|
+ if (grouponLinkId) {
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/groupon/grouponDetail/grouponDetail?id=' + grouponLinkId
|
|
|
+ })
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/checkout/payResult/payResult?status=1&orderId=' + orderId + '&actualPrice=' + this.data.actualPrice
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'fail': res => {
|
|
|
+ console.log("支付过程失败");
|
|
|
+ // 弹出支付失败
|
|
|
+ this.setData({
|
|
|
+ payFailShow: true,
|
|
|
+ remarkDisable: true
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ 'complete': function (res) {
|
|
|
+ console.log("支付过程结束")
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
// 弹出支付失败
|
|
@@ -648,19 +649,14 @@ Page({
|
|
|
payFailShow: true,
|
|
|
remarkDisable: true
|
|
|
});
|
|
|
- // wx.redirectTo({
|
|
|
- // url: '/pages/checkout/payResult/payResult?status=0&orderId=' + orderId
|
|
|
- // });
|
|
|
}
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
- wx.showToast({
|
|
|
- title: res.errmsg,
|
|
|
- icon:'none'
|
|
|
- })
|
|
|
-
|
|
|
- // util.showErrorToast(res.errmsg);
|
|
|
+ wx.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -792,21 +788,21 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- //视频号,校验 wx.checkBeforeAddOrder
|
|
|
- wx.checkBeforeAddOrder({
|
|
|
- success (res) {
|
|
|
- console.log("checkBeforeAddOrder-success:",res);
|
|
|
- if(res.data.errcode==0){
|
|
|
- that.setData({
|
|
|
- traceId:res.data.traceId,
|
|
|
- requireOrder:res.data.requireOrder
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- fail (res) {
|
|
|
- console.log("checkBeforeAddOrder-fail:",res);
|
|
|
- }
|
|
|
- })
|
|
|
+ //视频号,校验 wx.checkBeforeAddOrder
|
|
|
+ wx.checkBeforeAddOrder({
|
|
|
+ success(res) {
|
|
|
+ console.log("checkBeforeAddOrder-success:", res);
|
|
|
+ if (res.data.errcode == 0) {
|
|
|
+ that.setData({
|
|
|
+ traceId: res.data.traceId,
|
|
|
+ requireOrder: res.data.requireOrder
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ console.log("checkBeforeAddOrder-fail:", res);
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
var date = new Date();
|
|
|
var year = date.getFullYear()
|
|
@@ -1012,75 +1008,78 @@ Page({
|
|
|
let date = e.currentTarget.dataset.date;
|
|
|
let week = e.currentTarget.dataset.week;
|
|
|
let isbook = e.currentTarget.dataset.isbook;
|
|
|
- console.info("dateCheck:" + index);
|
|
|
- this.setData({
|
|
|
- dateIndex: index
|
|
|
- });
|
|
|
- let period=this.data.dateList[this.data.dateIndex].period;
|
|
|
- let current=(this.data.noonType==1?'上午':'下午');
|
|
|
- let list=period.filter(item=>{
|
|
|
- return item.ofTime==current;
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- timeList:list
|
|
|
- });
|
|
|
- let isNoTime=list.every(item=>{
|
|
|
- return item.timeMsg&&item.timeMsg!=null;
|
|
|
- });
|
|
|
- if(isNoTime){
|
|
|
- this.setData({
|
|
|
- timeIndex:-1,
|
|
|
- selectTimeValue:''
|
|
|
- });
|
|
|
- }
|
|
|
- // if (this.data.checkedGoodsList[0].goodsId == 1190332) {
|
|
|
- // this.setData({
|
|
|
- // dateIndex: index
|
|
|
- // });
|
|
|
- // } else if (isbook) { //前三天不可预约
|
|
|
- // this.setData({
|
|
|
- // dateIndex: index
|
|
|
- // });
|
|
|
- // this.getDayStock();
|
|
|
- // }
|
|
|
- },
|
|
|
- noonTab(e) {
|
|
|
+ console.info("dateCheck:" + index);
|
|
|
+ this.setData({
|
|
|
+ dateIndex: index
|
|
|
+ });
|
|
|
+ let period = this.data.dateList[this.data.dateIndex].period;
|
|
|
+ let current = (this.data.noonType == 1 ? '上午' : '下午');
|
|
|
+ let list = period.filter(item => {
|
|
|
+ return item.ofTime == current;
|
|
|
+ });
|
|
|
+ let bookdate = this.data.dateList[this.data.dateIndex].bookdate
|
|
|
+ let weekOfDay = this.data.dateList[this.data.dateIndex].weekOfDay
|
|
|
+ this.setData({
|
|
|
+ timeList: list,
|
|
|
+ date: bookdate,
|
|
|
+ week: weekOfDay
|
|
|
+ });
|
|
|
+ let isNoTime = list.every(item => {
|
|
|
+ return item.timeMsg && item.timeMsg != null;
|
|
|
+ });
|
|
|
+ if (isNoTime) {
|
|
|
+ this.setData({
|
|
|
+ timeIndex: -1,
|
|
|
+ selectTimeValue: ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ noonTab(e) {
|
|
|
let noon = e.currentTarget.dataset.noon;
|
|
|
|
|
|
this.setData({
|
|
|
timeIndex: -1,
|
|
|
- noonType: noon,
|
|
|
- selectTimeValue:'',
|
|
|
- });
|
|
|
- let period=this.data.dateList[this.data.dateIndex].period;
|
|
|
- let current=(this.data.noonType==1?'上午':'下午');
|
|
|
- let list=period.filter(item=>{
|
|
|
- return item.ofTime==current;
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- timeList:list
|
|
|
- });
|
|
|
+ noonType: noon,
|
|
|
+ selectTimeValue: '',
|
|
|
+ });
|
|
|
+ let period = this.data.dateList[this.data.dateIndex].period;
|
|
|
+ let current = (this.data.noonType == 1 ? '上午' : '下午');
|
|
|
+ let list = period.filter(item => {
|
|
|
+ return item.ofTime == current;
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ timeList: list
|
|
|
+ });
|
|
|
|
|
|
|
|
|
},
|
|
|
timeCheck(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
- // let stock = e.currentTarget.dataset.stock;
|
|
|
- let msg=e.currentTarget.dataset.msg;
|
|
|
- if (msg==null||msg=='') {
|
|
|
- let time= (this.data.timeList[index].begin).split(':')[0];
|
|
|
- this.setData({
|
|
|
- timeIndex: index,
|
|
|
- selectTimeValue: Number(time)
|
|
|
- });
|
|
|
+ let toastMsg = e.currentTarget.dataset.toastmsg;
|
|
|
+ let msg = e.currentTarget.dataset.msg;
|
|
|
+ if (msg == null || msg == '') {
|
|
|
+ let time = (this.data.timeList[index].begin).split(':')[0];
|
|
|
+ let bookTime = this.data.timeList[index].begin + '-' + this.data.timeList[index].end
|
|
|
+ this.setData({
|
|
|
+ timeIndex: index,
|
|
|
+ selectTimeValue: Number(time),
|
|
|
+ time: bookTime
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: toastMsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
},
|
|
|
weekCheck(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
+ let weekday = e.currentTarget.dataset.weekday;
|
|
|
+ console.log("weekday", weekday);
|
|
|
this.setData({
|
|
|
weekIndex: index,
|
|
|
- // selectTimeIndex:'null'
|
|
|
+ weekday: weekday
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -1094,6 +1093,7 @@ Page({
|
|
|
});
|
|
|
this.setData({
|
|
|
weekArrList: weekList,
|
|
|
+ selecttime: time
|
|
|
});
|
|
|
let itemData = "weekArrList[" + this.data.weekIndex + "].num";
|
|
|
let selectedDateList = [];
|
|
@@ -1103,14 +1103,14 @@ Page({
|
|
|
weekStr: this.data.weekArrList[this.data.weekIndex].week
|
|
|
};
|
|
|
selectedDateList.push(dateItem);
|
|
|
- console.log(this.data);
|
|
|
+ // console.log(this.data);
|
|
|
this.setData({
|
|
|
selectTimeIndex: index,
|
|
|
[itemData]: 1,
|
|
|
selectedWeekList: [this.data.weekIndex],
|
|
|
selectedDateList: selectedDateList
|
|
|
});
|
|
|
- console.log(this.data);
|
|
|
+ console.log("111",this.data.selectedDateList);
|
|
|
} else {
|
|
|
|
|
|
// 如果选中的时间段小于2个
|
|
@@ -1128,12 +1128,14 @@ Page({
|
|
|
selectedWeekList.push(this.data.weekIndex);
|
|
|
}
|
|
|
this.setData({
|
|
|
+ selecttime: time,
|
|
|
[itemData]: num + 1,
|
|
|
selectTimeIndex: index,
|
|
|
// selectedWeekList:selectedWeekList,
|
|
|
selectedWeekList: [this.data.weekIndex],
|
|
|
selectedDateList: selectedDateList
|
|
|
});
|
|
|
+ console.log("222",this.data.selectedDateList);
|
|
|
} else {
|
|
|
// 删除第一个
|
|
|
let firstTimeSelected = this.data.selectedDateList[0];
|
|
@@ -1146,6 +1148,7 @@ Page({
|
|
|
selectedDateListDel.shift();
|
|
|
|
|
|
this.setData({
|
|
|
+ selecttime: time,
|
|
|
[itemDataDel]: numDel - 1,
|
|
|
// selectTimeIndex:index,
|
|
|
selectedDateList: selectedDateListDel
|
|
@@ -1177,9 +1180,9 @@ Page({
|
|
|
this.setData({
|
|
|
selectedWeekList: weekListNew,
|
|
|
});
|
|
|
-
|
|
|
+ console.log("333",this.data.selectedDateList);
|
|
|
}
|
|
|
- console.log(this.data);
|
|
|
+ // console.log(this.data);
|
|
|
}
|
|
|
|
|
|
},
|
|
@@ -1194,6 +1197,20 @@ Page({
|
|
|
weekList.forEach(item => {
|
|
|
item.num = 0;
|
|
|
});
|
|
|
+ if (e.detail.name == '1') {
|
|
|
+ this.setData({
|
|
|
+ selectweek: '一周1次'
|
|
|
+ })
|
|
|
+ } else if (e.detail.name == '2') {
|
|
|
+ this.setData({
|
|
|
+ selectweek: '一周2次'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ selectweek: '两周1次'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log("selectweek", this.data.selectweek);
|
|
|
this.setData({
|
|
|
weekArrList: weekList,
|
|
|
activeTab: e.detail.name,
|
|
@@ -1214,32 +1231,14 @@ Page({
|
|
|
isFinishAppoint: false
|
|
|
});
|
|
|
if (this.data.popupType == '1') {
|
|
|
-
|
|
|
- // let index = 2;
|
|
|
- // let length = this.data.dateList.length;
|
|
|
- // let list = this.data.dateList;
|
|
|
- // for (let i = 0; i < length; i++) {
|
|
|
- // if (i < 7 && i >= 2 && list[i].week != '周六' && list[i].week != '周日') {
|
|
|
- // index = i;
|
|
|
- // break;
|
|
|
-
|
|
|
- // }
|
|
|
- // }
|
|
|
- // console.log(index);
|
|
|
- // this.setData({
|
|
|
- // dateIndex: index
|
|
|
- // })
|
|
|
-
|
|
|
- // 获取时间段
|
|
|
- // this.getDayStock();
|
|
|
- this.getDayTime();
|
|
|
+ this.getDayTime();
|
|
|
}
|
|
|
},
|
|
|
confirmTime() {
|
|
|
console.log(this.data.activeTab);
|
|
|
console.log(this.data);
|
|
|
if (this.data.popupType == 1) {
|
|
|
- if (this.data.timeIndex === ''||this.data.timeIndex<0) {
|
|
|
+ if (this.data.timeIndex === '' || this.data.timeIndex < 0) {
|
|
|
wx.showToast({
|
|
|
title: '请选择服务时间',
|
|
|
icon: 'none',
|
|
@@ -1250,7 +1249,7 @@ Page({
|
|
|
|
|
|
let date = this.data.dateList[this.data.dateIndex].bookdate;
|
|
|
let week = this.data.dateList[this.data.dateIndex].weekOfDay;
|
|
|
- let time = this.data.timeList[this.data.timeIndex].begin+'-'+this.data.timeList[this.data.timeIndex].end;
|
|
|
+ let time = this.data.timeList[this.data.timeIndex].begin + '-' + this.data.timeList[this.data.timeIndex].end;
|
|
|
console.log(week, time);
|
|
|
this.setData({
|
|
|
oneTimeAppoint: date + ' ' + week + ' ' + time,
|
|
@@ -1325,17 +1324,8 @@ Page({
|
|
|
remarkDisable: false,
|
|
|
isFinishAppoint: true,
|
|
|
popupType: 2,
|
|
|
- // noSerTimes: res.data,
|
|
|
- // appointFailTip: (res.data >= 1 ? true : false)
|
|
|
});
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- // this.setData({
|
|
|
- // choosePopup:false,
|
|
|
- // isFinishAppoint:true
|
|
|
- // });
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
orderAppoint() {
|
|
@@ -1373,8 +1363,6 @@ Page({
|
|
|
remarkDisable: false,
|
|
|
isFinishAppoint: true,
|
|
|
popupType: 2,
|
|
|
- // noSerTimes: res.data,
|
|
|
- // appointFailTip: (res.data >= 1 ? true : false)
|
|
|
});
|
|
|
|
|
|
} else {
|
|
@@ -1461,9 +1449,9 @@ Page({
|
|
|
day: this.data.dateList[this.data.dateIndex].date,
|
|
|
goodsId: this.data.checkedGoodsList[0].goodsId,
|
|
|
lng: this.data.checkedAddress.lng,
|
|
|
- lat: this.data.checkedAddress.lat,
|
|
|
- productId:this.data.checkedGoodsList[0].product.id,
|
|
|
- serviceDuration:this.data.serviceDuration
|
|
|
+ lat: this.data.checkedAddress.lat,
|
|
|
+ productId: this.data.checkedGoodsList[0].product.id,
|
|
|
+ serviceDuration: this.data.serviceDuration
|
|
|
}
|
|
|
wx.showLoading({
|
|
|
title: '加载中',
|
|
@@ -1477,19 +1465,6 @@ Page({
|
|
|
timeIndex: 0
|
|
|
|
|
|
});
|
|
|
- // let validList = this.data.timeList.filter(item => {
|
|
|
- // return item.stock > 0
|
|
|
- // });
|
|
|
- // if (validList.length > 0) {
|
|
|
- // this.setData({
|
|
|
- // timeIndex: validList[0].id - 1
|
|
|
- // });
|
|
|
-
|
|
|
- // } else {
|
|
|
- // this.setData({
|
|
|
- // timeIndex: ''
|
|
|
- // });
|
|
|
- // }
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1517,13 +1492,13 @@ Page({
|
|
|
});
|
|
|
|
|
|
});
|
|
|
- },
|
|
|
- getDayTime() {
|
|
|
+ },
|
|
|
+ getDayTime() {
|
|
|
|
|
|
let params = {
|
|
|
- days:30,
|
|
|
+ days: 30,
|
|
|
productId: this.data.checkedGoodsList[0].productId,
|
|
|
- serviceDuration:this.data.serviceDuration
|
|
|
+ serviceDuration: this.data.serviceDuration
|
|
|
}
|
|
|
wx.showLoading({
|
|
|
title: '加载中',
|
|
@@ -1533,18 +1508,18 @@ Page({
|
|
|
wx.hideLoading();
|
|
|
if (res.errno == 0) {
|
|
|
this.setData({
|
|
|
- dateList: res.data,
|
|
|
- dateIndex:0,
|
|
|
- timeIndex: -1,
|
|
|
- noonType:1
|
|
|
- });
|
|
|
- let period=res.data[0].period;
|
|
|
- let list=period.filter(item=>{
|
|
|
- return item.ofTime=='上午';
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- timeList:list
|
|
|
- });
|
|
|
+ dateList: res.data,
|
|
|
+ dateIndex: 0,
|
|
|
+ timeIndex: -1,
|
|
|
+ noonType: 1
|
|
|
+ });
|
|
|
+ let period = res.data[0].period;
|
|
|
+ let list = period.filter(item => {
|
|
|
+ return item.ofTime == '上午';
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ timeList: list
|
|
|
+ });
|
|
|
|
|
|
|
|
|
} else {
|
|
@@ -1580,4 +1555,4 @@ Page({
|
|
|
|
|
|
|
|
|
|
|
|
-});
|
|
|
+});
|