<template>

	<view class="container">
		<view class="address-box" v-if="checkedAddress.id > 0 || isNeedAppoint">
			<view class="address-item" @tap="selectAddress" v-if="checkedAddress.id > 0">
				<image class="map-icon" mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-dy/order-map.png">
				</image>
				<view class="m">
					<text class="address">{{ checkedAddress.addressDetail }}</text>
					<view class="address-bottom">
						<text class="user-name">{{ checkedAddress.name }}
							{{ formatGender(checkedAddress.gender) }}</text>
						<text>{{ checkedAddress.tel }}</text>
					</view>
				</view>
				<view class="r">
					<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-dy/order-arrow.png"></image>

				</view>
			</view>
			<view class="address-item address-empty" v-else @tap="selectAddress">
				<view class="m">还没有服务地址，去添加</view>
				<view class="r">

				</view>
			</view>
		</view>



		<view class="order-box" v-if="couponId == 24">
			<view class="order-item no-border">
				<view class="l">
					<text class="name">预约时间</text>
				</view>
				<view class="r">
					<picker mode="multiSelector" @change="bindMultiPickerChange"
						@columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray">
						<text class="message-app txt">{{ orderData }}</text>
					</picker>
				</view>
			</view>
		</view>

		<view class="appoint-time-block appoint-block" @tap="showAppoint">
			<view class="title"><text>*</text>上门时段</view>
			<view class="appoint-time" v-if="appointDate==''">服务者将在此时段内上门</view>
			<view class="appoint-timed" v-else>{{appointDate}}</view>
			<image src="https://jzmall.lifejingzhi.com/file/wx-dy/order-arrow.png" mode="aspectFit" class="arrow-img">
			</image>
		</view>
	<view class="goods-items">

			<view class="item">

				<view style="display: flex; align-items: center; padding-bottom: 10rpx; border-bottom: 1px solid #efefef;">
					<view style="margin-right: 10rpx">鲸致生活</view>
					<view style="font-size: 11px">家政·保洁·家电蒸洗·擦窗·开荒·保姆·收纳·搬家·月嫂</view>
				</view>
				<view style="display: flex; padding-top: 10rpx">
					<view class="img">
						<image :src="checkedGoods.picUrl" mode="aspectFill"></image>
					</view>
					<view class="info">
						<view class="name">{{ checkedGoods.name }}</view>
						<view class="m" style="margin-bottom: 20rpx">为更好的服务体验，建议提前1天预约！</view>
						<view class="m">服务次数:{{ checkedGoods.serviceTimes }}</view>

					</view>
				</view>
			</view>
			<view style="display: flex; justify-content: flex-end; margin-bottom: 10px">
				<text
					style="text-decoration-line: line-through; font-size: 13px; color: #666666">¥{{ checkedGoods.counterPrice }}</text>
			</view>
			<view class="goods-total">
				<view>小计：</view>
				<view class="amount">¥{{ goodsTotalPrice }}</view>
			</view>
		</view>

		<view class="order-box">
			<view class="order-item no-border">
				<view class="l">
					<text class="name">购买份数</text>
				</view>
				<view class="r">
					<text class="txt">共1件</text>
				</view>
			</view>
			<view class="order-item no-border">
				<view class="l" style="align-items: center">
					<image src="https://mall.zhaijieshi.cc/file/jzmall/storage/r6i41p5mbm9fxh5i1jyv.png"
						style="height: 25rpx; width: 25rpx" mode="aspectFill"></image>
					<text class="name" style="margin-left: 10rpx">优惠</text>
				</view>
			</view>
			<view class="order-item no-border">
				<view class="l">
					<text class="name" style="color: #999" v-if="availableCouponLength == 0">暂无可用优惠</text>
					<text class="name" style="color: rgb(130 28 28)" v-else>有可用优惠</text>
				</view>
				<view class="r" @tap="selectCoupon">
					<text class="txt" style="color: #999" v-if="availableCouponLength == 0">0张</text>
					<text class="txt" style="color: rgb(130 28 28)" v-else>{{ availableCouponLength }}张</text>
					<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-dy/order-arrow.png"
						style="width: 7px; height: 12px; margin-left: 3px"></image>
				</view>
			</view>
			<view class="discount-line">
				<view class="l">
					<text class="name">已选择</text>
					<text class="txt">-￥{{ couponPrice }}</text>
				</view>
			</view>
		</view> 


	<view class="go-pay-wrapper" @tap="submitOrder">
			<view class="btn-left">
				<text class="num">共1件</text>
				<text class="total">合计：</text>
				<text class="rmb">¥</text>
				<text class="price">{{ actualPrice }}</text>
			</view>
			<view class="btn-right">提交订单</view>
		</view> 
		
		<view class="appoint-overlay-wrapper" v-if="choosePopup" @tap="onClose"></view>
		<view class="popup-wrapper popup-wrapper-special" v-if="choosePopup">

			<view class="popup-title popup-title-special popup-title-new">
				<view>选择服务开始时间</view>
				<view v-if="selectTimeValue>=17" class="fee-tips">您选的时间段可能会加收夜间服务费，具体以与商家的沟通为准</view>

			</view>

			<block>
				<view class="popup-content popup-content-special">
					<view class="time-select-left">
						<view v-for="(item,index) in dateList" :key="index" class="time-select-left-item"
							@tap="dateCheck" :data-index="index" :data-week="item.week" :data-date="item.date"
							:data-isbook="item.isBook">
							<view class="date-line-wrapper">
								<view :class="dateIndex==index?'current-date':''">
									{{item.bookdate+' '+item.weekOfDay}}
								</view>
								<view>
									<text v-if="index<=1" class="date-tag">{{index==0?'今天':'明天'}}</text>

								</view>
							</view>
							<view :class="'date-msg '+(item.dateMsg=='可约'?'avail-date':'')">{{item.dateMsg}}</view>

						</view>
					</view>
					<view class="time-select-right">
						<view class="noon-select">
							<view :class="'noon-item '+(noonType=='1'?'active-noon':'')" data-noon="1" @tap="noonTab">上午
							</view>
							<view :class="'noon-item '+(noonType=='2'?'active-noon':'')" data-noon="2" @tap="noonTab">下午
							</view>
						</view>
						<view class="time-item-wrapper">
							<view v-for="(item,index) in timeList" :key="item.id"
								:class="'time-select-right-item '+(item.timeMsg?'invalid-time':'')" @tap="timeCheck"
								:data-stock="item.stock" :data-index="index" :data-msg="item.timeMsg">

								<view class="time-line">
									<text :class="timeIndex===index?'current-date':''">{{item.begin}} </text>

									<text v-if="selectTimeValue>=17&&timeIndex==index&&(!item.timeMsg)"
										class="extra-tips">收夜间服务费</text>
									<text v-if="timeIndex===index" class="date-tag">已选</text>
									<view v-if="item.timeMsg&&item.timeMsg!=null" class="time-msg">
										{{item.timeMsg}}
									</view>

								</view>

							</view>
						</view>
					</view>
				</view>
			</block>
			<view class="popup-btn-wrapper">
				<view @tap="confirmTime" class="confirm-btn">确定</view>
			</view>



		</view>

		<view class="appoint-overlay-wrapper" v-if="payFailShow"></view>
		<view class="overlay-wrapper" v-if="payFailShow">
			<view class="fail-wrapper">
				<view class="fail-top">
					<image src="/static/images/new/icon-fail.png"></image>
					<view class="fail-text">支付失败</view>
					<view class="sub-color">支付遇到问题，请尝试重新支付</view>
				</view>
				<view class="fail-bottom">
					<view class="cancel-btn" @tap="cancelPay">取消</view>
					<view class="btn-devide"></view>
					<view class="repay-btn" @tap="rePay">重新支付</view>
				</view>
			</view>
		</view>
		<view class="appoint-overlay-wrapper" v-if="remarkShow" @tap="onRemarkClose"></view>
		<view class="remark-popup" v-if="remarkShow">
			<view class="title">订单备注</view>
			<textarea @input="bindMessageInput" placeholder="请输入订单备注信息" :value="message"
				placeholder-style="font-size:26rpx;color:#666;" maxlength="200" class="remark-textarea"></textarea>
			<view class="btn" @tap="confirmRemark">确定</view>
		</view>

		<view class="login-out-wrapper" v-if="tipShow">
			<view class="login-out-tip">
				<image class="tip-img" mode="aspectFit" src="/static/images/tipsFail.png"></image>
				<view class="tips">{{ tips }}</view>
				<view class="select-wrapper">
					<view class="cancel" @tap="cancelTipShow">确定</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	var util = require('../../utils/util.js');
	var user = require('../../utils/user.js');
	var api = require('../../config/api.js');
	var check = require('../../utils/check.js');
	var app = getApp();
	export default {
		data() {
			return {
				productId: '',
				unitIncreaseNumber: '',
				callbackUrl: '',
				remarkShow: false,
				isRecommend: false,
				isNoMatch: true,
				codeShow: false,
				recCode: '',
				recommendTips: '',
				goodsList: [],

				//支付使用参数
				skuList: [],

				payment: '',
				orderId: '',
				outOrderNo: '',
				memberDiscount: '',
				isMember: false,
				payFailShow: false,
				choosePopup: false,
				noSerTimes: '',
				popupType: 1,

				//1单次预约 2 选择服务频次 3选择首次预约时间
				// timeList: check.getTimeList(1),
				// timeList: [],

				// dateList: util.getDateList(new Date(new Date().getTime() + 3600000 * 24 * 0), 1, 30),

				// firstAppointList:util.getDateList(new Date(new Date().getTime()+60*60*1000*24),7),
				firstAppointList: [],


				//单次预约选中的日期
				firstDateIndex: 0,

				//首次预约时间
				activeTab: 1,

				//频次
				weekIndex: 0,

				//选中的周几
				weekArrList: [{
						id: 1,
						week: '周一',
						num: 0
					},
					{
						id: 2,
						week: '周二',
						num: 0
					},
					{
						id: 3,
						week: '周三',
						num: 0
					},
					{
						id: 4,
						week: '周四',
						num: 0
					},
					{
						id: 5,
						week: '周五',
						num: 0
					},
					{
						id: 6,
						week: '周六',
						num: 0
					},
					{
						id: 0,
						week: '周日',
						num: 0
					}
				],

				selectedWeekList: [],
				selectedDateList: [],
				selectTimeIndex: 'null',

				//选中的时间段
				oneTimeAppoint: '2021-04-22 周一 13:00-14:00',

				isNeedAppoint: false,

				//是否需要预约
				isFinishAppoint: false,

				//已选择预约
				isOneAppoint: true,

				//单次卡
				appointFailTip: false,

				//预约失败提示
				bookStartDate: '',

				//可预约时间段
				bookEndDate: '',

				multiIndex: [0, 0, 0, 0, 0, 0],
				multiArray: [],
				array: [],
				year: '',
				month: '',
				day: '',
				startHour: '',
				endHour: '',
				orderData: '',

				//此时间为预计上门时间
				checkedGoodsList: [],

				checkedGoods: {
					picUrl: '',
					name: '',
					serviceTimes: '',
					counterPrice: ''
				},

				checkedAddress: {
					id: 0,
					addressDetail: '',
					name: '',
					tel: ''
				},

				goodsId: '',
				availableCouponLength: 0,

				// 可用的优惠券数量
				goodsTotalPrice: 0,

				//商品总价
				freightPrice: 0,

				//快递费
				couponPrice: 0,

				//优惠券的价格
				grouponPrice: 0,

				//团购优惠价格
				orderTotalPrice: 0,

				//订单总价
				actualPrice: 0,

				//实际需要支付的总价
				cartId: 0,

				addressId: 0,
				couponId: 0,
				userCouponId: 0,
				message: '',
				grouponLinkId: 0,

				//参与的团购
				grouponRulesId: 0,

				mobile: '',

				//预约手机号
				shareId: 0,

				userInfo: {},
				remarkDisable: false,
				code: '',
				city: '',

				//所在位置 根据ip获得
				isCity: true,

				//是否业务城市
				openId: '',

				tipShow: false,
				tips: '',
				timeList: [],
				dateList: [],
				timeIndex: '',
				//选中的时间段
				dateIndex: 0, //选中的日期
				appointDate: '', //显示信息
				noonType: 1,
				selectTimeValue: '',
			};
		},
		onReady: function() {
			// 页面渲染完成
		},
		onShow: function() {
			//console.log(this.data.dateList);
			let that = this;
			// 页面显示
			user.checkLogin()
				.then((res) => {
					app.globalData.hasLogin = true;
					console.info('session 未过期');
				})
				.catch(() => {
					console.info('session 过期');
					app.globalData.hasLogin = false;
					// wx.navigateTo({
					//   url: '/pages/auth/login/login'
					// });
					user.login().then((res) => {
						that.setData({
							code: res.code
						});
					});
				});
			uni.showLoading({
				title: '加载中...'
			});
			try {
				var cartId = uni.getStorageSync('cartId');
				if (cartId === '') {
					cartId = 0;
				}
				var addressId = uni.getStorageSync('addressId');
				if (addressId === '') {
					addressId = 0;
				}
				var couponId = uni.getStorageSync('couponId');
				if (couponId === '') {
					couponId = 0;
				}
				var userCouponId = uni.getStorageSync('userCouponId');
				if (userCouponId === '') {
					userCouponId = 0;
				}
				var grouponRulesId = uni.getStorageSync('grouponRulesId');
				if (grouponRulesId === '') {
					grouponRulesId = 0;
				}
				var grouponLinkId = uni.getStorageSync('grouponLinkId');
				if (grouponLinkId === '') {
					grouponLinkId = 0;
				}
				var goodsId = uni.getStorageSync('goodsId');
				if (goodsId === '') {
					goodsId = 0;
				}
				var openId = uni.getStorageSync('openId');
				if (openId === '') {
					openId = '';
				}
				console.info(openId);
				this.setData({
					cartId: cartId,
					addressId: addressId,
					couponId: couponId,
					userCouponId: userCouponId,
					grouponRulesId: grouponRulesId,
					grouponLinkId: grouponLinkId,
					goodsId: goodsId,
					openId: openId
				});
				this.getCheckoutInfo();
			} catch (e) {
				console.log('CatchClause', e);
				console.log('CatchClause', e);
				// Do something when catch error
				console.log(e);
			}
		},
		onHide: function() {
			// 页面隐藏
		},
		onUnload: function() {
			// 页面关闭
			//清空宠物保险的缓存数据
			console.info('checkout onload');
			//wx.setStorageSync('petinfo'+this.data.cartId, null);
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			console.log(options);
			if (options.productId) {
				this.setData({
					productId: options.productId,
					unitIncreaseNumber: options.unitIncreaseNumber
				});
			}

			let userInfo = uni.getStorageSync('userInfo');
			if (userInfo) {
				this.setData({
					userInfo: userInfo
				});
			}
			let that = this;
			if (options.nurseId) {
				this.setData({
					nurseId: options.nurseId
				});
			}
			if (typeof options.shareId != 'undefined' && options.shareId > 0) {
				that.setData({
					shareId: options.shareId
				});
			}
			var date = new Date();
			var year = date.getFullYear();
			var month = date.getMonth() + 1;
			var day = date.getDate();
			var hour = date.getHours();
			var surplusMonth = that.surplusMonth(year);
			//console.log(surplusMonth);
			var surplusDay = this.surplusDay(year, month, day);
			//console.log(surplusDay);
			var surplusHour = this.surplusHour(year, month, day, hour);
			//console.log(surplusHour);

			//初始化picker
			that.setData({
				multiArray: [
					[year + '年', year + 1 + '年', year + 2 + '年'], surplusMonth, surplusDay, surplusHour[0],
					['~'], surplusHour[1]
				],
				year: year,
				month: month,
				day: day,
				startHour: surplusHour[0][0],
				endHour: surplusHour[1][0]
			});
		},
		methods: {
			//获取checkou信息(买约一体)
			getCheckoutInfo: function() {
				let that = this;
				util.request(api.CartCheckout, {
					cartId: that.cartId,
					addressId: that.addressId,
					couponId: that.couponId,
					userCouponId: that.userCouponId,
					grouponRulesId: that.grouponRulesId,
					shareId: that.shareId,
					goodsId: that.goodsId,
					openId: that.openId,
					productId: that.productId,
					unitIncreaseNumber: that.unitIncreaseNumber,

				}).then(function(res) {
					uni.hideLoading();
					if (res.errno === 0) {
						that.setData({
							isRecommend: res.data.checkedGoods.attribute != 1,
							isMember: res.data.isMember,
							memberDiscount: res.data.memberDiscount,
							checkedGoods: res.data.checkedGoods,
							checkedAddress: res.data.checkedAddress,
							availableCouponLength: res.data.availableCouponLength,
							actualPrice: res.data.actualPrice,
							couponPrice: res.data.couponPrice,
							grouponPrice: res.data.grouponPrice,
							freightPrice: res.data.freightPrice,
							goodsTotalPrice: res.data.goodsTotalPrice,
							orderTotalPrice: res.data.orderTotalPrice,
							addressId: res.data.addressId,
							couponId: res.data.couponId,
							userCouponId: res.data.userCouponId,
							grouponRulesId: res.data.grouponRulesId,
							isNeedAppoint: res.data.checkedGoods.type === 0 ? true : false,
							//0需要预约 服务类商品，1保险 2中介 3买约分离次卡
							isOneAppoint: res.data.checkedGoods.serviceTimes == 1 ? true : false,
							//1为单次，其余为多次
							popupType: res.data.checkedGoods.serviceTimes == 1 ? 1 : 2,
							bookStartDate: res.data.bookStartDate,
							bookEndDate: res.data.bookEndDate,
							city: res.data.city,
							isCity: res.data.isCity,
							mobile: res.data.mobile
						});
						let serviceDuration = res.data.checkedGoods.serviceDuration;
						if (that.popupType == 2) {
							let timeList = [];
							if (res.data.timeRange != null && res.data.timeRange.length > 0) {
								res.data.timeRange.forEach((time, index) => {
									timeList.push({
										id: index + 1,
										time: time
									});
								});
							} else {
								timeList = check.getTimeList(serviceDuration);
							}
							that.setData({
								timeList: timeList
							});
						}
						that.LimitCanAppointmentDate();
						setTimeout(() => {
							if (res.data.isCity == false) {
								that.setData({
									tipShow: true,
									tips: '抱歉，您选择的城市暂无法提供服务'
								});
							}
						}, 1000);
					}else{
					
						        uni.showToast({
						          title: res.errmsg,
						          icon: 'none',
						          duration: 2000
						        });

					}
				});
			},

			showRemark() {
				this.setData({
					remarkShow: true
				});
			},

			onRemarkClose() {
				this.setData({
					remarkShow: false
				});
			},
			formatGender(value) {
				var result = '';
				if (value == 1) {
					result = "先生";
				} else if (value == 2) {
					result = "女士";
				}
				return result;

			},
			confirmRemark() {
				this.setData({
					remarkShow: false
				});
			},

			LimitCanAppointmentDate() {
				//特殊商品 如果需要限制可预约的时间范围 在次方法中实现
				if (this.checkedGoods.id == 1190332) {
					let dates = [];
					this.dateList.forEach((item) => {
						if (item.date < '2022-04-01') {
							dates.push(item);
						}
					});
					this.setData({
						dateList: dates
					});
				}
				//控制可预约时间范围
				let that = this;
				if (that.bookStartDate) {
					let dates = [];
					let dateIndex = -1;
					that.dateList.forEach((item, index) => {
						if (item.date < that.bookStartDate || item.date > that.bookEndDate) {
							item.isBook = false;
							item.mark = '不可约';
						} else {
							//设置第一个可预约的时间index
							if (dateIndex < 0) {
								dateIndex = index;
							}
						}
						dates.push(item);
					});
					that.setData({
						dateList: dates,
						dateIndex: dateIndex
					});
				}
				//console.info(that.data.dateList);
				//console.info(that.data.dateIndex);

				//设置默认起始可预约 index:dateIndex  近7天如果有周六 周日 不允许预约
				//存在一种情况 如果今天是周四，如果起始index=2 则周日允许预约 虽然页面显示为”约满"
				// if(this.data.dateList[3].id==0) {
				//   console.info(" dateIndex:4")
				//   this.setData({
				//     dateIndex:4
				//   })
				// }else{
				//   if(this.data.dateList[2].id==0) {

				//   console.info(" dateIndex:3")
				//     this.setData({
				//       dateIndex:3
				//     })
				//   }
				// }
			},

			selectAddress() {
				uni.navigateTo({
					url: '/pages/ucenter/address/address'
				});
			},

			selectCoupon() {
				uni.navigateTo({
					url: '/pages/ucenter/couponSelect/couponSelect'
				});
			},

			bindMessageInput: function(e) {
				this.setData({
					message: e.detail.value
				});
			},

			bindPhone(e) {
				this.setData({
					mobile: e.detail.value
				});
			},

			cancelTipShow() {
				this.setData({
					tipShow: false
				});
			},

			submitOrder: function() {
				let that = this;
				// if (that.isNeedAppoint && that.addressId <= 0) {
				//     that.setData({
				//         tipShow: true,
				//         tips: '请选择服务地址'
				//     });
				//     return;
				// }
        if (!that.isCity) {
          that.setData({
            tipShow: true,
            tips: '抱歉，您选择的城市暂无法提供服务'
          });
          return;
        }

				if (that.addressId <= 0) {
					util.showErrorToast("请选择服务地址");
					return false;
				}

				if (this.timeIndex === '' || this.timeIndex < 0) {
					util.showErrorToast("请选择服务时间");
					return false;
				}
				// 检查是否已经预约
				// if (that.isNeedAppoint && !that.isFinishAppoint) {
				//     that.setData({
				//         tipShow: true,
				//         tips: '请先预约服务时间'
				//     });
				//     return;
				// }

				// if (!that.isNeedAppoint && (that.mobile == null || that.mobile.length != 11)) {
				//     that.setData({
				//         tipShow: true,
				//         tips: '为了更好地为您服务请填写正确的手机号码'
				//     });
				//     return;
				// }
				
				// #ifdef MP-TOUTIAO
				this.orderPrepay();
				// #endif
					// #ifdef MP-ALIPAY
				this.aliSubmit();
					// #endif
		
			},
			orderPrepay(){
				let that = this;
				uni.showLoading({
					title: '检测中'
				});
				util.request(api.OrderPrepay, {
						addressId: that.addressId,
						shopId: that.checkedAddress.shopId,
						cart: that.cartId,
						goodsId: that.goodsId,
						couponId: that.couponId,
						userCouponId: that.userCouponId,
						productId: that.productId,
						unitIncreaseNumber: that.unitIncreaseNumber,
						openId:that.openId
					})
					.then(function(res) {
						uni.hideLoading();
						if (res.errno === 0) {
							console.log(res);
							that.setData({
								skuList: res.data.skuList,
								payment: res.data.payment,
								callbackUrl: res.data.callbackUrl
							});
							that.submitInfo(res);
							util.addLog(1,2,13);
						} else {
							uni.showModal({
								title: '提醒',
								showCancel: false,
								content: res.errmsg
							});
						}
					})
					.catch((res) => {
						uni.hideLoading();
						util.showErrorToast(res.errmsg);
					});
			},
          aliSubmit(){
			  let that = this;
			  uni.showLoading({
			      title: '加载中'
			  });
			  let date = this.dateList[this.dateIndex].bookdate;
			  let week = this.dateList[this.dateIndex].weekOfDay;
			  let time = this.timeList[this.timeIndex].begin + '-' + this.timeList[this.timeIndex].end;
			  util.request(api.OrderSubmit, {
			    addressId: that.addressId,
			    shopId: that.checkedAddress.shopId,
			    cart: that.cartId,
			    goodsId: that.goodsId,
			    couponId: that.couponId,
			    userCouponId: that.userCouponId,
			    productId: that.productId,
			    unitIncreaseNumber: that.unitIncreaseNumber,
				openId:that.openId,
				  orderDate: {
					 type:0,
					 weeks:[
						 {
							 dayOfWeek: (new Date(this.dateList[this.dateIndex].bookdate)).getDay(),
							 startTime: time.split('-')[0],
							 endTime: time.split('-')[1],
						 }
					 ],
					 startDate: date,
					 lng: this.checkedAddress.lng,
					 lat: this.checkedAddress.lat,
					 shopId: this.checkedAddress.shopId,
					 goodId: this.goodsId,
					 productId: this.productId,
					 unitIncreaseNumber: this.unitIncreaseNumber,
				  
				  },
			  }, 'POST')
			      .then(res=> {
			          if (res.errno === 0) {
						  util.addLog(1,2,13);
			            this.aliPrepay(res.data.orderId);
			          } else {
			              uni.showModal({
			                  title: '提醒',
			                  showCancel: false,
			                  content: res.errmsg
			              });
			          }
			      })
			      .catch((res) => {
			          uni.hideLoading();
			          util.showErrorToast(res.errmsg);
			      });
		  },
		  aliPrepay(orderId){
		  		  uni.showLoading({
		  		      title: '加载中'
		  		  });
		  		  let that=this;
		  		  util.request(api.aliPrepay, {
		       orderId:orderId
		  		  }).then(res=> {
		  		          if (res.errno === 0) {
		  		  			//是否跳转新支付结果页面
		  		  			let goNewPage=res.data.goNewPage;
		  		          
		  		            let tradeNo=res.data.payment.tradeNo;
		  		            let outOrderNo=res.data.payment.outTradeNo;
		  		            
		  		              my.tradePay({
		  		  				  tradeNO:tradeNo,
		  		                  success: (payres) => {
		  							  uni.hideLoading();
				
		  		                      uni.hideLoading();
		  		                      console.log('ali调起支付成功');
		  		                      console.log(payres);
		                           let resultCode=payres.resultCode;
		  							   if(resultCode=='9000'){
										   util.addLog(1,2,15,{
										   	goodsId: this.goodsId,
										   	productId:this.productId
										   });
		  								   //如果是静默状态未登录 开始授权登录
		  								     if (!app.globalData.hasLogin) {
		  								         user.getLoginInfo(outOrderNo).then((resUser) => {
		  								             if (resUser.errno == 0) {
		  								                 app.globalData.hasLogin = true;
		  								                 app.globalData.userInfo = resUser.data.userInfo;
		  								                 uni.setStorageSync('userInfo', resUser.data.userInfo);
		  								                 uni.setStorageSync('token', resUser.data.token);
		  								             }
		  								         });
		  								     }
		  								   if(goNewPage){
		  								   	uni.redirectTo({
		  								   	    url: '/pages/checkout/payResult/payResultNew?status=1&outOrderNo=' + outOrderNo + '&actualPrice=' + that.actualPrice+'&goodsId='+that.id+'&productId='+that.productId
		  								   	});
		  								   }else{
		  								   	uni.redirectTo({
		  								   	    url: '/pages/checkout/payResult/payResult?status=1&outOrderNo=' + outOrderNo + '&actualPrice=' + that.actualPrice+'&goodsId='+that.id
		  								   	});
		  								   }
		  							   }else{
		  								  util.addLog(1,2,14,{
		  								  	goodsId: this.goodsId,
		  								  	productId:this.productId
		  								  });
										  // that.setData({
										  // 	payFailShow: true
										  // });
		  								   uni.showModal({
		  								       title: '提示',
		  								       content: "未支付成功，"+payres.memo,
		  								       showCancel: false,
		  									   success:function(modalres){
		  										   if(modalres.confirm){
		  											   uni.navigateTo({
		  											       url: '/pages/ucenter/orderDetail/orderDetailPay?id=' + outOrderNo
		  											   });
		  										   }
		  										   
		  									   }
		  								   });
		  							   }
		  		                  
		  		                    
		  		                  },
		  		                  fail: (failres) => {
		  							  console.log(failres);
		  		  			
		  		                      uni.hideLoading();
		  		                     
		  		                  }
		  		              });
		  		          } else {
		  					  uni.hideLoading();
		  		              uni.showModal({
		  		                  title: '提醒',
		  		                  showCancel: false,
		  		                  content: res.errmsg
		  		              });
		  		          }
		  		      })
		  		      .catch((res) => {
		  		          uni.hideLoading();
		  		          util.showErrorToast(res.errmsg);
		  		      });
		  },
		  
 
			submitInfo(res) {
				let date = this.dateList[this.dateIndex].bookdate;
				let week = this.dateList[this.dateIndex].weekOfDay;
				let time = this.timeList[this.timeIndex].begin + '-' + this.timeList[this.timeIndex].end;
				let params = {
					weeks: [{
						dayOfWeek: (new Date(this.dateList[this.dateIndex].bookdate)).getDay(),
						startTime: time.split('-')[0],
						endTime: time.split('-')[1],
					}],
					type: 0,
					startDate: date,
					lng: this.checkedAddress.lng,
					lat: this.checkedAddress.lat,
					shopId: this.checkedAddress.shopId,
					goodId:res.data.jzGoodsId,
					productId:res.data.jzProductId,
					unitIncreaseNumber: this.unitIncreaseNumber,
				};
				console.log(params);
				this.orderPay(params);
			},
			orderPay(orderData) {
				util.addLog(1,2,13,{
				goodsId: this.goodsId,
				productId:this.productId
			});
				var callbackData = {
					cartId: this.cartId,
					addressId: this.addressId,
					couponId: this.couponId,
					userCouponId: this.userCouponId,
					message: this.message,
					shareId: this.shareId,
					//预约参数信息
					orderDate: orderData,
					userId: this.userInfo ? this.userInfo.id : '',
					// phone_num: this.mobile,
					city: this.city
				};
				if (this.codeShow && !this.isNoMatch) {
					callbackData.recCode = this.recCode;
				}
				let params = {
					skuList: this.skuList,
					payment: this.payment,
					callbackData: callbackData,
					callbackUrl: this.callbackUrl
				};
				console.log(params);
				uni.showLoading({
					title: '加载中'
				});
				uni.createOrder({
					skuList: this.skuList,
					payment: this.payment,
					callbackData: callbackData,
					callbackUrl: this.callbackUrl,
					success: (res) => {
						util.addLog(1,2,15,{
				goodsId: this.goodsId,
				productId:this.productId
			});
						uni.hideLoading();
						console.log('预下单成功11');
						console.log(res);
						const {
							orderId,
							outOrderNo
						} = res;
						console.log('success res', res);
						console.log('orderId', orderId, 'outOrderNo', outOrderNo);
						this.setData({
							orderId,
							outOrderNo
						});
						console.log(this);
						//如果是静默状态未登录 开始授权登录
						if (!app.globalData.hasLogin) {
							user.getLoginInfo(outOrderNo).then((resUser) => {
								
								console.log(resUser);
								if (resUser.errno == 0) {
									console.log("支付成功后1111",resUser);
									app.globalData.hasLogin = true;
									app.globalData.userInfo = resUser.data.userInfo;
									uni.setStorageSync('userInfo', resUser.data.userInfo);
									uni.setStorageSync('token', resUser.data.token);
								}
							});
						}
						uni.redirectTo({
							url: '/pages/checkout/payResult/payResult?status=1&outOrderNo=' +
								outOrderNo + '&actualPrice=' + this.actualPrice
						});
					},
					fail: (res) => {
						util.addLog(1,2,14,{
				goodsId: this.goodsId,
				productId:this.productId
			});
						uni.hideLoading();
						console.log('预下单失败11');
						console.log('params', params);
						console.log(res);
						const {
							orderId,
							outOrderNo,
							errNo,
							errMsg,
							errLogId
						} = res;
						if (errLogId) {
							console.log('预下单失败', errNo, errMsg, errLogId);
							let tomsg = errMsg;
							if (tomsg.indexOf('createOrder') != -1) {
								tomsg = tomsg.replace('createOrder:fail 开发者限购:', '');
								tomsg = tomsg.replace('createOrder:fail 开发者拒绝交易:', '');
								tomsg = tomsg.replace('createOrder:fail', '');
							}
							uni.showModal({
								title: '提示',
								content: tomsg,
								showCancel: false,
								success(res) {}
							});
						}
						if (orderId || outOrderNo) {
							this.setData({
								orderId,
								outOrderNo
							});
							console.log('支付失败', errNo, errMsg, orderId, outOrderNo);
							this.setData({
								payFailShow: true
							});
							// uni.navigateTo({
							//     url: '/pages/ucenter/orderDetail/orderDetailPay?id=' + outOrderNo
							// });
						}
						console.log(errNo, errMsg);
					}
				});
			},

			surplusMonth: function(year) {
				var date = new Date();
				var year2 = date.getFullYear();
				var month = date.getMonth() + 1;
				var day = date.getDate();
				var hour = date.getHours();
				var minute = date.getMinutes();
				var second = date.getSeconds();
				var monthDatas = [];
				if (year == year2) {
					var surplusMonth = 12 - month;
					monthDatas.push(month + '月');
					for (var i = month; i < 12; i++) {
						monthDatas.push(i + 1 + '月');
					}
				} else {
					for (var i = 0; i < 12; i++) {
						monthDatas.push(i + 1 + '月');
					}
				}
				return monthDatas;
			},

			//天数计算
			surplusDay: function(year, month, day) {
				var days = 31;
				var dayDatas = [];
				var date = new Date();
				var year2 = date.getFullYear();
				var month2 = date.getMonth() + 1;
				switch (parseInt(month)) {
					case 1:
					case 3:
					case 5:
					case 7:
					case 8:
					case 10:
					case 12:
						days = 31;
						break;
						//对于2月份需要判断是否为闰年
					case 2:
						if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
							days = 29;
							break;
						} else {
							days = 28;
							break;
						}
					case 4:
					case 6:
					case 9:
					case 11:
						days = 30;
						break;
				}
				if (year == year2 && month == month2) {
					// dayDatas.push(day + "日")
					for (var i = day; i < days; i++) {
						dayDatas.push(i + 1 + '日');
					}
				} else {
					console.log(month + '月' + days + '天');
					for (var i = 0; i < days; i++) {
						dayDatas.push(i + 1 + '日');
					}
				}
				return dayDatas;
			},

			//时间计算
			surplusHour: function(year, month, day, hour) {
				var date = new Date();
				var year2 = date.getFullYear();
				var month2 = date.getMonth() + 1;
				var day2 = date.getDate();
				var hourEnd = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21];
				var hours = [
					['09时', '10时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时'],
					['10时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时', '21时']
				];
				return hours;
			},

			varietiesChange: function(e) {
				var Varieties = this.array[parseInt(e.detail.value)];
				console.log(Varieties);
				this.setData({
					Varieties: Varieties
				});
			},

			warehouseChange: function(e) {
				var Warehouse = this.array[parseInt(e.detail.value)];
				console.log(Warehouse);
				this.setData({
					Warehouse: Warehouse
				});
			},

			//某一列的值改变时触发
			bindMultiPickerColumnChange: function(e) {
				var date = new Date();
				var year1 = date.getFullYear();
				var month1 = date.getMonth() + 1;
				var day1 = date.getDate();
				var hour1 = date.getHours();
				console.log('当前月份' + this.month + '修改的列为', e.detail.column, '，值为', e.detail.value);
				var data = {
					multiArray: this.multiArray,
					multiIndex: this.multiIndex,
					year: this.year,
					month: this.month,
					day: this.day,
					startHour: this.startHour,
					endHour: this.startHour
				};
				data.multiIndex[e.detail.column] = e.detail.value;
				switch (e.detail.column) {
					case 0:
						var yearStr = data.multiArray[e.detail.column][e.detail.value];
						var year = yearStr.substring(0, yearStr.length - 1);
						data.year = parseInt(year);
						var surplusMonth = this.surplusMonth(year);
						data.multiArray[1] = surplusMonth;
						if (data.year == year1) {
							data.month = month1;
						} else {
							data.month = 1;
						}
						if (data.year == year1 && month1 == data.month) {
							data.day = day1;
						} else {
							data.day = 1;
						}
						var surplusDay = this.surplusDay(data.year, data.month, data.day);
						data.multiArray[2] = surplusDay;
						var surplusHour;
						if (data.year == year1 && month1 == data.month && data.day == day1) {
							surplusHour = this.surplusHour(data.year, data.month, data.day, hour1);
						} else {
							surplusHour = this.surplusHour(data.year, data.month, data.day, 1);
						}
						console.log(surplusHour);
						data.multiArray[3] = surplusHour[0];
						data.multiArray[5] = surplusHour[1];
						data.startHour = surplusHour[0];
						data.endHour = surplusHour[1];
						data.multiIndex[1] = 0;
						data.multiIndex[2] = 0;
						data.multiIndex[3] = 0;
						data.multiIndex[5] = 0;
						break;
					case 1:
						console.log('选择月份' + data.multiArray[e.detail.column][e.detail.value]);
						var monthStr = data.multiArray[e.detail.column][e.detail.value];
						var month = monthStr.substring(0, monthStr.length - 1);
						data.month = month;
						data.day = 1;
						if (data.year == year1 && month1 == data.month) {
							data.day = day1;
						} else {
							data.day = 1;
						}
						var surplusDay = this.surplusDay(data.year, data.month, data.day);
						data.multiArray[2] = surplusDay;
						var surplusHour;
						if (data.year == year1 && month1 == data.month && data.day == day1) {
							surplusHour = this.surplusHour(data.year, data.month, data.day, hour1);
						} else {
							surplusHour = this.surplusHour(data.year, data.month, data.day, 1);
						}
						data.multiArray[3] = surplusHour[0];
						data.multiArray[5] = surplusHour[1];
						data.startHour = surplusHour[0];
						data.endHour = surplusHour[1];
						data.multiIndex[2] = 0;
						data.multiIndex[3] = 0;
						data.multiIndex[5] = 0;
						break;
					case 2:
						console.log('选择日' + data.multiArray[e.detail.column][e.detail.value]);
						var dayStr = data.multiArray[e.detail.column][e.detail.value];
						var day = dayStr.substring(0, dayStr.length - 1);
						data.day = day;
						var surplusHour;
						if (data.year == year1 && month1 == data.month && data.day == day1) {
							surplusHour = this.surplusHour(data.year, data.month, data.day, hour1);
						} else {
							surplusHour = this.surplusHour(data.year, data.month, data.day, 1);
						}
						data.multiArray[3] = surplusHour[0];
						data.multiArray[5] = surplusHour[1];
						data.startHour = surplusHour[0];
						data.endHour = surplusHour[1];
						data.multiIndex[3] = 0;
						data.multiIndex[5] = 0;
						break;
					case 3:
						console.log('起始时间' + data.multiArray[e.detail.column][e.detail.value]);
						var hourStr = data.multiArray[e.detail.column][e.detail.value];
						var hour = hourStr.substring(0, hourStr.length - 1);
						data.startHour = hour;
						console.log('起始时间' + hour + ' day1:' + day1);
						/*var endhours2 = [];  
          var end = ['09时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时', '20时']; 
            for (var i = e.detail.value; i < end.length; i++) { 
               endhours2.push(end[i]); 
            }  
          data.multiArray[5] = endhours2; */
						if (e.detail.value > data.multiIndex[5]) {
							data.multiIndex[5] = e.detail.value;
						}
						break;
					case 5:
						var hourStr = data.multiArray[e.detail.column][e.detail.value];
						var hour = hourStr.substring(0, hourStr.length - 1);
						data.endHour = hour;
						if (e.detail.value < data.multiIndex[3]) {
							data.multiIndex[3] = e.detail.value;
						}
						//console.log('index:'+data.multiIndex[3]+'value:'+e.detail.value+'结束时间' + data.multiArray[e.detail.column][e.detail.value]);
						break;
				}
				this.setData(data);
			},

			//value 改变时触发 change 事件
			bindMultiPickerChange: function(e) {
				console.info(e);
				console.info(this.multiArray);
				console.info(this);
				console.info(this.multiIndex);
				var dateStr =
					this.multiArray[0][this.multiIndex[0]] +
					this.multiArray[1][this.multiIndex[1]] +
					this.multiArray[2][this.multiIndex[2]] +
					this.multiArray[3][this.multiIndex[3]] +
					this.multiArray[4][this.multiIndex[4]] +
					this.multiArray[5][this.multiIndex[5]];
				console.log('picker发送选择改变，携带值为', dateStr);
				this.setData({
					orderData: dateStr
				});
			},

			onClose() {
				this.setData({
					choosePopup: false
					//remarkDisable: false,
				});
			},

			dateCheck(e) {
				let index = e.currentTarget.dataset.index;
				let date = e.currentTarget.dataset.date;
				let week = e.currentTarget.dataset.week;
				let isbook = e.currentTarget.dataset.isbook;
				this.setData({
					dateIndex: index
				});
				let period = this.dateList[this.dateIndex].period;
				let current = (this.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: ''
					});
				}
			},

			timeCheck(e) {
				let index = e.currentTarget.dataset.index;
				let msg = e.currentTarget.dataset.msg;
				if (msg == null || msg == '') {
					let time = (this.timeList[index].begin).split(':')[0];
					this.setData({
						timeIndex: index,
						selectTimeValue: Number(time)
					});
				}
			},

			weekCheck(e) {
				let index = e.currentTarget.dataset.index;
				this.setData({
					weekIndex: index
					// selectTimeIndex:'null'
				});
			},

			timeSelect(e) {
				let index = e.currentTarget.dataset.index;
				let time = e.currentTarget.dataset.time;
				if (this.activeTab != 2) {
					let weekList = this.weekArrList;
					weekList.forEach((item) => {
						item.num = 0;
					});
					this.setData({
						weekArrList: weekList
					});
					let itemData = 'weekArrList[' + this.weekIndex + '].num';
					let selectedDateList = [];
					let dateItem = {
						week: this.weekIndex,
						time: time,
						weekStr: this.weekArrList[this.weekIndex].week
					};
					selectedDateList.push(dateItem);
					console.log(this);
					this.setData({
						selectTimeIndex: index,
						[itemData]: 1,
						selectedWeekList: [this.weekIndex],
						selectedDateList: selectedDateList
					});
					console.log(this);
				} else {
					// 如果选中的时间段小于2个
					if (this.selectedDateList.length < 2) {
						let itemData = 'weekArrList[' + this.weekIndex + '].num';
						let num = this.weekArrList[this.weekIndex].num;
						let selectedDateList = this.selectedDateList;
						selectedDateList.push({
							week: this.weekIndex,
							time: time,
							weekStr: this.weekArrList[this.weekIndex].week
						});
						let selectedWeekList = this.selectedWeekList;
						if (selectedWeekList.indexOf(this.weekIndex) == -1) {
							selectedWeekList.push(this.weekIndex);
						}
						this.setData({
							[itemData]: num + 1,
							selectTimeIndex: index,
							// selectedWeekList:selectedWeekList,
							selectedWeekList: [this.weekIndex],
							selectedDateList: selectedDateList
						});
					} else {
						// 删除第一个
						let firstTimeSelected = this.selectedDateList[0];
						let firstWeekSelectedIndex = firstTimeSelected.week;
						// let firstWeekSelected=this.data.weekArrList[firstWeekSelectedIndex];

						let itemDataDel = 'weekArrList[' + firstWeekSelectedIndex + '].num';
						let numDel = this.weekArrList[firstWeekSelectedIndex].num;
						let selectedDateListDel = this.selectedDateList;
						selectedDateListDel.shift();
						this.setData({
							[itemDataDel]: numDel - 1,
							// selectTimeIndex:index,
							selectedDateList: selectedDateListDel
						});

						// 加入新选中的

						let itemData = 'weekArrList[' + this.weekIndex + '].num';
						let num = this.weekArrList[this.weekIndex].num;
						let selectedDateList = this.selectedDateList;
						selectedDateList.push({
							week: this.weekIndex,
							time: time,
							weekStr: this.weekArrList[this.weekIndex].week
						});
						this.setData({
							[itemData]: num + 1,
							// selectTimeIndex:index,
							selectedDateList: selectedDateList
						});
						let weekListNew = [];
						this.selectedDateList.forEach((item) => {
							if (weekListNew.indexOf(item.week) == -1) {
								weekListNew.push(item.week);
							}
						});
						this.setData({
							selectedWeekList: weekListNew
						});
					}
					console.log(this);
				}
			},

			firstDateCheck(e) {
				let index = e.currentTarget.dataset.index;
				this.setData({
					firstDateIndex: index
				});
			},

			onTabChange(e) {
				let weekList = this.weekArrList;
				weekList.forEach((item) => {
					item.num = 0;
				});
				let tab = e.currentTarget.dataset.tab;
				this.setData({
					weekArrList: weekList,
					activeTab: tab,
					selectTimeIndex: 'null',
					selectedWeekList: [],
					selectedDateList: []
				});
			},

			showAppoint() {
				if (this.addressId == 0) {
					util.showErrorToast("请选择服务地址");
					return false;
				}
				// this.setData({
				//   choosePopup: true,
				//   popupType: this.data.popupType == 3 ? 2 : this.data.popupType,
				//   isFinishAppoint: false
				// });
				// if (this.data.popupType == '1') {

				//   this.getDayStock();
				// }

				if (this.appointDate != '') {
					this.setData({
						choosePopup: true,
					});
					return false;
				} else {
					this.setData({
						choosePopup: true,
						noonType: 1,
						timeIndex: 0
					});

					this.getDayStock();
				}
			},

			confirmTimeOld() {
				console.log(this.activeTab);
				console.log(this);
				if (this.popupType == 1) {
					if (this.timeIndex === '') {
						uni.showToast({
							title: '请选择服务时间',
							icon: 'none',
							duration: 2000
						});
						return false;
					}
					let date = this.dateList[this.dateIndex].date;
					let week = this.dateList[this.dateIndex].week;
					let time = this.timeList[this.timeIndex].time;
					console.log(week, time);
					this.setData({
						oneTimeAppoint: date + ' ' + week + ' ' + time,
						choosePopup: false,
						isFinishAppoint: true
					});
				} else if (this.popupType == 2) {
					if (this.activeTab == 2) {
						if (this.selectedDateList.length < 1) {
							uni.showToast({
								title: '请选择服务时间',
								icon: 'none',
								duration: 2000
							});
						} else if (this.selectedDateList.length == 1) {
							uni.showToast({
								title: '请选择第二次服务时间',
								icon: 'none',
								duration: 2000
							});
						} else {
							// 选择频次
							let futureDateList = util.getDateList(new Date(new Date().getTime() + 3600000 * 24), 1);
							let minIndex = Math.min.apply(null, this.selectedWeekList);
							console.log(minIndex);
							console.log(this.weekArrList[minIndex].id);
							let beginDate = futureDateList.filter((item) => {
								return new Date(item.date).getDay() == this.weekArrList[minIndex].id;
							});
							console.log(beginDate);
							let inter = 7;
							let firstAppointList = util.getDateList(new Date(new Date(beginDate[0].date).getTime()),
								inter);
							this.setData({
								popupType: 3,
								firstAppointList: firstAppointList
							});
						}
					} else {
						if (this.selectedDateList.length == 0) {
							uni.showToast({
								title: '请选择服务时间',
								icon: 'none',
								duration: 2000
							});
						} else {
							//  选择频次
							let futureDateList = util.getDateList(new Date(new Date().getTime() + 3600000 * 24), 1);
							let minIndex = Math.min.apply(null, this.selectedWeekList);
							console.log(minIndex);
							let beginDate = futureDateList.filter((item) => {
								return new Date(item.date).getDay() == this.weekArrList[minIndex].id;
							});
							console.log(beginDate);
							let inter = this.activeTab == 3 ? 14 : 7;
							let firstAppointList = util.getDateList(new Date(new Date(beginDate[0].date).getTime()),
								inter);
							this.setData({
								popupType: 3,
								firstAppointList: firstAppointList
							});
						}
					}
				} else if (this.popupType == 3) {
					let firstTime = this.firstAppointList[this.firstDateIndex].date;
					console.log(firstTime);
					console.log(this.selectedDateList);
					// this.orderAppoint();
					this.setData({
						choosePopup: false,
						isFinishAppoint: true,
						popupType: 2
						// noSerTimes: res.data,
						// appointFailTip: res.data >= 1 ? true : false
					});
					//  this.setData({
					//   choosePopup:false,
					//   isFinishAppoint:true
					//  });
				}
			},

			noonTab(e) {
				let noon = e.currentTarget.dataset.noon;

				this.setData({
					timeIndex: -1,
					noonType: noon,
					selectTimeValue: '',
				});
				let period = this.dateList[this.dateIndex].period;
				let current = (this.noonType == 1 ? '上午' : '下午');
				let list = period.filter(item => {
					return item.ofTime == current;
				});
				this.setData({
					timeList: list
				});
			},
			confirmTime() {
				if (this.timeIndex === '' || this.timeIndex < 0) {
					util.showErrorToast('请选择服务时间');
					return false;
				}
				let date = this.dateList[this.dateIndex].bookdate;
				let week = this.dateList[this.dateIndex].weekOfDay;
				let time = this.timeList[this.timeIndex].begin + '-' + this.timeList[this.timeIndex].end;
				this.setData({
					choosePopup: false,
					appointDate: date + ' ' + week + ' ' + time
				});
			},
			orderAppoint() {
				//   如果是多次卡先预估，单次卡不用预估
				let weeks = [];
				this.selectedDateList.forEach((item) => {
					let obj = {
						dayOfWeek: this.weekArrList[item.week].id,
						startTime: item.time.split('-')[0],
						endTime: item.time.split('-')[1]
					};
					weeks.push(obj);
				});
				let params = {
					weeks: weeks,
					type: this.activeTab,
					startDate: this.firstAppointList[this.firstDateIndex].date,
					lng: this.checkedAddress.lng,
					lat: this.checkedAddress.lat,
					shopId: this.checkedAddress.shopId,
					goodId: this.checkedGoods.id
				};
				uni.showLoading({
					title: '加载中'
				});
				util.request(api.OrderAppoint, params, 'POST')
					.then((res) => {
						uni.hideLoading();
						if (res.errno == 0) {
							// this.orderPay(params);
							this.setData({
								choosePopup: false,
								isFinishAppoint: true,
								popupType: 2
								// noSerTimes: res.data,
								// appointFailTip: res.data >= 1 ? true : false
							});
						} else {
							// util.showErrorToast(res.errmsg);
							uni.showToast({
								title: res.errmsg,
								icon: 'none',
								duration: 2000
							});
						}
					})
					.catch(function(err) {
						console.log(err);
						uni.hideLoading();
						uni.showToast({
							title: err.errMsg,
							icon: 'none'
						});
					});
			},

			cancelPay() {
				this.setData({
					payFailShow: false
				});
				uni.navigateBack({
					delta: 1
				});
			},

			rePay() {
				uni.showLoading({
					title: '支付中'
				});

				// 支付
				uni.continueToPay({
					// orderId: this.data.orderId, // 内部订单号
					outOrderNo: this.outOrderNo,
					// 外部订单号 2个订单号必填一个
					success: (res) => {
						console.log(res);
						const {
							orderId,
							outOrderNo
						} = res;
						console.log('success res', res);
						console.log('orderId', orderId, 'outOrderNo', outOrderNo);
						this.setData({
							payFailShow: false
						});
						uni.redirectTo({
							url: '/pages/checkout/payResult/payResult?status=1&outOrderNo=' +
								outOrderNo + '&orderId=' + orderId + '&actualPrice=' + this.actualPrice
						});
					},
					fail: (res) => {
						console.log(res);
						const {
							orderId,
							outOrderNo,
							errNo,
							errMsg,
							errLogId
						} = res;
						if (errLogId) {
							console.log('查询订单信息失败', errNo, errMsg, errLogId);
						}
						if (orderId || outOrderNo) {
							console.log('支付失败', errNo, errMsg, orderId, outOrderNo);
						}
						util.showErrorToast('支付失败');
					}
				});
			},

			getDayStock() {
				// if (this.dateIndex < 0) {
				//     return false;
				// }
				let params = {
					days: 7,
					goodsId: this.checkedGoods.id,
					serviceDuration: this.checkedGoods.serviceDuration,
					addressId: this.addressId,
					productId: this.productId,

					// lng: this.checkedAddress.lng,
					// lat: this.checkedAddress.lat
				};
				uni.showLoading({
					title: '加载中'
				});
				util.request(api.everyDayTime, params, 'GET')
					.then((res) => {
						uni.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
							});

						} else {
							uni.showToast({
								title: res.errmsg,
								icon: 'none',
								duration: 2000
							});
							this.setData({
								timeList: [],
								timeIndex: ''
							});
						}
					})
					.catch(function(err) {
						console.log(err);
						uni.hideLoading();
						uni.showToast({
							title: err.errMsg,
							icon: 'none'
						});
						this.setData({
							timeList: [],
							timeIndex: ''
						});
					});
			},

			bindCodeInput: function(e) {
				this.setData({
					recCode: e.detail.value
				});
				if (e.detail.value.length == 5) {
					// 校验服务者真实性
					this.recCodeCheck();
					//  this.setData({
					//   codeShow:true
					//  })
				} else {
					this.setData({
						codeShow: false
					});
				}
			},

			recCodeCheck() {
				uni.showLoading({
					title: '加载中'
				});
				util.request(
						api.checkRecommend, {
							recCode: this.recCode
						},
						'GET'
					)
					.then((res) => {
						uni.hideLoading();
						if (res.errno == 0) {
							if (res.data) {
								this.setData({
									codeShow: true,
									isNoMatch: false,
									recommendTips: '推荐人：' + res.data
								});
							} else {
								this.setData({
									codeShow: true,
									isNoMatch: true,
									recommendTips: '未匹配到推荐者，请您和推荐人核对'
								});
							}
						} else {
							this.setData({
								codeShow: false
							});
							uni.showToast({
								title: res.errmsg,
								icon: 'none',
								duration: 2000
							});
						}
					})
					.catch(function(err) {
						uni.hideLoading();
						this.setData({
							codeShow: false
						});
						uni.showToast({
							title: err.errMsg,
							icon: 'none'
						});
					});
			}
		}
	};
