Преглед изворни кода

一小多司。和app紅包配置

xw пре 1 недеља
родитељ
комит
14768c3431
2 измењених фајлова са 125 додато и 14 уклоњено
  1. 69 14
      src/views/course/coursePlaySourceConfig/index.vue
  2. 56 0
      src/views/system/config/config.vue

+ 69 - 14
src/views/course/coursePlaySourceConfig/index.vue

@@ -10,10 +10,11 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="所属公司" prop="companyId">
+      <el-form-item label="所属公司" prop="companyIds">
         <el-select
-          v-model="queryParams.companyId"
+          v-model="queryParams.companyIds"
           filterable
+          multiple
           remote
           reserve-keyword
           placeholder="请输入公司名称搜索"
@@ -132,7 +133,7 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="ID" align="center" prop="id" />
       <el-table-column label="名称" align="center" prop="name" />
-      <el-table-column label="所属公司" align="center" prop="companyId" :formatter="companyNameFormatter"/>
+      <el-table-column label="所属公司" align="center" prop="companyIds" :formatter="companyNameFormatter"/>
       <el-table-column label="图标" align="center" prop="img">
         <template slot-scope="scope">
           <el-image
@@ -233,10 +234,11 @@
         <el-form-item label="名称" prop="name">
           <el-input v-model="form.name" placeholder="请输入名称" />
         </el-form-item>
-        <el-form-item label="所属公司" prop="companyId">
+        <el-form-item label="所属公司" prop="companyIds">
           <el-select
-            v-model="form.companyId"
+            v-model="form.companyIds"
             filterable
+            multiple
             remote
             reserve-keyword
             placeholder="请输入公司名称搜索"
@@ -507,6 +509,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
         name: null,
+        companyIds: [],
         appid: null,
         status: null
       },
@@ -566,6 +569,7 @@ export default {
       title: null,
       open: false,
       form: {
+        companyIds: [],
         setCompanyIdList: []
       },
       bindRules:{
@@ -853,8 +857,35 @@ export default {
       });
     },
     companyNameFormatter(row){
-      let company = this.formatterCompanyOptions.filter(item => item.dictValue === row.companyId)[0];
-      return company ? company.dictLabel : '';
+      const rawCompanyIds = row.companyIds !== undefined && row.companyIds !== null
+        ? row.companyIds
+        : (row.company_ids !== undefined && row.company_ids !== null ? row.company_ids : row.companyId);
+      let companyIds = [];
+      if (Array.isArray(rawCompanyIds)) {
+        companyIds = rawCompanyIds;
+      } else if (typeof rawCompanyIds === 'string') {
+        // 兼容 "300,305" / "[300, 305]" / "300"
+        companyIds = (rawCompanyIds.match(/\d+/g) || []);
+      } else if (rawCompanyIds !== undefined && rawCompanyIds !== null && rawCompanyIds !== '') {
+        companyIds = [rawCompanyIds];
+      }
+      const normalizedIds = companyIds
+        .map(item => Number(item))
+        .filter(item => Number.isFinite(item));
+      if (!normalizedIds.length) {
+        return '';
+      }
+      const companyNameMap = this.formatterCompanyOptions.reduce((map, item) => {
+        const key = Number(item.dictValue);
+        if (Number.isFinite(key)) {
+          map[key] = item.dictLabel;
+        }
+        return map;
+      }, {});
+      return normalizedIds
+        .map(id => companyNameMap[id])
+        .filter(Boolean)
+        .join('、');
     },
 
     // 获取开关配置
