<view class='page'>
	<include src='/components/common/common'></include>
	<include src='/components/header/header'></include>
	<view class='body after-navber'>
		<block wx:if='{{show_index}}'>
			<navigator class='return-index-btn' openType='redirect' url='/pages/index/index'>
				<image src='{{__wxapp_img.nav.index.url}}' style='width: 50rpx;height: 50rpx'></image>
			</navigator>
		</block>
		<view class='flex-row tab-bar'>
			<view class='flex-grow-1'>
				<navigator class='{{(status == 0?"active":"")}}' openType='redirect' url='/pages/order/order?status=0'><text>待付款</text></navigator>
			</view>
			<view class='flex-grow-1'>
				<navigator class='{{(status == 1?"active":"")}}' openType='redirect' url='/pages/order/order?status=1'><text>待发货</text></navigator>
			</view>
			<view class='flex-grow-1'>
				<navigator class='{{(status == 2?"active":"")}}' openType='redirect' url='/pages/order/order?status=2'><text>待收货</text></navigator>
			</view>
			<view class='flex-grow-1'>
				<navigator class='{{(status == 3?"active":"")}}' openType='redirect' url='/pages/order/order?status=3'><text>已完成</text></navigator>
			</view>
			<view class='flex-grow-1'>
				<navigator class='{{(status == 4?"active":"")}}' openType='redirect' url='/pages/order/order?status=4'><text>售后</text></navigator>
			</view>
		</view>
		<view class='order-list'>
			<block wx:if='{{show_no_data_tip}}'>
				<view class='no-data-tip'>暂无相关订单</view>
			</block>
			<block wx:for='{{order_list}}' wx:for-item='order' wx:for-index='index' wx:key='{{order.id}}'>
				<view class='order-item'>
					<navigator url='{{(status == 4?"/pages/order-refund-detail/order-refund-detail?id=" + order.order_refund_id:"/pages/order-detail/order-detail?id=" + order.order_id)}}'>
						<view style='font-size: 9pt;margin-bottom: 12rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis'>{{order.mch.name}}</view>
						<view class='flex-row order-info'>
							<view class='flex-grow-1'>订单号:{{order.order_no}}</view>
							<view class='flex-grow-0'>{{order.addtime}}</view>
						</view>
						<view class='goods-list'>
							<block wx:for='{{order.goods_list}}' wx:for-item='goods' wx:for-index='index' wx:key='{{goods.id}}'>
								<view class='goods-item flex-row'>
									<view class='flex-grow-0' style='overflow: visible'>
										<image class='goods-pic' mode='aspectFill' src='{{goods.goods_pic}}'></image>
									</view>
									<view class='flex-grow-1 flex-col'>
										<view class='flex-grow-1'>
											<view class='goods-name'>{{goods.goods_name}}</view>
											<view class='attr-list'>
												<block wx:for='{{goods.attr_list}}' wx:for-item='attr' wx:for-index='index' wx:key='{{attr.id}}'>
													<view class='attr-item'> {{attr.attr_group_name}}:{{attr.attr_name}} </view>
												</block>
											</view>
										</view>
										<view class='flex-grow-0 flex-row'>
											<view class='flex-grow-1 num'>×{{goods.num}}</view>
											<view class='flex-grow-0 price'>￥:{{goods.price}}</view>
										</view>
									</view>
								</view>
							</block>
						</view>
					</navigator>
					<view class='flex-row'>
						<view class='flex-grow-1 flex-y-center'>
							<block wx:if='{{status == 4}}'>
								<block wx:if='{{order.refund_type == 1}}'> 退货退款： <text style='color: #ff4544'>￥{{order.refund_price}}</text></block>
								<block wx:if='{{order.refund_type == 2}}'> 换货 </block>
							</block>
							<block wx:else>合计：￥{{order.pay_price}}</block>
						</view>
						<view class='flex-grow-0 flex-y-center flex-row'>
							<block wx:if='{{status == 4}}'>
								<block wx:if='{{order.refund_status == 0}}'>
									<view>
										<block wx:if='{{order.refund_type == 1}}'>
											<block wx:if='{{order.is_agree == 0}}'>等待处理</block>
											<block wx:else>
												<block wx:if='{{order.is_user_send == 0}}'>待买家发货</block>
												<block wx:else>等卖家待处理</block>
											</block>
										</block>
										<block wx:else>等卖家待处理</block>
									</view>
								</block>
								<block wx:if='{{order.refund_status == 1}}'>
									<view style='color: #36ba75'>已同意并退款</view>
								</block>
								<block wx:if='{{order.refund_status == 2}}'>
									<view style='color: #36ba75'>已同意换货</view>
								</block>
								<block wx:if='{{order.refund_status == 3}}'>
									<block wx:if='{{order.refund_type == 1}}'>
										<view style='color: #ff4544'>已拒绝退货退款</view>
									</block>
									<block wx:if='{{order.refund_type == 2}}'>
										<view style='color: #ff4544'>已拒绝换货</view>
									</block>
								</block>
							</block>
							<block wx:else>
								<block wx:if='{{order.is_send == 0}}'>
									<view class='flex-grow-1'>
										<block wx:if='{{order.apply_delete == 1}}'><text>退款申请中</text></block>
										<block wx:else><button bindtap='orderRevoke' class='order-option-btn' data-id='{{order.order_id}}'>{{(order.is_pay?"退款":"取消")}}</button></block>
									</view>
								</block>
								<block wx:if='{{ (order.is_pay == 0 && order.pay_type != 2) }}'>
									<view class='flex-grow-1'><button bindtap='orderPay' class='order-option-btn' data-id='{{order.order_id}}'
										 data-index='{{index}}'>付款</button></view>
								</block>
								<block wx:if='{{ ( ( ( (order.is_pay == 1 || order.pay_type == 2)  && order.is_offline == 1)  && order.is_send == 0)  && order.apply_delete == 0) }}'>
									<view class='flex-grow-1'>
										<view bindtap='orderQrcode' class='order-option-btn clerk flex-y-center' data-index='{{index}}'>
											<image data-index='{{index}}' src='{{__wxapp_img.store.clerk.url}}' style='width:26rpx;height:26rpx;margin-right:10rpx'></image>
											核销码
										</view>
									</view>
								</block>	
