<template>
	<view>
		<u-sticky bgColor="#ff7a31">
		    <u-tabs :list="nav" 
			:current="current"
			lineColor="#ffffff"
			:activeStyle="{
				color: '#ffffff',
				transform: 'scale(1.05)'
			}"
			:inactiveStyle="{
				color: '#f5f5f5',
				transform: 'scale(1)'
			}"
			:scrollable="true"
			itemStyle="padding-left: 60rpx; padding-right: 60rpx;font-size:22rpx; height: 100rpx;"
			@click="tabClick"></u-tabs>
		</u-sticky>
		<view class="se-p-40">
			<view class="se-px-40 se-mb-30 se-py-30 se-bgc-white se-br-40 se-bs-b" v-for="(items,indexs) in list" :key="indexs">
				<view class="se-flex se-flex-h-sb se-fw-6 se-fs-32 se-pb-20">
					<view class="se-flex">
						<text>工装石膏板搬运</text>
						<u-icon name="arrow-right"></u-icon>
					</view>
					<view class="se-c-red">
						已完成
					</view>
				</view>
				<view class="se-flex  se-bgc-f5 se-br-20">
					<view class="se-w-160 se-h-160">
						<image class="se-w-160 se-h-160 se-br-10" src="https://cdn.uviewui.com/uview/album/1.jpg" mode=""></image>
					</view>
					<view class="se-ml-20 se-flex se-flex-v-sa se-flex-ai-fs">
						<view class="se-fs-24 se-c-text-third se-display-ib">师傅姓名: 李**</view>
						<view class="se-fs-24 se-c-text-third se-display-ib">接单时间: 2024-03-25 15:39</view>
						<view class="se-fs-24 se-c-text-third se-display-ib">联系电话: 13189698115</view>
					</view>
				</view>
				<view class="se-flex se-flex-h-sb se-w-p-100 se-pt-20">
					<view class="se-fs-24 se-display-ib">
						<text class="se-c-black">总价格：</text>
						<text class="se-c-orange se-fs-30 se-fw-6"><text class="se-fs-24">￥</text>6000</text>
					</view>
					<view class="se-display-ib se-px-20 se-br-40 se-flex-h-c se-h-50 se-lh-50 se-ta-c se-fs-24 se-fs-24 se-c-66 se-b">
						<text>联系客服</text>
					</view>
				</view>
			</view>
			<u-empty v-if="list && list.length==0" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	import {
		bossOrderList
	} from "@/common/api.js"
	export default{
		components:{
			
		},
		data(){
			return{
				current:0,
				nav: [
					{
						name: '全部',
						index: null
					},
					{
						name: '待接单',
						index: 0
					}, 
					{
						name: '已接单',
						index: 1
					}, 
					{
						name: '进行中',
						index: 2
					}, 
					{
						name: '试工完成',
						index: 3
					},
					{
						name: '企业确认',
						index: 4
					}, 
					{
						name: '已支付',
						index: 5
					}, 
					{
						name: '已完成',
						index: 6
					}, 
					{
						name: '已取消',
						index: 7
					}, 
					{
						name: '发起支付',
						index: 8
					}
				],
				list:[],
				orderStatus:null,
				pageNo:1,
				pageSize:20,
			}
		},
		mounted() {
			this.onOrder()
		},
		methods:{
			onReach(){
				this.pageNo = this.pageNo + 1
				this.onOrder()
			},
			onRefresh(){
				this.list = []
				this.pageNo = 1
				this.onOrder()
			},
			onOrder(){
				let that = this;
				let params={
					role:1,
					status:that.orderStatus,
					pageNo:that.pageNo,
					pageSize:that.pageSize
				}
				bossOrderList(params).then(response=>{
					if(this.pageNo==1){
						this.list = response.result.records
					}else{
						this.list = this.list.concat(response.result.records)
					}
				}).catch(error=>{
					
				})
			},
			tabClick(event){
				this.list = []
				this.pageNo = 1
				this.current = event.index
				this.orderStatus = this.nav[event.index].index
				this.onOrder()
			},
			onOrderDetail(event){
				uni.navigateTo({
					url:"/pages_subpack/order-detail/index?orderId="+event.id
				})
			},
			callPhone(event){
				uni.makePhoneCall({
				    phoneNumber: event.phone,
				    success: () => {
				      console.log("拨打成功");
				    },
				    fail: (err) => {
				      console.error("拨打失败", err);
				    },
				  })
			}
		}
	}
</script>

<style>
</style>