@@ -894,7 +925,16 @@ export default {
 
     getList() {
       this.loading = true;
-      list(this.queryParams).then(response => {
+      const normalizedCompanyIds = Array.isArray(this.queryParams.companyIds)
+        ? this.queryParams.companyIds
+            .map(item => Number(item))
+            .filter(item => Number.isFinite(item))
+        : [];
+      const params = {
+        ...this.queryParams,
+        companyIds: normalizedCompanyIds
+      };
+      list(params).then(response => {
         this.list = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -906,6 +946,7 @@ export default {
     },
     resetQuery() {
       this.resetForm("queryForm");
+      this.queryParams.companyIds = [];
       this.getList();
     },
     handleAdd() {
@@ -918,9 +959,22 @@ export default {
       this.reset()
       const id = row.id || this.ids
       get(id).then(response => {
+        const rawCompanyIds = Array.isArray(response.data.companyIds)
+          ? response.data.companyIds
+          : (response.data.companyIds ? String(response.data.companyIds).split(',') : []);
+        const normalizedCompanyIds = rawCompanyIds
+          .map(item => Number(item))
+          .filter(item => Number.isFinite(item));
+        if (!normalizedCompanyIds.length && response.data.companyId !== null && response.data.companyId !== undefined && response.data.companyId !== '') {
+          const companyIdNum = Number(response.data.companyId);
+          if (Number.isFinite(companyIdNum)) {
+            normalizedCompanyIds.push(companyIdNum);
+          }
+        }
         this.form = {
           ...response.data,
-          type: response.data.type.toString()
+          type: response.data.type.toString(),
+          companyIds: normalizedCompanyIds
         }
         if(!!this.form.setCompanyIds){
            this.$set(
@@ -957,16 +1011,16 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          const normalizedCompanyIds = Array.isArray(this.form.companyIds)
+            ? this.form.companyIds.map(item => Number(item)).filter(item => Number.isFinite(item))
+            : [];
           if(!!this.form.setCompanyIdList && this.form.setCompanyIdList.length > 0){
             this.form.setCompanyIds = this.form.setCompanyIdList.join(',')
           }else{
             this.form.setCompanyIds = "";
           }
-
-          // 处理companyId,将null转换为空字符串
-          if (this.form.companyId === null || this.form.companyId === undefined) {
-            this.form.companyId = '';
-          }
+          this.form.companyIds = normalizedCompanyIds;
+          this.form.companyId = '';
 
           if (this.form.customAuthEnabled === 0) {
             this.form.miniAppAuthType = '';
@@ -1008,6 +1062,7 @@ export default {
       this.form = {
         id: null,
         name: null,
+        companyIds: [],
         appid: null,
         secret: null,
         img: null,

+ 56 - 0
src/views/system/config/config.vue

@@ -2520,6 +2520,48 @@
           </div>
         </el-form>
       </el-tab-pane>
+      <el-tab-pane label="APP提现配置" name="his.AppRedPacket">
+        <!-- 添加 ref 和 rules -->
+        <el-form ref="form35" :model="form35" label-width="160px">
+
+          <el-form-item label="红包接口类型" prop="isNew">
+            <el-radio-group v-model="form35.isNew" >
+              <el-radio label="0">商家转账到零钱(旧)</el-radio>
+              <el-radio label="1">商家转账到零钱(新)</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item label="商户号" prop="mchId">
+            <el-input v-model="form35.mchId" placeholder="请输入商户号"></el-input>
+          </el-form-item>
+          <el-form-item label="商户密钥" prop="mchKey">
+            <el-input v-model="form35.mchKey" placeholder="请输入商户密钥" show-password></el-input>
+          </el-form-item>
+          <el-form-item label="p12证书路径" prop="keyPath">
+            <el-input v-model="form35.keyPath" placeholder="请输入p12证书路径"></el-input>
+          </el-form-item>
+          <el-form-item label="apiV3密钥" prop="apiV3Key">
+            <el-input v-model="form35.apiV3Key" placeholder="请输入apiV3密钥" show-password></el-input>
+          </el-form-item>
+          <el-form-item label="公钥ID" prop="publicKeyId">
+            <el-input v-model="form35.publicKeyId" placeholder="请输入公钥ID"></el-input>
+          </el-form-item>
+          <el-form-item label="公钥证书路径" prop="publicKeyPath">
+            <el-input v-model="form35.publicKeyPath" placeholder="请输入公钥证书路径"></el-input>
+          </el-form-item>
+          <el-form-item label="私钥路径" prop="privateKeyPath">
+            <el-input v-model="form35.privateKeyPath" placeholder="请输入私钥路径"></el-input>
+          </el-form-item>
+          <el-form-item label="证书路径" prop="privateCertPath">
+            <el-input v-model="form35.privateCertPath" placeholder="请输入证书路径"></el-input>
+          </el-form-item>
+          <el-form-item label="回调地址" prop="notifyUrl">
+            <el-input v-model="form35.notifyUrl" placeholder="请输入回调地址"></el-input>
+          </el-form-item>
+          <div class="footer">
+            <el-button type="primary" @click="submitForm35">提 交</el-button>
+          </div>
+        </el-form>
+      </el-tab-pane>
     </el-tabs>
 
 
@@ -2715,6 +2757,7 @@ export default {
       },
       form31:{},
       form32:{},
+      form35: {},
       storeProductScrmColumns:[],
       storeScrmColumns: [],
       photoArr: [],
@@ -3131,6 +3174,11 @@ export default {
             console.log(this.form32 );
           }
         }
+        if (key == 'his.AppRedPacket') {
+          if (!!response.data && response.data.configValue) {
+            this.form35 = { ...this.form35, ...JSON.parse(response.data.configValue) }
+          }
+        }
       })
     },
     /** 提交按钮 */
@@ -3433,6 +3481,14 @@ export default {
         }
       })
     },
+    submitForm35() {
+      const param = { configId: this.configId, configKey: this.configKey, configValue: JSON.stringify(this.form35) }
+      updateConfigByKey(param).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess('修改成功')
+        }
+      })
+    },
     formatColumns(){
       console.log(this.form27.pass_columns)