prove.html 14.7 KB
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <script src="../../assets/js/fontsize.js"></script>
    <link rel="stylesheet" href="../../assets/css/weui.min.css">
    <link rel="stylesheet" href="../../assets/css/api.css"/>
    <link rel="stylesheet" href="../../assets/css/style.css">
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <link rel="stylesheet" href="../../assets/css/index.css">
    <link rel="stylesheet" href="../../assets/css/doc.css">
    <link rel="stylesheet" href="../../assets/css/pay_form_f.css">
    <title></title>
    <style>
        .auth2_title {
            font-size: 14px;
            color: #424242;
            margin: 0.57rem 0.62rem 0 0.62rem;
        }

        .photos {
            display: flex;
            align-items: center;
            /*justify-content: space-around;*/
            flex-wrap: wrap;
            font-size: 14px;
            color: #424242;
        }

        .photo_item {
            display: flex;
            align-items: center;
            flex-direction: column;
            margin: 0.84rem 0 0 0;
            /*flex: 1;*/
            width: 50%;
        }

        .photo_item_img {
            height: 1.92rem;
            width: 2.46rem;
            border: 1px dashed #dcdcdc;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.1rem;
            overflow: hidden;
            margin-bottom: 0.28rem;
        }

        .photo_item_img .iconfont {
            font-size: 33px;
            color: #c1c1c1;
        }

        .photo_item_img img {
            width: 100%;
        }

        .idcard_box input {
            padding: 0.28rem 0;
            width: 100%;
            text-align: right;
        }

        .idcard_box .iconfont {
            color: #E3C88D;
            margin-right: 0.1rem;
        }

        .photo_re {
            color: #AAAAAA;
            font-size: 14px;
            text-align: right;
            margin: 0 0 0.47rem 0;
            padding-right: 1.3rem;
        }

        .auth2_tips {
            text-align: center;
            font-size: 10px;
            color: #AAAAAA;
            margin-bottom: 0.65rem;
        }

        .save_btn {
            position: relative;
            width: 84%;
            margin: 0.91rem auto 0.3rem auto;
            border-radius: 0.1rem;
            font-size: 15px;
        }
    </style>
