<template>
    <!--填写咨询内容-->
    <view class="write-dise-con"
        :style="{ marginTop: height + 'px', height: 'calc(100vh - ' + height + 'px - 100rpx)', overflow: 'auto' }">
        <view class="write-dise-con-scroll">
            <view class="itdc-head">
                <view class="itdc-head-content" v-if="docObj">
                    <view class="itdc-head-portrait">
                        <image style="width:100rpx;height:100rpx;border-radius: 50%;" @onerror="imageError"
                            :src="docObj && docObj.image ? docObj.image : '/images/photo/a0061261ab11da688ee4574cfc8e0994.jpg'">
                        </image>
                    </view>
                    <view class="itdc-head-content-top">
                        <view class="itdc-head-content-top-text">
                            <text>{{ docObj && docObj.doctorName ? docObj.doctorName : "" }}</text>
                            <text>{{ docObj && docObj.title ? docObj.title : "" }}</text>
                            <text>|</text>
                            <text style="margin-left:16rpx">{{ docObj && docObj.locDesc ? docObj.locDesc : "" }}</text>
                        </view>
                        <view class="itdc-head-desc">
                            <text>请详细描述病情、症状，这有助于我更准确地分析，同事保证你的隐私安全！</text>
                        </view>
                    </view>
                </view>
            </view>
            <view class="write-dise-con-input">
                <view class="detail-list-item">
                    <view>预约时段</view>
                    <view class="right">
                        <text style="margin-right:20rpx">{{ time }}</text>
                    </view>
                </view>
                <view class="detail-list-item">
                    <view>就诊人</view>
                    <view class="right" @tap="showPopupTap">
                        <text style="margin-right:20rpx">{{ (patObj && patObj.patName ? (patObj.patName + ' ') : '') +
                            (patObj && patObj.patSexDesc ? patObj.patSexDesc : '') }}</text>
                        <uni-icons size="28rpx" color="#333333" type="forward" />
                    </view>
                </view>
                <view class="detail-list-item">
                    <view>挂号费</view>
                    <view class="right">
                        <view style="margin-right:20rpx">￥<text class="c-orange">{{ payAmtInt }}</text></view>
                    </view>
                </view>
                <view class="detail-list-item">
                    <view>既往病史</view>
                    <!-- <view class="right" @tap="showPopup1">
                        <text style="margin-right:20rpx">{{ checkBoxDesc ? checkBoxDesc : "请选择" }}</text>
                        <text style="margin-right:20rpx">
                        </text>
                        <van-icon size="28rpx" color="#333333" name="arrow" />
                    </view> -->
                </view>
                <view class="disease-detail-css">
                    <textarea class="placeholder-css text-css" placeholder="请输入既往病史" @input="inputValue_jwbs"
                        v-model="pastMedicalHistory" style="position:static;" cursor-spacing="140"
                        :adjust-position="true"></textarea>
                </view>
                <view class="detail-list-item">
                    <view>是否药物过敏</view>
                    <view class="right">
                        <checkbox-group :value="checked" @change="onChangeCheck">
                            <checkbox value="1"></checkbox>
                        </checkbox-group>
                    </view>
                </view>
                <view class="detail-list-item" v-if="checked.length > 0">
                    <view>过敏药物名称</view>
                    <view class="right" style="text-align: right;">
                        <input placeholder="请输入过敏药物名称" @input="drugNameTap" />
                    </view>
                </view>
                <view class="detail-list-item" style="border-bottom: 0;" v-if="entrance != '4'">
                    <view>咨询内容</view>
                    <!-- <view class="btn" bindtap="">
    					历史病情
    				</view> -->
                </view>
                <view class="disease-detail-css" v-if="entrance != '4'">
                    <scroll-view class="ddc-scroll-view" :scroll-top="lineHeight">
                        <textarea v-if="isShowText" class="placeholder-css text-css" @blur="onShowText"
                            @input="inputValue" :value="disesNote" :focus="onFacus" style="position:static;"
                            cursor-spacing="140" :adjust-position="true"></textarea>
                        <view v-else :class="disesNote == '' ? 'placeholder-css' : 'text-css'" @tap="onShowTextare">
                            <text style="word-wrap: break-word;">{{ disesNote == "" ? placeholder : disesNote }}</text>
                        </view>
                    </scroll-view>
                </view>
                <view class="ddc-message" v-if="entrance != '4'">*为保护您的隐私，请不要输入您的住址等信息。</view>
                <!-- 是否线下就诊过 -->
                <view class="detail-list-item" v-if="entrance != '4'">
                    <view><text style="color:#ee0a24;">*</text>是否就该病情到线下医院就诊过</view>
                    <view class="right">
                        <radio-group style="display:flex;" @change="onChangeVisited">
                            <label style="margin-right:30rpx;">
                                <radio value="Y" :checked="visitedOffline === 'Y'" style="transform:scale(0.8);" />是
                            </label>
                            <label>
                                <radio value="N" :checked="visitedOffline === 'N'" style="transform:scale(0.8);" />否
                            </label>
                        </radio-group>
                    </view>
                </view>
                <view class="detail-list-item" v-if="entrance != '4' && visitedOffline === 'Y'">
                    <view><text style="color:#ee0a24;">*</text>医生诊断的名称</view>
                    <view class="right" style="text-align: right;">
                        <input placeholder="请输入医生诊断的名称" :value="offlineDiagnosis" @input="inputDiagnosis" />
                    </view>
                </view>
                <!-- 职业 -->
                <view class="detail-list-item" v-if="entrance != '4'">
                    <view><text style="color:#ee0a24;">*</text>职业</view>
                    <view class="right">
                        <picker mode="selector" :range="OCCUList" range-key="label" @change="onChangeOCCU">
                            <view style="display:flex;align-items:center;">
                                <text style="margin-right:20rpx"
                                    :style="{ color: OCCUSelect ? '#333333' : '#999999' }">{{ OCCUSelect ?
                                        OCCUSelect.label : '请选择' }}</text>
                                <uni-icons size="28rpx" color="#333333" type="forward" />
                            </view>
                        </picker>
                    </view>
                </view>
                <!-- 问诊人 -->
                <view class="detail-list-item" v-if="entrance != '4'">
                    <view><text style="color:#ee0a24;">*</text>问诊人</view>
                    <view class="right" style="text-align: right;">
                        <input placeholder="请输入问诊人姓名" :value="inquirerName" @input="inputInquirerName" />
                    </view>
                </view>
                <!-- 问诊人和就诊人关系 -->
                <view class="detail-list-item" v-if="entrance != '4'">
                    <view><text style="color:#ee0a24;">*</text>问诊人和就诊人关系</view>
                    <view class="right">
                        <picker mode="selector" :range="relationList" range-key="label" @change="onChangeRelation">
                            <view style="display:flex;align-items:center;">
                                <text style="margin-right:20rpx"
                                    :style="{ color: relationSelect ? '#333333' : '#999999' }">{{ relationSelect ?
                                        relationSelect.label : '请选择' }}</text>
                                <uni-icons size="28rpx" color="#333333" type="forward" />
                            </view>
                        </picker>
                    </view>
                </view>
                <view class="detail-list-item" style="border-bottom:0" v-if="entrance != '4'">
                    <view>
                        <view>上传图片</view>
                        <view class="text1">上传内容仅对该医生可见，最多9张</view>
                        <view style="margin-top:30rpx">
                            <!-- 自定义上传按钮 -->
                            <view class="upload-btn" @tap="chooseImage" v-if="fileList.length < 9">
                                <uni-icons type="plus" size="40" color="#999"></uni-icons>
                                <text style="font-size: 24rpx; color: #999; margin-top: 10rpx;">选择图片</text>
                            </view>
                            <!-- 预览列表 -->
                            <view class="preview-list" v-if="fileList.length > 0">
                                <view class="preview-item" v-for="(item, index) in fileList" :key="index">
                                    <image :src="item.url" mode="aspectFill"></image>
                                    <view class="delete-btn" @tap="deleteImage(index)">
                                        <uni-icons type="closeempty" size="20" color="#fff"></uni-icons>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </view>
                    <view class="right">
                    </view>
                </view>
            </view>
            <view class="read" v-if="entrance != '4'">
                <view class="agree-css" @tap="agree2">
                    <uni-icons type="circle-filled" v-if="showButton" style="color:#1890FFFF;" size="48rpx" />
                    <uni-icons type="circle" v-if="showButton ? false : true" size="48rpx" />
                </view>
                <view style="color:#666666FF;">
                    <text @tap="agree2">我已阅读并同意</text>
                    <text @tap="showBookTap" style="color:#1890FF;">《{{ userData.hospDesc }}互联网医院患者知情同意书》</text>
                </view>
            </view>
            <!-- <view @tap="copyParams" style="padding: 10rpx; word-break: break-all; font-size: 24rpx; color: #333; background: #f5f5f5; border-radius: 8rpx; margin: 10rpx 0;">
                <view style="font-weight: bold; margin-bottom: 6rpx;">01050002接口入参（点击复制）：</view>
                <view>{{params ? JSON.stringify(params) : '暂无数据'}}</view>
            </view> -->
            <view class="wdc-footer-btn">
                <view class="health-pay-btn">
                    <!-- insuType O只是门诊，R只是挂号，OR门诊和挂号，其它不使用医保;   insuTestFlag Y 是测试，O 是正式库测试 其它为正式使用 -->
                    <!-- 测试 -->
                    <block
                        v-if="userData && (userData.insuType == 'R' || userData.insuType == 'OR') && userData.insuTestFlag == 'Y'">
                        <view class="pay-css" @tap="getAuthCode">
                            <text>医保支付</text>
                        </view>
                    </block>
                    <!-- 测试 -->
                    <block
                        v-if="userData && (userData.insuType == 'R' || userData.insuType == 'OR') && !userData.insuTestFlag">
                        <view class="pay-css" @tap="getAuthCode">
                            <text>医保支付</text>
                        </view>
                    </block>
                    <view @tap="judgeCompliance" class="pay-css personal">
                        <text>自费支付</text>
                    </view>
                </view>
            </view>
        </view>
    </view>

    <van-popup :show="showPopup" position="bottom" custom-style="height: 40%;" @close="onClosePopup">
        <view class="pat-wrapper">
            <view class="pat-header">
                <text class="address_text2">选择就诊人</text>
                <view style="float:right">
                    <!-- <van-button size="small" custom-class="cancel" type="info" plain @click="onClosePopup">取消</van-button> -->
                    <view class="cancel" @tap="onClosePopup">取消</view>
                </view>
            </view>
            <view style="margin:0 24rpx 16rpx 24rpx">
                <scroll-view scroll-y="true" style="height: 320rpx;margin-bottom: 100rpx">
                    <radio-group @change="onChangePat">
                        <label class="pat-item" v-for="(item, index) in visitorData" :key="index">
                            <view>
                                <radio :value="item.patID" icon-size="30rpx" :checked="item.patID == radio"></radio>
                            </view>
                            <view class="pat-radio-item">
                                <view class="pat-name-box">
                                    <text class="pat-name-text">{{ item.patName }} {{ item.idCard }}</text>
                                </view>
                                <view @tap.stop="updatePat" :data-index="item.patID">
                                    <uni-icons size="48rpx" type="compose" />
                                </view>
                            </view>
                        </label>
                    </radio-group>
                </scroll-view>
            </view>
            <view class="add-pat-css" bindtap="gotoAddPat">
                <uni-icons name="plus" size="37rpx;" /><text class="add-pat-text">添加就诊人</text>
            </view>
        </view>
    </van-popup>
    <!-- 弹出疾病多选框 -->
    <van-popup :show="showPopup1" position="bottom" custom-style="height: 40%;" @close="onClosePopup1">
        <view class="disease-wrapper">
            <view class="disease-header">
                <text class="address_text2">选择疾病</text>
                <view style="float:right">
                    <!-- <van-button size="small" custom-class="cancel" type="info" :plain="true" @click="onClosePopup1">确定</van-button> -->
                    <view class="confirm" @tap="onClosePopup1">确认</view>
                </view>
            </view>
            <view style="margin:0 24rpx 16rpx 24rpx">
                <scroll-view scroll-y="true" style="height: 410rpx;">
                    <view class="check-box">
                        <checkbox-group :value="checkBoxData" @change="onChangeCheckBoxData">
                            <label style="padding-top:20rpx;display:flex;" v-for="(item, index) in checkBox"
                                :key="index">
                                <view>
                                    <checkbox :value="item.ID" :checked="checkBoxData.indexOf(item.ID) > -1" />
                                </view>
                                <view>
                                    {{ item.descripts }}
                                </view>
                            </label>
                        </checkbox-group>
                    </view>
                </scroll-view>
            </view>
        </view>
    </van-popup>
    <van-popup :show="showBook" custom-style="height: 80%" position="bottom" @close="onCloseBook">
        <view class="zqty-container">
            <view class="zqty-header">
                <view class="zqty-title">{{ userData.hospDesc }}互联网医院患者知情同意书</view>
            </view>
            <scroll-view class="zqty-body" scroll-y="true">
                <view class="zqty-body-content" decode="true">
                    <view class="p">欢迎您使用{{ userData.hospDesc
                    }}互联网医院。在您开始使用互联网医院服务前，请您务必仔细阅读本知情同意书中的所有条款。一旦您勾选"已阅读并同意"，即表示您已充分理解并自愿接受本同意书的全部内容。</view>
                    <view class="p">特别提示： 互联网诊疗不能完全替代线下面诊。若病情出现变化或存在不适宜在线诊疗的情况，请及时前往{{ userData.hospDesc }}就诊。</view>
                    <view class="h2">一、基本声明与实名认证</view>
                    <view class="p">1、服务性质：本院互联网医院依托实体医疗机构建立，旨在为患者提供便捷的医疗健康服务，包括但不限于在线复诊、健康咨询、处方开具、药品配送等 。</view>
                    <view class="p">
                        2、实名制要求：根据国家相关规定，互联网医院实行实名制就诊。您承诺提供的姓名、身份证号、手机号及医保信息等真实有效。因提供虚假信息导致的一切后果（如误诊、用药错误等），由您自行承担 。</view>
                    <view class="h2">二、服务范围与复诊规定</view>
                    <view class="p">1、接诊范围：{{ userData.hospDesc }}互联网医院仅对部分常见病、慢性病的复诊患者提供服务。您知悉并保证，在发起在线诊疗申请前，已在{{
                        userData.hospDesc }}完成该疾病的首次诊断。</view>
                    <view class="p">2、服务限制：{{ userData.hospDesc }}互联网医院不提供首诊服务，亦不用于急诊、危重症患者。如您属于急危重症，请立即拨打120或前往就近医院就诊。
                    </view>
                    <view class="p">3、特殊药品限制：根据法律法规，互联网医院不得开具麻醉药品、精神药品、医疗用毒性药品、放射性药品以及其他用药风险较高或有特殊管理规定的药品处方。</view>
                    <view class="h2">三、诊疗风险与医患权责</view>
                    <view class="p">1、医疗局限性告知：</view>
                    <view class="p">
                        互联网诊疗无法进行体格检查及部分辅助检查，医生主要依据您提供的图文资料（病史、症状描述、既往检查报告）进行判断。若您提供的资料不准确、不全面或描述不清，可能导致诊疗方案出现偏差，相关风险由您承担。
                    </view>
                    <view class="p">由于个体差异和疾病本身的复杂性，即使医生已尽到专业努力，仍可能存在病情恶化、药物不良反应或治疗效果未达预期的风险。</view>
                    <view class="p">2、诊疗终止与转诊：当出现以下情况时，医生有权终止诊疗服务，请您配合前往实体医疗机构就诊：</view>
                    <view class="p">● 病情出现变化或加重；</view>
                    <view class="p">● 经医生判断，疾病属于疑难杂症或需现场检查确诊；</view>
                    <view class="p">● 您属于急症或重症 。</view>
                    <view class="p">3、服务行为规范：医生将通过电子签名提供诊疗服务，严禁他人或人工智能软件代替接诊 。您在交流过程中应文明用语，尊重医护人员的专业判断。</view>
                    <view class="h2">四、处方与药品服务</view>
                    <view class="p">1、处方审核：医生开具的电子处方需经本院执业药师审核合格后方可生效。您有权根据药师指导调整用药方案。</view>
                    <view class="p">2、药品配送：如选择药品配送服务，药品将由我院或我院委托的第三方配送。请您在签收时核对药品信息。除药品质量问题外，药品一经售出，不予退换。</view>
                    <view class="h2">五、隐私保护与信息收集</view>
                    <view class="p">1、信息收集：为提供诊疗服务，我们将收集您的身份信息、病情资料、健康记录（如身高、体重、慢性病史）以及问诊过程中的音视频资料 。</view>
                    <view class="p">
                        2、信息保密：本院将严格遵守《个人信息保护法》及相关医疗法规，对您的个人信息和诊疗数据予以保密，严防数据泄露。诊疗过程中的图文对话、音视频资料将按照门诊电子病历规定进行保存（保存时间不少于15年，过程记录不少于3年）。
                    </view>
                    <view class="h2">六、费用与投诉</view>
                    <view class="p">1、费用公示：互联网医院的服务收费项目及标准已在平台公示，您同意在诊疗服务开启前支付相应的挂号费/诊查费。</view>
                    <view class="p">2、投诉渠道：如您在就诊过程中对服务不满意，有权通过平台客服或医院公布的监督电话进行投诉，我们将依据事实予以协调处理。</view>
                    <view class="h2">七、法律效力与协议修改</view>
                    <view class="p">1、电子有效性：本知情同意书以电子形式签订，自您在线上点击"已阅读并同意"时起具有同等法律效力 。</view>
                    <view class="p">2、规则更新：本院有权根据法律法规的变化或业务调整修改本知情同意书。修改后的协议一经发布即视为有效告知，如您继续使用服务，视为接受修订。</view>
                    <view class="h2">八、低龄儿童互联网诊疗限制告知</view>
                    <view class="p">
                        本人/监护人已知悉并同意：由于互联网诊疗存在远程信息采集、体格检查及病情判断受限等客观限制，为保障低龄儿童诊疗安全，本互联网医院暂不为六周岁以下儿童提供线上挂号、问诊、复诊、开具处方及药品配送等互联网诊疗服务。
                    </view>
                    <view class="h2">患者承诺：</view>
                    <view class="p">本人已仔细阅读并充分理解上述所有条款，知晓互联网诊疗存在的局限性及潜在风险。本人同意遵守互联网医院的规定，保证提供信息真实有效，自愿接受互联网诊疗服务。</view>
                </view>
            </scroll-view>
            <view class="zqty-footer">
                <van-button custom-class="button_agree" type="default" @tap="agree">已阅读并同意</van-button>
            </view>
        </view>
    </van-popup>
    <van-dialog id="van-dialog" />
    <van-popup :show="showPopup2" custom-style="height: 80%;" @close="onClosePopup2">
        <view class="content" style="width: 750rpx; background: #fff; font-size: 24rpx;" @tap="copyText">
            <view class="result" style="width: 750rpx; word-break: break-all;">
                支付查询入参: {{ payStatusParams }}
            </view>
            <view class="result">
                支付查询出参: {{ payStatusResult }}
            </view>
        </view>
    </van-popup>
