<template>
	<view style="font-size: 28upx">
		<!-- <z-nav-bar backState="2000" title="首页"></z-nav-bar> -->
		<view class="home_bg">
			<view class="" style="">
				<view style="height: 60rpx"></view>
				<view class="icon_hua">
					<image src="../../static/icon/home_icon_1.png" mode="aspectFit" class="icon_hua_1"></image>
				</view>
				<view class="hehan">
					<image src="../../static/icon/hehan.png" mode="aspectFit" class="icon_hua_1"></image>
				</view>

				<view class="fiveIcon flexbox" style="justify-content: space-around">
					<div class="item item1" @click="onPageJump('../acupoint/acupoint')">
						<image src="../../static/icon/five1.png" mode="aspectFit"></image>
						<text>经穴检索</text>
					</div>
					<div class="item item1" @click="onPageJump('../prescript/prescript')">
						<image src="../../static/icon/five2.png" mode="aspectFit"></image>
						<text>方药检索</text>
					</div>
					<div class="item item1" @click="onPageJump('../classic/classic')">
						<image src="../../static/icon/five7.png" mode="aspectFit"></image>
						<text>经典查阅</text>
					</div>
					<div class="item item1" @click="onPageJump('../luck/luck')">
						<image src="../../static/icon/five4.png" mode="aspectFit"></image>
						<text>五运六气</text>
					</div>

					<!-- 					<div class="item item1" @click="onPageJump('../peanut/searchFor')">
						<image src="../../static/icon/five3.png" mode="aspectFit"></image>
						<text>书名检索</text>
					</div> -->

					<!-- <div class="item item1" @click="onPageJump('../medicaldes/medicaldes')">
						<image src="../../static/icon/five5.png" mode="aspectFit"></image>
						<text>中医研究</text>
					</div> -->
				</view>
			</view>
			<!-- <view class="home_lunbo">
			-
				<u-swiper :list="list3" indicator indicatorMode="line" circular style="height: 180rpx;"></u-swiper>
			</view> -->
		</view>
		<!-- <view class="home_nar" v-if="showEbook"> -->
		<view class="home_nar" v-if="iosHide">
			<view class="hn_cl_tit shuguan" @click="onPageJump('../clock/index')">
				<image src="../../static/icon/home1-1.png" mode="aspectFit"></image>
				<!-- <text>打 卡</text> -->
			</view>

			<view class="hn_cl_tit dianzishu" @click="onPageJump('../listen/home')" v-if="iosHidden">
				<image src="../../static/icon/home2-1.png" mode="aspectFit"></image>
				<!-- <text>听 书</text> -->
			</view>

			<!-- <view class="hn_cl_tit" @click="onPageJump('../bookShop/bookShopIndex')"> -->
			<view class="hn_cl_tit shuping" @click="onPageJump('../comments/commentsList')">
				<image src="../../static/icon/home3-1.png" mode="aspectFit"></image>
				<!-- <text>书 评</text> -->
			</view>

			<view class="hn_cl_tit chaoshi" @click="onPageJump('../talkBook/talkBook')">
				<image src="../../static/icon/home4-1.png" mode="aspectFit"></image>
				<!-- <text>讲 书</text> -->
			</view>

			<view class="hn_cl_tit chaoshi" @click="onPageJump('../yian/yian')">
				<image src="../../static/icon/home5-1.png" mode="aspectFit"></image>
				<!-- <text>讲 书</text> -->
			</view>
		</view>
		<!-- <view class="search_box flexbox" @click="onPageJump('../peanut/searchFor')">
			<view class="search">
				<text class="icon_search"></text>
				<text class="prompt">请输入书名</text>
			</view>
			<view class="searBtn">
				<text>书名检索</text>
			</view>
		</view> -->
		<!-- 新闻播报 -->
		<view class="fourBox" v-if="newsList.length > 0">
			<view class="newsBox flexbox">
				<view class="icon">
					<u-icon name="volume-fill" color="#ff5500" size="26"></u-icon>
				</view>
				<view class="newscoll">
					<swiper class="swiper" interval="5000" circular autoplay vertical indicator-dots="false">
						<swiper-item class="item" v-for="(item, index) in newsList" :key="index"
							@click="newsClick(item)">
							<view class="swiper-item uni-bg-red">{{ item.title }}</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
		</view>
		<!-- 营销标签 -->
		<!-- <scroll-view class="yxTagBox" scroll-x="true">
			<view class="ProTabs flexbox">
				<text v-for="(item, index) in yingxiaoTags" :key="item.id" :class="[yxCurIndex == index ? 'cur' : '']"
					@click="yxTabsChange(item, index)">{{ item.title }}</text>
			</view>
		</scroll-view>

		<view class="newBook">
			<scroll-view class="scroll-view_H" scroll-x="true" scroll-left="10" style="margin-top: 0 !important">
				<view :class="['item']" v-for="(item, index) in YXBookList" :key="index">
					<view class="videoBox" @click="goDetail(item.product_id)">
						<image v-if="item.product_images != ''" :src="item.product_images" mode="scaleToFill"></image>
						<image v-else src="../../static/icon/wufeng.jpg" mode="scaleToFill"></image>
					</view>
					<text class="bookName">{{ item.product_name }}</text>
				</view>
			</scroll-view>
		</view>

		<scroll-view class="ProTabsBox">
			<view class="New_ProTabs flexbox">
				<text v-for="(item, index) in catTagList" :key="item.splId" :class="[tabsid == item.id ? 'cur' : '']"
					@click="tabsChange(item, index)">{{ item.title }}</text>
			</view>
		</scroll-view>
		<view class="children_cate_box" v-if="childrenCatList && childrenCatList.length > 0">
			<view class="children_cate flexbox">
				<view @click="childrenChange(item, index)" :class="['item', curChildrenId == item.id ? 'cur' : '']"
					v-for="(item, index) in childrenCatList" :key="item.id">
					<text>{{ item.title }}</text>
				</view>
			</view>
		</view> -->
		<!-- 商品展示 -->
		<!-- <view class="goods">
			
			<view class="">
				<view v-if="tjProList.length > 0">
					<view class="flexbox" style="flex-wrap: wrap;">
						<view class="goodsItem" v-for="(item, index) in tjProList" :key="index"
							style="position: relative;" @click="goDetail(item.product_id)">
							<image :src="item.product_images" mode="" class="goodsImg"></image>
							<view class="goodsContent">
								<view class="goodsName">
									{{ item.product_name }}
								</view>
								<view class="goodsPrice" style="">
									

									<text v-if="item.is_vip_price==1&&item.vip_price!=0">
									<text style="color: #e97512;font-size: 12px;font-weight: bold;">￥{{(item.vip_price).toFixed(2)}}</text>
									<text style="color: #8a8a8a;font-size: 10px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">￥{{(item.price).toFixed(2)}}</text>
									
									
								
								</text>

							<text
								v-else-if="item.activity_price && item.activity_price > 0">
								<text style="color: #e97512;font-size: 12px;font-weight: bold;">￥{{(item.activity_price).toFixed(2)}}</text>
									<text style="color: #8a8a8a;font-size: 10px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">￥{{(item.price).toFixed(2)}}</text>
									
								
							
							</text>

					
									<span class="price" style=" color: #e97512;font-size: 12px;" v-else>￥{{ item.price }}</span>
									<span class="Salesnum" style="font-size: 10px !important;line-height: 24px;">已售:{{ item.sum_sales }} 件</span>
								</view>
								<view  v-if="item.is_vip_price==1&&item.vip_price!=0&&item.vip_price!=null"
									style="position: absolute;top: 10rpx;left: 10px;text-align: center;font-size: 22rpx;background-color: #f94f04;color: #fff;font-weight: bold;border-radius:4px;width: 120rpx; padding:4px;box-sizing: border-box;">
									VIP优惠</view>
							</view>
						</view>
					</view>
					<view class="">
						<view v-if="status == 0" style="text-align: center">
							<u-loading-icon style="display: inline-block"></u-loading-icon>
							<font style="
                  vertical-align: super;
                  margin-left: 10px;
                  font-size: 26rpx;
                  color: #909399;
                ">努力加载中
							</font>
						</view>
						<view v-if="status == 1">
							<u-divider text="全部加载完成"></u-divider>
						</view>
					</view>
				</view>
				<u-divider v-else text="暂无数据哦~"></u-divider>
			</view>
		</view> -->

		<view>
			<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle="bgiStyle" :iconStyle="iconStyle"></u-back-top>
		</view>
		<view class="appJump">
			<view class="soulspace item flexbox" @click="appjumpfun('soulspace')">
			  <view class="img">
			    <image src="@/static/xlkj.png"></image>
			  </view>
			  <view class="text">
			    <text>心灵空间</text>
			  </view>
			</view>
			<view class="zmzm item flexbox" @click="appjumpfun('wumen')">
				<view class="img">
					<image src="@/static/wumen40.png"></image>
				</view>
				<view class="text">
					<text>吴门医述</text>
				</view>
			</view>
			<view class="zmzm item flexbox" @click="appjumpfun('taihu')" v-if="isShowTaihu">
				<view class="img">
					<image src="@/static/logo_taihu.png"></image>
				</view>
				<view class="text">
					<text>太湖云医</text>
				</view>
			</view>
			<view class="zmzm item flexbox" @click="appjumpfun('zmzm')">
				<view class="img">
					<image src="@/static/40x40.png"></image>
				</view>
				<view class="text">
					<text>众妙之门</text>
				</view>
			</view>
			
		</view>
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<z-navigation></z-navigation>
		<music-play :playList="myList"></music-play>
		<common-advertisement ref="commonAdvertisement" :list="advertisementList"></common-advertisement>
	</view>
