123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- var request = GetRequest(),
- id = request.id;
- new Vue({
- el: "#main",
- data: {
- dateInfo: {},
- numberInfo: {},
- baseInfo: {},
- patientInfo: {},
- Warntxt: "",
- },
- mounted: function() {
- EventBus.$emit("jump-step", {
- step: 4
- }); //step:跳转的步数
- //从缓存获取前一个页面缓存的信息
- var dateInfo = window.localStorage.getItem("dateInfo"),
- numberInfo = window.localStorage.getItem("numberInfo"),
- baseInfo = window.localStorage.getItem("baseInfo"),
- patientInfo = window.sessionStorage.getItem("oauthInfo");
- if(patientInfo) {
- patientInfo = JSON.parse(patientInfo);
- this.patientInfo = patientInfo;
- }
- if(dateInfo) {
- dateInfo = JSON.parse(dateInfo);
- this.dateInfo = dateInfo;
- }
- if(numberInfo) {
- numberInfo = JSON.parse(numberInfo);
- this.numberInfo = numberInfo;
- }
- if(baseInfo) {
- baseInfo = JSON.parse(baseInfo);
- this.baseInfo = baseInfo;
- }
- jiuzhenAPI.getRegisterWarn({
- token: "e8b01d2e-6dc8-4ba2-8422-462ae7535651"
- }).then(function(res) {
- this.Warntxt = res.value.replace("预约须知:", "")
- })
- },
- methods: {
- confirm: function() {
- var userInfo = this.patientInfo,
- baseInfo = this.baseInfo,
- dateInfo = this.dateInfo,
- numberInfo = this.numberInfo;
- var params = {
- thirdPartyUserId: userInfo.id,
- patientName: userInfo.realName,
- tel: userInfo.telephone,
- IP: returnCitySN.cip, //通过搜狐接口获得ip地址
- cardNo: userInfo.idCardNo,
- modeId: dateInfo.modeId,
- hospitalId: baseInfo.hospitalId,
- hospitalName: baseInfo.hosName,
- hosDeptId: baseInfo.hosDeptId,
- hosDeptName: baseInfo.deptName,
- doctorSn: baseInfo.doctorSn,
- doctorName: baseInfo.doctorName,
- numberSn: numberInfo.numberSN,
- numberPrice: dateInfo.specialPrice,
- thirdPartyOrderId: id,
- registerDate: dateInfo.registerDate,
- timeId: dateInfo.timeId,
- commendTime: numberInfo.commendTime,
- serialNo: numberInfo.serialNo
- }
- appointmentAPI.createRegOrderForOpen(params).then(function(res) {
- if(res.successFlg) {
- if(res.obj.Code == "10000") {
- var orderId = res.obj.orderId;
- //更新我们自己系统的挂号单信息
- var params2 = {
- id: res.obj.thirdPartyOrderId,
- userId: userInfo.id
- };
- appointmentAPI.updateRegistrationOrder(params2).then(function(res) {
- console.log(res);
- if(res.successFlg) {
- window.localStorage.removeItem("dateInfo");
- window.localStorage.removeItem("numberInfo");
- window.localStorage.removeItem("baseInfo");
- window.location.href = "success-info.html?orderId=" + orderId + "&hospitalId=" + baseInfo.hospitalId + "&deptId=" + baseInfo.hosDeptId;
- } else {
- console.log(res.errorMsg);
- }
- })
- } else {
- showErrorMessage(res.obj.Message);
- }
- } else {
- showErrorMessage(res.errorMsg);
- }
- });
- },
- cancel: function() {
- var params = {
- id: id,
- state: 99 //订单状态: 1-待付款,2-待就诊,11-预约中,22-退款中,99-已退号,-1-系统取消,3-已就诊
- };
- appointmentAPI.updateOrderState(params).then(function(res) {
- if(res.successFlg) {
- window.localStorage.removeItem("dateInfo");
- window.localStorage.removeItem("numberInfo");
- window.localStorage.removeItem("baseInfo");
- document.history.back();
- } else {
- showErrorMessage(res.errorMsg);
- }
- })
- }
- }
- })
- function showErrorMessage(content) {
- layer.msg(content, {
- icon: 2,
- time: 3000
- });
- }
|