</template>

<script>
import Utils from '@/utils/utils';
import $http from "@/utils/https";
import { wxpay, alipay, ttpay } from '@/utils/pay'
import httpConfig from '@/utils/httpConfig';
import Dialog from '@/components/dialog/dialog'
import GenerateTestUserSig from '@/debug/GenerateTestUserSig';
import VanDialog from '@/components/dialog/index'
import VanButton from '@/components/button/index'
import VanPopup from '@/components/popup/index'

// #ifdef MP-ALIPAY
import monitor from '@/utils/alipayLogger.js';
// #endif

const jweixin = require('jweixin-module');
const app = getApp();
let timer = null;
let isPayment = true
export default {
    components: {
        'van-dialog': VanDialog,
        'van-button': VanButton,
        'van-popup': VanPopup
    },
    props: {
        path: {
            type: String,
            default: ''
        },
        payPath: {
            type: String,
            default: ''
        },
        flag: {
            type: Boolean,
            default: false
        }
    },
    data() {
        return {
            windowHost: httpConfig && httpConfig.ipDeault,
            imgHost: httpConfig && httpConfig.imgHost,
            payTypeRadio: '',
            onFacus: true,
            motto: '',
            idCardNo: '',
            admReasonCode: null, // '02': 医保支付 '01': 自费支付
            payAmtInt: 0, // 自费支付金额
            userData: {},
            hisHospID: null,
            symptom: '',
            payTradeNum: "", ///就诊ID
            prescribeTradeNum: "",
            healthPayAmt: 0, ///医保支付金额
            cashamt: 0,
            insuamt: 0,
            insuGRBalance: 0,
            fileList: [], ////图片列表
            backPage: 2, ////回退页码
            locID: '',
            showButton: false,
            showBook: false,
            patID: '',
            patIndex: null,
            radio: '',
            visitorData: null,
            showPopup: false,
            showPopup1: false,
            onFocus: false, //textarea焦点是否选中
            isShowText: false,
            show: false,
            active: 1,
            docObj: null,
            schTimeKey: "", ///预约时间段ID
            schDateKey: "", //图文咨询预约ID
            disesTime: "", //患病时长
            disesNote: "", //症状描述
            pastMedicalHistory: "", ///既往病史
            patObj: null,
            placeholder: "请详细描述您想要咨询的问题，如症状描述、持续时间、用药情况、检查治疗等。",
            lineHeight: 0, ////文本框高度
            height: app.globalData.height,
            medCardID: "",
            infoByTrandNoFlag: false,
            infoByTrandNo: 0,
            time: "",
            checked: false,
            drugName: "",
            checkBoxData: [],
            checkBoxDesc: "",
            checkBox: [],
            visitedOffline: "", // 是否就该病情到线下医院就诊过 Y/N
            offlineDiagnosis: "", // 医生诊断的名称
            OCCUList: [], // 职业字典
            OCCUSelect: null, // 选中的职业 {label, value}
            inquirerName: "", // 问诊人
            relationList: [], // 家庭关系字典
            relationSelect: null, // 选中的关系 {label, value}
            showMedicalInsurancePopup: true, // 医保使用提示弹窗是否显示
            entrance: null,
            platform: app.globalData.platform,
            provider: app.globalData.provider,
            appId: app.globalData.appId, // 应用ID
            latitude: null, //维度
            longitude: null, //经度
            payStatusParams: '',// 支付状态查询入参
            payStatusResult: '',// 支付状态查询
            params: null,
        }
    },
    mounted: function () {
        const self = this
        const userData = this.$cache.get('userData')
        if (userData) {
            this.userData = userData
            this.hisHospID = userData.hisHospID
        }
        if (userData && userData.insuType == 'Y' && !userData.insuTestFlag) {
            console.log('医保提示框')
            Dialog.alert({
                context: this,
                title: '提示',
                message: '医保线上支付仅支持市医保和省医保普通门诊结算，目前暂不支持慢特病门诊和跨省异地患者线上结算，为了不影响您的待遇，该类患者请到人工窗口进行结算。医保支付后不支持跨月的退费，请根据实际就医需求选择支付，谢谢！',
                messageAlign: 'left'
            }).then(() => {
                // on close
            });
        }

        if (app.globalData.disesNote != '' && app.globalData.disesNote) {
            Dialog.confirm({
                context: this,
                title: '提示',
                message: '是否恢复上次输入的内容？',
            })
                .then(() => {
                    this.setData({
                        disesNote: app.globalData.disesNote
                    })
                })
                .catch(() => {
                    app.globalData.disesNote = ''
                    this.setData({
                        disesNote: ''
                    })
                });
        }
        // if (!app.globalData.reservationEntrance ){
        //   this.getRegInfo()
        // }else{
        //   console.log(app.globalData.writeObj)
        //   this.setData({
        //     docObj: app.globalData.docObj,
        //     // disesTime:app.globalData.writeObj.disesTime===""?this.disesTimeList[0].name:app.globalData.writeObj.disesTime,
        //     patObj: app.globalData.patObj,
        //     schTimeKey: app.globalData.writeObj.schTimeKey, ///预约时间段ID
        //     schDateKey: app.globalData.writeObj.schDateKey, ///图文咨询预约ID
        //     userData: this.$cache.get('userData'),
        //     locID: app.globalData.locObj.locID,
        //     entrance: app.globalData.reservationEntrance
        //   }, () => {
        //     if (this.flag === true) {
        //       this.getSchDateKey()
        //     } else {
        //       this.getPayAmt();
        //       this.healthPayAmt();
        //       this.getIp();
        //     }

        //   })
        // }
        console.log('app.globalData.writeObj===', app.globalData.writeObj)
        this.setData({
            docObj: app.globalData.docObj,
            //disesTime:app.globalData.writeObj.disesTime===""?this.disesTimeList[0].name:app.globalData.writeObj.disesTime,
            patObj: app.globalData.patObj,
            schTimeKey: app.globalData.writeObj.schTimeKey, ///预约时间段ID
            schDateKey: app.globalData.writeObj.schDateKey, ///图文咨询预约ID
            userData: this.$cache.get('userData'),
            locID: app.globalData.locObj.locID,
            entrance: app.globalData.reservationEntrance,
            time: app.globalData.writeObj.time
        }, () => {
            if (this.flag === true) {
                this.getSchDateKey()
            } else {
                this.getPayAmt();
                // this.healthPayAmt();
                this.getIp();
            }
            if (this.entrance != '4') {
                this.showBookTap();
            }
        })
        this.getCheckBox();
        this.getVisitorDataList();
        this.getDictList();
    },
    methods: {
        copyParams() {
            if (!this.params) {
                uni.showToast({ title: '暂无数据', icon: 'none' })
                return
            }
            uni.setClipboardData({
                data: JSON.stringify(this.params, null, 2),
                success: () => {
                    uni.showToast({ title: '复制成功', icon: 'success' })
                },
                fail: () => {
                    // 降级使用copyText方法
                    this.copyText(this.params)
                }
            })
        },
        copyText(text) {
            if (navigator.clipboard) {
                navigator.clipboard.writeText(JSON.stringify(text)).then(() => {
                    uni.showToast({
                        title: '复制成功!'
                    })
                    console.log('复制成功!');
                }).catch(err => {
                    uni.showToast({
                        title: '复制失败:' + err
                    })
                    console.error('复制失败:', err);
                });
            } else {
                // 兼容旧版浏览器
                const textArea = document.createElement('textarea');
                textArea.value = text;
                document.body.appendChild(textArea);
                textArea.focus();
                textArea.select();
                try {
                    const successful = document.execCommand('copy');
                    console.log(successful ? '成功' : '失败');
                } catch (err) {
                    console.error('复制失败:', err);
                }
                document.body.removeChild(textArea);
            }
        },

        onShow: function () {
            console.log('onShow')
            const self = this
            let {
                platform,
                admReasonCode,
                payTradeNum
            } = self;

            if (!isPayment) {
                isPayment = true;
            }
            console.log('支付订单号：' + payTradeNum)
            console.log('操作类型：' + admReasonCode)
            // 如果支付订单号存在，直接查询订单状态
            if (payTradeNum) {
                uni.showLoading();
                if (platform == 'alipay') {
                    self.getPayStatus("alipay");
                } else {
                    self.getPayStatus("healthPay");
                }
            } else if (admReasonCode == '02' && app.globalData.authCode) {
                // #ifdef MP-WEIXIN
                // 如果是医保支付
                self.judgeCompliance(admReasonCode, function () {
                    if (payTradeNum) {
                        uni.showLoading();
                        self.getPayStatus("healthPay");
                    }
                })
                // #endif
            }

            // #ifdef MP-ALIPAY
            // 获取当前位置经纬度
            Utils.getLatLong().then(res => {
                self.latitude = res.latitude
                self.longitude = res.longitude
            })
            // #endif
        },

        onHide: function () {
            if (timer) {
                uni.hideLoading();
                clearInterval(timer)
            }
        },

        ///获取便民挂号信息
        getRegInfo: function () {
            let userData = this.$cache.get('userData')
            let data = {
                params: [{
                    hospID: userData.hospID || "",
                    hospCode: userData.hisHospID || "",
                    admreasonID: ""

                }]
            }
            $http.post("urlS", this, {
                code: "03040041",
                data: data,
                namespace: "Y",
                success: function (res) {
                    uni.hideLoading();
                    if (+res.errorCode === 0) {
                        let resObj = res.result
                        let locObj = {
                            locID: resObj.locID,
                            locCode: resObj.locCode,
                            locDesc: resObj.locDesc
                        }
                        let patObj = {
                            idCardNo: userData.idCardNo,
                            imUserID: userData.imUserID,
                            patDesc: userData.patName,
                            patID: userData.patID,
                            hisPatNo: userData.hisPatNo,
                            hisPatID: userData.hisPatID,
                            mobile: userData.mobile,
                            patSexDesc: userData.patSexDesc,
                            medCardID: userData.medCardID || ''
                        }
                        let docObj = {
                            doctorID: resObj.doctorID,
                            doctorCode: resObj.doctorCode,
                            doctorName: resObj.doctorName,
                            image: resObj.image,
                            title: resObj.title,
                        }
                        this.setData({
                            docObj: docObj,
                            patObj: patObj,
                            schTimeKey: resObj.resDetailID,
                            userData: this.$cache.get('userData'),
                            locID: locObj.locID,
                            entrance: "1"
                        }, () => {
                            this.getPayAmt();
                            // this.healthPayAmt();
                            this.getIp();
                        })
                    } else {
                        uni.showToast({
                            icon: "none",
                            title: res.errorMessage
                        });
                    }
                }
            });
        },

        /// 获取多选
        getCheckBox() {
            let userData = this.$cache.get('userData')
            let data = {
                params: [{
                    hospID: userData.hospID || "",
                    hospCode: userData.hisHospID || '',
                    upDirectID: "",
                    locID: "",
                    inputValue: ""
                }]
            }
            $http.post("urlS", this, {
                code: "03050253",
                data: data,
                namespace: "Y",
                success: function (res) {
                    console.log(res)
                    if (+res.errorCode === 0) {
                        this.setData({
                            checkBox: res.result.data
                        }, () => {
                            console.log("checkBox", this.checkBox)
                        })
                    }
                }
            });
        },

        /// 获取职业、家庭关系字典（复用就诊人登记页字典接口）
        getDictList() {
            let data = {
                params: []
            }
            $http.post("urlS", this, {
                code: "01030011",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setData({
                            OCCUList: res.OCCU && res.OCCU.length > 0 ? res.OCCU : [],
                            relationList: res.relation && res.relation.length > 0 ? res.relation : []
                        })
                    }
                }
            });
        },

        // 是否线下就诊过
        onChangeVisited(e) {
            this.setData({
                visitedOffline: e.detail.value
            })
        },

        // 输入医生诊断的名称
        inputDiagnosis(e) {
            this.setData({
                offlineDiagnosis: e.detail.value
            })
        },

        // 输入问诊人姓名
        inputInquirerName(e) {
            this.setData({
                inquirerName: e.detail.value
            })
        },

        // 选择职业
        onChangeOCCU(e) {
            this.setData({
                OCCUSelect: this.OCCUList[e.detail.value] || null
            })
        },

        // 选择问诊人和就诊人关系
        onChangeRelation(e) {
            this.setData({
                relationSelect: this.relationList[e.detail.value] || null
            })
        },

        //切换单选按钮
        onChangeCheck(event) {
            console.log(event)
            this.setData({
                checked: event.detail.value,
            });
        },
        ///多选
        onChangeCheckBoxData(event) {
            console.log(event)
            this.setData({
                checkBoxData: event.detail.value,
            })
        },
        //输入过敏药品名称
        drugNameTap(e) {
            this.setData({
                drugName: e.detail.value
            })
        },

        onClosePopup() {
            this.setData({
                showPopup: false
            });
        },

        showPopupTap() {
            this.setData({
                showPopup: true
            });
        },

        onClosePopup1() {
            const {
                checkBox,
                checkBoxData
            } = this
            const resCheckBoxData = checkBoxData.map(item => {
                for (let i = 0; i < checkBox.length; i++) {
                    if (item == checkBox[i].ID) return checkBox[i].descripts
                }
            })
            this.setData({
                checkBoxDesc: resCheckBoxData.toString(),
                showPopup1: false
            })
        },

        showPopupTap1() {
            this.setData({
                showPopup1: true
            });
        },

        onClosePopup2() {
            this.setData({
                showPopup2: false
            });
        },

        ///跳转到添加就诊人
        gotoAddPat: Utils.debounce(function () {
            uni.navigateTo({
                url: "../../../../mine/addCard/visitorEntry/visitorEntry",
                success: (res) => {
                    res.eventChannel.emit('turnBack', {
                        url: this.flag ? '../../../index/pages/graphicConsultation/graphicConsulWriteContent/graphicConsulWriteContent' :
                            '../../../index/pages/videoConsultation/videoConsulWriteContent/videoConsulWriteContent',
                    })
                },
            })
        }),

        ///选择就诊人
        onChangePat(event) {
            const self = this
            let {
                visitorData
            } = self;
            console.log(event)
            let patObj = {};
            for (var i = 0; i < visitorData.length; i++) {
                if (visitorData[i].patID === event.detail.value) {
                    console.log(visitorData[i].patID, event.detail.value)
                    patObj = visitorData[i];
                    break;
                }
            }
            this.setData({
                radio: event.detail.value,
                patObj
            }, () => {
                // this.loginTim(this.patObj);
            });
            setTimeout(() => {
                self.onClosePopup()
            }, 300)
        },

        onCloseBook() {
            this.setData({
                showBook: false
            });
        },

        showBookTap() {
            this.setData({
                showBook: true
            });
        },

        agree() {
            this.setData({
                showButton: true
            }, () => {
                this.onCloseBook();
            })
        },

        agree2() {
            this.setData({
                showButton: this.showButton == false ? true : false
            })
        },

        ///查询就诊人列表
        getVisitorDataList: function () {
            const self = this
            let data = {
                params: [{}]
            }
            $http.post("urlS", self, {
                code: "01030001",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        if (res.result && res.result.totalCount === 0) {
                            Dialog.alert({
                                context: self,
                                title: '提示',
                                message: '请添加就诊人',
                            }).then(() => {
                                self.gotoAddPat()
                            });
                            return
                        } else {
                            let data = JSON.parse(JSON.stringify(res.result.rows))
                            self.replaceIdCardNo(data);
                        }

                    } else {
                        self.setData({
                            visitorData: []
                        });
                    }
                }
            });
        },

        ///处理身份证号
        replaceIdCardNo(data) {
            const self = this
            for (var i = 0; i < data.length; i++) {
                data[i].idCard = Utils.identityCardEncryption(data[i].idCardNo)
            }
            console.log(data)
            self.setData({
                visitorData: data
            }, () => {
                const {
                    visitorData,
                    patObj
                } = self
                if (data.length === 1) {
                    self.setData({
                        patIndex: 0,
                        patID: data[0].patID,
                        patObj: data[0],
                        radio: data[0].patID
                    }, () => {
                        // self.loginTim(data[0])
                    })
                    app.globalData.patObj = data[0];
                } else if (this.$cache.get('userData').patID != "") {
                    for (var i = 0; i < visitorData.length; i++) {
                        if (visitorData[i].patID == this.$cache.get('userData').patID) {
                            self.setData({
                                patObj: visitorData[i],
                                patID: visitorData[i].patID,
                                patIndex: i,
                                radio: visitorData[i].patID,
                            }, () => {
                                if (!app.globalData.isLogOut) { // 判断是否以及退出，已经退出则不需要退出再登录，而是直接登录
                                    // self.login(patObj && patObj.imUserID ? patObj.imUserID : "");
                                }
                            });
                            app.globalData.patObj = visitorData[i];
                            break;
                        }
                    }
                }
            });
        },

        //图片加载出错，替换为默认图片
        imageError(e) {
            this.docObj.image = "https://api.daidr.me/apis/imgholder/74x95.png?text=推荐医生";
        },

        chooseImage() {
            const self = this;
            const remaining = 9 - this.fileList.length;
            if (remaining <= 0) {
                uni.showToast({ title: '最多上传9张图片', icon: 'none' });
                return;
            }
            uni.chooseImage({
                count: remaining,
                sizeType: ['compressed'],
                sourceType: ['album', 'camera'],
                success(res) {
                    // 逐一上传选择的图片
                    res.tempFilePaths.forEach(path => {
                        self.afterRead(path);
                    });
                },
                fail(err) {
                    console.log('选择图片失败:', err);
                }
            });
        },

        ///文件上传
        afterRead(filePath) {
            const self = this;
            let newUserData = this.$cache.get('userData');
            uni.showLoading({ title: '上传中...', mask: true });
            uni.uploadFile({
                // url: self.windowHost +'/uploadFile?fileType=consult',
                url: newUserData && newUserData.consultFileUpload ? newUserData.consultFileUpload.indexOf("http") !== -1 ? newUserData.consultFileUpload : self.windowHost + newUserData.consultFileUpload : self.windowHost + '/uploadFile?fileType=consult',
                filePath: filePath,
                name: 'file',
                success(res) {
                    uni.hideLoading();
                    // 上传完成需要更新 fileList
                    if (res.statusCode === 200) {
                        let data = JSON.parse(res.data);
                        if (data.filePath) {
                            let path = data.filePath;
                            let url = (newUserData && newUserData.consultFile ? newUserData.consultFile.indexOf("http") !== -1 ? newUserData.consultFile : self.windowHost + newUserData.consultFile : self.windowHost + "/images/consult/") + path;
                            self.fileList.push({
                                url: url,
                                isImage: true,
                                path: path
                            });
                            self.setData({
                                fileList: self.fileList
                            });
                        }
                    } else {
                        uni.showToast({ title: '上传失败', icon: 'none' });
                    }
                },
                fail(err) {
                    uni.hideLoading();
                    uni.showToast({ title: '上传失败', icon: 'none' });
                    console.log('上传失败:', err);
                }
            });
        },

        ///删除图片
        deleteImage(index) {
            this.fileList.splice(index, 1);
            this.setData({
                fileList: this.fileList
            })
        },

        onShowTextare() { //显示textare
            this.setData({
                isShowText: true,
                onFacus: true
            })
        },

        onShowText() { //显示text
            this.setData({
                isShowText: false,
                onFacus: false
            })
        },

        inputValue(e) {
            var value = e.detail.value;
            this.setData({
                disesNote: value,
            });
            app.globalData.disesNote = value
        },

        // 既往病史
        inputValue_jwbs(e) {
            var value = e.detail.value;
            this.setData({
                pastMedicalHistory: value,
            });
            app.globalData.pastMedicalHistory = value
        },

        updatePat(e) {
            const self = this
            let patID = e.currentTarget.dataset.index
            console.log(132132132132, patID, e.currentTarget)
            uni.navigateTo({
                url: "/pages/mine/addCard/cardDetail/cardDetail",
                success: (res) => {
                    res.eventChannel.emit('turnBack', {
                        patID: patID,
                        url: self.flag ? '../../../index/pages/graphicConsultation/graphicConsulWriteContent/graphicConsulWriteContent' :
                            '../../../index/pages/videoConsultation/videoConsulWriteContent/videoConsulWriteContent',
                    })
                },
            })
        },

        // 登录
        login: Utils.debounce(function (userID) {
            console.log("IM登录", userID)
            let userData = GenerateTestUserSig.genTestUserSig(userID || '');
            let promise = app.globalData.tim.login({
                userID: userID || '',
                userSig: userData && userData.userSig ? userData.userSig : ""
            });
            promise.then((imResponse) => {
                app.globalData.isLogOut = true;
                console.log("tim登录成功：", userID);
            }).catch((imError) => {
                console.log('tim登录失败', userID, imError); // 登录失败的相关信息
            });
        }),

        // 退出
        signOut: function (type, userID) {
            const self = this
            try {
                let promise = app.globalData.tim.logout();
                promise.then((imResponse) => {
                    app.globalData.isLogOut = false;
                    console.log("退出登录成功：", imResponse)
                    if (type === "signOut") {
                        self.login(userID);
                    }
                }).catch(function (imError) {
                    console.log('退出失败');
                });
            } catch (err) {
                console.log("退出失败")
            }
        },

        // 重新登录tim
        loginTim(patObj) {
            const self = this
            let userData = this.$cache.get('userData') || {};
            const {
                patIndex
            } = self;
            if (userData.imUserID !== patObj.imUserID) {
                this.$cache.set('userData', {
                    ...userData,
                    idCardNo: patObj.idCardNo,
                    imUserID: patObj.imUserID,
                    patDesc: patObj.patName,
                    patID: patObj.patID,
                    hisPatNo: patObj.hisPatNo,
                    hisPatID: patObj.hisPatID,
                    mobile: patObj.mobile,
                    patValue: patIndex ? patIndex : 0,
                    patSexDesc: patObj.patSexDesc,
                    medCardID: patObj.medCardID || ''
                });
                console.log(!app.globalData.isLogOut)
                if (!app.globalData.isLogOut) { // 判断是否以及退出，已经退出则不需要退出再登录，而是直接登录
                    // self.login(patObj.imUserID)
                } else {
                    self.signOut('signOut', patObj.imUserID)
                }
            }
        },

        // 判断患者是否符合科室要求
        judgeCompliance: Utils.debounce(function (admReasonCode, callback) {
            console.log('judgeComplian success')
            const self = this
            return new Promise((resolve, reject) => {
                if (!isPayment) {
                    if (admReasonCode == "02") {
                        uni.hideLoading();
                    }
                    return;
                }

                let code = typeof (admReasonCode) === 'string' ? admReasonCode : '01';
                self.setData({
                    admReasonCode: code
                })
                const {
                    schDateKey,
                    schTimeKey,
                    locID,
                    patObj
                } = self;
                let data = {
                    params: [{
                        patID: '',
                        patNo: patObj.hisPatNo || '',
                        locID: locID || '',
                        schDateKey: schDateKey,
                        schTimeKey: schTimeKey
                    }]
                }
                if (admReasonCode != "02") {
                    uni.showLoading({
                        mask: true
                    })
                }
                $http.post("urlS", self, {
                    code: "03100090",
                    data: data,
                    namespace: "Y",
                    success: function (resOne) {
                        if (+resOne.errorCode === 0) {
                            self.lockNumber(code).then(data => {
                                typeof callback == 'function' && callback()
                            });
                        } else {
                            uni.hideLoading();
                            uni.showToast({
                                icon: 'none',
                                title: resOne.errorMessage
                            });
                        }
                    },
                    error: function (error) {
                        console.log(error)
                    }
                });
            })
        }),

        // 挂号前加入到锁号表中
        lockNumber(code) {
            const self = this
            const {
                platform
            } = self
            return new Promise((resolve, reject) => {
                const {
                    flag,
                    entrance,
                    schDateKey,
                    schTimeKey,
                    disesNote,
                    patObj,
                    showButton,
                    visitedOffline,
                    offlineDiagnosis,
                    OCCUSelect,
                    inquirerName,
                    relationSelect
                } = self
                console.log('schTimeKey==', schTimeKey)
                let appointID = flag ? schDateKey : schTimeKey;
                if (appointID === "") {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请选择医生排班记录！！！'
                    });
                    return;
                }
                if (disesNote.length <= 10 && entrance != '4') {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '症状描述不得少于10个字'
                    });
                    return;
                }
                if (!visitedOffline && entrance != '4') {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请选择是否到线下医院就诊过'
                    });
                    return;
                }
                if (visitedOffline === 'Y' && !offlineDiagnosis.trim() && entrance != '4') {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请输入医生诊断的名称'
                    });
                    return;
                }
                if (!OCCUSelect && entrance != '4') {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请选择职业'
                    });
                    return;
                }
                if (!inquirerName.trim() && entrance != '4') {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请输入问诊人姓名'
                    });
                    return;
                }
                if (!relationSelect && entrance != '4') {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请选择问诊人和就诊人关系'
                    });
                    return;
                }
                if (!patObj.patName) {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请选择就诊人'
                    });
                    return;
                }
                if (!showButton && entrance != '4') {
                    uni.hideLoading();
                    uni.showToast({
                        icon: 'none',
                        title: '请先阅读并勾选患者知情同意书'
                    });
                    return;
                }
                let userData = this.$cache.get('userData');
                let data = {
                    params: [{
                        resDetailID: flag ? schDateKey : "",
                        patID: '',
                        bookMethodCode: "NET",
                        hospCode: userData.hisHospID || '',
                        resTimeID: flag ? "" : schTimeKey,
                    }]
                }
                $http.post("urlS", self, {
                    code: "03050234",
                    data: data,
                    namespace: "Y",
                    success: function (res) {
                        uni.hideLoading();
                        if (+res.errorCode === 0) {
                            console.log(res)
                            self.settlementPay(code, res.orderNo, function () {
                                resolve()
                            })
                        } else {
                            uni.showToast({
                                icon: 'icon',
                                title: res.errorMessage
                            });
                        }
                    },
                    error: function (error) {
                        uni.hideLoading();
                        console.log(error)
                    }
                });
            })
        },

        // 获取IP地址 
        getIp() {
            var self = this;
            uni.request({
                url: this.windowHost + '/localIP',
                success: function (e) {
                    self.setData({
                        motto: e.data.ipv4,
                    })
                }
            });
        },

        ///根据科室，医生，日期查询图文排班ID
        getSchDateKey: Utils.debounce(function () {
            let data = {
                params: [{
                    doctorID: app.globalData.docObj.doctorID + "",
                    hospCode: this.$cache.get('userData').hisHospID,
                    locID: app.globalData.locObj.locID,
                    userID: "",
                    imageFlag: "Y",
                    date: app.globalData.schDate
                }]
            }
            $http.post("urlS", this, {
                namespace: "Y",
                code: "03100040",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        const resDetailID = res.result.length > 0 ? res.result[0].resDetailID : "";
                        this.setData({
                            schDateKey: resDetailID,
                            time: res.result.length > 0 ? res.result[0].resDetail[0].timeDatail : "",
                        }, () => {
                            this.getPayAmt();
                            // this.healthPayAmt(); 
                            this.getIp();
                        });
                        app.globalData.writeObj.schDateKey = resDetailID;
                    } else {
                        this.setData({
                            schDateKey: ""
                        });
                    }
                }
            });
        }),

        ///获取医生收费金额
        getPayAmt() {
            const {
                flag,
                schDateKey,
                schTimeKey
            } = this
            let data = {
                params: [{
                    locResDetailID: flag ? schDateKey : schTimeKey
                }]
            }
            $http.post("urlS", this, {
                namespace: "Y",
                code: "03100105",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setData({
                            payAmtInt: Number(res.result).toFixed(2)
                        });
                    } else {
                        uni.showToast({
                            icon: 'none',
                            title: res.errorMessage
                        })
                    }
                }
            });
        },

        ///获取医保付费金额
        healthPayAmtTap() {
            const {
                schDateKey,
                schTimeKey
            } = this
            let data = {
                params: [{
                    appointID: schDateKey ? schDateKey : schTimeKey,
                    // hisHospID:this.hisHospID,
                    // userCode: this.$cache.get('userData').userCode,
                }]
            }
            $http.post("urlS", this, {
                code: "01050005",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        console.log("获取医保付费金额", res)
                        this.setData({
                            healthPayAmt: res.result && res.result.priceAmt ? Number(res.result.priceAmt).toFixed(2) : 0
                        });
                    } else {
                        this.setData({
                            healthPayAmt: 0
                        });
                    }
                }
            });
        },

        // 或取医保卡绑定openID以及跳转路径
        getOpenIDAndRouter() {
            let userData = this.$cache.get('userData');
            let data = {
                params: [{
                    pubAccCode: userData.pubAccCode || '',
                    openID: userData.openID || '',
                }]
            }
            $http.post("urlS", this, {
                code: "01050010",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let result = res.result;
                        uni.navigateToMiniProgram({
                            appId: result.bind_appid || '',
                            path: result.bind_url || '',
                            envVersion: 'release',
                            success(res) {
                                // 打开成功
                            },
                            fail: (error) => {
                                uni.showToast({
                                    icon: 'none',
                                    title: '跳转绑定电子医保卡界面失败，请稍后重试。'
                                });
                            }
                        })
                    }
                }
            });
        },

        // 支付预结算
        settlementPay: Utils.debounce(function (admReasonCode, orderNo, callback) {
            const self = this
            const userData = this.$cache.get('userData');
            const {
                fileList,
                entrance,
                payAmtInt,
                motto,
                flag,
                schDateKey,
                schTimeKey,
                patObj,
                medCardID,
                disesTime,
                disesNote,
                checked,
                drugName,
                checkBoxDesc,
                platform,
                appId,
                visitedOffline,
                offlineDiagnosis,
                OCCUSelect,
                inquirerName,
                relationSelect
            } = self
            const userCode = platform == "alipay" ? "alisf" : "wxsf"
            const payWayCode = platform == "alipay" ? "ALIPAY" : "WECHAT"
            if (!isPayment) {
                return;
            }
            isPayment = false;
            var imageAddress = "";
            for (var i = 0; i < fileList.length; i++) {
                if (imageAddress === "") {
                    imageAddress = fileList[i].path
                } else {
                    imageAddress = imageAddress + "&" + fileList[i].path
                }
            }

            let data = {
                params: [{
                    // #ifdef MP-ALIPAY
                    appID: appId || '', // 应用APPID
                    latitude: (self.latitude && self.longitude) ? (self.latitude + ',' + self.longitude) : '', // 当前用户所在位置经纬度
                    // #endif
                    authCode: app.globalData.authCode, // 医保支付授权码
                    cityCode: userData && userData.cityCode, // 医保城市编码
                    channel: userData && userData.channel, // 医保渠道号
                    totalFee: payAmtInt,
                    ipAddress: motto,
                    appointID: flag ? schDateKey : schTimeKey,
                    body: flag ? (entrance === '2' ? '图文咨询' : '免费咨询') : (entrance === '3' ? '视频问诊' : "预约挂号"),
                    businessType: flag ? "TWWZ" : (entrance === '3' ? "SPWZ" : (platform == 'alipay' ? 'REGAliPAY' : 'REGPAY')), // REGPAY - 预约挂号
                    patID: patObj && patObj.hisPatID ? patObj.hisPatID : '',
                    patNo: patObj && patObj.hisPatNo ? patObj.hisPatNo : '',
                    patName: patObj && patObj.patName ? patObj.patName : '',
                    idCardNo: patObj && patObj.idCardNo ? patObj.idCardNo : '',
                    mobile: patObj && patObj.mobile ? patObj.mobile : '',
                    insuFlag: admReasonCode,
                    medicalcardid: medCardID,
                    userCode,
                    data: {
                        code: "03100041",
                        params: [{
                            resTimeID: schTimeKey,
                            resDetailID: schDateKey,
                            hospCode: (userData && userData.hisHospID) || hisHospID,
                            patID: patObj && patObj.hisPatID ? patObj.hisPatID : '',
                            patName: patObj && patObj.patName ? patObj.patName : '',
                            patNo: patObj && patObj.hisPatNo ? patObj.hisPatNo : '',
                            bookMethodID: "Y",
                            bookMethodID: "Win",
                            insuFlag: admReasonCode,
                            orderNo: orderNo,
                            symptom: {
                                illnessTime: disesTime ? disesTime : '',
                                symptom: disesNote,
                                imageAddress: imageAddress,
                                appointID: flag ? schDateKey : schTimeKey,
                                AllergyFlag: checked ? "Y" : "N",
                                AllergyDesc: drugName || "",
                                DiseaseDesc: checkBoxDesc || "",
                                visitedFlag: visitedOffline || "", // 是否到线下医院就诊过 Y/N
                                diagnosisDesc: visitedOffline === 'Y' ? (offlineDiagnosis || "") : "", // 医生诊断的名称
                                occupationID: OCCUSelect && OCCUSelect.value ? OCCUSelect.value : "", // 职业ID
                                occupationDesc: OCCUSelect && OCCUSelect.label ? OCCUSelect.label : "", // 职业名称
                                inquirerName: inquirerName || "", // 问诊人
                                relationID: relationSelect && relationSelect.value ? relationSelect.value : "", // 关系ID
                                relationDesc: relationSelect && relationSelect.label ? relationSelect.label : "" // 关系名称
                            },
                            paywStr: [{
                                payWayCode,
                                payWayID: "",
                                payWayAmt: payAmtInt // admReasonCode === '02' ? healthPayAmt :
                            }],
                        }],
                    },
                }]
            }
            console.log(platform)

            uni.showLoading({
                title: '结算中,请稍后',
                mask: true
            })
            console.log('预结算参数')
            console.log(data)
            $http.post("urlS", this, {
                code: "01050002",
                data: data,
                success: function (res) {
                    console.log('预结算返回值：')
                    console.log(res)
                    uni.hideLoading();
                    app.globalData.authCode = '' //医保授权置空
                    if (+res.errorCode === 0) {
                        app.globalData.disesNote = ''
                        this.setData({
                            payTradeNum: res.result.payTradeNum ? res.result.payTradeNum : '',
                            prescribeTradeNum: res.result.prescribeTradeNum ? res.result.prescribeTradeNum : '',
                            cashamt: res.result.cashamt ? res.result.cashamt : 0,
                            insuamt: res.result.insuamt ? res.result.insuamt : 0,
                            insuGRBalance: res.result.insuGRBalance ? res.result.insuGRBalance : 0
                        }, () => {
                            if (admReasonCode === '02') {
                                if (res.result.payFlag == 'Y') {
                                    // this.demoTest()
                                    this.toJumpHealthPay(res.result) // 跳转医保待支付待结算详情页
                                } else {
                                    this.getPayStatus("gotoView");
                                }
                            } else {
                                if (+payAmtInt !== 0) {
                                    // 支付宝、微信统一支付方法
                                    this.unifyPay(res.result).then(() => {
                                        typeof callback == 'function' && callback()
                                    })
                                } else {
                                    this.getPayStatus("gotoView");
                                }
                            }
                        })
                    } else {
                        uni.hideLoading();
                        uni.showToast({
                            icon: 'none',
                            title: res.errorMessage + '，请稍后重试'
                        });
                        isPayment = true;
                    }
                },
                error: function (err) {
                    console.log(err)
                    uni.hideLoading();
                    isPayment = true;
                }
            });
        }),

        // 医保移动支付获取授权码
        getAuthCode() {
            const self = this
            const userData = this.$cache.get('userData');
            const platform = app.globalData.platform;
            this.setData({
                payTradeNum: '', // 清空单号
                prescribeTradeNum: '', // 清空单号
                admReasonCode: '02'
            })
            Utils.getAuthCode(app)
                // #ifdef MP-ALIPAY
                .then(res => {
                    self.judgeCompliance(self.admReasonCode, function () {
                        // if (payTradeNum) {
                        //     uni.showLoading();
                        //     self.getPayStatus("healthPay");
                        // }
                    })
                })
            // #endif
        },

        toJumpHealthPay: Utils.debounce(function (data) {
            const {
                flag,
                payAmtInt,
                payTradeNum,
                prescribeTradeNum
            } = this
            if (typeof data == 'object') {
                data['flag'] = flag
                data['payAmtInt'] = payAmtInt
                data['payTradeNum'] = payTradeNum
                data['prescribeTradeNum'] = prescribeTradeNum
            }
            uni.navigateTo({
                url: "/pages/index/pages/videoConsultation/waitYbSettlement/index",
                success: (res) => {
                    console.log('writeDiseCon settlmentData')
                    console.log(data)
                    res.eventChannel.emit('settlmentData', {
                        settlmentData: data
                    })
                },
            })
        }),

        // 微信、支付宝支付调用
        unifyPay(data) {
            let self = this;
            return new Promise((resolve, reject) => {
                const {
                    platform,
                    provider
                } = self
                data['provider'] = provider

                // #ifdef MP-WEIXIN || H5
                // 微信公众号支付
                wxpay(data)
                    .then(async (res) => {
                        uni.showToast({
                            title: "支付成功",
                            success(res) {
                                self.getPayStatus("wechatPay");
                            }
                        })
                        resolve()
                    })
                    .catch((errMsg) => {
                        Utils.abnormalOrderDeal(data) // 取消未支付订单
                        reject(errMsg)
                    })
                // #endif

                // #ifdef MP-ALIPAY 
                // 支付宝小程序支付
                if (platform == 'alipay') {
                    data['orderInfo'] = data.trade_no
                }
                alipay(data)
                    .then(res => {
                        if (provider == 'alipay') {
                            console.log(provider, res.resultCode)
                            if (res.resultCode == '9000') {
                                uni.showToast({
                                    title: '支付成功'
                                }, () => {
                                    self.getPayStatus("aliPay");
                                })
                                resolve()
                            } else if (res.resultCode == '6001') {
                                uni.showToast({
                                    title: res.memo
                                }, () => {
                                    Utils.abnormalOrderDeal(data) // 取消未支付订单
                                })
                                reject(res.memo)
                            } else {
                                Utils.abnormalOrderDeal(data) // 取消未支付订单
                                reject()
                            }
                        }).catch(err => {
                            isPayment = true;
                            console.log('调用支付失败', err)
                            Utils.abnormalOrderDeal(data) // 取消未支付订单
                            reject(err)
                        })
                // #endif
            })
        },

        // 获取支付状态
        getPayStatus(btnType) {
            let self = this;
            let userData = this.$cache.get('userData');
            let {
                infoByTrandNo,
                infoByTrandNoFlag,
                flag,
                payTradeNum,
                payAmtInt,
                prescribeTradeNum,
                platform
            } = self;
            // console.log(infoByTrandNoFlag)
            if (!infoByTrandNoFlag) {
                infoByTrandNo++
                self.setData({
                    infoByTrandNo
                })
                if (infoByTrandNo > 5) {
                    uni.hideLoading();
                    self.setData({
                        infoByTrandNo: 0
                    })
                    isPayment = true
                    return
                }
            }
            let data = {
                params: [{
                    hospitalCode: userData.hisHospID || '',
                    payTradeNum: payTradeNum,
                    userCode: platform === "alipay" ? "alisf" : "wxsf",
                }]
            }
            console.log('状态查询入参', data)
            uni.showLoading({
                title: '订单状态查询中',
                mask: true
            })
            self.setData({
                showPopup2: true
            })
            $http.post("urlS", self, {
                code: "130980",
                data: data,
                namespace: "UPP",
                success: function (res) {
                    // console.log(res)
                    self.setData({
                        payStatusResult: JSON.stringify(res)
                    })
                    isPayment = true;
                    if (+res.errorCode === 0) {
                        uni.hideLoading();
                        self.setData({
                            infoByTrandNoFlag: true
                        }, () => {
                            if (btnType === "gotoView") {
                                self.gotoView();
                            } else if (["wechatPay", "healthPay", "aliPay"].indexOf(btnType) > -1) {
                                // #ifdef MP-ALIPAY
                                // 服务办结
                                monitor.api({
                                    api: "预约挂号",
                                    success: true,
                                    c1: "taSR_YL",
                                    time: Math.floor(Math.random() * 100 + 50)
                                })
                                // #endif
                                uni.reLaunch({
                                    url: '/pages/index/common/paySuccess/paySuccess?payAmtInt=' + payAmtInt + '&flag=' + flag + '&payTradeNum=' + payTradeNum + '&prescribeTradeNum=' + prescribeTradeNum
                                })
                            }
                        })
                    } else if (res.errorCode == 'UN') { // 医保支付成功，HIS保存未成功，跳转账单已付款页面
                        uni.switchTab({
                            url: '/pages/tabBar/order/order?tab=1',
                        })
                    } else if (res.errorCode == 'NOTPAY') {
                        self.resetData(res.errorMessage)
                    } else {
                        if (infoByTrandNo == 5) {
                            self.resetData(res.errorMessage)
                        } else {
                            self.getPayStatus(btnType)
                        }
                    }
                },
                error: function (error) {
                    self.resetData("失败，稍后重试")
                },
                callback: function (res) {
                    self.setData({
                        payStatusParams: res
                    })
                }
            });
        },

        resetData(errorMessage) {
            uni.hideLoading()
            isPayment = true;
            uni.showToast({
                icon: 'none',
                title: errorMessage
            });
            this.setData({
                payTradeNum: '',
                prescribeTradeNum: ''
            })
        },

        // 不需要调用微信
        gotoView() {
            // console.log("gotoView-uni.reLaunch")
            const {
                payAmtInt,
                flag,
                payTradeNum,
                prescribeTradeNum
            } = this
            uni.reLaunch({
                url: '/pages/index/common/paySuccess/paySuccess?payAmtInt=' + payAmtInt + '&flag=' + flag + '&payTradeNum=' + payTradeNum + '&prescribeTradeNum=' + prescribeTradeNum
            })
        },
    },
}
</script>

