roomCreateFeeAdd.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. (function(vc) {
  2. vc.extends({
  3. data: {
  4. roomCreateFeeAddInfo: {
  5. feeTypeCds:[],
  6. feeConfigs:[],
  7. locationTypeCd: '',
  8. locationObjId: '',
  9. floorId: '',
  10. floorNum: '',
  11. floorName: '',
  12. unitId: '',
  13. unitName: '',
  14. roomId: '',
  15. feeTypeCd:'',
  16. configId:'',
  17. billType:'',
  18. roomState:''
  19. }
  20. },
  21. _initMethod: function() {
  22. vc.getDict('pay_fee_config',"fee_type_cd",function(_data){
  23. vc.component.roomCreateFeeAddInfo.feeTypeCds = _data;
  24. });
  25. },
  26. _initEvent: function() {
  27. vc.on('roomCreateFeeAdd', 'openRoomCreateFeeAddModal',
  28. function() {
  29. $('#roomCreateFeeAddModel').modal('show');
  30. });
  31. vc.on("roomCreateFeeAdd", "notify", function (_param) {
  32. if (_param.hasOwnProperty("floorId")) {
  33. vc.component.roomCreateFeeAddInfo.floorId = _param.floorId;
  34. }
  35. if (_param.hasOwnProperty("unitId")) {
  36. vc.component.roomCreateFeeAddInfo.unitId = _param.unitId;
  37. }
  38. if (_param.hasOwnProperty("roomId")) {
  39. vc.component.roomCreateFeeAddInfo.roomId = _param.roomId;
  40. }
  41. });
  42. },
  43. methods: {
  44. roomCreateFeeAddValidate() {
  45. return vc.validate.validate({
  46. roomCreateFeeAddInfo: vc.component.roomCreateFeeAddInfo
  47. },
  48. {
  49. 'roomCreateFeeAddInfo.locationTypeCd': [{
  50. limit: "required",
  51. param: "",
  52. errInfo: "收费范围不能为空"
  53. },
  54. {
  55. limit: "num",
  56. param: "",
  57. errInfo: "收费范围格式错误"
  58. },
  59. ],
  60. 'roomCreateFeeAddInfo.locationObjId': [{
  61. limit: "required",
  62. param: "",
  63. errInfo: "收费对象不能为空"
  64. }
  65. ],
  66. 'roomCreateFeeAddInfo.feeTypeCd': [{
  67. limit: "required",
  68. param: "",
  69. errInfo: "费用类型不能为空"
  70. }
  71. ],
  72. 'roomCreateFeeAddInfo.configId': [{
  73. limit: "required",
  74. param: "",
  75. errInfo: "费用项目不能为空"
  76. }
  77. ],
  78. 'roomCreateFeeAddInfo.billType': [{
  79. limit: "required",
  80. param: "",
  81. errInfo: "出账类型不能为空"
  82. }
  83. ],
  84. 'roomCreateFeeAddInfo.roomState': [{
  85. limit: "required",
  86. param: "",
  87. errInfo: "出账类型不能为空"
  88. }
  89. ]
  90. });
  91. },
  92. saveRoomCreateFeeInfo: function() {
  93. vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
  94. if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '1000') { //大门时直接写 小区ID
  95. vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.communityId;
  96. } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '2000') {
  97. vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.unitId;
  98. } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '3000') {
  99. vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.roomId;
  100. } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '4000') {
  101. vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.floorId;
  102. } else {
  103. vc.toast("收费范围错误");
  104. return;
  105. }
  106. if (!vc.component.roomCreateFeeAddValidate()) {
  107. vc.toast(vc.validate.errInfo);
  108. return;
  109. }
  110. vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
  111. vc.http.post('roomCreateFeeAdd', 'save', JSON.stringify(vc.component.roomCreateFeeAddInfo), {
  112. emulateJSON: true
  113. },
  114. function(json, res) {
  115. //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
  116. if (res.status == 200) {
  117. //关闭model
  118. $('#roomCreateFeeAddModel').modal('hide');
  119. vc.component.clearAddFeeConfigInfo();
  120. vc.toast("创建收费成功,总共["+res.totalRoom+"]房屋,成功["+res.successRoom+"],失败["+res.errorRoom+"]",8000);
  121. return;
  122. }
  123. vc.message(json);
  124. },
  125. function(errInfo, error) {
  126. console.log('请求失败处理');
  127. vc.message(errInfo);
  128. });
  129. },
  130. clearAddFeeConfigInfo: function() {
  131. var _feeTypeCds = vc.component.roomCreateFeeAddInfo.feeTypeCds;
  132. vc.component.roomCreateFeeAddInfo = {
  133. feeConfigs:[],
  134. locationTypeCd: '',
  135. locationObjId: '',
  136. floorId: '',
  137. floorNum: '',
  138. floorName: '',
  139. unitId: '',
  140. unitName: '',
  141. roomId: '',
  142. feeTypeCd:'',
  143. configId:'',
  144. billType:''
  145. };
  146. vc.component.roomCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
  147. },
  148. _changeFeeTypeCd:function(_feeTypeCd){
  149. var param = {
  150. params: {
  151. page:1,
  152. row:20,
  153. communityId:vc.getCurrentCommunity().communityId,
  154. feeTypeCd:_feeTypeCd,
  155. isDefault:'F'
  156. }
  157. };
  158. //发送get请求
  159. vc.http.get('roomCreateFeeAdd', 'list', param,
  160. function(json, res) {
  161. var _feeConfigManageInfo = JSON.parse(json);
  162. vc.component.roomCreateFeeAddInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
  163. },
  164. function(errInfo, error) {
  165. console.log('请求失败处理');
  166. });
  167. }
  168. }
  169. });
  170. })(window.vc);