<template>
	<view class="content">
		<view class="type-item">
			<view class="item-title" v-if="userInfo.type == 1">咨询预约</view>
			<view class="item-title" v-if="userInfo.type == 2">我的病人</view>
			<view class="item-title" v-if="userInfo.type == 3">预约管理</view>
			<!-- <view class="record" v-if="userInfo.type == 3" @click="ToMyorder">预约记录</view> -->
			<view class="navbar flex">
				<view v-for="(item, index) in navList" :key="index" class="nav-item"
					:class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
			</view>
			<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
				<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
					<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
						<!-- 空白页 -->
						<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
						<!-- 订单列表 -->
						<view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
							<view class="i-top flex_item">
								<image src="/static/img/img021.png"></image>
								<view class="time">
									发起时间：
									<text>{{ item.add_time }}</text>
								</view>
								<view v-if="userInfo.type == 1 || userInfo.type == 3">
									<view class="state" v-if="item.refund == 0">
										{{
											item.status == 0
												? '未支付'
												: item.status == 1
												? '已支付'
												: item.status == 2
												? '已预约'
												: item.status == 3
												? '待确认'
												: item.status == 4
												? '已确认'
												: item.status == 5
												? '已完成'
												: '已评价'
										}}
									</view>
									<view class="state" v-if="item.refund != 0">
										{{ item.refund == 1 ? '退款中' : item.status == 2 ? '退款完成' : '退款失败' }}
									</view>
								</view>
								<view v-if="userInfo.type == 2">
									<view class="state" v-if="item.refund == 0">
										{{
											item.status == 0
												? '未支付'
												: item.status == 1
												? '已支付'
												: item.status == 2
												? '已预约'
												: item.status == 3
												? '已确认'
												: item.status == 4
												? '待确认'
												: item.status == 5
												? '已完成'
												: '已评价'
										}}
									</view>
									<view class="state" v-if="item.refund != 0">
										{{ item.refund == 1 ? '退款中' : item.status == 2 ? '退款完成' : '退款失败' }}
									</view>
								</view>
							</view>
							<view class="goods-box-single flex_item" @click="ToChat(item)">
								<view class="img-box">
									<view v-if="item.status == 1 || item.status == 2">
										<view class="corner" v-if="item.no_read > 0 && item.refund == 0">
											<text>{{ item.no_read }}</text>
										</view>
									</view>
									<image v-if="userInfo.type != 2" class="goods-img"
										:src="item.doctor_avatar || '/static/error/missing-face.png'" mode="aspectFill">
									</image>
									<image v-if="userInfo.type == 2" class="goods-img"
										:src="item.patient_avatar || '/static/error/missing-face.png'"
										mode="aspectFill"></image>
								</view>
								<view class="right">
									<text class="title clamp" v-if="userInfo.type != 2">
										{{ item.doctor_name }}({{
											item.doctor_level == 1 ? '初级' : item.doctor_level == 2 ? '中级' : item.doctor_level == 3 ? '副高级' : '正高级'
										}})
									</text>
									<view v-if="userInfo.type == 2">
										<text class="title clamp"
											v-if="item.type == 1 || item.type == 2">{{ item.patient_name }}</text>
										<text class="title clamp" v-if="item.type == 3">{{ item.organ_name }}</text>
									</view>
									<view class="title clamp font-da">
										{{ item.type == 1 ? '咨询' : item.type == 2 ? '预约麻醉' : '多点执业' }}
									</view>
									<view class="title red" v-if="userInfo.type != 2 && item.refund == 1">
										您申请的退款将在平台审核后，退回您的账户，感谢您使用麻醉服务平台。</view>
								</view>
								<view class="appointment"
									v-if="userInfo.type == 2 && item.refund == 0 && item.status != 0">回复详情</view>
								<view class="appointment"
									v-if="userInfo.type != 2 && item.refund == 0 && item.status != 0">立即咨询</view>
								<!-- 0未支付 1病人已支付 2已预约时间 3医生确认完成 4病人已完成 5已完成 6已评价 -->
							</view>
							<view class="action-box b-t" v-if="userInfo.type != 2">
								<view class="action-btn" v-if="item.status == 0" @click="ConfirmPay(item)">去支付</view>
								<view class="action-btn" v-if="item.status == 0" @click="Cancel(item.order_id)">取消订单
								</view>
								<view class="action-btn"
									v-if="(item.refund == 0 && item.status == 2) || item.status == 3"
									@click="Completion(item.order_id)">确认完成</view>
								<view class="action-btn" v-if="item.status == 4 || item.status == 5"
									@click="ToEvaluate(item.order_id)">去评价</view>
								<view class="action-btn"
									v-if="item.status == 4 || item.status == 5 || item.status == 6 || item.status == 7"
									@click="open(item.order_id)">
									打赏医生
								</view>
								<view class="action-btn" v-if="item.refund == 0 && item.status == 2"
									@click="open1(item)">退款</view>
								<!-- <view class="action-btn" v-if="item.refund == 1" @click="cancel(item.order_id)">取消退款</view> -->
								<view class="action-btn"
									v-if="item.status == 4 || item.status == 5 || item.status == 6 || item.status == 7"
									@click="ToZixu(item)">再次咨询</view>
								<!-- <view class="action-btn" v-if="item.status == 6" @click="del(item)">删除订单</view> -->
							</view>
							<view class="action-box b-t" v-if="userInfo.type == 2">
								<view class="action-btn"
									v-if="(item.refund == 0 && item.status == 2) || item.status == 4 || item.status == 7"
									@click="Completion(item.order_id)">
									确认完成
								</view>
								<view class="action-btn" v-if="item.refund == 0 && item.status == 2"
									@click="open1(item)">退款</view>
							</view>
						</view>
						<uni-load-more :status="tabItem.loadingType"></uni-load-more>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
		<!-- 申请退款弹窗 -->
		<uni-popup ref="popup1" type="center">
			<view class="popup">
				<view class="row">
					<view class="row-1">申请退款</view>
					<input class="row-2" type="text" v-model="reason" placeholder="请输入退款理由" />
					<button class="row-3 flex" @click="refund">申请退款</button>
				</view>
			</view>
			<view class="close_icon" @click="close1">
				<image src="../../static/img/img016.png"></image>
			</view>
		</uni-popup>
		<!-- 打赏金额弹出层 -->
		<uni-popup ref="popup" type="center">
			<view class="popup">
				<!-- <image class="img" mode="widthFix" src="../../static/img/img022.png"></image> -->
				<view class="row">
					<view class="row-1">打赏金额</view>
					<input class="row-2" type="number" v-model="money" placeholder="请输入打赏金额" />
					<button class="row-3 flex" @click="Reward">立即打赏</button>
				</view>
			</view>
			<view class="close_icon" @click="close">
				<image src="../../static/img/img016.png"></image>
			</view>
		</uni-popup>
		<!-- 支付弹窗 -->
		<uni-popup ref="popup2" style="z-index: 999;" type="bottom">
			<view class="payment">
				<view class="first flex " @click="payclose()">
					<text class="word">选择支付方式</text>
					<image src="../../static/img/img25.png"></image>
				</view>
				<view class="pay-type-list">
					<view class="type-item b-b" @click="changePayType(1)">
						<view class="img">
							<image class="yue" src="../../static/img/img26.png"></image>
						</view>
						<view class="con"><text class="tit">微信支付</text></view>
						<label class="radio">
							<radio value="" color="#FC4141" :checked="payType == 1"></radio>
						</label>
					</view>
					<view class="type-item flex_item" @click="changePayType(2)">
						<view class="img">
							<image class="yue" src="../../static/img/img017.png"></image>
						</view>
						<view class="con"><text class="tit">余额支付</text></view>
						<label class="radio">
							<radio value="" color="#FC4141" :checked="payType == 2"></radio>
						</label>
					</view>
				</view>
				<view class="one"></view>
				<view class="Third flex">
					<view class="two1">
						<text class="two1-1 ">合计：</text>
						<text class="two1-2">￥</text>
						<text class="two1-2 size">{{ money }}</text>
					</view>
					<view class="two2" :class="{ clickbg: payLoding }" @click.stop="!payLoding ? confirm() : ''">
						<text>立即支付</text>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>