</template>

<script>
	import musicPlay from "@/components/music.vue";
	import repciptData from "@/static/json/repcipt.json";
	import $http from "@/config/requestConfig.js";
	// #ifdef APP-PLUS
	import updata from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
	// #endif
	import {
		mapState,
		mapMutations
	} from "vuex";
	export default {
		data() {
			return {
				isShowTaihu:false,
				myList: [],
				advertisementList: [],
				showEbook: false, // 显示电子书相关
				transaction: {
					// 成功回调
				},
				tabsNumber: null,
				scrollLeft: 0,
				maxTimes: 1, // 轮询最大次数
				ComplateRequestInterval: null, // 轮询定时器
				checking: false, // 正在检测
				ComplateRequestArr: [],
				iapChannel: null,
				scrollTop: 0,
				list3: [
					// '../../static/icon/home_ban_1.jpg',
					"../../static/icon/home_ban_2.jpg",
					"../../static/icon/home_ban_3.jpg",
				],
				yingxiaoTags: [
					// 营销标签列表
				],
				xinsList: [],
				loadingNow: false,
				limiTist: [],
				jingList: [],
				seckillList: [],
				offSaleList: [], // 折扣列表
				goodsList: [],
				bgiStyle: {
					background: "#fff",
				},
				YXBookList: [],
				catTagList: [
					// 分类标签
				],
				curChildrenId: 0,
				iconStyle: {
					fontSize: "40rpx",
					fontWeight: "bold",
					color: "#54a966",
				},
				tagList: [], // 推荐标签列表
				childrenCatList: [], // 二级分类
				wztaglist: [{
						splId: "-1",
						labelName: "全部",
					},
					{
						splId: "5",
						labelName: "文学",
					},
					{
						splId: "6",
						labelName: "哲学",
					},
				],
				yxtaglist: [{
						splId: "0",
						labelName: "全部",
					},
					{
						splId: "2",
						labelName: "中医经典",
					},
					{
						splId: "1",
						labelName: "中医基础",
					},
					{
						splId: "3",
						labelName: "各家学说",
					},
					{
						splId: "4",
						labelName: "中医临床",
					},
				],
				tabsid: "",
				wztabsid: "",
				pageSize: 10,
				page: 1,
				totalPage: 0,
				tjProList: [],
				status: 3,
				userMsg: {}, // 用户信息
				yxCurIndex: 0, // 当前营销标签序号
				SystemInfoSync: {}, // 屏幕尺寸
				newsList: [], // 播报新闻列表
			};
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		//第一次加载
		onLoad(e) {
			if (plus.os.name == "Android") {
					this.isShowTaihu=true
					}else{
						this.isShowTaihu=false
					}
			// 隐藏原生的tabbar
			uni.hideTabBar();
			// this.requestIapOrder()
			this.$nextTick(() => {

				this.getAdvertisement()

			})

		},
		onHide() {
			this.page = 1;
			// this.tjProList = []
			// if(this.tagList.length > 0){
			// 	this.tabsid = this.tagList[0].splId
			// }
		},
		//页面显示
		onShow() {
			// 隐藏原生的tabbar
			// #ifdef APP-PLUS
			updata();
			// #endif
			// this.getUserInfo()
			// this.tjProList = []
			// uni.hideTabBar();
			// this.getData();
			// this.getTags()
			// this.getYXTgs()
			this.requestAll();
		},
		onTabItemTap() {},
		// 页面加载完毕
		onReady() {
			// this.requestIapOrder()
			// console.log(uni.getSystemInfoSync(), '屏幕')
		},
		mounted() {
			this.requestAll();
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			// this.tjProList = []
			// this.getUserInfo()
			// this.getData()
			// this.getTags()
			// this.getYXTgs()
			this.requestAll();
			// this.requestIapOrder()
			uni.stopPullDownRefresh();
		},
		// onReachBottom() {
		// 	this.loadingNow = true
		// 	console.log('到底了')
		// 	if (this.page + 1 <= this.totalPage) {
		// 		this.status = 0
		// 		this.page++
		// 		this.getJtData()
		// 	} else {
		// 		this.status = 1
		// 	}

		// },

		filters: {
			// 控制字数
			ellipsis(value) {
				if (!value) return "";
				let reg = /[\u4e00-\u9fa5]/g;
				let names = value.match(reg);
				value = names ? names.join("") : "";
				if (value.length > 50) {
					return value.slice(0, 50) + "...";
				}
				return value;
			},
		},
		computed: {
			...mapState(["userInfo"]),
		},
		components: {
			musicPlay,
		},
		//方法
		methods: {
			...mapMutations(["setUserInfo"]),

			async getAdvertisement() {
				await $http
					.request({
						url: "common/mainAd/getMainAd",
						method: "POST",
						data: {
							type: 0,
						},
						header: {
							//默认 无 说明：请求头
							"Content-Type": "application/json",
						},
					})
					.then(async (res) => {
						console.log("res at line 61511111111111111:", res);
						if (res.code == 0 && res.list && res.list.length > 0) {
							this.advertisementList = res.list;

							this.$refs.commonAdvertisement.open();
						}
					});
			},
			requestAll() {
				this.getUserInfo();
				this.tjProList = [];
				uni.hideTabBar();
				// this.getData();
				this.getTags();
				this.getYXTgs();
				this.getNewsList();
			},
			newsClick(item) {
				if (item.type == 1) {
					// url跳转
					if (item.url != "") {
						console.log("item", item);
						// this.openURL(item.url)
						uni.navigateTo({
							url: `/pages/news/newsForwebview?id=${item.id}&url=${item.url}&type=1`,
						});
					} else {
						console.log("跳转链接为空");
					}
				} else {
					// 内部跳转
					uni.navigateTo({
						url: "/pages/news/news?newsid=" + item.id,
					});
				}
			},
			// 获取播报新闻列表
			getNewsList() {
				$http
					.request({
						url: "common/message/listByPage",
						method: "POST", // POST、GET、PUT、DELETE，具体说明查看官方文档
						data: {
							isBook: 1, //是否是疯子读书0否1是
							isMedical: 0, //是否是吴门医述0否1是
							isSociology: 0, //是否是众妙之门0否1是
						},
						header: {
							//默认 无 说明：请求头
							"Content-Type": "application/json",
						},
					})
					.then((res) => {
						if (res.code == 0) {
							if (res.messages.length > 0) {
								this.newsList = res.messages;
							} else {
								this.newsList = [];
							}
						}
					});
			},
			// 获取营销标签列表
			getYXTgs() {
				this.$http.post("book/labelAndMarket/marketTree").then((res) => {
					// console.log(res, '营销标签列表')
					if (res.result.length > 0) {
						this.yingxiaoTags = res.result;
						this.getYXproducts();
					}

					// console.log(res)
				});
			},
			// ...mapMutations(['setLoadingShow']),
			// 获取对应营销商品列表
			getYXproducts(item) {
				var tag_id = null;
				if (!item) {
					/// console.log('没有传参')
					tag_id = this.yingxiaoTags[0].id;
				} else {
					tag_id = item.id;
				}
				this.$http
					.post("book/labelAndMarket/getShopProductListByMarketId", {
						marketId: tag_id,
					})
					.then((res) => {
						if (res.code == 0 && res.result.length > 0) {
							this.YXBookList = res.result;
						} else {
							this.YXBookList = [];
						}
						// console.log(res.result, '营销商品列表')
					})
					.catch((e) => {
						this.YXBookList = [];
					});
			},
			// 获取用户详情
			getUserInfo() {
				// 用户详情
				// if (this.userInfo.id != undefined) {
				this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
					this.userMsg = res.user;
				});
				// }
			},
			// 获取商品标签
			getTags() {
				this.loadingNow = false;
				this.$http
					.post("book/labelAndMarket/labelTree")
					.then((res) => {
						// console.log(res, '标签列表')
						if (res.code == 0 && res.result.length > 0) {
							this.catTagList = res.result;
							this.tabsid = this.catTagList[0].id;
							if (this.catTagList[0].isLast == 1) {
								this.getJtData(this.catTagList[0].id);
							} else {
								this.childrenCatList = this.catTagList[0].children;
								this.curChildrenId = this.childrenCatList[0].id;
								this.getJtData(this.childrenCatList[0].id);
							}
						}
					})
					.catch((e) => {
						console.log(e, "e");
					});
			},
			// 二级分类点击
			childrenChange(item, index) {
				// console.log(item,this.curChildrenId,'点击')
				this.curChildrenId = this.childrenCatList[index].id;
				this.getJtData(this.childrenCatList[index].id);
			},
			tabsChange(item, cindex) {
				//	this.tjProList = []
				this.tabsid = item.id;
				this.childrenCatList = [];
				if (this.catTagList[cindex].isLast == 1) {
					this.getJtData(this.catTagList[cindex].id);
				} else {
					this.childrenCatList = this.catTagList[cindex].children;
					this.curChildrenId = this.childrenCatList[0].id;
					this.getJtData(this.childrenCatList[0].id);
				}
				// this.getJtData()
				// if (this.tabsid == 15) {
				// 	this.wztabsid = '0'
				// } else if (this.tabsid == 16) {
				// 	this.wztabsid = '-1'
				// } else {
				// 	this.wztabsid = ''
				// }
				// this.page = 1
				// // 获取推荐数据
			},
			yxTabsChange(item, index) {
				// this.yxtaglist = []
				this.yxCurIndex = index;
				this.getYXproducts(item);
			},
			wztabsChange(item) {
				this.tjProList = [];
				this.wztabsid = item.splId;
				this.page = 1;
				// 获取推荐数据
				// this.getJtData()
			},
			getJtData(cid) {
				this.$http
					// .post('book/label/list',{
					.post("book/labelAndMarket/getShopProductListByLabelId", {
						labelId: cid,
					})
					.then((res) => {
						if (res.code == 0 && res.result.length > 0) {
							this.tjProList = res.result;
							console.log('列表列表this.tjProList at line 745:', this.tjProList)
						} else {
							this.tjProList = [];
							this.status = 3;
						}
					})
					.catch((e) => {
						this.tjProList = [];
						console.log(e, "商品分类列表报错");
					});
			},
			// 获取折扣图书
			// getOffSale() {
			// 	this.$http
			// 		.post('book/shopproduct/listactivityprice?limit=10&page=1')
			// 		.then(res => {
			// 			console.log(res, '折扣')
			// 			if (res.code == 0 && res.page.list.length > 0) {
			// 				this.offSaleList = res.page.list
			// 				this.tabsNumber = 0
			// 			}

			// 		}).catch(e => {
			// 			console.log(e, 'e')
			// 		});
			// },
			// 新书上市
			// getNewBook() {
			// 	this.$http
			// 		.post('book/shopproduct/getNewBook', {
			// 			'limit': 4,
			// 			'page': 1
			// 		})
			// 		.then(res => {
			// 			console.log(res, 'xinshu')
			// 			this.YXBookList.page.list
			// 		}).catch(e => {
			// 			console.log(e, '新书上市报错')
			// 		});
			// },
			// 检测未完成订单
			requestIapOrder() {
				console.log("检测支付环境...");
				plus.payment.getChannels((channels) => {
					console.log(channels, "channels");
					//this.setUserInfo({channelList:channels}); // 将支付通道保存到本地
					for (var i in channels) {
						// 判断是否苹果支付1
						if (channels[i].id === "appleiap") {
							this.iapChannel = channels[i];
							// console.log(this.userInfo.restoreFlag,'this.userInfo.restoreFlag')
							if (this.userInfo.restoreFlag) {
								// 如果存在异常回调订单
								this.restoreComplateRequest();
							}
						}
					}
				});
			},
			// 查询未关闭订单
			restoreComplateRequest() {
				let that = this;
				console.log("检测未完成订单");
				console.log(this.iapChannel, "this.iapChannel");
				this.iapChannel.restoreComplateRequest({
						manualFinishTransaction: true,
					},
					function(results) {
						if (!that.checking) {
							that.checking = true;
							// console.log(that.checking)
							// results 格式为数组存放恢复的IAP商品交易信息对象 IAPTransaction，通用需将返回的支付凭证传给后端进行二次认证
							that.ComplateRequestArr = results;
							console.log(that.ComplateRequestArr, "未完成订单数组");
							if (results && results.length > 0) {
								results.map((item, index) => {
									// "0"为正在支付；"1"为支付成功；"2"为支付失败；"3"为支付已恢复。
									if (item.transactionState == "1") {
										// 已经支付，但是没有走逻辑的内购订单
										that.iapCheck(item, index);
									} else {
										// 其他状态的内购订单
										that.finishTransaction(item);
									}
								});
							}
						}
					}
				);
			},
			// 关闭交易订单
			finishTransaction(trans, index) {
				this.iapChannel.finishTransaction(
					trans,
					(success) => {
						console.log("关闭订单成功", index);

						if (index == this.ComplateRequestArr.length - 1) {
							// 最后一个支付订单
							this.setUserInfo({
								restoreFlag: false,
							});
							// console.log(this.userInfo.restoreFlag,'this.ComplateRequestArr.length+++')
						}
					},
					(fail) => {
						console.log("关闭订单失败");
					}
				);
			},
			iapCheck(result, index) {
				const that = this;
				console.log("进入后台验证");
				let data = {
					transactionId: result.transactionIdentifier, // 支付交易id
					customerOid: that.userInfo.id,
					productId: result.payment.productid, // 产品id
					orderId: result.payment.username, // 系统订单号
					receiptData: result.transactionReceipt, // 苹果返回收据
					loadAnimate: "none", // 请求加载动画
				};
				console.log(data, "data");
				$http
					.request({
						url: "/Ipa/veri",
						method: "POST", // POST、GET、PUT、DELETE，具体说明查看官方文档
						data,
						header: {
							//默认 无 说明：请求头
							"Content-Type": "application/json",
						},
					})
					.then((res) => {
						console.log(JSON.stringify(res));
						console.log(res.code);
						if (res.code == 0) {
							// uni.hideLoading()
							console.log("充值订单已处理，请留意账户金额变动....");
							// 服务器验证票据有效后在客户端关闭订单
							that.finishTransaction(result, index);
						} else if (res.code == 200) {
							// 重复验证订单
							console.log("重复验证....");
							that.finishTransaction(result, index);
						}
					})
					.catch((e) => {
						console.log("支付验证失败，进入轮询程序...");
						that.getIapPayResult(result, index);
					});
				console.log("--------------");
			},

			// 轮询验证支付结果
			getIapPayResult(result, index) {
				// let interval = null
				this.ComplateRequestInterval = setTimeout(() => {
					if (this.maxTimes <= 3) {
						this.iapCheck(result, index);
						console.log("执行1", this.maxTimes, this.ComplateRequestInterval);
						this.maxTimes += 1;
					} else {
						this.maxTimes = 0;
						console.log(
							"停止轮询",
							this.maxTimes,
							this.ComplateRequestInterval,
							this.maxTimes
						);
						this.checking = false;
						this.saveErrorIapOrder(result, index);
						clearTimeout(this.ComplateRequestInterval);
					}
				}, 10000);
			},
			// 轮询失败接口
			saveErrorIapOrder(result, index) {
				console.log("提交到充值问题单里面...");
				let data = {
					transactionId: result.transactionIdentifier,
					failureflag: 1,
					orderId: result.payment.username,
					receiptData: result.transactionReceipt,
					productId: result.payment.productid,
					customerOid: this.userInfo.id,
				};
				$http
					.request({
						url: "Ipa/failure",
						method: "POST", // POST、GET、PUT、DELETE，具体说明查看官方文档
						data,
						header: {
							//默认 无 说明：请求头
							"Content-Type": "application/json",
						},
					})
					.then((res) => {
						console.log(JSON.stringify(res));
						if (res.code == 200) {
							console.log("提交成功，关闭订单");
							this.finishTransaction(result, index);
						}
					})
					.catch((e) => {
						console.log(e);
						if (e.statusCode == 0) {
							// 重复提交，直接关闭订单
							this.finishTransaction(result, index);
						}
					});
			},
			// 获取列表数据
			getData() {
				// 获取限时秒杀
				// this.$http
				// 	.get(`book/shopseckill/getSeckillProd`)
				// 	.then(res => {
				// 		this.seckillList = res.list
				// 		// this.seckillList = null
				// 	})
				// 获取精选商品
				// this.$http
				// 	.post('book/shopproduct/appGetList?limit=30&page=1&istop=1')
				// 	.then(res => {
				// 		console.log(res.page.list,'首页商品')
				// 		this.goodsList = res.page.list
				// 	})
				//this.getOffSale()
				// this.getNewBook()
			},

			// 跳转
			onPageJump(url) {
				console.log(this.userMsg, "this.userMsg");
				if (url == "../luck/luck" && this.userMsg.wylqPower == 0) {
					uni.showModal({
						content: "购买 中医时间医学·火病原理 后方可使用此功能",
						confirmText: "好的",
						showCancel: false,
						success: function(res) {
							if (res.confirm) {}
						},
					});
					return;
				}
				uni.navigateTo({
					url: url,
				});
			},

			onPageJumpData(url, data) {
				uni.navigateTo({
					url: url + "?id=" + data,
				});
			},

			onTabJump(url) {
				uni.switchTab({
					url: url,
				});
			},

			onGoing() {
				uni.showToast({
					icon: "none",
					title: "开发中，敬请期待...",
				});
			},

			// 电子书内容跳转
			onBookJump(e) {
				uni.navigateTo({
					url: "../eBook/bookContent?Id=" + e.bookid,
				});
			},
			// 商品详情页
			goDetail(id) {
				uni.navigateTo({
					url: "../bookShop/commodityDetail?id=" + id,
				});
			},

			// 列表跳页
			onShopMore(e) {
				uni.navigateTo({
					url: "../bookShop/bookShopType?type=" + e,
				});
			},

			// 三个列表跳页
			onBookMore(e) {
				uni.navigateTo({
					url: "../eBook/bookType?Type=" + e,
				});
			},
			appjumpfun(name) {
				let bagName = "";
				let schemes = "";
				if (name == "zmzm") {
					bagName = "com.cn.zmzm";
					schemes = "zmzm";
				}
				if (name == "soulspace") {
					bagName = "com.nuttyreading.soul";
					schemes = "soulspace";
				}
				if (name == "wumen") {
					bagName = "com.cn.medicine";
					schemes = "medicine";
				}
				if (name == "taihu") {
					bagName = "com.cn.taimed";
					schemes = "taimed";
				}
				
				if (plus.os.name == "Android") {
					//安卓
					if (
						plus.runtime.isApplicationExist({
							//查看安卓系统手机有没有下载这款app
							pname: bagName, //B款app云打包的包名
						})
					) {
						//安装了app
						plus.runtime.launchApplication({
							//打开app
							pname: bagName, //B款app云打包的包名
							extra: {
								url: `${schemes}://${bagName}`, //B款app配置的schemes+云打包的包名
							},
							function(e) {
								console.log("Open system default browser failed: " + e.message);
							},
						});
					} else {
						//未安装app
						plus.runtime.openURL(
							`https://a.app.qq.com/o/simple.jsp?pkgname=${bagName}`,
							function(res) {
								//进入后台小哥哥给我的应用宝下载链接，让你们后台给你
								//这链接会判断你手机是ios还是Android，Android进入应用宝下载app
								//跟下面的是一个链接
								console.log(res);
							}
						);
					}
				} else if (plus.os.name == "iOS") {
					//苹果
					//因为ios查不到B款app在ios系统手机里面，其实下载了，也是检测不到，所以就不检测了
					//直接打开B款app，B款app没有的话，会进入回调报错，我们在回调去打开下载链接
					plus.runtime.launchApplication({
							action: "${schemes}://",
						},
						function(e) {
							plus.runtime.openURL(
								`https://a.app.qq.com/o/simple.jsp?pkgname=${bagName}`,
								function(res) {
									//进入后台小哥哥给我的appStore下载app链接，，让你们后台给你
									//这链接会判断你手机是ios还是Android，ios进入应用宝下载app
									//跟上面的是一个链接
									console.log(res);
								}
							);
						}
					);
				}
			},
		},
	};
