<template>
	<view>
		<view class="order_nav">
			<scroll-view class="scroll-view_H" scroll-x="true" :show-scrollbar="false">
				<view :class="scroll_active==index?'scroll_active':''" v-for="(item,index) in scrollList"
					@click="scrollChange(index)" :key="index">{{item.text}}</view>
			</scroll-view>
		</view>

		<view class="body">

			<!-- 全部订单 -->
			<template v-if="isList==true && scroll_active==0">
				<view class="" v-for="(item,idnex) in orderList" :key="item.order_id">
					<view class="order" @click="goDetails(item,item.order_id)">
						<view class="order_title">
							<!-- 待支付订单 -->
							<text v-if="item.pay_status_code==0 && item.order_status_code==0">Waiting for payment</text>
							<!-- 已取消订单 -->
							<text v-else-if="item.order_status_code==2">cancelled</text>
							<!-- 待发货订单 -->
							<text v-else-if="item.pay_status_code==2 && item.shipping_status_code==0">To be
								shipped</text>
							<!-- 运输中订单 -->
							<text
								v-else-if="item.pay_status_code==2 && item.shipping_status_code==1 || item.shipping_status_code==4">Shipped</text>
							<!-- 已完成订单 -->
							<text v-else-if="item.pay_status_code==2 && item.shipping_status_code==2">Completed</text>

							<view class="order_title_right">
								<text>order#{{item.order_sn}}</text>
								<image src="../../static/img/right.png" mode=""></image>
							</view>
						</view>
						<view class="order_content">
							<template v-if="item.order_goods.length==1">
								<view class="good_info" v-for="(item1,index1) in item.order_goods" :key="index1"
									@click.stop="goGoodsDetails(item1.goods_id)">
									<view class="good_info_left ">
										<view class="good_info_image">
											<image :src="item1.goods_img" mode=""></image>
										</view>
										<view class="left_info">
											<view class="info_name">{{item1.goods_name}}</view>
											<view class="left_info_bottom">
												<view class="info_lable" v-if="item1.goods_attr">
													<text>{{item1.goods_attr |goodsAttr}}</text>
													<!-- 	<image src="/static/img/bottom.png" mode=""></image> -->
												</view>
												<text>×{{item1.goods_number}}</text>
											</view>
										</view>
									</view>
								</view>
							</template>
							<template v-else>
								<view class="good_info" @click.stop="showGoods(item.order_goods,1)">
									<view class="good_info_left">
										<view class="good_info_image" v-for="(item1,index1) in item.order_goods"
											:key="index1">
											<image :src="item1.goods_img" mode=""></image>
										</view>
									</view>
									<view class="good_info_right">
										<text>{{item.order_goods.length}} ltems</text>
										<image src="../../static/img/right.png" mode=""></image>
									</view>
								</view>
							</template>


							<view class="good_price">total:US${{item.total_fee_o}}</view>
							<!-- <view class="good_points" v-if="item.pay_status_code==0 && item.order_status_code==0">
								<image src="/static/img/gantan1.png" mode=""></image>
								<text>Reward 10 points</text>
							</view> -->
							<view class="order_button">
								<!-- 待支付订单 -->
								<template v-if="item.pay_status_code==0 && item.order_status_code==0">
									<button class="cancel" @click.stop="openTips(item.order_id,0)">CANCEL ORDER</button>
									<button class="pay" @click.stop="payNow(item.order_id,0)">PAY NOW</button>
								</template>
								<!-- 已取消订单 -->
								<button v-if="item.order_status_code==2" class="cancel"
									@click.stop="openTips(item.order_id,1)">DELETE ORDER</button>
								<!-- 待发货订单 -->
								<template
									v-if="item.pay_status_code==2 && item.shipping_status_code==1 || item.shipping_status_code==4">
									<button class="cancel" @click.stop="goLogistics(item.order_id)">LOGISTICS</button>
									<button class="pay" @click.stop="openTips(item.order_id,2)">CONFIRM RECEIPT</button>
								</template>
								<!-- 已完成订单 -->
								<template v-if="item.pay_status_code==2 && item.shipping_status_code==2">
									<button class="cancel" @click.stop="goLogistics(item.order_id)">LOGISTICS</button>
									<button class="cancel" @click.stop="openTips(item.order_id,1)">DELETE ORDER</button>
									<button class="pay" @click.stop="goComment(item)"
										v-if="item.comment_status_code==0">COMMENT</button>
								</template>
							</view>
						</view>
					</view>
				</view>


			</template>
			<!-- 待支付订单 -->
			<template v-if="isList==true && scroll_active==1">
				<view class="" v-for="(item,idnex) in orderList" :key="item.order_id">
					<view class="order" @click="goDetails(item,item.order_id)"
						v-if="item.pay_status_code==0 && item.order_status_code==0">
						<view class="order_title">
							<text>Waiting for payment</text>
							<view class="order_title_right">
								<text>order#{{item.order_sn}}</text>
								<image src="../../static/img/right.png" mode=""></image>
							</view>
						</view>
						<view class="order_content">
							<template v-if="item.order_goods.length==1">
								<view class="good_info" v-for="(item1,index1) in item.order_goods" :key="index1"
									@click.stop="goGoodsDetails(item1.goods_id)">
									<view class="good_info_left ">
										<view class="good_info_image">
											<image :src="item1.goods_img" mode=""></image>
										</view>
										<view class="left_info">
											<view class="info_name">{{item1.goods_name}}</view>
											<view class="left_info_bottom">
												<view class="info_lable" v-if="item1.goods_attr ">
													<text>{{item1.goods_attr |goodsAttr}}</text>
													<!-- <image src="/static/img/bottom.png" mode=""></image> -->
												</view>
												<text>×{{item1.goods_number}}</text>
											</view>
										</view>
									</view>
								</view>
							</template>
							<template v-else>
								<view class="good_info" @click.stop="showGoods(item.order_goods,1)">
									<view class="good_info_left">
										<view class="good_info_image" v-for="(item1,index1) in item.order_goods"
											:key="index1">
											<image :src="item1.goods_img" mode=""></image>
										</view>
									</view>
									<view class="good_info_right">
										<text>{{item.order_goods.length}} ltems</text>
										<image src="../../static/img/right.png" mode=""></image>
									</view>
								</view>
							</template>
							<view class="good_price">total:US${{item.total_fee_o}}</view>
							<!-- <view class="good_points" v-if="item.pay_status_code==0 && item.order_status_code==0">
								<image src="/static/img/gantan1.png" mode=""></image>
								<text>Reward 10 points</text>
							</view> -->
							<view class="order_button">
								<button class="cancel" @click.stop="openTips(item.order_id,0)">CANCEL ORDER</button>
								<button class="pay" @click.stop="payNow(item.order_id,0)">PAY NOW</button>
							</view>
						</view>
					</view>

				</view>


			</template>

			<!-- 待发货订单 -->
			<template v-if="isList==true && scroll_active==2">
				<view v-for="(item,idnex) in orderList" :key="item.order_id">
					<view class="order" v-if="item.pay_status_code==2 && item.shipping_status_code==0"
						@click="goDetails(item,item.order_id)">
						<view class="order_title">
							<text>To be shipped</text>
							<view class="order_title_right">
								<text>order#{{item.order_sn}}</text>
								<image src="../../static/img/right.png" mode=""></image>
							</view>
						</view>
						<view class="order_content">
							<template v-if="item.order_goods.length==1">
								<view class="good_info" v-for="(item1,index1) in item.order_goods" :key="index1"
									@click.stop="goGoodsDetails(item1.goods_id)">
									<view class="good_info_left ">
										<view class="good_info_image">
											<image :src="item1.goods_img" mode=""></image>
										</view>
										<view class="left_info">
											<view class="info_name">{{item1.goods_name}}</view>
											<view class="left_info_bottom">
												<view class="info_lable" v-if="item1.goods_attr">
													<text>{{item1.goods_attr |goodsAttr}}</text>
													<!-- <image src="/static/img/bottom.png" mode=""></image> -->
												</view>
												<text>×{{item1.goods_number}}</text>
											</view>
										</view>
									</view>
								</view>
							</template>
							<template v-else>
								<view class="good_info" @click.stop="showGoods(item.order_goods,1)">
									<view class="good_info_left">
										<view class="good_info_image" v-for="(item1,index1) in item.order_goods"
											:key="index1">
											<image :src="item1.goods_img" mode=""></image>
										</view>
									</view>
									<view class="good_info_right">
										<text>{{item.order_goods.length}} ltems</text>
										<image src="../../static/img/right.png" mode=""></image>
									</view>
								</view>
							</template>
							<view class="good_price">total:US${{item.total_fee_o}}</view>
						</view>
					</view>
				</view>


			</template>
			<!-- 运输中订单 -->
			<template v-if="isList==true && scroll_active==3">
				<view v-for="(item,idnex) in orderList" :key="item.order_id">
					<view class="order"
						v-if="item.pay_status_code==2 && item.shipping_status_code==1 || item.shipping_status_code==4"
						@click="goDetails(item,item.order_id)">
						<view class="order_title">
							<text>Shipped</text>
							<view class="order_title_right">
								<text>order#{{item.order_sn}}</text>
								<image src="../../static/img/right.png" mode=""></image>
							</view>
						</view>
						<view class="order_content">
							<template v-if="item.order_goods.length==1">
								<view class="good_info" v-for="(item1,index1) in item.order_goods" :key="index1"
									@click.stop="goGoodsDetails(item1.goods_id)">
									<view class="good_info_left ">
										<view class="good_info_image">
											<image :src="item1.goods_img" mode=""></image>
										</view>
										<view class="left_info">
											<view class="info_name">{{item1.goods_name}}</view>
											<view class="left_info_bottom">
												<view class="info_lable">
													<text>{{item1.goods_attr |goodsAttr}}</text>
													<!-- <image src="/static/img/bottom.png" mode=""></image> -->
												</view>
												<text>×{{item1.goods_number}}</text>
											</view>
										</view>
									</view>
								</view>
							</template>
							<template v-else>
								<view class="good_info" @click.stop="showGoods(item.order_goods,1)">
									<view class="good_info_left">
										<view class="good_info_image" v-for="(item1,index1) in item.order_goods"
											:key="index1">
											<image :src="item1.goods_img" mode=""></image>
										</view>
									</view>
									<view class="good_info_right">
										<text>{{item.order_goods.length}} ltems</text>
										<image src="../../static/img/right.png" mode=""></image>
									</view>
								</view>
							</template>
							<view class="good_price">total:US${{item.total_fee_o}}</view>
							<view class="order_button">
								<button class="cancel" @click.stop="goLogistics(item.order_id)">LOGISTICS</button>
								<button class="pay" @click.stop="openTips(item.order_id,2)">CONFIRM RECEIPT</button>
							</view>
						</view>
					</view>
				</view>


			</template>
			<!-- 已完成订单 -->
			<template v-if="isList==true && scroll_active==5">
				<view class="" v-for="(item,idnex) in orderList" :key="item.order_id">
					<view class="order " v-if="item.pay_status_code==2 && item.shipping_status_code==2"
						@click="goDetails(item,item.order_id)">
						<view class="order_title">
							<text>Completed</text>
							<view class="order_title_right">
								<text>order#{{item.order_sn}}</text>
								<image src="../../static/img/right.png" mode=""></image>
							</view>
						</view>
						<view class="order_content">
							<template v-if="item.order_goods.length==1">
								<view class="good_info" v-for="(item1,index1) in item.order_goods" :key="index1"
									@click.stop="goGoodsDetails(item1.goods_id)">
									<view class="good_info_left ">
										<view class="good_info_image">
											<image :src="item1.goods_img" mode=""></image>
										</view>
										<view class="left_info">
											<view class="info_name">{{item1.goods_name}}</view>
											<view class="left_info_bottom">
												<view class="info_lable" v-if="item1.goods_attr">
													<text>{{item1.goods_attr |goodsAttr}}</text>
													<!-- <image src="/static/img/bottom.png" mode=""></image> -->
												</view>
												<text>×{{item1.goods_number}}</text>
											</view>
										</view>
									</view>
								</view>
							</template>
							<template v-else>
								<view class="good_info" @click.stop="showGoods(item.order_goods,1)">
									<view class="good_info_left">
										<view class="good_info_image" v-for="(item1,index1) in item.order_goods"
											:key="index1">
											<image :src="item1.goods_img" mode=""></image>
										</view>
									</view>
									<view class="good_info_right">
										<text>{{item.order_goods.length}} ltems</text>
										<image src="../../static/img/right.png" mode=""></image>
									</view>
								</view>
							</template>
							<view class="good_price">total:US${{item.total_fee_o}}</view>
							<view class="order_button">
								<button class="cancel" @click.stop="goLogistics(item.order_id)">LOGISTICS</button>
								<button class="cancel" @click.stop="openTips(item.order_id,1)">DELETE ORDER</button>
								<button class="pay" @click.stop="goComment(item)"
									v-if="item.comment_status_code==0">COMMENT</button>
							</view>
						</view>
					</view>
				</view>


			</template>
			<!-- 退换货订单 -->
			<template v-if="isList==true && scroll_active==4">
				<view class="" v-for="(item,idnex) in orderList" :key="item.order_id">
					<view class="order" v-if="item.order_status_code==4" @click="goDetails(item,item.order_id)">
						<view class="order_title">
							<text>Return and exchange</text>
							<view class="order_title_right">
								<text>order#{{item.order_sn}}</text>
								<image src="../../static/img/right.png" mode=""></image>
							</view>
						</view>
						<view class="order_content">
							<template v-if="item.order_goods.length==1">
								<view class="good_info" v-for="(item1,index1) in item.order_goods" :key="index1"
									@click.stop="goGoodsDetails(item1.goods_id)">
									<view class="good_info_left ">
										<view class="good_info_image">
											<image :src="item1.goods_img" mode=""></image>
										</view>
										<view class="left_info">
											<view class="info_name">{{item1.goods_name}}</view>
											<view class="left_info_bottom">
												<view class="info_lable" v-if="item1.goods_attr">
													<text>{{item1.goods_attr |goodsAttr}}</text>
													<!-- <image src="/static/img/bottom.png" mode=""></image> -->
												</view>
												<text>×{{item1.goods_number}}</text>
											</view>
										</view>
									</view>
								</view>
							</template>
							<template v-else>
								<view class="good_info" @click.stop="showGoods(item.order_goods,1)">
									<view class="good_info_left">
										<view class="good_info_image" v-for="(item1,index1) in item.order_goods"
											:key="index1">
											<image :src="item1.goods_img" mode=""></image>
										</view>
									</view>
									<view class="good_info_right">
										<text>{{item.order_goods.length}} ltems</text>
										<image src="../../static/img/right.png" mode=""></image>
									</view>
								</view>
							</template>
							<view class="good_price">total:US${{item.total_fee_o}}</view>
							<view class="order_button">
								<button class="pay">CANCEL RETURN</button>
							</view>
						</view>
					</view>
				</view>


			</template>
			<!-- 已取消订单 -->
			<template v-if="isList==true && scroll_active==6">
				<view class="" v-for="(item,idnex) in orderList" :key="item.order_id">
					<view class="order" v-if="item.order_status_code==2" @click="goDetails(item,item.order_id)">
						<view class="order_title">
							<text>cancelled</text>
							<view class="order_title_right">
								<text>order#{{item.order_sn}}</text>
								<image src="../../static/img/right.png" mode=""></image>
							</view>
						</view>
						<view class="order_content">
							<template v-if="item.order_goods.length==1">
								<view class="good_info" v-for="(item1,index1) in item.order_goods" :key="index1"
									@click.stop="goGoodsDetails(item1.goods_id)">
									<view class="good_info_left ">
										<view class="good_info_image">
											<image :src="item1.goods_img" mode=""></image>
										</view>
										<view class="left_info">
											<view class="info_name">{{item1.goods_name}}</view>
											<view class="left_info_bottom">
												<view class="info_lable" v-if="item1.goods_attr">
													<text>{{item1.goods_attr |goodsAttr}}</text>
													<!-- <image src="/static/img/bottom.png" mode=""></image> -->
												</view>
												<text>×{{item1.goods_number}}</text>
											</view>
										</view>
									</view>
								</view>
							</template>
							<template v-else>
								<view class="good_info" @click.stop="showGoods(item.order_goods,1)">
									<view class="good_info_left">
										<view class="good_info_image" v-for="(item1,index1) in item.order_goods"
											:key="index1">
											<image :src="item1.goods_img" mode=""></image>
										</view>
									</view>
									<view class="good_info_right">
										<text>{{item.order_goods.length}} ltems</text>
										<image src="../../static/img/right.png" mode=""></image>
									</view>
								</view>
							</template>
							<view class="good_price">total:US${{item.total_fee_o}}</view>
							<view class="order_button">
								<button class="cancel" @click.stop="openTips(item.order_id,1)">DELETE ORDER</button>
							</view>
						</view>
					</view>
				</view>


			</template>
			<template v-if="isList==false">
				<view class="order1">
					<image src="../../static/img/order_nodate.png" mode=""></image>
					<text>You made no order yet!</text>
					<navigator url="/pages/category/index" open-type="switchTab">
						<button>Continue shopping</button>
					</navigator>
				</view>
			</template>
		</view>


		<view class="mask" v-show="isShow" @click="isShow=false"></view>
		<!-- 支付 -->
		<view class="order_popup" v-if="isShow && showType==0">
			<view class="order_popup_title">
				<text>
					Payment Method
				</text>
				<image src="../../static/img/close1.png" mode="" @click="isShow=false"></image>
			</view>
			<view class="order_popup_pay">
				<view class="pay_item" @click="selectPay(0)">
					<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==0">
					</image>
					<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
					<view class="pay_item_right">
						<image src="../../static/img/pay_pal.png" mode=""></image>
						<text>Pay Pal</text>
					</view>
				</view>
				<view class="pay_item" @click="selectPay(1)">
					<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==1">
					</image>
					<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
					<view class="pay_item_right">
						<image src="../../static/img/card.png" mode=""></image>
						<text>Credit/Debit Card</text>
					</view>
				</view>
				<!--<view class="pay_item" @click="selectPay(2)">
					<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==2"></image>
					<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
					<view class="pay_item_right">
						<image src="../../static/img/GPay.png" mode=""></image>
						<text>Google Pay</text>
					</view>
				</view>
				<view class="pay_item" @click="selectPay(3)">
					<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==3"></image>
					<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
					<view class="pay_item_right">
						<image src="../../static/img/APay.png" mode=""></image>
						<text>Apple pay</text>
					</view>
				</view> -->
				<button @click="getPayDate">PAY NOW</button>
			</view>
		</view>
		<!-- 商品信息 -->
		<view class="order_popup" v-show="isShow && showType==1">
			<view class="order_popup_title">
				<text>Commodity information</text>
				</text>
				<image src="../../static/img/close1.png" mode="" @click="isShow=false"></image>
			</view>
			<view class="order_popup_commodity">
				<view class="good_info padding_left " v-for="(item,index) in goods_list " :key="index"
					@click.stop="goGoodsDetails(item.goods_id)">
					<view class="good_info_left ">
						<view class="good_info_image img_border">
							<image :src="item.goods_img" mode="" class="img_border"></image>
						</view>
						<view class="left_info">
							<view class="info_name">{{item.goods_name}}</view>
							<view class="left_info_bottom">
								<view class="info_lable" v-if="item.goods_attr">
									<text>{{item.goods_attr |goodsAttr}}</text>
									<!-- <image src="/static/img/bottom.png" mode=""></image> -->
								</view>
								<text>x{{item.goods_number}}</text>
							</view>
							<view class="info_price">US${{item.goods_price}}</view>
						</view>
					</view>
				</view>

			</view>
		</view>
		<!-- 删除、取消弹框 -->
		<uni-popup ref="alertDialog" type="dialog">
			<uni-popup-dialog type="error" cancelText="Close" :confirmText="tipsBut" title="Tips" :content="tipsInfo"
				@confirm="dialogConfirm"></uni-popup-dialog>
		</uni-popup>

	</view>