<style lang="scss">
.c-orange {
    color: #FA541C;
}

.write-dise-con {
    overflow: hidden;
    padding-bottom: 100rpx;
}

.write-dise-con-scroll {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
}

.choose-doctor-header-bg {
    position: absolute;
    left: 0;
    top: 0;
    height: 242rpx;
    width: 100%;
    z-index: -1;
}

.choose-doctor-header {
    height: 170rpx;
    padding: 0 24rpx;
    padding-top: 10rpx;
    box-sizing: border-box;
}

.choose-doctor-header-content {
    width: 100%;
    height: 100%;
    background: #fff;
    padding-top: 20rpx;
    box-sizing: border-box;
    border-radius: 10rpx;
}

.cdhc-steps {
    display: flex;
    justify-content: space-around;
}

.cdhc-steps-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 112rpx;
}

.cdhc-steps-content text {
    color: #1890FF;
    font-size: 28rpx;
    font-weight: bold;
}

.cdhc-steps-content:nth-child(3) text {
    color: #666;
}

.cdhc-steps .cdhc-steps-image {
    width: 80rpx;
    height: 80rpx;
    margin-bottom: 12rpx;
}

.cdhc-steps-content .after,
.cdhc-steps-content .before {
    position: absolute;
    width: 70%;
    height: 4rpx;
    background: #eee;
    top: 40rpx;
    right: 90%;
}

