my_order_go.html 16.0 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
<!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/api.css"/>
    <link rel="stylesheet" href="../../assets/css/style.css">
    <link rel="stylesheet" href="../../assets/css/index.css">
    <link rel="stylesheet" href="../../assets/css/doc.css">
    <link rel="stylesheet" href="../../assets/css/pay.css">
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <title></title>
    <style type="text/css">
        body {
            padding-bottom: 0.7rem;
        }

        .hr {
            height: 0.11rem;
            background-color: #f2f2f2;
        }

        .pay_date {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.2rem 0.53rem 0.2rem 0.42rem;
            font-size: 16px;
            color: #424242;
        }

        .bordert {
            border-top: 1px solid #ececec;
        }

        .order_num {
            padding: 0.2rem 0.44rem;
            background-color: #f2f2f2;
            font-size: 16px;
            color: #424242;
        }

        .order_btn_box {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            margin: 0.82rem 0;
            padding: 0 0.5rem;
            font-size: 19px;
            color: #D8B25F;
        }

        .order_btn_box span {
            border: 1px solid #D8B25F;
            border-radius: 0.16rem;
            width: 1.81rem;
            text-align: center;
            padding: 0.15rem 0;
            margin-left: 0.44rem;
        }

        .cath_order {
            display: flex;
            align-items: center;
            padding: 0.23rem 0;
            background-color: #fff;
            position: fixed;
            width: 100%;
            bottom: 0;
            z-index: 2;
            justify-content: flex-end;
            font-size: 17px;
        }

        .cath_order span {
            padding: 0.15rem 0.28rem;
            border-radius: 0.1rem;
        }

        .span0 {
            background-color: #dbb25f;
            color: #fff;
        }

        .span1 {
            border: 1px solid #dbb25f;
            color: #dbb25f;
            margin: 0 0.34rem 0 0.44rem;
        }
    </style>
</head>
<body>
<div id="loadStart"></div>
<div id="app" v-cloak>
    <div class="pay_time" v-if="order_type=='待付款'">支付剩余时间:{{minute}}:{{second}}</div>
    <div class="pay_box">
        <div class="pay_item_title">
            <span class="pay_item_title_span">{{order_info.post_title}}</span>
            <span v-if="order_info.order_type">{{order_info.order_type}}</span>
            <span v-else>
                <span v-if="status==0">待结单</span>
                <span v-else-if="status==1">已接单</span>
                <span v-else>已完成</span>
            </span>
        </div>
        <div class="pay_detail">
            <div class="pay_detail_item">
                <span class="iconfont icon-yonghu"></span>
                <span class="pay_detail_label">服务对象</span>
                <span>{{order_info.name}}</span>
            </div>
            <div class="pay_detail_item">
                <span class="iconfont icon-xingbie"></span>
                <span class="pay_detail_label"> 性别</span>
                <span v-if="order_info.sex==1"></span>
                <span v-else></span>
            </div>
            <div class="pay_detail_item">
                <span class="iconfont icon-chuhangriqi"></span>
                <span class="pay_detail_label">出生日期</span>
                <span>{{order_info.birthday}}</span>
            </div>
            <div class="pay_detail_item">
                <span class="iconfont icon-dianhua-1"></span>
                <span class="pay_detail_label">联系电话</span>
                <span>{{order_info.mobile}}</span>
            </div>
            <div class="pay_detail_item">
                <span class="iconfont icon-shijian1"></span>
                <span class="pay_detail_label">上门时间</span>
                <span v-if="user_type==1">{{order_info.service_time}}</span>
                <span v-else>{{order_info.service_time}}</span>
            </div>
            <div class="pay_detail_item">
                <span class="iconfont icon-dizhi"></span>
                <span class="pay_detail_label">服务地址</span>
                <span>{{order_info.address}}</span>
            </div>
        </div>
    </div>
    <div class="hr"></div>
    <div class="pay_box">
        <div class="pay_item_title"><span class="pay_item_title_span">病情描述</span></div>
        <div class="pay_detail">
            <div class="pay_detail_item"><span class="pay_detail_label">{{order_info.remark}}</span></div>
        </div>
    </div>
    <div class="pay_box" v-if="order_info.ill_case||order_info.drug||order_info.drug_recipe||order_info.diagnosis">
        <div class="pay_item_title"><span class="pay_item_title_span">就医证明</span></div>
        <div class="pay_detail">
            <div class="pay_detail_item">
                <div class="pay_detail_item_img" v-if="order_info.ill_case!=''">
                    <img :src="order_info.ill_case" alt="">
                </div>
                <div class="pay_detail_item_img" v-if="order_info.drug!=''">
                    <img :src="order_info.drug" alt="">
                </div>
                <div class="pay_detail_item_img" v-if="order_info.drug_recipe!=''">
                    <img :src="order_info.drug_recipe" alt="">
                </div>
                <div class="pay_detail_item_img" v-if="order_info.diagnosis!=''">
                    <img :src="order_info.diagnosis" alt="">
                </div>
            </div>
        </div>
    </div>
    <div class="pay_date bordert" v-if="user_type!=1">
        <span>总服务费</span><span>{{order_info.price?order_info.price:0}}元</span>
    </div>
    <div class="pay_date bordert" v-else>
        <span>总服务费</span><span>{{order_info.server_fee?order_info.server_fee:0}}元</span>
    </div>
    <div class="order_num">订单号:{{order_info.order_sn}}</div>
    <div v-if="user_type==1&&status==0" class="cath_order">
        <span class="span0" @click="catch_order">确认接单</span>
        <span class="span1" @click="cancel">无法接单</span>
    </div>
    <div class="order_btn_box" v-if="order_type=='待付款'">
        <span @click="cancel_order" v-if="order_type=='待付款'||order_type=='支付中'">取消支付</span>
        <span @click="pay_moneny">支付</span>
    </div>
    <div class="order_btn_box" v-if="order_type=='支付中'">
        <span @click="pay_moneny">支付</span>
    </div>
    <div class="order_btn_box" v-if="order_type=='进行中'">
        <span @click="re_money">退款</span>
    </div>
    <!--<div class="order_btn_box" v-else-if="order_type=='进行中'"><span @click="cancel_order">取消支付</span></div>-->
