packageForm.js 3.8 KB

1
  1. "use strict";var t=require("../common/vendor.js"),e=require("../api/packageOrder.js");require("../common/request.js");const i={data:()=>({content:null,show:!1,scrollTop:0,patient:null,items:[{title:"您是否已在线下就诊,且对所购买的药品无过敏或不良反应?",options:[{name:"是,我线下就诊过",value:1,color:"green"},{name:"无,从未就诊",value:0,color:"red"}]},{title:"您是否已详细阅读药物说明,确认自己符合药物适用人群,并了解用药方法、用药禁忌等信息?",options:[{name:"是,我已充分了解",value:1,color:"green"},{name:"否,未阅读",value:0,color:"red"}]}],msgs:[],index:0,item:null,notice:[{title:"好的。我将根据您提交的复诊信息开具处方,请详细阅读药品说明书,遵医嘱用药。"},{title:"您存在用药禁忌证,目前不推荐购买此套餐包。建议您尽早就医,在医生指导下采取针对性的治疗措施!在改善相关禁忌证后,也可以再次咨询,重新评估是否可以使用该套餐包。"}],packageId:null,doctorId:null,isComplete:0,companyUserId:null,companyId:null}),onLoad(e){this.packageId=e.packageId,this.doctorId=e.doctorId,this.$isEmpty(e.companyId)||(this.companyId=e.companyId),this.$isEmpty(e.companyUserId)||(this.companyUserId=e.companyUserId);var i=this;t.index.$on("refreshOrderPatient",(t=>{i.patient=t})),this.item=this.items[0],this.addMsg(1,this.item.title)},onShow(){},methods:{close(){this.show=!1},confirm(){1==this.isComplete?this.submit():t.index.navigateBack()},addMsg(e,i){var n={type:e,content:i};this.msgs.push(n);var o=this;t.index.createSelectorQuery().select(".msgs").boundingClientRect((t=>{const e=t.height;o.scrollTop=e,console.log(o.scrollTop)})).exec()},optionClick(e,i){if(null!=this.patient){if(0==i.value)return this.content=this.notice[1].title,this.show=!0,void(this.isComplete=0);if(e.option=i.name,console.log(e.option),this.addMsg(2,i.name),this.index++,!(this.index<=this.items.length-1))return this.content=this.notice[0].title,this.show=!0,void(this.isComplete=1);this.item=this.items[this.index],this.addMsg(1,this.item.title)}else t.index.showToast({icon:"none",title:"请选择就诊人"})},addPatient(){t.index.navigateTo({url:"/pages_user/patient"})},submit(){t.index.showLoading({title:"处理中..."});var i={companyId:this.companyId,companyUserId:this.companyUserId,patientId:this.patient.patientId,patientJson:JSON.stringify(this.patient),packageId:this.packageId,doctorId:this.doctorId,formJson:JSON.stringify(this.items)};e.create(i).then((e=>{if(t.index.hideLoading(),200==e.code){t.index.requestSubscribeMessage({tmplIds:["jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU"],success(i){setTimeout((function(){t.index.navigateTo({url:"/pages_order/packageOrderPay?orderId="+e.order.orderId})}),200)},fail(i){setTimeout((function(){t.index.navigateTo({url:"/pages_order/packageOrderPay?orderId="+e.order.orderId})}),200)}})}else t.index.showToast({icon:"none",title:e.msg})}))}}};if(!Array){t.resolveComponent("u-modal")()}Math;var n=t._export_sfc(i,[["render",function(e,i,n,o,s,a){return t.e({a:null==s.patient},null==s.patient?{b:t.o((t=>a.addPatient()))}:{},{c:null!=s.patient},null!=s.patient?t.e({d:t.t(s.patient.patientName),e:1==s.patient.sex},(s.patient.sex,{}),{f:2==s.patient.sex},(s.patient.sex,{}),{g:t.t(e.$getAge(s.patient.birthday)),h:t.t(e.$parseIdCard(s.patient.idCard)),i:t.o((t=>a.addPatient()))}):{},{j:t.f(s.msgs,((e,i,n)=>t.e({a:1==e.type},1==e.type?{b:t.t(e.content)}:{},{c:2==e.type},2==e.type?{d:t.t(e.content)}:{}))),k:s.scrollTop,l:null!=s.item},null!=s.item?{m:t.t(s.item.title),n:t.f(s.item.options,((e,i,n)=>({a:t.t(e.name),b:t.n("red"==e.color?"option-item red":"option-item green"),c:t.o((t=>a.optionClick(s.item,e)))})))}:{},{o:t.o((t=>a.close())),p:t.o((t=>a.confirm())),q:t.p({show:s.show,title:"温馨提示",content:s.content})})}]]);wx.createPage(n);