<template>
	<view class="container">
		<view class="">
			<view style="background-color: #03803B;">
				<uni-search-bar bgColor="#fff" v-model="cname" placeholder="请输入综合查询" @confirm="custom"
					@clear="custom" :radius="100"  cancelButton="none">
				</uni-search-bar>
			</view>
			<view style="background-color: #FFFFFF;">
				<u-tabs :list="list" :current="current" lineColor="#03803B" :activeStyle="activeStyle"
					@click="sectionChange"></u-tabs>
			</view>
		</view>
		<z-paging ref="paging" v-model="dataList" @query="getList" :fixed="false" :auto-show-back-to-top="true"
			:empty-view-text="cname ? '未找到相关结果' : '暂无数据'" :hide-empty-view="false"
			:auto-show-system-loading="true">
			<view style="margin-top: 20rpx;">
				<view class="card" v-for="(item,index) in dataList" :key="index" @click="inPage(item,index)">
					<view>
						<view style="font-size: 26rpx;color: #717171;display: flex;justify-content: space-between;">
							<view class="">
								{{item.goodsNameJoin}}
							</view>
							<view style="color: #03803B;">
								{{item.xcxStatus}}
							</view>
						</view>
						<view style="height: 1rpx;background: #F1F1F1;margin:20rpx 0">
						</view>
						<view style="font-size: 26rpx;color: #717171;">
							<view style="margin-bottom: 20rx;">
								订单编号：<text style="color: #C4C4C4;">{{item.ordNo}}</text>
							</view>
							<view style="margin-bottom: 20rx;">
								支付方式：<text style="color: #C4C4C4;">
									<!--              {{item.payType && item.payType.indexOf('01') != -1?'扫码支付':'微信支付'}}-->
									{{ item.receivableType ? item.receivableType : '' }}
								</text>
							</view>
							<view>
								下单时间：<text style="color: #C4C4C4;">{{item.createTime}}</text>
							</view>
						</view>
					</view>
				</view>

			</view>
		</z-paging>

	</view>
</template>

<script>
	import {
		appStatusList,
		appStatusShareList
	} from '@/api/me/myOrder.js'
	export default {
		data() {
			return {
				activeStyle: {
					color: '#03803B',
					fontWeight: 'bold',
				},
				xcxStatus: '',
				current: 0,
				cname: "",
				list: [{
						name: '全部',
						status: '',
					}
					// , {
					// 	name: '未付款',
					//  status: '未付款',
					// 	badge: {
					// 		value: 0
					// 	}
					// }
					, {
						name: '待发货',
						status: '待发货',
					}, {
						name: '已发货',
						status: '已发货',
					}, {
						name: '已收货',
						status: '已收货',
					}, {
						name: '退款售后',
						status: '退款请核,退款中,已取消',
					}
				],
				dataList: [],
			}
		},
		onLoad(option) {
			if(option.xcxStatus){
				this.xcxStatus=option.xcxStatus
				this.current=option.current
			}
		},
		methods: {
			sectionChange(item) {
				this.current = item.index;
				this.xcxStatus=this.list[item.index].name == "全部" ? "" : this.list[item.index].status
				this.$refs.paging.reload()
			},
			async getList(pageNo, pageSize) {
				try {
					const obj = {
						bsType: 'XS',
						retrieval: this.cname,
						xcxStatus:this.xcxStatus,
						current: pageNo,
						size: pageSize
					}
					const res = await appStatusList(obj)
					this.$refs.paging.complete(res.data.records)
				} catch (e) {
					this.$refs.paging.complete(false)
					uni.showToast({
						title: '加载失败',
						icon: 'none'
					})
				}
			},
			//搜索
			custom() {
				this.$refs.paging.reload()
			},
			inPage(item, index) {
				uni.navigateTo({
					url: '/pages/me/orderDetails?id='+item.id,
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		// #ifdef H5
		height: calc(100vh - var(--nav-bar, 44px));
		// #endif
		// #ifdef APP-PLUS
		height: 100vh;
		// #endif

		display: flex;
		flex-direction: column;
	}

	.card {
		padding: 40rpx;
		background-color: #fff;
		margin-top: 20rpx;
	}

	::v-deep .uni-searchbar__cancel {
		color: #fff;
	}
</style>