<!-- 								<block wx:if='{{ ( ( ( (order.is_pay == 1 || order.pay_type == 2)  && (order.is_offline == 1 || order.is_offline == 0))  && order.is_confirm == 0)  && order.apply_delete == 0) && order.is_virtual == 1 }}'>
									<view class='flex-grow-1'>
										<view bindtap='orderQrcode' class='order-option-btn clerk flex-y-center' data-index='{{index}}'>
											<image data-index='{{index}}' src='{{__wxapp_img.store.clerk.url}}' style='width:26rpx;height:26rpx;margin-right:10rpx'></image>
											核销码
										</view>
									</view>
								</block> -->
								<block wx:if='{{ (order.is_send == 1 && order.is_confirm == 0) }}'>
									<view class='flex-grow-1 flex-row'>
										<block wx:if='{{order.express}}'>
											<view class='flex-grow-0'>
												<navigator class='order-option-btn' url='/pages/express-detail/express-detail?id={{order.order_id}}'>物流
												</navigator>
											</view>
										</block>
										<view class='flex-grow-0'><button bindtap='orderConfirm' class='order-option-btn' data-id='{{order.order_id}}'>确认收货
											</button></view>
									</view>
								</block>
								<block wx:if='{{ ( ( (order.is_send == 1 && order.is_confirm == 1)  && order.is_comment == 0)  && __is_comment) }}'>
									<view class='flex-grow-1'>
										<block wx:if='{{__is_comment}}'>
											<navigator class='order-option-btn' url='/pages/order-comment/order-comment?id={{order.order_id}}'>评价
											</navigator>
										</block>
									</view>
								</block>
								<block wx:if='{{order.refund == 1}}'>
									<view class='flex-grow-1'>
										<navigator class='order-option-btn' openType='redirect' url='/pages/order/order?order_id={{order.order_id}}&status=4'>售后详情
										</navigator>
									</view>
								</block>
							</block>
						</view>
					</view>
				</view>
			</block>
		</view>
		<view bindtap='hide' class='flex-row flex-y-center modal {{(hide == 1?"hide":"")}}'>
			<view class='flex-y-center' style='width:100%;height:800rpx;padding:100rpx;'>
				<view style='background-color:#fff;width:100%;height:100%;border-radius:10rpx;padding:0 50rpx;'>
					<view class='flex-x-center' style='width:100%;height:50rpx;margin-top:50rpx;font-size:13pt;margin-bottom:20rpx'>核销二维码</view>
					<image src='{{qrcode}}' style='width:450rpx;height:450rpx;'></image>
				</view>
			</view>
		</view>
	</view>
	<include src='/components/footer/footer'></include>
</view>
