123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- var $dagou = $('.dagou'),
- // $team= $('.team'),
- $tuandui = $('.tuandui'),
- $msure_btn = $('#msure_btn'),
- arr = [],
- Arr = [],
- ArR,
- _name,
- sta = false;
- //获取登陆者信息;
- getBaseInfo = function() {
- var userAgent = JSON.parse(plus.storage.getItem("userAgent"));
- self = plus.webview.currentWebview();
- team_id = self.team_id;
- _codes = self.codes;
- codes = _codes.join(',');
- return {
- userAgent: userAgent,
- teamInfo: JSON.parse(plus.storage.getItem("teamInfo"))
- }
- }
- mui.plusReady(function() {
- var info = getBaseInfo();
- initPatientGroupsList();
- _Click();
- backParent();
- })
- // 处理页面点击事件
- function _Click() {
- $tuandui.on('click', '.team', function() {
- var id = $(this).attr('data-id');
- var currUl = $(this).next();
- var that = $(this);
- currUl.toggle();
- var a = that.find('.state').hasClass('_Photoone')
- var b = that.find('.state').hasClass('_photoone')
- if(a) {
- that.find('.state').removeClass('_Photoone')
- that.find('.state').addClass('_photoone')
- }
- if(b) {
- that.find('.state').removeClass('_photoone')
- that.find('.state').addClass('_Photoone')
- }
- //获取指定团队健管师的数目
- //url:GET /doctor/admin-teams/{team_id}/jgsmembers
- //入参:team_id
- var urL = 'doctor/admin-teams/' + id + '/jgsmembers';
- sendGet(urL, { team_id: id }, null, function(res) {
- if(res.status == 200) {
- console.log(res);
- arr = res.data; //健管师的数目
- var _html = template("qb_list_team", { slist: arr });
- currUl.empty().append(_html)
- }
- })
- })
- //点击选择打钩按钮
- $tuandui.on('click', 'li', function() {
- $(this).find('.dagou').toggleClass("photo");
- $tuandui.find('.dagou').not($(this).find('.dagou')).removeClass("photo");
- ///点击拿到医生的code 以进行确定点击进行传参
- ArR = $(this).attr('data-code');
- _name = $(this).attr('data-name');
- console.log(ArR)
- console.log(_name)
- })
- //确定的点击事件
- // 点击确定配置健管师
- //url:POST /doctor/prescriptionInfo/distributionHealthDoctor
- //入参codes :
- // healthdoctor:
- $msure_btn.on('click', function() {
- if(_name) {
- mui.confirm("是否确认将所选订单分配给" + _name + "配送", "", ["取消", "确定"], function(e) {
- if(e.index == 0) {
-
- } else if(e.index == 1) {
- var _url = 'doctor/prescriptionInfo/distributionHealthDoctor';
- sendPost(_url, { codes: codes, healthDoctor: ArR }, null, function(res) {
- if(res.status == 200) {
- console.log(res);
- mui.toast("已将所选订单分配给" + _name + "医生配送");
- setTimeout(function(){
- var old_back = mui.back;
- if(self.opener()){
- mui.fire(self.opener(), "refresh");
- }
- old_back();
- },1000)
- }
- })
- }
- })
- } else {
- mui.toast("请至少选择一位配送员");
- }
- })
- }
- //初始化页面
- function initPatientGroupsList() {
- //获取医生同社区底下所有团队建管师数目
- //url:GET /doctor/prescriptionInfo/getTeamHealthDoctorCount
- //入参 无;
- var zurl = 'doctor/prescriptionInfo/getTeamHealthDoctorCount';
- sendGet(zurl, {}, null, function(res) {
- if(res.status == 200) {
- console.log(res)
- Arr = res.data; //健管师的数目
- var html = template("dq_list_team", { list: Arr });
- $('.tuandui').append(html);
- if($tuandui.find(".team").length>0){
- $tuandui.find(".team").eq(0).trigger("click");
- }
- }
- })
- }
- // 返回刷新
- function backParent(){
- var old_back = mui.back;
- mui.back = function() {
- if(self.opener()){
- mui.fire(self.opener(), "refresh");
- }
- old_back();
- }
- }
- template.helper("setPhoto", function(p) {
- return getImgUrl(p);
- });
|