zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<template>
  <div class="customer-edit">
    <el-dialog :title="title"
               :visible="dialogVisible"
               :modal-append-to-body="false"
               :close-on-click-modal="false"
               custom-class="comm-dialog"
               center
               width="850px"
               @close="$emit('doAction', 'close')">
      <EditForm ref="contractForm"
                column="2"
                :inline="true"
                :list="formList"
                :formValues="formValues"
                :formRules="formRules"
                :key="info.mailingNo || '1'"
                @updateValue="updateValue"
                ></EditForm>
      <div slot="footer"
           class="dialog-footer popup-form-buttons">
        <el-button class="comm-button"
                   size="small"
                   @click="$emit('doAction', 'close')">取消</el-button>
        <el-button class="comm-button"
                   size="small"
                   @click="submit"
                   type="primary">保存</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
// 闪佣付-流水-新增与编辑
import EditForm from '../components/EditForm';
import addHouseholdBagPayRec from '@comprehensive/model/addHouseholdBagPayRec';
import qryHouseholdBagApplyCustList from '@comprehensive/model/qryHouseholdBagApplyCustList';
 
import {
  getProvinceCodeList,
  getCityCodeList,
  getAreaCodeList,
} from '@comprehensive/serve/public';
import getDictionaryList from '@comprehensive/model/getDictionaryList'
import getApplyListAll from '@comprehensive/model/getApplyListAll';
 
 
export default {
  components: {
    EditForm,
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: '新增'
    },
    info: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      loading: false,
      model: null,
      formRules: {},
      formList: [],
    };
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      const { info } = this;
      const model = addHouseholdBagPayRec();
      this.model = model;
      const formList = model.getFormList({
        ...info,
        address: info.adress || info.address || '',
      });
      this.formList = formList;
      this.formRules = model.getFormRules(formList);
      // this.getOptions();
      this.getApplyListAll()
      this.getRepayTypeList();
      // this.qryHouseholdBagApplyCustList();
    },
 
    
    // 查询项目管理列表
    async getApplyListAll() {
      const res = await getApplyListAll().request({});
      const { list } = res;
      this.updateValue('projectSerialno', { options: list });
    },
 
     // 支付方式
    async getRepayTypeList() {
      const res = await getDictionaryList().request({
        codeNo: 'HouseholdAppBagPayMethod'
      })
      const { list } = res
      this.updateValue('payMethod', { options: list })
    },
    
    // 关联客户下拉列表
    async qryHouseholdBagApplyCustList(projectSerialno) {
      let { formValues } = this
      const res = await qryHouseholdBagApplyCustList().request({
        projectSerialno: projectSerialno
      })
      const { list } = res
      this.updateValue('houseBagSerialno', { options: list })
    },
 
   // 更新表单数据
    updateValue(index, info) {
      const { formList } = this
      if (isNaN(index)) {
        // index is name
        index = formList.findIndex(({ name }) => name === index)
      }
      if (!isNaN(index) && index > -1) {
        const preInfo = formList[index]
        this.$set(formList, index, { ...preInfo, ...info });
        if(info.name === 'projectSerialno') {
          if(info.value != preInfo.value) {
            const findIdx = formList.findIndex(
              ({ name }) => name === 'houseBagSerialno'
            )
            this.$set(formList, findIdx, { ...formList[findIdx], value: '' });
          }
          this.qryHouseholdBagApplyCustList(info.value);
        }
      }
    },
 
    async submit() {
      const { model, info } = this;
      let formInfo = this.$refs.contractForm.validate();
      if (formInfo) {
        if('serialno' in info) {
          formInfo.serialno = info.serialno
        }
        this.loading = true;
        await model.request({
          ...formInfo,
        });
        this.$emit('doAction', 'succ');
        this.loading = false;
      }
    },
  },
  computed: {
    // 表单值信息
    formValues() {
      const { model, formList } = this;
      return model.getFormValues(formList);
    },
  },
  watch: {
    info() {
      this.init();
    },
  },
};
</script>
<style lang="postcss" scoped>
.disable-input {
  background-color: #f5f7fa;
  border: 1px solid #f5f7fa;
  border-radius: 4px;
  color: #c0c4cc;
  cursor: pointer;
  width: 190px;
  height: 32px;
  line-height: 32px;
  padding: 0 15px;
  display: flex;
  justify-content: space-between;
  & p {
    flex: 1;
  }
  & >>> .el-icon-tickets {
    line-height: 34px;
  }
}
.customer-edit {
  & >>> .el-dialog__header {
    /* padding-bottom: 0; */
  }
  & >>> .el-dialog__body {
    padding-top: 0;
  }
  & >>> .el-dialog {
    width: 950px;
  }
}
</style>