</script>
<style>
	page {
		height: 100%;
		background: #f4f4f4;
	}

	.container {
		padding: 50rpx 28rpx 180rpx;
	}

	.address-box {
		width: 100%;
		/* height: 166.55rpx;
  background-size: 62.5rpx 10.5rpx; */
		/* margin-bottom: 20rpx; */
		/* padding-top: 10.5rpx; */
	}

	.address-item {
		display: flex;
		min-height: 136rpx;
		background: #fff;
		padding: 30rpx 20rpx;
		border-radius: 10rpx;
	}

	.address-item.address-empty {
		line-height: 75rpx;
		text-align: center;
	}

	.address-item .map-icon {
		width: 28rpx;
		height: 30rpx;
		margin: 6rpx 10rpx 0 0;
	}

	.address-box .l {
		width: 125rpx;
		height: 100%;
	}

	.address-box .l .name {
		margin-left: 6.25rpx;
		margin-top: -7.25rpx;
		display: block;
		width: 125rpx;
		height: 43rpx;
		line-height: 43rpx;
		font-size: 30rpx;
		color: #333;
		margin-bottom: 5rpx;
	}

	.address-box .l .default {
		margin-left: 6.25rpx;
		display: block;
		width: 62rpx;
		height: 33rpx;
		border-radius: 5rpx;
		border: 1px solid #b4282d;
		font-size: 20.5rpx;
		text-align: center;
		line-height: 29rpx;
		color: #b4282d;
	}

	.address-box .m {
		flex: 1;
	}

	.address-box .mobile {
		display: block;
		height: 29rpx;
		line-height: 29rpx;
		margin-bottom: 6.25rpx;
		font-size: 26rpx;
	}

	.address-box .address {
		display: block;
		/* height: 30rpx; */
		line-height: 32rpx;
		font-size: 30rpx;
		margin: 0 0 16rpx 0;
	}

	.address-bottom {
		color: #999;
		line-height: 28rpx;
		height: 28rpx;
		font-size: 26rpx;
	}

	.address-bottom .user-name {
		margin: 0 32rpx 0 0;
	}

	.address-box .r {
		width: 30rpx;
		height: 90rpx;
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.address-box .r image {
		width: 14rpx;
		height: 24rpx;
	}

	.coupon-box {
		width: 100%;
		height: 210rpx;
		background: #fff;
		border-radius: 10rpx;
	}

	.coupon-box .coupon-item {
		margin: 0 10rpx;
		height: 70rpx;
		overflow: hidden;
		background: #fff;
		display: flex;
		padding: 0 20rpx 0 10rpx;
		align-items: center;
		justify-content: space-between;
		border-bottom: 2rpx solid #E4E4E4;
	}

	.coupon-box .l {
		flex: 1;
		height: 70rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.coupon-box .l .name {
		font-size: 24rpx;
	}

	.coupon-box .l .txt {
		font-size: 24rpx;
	}

	.coupon-box .r {
		width: 30rpx;
		height: 40rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.coupon-box .r image {
		width: 52.078rpx;
		height: 52.078rpx;
	}

	.message-box {
		margin-top: 20rpx;
		width: 100%;
		height: auto;
		overflow: hidden;
		background: #fff;
	}

	.message-box .message-item {
		height: 86.078rpx;
		overflow: hidden;
		background: #fff;
		display: flex;
		margin-left: 31.25rpx;
		padding-right: 31.25rpx;
	}


	.message-box .message-app {
		height: 74.078rpx;
		overflow: hidden;
		background: #fff;
		display: flex;
		margin-left: 31.25rpx;
		padding-right: 31.25rpx;
		padding-top: 18rpx;
		border-radius: 20rpx;
	}

	.order-box {
		margin-top: 20rpx;
		width: 100%;
		height: auto;
		overflow: hidden;
		background: #fff;
		border-radius: 10rpx;
	}

	.order-box .order-item {
		height: 90rpx;
		overflow: hidden;
		background: #fff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 20rpx;
		border-bottom: 1px solid #d9d9d9;
	}

	.order-box .order-item.tip-item {
		padding-bottom: 26rpx;
		height: auto;
		display: flex;
		flex-direction: column;
	}

	.order-box .order-item .l {
		/* width:100rpx; */
		height: 82rpx;
		line-height: 82rpx;
		align-items: center;
	}

	.order-box .order-item .l .name {
		font-size: 30rpx;
		color: #333;
	}

	.order-box .order-item .r {
		line-height: 82rpx;
		flex: 1;
		height: 82rpx;
		align-items: center;
		text-align: right;
		/* overflow: hidden; */
	}

	.order-box .order-item.no-border {
		border-bottom: none;
	}

	.goods-items {
		min-height: 190rpx;
		margin-top: 20rpx;
		background: #fff;
		/* margin-bottom: 120rpx; */
		border-radius: 10rpx;
		padding: 20rpx 20rpx 30rpx;
	}

	.goods-items .item {
		/* height:190rpx; */
		align-items: center;
	}

	.goods-items .item .name {
		font-size: 30rpx;
		/* height: 28rpx; */
		line-height: 34rpx;
		color: #333;
		margin-bottom: 20rpx;
	}

	.goods-items .item.no-border {
		border-bottom: none;
	}

	.goods-items .item:last-child {
		border-bottom: none;
	}

	.goods-items .img {
		height: 178rpx;
		width: 178rpx;
		/* background-color: #f4f4f4; */
		margin-right: 26rpx;
		border-radius: 10rpx;
	}

	.goods-items .img image {
		height: 190rpx;
		width: 190rpx;
		border-radius: 10rpx;
	}

	.goods-items .info {
		flex: 1;
		height: 190rpx;
		padding: 10rpx 0 0;
	}

	.goods-items .t {
		height: 33rpx;
		line-height: 33rpx;
		margin-bottom: 10rpx;
		overflow: hidden;
		font-size: 30rpx;
		color: #333;
	}

	.goods-items .t .name {
		display: block;
		float: left;
	}

	.goods-items .t .number {
		display: block;
		float: right;
		text-align: right;
	}

	.address-block {
		width: 690rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		padding: 30rpx 20rpx 20rpx;
	}

	.address-block .tips {
		display: flex;
		align-items: center;
		height: 30rpx;
	}

	.tips image {
		width: 30rpx;
		height: 30rpx;
		margin-right: 10rpx;
	}

	.tips view {
		line-height: 30rpx;
		font-size: 30rpx;

	}

	.goods-items .m {
		height: 28rpx;
		overflow: hidden;
		line-height: 28rpx;
		margin-bottom: 16rpx;
		font-size: 22rpx;
		color: #666;
		margin-left: 10rpx;
	}

	.buy-tips {
		margin-top: 5rpx;
		font-size: 22rpx;
		color: #666;
		line-height: 34rpx;
		padding: 0 30rpx 0 20rpx;
	}

	.goods-items .b {
		height: 28rpx;
		line-height: 28rpx;
		font-size: 26rpx;
		color: #666;
	}

	.order-total {
		position: fixed;
		left: 0;
		bottom: 0;
		height: 100rpx;
		width: 100%;
		display: flex;
	}

	.order-total .l {
		flex: 1;
		height: 100rpx;
		line-height: 100rpx;
		color: #b4282d;
		background: #fff;
		font-size: 33rpx;
		padding-left: 31.25rpx;
		border-top: 1rpx solid rgba(0, 0, 0, 0.2);
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
	}

	.order-total .r {
		width: 233rpx;
		height: 100rpx;
		background: #b4282d;
		border: 1px solid #b4282d;
		line-height: 100rpx;
		text-align: center;
		color: #fff;
		font-size: 30rpx;
	}

	.actual-price {
		color: #2a2a2a;
		/* font-weight: bold; */
		font-size: 30rpx;
		text-align: right;
		margin: 28rpx 0 0;
	}

	.actual-price text {
		color: #DF1717;
	}

	.go-pay-wrapper {
		position: fixed;
		bottom: 50rpx;
		left: 30rpx;
		right: 30rpx;
		height: 90rpx;
		width: 690rpx;
		border-radius: 90rpx;
		display: flex;
		align-items: center;
		overflow: hidden;
		/* background:#fff; */

	}

	.btn-left {
		width: 486rpx;
		background: #000;
		display: flex;
		height: 90rpx;
		padding: 8rpx 0 0 42rpx;
		align-items: center;

	}

	.btn-left .num {
		font-size: 22rpx;
		color: #fff;
		/* margin-top:10rpx; */
		margin-right: 10rpx;
	}

	.btn-left .total {
		font-size: 22rpx;
		color: #fff;
		/* margin-top:10rpx; */
	}

	.btn-left .rmb {
		font-weight: bold;
		font-size: 24rpx;
		color: #fff;
		margin-top: -6rpx;
	}

	.btn-left .price {
		font-weight: bold;
		font-size: 32rpx;
		color: #fff;
		margin-top: -6rpx;
	}

	view.go-pay-wrapper button>view {
		color: #fff;
	}

	.appoint-time-block {
		margin-top: 20rpx;
		background: #fff;
		border-radius: 10rpx;
	}

	.appoint-time-block view.appoint-time-operate {
		padding: 0 20rpx;
		height: 90rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 24rpx;
	}

	.appoint-time-block .operate-left {
		color: #333;
		font-size: 30rpx;
	}

	view.operate-right {
		display: flex;
		align-items: center;
	}

	view.operate-right text {
		color: #09AFFF;
		font-size: 26rpx;
	}

	view.operate-right .not-select {
		color: #333;
	}

	.appoint-time-show {
		border-top: 2rpx solid #E4E4E4;
		padding: 0 24rpx;
		font-size: 24rpx;
	}

	view.one-time {
		height: 70rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	view.one-time text {
		color: #999;
		font-size: 26rpx;
	}

	.multi-times {
		padding: 30rpx 0
	}

	.multi-times-item {
		height: 54rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.multi-times-item text {
		font-weight: bold;
		font-size: 24rpx;
	}

	view.appoint-result {
		margin-top: 18rpx;
		border: 2rpx solid #09AFFF;
		border-radius: 20rpx;
		line-height: 46rpx;
		font-size: 26rpx;
		padding: 10rpx;
	}

	.orange-font {
		color: #FA6400;
		font-weight: bold;
		font-size: 26rpx;
	}

	.order-item .message-item {
		color: #2a2a2a;
		font-size: 26rpx;
		font-weight: normal;
		height: 82rpx;
	}

	view.popup-wrapper view {
		color: #888;
		font-size: 30rpx;
	}

	.popup-content {
		flex: 1;
	}

	.popup-title {
		height: 96rpx;
		line-height: 96rpx;
		text-align: center;
		border-bottom: 1rpx solid #ddd;
		font-size: 15px !important;
	}

	.popup-content {
		display: flex;
	}

	.time-select-left {
		border-right: 1rpx solid #ddd;
		padding: 0 8rpx 0 20rpx;
		width: 370rpx;
	}

	.time-select-right {
		flex: 1;
		/* padding: 0 8rpx; */
		height: 900rpx;
		overflow-y: hidden;
	}

	.time-select-left-item {
		height: 108rpx;
		display: flex;
		flex-direction: column;
		padding: 4rpx 0;
	}

	.date-line-wrapper {
		flex: 1;
		display: flex;
		/* justify-content: space-between; */
		align-items: center;
	}

	.time-select-left-item .date-msg {
		height: 36rpx;
		line-height: 36rpx;
		color: #888;
		font-size: 24rpx;
	}

	.time-select-left-item .date-msg.avail-date {
		color: #3FA10D;
		font-weight: bold;
	}

	.popup-wrapper .popup-content .current-date {
		color: #09afff;
		font-weight: bold;
	}

	view.popup-wrapper .time-select-right-item {
		line-height: 104rpx;
		height: 104rpx;
		border-bottom: 1rpx solid #ddd;
		display: flex;
		align-items: flex-start;
		/*justify-content: space-between; */
		flex-direction: column;
		padding: 0 24rpx;
		justify-content: center;
	}

	.time-select-right-item view {
		color: #6D7278;
		/* font-weight: bold; */
	}

	view.popup-btn-wrapper {
		margin: 20rpx 0 0;
		padding: 0 24rpx 20rpx;
	}

	view.popup-btn-wrapper button>view {
		color: #fff;
	}

	view.popup-wrapper .date-tag {
		color: #09afff;
		height: 44rpx;
		line-height: 42rpx;
		width: 76rpx;
		border: 2rpx solid #09afff;
		border-radius: 44rpx;
		text-align: center;
		font-weight: normal;
		font-size: 22rpx;
		display: inline-block;
		margin-left: 8rpx;
	}

	view.popup-wrapper .full-time {
		color: #09AFFF;
		font-size: 24rpx;
		margin: 0 0 0 20rpx;
		height: 44rpx;
		line-height: 44rpx;
		float: right;
		padding-right: 40rpx;
	}

	.first-appoint-date-item {
		height: 108rpx;
		display: flex;
		align-items: center;
		padding: 0 0 0 240rpx;

	}

	.first-time-selected {
		margin: 0 0 0 60rpx;
	}

	.select-week-times {
		border-top: 1rpx solid #ddd;
	}

	.week-select-left {
		flex: 1.2;
	}

	.week-select-left>view.time-select-left-item {
		padding: 0 0 0 60rpx;
		display: flex;
		align-items: flex-start;
		justify-content: flex-start;
		flex-direction: row;
		padding: 10rpx 0 0 60rpx;
	}

	.week-select-left>view.time-select-left-item .week-str {
		padding: 12rpx 0 0 0;
	}

	view.popup-wrapper view.select-num-tag {
		width: 32rpx;
		height: 32rpx;
		line-height: 32rpx;
		background: #09AFFF;
		border-radius: 34rpx;
		font-size: 20rpx;
		color: #fff;
		text-align: center;
		margin: 0 0 0 6rpx;

	}

	/* 支付失败弹框 */
	.overlay-wrapper {
		display: flex;
		align-items: center;
		justify-content: center;
		/* height: 100%; */
		position: fixed;
		left: 0;
		bottom: 0;
		right: 0;
		top: 0;
		z-index: 9999;
	}

	.fail-wrapper {
		width: 588rpx;
		height: 502rpx;
		border-radius: 10rpx;
		background: #fff;
		padding-bottom: 40rpx;
		padding: 80rpx 0 0;
		font-size: 24rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.fail-top {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.fail-top image {
		width: 110rpx;
		height: 110rpx;
	}

	.fail-text {
		font-size: 34rpx;
		font-weight: bold;
		margin: 66rpx 0 24rpx;
		height: 34rpx;
	}

	.fail-bottom {
		height: 132rpx;
		border-top: 2rpx solid #E4E4E4;
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	.fail-bottom .btn-devide {
		width: 2rpx;
		height: 130rpx;
		background: #E4E4E4;
	}

	.cancel-btn {
		width: 202rpx;
		height: 72rpx;
		line-height: 72rpx;
		border: 2rpx solid #85868A;
		color: #282728;
		border-radius: 72rpx;
		text-align: center;
	}

	.repay-btn {
		width: 202rpx;
		height: 72rpx;
		line-height: 72rpx;
		background: #09AFFF;
		color: #fff;
		border-radius: 72rpx;
		text-align: center;
	}

	.discount-title {
		height: 70rpx;
		background: #E0F5FC;
		padding: 0 10rpx;
		display: flex;
		align-items: center;
	}

	.discount-title image {
		width: 24rpx;
		height: 26rpx;
		margin: 0 8rpx 0 0;
	}

	.discount-title text {
		font-size: 28rpx;
		font-weight: bold;
		color: #323232;
	}

	.discount-line {
		padding: 0 20rpx 0 20rpx;
		border-top: 2rpx solid #E4E4E4;
	}

	.discount-line .txt {
		color: #DF1717;
		font-size: 24rpx;
	}

	.discount-line .l {
		flex: 1;
		height: 70rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.member-benefit,
	.buy-member {
		margin: 20rpx 0 0;
		height: 70rpx;
		background: #fff;
		border-radius: 10rpx;
		padding: 0 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.member-benefit .member-tip {
		text-align: right;
	}

	.member-tag {
		width: 142rpx;
		padding: 0 10rpx;
		height: 44rpx;
		line-height: 44rpx;
		text-align: center;
		background: #2E3235;
		border-radius: 5rpx;
	}

	.member-tag text {
		font-size: 24rpx;
		color: #2A2A2A;
		background: linear-gradient(177deg, #F1E3C8 0%, #E6C162 100%);
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
	}

	.member-tip {
		flex: 1;
		margin: 0 0 0 26rpx;
		color: #DF1717;
		font-size: 24rpx;
	}

	.popup-content-special {
		position: relative;
	}

	.popup-title-special {
		position: absolute;
		left: 0;
		top: 0;
		right: 0;
		background: #fff;
	}

	.popup-content-special {
		height: 900rpx;
		margin-top: 96rpx;
	}

	.popup-content-special .time-select-left {
		height: 900rpx;
		overflow-y: scroll;
	}

	.stock-text {
		font-size: 20rpx;
		font-weight: normal;
		color: #888
	}

	.zero-stock {
		color: #ccc;
	}

	.appoint-overlay-wrapper {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, .7);
		z-index: 999;
	}

	/* 选择时间 */
	view.popup-wrapper {
		/* padding: 0 0 20rpx; */
		color: #333;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		/* height: 80%; */
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		background: #fff;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
		z-index: 9999;
	}

	view.popup-wrapper view.confirm-btn {
		background: #09AFFF;
		height: 88rpx;
		line-height: 88rpx;
		border-radius: 88rpx;
		text-align: center;
		color: #fff;
	}

	.go-pay-wrapper {
		/* padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom); */
	}

	.go-pay-wrapper view.btn-right {
		background: #00B9FF;
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		color: #fff;
		width: 204rpx;
		font-size: 30rpx;
	}

	.appoint-tabs-wrapper {
		height: 88rpx;
		display: flex;
		align-items: center;
		line-height: 88rpx;
		justify-content: space-around;
	}

	.appoint-tab-item {
		/* width:80rpx; */
		border-bottom: 4rpx solid #fff;
	}

	.appoint-tab-item.active {
		color: #09AFFF;
		border-bottom: 4rpx solid #09afff;
	}

	.order-box.code-module {
		border-radius: 10rpx;
		padding: 8rpx 0;
	}

	.codeTips {
		height: 52rpx;
		line-height: 40rpx;
		padding-bottom: 20rpx;
		color: #09afff;
		font-size: 26rpx;
		text-align: right;
		padding: 0 20rpx;
	}

	.codeTips.no-match {
		color: #FA6400;
	}

	.goods-total {
		height: 30rpx;
		margin-top: 20rpx;
		display: flex;
		align-items: flex-end;
		justify-content: flex-end;
	}

	.goods-total view {
		font-size: 24rpx;
		color: #666;
	}

	.goods-total .amount {
		color: #333;
		font-size: 48rpx;
		line-height: 50rpx;
		/* margin-bottom:4rpx; */
	}

	.order-box .order-item .r.remark-block {
		display: flex;
		align-items: center;
		justify-content: flex-end;
	}

	.remark-block view {
		color: #999;
		font-size: 26rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		width: 460rpx;
	}

	.remark-block image {
		width: 14rpx;
		height: 24rpx;
		margin-left: 6rpx;
	}

	.remark-popup {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		height: 860rpx;
		background: #fff;
		border-radius: 20rpx 20rpx 0px 0px;
		padding: 40rpx 30rpx 50rpx;
		z-index: 9999;
	}

	.remark-popup .title {
		height: 30rpx;
		line-height: 30rpx;
		font-size: 30rpx;
		color: #333333;
	}

	.remark-textarea {
		width: 690rpx;
		height: 240rpx;
		background: #F8F8F8;
		border-radius: 10rpx;
		padding: 20rpx 36rpx 36rpx 20rpx;
		font-size: 26rpx;
		line-height: 40rpx;
		margin: 30rpx 0 330rpx;
		box-sizing: border-box;
	}

	.remark-popup .btn {
		width: 690rpx;
		height: 100rpx;
		background: #00B9FF;
		border-radius: 50rpx;
		line-height: 100rpx;
		font-size: 30rpx;
		text-align: center;
		color: #fff;
	}




	.login-out-wrapper {
		width: 750rpx;
		height: 100vh;
		background: rgba(0, 0, 0, 0.5);
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		top: 0;
		bottom: 0;

	}

	.login-out-tip {
		width: 576rpx;
		height: 410rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		position: relative;
		padding: 142rpx 66rpx 50rpx;
	}

	.tip-img {
		position: absolute;
		width: 168rpx;
		height: 168rpx;
		top: 10px;
		left: 110px;
	}

	.login-out-wrapper .tips {
		font-size: 13px;
		color: #333333;
		line-height: 38rpx;
		height: 38rpx;
		font-size: 36rpx;
		text-align: center;
		margin-bottom: 68rpx;
		margin-top: 30px;
	}


	.select-wrapper {
		height: 70rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		/* justify-content: space-between; */

	}

	.select-wrapper .confirm {
		width: 200rpx;
		height: 70rpx;
		line-height: 70rpx;
		border: 2rpx solid #999999;
		border-radius: 70rpx;
		font-size: 30rpx;
		text-align: center;
	}

	.select-wrapper .cancel {
		width: 200rpx;
		height: 70rpx;
		line-height: 70rpx;
		background: #00C0FF;
		border-radius: 70rpx;
		color: #FFFFFF;
		font-size: 30rpx;
		text-align: center;
	}

	.contact-wrapper {
		position: relative;
	}

	.contact-btn {
		position: absolute;
		top: 0;
		left: 0;
		width: 630rpx;
		height: 90rpx;
		opacity: 0;
		z-index: 99;
	}

	.popup-content-special {
		position: relative;
	}

	.popup-title-special {
		position: absolute;
		left: 0;
		top: 0;
		right: 0;
		background: #fff;
	}

	.popup-content-special {
		height: 900rpx;
		/* margin-top: 96rpx; */
		margin-top: 116rpx;
	}

	.popup-content-special .time-select-left {
		height: 900rpx;
		overflow-y: scroll;
	}

	.stock-text {
		font-size: 20rpx;
		font-weight: normal;
		color: #888
	}

	.zero-stock {
		color: #ccc;
	}


	.noon-select {
		height: 64rpx;
		display: flex;
		border-bottom: 1rpx solid #ddd;
	}

	.time-select-right .noon-item {
		flex: 1;
		text-align: center;
		line-height: 64rpx;
		color: #979797;
		font-size: 26rpx;
	}

	.time-select-right view.noon-item.active-noon {
		color: #fff;
		background: #09afff;
	}

	view.popup-wrapper .time-select-right-item .date-tag {
		width: 80rpx;
		height: 40rpx;
		line-height: 38rpx;
		margin-left: 0;
		/* margin-left:120rpx; */
	}

	.popup-title-new.popup-title {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 116rpx;
		line-height: normal;
	}

	.popup-title-new view {
		color: #333;
		font-size: 32rpx;
	}

	.popup-title-new view.fee-tips {
		color: #FF5735;
		font-size: 22rpx;
	}

	.time-select-right-item text {
		color: #888;
	}

	.time-select-right .time-item-wrapper {
		height: 836rpx;
		overflow-y: scroll;
	}

	.time-line {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	view.popup-wrapper .time-select-right-item.invalid-time text {
		color: #999;
	}

	view.popup-wrapper .time-select-right-item.invalid-time {
		/* background: #E1E1E1; */
		background: #eee;
	}

	.time-select-right-item view.time-msg {
		height: 40rpx;
		line-height: 38rpx;
		border-radius: 40rpx;
		padding: 0 8rpx;
		font-size: 22rpx;
		border: 2rpx solid #999;
		color: #999;
		font-weight: normal;
		white-space: nowrap;
	}

	.time-select-right-item text.extra-tips {
		color: #FF5735;
		font-size: 22rpx;
	}

	.notice-block {
		background: #fff;
		border-radius: 24rpx;
		padding: 20rpx 24rpx;
		margin-bottom: 24rpx;
	}

	.notice-title {
		font-weight: bold;
		font-size: 26rpx;
		line-height: 60rpx;
	}

	.notice-item {
		display: flex;
		align-items: flex-start;
	}

	.notice-index {
		width: 36rpx;
	}

	.notice-item view {
		font-size: 26rpx;
		line-height: 40rpx;
		color: #666;
	}

	.notice-item view:last-child {
		flex: 1;
		text-align: justify;
	}

	.appoint-block {
		padding: 0 20rpx;
		height: 88rpx;
		display: flex;
		align-items: center;
		/* border-bottom: 2rpx solid #E0E0E0; */
	}

	.appoint-block .title {
		width: 136rpx;
		border-bottom: 2rpx solid #fff;
		font-size: 26rpx;
		font-weight: bold;
		z-index: 9;
		height: 72rpx;
		line-height: 72rpx;
	}

	.appoint-block .title text {
		color: #f00;
	}

	.appoint-time {
		flex: 1;
		color: #ACADB1;
		padding-left: 4rpx;
		font-size: 24rpx;
	}

	.appoint-timed {
		flex: 1;
		padding-left: 4rpx;
		color: #333;
		font-size: 26rpx;
	}

	.appoint-block .arrow-img {
		width: 24rpx;
		height: 24rpx;
		margin-left: 8rpx;
	}
</style>