.cdhc-steps-content .after {
    background: #1890FF;
}

.cdhc-steps-content .before {
    left: 90%;
}

.itdc-head {
    padding: 30rpx;
    background: rgba(255, 255, 255, 1);
    margin-bottom: 12rpx;
}

.itdc-head-portrait {
    margin-top: -115rpx;
    margin-right: 20rpx;
}

.write-dise-con-scroll .wdc-footer-btn {
    background: #fff;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    font-size: 32rpx;
}

.itdc-head-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.itdc-head-content-top-text {
    font-size: 26rpx;
    color: #999999;
}

.itdc-head-content-top-text text:nth-child(1) {
    font-size: 30rpx;
    font-weight: 500;
    color: #333333;
}

.itdc-head-content-top-text text:nth-child(2) {
    margin: 0 16rpx;
}

.itdc-head-content .van-rate {
    border-radius: 10rpx;
    width: 240rpx;
    height: 40rpx;
    margin: 16rpx 0;
    line-height: 40rpx;
    background: #feeee8;
    display: flex;
    justify-content: space-between;
    padding: 0 12rpx;
    padding-bottom: 4rpx;
    align-items: center;
    box-sizing: border-box;
}

.itdc-head-desc {
    width: 520rpx;
    height: 90rpx;
    background: #F6F6F6;
    padding: 30rpx;
    margin-top: 20rpx;
    font-size: 26rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #999999;
    line-height: 46rpx;
}

