<template>
    <view class="content">
        <view class="page">
                <view class="block_2 flex-row justify-start" v-for="(item,index) in projects.projectVos" :key="index" @click="clickItem(item.id)">

                    <view class="flex-col justify-center ">
                        <u-icon v-if="item.id === serviceProjectId" name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
                        <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
                    </view>

                    <view class="outView ">
                        <text lines="1" class="text_3">{{item.serviceName}}</text>

                            <view class="group_2 ">
                                <view class="image-text_2">
                                    <u-icon name="server-man" size="16"></u-icon>
                                    <text lines="1" class="text-group_2">服务人员：</text>
                                    <text lines="1" class="text_5">{{projects.personName}}</text>
                                </view>
                                <view class="group_3">
                                    <u-icon name="clock" size="16"></u-icon>
                                    <text lines="1" class="text-group_2">服务时间：</text>
                                    <text lines="1" decode="true" class="text_5">2023-8-14&nbsp;12:33:55</text>
                                </view>
                            </view>

                        <view class="text-wrapper_3  flex-row justify-start">
                            <text lines="1" class="text_7">标准价：</text>
                            <text lines="1" class="text_8">¥{{item.standardPrice}}</text>
                            <text lines="1" class="text_9 text_7">会员价：</text>
                            <text lines="1" class="text_8">¥{{item.memberPrice}}</text>
                        </view>
                        <view class="box_4"></view>
                    </view>



                </view>

            <view class="tabBarLineHeight"></view>

            <view class="bottomView ">
                <view class="flex-row justify-center">
                    <view class="block_3 ">
                        <text lines="1" class="text_15">优惠券</text>
                        <view class="image-text_4">
                            <text lines="1" class="text-group_4">未选择</text>
                            <u-icon name="arrow-right" color="#666" size="18"></u-icon>
                        </view>
                    </view>
                </view>

                <view class="flex-row justify-center">
                    <view class="submitButton" @click="addChildProject">确定</view>
                </view>
            </view>

        </view>
    </view>
</template>

<script>
export default {
    components: {
    },
    data() {
        return {
            title: 'Hello',
            tabIndex: 3,
            projects:{},
            serviceStationId:'',
            orderId:'',
            serviceProjectId:''
        }
    },
    onLoad(e) {
        this.orderId=e.orderId
        this.serviceStationId=e.serviceStationId
        this.getStationById(e.serviceStationId)
    },
    methods: {

        clickItem(id){
            this.serviceProjectId = id
        },

        addChildProject(){
            if (this.id === ''){
                uni.$u.toast("请选择服务项目")
            }
            this.$api.addChildProject({
                orderId:this.orderId,
                serviceProjectId:this.serviceProjectId,
                servicePersonId:this.projects.personId,
                serviceStationId:this.serviceStationId,
                couponIds:''
            }).then(res=>{
                uni.navigateTo({
                    url:'/orderPages/orderDetail/index?id='+ this.orderId
                })
            })


        },

        getStationById(qeCode){
            this.$api.getStationById({
                stationId:qeCode
            }).then(res=>{
                console.log('++++++++getStationById+++++++++++',res)

                this.projects=res.data.data

            })
        }


    }
}
</script>

<style scoped lang="scss">
@import '/common/css/common.css';
@import './index.rpx.scss';
</style>