</div>
</body>
</html>

<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.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/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: {
            minutes: 30,
            seconds: 0,
            order_id: '',
            order_type: '',
            order_info: [],
            time: [],
            user_type: '',
            gid: '',
            id: '',
            status: ''
        },
        created: function () {
            apiready = function () {
                app.order_id = api.pageParam.order_id;
                app.id = api.pageParam.id;
                app.order_type = api.pageParam.order_type;
                app.user_type = api.pageParam.user_type;
                app.status = api.pageParam.status;
                if (app.user_type == 1) {
                    app.serverOrderInfo()
                } else {
                    app.myOrder();
                    app.add();
                }
            }
        },
        watch: {
            second: {
                handler(newVal) {
                    this.num(newVal)
                }
            },
            minute: {
                handler(newVal) {
                    this.num(newVal)
                }
            }
        },
        computed: {
            second: function () {
                return this.num(this.seconds)
            },
            minute: function () {
                return this.num(this.minutes)
            }
        },

        methods: {
            num: function (n) {
                return n < 10 ? "0" + n : "" + n
            },
            add: function () {
                var time = window.setInterval(function () {
                    if (app.seconds == 0 && app.minutes != 0) {
                        app.seconds = 59;
                        app.minutes -= 1;
                    } else if (app.minutes == 0 && app.seconds == 0) {
                        app.seconds = 0;
                        window.clearInterval(time);
                        if (app.order_type == '待付款') {
                            // app.cancel_order();
                            closeWindow('my_order')
                        }
                    } else {
                        app.seconds -= 1
                    }
                }, 1000);
            },
            // 去支付
            pay_moneny: function () {
                openView('my_pay', 'my/my_pay', '支付', 'my_pay', false, {order_id: app.order_id});
            },
            // 获取用户端详情
            myOrder: function () {
                var post = {
                    order_id: app.order_id
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken(),
                };
                getRequest('post', 'user/Order/getOrderInfo', post, header).then(function (res) {
                    // alert(JSON.stringify(res));
                    if (res.data.code == 1) {
                        app.time = (res.data.data.timeout).split(':');
                        app.seconds = parseInt(app.time[1]);
                        app.minutes = parseInt(app.time[0]);
                        app.order_info = res.data.data;

                    } else {
                        toastMsg(res.data.msg)
                    }
                    loadEnd();
                })
            },
            // 取消订单
            cancel_order: function () {
                api.showProgress({
                    title: '取消订单',
                    text: '正在取消订单',
                    modal: false
                });
                var post = {
                    order_id: app.order_id
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken(),
                };
                getRequest('post', 'user/Order/cancleOrder', post, header).then(function (res) {
                    // alert(JSON.stringify(res));
                    if (res.data.code == 1) {
                        toastMsg(res.data.msg);
                        setTimeout(res => {
                            openView('my_orderlist', 'my/my_orderlist', '我的订单')
                        }, 2000);
                        api.sendEvent({
                            name: 'cancel_order',
                        });
                    } else {
                        toastMsg(res.data.msg)
                    }
                    api.hideProgress();
                });
            },
            // 获取医护端详情页面
            serverOrderInfo: function () {
                var post = {
                    oid: app.order_id
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken(),
                };
                getRequest('post', 'user/service/serverOrderInfo', post, header).then(function (res) {
                    // alert(JSON.stringify(res));
                    if (res.data.code == 1) {
                        app.order_info = res.data.data;
                    } else {
                        toastMsg(res.data.msg)
                    }
                    loadEnd();
                });
            },
            // 确认接单
            catch_order: function () {
                var post = {
                    id: app.id
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken(),
                };
                api.confirm({
                    title: '确认订单',
                    msg: '确认接单吗?',
                    buttons: ['确定', '取消']
                }, function (ret, err) {
                    var index = ret.buttonIndex;
                    if (index == 1) {
                        getRequest('post', 'user/service/getOrder', post, header).then(function (res) {
                            // alert(JSON.stringify(res));
                            if (res.data.code == 1) {
                                toastMsg('接单成功');
                                api.openWin({
                                    name: 'doctor_win',
                                    url: '../doctor/doctor_win.html',
                                });
                                api.sendEvent({
                                    name: 'doctor_index0',
                                    extra: {
                                        index: 1,
                                        order_success: 1
                                    }
                                });
                            } else {
                                toastMsg(res.data.msg)
                            }
                        });
                    } else {

                    }
                });
            },
            // 无法接单
            cancel: function () {
                api.closeWin();
            },
            // 退款
            re_money: function () {
                var post = {
                    order_id: app.order_info.id
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken(),
                };
                api.confirm({
                    title: '退款',
                    msg: '确认退款',
                    buttons: ['确定', '取消']
                }, function (ret, err) {
                    var index = ret.buttonIndex;
                    if (index == 1) {
                        getRequest('post', 'user/Order/refundOrder', post, header).then(function (res) {
                            if (res.data.code == 1) {
                                toastMsg('退款成功');
                                setTimeout(function () {
                                    openView('my_orderlist', 'my/my_orderlist', '我的订单')
                                }, 2000);
                                api.sendEvent({
                                    name:'re_money'
                                });
                            } else {
                                toastMsg('退款信息错误')
                            }
                        });
                    }
                });
            }
        }
    })
</script>