bulk.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div>
  3. <div class="formContent-item_title marginNone">
  4. 客户名称:{{ chiData.residentName || '--' }} <br />租赁房屋: {{ chiData.address || '--' }}
  5. </div>
  6. <div class="formContent-item_title noneBef">{{ assets }}</div>
  7. <zz-table :settings="{ showIndex: true, stripe: true, hidePagination: true }" :cols="cols" :data="tabList">
  8. <template slot-scope="scope" slot="payBeginTime">
  9. {{ typeTimeTransition(scope.row.payBeginTime, scope.row.payEndTime) }}
  10. </template>
  11. </zz-table>
  12. <el-form ref="form" :model="formData" :rules="formRules" label-width="110px">
  13. <div class="inline">
  14. <el-form-item label="支付方式:" prop="payType">
  15. <el-select placeholder="选择支付方式" v-model="formData.payType">
  16. <el-option label="微信" :value="1"></el-option>
  17. <el-option label="支付宝" :value="2"></el-option>
  18. <el-option label="现金" :value="3"></el-option>
  19. <el-option label="刷卡" :value="6"></el-option>
  20. <el-option label="其他" :value="5"></el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="应收金额(元):"> {{ fiterSum(tabList, 'receivableAmount') }}</el-form-item>
  24. <el-form-item label="实收金额(元):" required="true"> {{ fiterSum(tabList, 'receivableAmount') }} </el-form-item>
  25. </div>
  26. <el-form-item label="备注信息:" placeholder="请输入备注信息">
  27. <el-input type="textarea" maxlength="100" show-word-limit resize="none" rows="3" v-model="formData.remark"></el-input>
  28. </el-form-item>
  29. </el-form>
  30. </div>
  31. </template>
  32. <script >
  33. export default {
  34. props: ['params'],
  35. data() {
  36. return {
  37. cols: [
  38. {
  39. label: '订单号',
  40. prop: 'billNumber'
  41. },
  42. {
  43. label: '费用名称',
  44. prop: 'chargeName'
  45. },
  46. {
  47. label: '计费周期',
  48. prop: 'payBeginTime',
  49. slot: 'payBeginTime',
  50. width: '200'
  51. },
  52. {
  53. label: '费用金额(元)',
  54. prop: 'amount'
  55. },
  56. {
  57. label: '滞纳金(元)',
  58. prop: 'lateFee'
  59. },
  60. {
  61. label: '应收金额(元)',
  62. prop: 'receivableAmount'
  63. }
  64. ],
  65. tabList: [],
  66. chiData: {},
  67. formData: {
  68. payType: '',
  69. remark: '',
  70. amount: '',
  71. billList: [
  72. {
  73. amount: '',
  74. billId: ''
  75. }
  76. ]
  77. },
  78. formRules: {
  79. payType: [this.$valid.selectRequired('支付方式')]
  80. }
  81. };
  82. },
  83. methods: {
  84. fiterSum(arr, val) {
  85. let v = null;
  86. arr.forEach((item) => {
  87. v += Number(item[val]);
  88. });
  89. return Math.floor(v * 100) / 100;
  90. // v.toFixed(2)
  91. },
  92. submit() {
  93. this.$refs.form.validate((valid) => {
  94. if (valid) {
  95. let billList = this.tabList.map((item, index) => {
  96. return {
  97. amount: item.amount,
  98. billId: item.id
  99. };
  100. });
  101. let installData = {
  102. payType: this.formData.payType,
  103. remark: this.formData.remark,
  104. billList: billList
  105. };
  106. var loading = this.$loading();
  107. this.$http
  108. .post('/sc-charge/charge/bill/payee', installData)
  109. .then(({ status, msg }) => {
  110. if (status == 0) {
  111. this.$message.success(msg);
  112. this.params.callback();
  113. this.$emit('close');
  114. } else {
  115. this.$message.error(msg);
  116. }
  117. loading.close();
  118. })
  119. .catch(() => {
  120. loading.close();
  121. });
  122. }
  123. });
  124. },
  125. getTable(list) {
  126. let ids = [];
  127. list.map((item) => {
  128. ids.push(item.id);
  129. });
  130. this.$http
  131. .post('/sc-charge/charge/bill/findUserBillDetailList', ids)
  132. .then((res) => {
  133. this.tabList = res;
  134. })
  135. .catch(() => {
  136. loading.close();
  137. });
  138. },
  139. typeTimeTransition(start, end) {
  140. let text = '';
  141. if (!!end) {
  142. let f = start.slice(5, 7),
  143. l = end.slice(5, 7);
  144. if (Number(f) == Number(l)) {
  145. text = start;
  146. } else {
  147. text = `${start.slice(0, 8)}-${end.slice(0, 8)}`;
  148. }
  149. }
  150. return text;
  151. }
  152. },
  153. created() {
  154. if (this.params.selectRow.length) {
  155. this.getTable(this.params.selectRow);
  156. }
  157. this.chiData = this.params.chiData;
  158. }
  159. };
  160. </script>
  161. <style lang="scss" scoped>
  162. .formContent-item_title {
  163. font-weight: 600;
  164. }
  165. .marginNone {
  166. margin-bottom: 0;
  167. }
  168. .zz-table {
  169. margin-bottom: 20px;
  170. }
  171. .noneBef {
  172. margin-top: 5px;
  173. &::before {
  174. content: none;
  175. }
  176. }
  177. .inline {
  178. display: flex;
  179. justify-content: space-between;
  180. }
  181. </style>