propertyPay.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. (function(vc,vm){
  2. vc.extends({
  3. data:{
  4. propertyPayInfo:{
  5. cycles:'',
  6. receivableAmount:'0.00',
  7. receivedAmount:'0.00',
  8. remark:'',
  9. feeId:'',
  10. builtUpArea:'',
  11. squarePrice:'',
  12. additionalAmount:'',
  13. communityId:''
  14. }
  15. },
  16. watch:{
  17. "propertyPayInfo.cycles":{//深度监听,可监听到对象、数组的变化
  18. handler(val, oldVal){
  19. vc.component.propertyPayInfo.receivableAmount = ((parseFloat(vc.component.propertyPayInfo.builtUpArea)
  20. * parseFloat(vc.component.propertyPayInfo.squarePrice)
  21. + parseFloat(vc.component.propertyPayInfo.additionalAmount)) * parseFloat(val)).toFixed(2);
  22. vc.component.propertyPayInfo.receivedAmount = vc.component.propertyPayInfo.receivableAmount;
  23. },
  24. deep:true
  25. }
  26. },
  27. _initMethod:function(){
  28. },
  29. _initEvent:function(){
  30. vc.on('propertyPay','openPayModel',function(_params){
  31. vc.component.refreshPropertyPayInfo();
  32. $('#propertyPayModel').modal('show');
  33. vc.component.propertyPayInfo.feeId = _params.feeId;
  34. vc.component.propertyPayInfo.builtUpArea = _params.builtUpArea;
  35. vc.component.propertyPayInfo.communityId = vc.getCurrentCommunity().communityId;
  36. });
  37. },
  38. methods:{
  39. payFeeValidate:function(){
  40. return vc.validate.validate({
  41. propertyPayInfo:vc.component.propertyPayInfo
  42. },{
  43. 'propertyPayInfo.feeId':[
  44. {
  45. limit:"required",
  46. param:"",
  47. errInfo:"费用ID不能为空"
  48. }
  49. ],
  50. 'propertyPayInfo.cycles':[
  51. {
  52. limit:"required",
  53. param:"",
  54. errInfo:"缴费周期不能为空"
  55. }
  56. ],
  57. 'propertyPayInfo.receivableAmount':[
  58. {
  59. limit:"required",
  60. param:"",
  61. errInfo:"应收金额不能为空"
  62. },
  63. {
  64. limit:"money",
  65. param:"",
  66. errInfo:"应收金额不是有效的金额"
  67. }
  68. ],
  69. 'propertyPayInfo.receivedAmount':[
  70. {
  71. limit:"required",
  72. param:"",
  73. errInfo:"实收金额不能为空"
  74. },
  75. {
  76. limit:"money",
  77. param:"",
  78. errInfo:"实收金额不是有效的金额"
  79. }
  80. ],
  81. 'propertyPayInfo.remark':[
  82. {
  83. limit:"maxLength",
  84. param:"200",
  85. errInfo:"备注长度不能超过200位"
  86. },
  87. ]
  88. });
  89. },
  90. payFee:function(){
  91. if(!vc.component.payFeeValidate()){
  92. vc.message(vc.validate.errInfo);
  93. return ;
  94. }
  95. vc.http.post(
  96. 'propertyPay',
  97. 'payFee',
  98. JSON.stringify(vc.component.propertyPayInfo),
  99. {
  100. emulateJSON:true
  101. },
  102. function(json,res){
  103. //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
  104. if(res.status == 200){
  105. //关闭model
  106. $('#propertyPayModel').modal('hide');
  107. vc.emit('propertyFee','listFeeDetail',propertyPayInfo);
  108. return ;
  109. }
  110. vc.message(json);
  111. },
  112. function(errInfo,error){
  113. console.log('请求失败处理');
  114. vc.message(errInfo);
  115. });
  116. },
  117. refreshPropertyPayInfo:function(){
  118. vc.component.propertyPayInfo={
  119. cycles:'',
  120. receivableAmount:'0.00',
  121. receivedAmount:'0.00',
  122. remark:'',
  123. builtUpArea:'',
  124. feeId:'',
  125. squarePrice:'',
  126. additionalAmount:'',
  127. communityId:''
  128. };
  129. vc.component.loadPropertyConfigFee();
  130. },
  131. //加载配置数据
  132. loadPropertyConfigFee:function(){
  133. var param = {
  134. params:{
  135. communityId:vc.getCurrentCommunity().communityId,
  136. configId:''
  137. }
  138. };
  139. vc.http.get(
  140. 'propertyPay',
  141. 'loadPropertyConfigData',
  142. param,
  143. function(json,res){
  144. //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
  145. if(res.status == 200){
  146. //关闭model
  147. vc.copyObject(JSON.parse(json), vc.component.propertyPayInfo);
  148. return ;
  149. }
  150. vc.message(json);
  151. },
  152. function(errInfo,error){
  153. console.log('请求失败处理');
  154. vc.message(errInfo);
  155. });
  156. }
  157. }
  158. });
  159. })(window.vc,window.vc.component);