<template>
    <view class="introduceYourselfEdit">
        <view v-if="auditStatus == 0 || auditStatus == 2" class="checkBox" :style="{
            color: auditStatus === 2 ? '#F53F3F' : '#FF7D00',
            background: auditStatus === 2 ? '#FFF5F5' : '#FFF8EC'
        }">
            <view style="display: flex;align-items: center;justify-content: space-between;">
                <view class="checkStatus">
                    <image :src="auditStatus == 0 ? '/static/login/status1.png' : '/static/login/status2.png'" mode=""
                        style="width: 32rpx;height: 32rpx;margin-right: 8rpx;">
                    </image>
                    {{ auditStatus == 2 ? '审核驳回' : '审核中' }}
                </view>
                <view class="contactCustomer" :style="{
                    border: auditStatus === 2 ? '1px solid #F53F3F' : '1px solid #FF7D00',
                }">联系客服</view>
            </view>

            <view class="text">{{ auditStatus == 2 ? '审核驳回' : '审核中' }}，审核结果将会在X-X个工作日通知您</view>
        </view>
        <view class="u-cell-group">
            <u--textarea placeholderClass="textarea-placeholder" autoHeight v-model="value" placeholder="简单的介绍您自己~"
                class="textareaDef"></u--textarea>
        </view>
        <view class="footer-bar" v-if="auditStatus != 0 ">
            <u-button :customStyle="{
                padding: '24rpx 48rpx',
                color: '#fff',
                background: 'var(--theme-color-gradient)',
                width: '654rpx',
                height: '88rpx',
                background: '#333335',
                borderRadius: '60rpx 60rpx 60rpx 60rpx',
            }" @click="onSubmit">保存</u-button>
        </view>
    </view>
</template>

<script>
import { onShow } from '@dcloudio/uni-app';

export default {
    data() {
        return {
            auditStatus: 1,
            value: '',
        }
    },
    onLoad() {
    },
    onLoad(query) {
        console.log(query, 'query')
        this.auditStatus = Number(query.auditStatus)
        this.value = (query.introduceYourself === undefined || query.introduceYourself === 'undefined') ? '' : decodeURIComponent(query.introduceYourself)
    },
    onShow() {
    },
    methods: {
        goBack() {
            uni.navigateBack()
        },
        onSubmit() {
            // 获取页面栈
            const pages = getCurrentPages()
            // 至少要有上一页才执行
            if (pages.length < 2) {
                uni.navigateBack()
                return
            }
            // 上一页实例
            const prevPage = pages[pages.length - 2]
            // 再校验页面实例是否存在
            if (!prevPage) {
                uni.navigateBack()
                return
            }
            // 直接修改上一页data里的字段
            prevPage.$data.baseInfo.introduceYourself = this.value
            console.log(prevPage.$data.baseInfo, 'prevPage.$data.baseInfo.introduceYourself')
            uni.navigateBack()
        }

    }
}
</script>

<style scoped lang="scss">
.introduceYourselfEdit {
    height: 100vh;
    background-color: #F7F8FA;
    .checkBox {
        padding: 30rpx 32rpx 24rpx 32rpx;
        height: 134rpx;
        border-radius: 8rpx 8rpx 8rpx 8rpx;

        //color: #FF7D00;
        .checkStatus {
            font-weight: 500;
            font-size: 30rpx;
            text-align: left;
            display: flex;
            align-items: center;

        }

        .contactCustomer {
            width: 144rpx;
            height: 44rpx;
            border-radius: 24rpx 24rpx 24rpx 24rpx;

            font-weight: 400;
            font-size: 26rpx;
            text-align: center;

        }

        .text {
            margin-top: 8rpx;
            font-weight: 400;
            font-size: 26rpx;
            text-align: left;
        }
    }


    .u-cell-group {
        background: #fff;
        min-height: 260rpx;
        box-sizing: border-box;
        border-radius: 8rpx 8rpx 8rpx 8rpx;
        padding: 32rpx;

        .u-textarea {
            background: #F7F8FA;
            min-height: 200rpx !important;
        }

        .textareaDef {

            .uni-textarea-placeholder {
                font-weight: 400;
                font-size: 30rpx;
                color: #C9CDD4;
            }

            .uni-textarea-wrapper {
                font-weight: 400;
                font-size: 30rpx;
                color: #4E5969;
            }

        }
    }


}
</style>