.write-dise-con-input {
    background: #FFFFFF;
    padding: 0 30rpx;
}


.pay-type {
    border-radius: 10rpx 10rpx 0 0;
    font-size: 32rpx;
    color: #666;
    background-color: rgba(255, 255, 255, 1);
    padding: 20rpx 38rpx 20rpx 32rpx;

}

.pat-item {
    height: 72rpx;
    margin: 16rpx 16rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .pat-radio-item {
        margin: 0 16rpx;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .pat-name-box {
            width: 550rpx;

            .pat-name-text {
                font-size: 28rpx;
            }
        }
    }
}


.radio {
    display: flex !important;
}

.disease-detail-css {
    height: 136rpx;
    background: #F6F6F6;
    border-radius: 8rpx;
    border-bottom: 2rpx solid #E5E5E5;
}

.ddc-add-img {
    background-color: #fff;
    border-radius: 0 0 10rpx 10rpx;
    padding: 24rpx;
    padding-bottom: 0;
    margin-bottom: 10rpx;
}

.button-css {
    width: 180rpx;
    text-align: center;
    background: #FAF9F9;
    border: 1rpx solid #ccc;
    border-radius: 4rpx;
    font-size: 28rpx;
    float: left;
    color: #666;
    height: 64rpx;
    line-height: 64rpx;
    margin-left: 24rpx;
    z-index: 99;
}