</script>
<style lang="scss" scoped>
	@import "@/style/mixin.scss";

	.appJump {
		position: fixed;
		right: 0;
		top: 120rpx;
		z-index: 1;

		.item {
			background: rgba(255, 255, 255, 0.9);
			margin-bottom: 10rpx;
			border: 1px solid #fff;
			align-items: center;
			padding-right: 10rpx;
			overflow: hidden;
			border-radius: 50rpx 0 0 50rpx;
			
			text {
			  font-size: 20rpx;
			  padding-left: 3rpx;
			}

			.img {
				padding: 6rpx;
				overflow: hidden;

				image {
					width: 36rpx;
					height: 36rpx;
					border-radius: 100%;
				}
			}
		}
	}

	.newsBox {
		justify-content: space-between;
		background-color: #fff;
		margin-top: 10px;
		overflow: hidden;
		border-radius: 20rpx;
		padding: 10rpx;
		overflow: hidden;
		margin-bottom: 10px;

		.content {
			image {
				max-width: 100% !important;
			}
		}

		.icon {
			width: 44rpx;
		}

		.newscoll {
			overflow: hidden;
			width: calc(100% - 60rpx);
			height: 40rpx;
			border: #11a669;
			line-height: 50rpx;

			.item {
				.swiper-item {
					font-size: 28rpx;
					@include toe();
				}
			}
		}
	}

	.yxTagBox {}

	.children_cate_box {
		padding: 0 10px;
	}

	.children_cate {
		border-radius: 5px;
		justify-content: space-evenly;

		background-color: #eee;
		display: flex;
		justify-items: normal;
		padding-top: 12rpx;
		overflow: hidden;
		padding-bottom: 10rpx;

		.item {
			width: 100%;
			text-align: center;
			align-items: center;
			border-right: 1px solid #acacac33;
			font-size: 30rpx;

			color: #333;
			// border-radius: 10rpx;
		}

		.item:last-child {
			margin-right: 0;
			border-right: none;
		}

		.cur {
			color: #55aa7f;
			font-weight: bold;
			border-radius: 5rpx;
		}
	}

	.fiveIcon {
		justify-content: space-between;
		text-align: center;

		text {
			font-size: 28rpx;
			color: #11a669;
		}

		image {
			width: 56rpx;
			height: 56rpx;
			margin: 0 auto;
		}
	}

	.hehan {
		width: 80%;
		margin: 10rpx auto;
	}

	.zhekou {
		.goodsName {
			margin-bottom: 20rpx;
		}
	}

	.activityPrice {
		font-size: 60rpx;
	}

	.priceAndnum {
		font-size: 24rpx !important;

		.price {
			color: #9b9b9b !important;
			font-size: inherit;
			font-weight: normal !important;
			display: block;
		}
	}

	.ProTabs {
		// margin: 20rpx 0;
		padding: 0 10px;
		align-items: center;

		text {
			padding: 8rpx 14rpx;
			font-size: 32rpx;
			display: inline-block;
			border-radius: 10rpx;
			overflow: hidden;
			background-color: #dfeae2;
			color: #0e583a;
			font-weight: bold;
			margin-right: 10rpx;
			display: block;
			width: 100%;
			text-align: center;
		}

		text.cur {
			background-color: #55aa7f;
			color: #fff;
		}

		text:last-child {
			margin-right: 0;
		}
	}

	.ProTabsBox {
		margin-top: 10px;
		padding-bottom: 3px;
	}

	.New_ProTabs {
		justify-content: space-between;
		background-color: #fff;
		padding-left: 10px;
		padding-right: 10px;

		text {
			// max-width: 12.5%;
			background-color: #dfeae2;
			color: #0e583a;
			font-size: 34rpx;
			line-height: 42rpx;
			padding: 5px 10px;
			font-weight: bold;
			display: block;
			width: 100%;
			margin-right: 5px;
			border-radius: 10rpx;
			overflow: hidden;
			text-align: center;
			letter-spacing: 10rpx;
		}

		text:last-child {
			margin-right: 0;
		}

		text.cur {
			background-color: #55aa7f;
			color: #fff;
		}
	}

	.wzProTabs {
		display: flex;
		justify-content: center;
		padding: 0 20rpx;

		text {
			padding: 8rpx 14rpx;
			font-size: 32rpx;
			display: inline-block;
			border-radius: 10rpx;
			overflow: hidden;
			// background-color: #eee;
			color: #55aa7f;
			margin-right: 10rpx;
		}

		text.cur {
			background-color: #55aa7f;
			color: #fff;
		}
	}

	// .newBook{margin-top: 10rpx;}
	.scroll-view_H {
		background-color: #fff;
		white-space: nowrap;
		padding: 10px;
		margin-top: 12rpx;
	}

	.scroll-view_H {
		.item {
			padding: 10rpx;
			overflow: hidden;
			display: inline-block;
			padding-bottom: 0;
			width: 180rpx !important;
			margin-right: 20rpx;
			border-radius: 10rpx;

			.videoBox {
				image {
					display: block;
					width: 150rpx;
					height: 170rpx;
				}
			}

			.bookName {
				display: block;
				margin-top: 6rpx;
				color: #666;
				font-size: 24rpx;
				white-space: nowrap;
				overflow-x: hidden;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}

		// .item.active{margin-right: 20rpx; border: 1px solid #55aa00;  border-radius: 10rpx;}
	}

	.flexbox {
		display: flex;
	}

	.head_line {
		padding-top: 8rpx;
		margin: 12rpx 0 0 0;

		b {
			display: inline-block;
			width: 12rpx;
			height: 40rpx;
			background-color: #54a966;
			vertical-align: bottom;
			margin: 0 20rpx 0 0;
		}

		text {
			font-size: 32rpx;
			font-weight: bold;
		}

		i {
			float: right;
			font-style: normal;
			color: #8b8a91;
			font-size: 24rpx;
			margin: 5rpx 35rpx 0 0;
		}
	}

	.home_bg {
		background-image: url("@/static/icon/home_bg.jpg");
		background-position: center center;
		background-repeat: no-repeat;
		background-size: cover;
		padding: 20rpx;
		position: relative;

		// margin-bottom:60rpx;
		// height: 400rpx; margin-bottom: 130rpx;
		.icon_hua_1 {
			// margin: 0 auto;
			width: 100%;
			text-align: center;
			height: 80rpx;

			image {
				width: 150rpx;
				height: 80rpx;
			}
		}

		.icon_hua {
			width: 100%;
			text-align: center;
			display: block;

			image {
				width: 150rpx;
				height: 150rpx;
				margin: 0 auto;
			}
		}
	}

	.search_box {
		margin: 20rpx auto 10rpx auto;
		align-items: center;
		width: calc(100% - 40rpx);
		margin-bottom: 20rpx;

		.search {
			height: 56upx;
			display: flex;
			width: 100%;
			margin: 0 auto;
			align-items: center;
			padding: 0upx 40upx;
			background-color: #fff;
			border-radius: 20upx;
			box-shadow: 0 0px 10px 1px #54a96633;
		}

		.prompt {
			color: #838383;
			font-size: 24rpx;
		}

		.icon_search {
			background-image: url("@/static/icon/map_ic_search.png");
			background-position: center center;
			background-repeat: no-repeat;
			background-size: cover;
			width: 36upx;
			height: 36upx;
			margin-right: 20upx;
		}

		.searBtn {
			// width: 180rpx;
			width: calc(100% - 75% + 12px);
			line-height: 56rpx;
			text-align: center;
			align-items: center;
			font-size: 28rpx;
			color: #fff;
			margin-left: -80rpx;
			background-color: #11a669;
			border-top-right-radius: 20upx;
			border-bottom-right-radius: 20upx;
		}
	}

	.home_nar {
		background-color: #fff;
		padding: 26rpx 10rpx;
		justify-content: space-between;
		display: flex;
		color: #333;
		margin-bottom: 0;

		// .dianzishu{  margin-right:10rpx;
		// 	background-color:#f8d6f4 ;  border: 2px solid #edcce9;
		// }
		// .chaoshi{background-color:#fff2d8 ;  border: 2px solid #ede6d3;	}
		// .shuping{ background-color: #d6ffda; border: 2px solid #bae9bf;}
		// .shuguan{ background-color:#e3f9f9 ;  border: 2px solid #d7eced; }
		.hn_cl_tit {
			// width: 23%;
			width: 31%;
			text-align: center;
			border-radius: 20rpx;
			// line-height: 110upx;
			//display: flex;
			align-content: center;
			justify-content: center;

			image {
				width: 120rpx;
				height: 120rpx;
				display: block;
				margin: 0 auto;
				// margin: 0 20rpx;
			}

			text {
				display: block;
				text-align: center;
				margin-top: 4rpx;
				font-size: 36rpx;
				color: #000;
				font-weight: blod;
			}
		}
	}

	.home_lunbo {
		margin: 40rpx 30rpx 0 30rpx;
	}

	.home_shujia {
		margin: 40rpx 20rpx 0 20rpx;
		display: flex;
		color: #333;

		.hn_sj {
			width: 20%;
			text-align: center;
			font-size: 26upx;

			image {
				width: 100upx;
				height: 100upx;
				margin: 0 auto;
			}
		}
	}

	.home_xinshu {
		margin: 35rpx 30rpx;
		padding: 36rpx 16rpx 0 16rpx;
		background-color: #fff;
		border-radius: 30rpx;

		.hx_list {
			margin: 0 15rpx 20rpx 15rpx;
			text-align: center;
			width: 28.5%;
			float: left;
			position: relative;

			image {
				width: 100%;
				height: 290upx;
				margin: 0 0 20rpx 0;
			}

			.hx_title {
				font-size: 28rpx;
				margin: 0 0 10rpx 0;
				font-weight: bold;
			}

			.hx_author {
				font-size: 24rpx;
				margin: 0 0 20rpx 0;
				color: #9b9b9b;
			}

			b {
				display: block;
				padding: 5rpx 10rpx;
				border-radius: 10rpx;
				text-align: center;
				color: #fff;
				font-weight: normal;
				background: #27b386;
				position: absolute;
				left: -10upx;
				top: 10upx;
				font-size: 16rpx;
			}
		}
	}

	.home_limit {
		margin: 35rpx 0;
		padding: 36rpx 0 20rpx 0;
		background-color: #fff;

		.lt_list {
			margin: 0 35rpx 0 0;
			text-align: center;
			position: relative;

			image {
				width: 200upx;
				height: 280upx;
				margin: 0 0 20rpx 0;
			}

			.lt_title {
				font-size: 28rpx;
				margin: 0 0 10rpx 0;
				font-weight: bold;
			}

			.lt_author {
				font-size: 24rpx;
				margin: 0 0 20rpx 0;
				color: #9b9b9b;
			}

			.lt_yuan {
				text-decoration: line-through;
				color: #c1c1c1;
				margin: 0 0 5rpx 0;
			}

			.lt_xian {
				color: #bf0c0c;
				font-weight: bold;
			}

			b {
				display: block;
				padding: 5rpx 10rpx;
				border-radius: 10rpx;
				text-align: center;
				color: #fff;
				font-weight: normal;
				background: #27b386;
				position: absolute;
				left: -10upx;
				top: 10upx;
				font-size: 16rpx;
			}
		}

		.lt_list:nth-child(1) {
			margin-left: 30rpx;
		}

		.lt_list:nth-last-child(1) {
			padding-right: 30rpx;
		}
	}

	.home_jingxu {
		margin: 60rpx 30rpx 0 30rpx;

		.hj_hot {
			box-shadow: 0 0px 10px 1px #56565633;
			background-color: #fff;
			position: relative;
			padding: 20upx 220upx 10upx 25upx;
			margin: 0 0 60rpx 0;
			border-radius: 15rpx;
			min-height: 230rpx;

			view {
				margin: 0 0 10rpx 0;

				text {
					color: #9b9b9b;
					font-size: 24rpx;
					line-height: 36rpx;
				}

				.bok_name {
					font-weight: bold;
					color: #333;
					font-size: 28rpx;
				}
			}

			image {
				position: absolute;
				right: 30upx;
				top: -30upx;
				width: 160upx;
				height: 240upx;
			}

			b {
				display: block;
				padding: 5rpx 10rpx;
				border-radius: 10rpx;
				text-align: center;
				color: #fff;
				font-weight: normal;
				background: #27b386;
				position: absolute;
				right: 150upx;
				top: -20upx;
				font-size: 16rpx;
			}
		}
	}

	.limited {
		width: 100%;
		height: auto;
		padding: 20rpx 10rpx 10rpx 10rpx;
		display: flex;
		align-items: center;
		background-color: #fff;
		margin-top: 50rpx;

		.limitedSymbol {
			width: 22%;
			height: 300rpx;
			border-right: 1px solid #eee;
			vertical-align: middle;

			image {
				width: 120rpx;
				height: 120rpx;
				margin: 45px auto 0 auto;
			}
		}

		.limitedScrollBox {
			width: 76%;
			padding: 0 10rpx;
		}

		.limitedItem {
			width: 200rpx;
			text-align: center;

			image {
				width: 150upx;
				height: 200upx;
				margin: 15rpx auto 20rpx auto;
			}

			text {
				font-size: 20rpx;
				display: block;
			}

			.biaoti {
				font-size: 30rpx;
				margin: 10rpx 0 10rpx 0;
				font-weight: bold;
			}

			.xian {
				font-size: 32rpx;
				color: #bf0c0c;
				font-weight: bold;
			}

			.yuan {
				text-decoration: line-through;
				color: #c1c1c1;
			}
		}
	}

	.goods {
		width: 100%;
		margin: 0 0 50rpx 0;
		background-color: #fff;
		margin-top: 10rpx;

		.goodsItem {
			display: inline-block;
			width: 46%;
			border-radius: 20rpx;
			padding: 20rpx;
			padding-bottom: 5rpx;
			margin: 0 20rpx 20rpx 20rpx;
			background-color: #fff;
			border: 1px solid #eee;

			.goodsImg {
				width: 98%;
				height: 380rpx;
				border-radius: 10rpx;
			}

			.goodsContent {
				.goodsName {
					margin-top: 10rpx;
					font-size: 26rpx;
					// font-weight: bold;
				}

				.goodsPrice {
					font-size: 28rpx;
					margin: 5rpx 0 0 3rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.price {
						font-weight: bold;
						color: #ff0000;
					}

					.Salesnum {
						color: #9b9b9b;
						font-size: 24rpx;
					}
				}
			}
		}

		.goodsItem:nth-child(2n) {
			margin-left: 0;
		}
	}
</style>