<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import DatetimePicker from '@/components/datetime-picker/datetime-picker.vue';
	import empty from '@/components/empty';
	import {
		getTime
	} from '@/utils/rocessor.js';
	import uniPopup from '@/components/uni-popup/uni-popup.vue';
	import {
		orderList,
		go_pay,
		cancel,
		setTime,
		patientFinish,
		doctorFinish,
		refund,
		cancelRefund,
		reward
	} from '@/api/patient.js';
	// #ifdef H5
	import weixinObj from '@/libs/jweixin-module/index.js';
	import {
		weixindata
	} from '@/utils/wxAuthorized';
	// #endif
	export default {
		components: {
			uniLoadMore,
			empty,
			uniPopup,
			DatetimePicker
		},
		data() {
			return {
				tabCurrentIndex: 0,
				time: '', //预定时间
				rewardId: '', //打赏的订单id
				refundId: '', //申请退款的id
				money: '', //打赏金额
				reason: '', //退款理由
				payType: 1, //支付类型
				payLoding: false, //判断是否支付中
				// #ifdef H5
				froms: '', //当前是否为微信浏览器
				// #endif
				type: '', //判断是否从订单中进入
				navList: [{
						state: 0,
						text: '全部',
						loadingType: 'more',
						orderList: [],
						page: 1, //当前页数
						limit: 10 //每次信息条数
					},
					{
						state: 1,
						text: '进行中 ',
						loadingType: 'more',
						orderList: [],
						page: 1, //当前页数
						limit: 10 //每次信息条数
					},
					{
						state: 2,
						text: '待评价',
						loadingType: 'more',
						orderList: [],
						page: 1, //当前页数
						limit: 10 //每次信息条数
					}
				]
			};
		},
		computed: {
			...mapState(['userInfo'])
		},
		onShow() {
			console.log(this.userInfo, 'patient');
			// this.tabCurrentIndex = 0;
			this.loadData('Refresh');
			// 1是病人 2是医生 3是机构
			if (this.userInfo.type == 2) {
				uni.setTabBarItem({
					index: 0,
					text: '首页',
					iconPath: 'static/tabBar/tab-home.png',
					selectedIconPath: 'static/tabBar/tab-home-current.png'
				});
				uni.setTabBarItem({
					index: 1,
					text: '我的病人',
					iconPath: 'static/tabBar/tab-cate.png',
					selectedIconPath: 'static/tabBar/tab-cate-current.png',
					visible: true
				});
				uni.setTabBarItem({
					index: 2,
					text: '科普学习',
					iconPath: 'static/tabBar/tab-study.png',
					selectedIconPath: 'static/tabBar/tab-study-current.png',
					visible: false
				});
				uni.setTabBarItem({
					index: 3,
					text: '接单',
					iconPath: 'static/tabBar/jd.png',
					selectedIconPath: 'static/tabBar/jd-act.png',
					pagePath: '/pages/dd/dd'
				})
				uni.setTabBarItem({
					index: 4,
					text: '我的',
					iconPath: 'static/tabBar/tab-my.png',
					selectedIconPath: 'static/tabBar/tab-my-current.png'
				});
			}
			if (this.userInfo.type == 1) {
				uni.setTabBarItem({
					index: 0,
					text: '首页',
					iconPath: 'static/tabBar/tab-home.png',
					selectedIconPath: 'static/tabBar/tab-home-current.png'
				});
				uni.setTabBarItem({
					index: 1,
					text: '咨询记录',
					iconPath: 'static/tabBar/tab-cate.png',
					selectedIconPath: 'static/tabBar/tab-cate-current.png',
					visible: true
				});
				uni.setTabBarItem({
					index: 2,
					text: '科普学习',
					iconPath: 'static/tabBar/tab-study.png',
					selectedIconPath: 'static/tabBar/tab-study-current.png',
					visible: true
				});
				uni.setTabBarItem({
					index: 3,
					text: '接单',
					iconPath: 'static/tabBar/jd.png',
					selectedIconPath: 'static/tabBar/jd-act.png',
					visible: false
				})
				uni.setTabBarItem({
					index: 4,
					text: '我的',
					iconPath: 'static/tabBar/tab-my.png',
					selectedIconPath: 'static/tabBar/tab-my-current.png.png'
				});
			}
			if (this.userInfo.type == 3) {
				uni.setTabBarItem({
					index: 0,
					text: '首页',
					iconPath: 'static/tabBar/tab-home.png',
					selectedIconPath: 'static/tabBar/tab-home-current.png'
				});
				uni.setTabBarItem({
					index: 1,
					text: '咨询记录',
					iconPath: 'static/tabBar/tab-cate.png',
					selectedIconPath: 'static/tabBar/tab-cate-current.png'
				});
				uni.setTabBarItem({
					index: 2,
					text: '科普学习',
					iconPath: 'static/tabBar/tab-study.png',
					selectedIconPath: 'static/tabBar/tab-study-current.png',
					visible: false
				});
				uni.setTabBarItem({
					index: 3,
					text: '发布订单',
					iconPath: 'static/tabBar/jd.png',
					selectedIconPath: 'static/tabBar/jd-act.png',
					pagePath: '/pages/dd/dd'
				})
				uni.setTabBarItem({
					index: 4,
					text: '我的',
					iconPath: 'static/tabBar/tab-my.png',
					selectedIconPath: 'static/tabBar/tab-my-current.png'
				});
			}
		},
		//下拉刷新
		onPullDownRefresh() {
			let obj = this;
			//监听下拉刷新动作的执行方法，每次手动下拉刷新都会执行一次
			obj.loadData('Refresh');
			// setTimeout(function() {
			// 	obj.loadData("Refresh");
			// 	uni.stopPullDownRefresh(); //停止下拉刷新动画
			// }, 1000);
		},
		methods: {
			//修改当前选中的时间下标
			// changeTimeIndex(index) {
			// 	this.actionItem = index;
			// 	console.log(this.actionItem,'actionItem')
			// },
			/**
			 * 选择日期时间
			 * @param {Object} date 日期数据
			 */
			//选择时间
			// changeDatetimePicker(date) {
			// 	console.log(2222,date.fmt3)
			// 	this.navList[this.tabCurrentIndex].orderList[this.actionItem].time = date.fmt3;
			// 	console.log(this.navList[this.tabCurrentIndex].orderList)
			// },
			//获取订单列表
			loadData(source) {
				//这里是将订单挂载到tab列表下
				let index = this.tabCurrentIndex;
				let navItem = this.navList[index];
				let state = navItem.state;
				if (source === 'Refresh') {
					// 刷新数据
					navItem.page = 1;
					navItem.loadingType = 'more';
					navItem.orderList = [];
				}
				if (navItem.loadingType === 'loading') {
					//防止重复加载
					return;
				}
				if (navItem.loadingType === 'noMore') {
					//防止重复加载
					return;
				}
				// 修改当前对象状态为加载中
				navItem.loadingType = 'loading';
				orderList({
						state: state,
						keyword: '',
						page: navItem.page,
						limit: navItem.limit
					})
					.then(({
						data
					}) => {
						let arr = data.list.map(e => {
							e.add_time = getTime(e.add_time);
							return e;
						});
						navItem.orderList = navItem.orderList.concat(arr);
						navItem.page++;
						if (source == 'Refresh') {
							uni.stopPullDownRefresh(); //停止下拉刷新动画
						}
						if (navItem.limit == arr.length) {
							//判断是否还有数据， 有改为 more， 没有改为noMore
							navItem.loadingType = 'more';
							return;
						} else {
							//判断是否还有数据， 有改为 more， 没有改为noMore
							navItem.loadingType = 'noMore';
						}
						this.$set(navItem, 'loaded', true);
					})
					.catch(e => {
						console.log(e);
					});
			},
			ConfirmPay(item) {
				let obj = this;
				uni.showModal({
					title: '提示',
					content: '确定支付' + item.pay_price + '吗？',
					success: function(res) {
						if (res.confirm) {
							go_pay({
									order_id: item.order_id
								})
								.then(({
									data
								}) => {
									console.log(item, data);
									if (item.pay_type == 2) {
										obj.payLoding = false;
										obj.$api.msg(msg);
										obj.loadData('Refresh');
									} else {
										obj.orderMoneyPay(data);
									}
								})
								.catch(e => {
									obj.payLoding = false;
									console.log(e.message);
								});
						} else if (res.cancel) {
							obj.payLoding = false;
							obj.$api.msg('取消支付');
						}
					}
				});
			},
			// 微信支付金额
			orderMoneyPay(data) {
				let obj = this;
				let config = data.jsConfig;
				weixindata().then(e => {
					weixinObj
						.chooseWXPay({
							timestamp: config.timestamp,
							nonceStr: config.nonceStr,
							package: config.package,
							signType: config.signType,
							paySign: config.paySign,
							success: function(res) {
								console.log(res);
								obj.$api.msg(res);
								obj.payLoding = false;
							},
							fail: function(res) {
								obj.payLoding = false;
								console.log(res, '失败');
								console.log(res.errMsg);
							}
						})
						.catch(e => {
							obj.payLoding = false;
							console.log(e.message);
						});
				});
			},
			//再次咨询
			ToZixu(item) {
				console.log(item);
				uni.navigateTo({
					url: '/pages/doctor/expert?id=' + item.doctor_id
				});
			},
			//取消订单
			Cancel(item) {
				let obj = this;
				cancel({
						order_id: item
					})
					.then(({
						data
					}) => {
						obj.$api.msg(data.msg);
						obj.loadData('Refresh');
					})
					.catch(e => {
						console.log(e.message);
					});
			},
			//确认订单完成
			Completion(item) {
				let obj = this;
				//病人和机构确认完成订单
				if (obj.userInfo.type == 1 || obj.userInfo.type == 3) {
					patientFinish({
							order_id: item
						})
						.then(data => {
							obj.$api.msg(data.msg);
							obj.loadData('Refresh');
						})
						.catch(e => {
							console.log(e.message);
						});
				}
				//医生确认完成订单
				if (obj.userInfo.type == 2) {
					doctorFinish({
							order_id: item
						})
						.then(data => {
							obj.$api.msg(data.msg);
							obj.loadData('Refresh');
						})
						.catch(e => {
							console.log(e.message);
						});
				}
			},
			//选中预约时间
			Appointment(item) {
				let obj = this;
				setTime({
						order_id: item.order_id,
						time: item.time
					})
					.then(data => {
						obj.$api.msg(data.msg);
						obj.loadData('Refresh');
					})
					.catch(e => {
						console.log(e.message);
					});
			},
			//判断时间是否过期
			// judgeTime(time) {
			// 	console.log(time, 'time');
			// 	let strtime = time.replace('/-/g', '/'); //时间转换
			// 	console.log(strtime, 'strtime');
			// 	//选择时间
			// 	let date1 = new Date(strtime);
			// 	console.log(date1, 'date1');
			// 	//现在时间
			// 	let date2 = new Date();
			// 	console.log(date2, 'date2');
			// 	//判断时间是否过期
			// 	if (date1 < date2) {
			// 		this.timeOut = false;
			// 	} else {
			// 		this.timeOut = true;
			// 	}
			// 	console.log(this.timeOut);
			// },
			//评价
			ToEvaluate(item) {
				uni.navigateTo({
					url: '/pages/patient/evaluate?id=' + item
				});
			},
			//申请退款
			refund() {
				let obj = this;
				if (obj.reason == '') {
					obj.$api.msg('请输入退款路由');
					return;
				}
				refund({
						reason: obj.reason,
						order_id: obj.refundId
					})
					.then(data => {
						obj.$api.msg(data.msg);
						obj.loadData('Refresh');
						obj.close1();
					})
					.catch(e => {
						obj.close1();
						obj.loadData('Refresh');
						console.log(e.message);
					});
			},
			//取消退款
			cancel(item) {
				let obj = this;
				uni.showModal({
					title: '提示',
					content: '确定要取消退款？',
					success: function(res) {
						if (res.confirm) {
							cancelRefund({
									order_id: item
								})
								.then(data => {
									obj.$api.msg(data.msg);
									obj.loadData('Refresh');
								})
								.catch(e => {
									obj.loadData('Refresh');
									console.log(e.message);
								});
						} else if (res.cancel) {
							obj.$api.msg('');
						}
					}
				});
			},
			//跳转咨询界面
			ToChat(item) {
				if (item.refund == 0) {
					//病人
					if (this.userInfo.type == 1) {
						uni.navigateTo({
							url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.doctor_name + '&uid=' +
								item.doctor_id
						});
					}
					//医生
					if (this.userInfo.type == 2) {
						if (item.type == 1 || item.type == 2) {
							uni.navigateTo({
								url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.patient_name +
									'&uid=' + item.patient_id
							});
						}
						if (item.type == 3) {
							uni.navigateTo({
								url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.organ_name +
									'&uid=' + item.patient_id
							});
						}
					}
					//机构
					if (this.userInfo.type == 3) {
						uni.navigateTo({
							url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.doctor_name + '&uid=' +
								item.doctor_id
						});
					}
				}
			},
			//打开打赏弹窗
			open(item) {
				this.rewardId = item;
				this.$refs.popup.open();
			},
			//关闭打赏弹窗
			close() {
				this.$refs.popup.close();
			},
			//立即打赏
			Reward() {
				if (this.money == '') {
					this.$api.msg('请输入打赏金额');
					return;
				}
				this.$refs.popup.close();
				this.payopen();
			},
			//打开支付弹窗
			payopen() {
				this.$refs.popup2.onTap();
				this.$refs.popup2.open();
			},
			//关闭支付弹窗
			payclose() {
				this.$refs.popup2.close();
			},
			//选择支付方式
			changePayType(type) {
				this.payType = type;
			},
			//确认支付
			confirm: async function() {
				let obj = this;
				// 支付中
				obj.payLoding = true;
				// #ifdef H5
				// 获取当前是否为微信浏览器
				obj.froms = uni.getStorageSync('weichatBrowser') || '';
				// #endif
				obj.CreateOrder();
			},
			//订单创建
			CreateOrder() {
				let obj = this;
				// 生成订单
				reward({
						order_id: obj.rewardId, //
						money: obj.money, //医生类型 1 普通预约 2 私人医生
						pay_type: obj.payType //支付类型  1是微信 2是余额
					})
					.then(data => {
						// 判断是否为余额支付
						if (obj.payType == 2) {
							if (data.code == 200) {
								if (data.msg == '余额支付成功') {
									obj.$api.msg('打赏成功');
								}
								obj.payclose();
								obj.loadData('Refresh');
								obj.payLoding = false;
							} else {
								obj.payclose();
								obj.payLoding = false;
								obj.$api.msg(msg);
							}
						}
						if (obj.payType == 1) {
							console.log('orderMoneyPay', data);
							let item = data.data;
							// 立即支付
							obj.orderMoneyPay(item);
						}
					})
					.catch(e => {
						// 支付完成
						console.log(e.message);
						obj.payclose();
						obj.payLoding = false;
						if (e.message == '该订单已支付!') {
							// obj.paySuccessTo();
						}
					});
			},
			//打开退款弹窗
			open1(item) {
				this.refundId = item.order_id;
				this.$refs.popup1.open();
			},
			//关闭退款弹窗
			close1() {
				this.$refs.popup1.close();
			},
			//预约记录
			ToMyorder() {
				uni.navigateTo({
					url: '/pages/order/myorder'
				});
			},
			//swiper 切换
			changeTab(e) {
				this.tabCurrentIndex = e.target.current;
				this.loadData('tabChange');
			},
			//顶部tab点击
			tabClick(index) {
				this.tabCurrentIndex = index;
				// 初始化数据列表
				this.navList[index].orderList = [];
				// 初始化翻页数
				this.navList[index].page = 1;
				// 初始化数据为未加载状态
				this.navList[index].loadingType = 'more';
			}
		}
	};