.image-tip {
    font-size: 32rpx;
    line-height: 42rpx;
    margin-bottom: 23rpx;
    color: #000;
}

.image-tip text {
    color: #F5222D;
    font-size: 28rpx;
}

.textarea {
    min-height: 190rpx !important;
}

.ddc-scroll-view {
    width: 100%;
    box-sizing: border-box;
    height: 136rpx;
}

.placeholder-css,
.text-css {
    font-size: 28rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #999999;
    line-height: 38rpx;
    padding: 20rpx;
}

.text-css {
    color: #333;
}

.cancel,
.confirm {
    border: 0 !important;
    color: #1890FF;
}

.button_agree {
    width: 100% !important;
    height: 100rpx !important;
    color: #1890ff !important;
    font-weight: bold;
}

.read {
    padding: 30rpx 30rpx 80rpx 30rpx;
    font-size: 26rpx;
}

.agree-css {
    float: left;
    line-height: 50rpx;
    height: 90rpx;
    margin-right: 17rpx;
}

.wdc-footer-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    font-size: 32rpx;
    background: white;
}

.total-css {
    font-size: 30rpx;
    font-family: PingFang SC;
    color: #333333FF
}

.health-pay-btn {
    position: relative;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    padding: 30rpx;
    padding-bottom: calc(env(safe-area-inset-bottom) + 30rpx);
}

