<template>
    <!-- pages/entryWrite/page/Entry/prescription/prescProcess/prescProcess.wxml -->
    <view class="body">
        <block v-if="processData.length > 0">
            <wux-steps direction="vertical">
                <block v-for="(item, index) in processData" :key="index">
                    <wux-step status="finish" :title="item.desc">
                        <view slot="leftContent" class="step-leftcontant">
                            <view class="step-leftcontant-time">{{ item.time }}</view>
                            <view class="step-leftcontant-date">{{ item.date }}</view>
                        </view>
                        <view slot="content">
                            <view class="step-contant-desc">{{ item.docDesc }}</view>
                            <!-- <block wx:if="{{(item.docAppeal!==undefined)&&(item.docAppeal!=='')}}">
                            <view class="step-contant-medDesc" >{{item.docAppeal}}</view>
                        </block> -->
                            <block v-for="(reasonItem, index1) in item.medData" :key="index1">
                                <view class="step-contant-reason">{{ reasonItem.reason }}</view>

                                <block v-for="(medItem, index2) in reasonItem.date" :key="index2">
                                    <view class="step-contant-medDesc">
                                        {{ medItem.medItem }} {{ medItem.spec !== undefined && medItem.spec !== '' ? '【' + medItem.spec + '】' : '' }}
                                    </view>
                                </block>
                            </block>
                            <block v-if="(item.docAppeal !== undefined && item.docAppeal !== '') || (item.auditRemarks !== undefined && item.auditRemarks !== '')">
                                <view class="step-contant-desc">
                                    备注：
                                    <text style="color: #ff9933">{{ item.docAppeal !== undefined && item.docAppeal !== '' ? item.docAppeal : item.auditRemarks }}</text>
                                </view>
                            </block>
                        </view>
                    </wux-step>
                </block>
            </wux-steps>
        </block>
    </view>
</template>

<script>
import wuxSteps from '../../../../components/steps/index';
import wuxStep from '../../../../components/step/index';
import { $http } from '../../../../../../config/https.js';
import Util from '../../../../../../utils/util.js';
export default {
    components: {
        wuxSteps,
        wuxStep
    },
    data() {
        return {
            processData: [],
            ordID: '',

            reasonItem: {
                reason: '',
                date: []
            },

            medItem: {
                medItem: '',
                spec: ''
            },

            undefined: ''
        };
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        console.log('onLoadOptions', options);
        if (options.ordID) {
            this.handlePrescAudit(options.ordID);
        }
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        if (this.processData.length < 0) {
            let { ordID } = this;
            this.handlePrescAudit(ordID);
        }
        // let newprocessData=JSON.parse(options.processData.replace(/desc/g,"text"))
    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        /**数据处理 */
        sortData: function (processData) {
            processData.map((element) => {
                if (element.docTitle !== '' && element.docTitle !== undefined) {
                    element.docDesc = `【${element.docTitle}: ${element.docName}】`;
                }
            });
            this.setData({
                processData
            });
            console.log('processData:', processData);
        },

        handlePrescAudit: function (ordID) {
            // let {prescNo,radio,mark}=this.data;
            // let httpsCode=radio=="apply"?'02030023':'02030024';
            let data = {
                params: [
                    {
                        ordID: ordID
                    }
                ]
            };
            $http.post('urlDeault', this, {
                code: '03100106',
                data: data,
                success: function (res) {
                    if (res.errorCode == '0') {
                        this.sortData(res.result.data);
                    }
                }
            });
        }
    }
};
</script>
<style>
page {
    height: 100%;
}
.body {
    margin-top: 30rpx;
    height: 100%;
    overflow: auto;
}
.step-leftcontant {
    font-size: 28rpx;
}
.wux-step--vertical .wux-step__bd {
    margin-left: 60rpx !important;
}
.wux-step__icon {
    width: 33.6rpx !important;
    height: 70% !important;
}
.wux-step--vertical .wux-step__ft {
    left: 30rpx !important;
}
.step-leftcontant-time {
    font-weight: 600;
}
.step-contant-medDesc {
    margin-left: 20rpx !important;
}
.step-contant-reason {
    font-size: 28rpx;
    color: #ff9933;
}
</style>
