Przeglądaj źródła

1、红包商户配置

yys 2 dni temu
rodzic
commit
f2de60ca1a
2 zmienionych plików z 60 dodań i 115 usunięć
  1. 14 24
      src/api/his/redPacketConfig.js
  2. 46 91
      src/views/his/redPacketConfig/index.vue

+ 14 - 24
src/api/his/redPacketConfig.js

@@ -3,26 +3,16 @@ import request from '@/utils/request'
 // 查询多商户配置列表
 export function listMore(query) {
   return request({
-    url: '/store/redPacket/more/list',
+    url: '/redPacket/more/list',
     method: 'get',
     params: query
   })
 }
 
-
-export function getRedPacketMchId(query) {
-  return request({
-    url: '/store/redPacket/more/getRedPacketConfig',
-    method: 'get',
-    params: query
-  })
-}
-
-
 // 查询多商户配置详细
 export function getMore(id) {
   return request({
-    url: '/store/redPacket/more/' + id,
+    url: '/redPacket/more/' + id,
     method: 'get'
   })
 }
@@ -30,7 +20,7 @@ export function getMore(id) {
 // 新增多商户配置
 export function addMore(data) {
   return request({
-    url: '/store/redPacket/more',
+    url: '/redPacket/more',
     method: 'post',
     data: data
   })
@@ -39,24 +29,16 @@ export function addMore(data) {
 // 修改多商户配置
 export function updateMore(data) {
   return request({
-    url: '/store/redPacket/more',
+    url: '/redPacket/more',
     method: 'put',
     data: data
   })
 }
 
-export function updateChangeMchId(data) {
-  return request({
-    url: '/store/redPacket/more/updateChangeMchId',
-    method: 'post',
-    data: data
-  })
-}
-
 // 删除多商户配置
 export function delMore(id) {
   return request({
-    url: '/store/redPacket/more/' + id,
+    url: '/redPacket/more/' + id,
     method: 'delete'
   })
 }
@@ -64,8 +46,16 @@ export function delMore(id) {
 // 导出多商户配置
 export function exportMore(query) {
   return request({
-    url: '/store/redPacket/more/export',
+    url: '/redPacket/more/export',
     method: 'get',
     params: query
   })
 }
+
+// 获取租户列表
+export function getTenantList() {
+  return request({
+    url: '/redPacket/more/tenantList',
+    method: 'get'
+  })
+}

+ 46 - 91
src/views/his/redPacketConfig/index.vue

@@ -68,25 +68,6 @@
           v-hasPermi="['redPacket:more:remove']"
         >删除</el-button>
       </el-col>
-      <el-col :span="1.5">
-        <el-tag
-          type="primary"
-          size="large"
-          style="font-size: 16px;"
-        >
-          当前使用的商户号:{{this.redPacketMchId}}
-        </el-tag>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="small"
-          @click="handleEditRedPacket"
-          v-hasPermi="['redPacket:more:editRedPacket']"
-        >修改当前发送的红包的商户号</el-button>
-      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -110,6 +91,12 @@
       <el-table-column label="pub_key.pem证书" align="center" prop="publicKeyPath" />
       <el-table-column label="回调地址" align="center" prop="notifyUrl" />
       <el-table-column label="回调地址" align="center" prop="notifyUrlScrm" />
+      <el-table-column label="分配租户" align="center" prop="tenantName" :show-overflow-tooltip="true">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.tenantId" type="success" size="small">{{ scope.row.tenantName || scope.row.tenantId }}</el-tag>
+          <el-tag v-else type="info" size="small">未分配</el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -183,31 +170,24 @@
         <el-form-item label="回调地址" prop="notifyUrlScrm">
           <el-input v-model="form.notifyUrlScrm" placeholder="请输入回调地址notifyUrlScrm" />
         </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
-
-    <el-dialog :title="redPacketOpen.title" :visible.sync="redPacketOpen.open" width="600px" append-to-body>
-      <el-form ref="redPacketOpen" :model="redPacketOpen" label-width="110px">
-        <el-form-item label="商户号" prop="cateId">
-          <el-select v-model="redPacketOpen.newChangeMchId" placeholder="请选择" clearable size="small">
+        <el-form-item label="分配租户" prop="tenantId">
+          <el-select v-model="form.tenantId" placeholder="请选择要分配的租户(同步到租户库)" clearable style="width: 100%;">
             <el-option
-              v-for="dict in moreList"
-              :key="dict.mchId"
-              :label="dict.mchId"
-              :value="dict.mchId"
+              v-for="item in tenantList"
+              :key="item.id"
+              :label="item.tenantName + ' (' + item.tenantCode + ')'"
+              :value="item.id"
             />
           </el-select>
+          <div class="form-tip">选择租户后,该商户配置将同步到指定租户的数据库中</div>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitFormChangeMchId">确 定</el-button>
-        <el-button @click="cancelChangeMchId">取 消</el-button>
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
   </div>
 </template>
 
@@ -218,8 +198,7 @@ import {
   delMore,
   addMore,
   updateMore,
-  getRedPacketMchId,
-  updateChangeMchId
+  getTenantList
 } from '@/api/his/redPacketConfig'
 
 export default {
@@ -240,15 +219,10 @@ export default {
       showSearch: true,
       // 总条数
       total: 0,
-      redPacketMchId: null,
-      redPacketOpen:{
-        open:false,
-        title:null,
-        oldChangeMchId:null,
-        newChangeMchId:null,
-      },
       // 多商户配置表格数据
       moreList: [],
+      // 租户列表
+      tenantList: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -275,13 +249,11 @@ export default {
       form: {},
       // 表单校验
       rules: {},
-      redPacketOpenRule:{
-        newChangeMchId:[{ required: true, trigger: "blur", message: "商户号不能为空" }]
-      },
     };
   },
   created() {
     this.getList();
+    this.loadTenantList();
   },
   methods: {
     /** 查询多商户配置列表 */
@@ -293,21 +265,12 @@ export default {
         this.total = response.total;
         this.loading = false;
       });
-      getRedPacketMchId().then(res=>{
-        this.redPacketMchId=res.data
-      })
     },
     // 取消按钮
     cancel() {
       this.open = false;
       this.reset();
     },
-    cancelChangeMchId() {
-      this.redPacketOpen.open=false;
-      this.redPacketOpen.title=false;
-      this.redPacketOpen.oldChangeMchId=false;
-      this.redPacketOpen.newChangeMchId=false;
-    },
     // 表单重置
     reset() {
       this.form = {
@@ -324,10 +287,17 @@ export default {
         publicKeyId: null,
         publicKeyPath: null,
         notifyUrl: null,
-        notifyUrlScrm: null
+        notifyUrlScrm: null,
+        tenantId: null
       };
       this.resetForm("form");
     },
+    // 加载租户列表
+    loadTenantList() {
+      getTenantList().then(res => {
+        this.tenantList = res.data || [];
+      });
+    },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
@@ -360,11 +330,6 @@ export default {
         this.title = "修改多商户配置";
       });
     },
-    handleEditRedPacket(){
-      this.redPacketOpen.open= true;
-      this.redPacketOpen.title="修改发送红包的商户号";
-
-    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -385,39 +350,29 @@ export default {
         }
       });
     },
-
-    /** 提交修改发送红包的商户号- */
-    submitFormChangeMchId() {
-      this.$refs["redPacketOpen"].validate(valid => {
-        if (valid) {
-            this.redPacketOpen.oldChangeMchId=this.redPacketMchId;
-            if (this.redPacketOpen.newChangeMchId==null){
-              return this.$message.error("修改的商户号不能为空")
-            }
-
-            updateChangeMchId(this.redPacketOpen).then(response => {
-              this.msgSuccess("修改成功");
-              this.cancelChangeMchId();
-              this.getList();
-            });
-
-        }
-      });
-    },
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
       this.$confirm('是否确认删除多商户配置编号为"' + ids + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delMore(ids);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delMore(ids);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
     },
   }
 };
 </script>
+
+<style scoped>
+.form-tip {
+  font-size: 12px;
+  color: #909399;
+  margin-top: 5px;
+  line-height: 1.4;
+}
+</style>