paymentSetup.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <div>
  3. <community-tree @organId="currentOrganId"></community-tree>
  4. <div class="content-right">
  5. <el-form ref="form" :model="formData">
  6. <el-form-item>
  7. <div class="item-title">存在未缴费账单,小程序首页强制弹出提示信息</div>
  8. <el-radio-group v-model="formData[0].enable">
  9. <el-radio :label="1">是</el-radio>
  10. <el-radio :label="0">否</el-radio>
  11. </el-radio-group>
  12. </el-form-item>
  13. <el-form-item>
  14. <div class="item-title">存在未缴纳的物业费账单,无法进行水费充值</div>
  15. <el-radio-group v-model="formData[1].enable">
  16. <el-radio :label="1">是</el-radio>
  17. <el-radio :label="0">否</el-radio>
  18. </el-radio-group>
  19. </el-form-item>
  20. <el-form-item>
  21. <div class="item-title">
  22. 水费预存金额低于
  23. <el-input
  24. placeholder="请输入金额"
  25. v-model="formData[2].amount"
  26. oninput="value=value.replace(/[^0-9.]/g,'')"
  27. ></el-input
  28. >元,发送提示信息
  29. </div>
  30. <el-checkbox-group v-model="listCheckWater">
  31. <el-checkbox :label="1">短信</el-checkbox>
  32. <el-checkbox :label="2">微信</el-checkbox>
  33. </el-checkbox-group>
  34. </el-form-item>
  35. <el-form-item>
  36. <div class="item-title">
  37. 电费预存金额低于
  38. <el-input
  39. placeholder="请输入金额"
  40. v-model="formData[3].amount"
  41. oninput="value=value.replace(/[^0-9.]/g,'')"
  42. ></el-input
  43. >元,发送提示信息
  44. </div>
  45. <el-checkbox-group v-model="listCheckElectric">
  46. <el-checkbox :label="1">短信</el-checkbox>
  47. <el-checkbox :label="2">微信</el-checkbox>
  48. </el-checkbox-group>
  49. </el-form-item>
  50. <el-form-item>
  51. <div class="item-title">
  52. 水费预存金额不能大于
  53. <el-input
  54. placeholder="请输入金额"
  55. v-model="formData[8].amount"
  56. oninput="value=value.replace(/[^0-9.]/g,'')"
  57. ></el-input
  58. >元
  59. </div>
  60. </el-form-item>
  61. <el-form-item>
  62. <div class="item-title">
  63. 电费预存金额不能大于
  64. <el-input
  65. placeholder="请输入金额"
  66. v-model="formData[9].amount"
  67. oninput="value=value.replace(/[^0-9.]/g,'')"
  68. ></el-input
  69. >元
  70. </div>
  71. </el-form-item>
  72. <el-form-item>
  73. <div class="item-title">水费收费规则</div>
  74. <el-radio-group v-model="formData[4].enable">
  75. <el-radio :label="0">按账单收费</el-radio>
  76. <el-radio :label="1">预充值,按计费周期扣费</el-radio>
  77. </el-radio-group>
  78. </el-form-item>
  79. <el-form-item>
  80. <div class="item-title">电费收费规则</div>
  81. <el-radio-group v-model="formData[5].enable">
  82. <el-radio :label="0">按账单收费</el-radio>
  83. <el-radio :label="1">预充值,按计费周期扣费</el-radio>
  84. </el-radio-group>
  85. </el-form-item>
  86. <el-form-item>
  87. <div class="item-title">
  88. 水费计费周期
  89. <el-select v-model="formData[6].amount">
  90. <el-option v-for="item in 12" :key="item" :label="item" :value="item"></el-option> </el-select
  91. >个月
  92. </div>
  93. </el-form-item>
  94. <el-form-item>
  95. <div class="item-title">
  96. 电费计费周期
  97. <el-select v-model="formData[7].amount">
  98. <el-option v-for="item in 12" :key="item" :label="item" :value="item"></el-option> </el-select
  99. >个月
  100. </div>
  101. </el-form-item>
  102. <el-form-item style="text-align: right">
  103. <el-button type="primary" @click="submit">保存</el-button>
  104. </el-form-item>
  105. </el-form>
  106. </div>
  107. </div>
  108. </template>
  109. <script>
  110. import communityTree from './communityTree.vue';
  111. export default {
  112. components: {
  113. communityTree
  114. },
  115. data() {
  116. return {
  117. currentId: '',
  118. listCheckWater: [1],
  119. listCheckElectric: [1],
  120. formData: [
  121. {
  122. type: 1,
  123. category: 1,
  124. enable: 0
  125. },
  126. {
  127. type: 2,
  128. category: 1,
  129. enable: 0
  130. },
  131. {
  132. type: 3,
  133. category: 1,
  134. enable: null,
  135. amount: null
  136. },
  137. {
  138. type: 4,
  139. category: 1,
  140. enable: null,
  141. amount: null
  142. },
  143. {
  144. type: 9,
  145. category: 1,
  146. enable: 0
  147. },
  148. {
  149. type: 10,
  150. category: 1,
  151. enable: 0
  152. },
  153. {
  154. type: 11,
  155. category: 1,
  156. enable: null,
  157. amount: 1
  158. },
  159. {
  160. type: 12,
  161. category: 1,
  162. enable: null,
  163. amount: 1
  164. },
  165. {
  166. type: 13,
  167. category: 1,
  168. enable: null,
  169. amount: 1
  170. },
  171. {
  172. type: 14,
  173. category: 1,
  174. enable: null,
  175. amount: 1
  176. }
  177. ],
  178. initFormData: [
  179. {
  180. type: 1,
  181. category: 1,
  182. enable: 0
  183. },
  184. {
  185. type: 2,
  186. category: 1,
  187. enable: 0
  188. },
  189. {
  190. type: 3,
  191. category: 1,
  192. enable: null,
  193. amount: null
  194. },
  195. {
  196. type: 4,
  197. category: 1,
  198. enable: null,
  199. amount: null
  200. },
  201. {
  202. type: 9,
  203. category: 1,
  204. enable: 0
  205. },
  206. {
  207. type: 10,
  208. category: 1,
  209. enable: 0
  210. },
  211. {
  212. type: 11,
  213. category: 1,
  214. enable: null,
  215. amount: 1
  216. },
  217. {
  218. type: 12,
  219. category: 1,
  220. enable: null,
  221. amount: 1
  222. },
  223. {
  224. type: 13,
  225. category: 1,
  226. enable: null,
  227. amount: 1
  228. },
  229. {
  230. type: 14,
  231. category: 1,
  232. enable: null,
  233. amount: 1
  234. }
  235. ]
  236. };
  237. },
  238. methods: {
  239. submit() {
  240. this.formData[2].enable = this.installRules(this.listCheckWater);
  241. this.formData[3].enable = this.installRules(this.listCheckElectric);
  242. this.formData.map((item) => {
  243. item.communityId = this.currentId;
  244. });
  245. let url = '/sc-community/systemConfig/batchAdd';
  246. this.$http
  247. .post(url, this.formData)
  248. .then(({ msg, status }) => {
  249. this.$message({
  250. type: status === 0 ? 'success' : 'error',
  251. message: msg
  252. });
  253. })
  254. .catch(() => {});
  255. },
  256. installRules(arr) {
  257. let thisArr = null;
  258. if (arr.length) {
  259. if (arr.length == 2) {
  260. thisArr = 3;
  261. } else {
  262. thisArr = arr[0];
  263. }
  264. } else {
  265. thisArr = 0;
  266. }
  267. return thisArr;
  268. },
  269. getInstallData(arr, num) {
  270. if (num === 3) {
  271. this[arr] = [1, 2];
  272. } else if (num === 0) {
  273. this[arr] = [];
  274. } else {
  275. this[arr] = [num];
  276. }
  277. },
  278. getData() {
  279. let instaData = { communityId: this.currentId, category: 1, pageNum: 1, pageSize: 10 };
  280. this.$http
  281. .post('/sc-community/systemConfig/page', instaData)
  282. .then(({ data, msg, status }) => {
  283. if (data.total == 0) {
  284. this.formData = JSON.parse(JSON.stringify(this.initFormData));
  285. } else {
  286. data.list.forEach((item, index) => {
  287. if (item.type == '1') {
  288. Object.assign(this.formData[0], item);
  289. } else if (item.type == '2') {
  290. Object.assign(this.formData[1], item);
  291. } else if (item.type == '3') {
  292. Object.assign(this.formData[2], item);
  293. this.getInstallData('listCheckWater', item.enable);
  294. } else if (item.type == '4') {
  295. Object.assign(this.formData[3], item);
  296. this.getInstallData('listCheckElectric', item.enable);
  297. } else if (item.type == '9') {
  298. Object.assign(this.formData[4], item);
  299. } else if (item.type == '10') {
  300. Object.assign(this.formData[5], item);
  301. } else if (item.type == '11') {
  302. Object.assign(this.formData[6], item);
  303. } else if (item.type == '12') {
  304. Object.assign(this.formData[7], item);
  305. }else if (item.type == '13') {
  306. Object.assign(this.formData[8], item);
  307. }else if (item.type == '14') {
  308. Object.assign(this.formData[9], item);
  309. }
  310. });
  311. }
  312. this.$refs.form.resetFields();
  313. })
  314. .catch(() => {});
  315. },
  316. currentOrganId(data) {
  317. this.currentId = data.id || '';
  318. this.getData();
  319. }
  320. },
  321. created() {}
  322. };
  323. </script>
  324. <style scoped lang='scss'>
  325. .content-right {
  326. background: white;
  327. font-size: 12px;
  328. padding: 20px;
  329. height: calc(100% - 100px);
  330. .item-title {
  331. /deep/ .el-input {
  332. display: inline-block;
  333. width: 120px;
  334. margin: 0 10px;
  335. }
  336. }
  337. }
  338. </style>