index.vue 9.9 KB

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