</script>

<style lang="scss">
	page,
	.content {
		background: $page-color-base;
		height: 100%;

		.type-item {
			height: 100%;
			position: relative;

			.item-title {
				font-weight: bold;
				background: #ffffff;
				font-size: 36rpx;
				color: #333333;
				text-align: center;
				height: 100rpx;
				line-height: 100rpx;
				border-bottom: 2rpx solid #eeeeee;
			}

			.record {
				position: absolute;
				top: 25rpx;
				right: 25rpx;
				color: #6786fb;
				font-size: 30rpx;
			}
		}
	}

	.swiper-box {
		height: calc(100% - 80px);
	}

	.list-scroll-content {
		height: 100%;
	}

	.navbar {
		display: flex;
		height: 40px;
		padding: 0 5px;
		background: #fff;
		box-shadow: 0 2px 2px rgba(0, 0, 0, 0.06);
		position: relative;
		z-index: 10;

		.nav-item {
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 100%;
			font-size: 15px;
			color: $font-color-dark;
			position: relative;

			&.current {
				color: $base-color;

				&:after {
					content: '';
					position: absolute;
					left: 50%;
					bottom: 0;
					transform: translateX(-50%);
					width: 44px;
					height: 0;
					border-bottom: 2px solid $base-color;
				}
			}
		}
	}

	.uni-swiper-item {
		height: auto;
	}

	.order-item {
		display: flex;
		flex-direction: column;
		padding-left: 30rpx;
		background: #fff;
		padding: 28rpx 28rpx;
		margin-bottom: 25rpx;
		border-radius: 15rpx;

		.i-top {
			display: flex;
			align-items: center;
			font-size: 30rpx;
			color: #6786fb;
			position: relative;

			image {
				width: 34rpx;
				height: 32rpx;
				margin-right: 15rpx;
			}

			.time {
				width: 75%;

				text {
					color: #666666;
				}
			}

			.del-btn {
				padding: 10rpx 0 10rpx 36rpx;
				font-size: $font-lg;
				color: $font-color-light;
				position: relative;

				&:after {
					content: '';
					width: 0;
					height: 30rpx;
					border-left: 1px solid $border-color-dark;
					position: absolute;
					left: 20rpx;
					top: 50%;
					transform: translateY(-50%);
				}
			}
		}

		.goods-box-single {
			padding: 50rpx 0;

			.img-box {
				position: relative;

				.goods-img {
					display: block;
					width: 140rpx;
					height: 140rpx;
					border-radius: 25rpx;
				}

				.corner {
					position: absolute;
					z-index: 999;
				}
			}

			.right {
				flex: 1;
				display: flex;
				flex-direction: column;
				padding: 0 30rpx 0 24rpx;
				overflow: hidden;

				.title {
					font-size: 30rpx;
					line-height: 45rpx;
					font-weight: 500;
					color: $font-color-dark;
					line-height: 50rpx;

					.price {
						color: #fc4141;
					}
				}

				.font-da {
					font-size: 35rpx;
					font-weight: bold;
				}

				.red {
					color: #fc4141;
				}

				.attr-box {
					font-size: 24rpx;
					color: #666666;

					.red {
						color: #e73932;
					}
				}
			}

			.appointment {
				font-size: 30rpx;
				color: #6786fb;
				background: rgba(103, 134, 251, 0.18);
				border-radius: 5px;
				padding: 15rpx 25rpx;
			}
		}

		.action-box {
			display: flex;
			justify-content: flex-end;
			align-items: center;
			position: relative;
			padding-top: 28rpx;
		}

		.action-btn {
			width: 160rpx;
			height: 60rpx;
			margin: 0;
			margin-left: 24rpx;
			padding: 0;
			text-align: center;
			line-height: 60rpx;
			font-size: $font-sm + 2rpx;
			color: $font-color-dark;
			background: #fff;
			border-radius: 100px;
			border: 2rpx solid #6786fb;
			color: #6786fb;
		}

		.row {
			display: flex;
			align-items: center;
			font-size: 30upx;
			position: relative;
		}
	}

	//搜索框
	.Search-box {
		overflow: hidden;
		width: 100%;
		padding: 20rpx;
		background-color: #ffffff;
		justify-content: space-around;

		.Search-box {
			width: 89%;
			height: 72rpx;
			border-radius: 36rpx;
			background-color: #f8f6f6;
			justify-content: flex-start;
			padding-left: 54rpx;

			.box-img {
				height: 30rpx;
				width: 30rpx;
				margin-right: 20rpx;
			}

			.box-word {
				font-size: $uni-font-size-base - 2rpx;
				font-weight: 500;
				color: #666666;
			}
		}

		.Search-word {
			width: 11%;
			font-size: $uni-font-size-lg - 2rpx;
			font-weight: 500;
			color: #666666;

			.word {
				float: right;
			}
		}
	}

	.second-part {
		padding: 20rpx;

		.template {
			width: 100%;
			background: #ffffff;
			overflow: hidden;
			padding: 20rpx;
			box-shadow: 0px 5px 5px 0px rgba(35, 24, 21, 0.06);
			margin-bottom: 18rpx;
			border-radius: 12rpx;
			position: relative;

			.left-img {
				width: 140rpx;
				float: left;
				overflow: hidden;

				image {
					width: 140rpx;
					height: 140rpx;
					border-radius: 50%;
				}
			}

			.center-word {
				width: 50%;
				padding-left: 25rpx;
				padding-right: 15rpx;

				.one {
					font-size: $uni-font-size-lg - 2rpx;
					font-weight: 500;
					color: $uni-text-color;
					line-height: 36rpx;
					display: block;
					margin-bottom: 10rpx;
				}

				.two {
					font-size: $uni-font-size-sm;
					font-weight: 500;
					color: #999999;
					line-height: 36rpx;
					display: block;
				}
			}

			.right-label {
				padding: 16rpx;
				border: 1px solid $base-color;
				border-radius: 7rpx;
				font-size: $font-sm - 1rpx;
				font-weight: 500;
				color: $base-color;
				align-items: center;

				image {
					width: 38rpx;
					height: 38rpx;
					margin-right: 8rpx;
				}
			}
		}
	}

	//弹窗
	.popup {
		width: 536rpx;

		.img {
			width: 100%;
		}

		.row {
			background: #ffffff;
			padding: 45rpx 45rpx;
			border-radius: 25rpx;

			.row-1 {
				color: #323333;
				font-size: 36rpx;
				text-align: center;
				width: 100%;
				padding: 30rpx 0rpx;
				padding-bottom: 50rpx !important;
			}

			.row-2 {
				background: #eaeaea;
				padding: 15rpx 25rpx;
				font-size: 26rpx;
				height: 80rpx;
				border-radius: 15rpx;
			}

			.row-3 {
				width: 80%;
				margin: 20rpx auto;
				margin-top: 50rpx;
				background: linear-gradient(0deg, rgba(126, 153, 254, 1), rgba(151, 143, 250, 1));
				border-radius: 34rpx;
				justify-content: center;
				font-size: $uni-font-size-lg + 4rpx;
				font-weight: 500;
				color: #f8f9f9;
			}
		}
	}

	.close_icon {
		width: 52rpx;
		height: 52rpx;
		margin: 88rpx auto 0;

		image {
			width: 100%;
			height: 100%;
		}
	}

	//支付弹窗

	.pay-type-list {
		margin-top: 20upx;
		background-color: #fff;
		padding-left: 40upx;

		.type-item {
			height: 120upx;
			padding: 20upx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-right: 60upx;
			font-size: 30upx;
			position: relative;
		}

		.icon {
			width: 100upx;
			font-size: 52upx;
		}

		.img {
			color: #fe8e2e;
			width: 50rpx;
			height: 50rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.tit {
			font-size: $font-lg;
			color: $font-color-dark;
			margin-bottom: 4upx;
		}

		.con {
			flex: 1;
			display: flex;
			flex-direction: column;
			padding-left: 25rpx;
			font-size: $font-sm;
			color: $font-color-light;
		}
	}

	.payment {
		background-color: #ffffff;
		border-radius: 15rpx 15rpx 0rpx 0rpx;
		z-index: 999;

		.first {
			border-bottom: 2rpx solid $border-color-light;
			padding: 38rpx 25rpx;

			.word {
				font-size: $uni-font-size-base;
				font-weight: bold;
				color: $font-color-dark;
			}

			image {
				width: 25rpx;
				height: 25rpx;
			}
		}

		.one {
			height: 20rpx;
			background-color: #f6f6f6;
		}

		.Third {
			.two1 {
				width: 55%;
				background-color: #ffffff;
				padding-left: 25rpx;

				.two1-1 {
					font-size: $uni-font-size-base;
					font-weight: 400;
					color: $font-color-dark;
				}

				.two1-2 {
					font-size: $uni-font-size-sm;
					font-weight: bold;
					color: $color-red1;
				}

				.size {
					font-size: $uni-font-size-lg + 4rpx;
				}
			}

			.two2 {
				width: 45%;
				background: $color-red1;
				color: #ffffff;
				font-size: $uni-font-size-lg;
				font-weight: 550;
				text-align: center;
				padding: 30rpx 0rpx;
			}

			.clickbg {
				background-color: $color-gray !important;
			}
		}
	}
</style>
