<!-- 我的处方 -->
<template>
    <nav-bar :navbar-data="navbarData" />
    <view :style="{ paddingTop: height +'px', height: '100vh', boxSizing: 'border-box', overflow: 'hidden' }">
        <!-- <van-tabs active="{{ active }}" bind:change="onChange" tab-active-class="tabs-active">
			<van-tab title="线上门诊">
			</van-tab>
			<van-tab title="线下门诊">
			</van-tab>
		</van-tabs> -->
        <view :style="{ height: 'calc(100vh - '+ (height + 51) +'px)', overflowY: 'auto' }">
            <view class="card" v-for="(item, index) in PrescData" :key="index">
                <view class="card-show">
                    <view>
                        <!-- <image class="card-show-img" src="/images/photo/a0061261ab11da688ee4574cfc8e0994.jpg"></image> -->
                    </view>
                    <view class="card-show-intro">
                        <view>
                            <text class="text1">{{ item.doctorName }}</text>
                            <text class="text2">{{ item.locDesc }}</text>
                        </view>
                        <view class="text3">就诊时间：{{ item.prescDate }}</view>
                    </view>
                </view>
                <view class="card-reg">诊断：{{ item.diag }}</view>
                <view class="card-pre">
                    <view class="card-pre-item">
                        <view class="card-pre-item-no">
                            <!-- <image style="width:32rpx;height:36rpx" src="../../../../images/icon_prescrip.png"></image> -->
                            <text style="margin-left:16rpx">西药处方</text>
                            <text style="margin-left:16rpx">{{ item.prescNo }}</text>
                        </view>
                        <view class="card-pre-btn">
                            <navigator :url="'../prescriptionDetail/prescriptionDetail?id=' + item.prescNo">
                                查看处方
                            </navigator>
                        </view>
                    </view>
                    <!-- <view class="card-pre-item">
						<view class="card-pre-item-no">
							<image style="width:32rpx;height:36rpx" src="../../../../images/icon_prescrip.png"></image>
							<text style="margin-left:16rpx">OPO202011260019</text>
							<text style="margin-left:16rpx">西药处方</text>
						</view>
						<view class="card-pre-btn2"> 
							已失效
						</view>
					</view> -->
                </view>
            </view>
            <!-- <van-divider contentPosition="center">数据已全部加载</van-divider> -->
			<view class="no-data" v-if="PrescData && PrescData.length == 0" :style="{height: 'calc(100% - '+ navHeight +'px)'}">
				<van-icon name="orders-o" size="50px" color="#cccccc" />
			    <view class="txt">暂无记录</view>
			</view>
        </view>
    </view>
</template>

<script>
import $http from "@/utils/https";
import Util from '@/utils/utils';
import VanDivider from '@/components/divider/index';
import VanIcon from '@/components/icon/index';
import NavBar from '@/components/navBar/index';
import Loadmore from '@/components/loadmore/loadmore';
const app = getApp()
export default {
    components: {
        'nav-bar': NavBar,
        'van-divider': VanDivider,
		'van-icon': VanIcon,
		'loadmore': Loadmore
    },
    data() {
        return {
            height: app.globalData.height,
            navbarData: {
                isGoHome: true,
                isGoBack: true,
                title: "我的处方"
            },
            PrescData: [],
            active: 0
        }
    },
    onLoad: function () {
        this.getPrescDataList();
    },
    methods: {
        // 请求电子处方列表数据
        getPrescDataList: function () {
            let userData = this.$cache.get('userData') ? this.$cache.get('userData') : {};
            let data = {
                params: [{
                    patID: userData.hisPatID,
                    hospCode: userData.hisHospID
                }]
            }
            $http.post("urlS", this, {
                code: "03100091",
                data: data,
                namespace: 'Y',
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setData({ PrescData: res.rows });
                    } else {
                        this.setData({ PrescData: [] });
                    }
                }
            });
        },
    }
}
</script>

<style>
.card {
  min-height: 200rpx;
  background: #FFFFFF;
  margin-top: 20rpx;
  padding: 30rpx;
}

.card-show {
  display: flex;
  align-items: center;
}

.card-show-img {
  width: 80rpx;
  height: 80rpx;
  border-radius: 50%;
}

.card-show-intro {
  margin-left: 24rpx;
}

.card-show-intro .text1 {
  font-size: 30rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 500;
  color: #333333;
  line-height: 42rpx;
}

.card-show-intro .text2 {
  margin-left: 16rpx;
  font-size: 26rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #999999;
  line-height: 36rpx;
}

.card-show-intro .text3 {
  font-size: 26rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #666666;
  line-height: 36rpx;
  margin-top: 4rpx;
}

.card-reg {
  padding: 20rpx 0;
  font-size: 26rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 500;
  color: #333333;
  line-height: 36rpx;
  border-bottom: 2rpx solid #E5E5E5;
}



.card-pre-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20rpx;
}

.card-pre-btn {
  width: 140rpx;
  height: 56rpx;
  background: #007AFF;
  border-radius: 8rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 26rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #FFFFFF;
  line-height: 36rpx;
}
.card-pre-item-no{
  display: flex;
  align-items: center;
}
.card-pre-btn2 {
  width: 140rpx;
  height: 56rpx;
  background:#F3F3F3;
  border-radius: 8rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 26rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #999999;
  line-height: 36rpx;
}

</style>