.health-pay-css {
    height: 100rpx;
    line-height: 100rpx;
    font-size: 32rpx;
    text-align: center;
    background-color: white;
}

.health-pay-right {
    width: 50%;
    display: flex;
    padding-right: 24rpx;
}

.health-pay-right-item {
    flex: 1;
    height: 100rpx;
    font-size: 32rpx;
    display: flex;
    align-items: center;
}

.health-pay-right-item text {
    width: 100%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    position: relative;
}

.health-pay-right-item text:after {
    height: 80rpx;
    width: 80rpx;
    position: absolute;
    background: #eee;
    border-radius: 50%;
    display: block;
    height: 80rpx;
    top: 0;
    content: '';
    z-index: -1;
}

.health-pay-right-item.pay-css1 text,
.health-pay-right-item.pay-css2 text {
    background-color: #13c2c2;
    color: #fff;
}

.health-pay-right-item.pay-css2 text {
    color: #fff;
    background-color: #1890ff;
}

.health-pay-right-item.pay-css1 text:after {
    left: -20%;
    background-color: #13c2c2;
    color: rgba(255, 255, 255, 1);
}

.health-pay-right-item.pay-css2 text:after {
    right: -20%;
    background-color: #1890ff;
    color: black;
}

.pat-wrapper,
.disease-wrapper {
    height: 100%;
    background-color: #FFFFFF;
}