</template>

<script>
	import {
		defaultRequest2
	} from '../../api/index.js'
	export default {
		data() {
			return {
				scrollList: [{
					text: 'All'
				}, {
					text: 'Unpaid'
				}, {
					text: 'Processing'
				}, {
					text: 'Shipped'
				}, {
					text: 'Completed'
				}, {
					text: 'Closed'
				}],
				scroll_active: 0,
				isList: true,
				orderList: [],
				isShow: false,
				// 显示状态 0 为支付 1为商品列表
				showType: 0,
				payQuery: {
					_action: 'payorder',
					order_id: '',
					order_type: 'GOODSBUY',
					payment_method: 'alipay.native'
				},
				pay_index: 0,
				cancelQuery: {
					_action: 'cancelorder',
					order_id: ''
				},
				// 弹出提示框的状态 0：取消订单 1、删除订单 2、确认收货
				tipsType: 0,
				tipsInfo: '',
				tipsBut: '',
				goods_list: [],
				query: {
					_action: 'getuserorders',
					page_index: 1,
					page_size: 10,
					payingstatus: '',
					status: '',
					shippingstatus: ''
				}
			}
		},
		methods: {
			// 跳转商品详情
			goGoodsDetails(id) {
				uni.navigateTo({
					url: '/pages/productDetails/index?goodid=' + id
				})
			},
			// 跳转评论页面
			goComment(item) {
				uni.navigateTo({
					url: '../productDetails/review?data=' + JSON.stringify(item)
				})
			},
			showGoods(goodsList, type) {
				this.isShow = true
				this.showType = type
				this.goods_list = goodsList
			},
			// 查看物流
			goLogistics(id) {
				uni.navigateTo({
					url: '../order/logisticsDetails?order_id=' + id
				})
			},
			// 订单详情
			goDetails(item, id) {
				let index
				if (item.pay_status_code == 0 && item.order_status_code == 0) {
					index = 0
				} else if (item.order_status_code == 2) {
					index = 4
				} else if (item.pay_status_code == 2 && item.shipping_status_code == 0) {
					index = 1
				} else if (item.pay_status_code == 2 && item.shipping_status_code == 1 || item.shipping_status_code == 4) {
					index = 2
				} else if (item.pay_status_code == 2 && item.shipping_status_code == 2) {
					index = 3
				} else if (item.order_status_code == 4) {
					// 退货
					index = 5
				}

				let url = '../order/details?details_index=' + index + '&id=' + id
				if (index == 5) {
					url = '../order/refundDetails'
				}
				uni.navigateTo({
					url: url
				})


			},
			// 选择支付方式
			selectPay(index) {
				this.pay_index = index
			},
			// 获取调用支付信息数据
			getPayDate() {
				if (this.pay_index == 0) {
					let data = {
						_action: 'payorder',
						order_id: this.payQuery.order_id,
						order_type: 'GOODSBUY',
						payment_method: 'paypal'
					}
					defaultRequest2(data).then(res => {
						console.info(res, '支付')
						if (res.error == 0) {
							let url = res.data.prepay_data.checkoutnow_url
							console.log(url)
							// plus.runtime.openURL(res.data.prepay_data.checkoutnow_url)
							uni.navigateTo({
								url: '../order/paypalWebview?src=' + url
							})
						}
					})
				} else if (this.pay_index == 1) {
					let data = {
						_action: 'payorder',
						order_id: this.payQuery.order_id,
						order_type: 'GOODSBUY',
						payment_method: 'oceanpay'
					}
					defaultRequest2(data).then(res => {
						console.info(res, '支付')
						if (res.error == 1) {
							let url = res.data.prepay_data.checkoutnow_url
							console.log(url)
							// plus.runtime.openURL(res.data.prepay_data.checkoutnow_url)
							uni.navigateTo({
								url: '../order/paypalWebview?src=' + url
							})
						}
					})
				} else {
					defaultRequest2(this.payQuery).then(res => {
						console.info(res)
						if (res.error == 1) {
							//订单对象，从服务器获取
							if (res.data.need_pay_amount == 1) return
							uni.requestPayment({
								provider: 'alipay',
								orderInfo: res.data.prepay_data.order_info, //支付宝订单数据
								success: function(res) {
									console.log('success:' + JSON.stringify(res));
									this.isShow = false
									uni.navigateTo({
										url: '../order/paySuccess?order_id=' + this.payQuery
											.order_id
									});
								},
								fail: function(err) {
									console.log('fail:' + JSON.stringify(err));
									uni.showToast({
										title: 'Payment failed',
										icon: 'none'
									})
								}
							});
						}
					})
				}
			},
			payNow(id, type) {
				this.payQuery.order_id = id
				this.isShow = true
				this.showType = type
			},
			// 淡出提示
			openTips(id, type) {
				this.tipsType = type
				if (type == 0) {
					this.tipsInfo =
						'Are you sure you want to cancel this order? This order will be regarded as invalid after cancellation'
					this.tipsBut = 'CancelOrder'
					this.cancelQuery._action = 'cancelorder'
				} else if (type == 1) {
					this.tipsInfo = 'Are you sure you want to delete this order?'
					this.tipsBut = 'DeleteOrder'
					this.cancelQuery._action = 'deleteorder'
				} else if (type == 2) {
					this.tipsInfo = 'Are you sure you have received the products?'
					this.tipsBut = 'Confirm'
					this.cancelQuery._action = 'affirmorder'
				}
				this.cancelQuery.order_id = id
				this.$refs.alertDialog.open()

			},
			// 提示框点击确操作 取消订单、删除订单
			dialogConfirm() {
				defaultRequest2(this.cancelQuery).then(res => {
					console.info(res)
					if (res.error == 0) {
						this.getList()
					}
				})
			},

			getList() {
				defaultRequest2(this.query).then(res => {
					console.info(res)
					if (res.error == 0) {
						if (res.data) this.orderList = res.data
						if (this.orderList.length == 0) {
							this.isList = false
						} else {
							this.isList = true
						}
					}
				})
			},
			scrollChange(index) {
				// {_action:'getuserorders',page_index:1,page_size:10,payingstatus:'',status:'',shippingstatus:''}
				this.scroll_active = index
				// if(index==0){
				// 	this.query.payingstatus=''
				// 	this.query.status=''
				// }else if(index==1){
				// 	this.query.payingstatus='1'
				// 	this.query.status='0'
				// 	this.query.shippingstatus='1'
				// }
				// this.getList()
			},
		},
		onShow(e) {
			this.scrollChange(0)
			this.getList()
		},
		onLoad(e) {
			this.scrollChange(0)
			this.scroll_active = e.scroll_active
			this.scrollChange(e.index)
		},
		filters: {
			goodsAttr(e) {
				return e.replace(/\s\n/g, ';');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.body {
		padding-top: 100rpx;
	}

	.padding_left {
		padding-left: 20rpx;
	}

	.order_nav {
		padding: 0 38.67rpx;
		border-bottom: 13.33rpx #F7F7F7 solid;
		position: fixed;
		width: 100%;
		box-sizing: border-box;
		z-index: 99;
		background-color: white;

		.scroll-view_H {
			white-space: nowrap;
			font-size: 28rpx;
			color: #666666;
			width: 100%;

			::-webkit-scrollbar {
				width: 0;
				height: 0;
				background-color: transparent;
			}

			view {
				margin-left: 37.33rpx;
				display: inline-block;
				padding: 25.33rpx 0;
			}

			view:first-child {
				margin-left: 0;
			}

			.scroll_active {
				color: #000000;
				font-size: 28rpx;
				font-weight: bold;
				border-bottom: 2px solid #000000;
			}
		}
	}

	.order {
		border-bottom: 13.33rpx #F7F7F7 solid;
		padding-bottom: 26.67rpx;

		.order_title {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding-left: 34.67rpx;
			padding-right: 25.33rpx;
			font-size: 28rpx;
			padding-top: 26.67rpx;
			padding-bottom: 20rpx;
			border-bottom: 1px solid #F1F1F1;

			.order_title_right {
				font-size: 22.67rpx;
				font-weight: bold;
				color: #666666;

				image {
					width: 16rpx;
					height: 16rpx;
					margin-left: 14.67rpx;
				}
			}
		}

		.order_content {
			padding-left: 32rpx;
			padding-right: 26.67rpx;
			// background-color: #B22234;
			margin-top: -30rpx;

			.good_info {
				padding-top: 60rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 22.67rpx;
				color: #666666;
				font-weight: bold;
				border-bottom: 1px solid #F1F1F1;

				.good_info_left {
					display: flex;
					align-items: center;

					.good_info_image {
						width: 133.33rpx;
						height: 133.33rpx;
						background-color: #999999;

						margin-right: 8rpx;
						border-radius: 10rpx !important;

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

					.left_info {
						margin-left: 24rpx;

						.info_name {
							font-size: 26.67rpx;
							font-weight: 400;
							width: 477.33rpx;
						}

						.left_info_bottom {
							width: 533.33rpx !important;
							display: flex;
							align-items: center;
							justify-content: space-between;
							font-size: 32rpx;
							color: #909090;
							width: 100%;
							margin-top: 24rpx;

							.info_lable {
								padding: 5.33rpx 20rpx;
								font-size: 22.67rpx;

								// border-radius: 33.33rpx;
								// border: 1px solid #D3D3D3;
								image {
									width: 17.33rpx;
									height: 17.33rpx;
									margin-left: 14.67rpx;
								}
							}
						}
					}
				}

				.good_info_right {
					display: flex;
					align-items: center;

					image {
						width: 16rpx;
						height: 16rpx;
						margin-left: 20rpx;
					}
				}
			}

			.good_price {
				font-size: 28rpx;
				text-align: right;
				margin: 24rpx 0;
			}

			.good_points {
				display: flex;
				align-items: center;
				justify-content: flex-end;
				font-size: 24rpx;
				color: #B22234;

				image {
					width: 29.33rpx;
					height: 29.33rpx;
					margin-right: 13.33rpx;
				}
			}

			.order_button {
				margin-top: 33.33rpx;
				display: flex;
				justify-content: flex-end;

				background-color: #FFF;

				button {
					height: 57.33rpx;
					line-height: 57.33rpx;
					font-weight: bold;
					font-size: 22.67rpx;

					background-color: #fff;
					margin: 0;
					border-radius: 0rpx;

					// border:green solid 4rpx;
					&:last-child {
						margin-right: 0 !important;
					}
				}

				button:after {
					border: none;
				}

				.cancel {
					color: #666666;
					border: black solid 1rpx;
					// border: white !important;
					margin-right: 20rpx;
					border-radius: 0;
					background-color: #fff;

				}

				.pay {
					color: white;
					border-radius: 0;
					background: black;
				}

			}
		}
	}

	.order1 {
		padding-top: 90.67rpx;
		font-size: 24rpx;
		font-weight: 400;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		image {
			width: 146.67rpx;
			height: 146.67rpx;
			margin-bottom: 36rpx;
		}

		button {
			background-color: #000000;
			font-size: 24rpx;
			color: white;
			// border-radius: 13.33rpx;
			height: 63.33rpx;
			margin-top: 20rpx;
		}
	}
</style>
