index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div class="main">
  3. <div class="search">
  4. <el-input placeholder="输入费用名称" class="search-input" clearable v-model="mixins_query.chargeName"></el-input>
  5. <el-select v-model="mixins_query.communityId" placeholder="所属社区" clearable>
  6. <el-option v-for="(item, index) in communityArr" :key="index" :label="item.communityName" :value="item.id"></el-option>
  7. </el-select>
  8. <el-select v-model="mixins_query.chargeType" placeholder="费用类型" clearable>
  9. <el-option label="物业费" :value="1"></el-option>
  10. <el-option label="水费" :value="2"></el-option>
  11. <el-option label="电费" :value="3"></el-option>
  12. <!-- <el-option label="车位费" :value="4"></el-option>
  13. <el-option label="二次供水费" :value="5"></el-option> -->
  14. </el-select>
  15. <el-button type="primary" class="search-btn" @click="mixins_search" icon="el-icon-search">查询 </el-button>
  16. <div class="search-icon">
  17. <el-tooltip class="item" effect="light" placement="bottom" content="新增">
  18. <i class="iconfont" @click="addOrEdit('add')">&#xe641;</i>
  19. </el-tooltip>
  20. </div>
  21. </div>
  22. <div class="roles-wrap">
  23. <zz-table
  24. :cols="cols"
  25. :settings="{ showIndex: true, stripe: true }"
  26. :loading="mixins_onQuery"
  27. :data="mixins_list"
  28. :pageset="mixins_pageset"
  29. @page-change="pageChange"
  30. >
  31. <template slot-scope="scope" slot="chargeMode">
  32. <span v-if="scope.row.chargeMode === 1">固定收费 </span>
  33. <span v-if="scope.row.chargeMode === 2">{{ scope.row.chargeType === 1 ? '价格*面积收费 ' : '单价*用量' }}</span>
  34. <span v-if="scope.row.chargeMode === 3">阶梯计费 </span>
  35. </template>
  36. <template slot-scope="scope" slot="chargePrice">
  37. <div v-if="!!scope.row.chargePrice">{{ scope.row.chargePrice }}</div>
  38. <template v-else>
  39. <div v-for="(item, index) in JSON.parse(scope.row.chargePriceLadder)" :key="index">
  40. <div>
  41. <span v-if="item.ladder === 1">一 阶价格:{{ item.price }}</span>
  42. <span v-else-if="item.ladder === 2">二 阶价格:{{ item.price }}</span>
  43. <span v-else-if="item.ladder === 3">三 阶价格:{{ item.price }}</span>
  44. <span v-else-if="item.ladder === 4">四 阶价格:{{ item.price }}</span>
  45. <span v-else-if="item.ladder === 5">五 阶价格:{{ item.price }}</span>
  46. <span v-else>{{ scope.row.chargePrice }}</span>
  47. </div>
  48. </div>
  49. </template>
  50. </template>
  51. <template slot-scope="scope" slot="opt">
  52. <div class="opt">
  53. <el-tooltip
  54. class="item"
  55. effect="light"
  56. placement="bottom"
  57. :content="scope.row.chargeStatus === 1 ? '禁用' : '启用'"
  58. >
  59. <i
  60. v-if="scope.row.chargeStatus === 1"
  61. class="zoniot_font zoniot-icon-qiyong1"
  62. @click="enabledStatus(scope.row)"
  63. ></i>
  64. <i v-else class="zoniot_font zoniot-icon-jinyong1" @click="enabledStatus(scope.row)"></i>
  65. </el-tooltip>
  66. <el-tooltip effect="light" placement="bottom" content="编辑">
  67. <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope.row)"></i>
  68. </el-tooltip>
  69. <el-tooltip effect="light" placement="bottom" content="删除">
  70. <i class="zoniot_font zoniot-icon-shanchu redText" @click="deluserbyidFn(scope.row.id)"></i>
  71. </el-tooltip>
  72. </div>
  73. </template>
  74. </zz-table>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import list from '@utils/list.js';
  80. const sunm = ['一', '二', '三', '四', '五'];
  81. export default {
  82. mixins: [list],
  83. name:'billingRules',
  84. data() {
  85. return {
  86. cols: [
  87. {
  88. label: '社区名称',
  89. prop: 'communityName'
  90. },
  91. {
  92. label: '费用名称',
  93. prop: 'chargeName'
  94. },
  95. {
  96. label: '费用类型',
  97. prop: 'chargeType',
  98. format(val) {
  99. if (val == '1') {
  100. return '物业费';
  101. } else if (val == '2') {
  102. return '水费';
  103. } else if (val == '3') {
  104. return '电费';
  105. } else if (val == '4') {
  106. return '车位费';
  107. } else if (val == '5') {
  108. return '二次供水费';
  109. }
  110. }
  111. },
  112. {
  113. label: '计费方式',
  114. prop: 'chargeMode',
  115. slot: 'chargeMode'
  116. },
  117. {
  118. label: '价格(元)',
  119. prop: 'chargePrice',
  120. slot: 'chargePrice'
  121. },
  122. {
  123. label: '计费周期',
  124. prop: 'chargeCycle',
  125. format(val) {
  126. if (val) {
  127. return val + '个月';
  128. }
  129. }
  130. },
  131. {
  132. label: '状态',
  133. prop: 'chargeStatus',
  134. format(val) {
  135. if (val == '1') {
  136. return '启用';
  137. } else if (val == '2') {
  138. return '禁用';
  139. }
  140. }
  141. },
  142. {
  143. label: '操作',
  144. prop: 'id',
  145. slot: 'opt'
  146. }
  147. ],
  148. productOptions: [],
  149. communityArr: [],
  150. mixins_post: 'get'
  151. };
  152. },
  153. created() {
  154. this.getorgTree();
  155. this.mixins_dataUrl = '/sc-charge/scChargeStrategy/page';
  156. this.mixins_query = {};
  157. this.mixins_search();
  158. },
  159. mounted() {
  160. this.getProductOptions();
  161. },
  162. methods: {
  163. getorgTree() {
  164. this.$http
  165. .get('/sc-community/assets/community/list')
  166. .then((data) => {
  167. this.communityArr = data.data;
  168. this.$store.commit('setAreaSelect', data.data);
  169. })
  170. .catch(function () {});
  171. },
  172. deluserbyidFn(id) {
  173. // let ids = [];
  174. // if (!!id) {
  175. // ids = [id];
  176. // } else {
  177. // if (!this.selectRow.length) {
  178. // this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
  179. // return;
  180. // }
  181. // this.selectRow.forEach((v) => {
  182. // ids.push(v.id);
  183. // });
  184. // }
  185. const h = this.$createElement;
  186. this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
  187. .then(() => {
  188. this.$http.postForm('/sc-charge/scChargeStrategy/delete', { id: id }).then(({ status, data, msg }) => {
  189. if (0 === status) {
  190. this.$message({
  191. type: 'success',
  192. message: '删除成功!'
  193. });
  194. this.mixins_search();
  195. } else {
  196. this.$message.error(msg);
  197. }
  198. });
  199. })
  200. .catch(() => {});
  201. },
  202. enabledStatus(rowinfo) {
  203. let status = 1;
  204. if (rowinfo.chargeStatus === 1) {
  205. status = 2;
  206. }
  207. this.$http.postForm(`/sc-charge/scChargeStrategy/enabled`, { id: rowinfo.id, chargeStatus: status }).then(({ status, msg }) => {
  208. if (status == 0) {
  209. this.$message.success(msg);
  210. this.mixins_search();
  211. } else {
  212. this.$message.error(msg);
  213. }
  214. });
  215. },
  216. addOrEdit(todo, data = {}) {
  217. new Promise((resolve) => {
  218. let title = '新增收费项目';
  219. if (todo == 'add') {
  220. } else {
  221. title = '修改收费项目';
  222. }
  223. this.$store.dispatch('addPopup', {
  224. url: '/payService/billingRules/stepPage/add.vue',
  225. width: '524px',
  226. height: '600px',
  227. props: {
  228. data,
  229. todo,
  230. productOptions: this.productOptions,
  231. callback: resolve
  232. },
  233. title: title
  234. });
  235. }).then(() => {
  236. this.mixins_search();
  237. });
  238. },
  239. getProductOptions() {
  240. this.$http.postForm('/sc-community/devicetype/selectList', { name: '' }).then((data) => {
  241. this.productOptions = data;
  242. });
  243. }
  244. }
  245. };
  246. </script>