</head>
<body>
<div id="app" v-cloak>
    <div class="auth2_title">请上传就医证明,以便订单审核(为您保密)</div>
    <div class="photos">
        <div class="photo_item">
            <div class="photo_item_img" @click="popupVisible=true">
                <img v-if="img1" :src="img1"/>
                <span v-else class="iconfont icon-xiangji"></span>
            </div>
            <div class="photo_type">诊断证明/医疗处置单</div>
        </div>
        <div class="photo_item">
            <div class="photo_item_img" @click="popupVisible1=true">
                <img v-if="img2" :src="img2"/>
                <span v-else class="iconfont icon-xiangji"></span>
            </div>
            <div class="photo_type">药品处方</div>
        </div>
        <div class="photo_item">
            <div class="photo_item_img" @click="popupVisible2=true">
                <img v-if="img3" :src="img3"/>
                <span v-else class="iconfont icon-xiangji"></span>
            </div>
            <div class="photo_type">药品照片</div>
        </div>
        <div class="photo_item">
            <div class="photo_item_img" @click="popupVisible3=true">
                <img v-if="img4" :src="img4"/>
                <span v-else class="iconfont icon-xiangji"></span>
            </div>
            <div class="photo_type">
                <div>病例</div>
            </div>
        </div>
    </div>
    <div class="photo_re">(选填)</div>
    <mt-popup v-model="popupVisible" position="bottom">
        <ul class="moreoul">
            <li @click="auth1('camera')">拍照</li>
            <li @click="auth1('album')">从相册中选择</li>
            <li @click="popupVisible=false" style="border-top: 2px solid #f0f0f0">取消</li>
        </ul>
    </mt-popup>
    <mt-popup v-model="popupVisible1" position="bottom">
        <ul class="moreoul">
            <li @click="auth2('camera')">拍照</li>
            <li @click="auth2('album')">从相册中选择</li>
            <li @click="popupVisible1=false" style="border-top: 2px solid #f0f0f0">取消</li>
        </ul>
    </mt-popup>
    <mt-popup v-model="popupVisible2" position="bottom">
        <ul class="moreoul">
            <li @click="auth3('camera')">拍照</li>
            <li @click="auth3('album')">从相册中选择</li>
            <li @click="popupVisible2=false" style="border-top: 2px solid #f0f0f0">取消</li>
        </ul>
    </mt-popup>
    <mt-popup v-model="popupVisible3" position="bottom">
        <ul class="moreoul">
            <li @click="auth4('camera')">拍照</li>
            <li @click="auth4('album')">从相册中选择</li>
            <li @click="popupVisible2=false" style="border-top: 2px solid #f0f0f0">取消</li>
        </ul>
    </mt-popup>
    <div class="save_btn" @click="auth_next">提交</div>
    <div class="auth2_tips">为提高审核速度,请最少上传1张清晰的图片</div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/index.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
    new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            img1: '',
            img2: '',
            img3: '',
            img4: '',
            popupVisible: false,
            popupVisible1: false,
            popupVisible2: false,
            popupVisible3: false,
        },
        created: function () {
            apiready = function () {
                if ($api.getStorage('img1') || ($api.getStorage('img2')) || ($api.getStorage('img3')) || ($api.getStorage('img4'))) {
                    app.img1 = $api.getStorage('img1');
                    app.img2 = $api.getStorage('img2');
                    app.img3 = $api.getStorage('img3');
                    app.img4 = $api.getStorage('img4')
                }
            }
        },
        methods: {
            //诊断证明/医疗处置单
            auth1: function (type) {
                app.popupVisible = false;
                api.getPicture({
                    sourceType: type,
                    encodingType: 'jpg',
                    mediaValue: 'pic',
                    destinationType: 'url',
                    allowEdit: true,
                    quality: 50,
                    targetWidth: 300,
                    targetHeight: 400,
                    saveToPhotoAlbum: true
                }, function (ret, err) {
                    if (ret && ret.data && ret.data !== "") {
                        api.ajax({
                            url: baseurl + 'portal/Goods/uploadProve',
                            method: 'post',
                            data: {
                                values: {
                                    type_id: 1
                                },
                                files: {
                                    file: ret.data
                                }
                            },
                            headers: {
                                "XX-Device-Type": getDevice(),
                                'XX-Token': getToken()
                            }
                        }, function (res, erro) {
                            // alert(JSON.stringify(res));
                            if (res.code == 1) {
                                toastMsg(res.msg)
                                app.img1 = res.data.url;
                                $api.setStorage('img1', res.data.url);
                            } else {
                                toastMsg(res.data.msg)
                            }
                        });
                    }
                });
            },
            // 药品处方
            auth2: function (type) {
                app.popupVisible1 = false;
                api.getPicture({
                    sourceType: type,
                    encodingType: 'jpg',
                    mediaValue: 'pic',
                    destinationType: 'url',
                    allowEdit: true,
                    quality: 50,
                    targetWidth: 300,
                    targetHeight: 400,
                    saveToPhotoAlbum: true
                }, function (ret, err) {
                    if (ret && ret.data && ret.data !== "") {
                        api.ajax({
                            url: baseurl + 'portal/Goods/uploadProve',
                            method: 'post',
                            data: {
                                values: {
                                    type_id: 2
                                },
                                files: {
                                    file: ret.data
                                }
                            },
                            headers: {
                                "XX-Device-Type": getDevice(),
                                'XX-Token': getToken()
                            }
                        }, function (res, erro) {
                            if (res.code == 1) {
                                toastMsg(res.msg)
                                app.img2 = res.data.url;
                                $api.setStorage('img2', res.data.url);
                            } else {
                                toastMsg({msg: JSON.stringify(erro)});
                            }
                        });
                    }
                });
            },
            // 药品照片
            auth3: function (type) {
                app.popupVisible2 = false;
                api.getPicture({
                    sourceType: type,
                    encodingType: 'jpg',
                    mediaValue: 'pic',
                    destinationType: 'url',
                    allowEdit: true,
                    quality: 50,
                    targetWidth: 300,
                    targetHeight: 400,
                    saveToPhotoAlbum: true
                }, function (ret, err) {
                    if (ret && ret.data && ret.data !== "") {
                        api.ajax({
                            url: baseurl + 'portal/Goods/uploadProve',
                            method: 'post',
                            data: {
                                values: {
                                    type_id: 3
                                },
                                files: {
                                    file: ret.data
                                }
                            },
                            headers: {
                                "XX-Device-Type": getDevice(),
                                'XX-Token': getToken()
                            }
                        }, function (res, erro) {
                            if (res.code == 1) {
                                toastMsg(res.msg)
                                app.img3 = res.data.url;
                                $api.setStorage('img3', res.data.url);
                            } else {
                                toastMsg({msg: JSON.stringify(erro)});
                            }
                        });
                    }
                });
            },
            // 病例
            auth4: function (type) {
                app.popupVisible3 = false;
                api.getPicture({
                    sourceType: type,
                    encodingType: 'jpg',
                    mediaValue: 'pic',
                    destinationType: 'url',
                    allowEdit: true,
                    quality: 50,
                    targetWidth: 300,
                    targetHeight: 400,
                    saveToPhotoAlbum: true
                }, function (ret, err) {
                    if (ret && ret.data && ret.data !== "") {
                        api.ajax({
                            url: baseurl + 'portal/Goods/uploadProve',
                            method: 'post',
                            data: {
                                values: {
                                    type_id: 4
                                },
                                files: {
                                    file: ret.data
                                }
                            },
                            headers: {
                                "XX-Device-Type": getDevice(),
                                'XX-Token': getToken()
                            }
                        }, function (res, erro) {
                            if (res.code == 1) {
                                toastMsg(res.msg)
                                app.img4 = res.data.url;
                                $api.setStorage('img4', res.data.url);
                            } else {
                                toastMsg({msg: JSON.stringify(erro)});
                            }
                        });
                    }
                });
            },
            auth_next: function () {
                if (app.img1 == '') {
                    toastMsg('请上传诊断证明/医疗处置单')
                } else if (app.img2 == '') {
                    toastMsg('请上传药品处方')
                } else if (app.img3 == '') {
                    toastMsg('请上传药品照片')
                }
                else {
                    api.sendEvent({
                        name: 'prove',
                        extra: {
                            diagnosis: app.img1,
                            drug_recipe: app.img2,
                            drug: app.img3,
                            ill_case: app.img4
                        }
                    });
                    api.closeWin();
                }
            },
        }
    })
</script>