index.vue 9.7 KB

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