.pat-header,
.disease-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 86rpx;
    border-bottom: 1rpx solid #e5e5e5;
    padding: 0 24rpx;
}

.add-pat-css {
    height: 110rpx;
    background-color: #FFFFFF;
    width: 100%;
    color: #1890FF;
    font-size: 32rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    bottom: 30rpx;
    position: fixed;
}

.add-pat-text {
    margin-left: 12rpx;
}

.pay-type {
    border-radius: 10rpx 10rpx 0 0;
    font-size: 32rpx;
    color: #666;
    background-color: rgba(255, 255, 255, 1);
    padding: 20rpx 38rpx 20rpx 32rpx;

}

.radio {
    display: flex !important;
}

.radio .van-radio {
    margin-left: 30rpx;
}

.consultation-content {
    width: 100%;
    color: #000;
    font-size: 32rpx;
    height: 64rpx;
    line-height: 64rpx;
}

.ddc-message {
    font-size: 20rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 300;
    color: #FF8F37;
    line-height: 28rpx;
    padding: 16rpx 0 30rpx 0;
    border-bottom: 2rpx solid #E5E5E5;
}

.health-pay-btn .pay-css {
    position: relative;
    width: 330rpx;
    height: 88rpx;
    background: #FEA935;
    border-radius: 8rpx;
    font-size: 28rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #FFFFFF;
    line-height: 40rpx;
    text-align: center;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.health-pay-btn .pay-css.personal {
    background-color: #007AFF;
    margin-left: 20rpx;
}

.health-pay-btn .pay-css:active::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
}

.detail-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 28rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666;
    line-height: 40rpx;
    border-bottom: 2rpx solid #E5E5E5;
    padding: 30rpx 0;
}

.detail-list-item .right {
    display: flex;
    align-items: center;
    font-size: 28rpx;
    color: #333333;
    line-height: 40rpx;
}

.detail-list-item .btn {
    width: 132rpx;
    height: 48rpx;
    border-radius: 8rpx;
    border: 2rpx solid #007AFF;
    font-size: 22rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #007AFF;
    line-height: 32rpx;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-list-item .text1 {
    font-size: 20rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 300;
    color: #999999;
    line-height: 28rpx;
    margin-top: 4rpx;
}

/* 自定义上传按钮样式 */
.upload-btn {
    width: 200rpx;
    height: 200rpx;
    border: 2rpx dashed #ccc;
    border-radius: 8rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 预览列表样式 */
.preview-list {
    display: flex;
    flex-wrap: wrap;
    margin-top: 20rpx;
}

.preview-item {
    position: relative;
    width: 200rpx;
    height: 200rpx;
    margin-right: 16rpx;
    margin-bottom: 16rpx;
    border-radius: 8rpx;
    overflow: hidden;
}

.preview-item image {
    width: 100%;
    height: 100%;
}

.preview-item .delete-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 40rpx;
    height: 40rpx;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 8rpx 0 8rpx;
}

.check-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

.zqty-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #fff;
}

.zqty-header {
    box-sizing: border-box;
    height: 88rpx;
    flex-shrink: 0;
    padding: 24rpx 0 16rpx 0;
    background-color: #fff;
    border-bottom: 1rpx solid #eee;
}

.zqty-title {
    display: block;
    font-size: 32rpx;
    text-align: center;
    font-weight: 700;
}

.zqty-body {
    height: calc(100% - 228rpx);
    flex: 1;
    line-height: 70rpx;
    font-size: 24rpx;
}

.zqty-body-content {
    padding: 0 20rpx 20rpx;
    box-sizing: border-box;
}

.zqty-footer {
    flex-shrink: 0;
    padding: 20rpx;
    background-color: #fff;
    box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.06);
}

.zqty-body .h2 {
    display: block;
    font-size: 28rpx;
    margin: 20rpx 0 8rpx 0;
}

.zqty-body .p {
    display: block;
    font-size: 20rpx;
    margin: 12rpx 0;
    line-height: 40rpx;
    word-break: break-all;
    text-align: justify;
}
</style>