| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- <template>
- <div>
- <community-tree @organId="currentOrganId"></community-tree>
- <div class="content-right">
- <el-form ref="form" :model="formData">
- <el-form-item>
- <div class="item-title">存在未缴费账单,小程序首页强制弹出提示信息</div>
- <el-radio-group v-model="formData[0].enable">
- <el-radio :label="1">是</el-radio>
- <el-radio :label="0">否</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <div class="item-title">存在未缴纳的物业费账单,无法进行水费充值</div>
- <el-radio-group v-model="formData[1].enable">
- <el-radio :label="1">是</el-radio>
- <el-radio :label="0">否</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <div class="item-title">
- 水费预存金额低于
- <el-input
- placeholder="请输入金额"
- v-model="formData[2].amount"
- oninput="value=value.replace(/[^0-9.]/g,'')"
- ></el-input
- >元,发送提示信息
- </div>
- <el-checkbox-group v-model="listCheckWater">
- <el-checkbox :label="1">短信</el-checkbox>
- <el-checkbox :label="2">微信</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- <el-form-item>
- <div class="item-title">
- 电费预存金额低于
- <el-input
- placeholder="请输入金额"
- v-model="formData[3].amount"
- oninput="value=value.replace(/[^0-9.]/g,'')"
- ></el-input
- >元,发送提示信息
- </div>
- <el-checkbox-group v-model="listCheckElectric">
- <el-checkbox :label="1">短信</el-checkbox>
- <el-checkbox :label="2">微信</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- <el-form-item>
- <div class="item-title">
- 水费预存金额不能大于
- <el-input
- placeholder="请输入金额"
- v-model="formData[8].amount"
- oninput="value=value.replace(/[^0-9.]/g,'')"
- ></el-input
- >元
- </div>
- </el-form-item>
- <el-form-item>
- <div class="item-title">
- 电费预存金额不能大于
- <el-input
- placeholder="请输入金额"
- v-model="formData[9].amount"
- oninput="value=value.replace(/[^0-9.]/g,'')"
- ></el-input
- >元
- </div>
- </el-form-item>
- <el-form-item>
- <div class="item-title">水费收费规则</div>
- <el-radio-group v-model="formData[4].enable">
- <el-radio :label="0">按账单收费</el-radio>
- <el-radio :label="1">预充值,按计费周期扣费</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <div class="item-title">电费收费规则</div>
- <el-radio-group v-model="formData[5].enable">
- <el-radio :label="0">按账单收费</el-radio>
- <el-radio :label="1">预充值,按计费周期扣费</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <div class="item-title">
- 水费计费周期
- <el-select v-model="formData[6].amount">
- <el-option v-for="item in 12" :key="item" :label="item" :value="item"></el-option> </el-select
- >个月
- </div>
- </el-form-item>
- <el-form-item>
- <div class="item-title">
- 电费计费周期
- <el-select v-model="formData[7].amount">
- <el-option v-for="item in 12" :key="item" :label="item" :value="item"></el-option> </el-select
- >个月
- </div>
- </el-form-item>
- <el-form-item style="text-align: right">
- <el-button type="primary" @click="submit">保存</el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- import communityTree from './communityTree.vue';
- export default {
- components: {
- communityTree
- },
- data() {
- return {
- currentId: '',
- listCheckWater: [1],
- listCheckElectric: [1],
- formData: [
- {
- type: 1,
- category: 1,
- enable: 0
- },
- {
- type: 2,
- category: 1,
- enable: 0
- },
- {
- type: 3,
- category: 1,
- enable: null,
- amount: null
- },
- {
- type: 4,
- category: 1,
- enable: null,
- amount: null
- },
- {
- type: 9,
- category: 1,
- enable: 0
- },
- {
- type: 10,
- category: 1,
- enable: 0
- },
- {
- type: 11,
- category: 1,
- enable: null,
- amount: 1
- },
- {
- type: 12,
- category: 1,
- enable: null,
- amount: 1
- },
- {
- type: 13,
- category: 1,
- enable: null,
- amount: 1
- },
- {
- type: 14,
- category: 1,
- enable: null,
- amount: 1
- }
- ],
- initFormData: [
- {
- type: 1,
- category: 1,
- enable: 0
- },
- {
- type: 2,
- category: 1,
- enable: 0
- },
- {
- type: 3,
- category: 1,
- enable: null,
- amount: null
- },
- {
- type: 4,
- category: 1,
- enable: null,
- amount: null
- },
- {
- type: 9,
- category: 1,
- enable: 0
- },
- {
- type: 10,
- category: 1,
- enable: 0
- },
- {
- type: 11,
- category: 1,
- enable: null,
- amount: 1
- },
- {
- type: 12,
- category: 1,
- enable: null,
- amount: 1
- },
- {
- type: 13,
- category: 1,
- enable: null,
- amount: 1
- },
- {
- type: 14,
- category: 1,
- enable: null,
- amount: 1
- }
- ]
- };
- },
- methods: {
- submit() {
- this.formData[2].enable = this.installRules(this.listCheckWater);
- this.formData[3].enable = this.installRules(this.listCheckElectric);
- this.formData.map((item) => {
- item.communityId = this.currentId;
- });
- let url = '/sc-community/systemConfig/batchAdd';
- this.$http
- .post(url, this.formData)
- .then(({ msg, status }) => {
- this.$message({
- type: status === 0 ? 'success' : 'error',
- message: msg
- });
- })
- .catch(() => {});
- },
- installRules(arr) {
- let thisArr = null;
- if (arr.length) {
- if (arr.length == 2) {
- thisArr = 3;
- } else {
- thisArr = arr[0];
- }
- } else {
- thisArr = 0;
- }
- return thisArr;
- },
- getInstallData(arr, num) {
- if (num === 3) {
- this[arr] = [1, 2];
- } else if (num === 0) {
- this[arr] = [];
- } else {
- this[arr] = [num];
- }
- },
- getData() {
- let instaData = { communityId: this.currentId, category: 1, pageNum: 1, pageSize: 10 };
- this.$http
- .post('/sc-community/systemConfig/page', instaData)
- .then(({ data, msg, status }) => {
- if (data.total == 0) {
- this.formData = JSON.parse(JSON.stringify(this.initFormData));
- } else {
- data.list.forEach((item, index) => {
- if (item.type == '1') {
- Object.assign(this.formData[0], item);
- } else if (item.type == '2') {
- Object.assign(this.formData[1], item);
- } else if (item.type == '3') {
- Object.assign(this.formData[2], item);
- this.getInstallData('listCheckWater', item.enable);
- } else if (item.type == '4') {
- Object.assign(this.formData[3], item);
- this.getInstallData('listCheckElectric', item.enable);
- } else if (item.type == '9') {
- Object.assign(this.formData[4], item);
- } else if (item.type == '10') {
- Object.assign(this.formData[5], item);
- } else if (item.type == '11') {
- Object.assign(this.formData[6], item);
- } else if (item.type == '12') {
- Object.assign(this.formData[7], item);
- }else if (item.type == '13') {
- Object.assign(this.formData[8], item);
- }else if (item.type == '14') {
- Object.assign(this.formData[9], item);
- }
- });
- }
- this.$refs.form.resetFields();
- })
- .catch(() => {});
- },
- currentOrganId(data) {
- this.currentId = data.id || '';
- this.getData();
- }
- },
- created() {}
- };
- </script>
- <style scoped lang='scss'>
- .content-right {
- background: white;
- font-size: 12px;
- padding: 20px;
- height: calc(100% - 100px);
- .item-title {
- /deep/ .el-input {
- display: inline-block;
- width: 120px;
- margin: 0 10px;
- }
- }
- }
- </style>
|