sign_handle.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. var httpData=GetRequest(),
  2. doctorInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'));
  3. var refuseReason = null;
  4. function showSuccessMessage(msg) {
  5. layer.msg(msg, {
  6. icon: 1
  7. })
  8. }
  9. function showErrorMessage(msg) {
  10. layer.msg(msg, {
  11. icon: 5
  12. })
  13. }
  14. function showWarningMessage(msg) {
  15. layer.msg(msg, {
  16. icon: 2
  17. })
  18. }
  19. function showInfoMessage(msg) {
  20. layer.msg(msg, {
  21. icon: 6
  22. })
  23. }
  24. function getReason(ele) {
  25. if(ele.hasClass("active")) {
  26. ele.removeClass("active")
  27. refuseReason = null
  28. return false;
  29. }
  30. ele.addClass("active").siblings().removeClass("active");
  31. refuseReason = ele.html();
  32. }
  33. new Vue({
  34. el: "#app",
  35. data: {
  36. isShowList1: false,
  37. isShowList2: false,
  38. isShowList3: false,
  39. showTit3: "请选择补贴类型",
  40. showTit4: "请选择服务类型",
  41. showTit5: "请选择居民标签",
  42. patientInfo: null,
  43. teamList: null,
  44. memberList: null,
  45. dictList: null,
  46. signInfo: {
  47. signType: 1,
  48. majorDoctor: null,
  49. majorDoctorName: null,
  50. healthLabel: null,
  51. customLabel: null,
  52. disease: null,
  53. patientIDcard: null, // 必填
  54. adminTeamCode: null,
  55. msgid: httpData.msgId, // 消息id(必填)
  56. patient: httpData.patientCode,
  57. healthDoctor: null,
  58. healthDoctorName: null,
  59. type: 1,
  60. expenses: null,
  61. group: null,
  62. //添加服务类型数据
  63. sevId: null,
  64. // 拒绝参数
  65. // adminTeamCode:0,
  66. // type: 2,
  67. refuseReason: null
  68. },
  69. },
  70. mounted: function() {
  71. if (httpData.status == 0) {
  72. this.signing()
  73. } else {
  74. this.signOuttime();
  75. }
  76. this.getDictByDictName();
  77. this.teamLimit();
  78. },
  79. methods: {
  80. signing: function() {
  81. var vm = this,
  82. loadding = layer.load(0, {shade: false}),
  83. params = {
  84. patient: httpData.patientCode
  85. }
  86. signAPI.signing(params).then(function(res) {
  87. layer.close(loadding)
  88. if(res.status == 200) {
  89. vm.patientInfo = res.data
  90. } else {
  91. showErrorMessage(res.msg);
  92. }
  93. })
  94. },
  95. signOuttime: function() {
  96. var vm = this,
  97. loadding = layer.load(0, {shade: false}),
  98. params = {
  99. patient: httpData.patientCode
  100. }
  101. signAPI.signOuttime(params).then(function(res) {
  102. layer.close(loadding)
  103. if(res.status == 200) {
  104. vm.patientInfo = res.data
  105. vm.signInfo.adminTeamCode = vm.patientInfo.jtSign.adminTeamId
  106. vm.signInfo.healthDoctorName = vm.patientInfo.jtSign.doctorHealthName
  107. vm.signInfo.healthDoctor = vm.patientInfo.jtSign.doctorHealth
  108. vm.signInfo.expenses = vm.patientInfo.jtSign.expensesType
  109. vm.teamMember()
  110. } else {
  111. showErrorMessage(res.msg);
  112. }
  113. })
  114. },
  115. getDictByDictName: function() {
  116. var vm =this,
  117. loadding = layer.load(0, {shade: false}),
  118. params = {
  119. name: "SIGN_EXPENSES"
  120. }
  121. signAPI.getDictByDictName(params).then(function(res) {
  122. layer.close(loadding)
  123. if(res.status == 200) {
  124. vm.dictList = res.list
  125. } else {
  126. showErrorMessage(res.msg);
  127. }
  128. })
  129. },
  130. teamLimit: function() {
  131. var vm = this,
  132. loadding = layer.load(0, {shade: false}),
  133. params = {
  134. doctorId: doctorInfo.uid
  135. }
  136. signAPI.teamLimit(params).then(function(res) {
  137. layer.close(loadding)
  138. if(res.status == 200) {
  139. vm.teamList = res.data
  140. } else {
  141. showErrorMessage(res.msg);
  142. }
  143. })
  144. },
  145. teamMember: function() {
  146. var vm = this,
  147. loadding = layer.load(0, {shade: false}),
  148. params = {
  149. teamId: vm.signInfo.adminTeamCode
  150. }
  151. signAPI.teamMember(params).then(function(res) {
  152. layer.close(loadding)
  153. vm.memberList = []
  154. if(res.status == 200) {
  155. $.each(res.data, function(i, v) {
  156. if(v.level == 3 || v.level == 2)
  157. vm.memberList.push(v);
  158. });
  159. } else {
  160. showErrorMessage(res.msg);
  161. }
  162. })
  163. },
  164. selectStatus: function(num) {
  165. if(num == 1) {
  166. this.isShowList2 = false;
  167. this.isShowList3 = false;
  168. this.isShowList1 = !this.isShowList1;
  169. } else if (num == 2) {
  170. if(!this.signInfo.adminTeamCode) {
  171. showWarningMessage("请先选择签约团队")
  172. }
  173. this.isShowList1 = false;
  174. this.isShowList3 = false;
  175. this.isShowList2 = !this.isShowList2;
  176. } else {
  177. this.isShowList1 = false;
  178. this.isShowList2 = false;
  179. this.isShowList3 = !this.isShowList3;
  180. }
  181. },
  182. selectLi: function(num, data) {
  183. if(num == 1) {
  184. this.isShowList1 = false;
  185. this.signInfo.adminTeamCode = data.id;
  186. if(!this.memberList) {
  187. this.teamMember()
  188. }
  189. }
  190. if(num == 2) {
  191. this.isShowList2 = false;
  192. this.signInfo.healthDoctorName = data.name
  193. this.signInfo.healthDoctor = data.code
  194. }
  195. if(num == 3) {
  196. this.isShowList3 = false;
  197. this.signInfo.expenses = data.code;
  198. }
  199. },
  200. showTeamName: function(teamCode) {
  201. var teamName;
  202. if(!this.teamList) {
  203. return "请选择签约团队";
  204. }
  205. for(var i = 0, len = this.teamList.length; i < len; i++) {
  206. if(teamCode == this.teamList[i].id) {
  207. teamName = this.teamList[i].name;
  208. }
  209. }
  210. return teamName
  211. },
  212. showExpensesName: function(code) {
  213. var expensesName;
  214. if(!this.dictList) {
  215. return "请选择补贴类型";
  216. }
  217. for(var i = 0, len = this.dictList.length; i < len; i++) {
  218. if(code == this.dictList[i].code) {
  219. expensesName = this.dictList[i].value;
  220. }
  221. }
  222. return expensesName
  223. },
  224. refuse: function() {
  225. var vm = this;
  226. layer.open({
  227. type: 1,
  228. area: ['400px', '300px'],
  229. shade: 0.5,
  230. title: '拒绝签约原因',
  231. shift: 2,
  232. shadeClose: false, //点击遮罩关闭层
  233. content: '<div class="p20 pb0"><div class="reason_list clearfix"><span class="fl mr10 mb20" onclick="getReason($(this))">居民信息填写不详</span><span class="fl mr10 mb20" onclick="getReason($(this))">签约人数已满</span><span class="fl mb20" onclick="getReason($(this))">家庭医生变更</span></div><textarea id="reason" maxLength="200" placeholder="可选择填写其他拒签原因(限200字以内)"></textarea></div>',
  234. btn: ['提 交', '取 消'],
  235. yes:function(index, layero) {
  236. if(!refuseReason) {
  237. if(!$("#reason").val()) {
  238. showWarningMessage("请选择或输入拒绝理由!");
  239. layer.close(index);
  240. return false
  241. }
  242. vm.signInfo.refuseReason = $("#reason").val()
  243. vm.signInfo.adminTeamCode = 0
  244. vm.signInfo.type = 2
  245. vm.sign()
  246. }
  247. layer.close(index);
  248. },
  249. success: function(layero){
  250. layero.find('.layui-layer-btn').css('text-align', 'center')
  251. }
  252. });
  253. },
  254. sign: function() {// type:1签约 2拒签
  255. var vm = this,
  256. loadding = layer.load(0, {shade: false});
  257. signAPI.sign(vm.signInfo).then(function(res) {
  258. layer.close(loadding)
  259. if(res.status == 200) {
  260. } else {
  261. showErrorMessage(res.msg);
  262. }
  263. })
  264. }
  265. }
  266. })