123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- var isGet,//0不需要请求
- code,
- type;
-
- var typeArr=[{'code':1,'name':'电话回复'},{'code':2,'name':'客服回复'}]
- var stateArr=[{'code':1,'name':'完成'},{'code':2,'name':'无法联系'}]
- var reasonArr=[{'code':1,'name':'预约成功'},{'code':2,'name':'预约失败'}]
- var yuyueArr=[{'code':1,'name':'没有号源'},{'code':2,'name':'病人取消'}]
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- type = self.type;
- code = self.code;
- var html = template('text_tmp',{data:{time:getNowDate()},type:type})
- $('#show_content').html(html)
- bindEvents();
- })
- function bindEvents(){
- initMobiscroll(typeArr,$("#handle_type"),'')
- initMobiscroll(stateArr,$("#handle_result"),'')
- initMobiscroll(yuyueArr,$("#handle_cause"),'')
- $("#submitBtn").on('click', function(){
- if(type == 0){
- var dealType = $('#handle_type').attr('data-id');
- var dealState = $('#handle_result').attr('data-id');
- if(!dealType){
- mui.toast('请选择处理方式')
- return
- }
- if(!dealState){
- mui.toast('请选择处理结果')
- return
- }
- var params = {
- code:code,
- dealType:dealType,
- dealState:dealState,
- dealContent:$('#handle_text').val().trim()
- }
- plus.nativeUI.showWaiting();
- sendPost("doctor/pcCustomer/dealConsultCallService",params, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("请求失败");
- }, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- mui.toast('保存成功')
- refreshHz()
- closePage()
- }else{
- mui.toast('保存失败')
- }
- })
- }
- if(type == 1){
- var dealCause = $('#handle_cause').attr('data-id');
- if(!dealCause){
- mui.toast('请选择原因')
- return
- }
- var params = {
- code:code,
- type:2,//预约失败
- dealReason:dealCause,
- dealContent:$('#handle_yytext').val().trim()
- }
- plus.nativeUI.showWaiting();
- sendPost("doctor/pcCustomer/dealAppointCallService",params, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("请求失败");
- }, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- mui.toast('保存成功')
- refreshHz()
- closePage()
- }else{
- mui.toast('保存失败')
- }
- })
- }
- })
- }
- function initMobiscroll(data,$id,curid){
- var html = '<option disabled selected></option>';
- $.map(data,function(item,index){
- if(item.code == curid){
- html += '<option selected value="'+item.code+'">'+item.name+'</option>';
- }else{
- html += '<option value="'+item.code+'">'+item.name+'</option>';
- }
- })
- $id.html(html);
- $id.mobiscroll().select({
- theme: 'ios',
- lang: 'zh',
- display: 'bottom',
- placeholder:'请选择',
- rows:4,
- onSelect: function ( valueText, inst) {
- $id.attr('data-id',inst._tempValue)
- }
- })
- }
- //刷新事件
- function refreshHz(){
- var page = plus.webview.getWebviewById("xietongfuwu-management");
- if(page){ mui.fire(page, "refreshXietong") }
- var page1 = plus.webview.getWebviewById("xietongfuwu-message");
- if(page1){ mui.fire(page1, "refreshXTmsg") }
- }
- //关闭页面
- function closePage(){
- var page = plus.webview.getWebviewById("xietongfuwu-detail");
- if(page){ page.close('none') }
- var page1 = plus.webview.getWebviewById("appointment-register");
- if(page1){ page1.close('none') }
- var page2 = plus.webview.getWebviewById("hospital-dept");
- if(page2){ page2.close('none') }
- var page3 = plus.webview.getWebviewById("xietongfuwu-yy");
- if(page3){ page3.close('none') }
- var page4 = plus.webview.getWebviewById("select-doctor");
- if(page4){ page4.close('none') }
- var page5 = plus.webview.getWebviewById("doctor-detail");
- if(page5){ page5.close('none') }
- var page6 = plus.webview.getWebviewById("info-confirm");
- if(page6){ page6.close('none') }
- var page7 = plus.webview.getWebviewById("detail-appointment");
- if(page7){ page7.close('none') }
-
- setTimeout(function(){ mui.back() },1000)
- }
- //现在时间
- function getNowDate() {
- var date = new Date();
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var day = date.getDate();
- var hour = date.getHours();
- var minute = date.getMinutes();
- var second = date.getSeconds();
- return year+'-'+(month<10?'0'+month:month)+'-'+(day<10?'0'+day:day)+' '+(hour<10?'0'+hour:hour)+':'+(minute<10?'0'+minute:minute)+':'+(second<10?'0'+second:second);
- }
|