|
|
@@ -0,0 +1,863 @@
|
|
|
+<!-- 模板区域 -->
|
|
|
+<template>
|
|
|
+ <div class="body">
|
|
|
+ <a-spin :spinning="spinning">
|
|
|
+ <div class="card">
|
|
|
+ <a-form ref="formRef" :model="businessConfigForm" labelAlign="right" :rules="businessConfigFormRules"
|
|
|
+ :label-col="labelCol">
|
|
|
+ <div class="card-header dis a-c mb-2">
|
|
|
+ <div class="link"></div>
|
|
|
+ <span>基本信息</span>
|
|
|
+ </div>
|
|
|
+ <div class="horizontal-section">
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="6">
|
|
|
+ <a-form-item label="渠道机构" name="institutionId">
|
|
|
+ <a-tree-select v-model:value="businessConfigForm.institutionId" show-search style="width: 100%"
|
|
|
+ :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" placeholder="Please select" allow-clear
|
|
|
+ tree-default-expand-all :tree-data="treeData" :field-names="{
|
|
|
+ children: 'node',
|
|
|
+ label: 'institutionName',
|
|
|
+ value: 'id',
|
|
|
+ }" tree-node-filter-prop="institutionName">
|
|
|
+ </a-tree-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="6">
|
|
|
+ <a-form-item label="联系人" name="contact">
|
|
|
+ <a-input v-model:value="businessConfigForm.contact" showCount maxlength="20" placeholder="请输入联系人" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="6">
|
|
|
+ <a-form-item label="联系人手机号" name="contactPhone">
|
|
|
+ <a-input v-model:value="businessConfigForm.contactPhone" showCount maxlength="11"
|
|
|
+ placeholder="请输入联系人手机号" allowClear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="6">
|
|
|
+ <a-form-item label="联系地址">
|
|
|
+ <a-input v-model:value="businessConfigForm.contactAddr" placeholder="请输入联系地址" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="6">
|
|
|
+ <a-form-item label="邮箱">
|
|
|
+ <a-input v-model:value="businessConfigForm.email" placeholder="请输入邮箱" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </div>
|
|
|
+ <div class="card-header dis a-c mb-2">
|
|
|
+ <div class="link"></div>
|
|
|
+ <span>权益发放场景配置</span>
|
|
|
+ </div>
|
|
|
+ <a-form-item label="对接方式" name="issueConnectionMethod">
|
|
|
+ <!-- 卡片单选 -->
|
|
|
+ <div class="flex card-Radio-container">
|
|
|
+ <div class="card-Radio dis f-c "
|
|
|
+ :class="{ 'card-Radio-active': item.value == businessConfigForm.issueConnectionMethod }"
|
|
|
+ @click="businessConfigForm.issueConnectionMethod = item.value"
|
|
|
+ v-for="item in issueConnectionMethodOptions" :key="item.value">
|
|
|
+ <span class="Method">{{ item.label }}</span>
|
|
|
+ <span class="annotation">{{ item.value == '1' ? '渠道使用H5页面,发放权益' : '渠道调用API接口,发放权益' }}</span>
|
|
|
+ <CheckCircleFilled v-if="item.value == businessConfigForm.issueConnectionMethod" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="权益查询配置" name="queryPermission">
|
|
|
+ <a-radio-group v-model:value="businessConfigForm.queryPermission">
|
|
|
+ <a-radio value="1">静默访问</a-radio>
|
|
|
+ <a-radio value="2">授权后访问</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-item>
|
|
|
+ <template v-if="businessConfigForm.issueConnectionMethod == '1'">
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-item label="回调地址" name="callbackUrl">
|
|
|
+ <a-input v-model:value="businessConfigForm.callbackUrl" placeholder="请输入回调地址" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-item label="权益查询页面位置精度" name="provinceCode">
|
|
|
+ <a-cascader v-model:value="queryTreeList"
|
|
|
+ :field-names="{ label: 'areaCname', value: 'areaCode', children: 'children' }" :options="queryTree"
|
|
|
+ placeholder="请选择位置查询精度" @change="selectAccuracy" change-on-select />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-item label="主题设置" name="issueThemeColor">
|
|
|
+ <a-popover trigger="click" overlayClassName="themeSettings">
|
|
|
+ <template #content>
|
|
|
+ <ChromePicker v-model="businessConfigForm.issueThemeColor" />
|
|
|
+ </template>
|
|
|
+ <div class="color-preview dis a-c j-c">
|
|
|
+ <div class="colorBlock" :style="{ backgroundColor: businessConfigForm.issueThemeColor }"></div>
|
|
|
+ <span>{{ businessConfigForm.issueThemeColor }}</span>
|
|
|
+ </div>
|
|
|
+ </a-popover>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-form-item label="权益发放配置" name="channelRightsDistributionConfig">
|
|
|
+ <div class=" receivedUserInfo dis f-c">
|
|
|
+ <div class="dis a-c ">
|
|
|
+ <a-popover trigger="click">
|
|
|
+ <template #content>
|
|
|
+ <a-checkbox-group v-model:value="rightsIssuanceRulesValue" class="dis f-c"
|
|
|
+ @change="rightsIssuanceRulesChange">
|
|
|
+ <a-checkbox :value="item.rulesId" name="type" v-for="(item, index) in rightsIssuanceRules"
|
|
|
+ :disabled="item.checked" :key="index">{{ item.rulesName }}</a-checkbox>
|
|
|
+ </a-checkbox-group>
|
|
|
+ </template>
|
|
|
+ <a-button type="link" preIcon="ant-design:plus-outlined" style="color: #018FFB;">添加字段</a-button>
|
|
|
+ </a-popover>
|
|
|
+ <span class="text">配置发放权益需要上传的接收人信息</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ <div class="received ">
|
|
|
+ <a-space :size="[16, 16]" wrap>
|
|
|
+ <template v-for="(item, index) in businessConfigForm.channelRightsDistributionConfig" :key="index">
|
|
|
+ <a-input-group compact>
|
|
|
+ <a-input disabled :placeholder="item.rulesName" style="width: 150px" />
|
|
|
+ <a-select v-model:value="item.isRequired" style="border-right: none;"
|
|
|
+ @change="val => channelRightsDistributionconfigDel(val, item.rulesId)">
|
|
|
+ <a-select-option :value="1">必填</a-select-option>
|
|
|
+ <a-select-option :value="0">非必填</a-select-option>
|
|
|
+ <a-select-option value="DEL" :disabled="item.checked">删除</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-input-group>
|
|
|
+ </template>
|
|
|
+ </a-space>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-if="businessConfigForm.issueConnectionMethod == '2'">
|
|
|
+ <a-form-item label="接口权限">
|
|
|
+ <div class="dis f-c">
|
|
|
+ <div class="" v-for="item in businessConfigForm.issueChannelSceneApiConfigs">
|
|
|
+ <a-checkbox class="mr-1 mb-1" v-model:checked="item.checked">{{ item.interfacePermissionName
|
|
|
+ }}</a-checkbox>
|
|
|
+ <div class="dis a-c mb-1">
|
|
|
+ <span class="fontsize14 mr-1 ">每分钟最大调用次数</span>
|
|
|
+ <a-input v-model:value="item.callCount" placeholder="请输入次数" class="w250">
|
|
|
+ <template #suffix>
|
|
|
+ 次
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ </template>
|
|
|
+ <div class="card-header dis a-c mb-2">
|
|
|
+ <div class="link"></div>
|
|
|
+ <span>消费者场景配置</span>
|
|
|
+ </div>
|
|
|
+ <a-form-item label="对接方式">
|
|
|
+ <!-- 卡片单选 -->
|
|
|
+ <div class="flex card-Radio-container">
|
|
|
+ <div class="card-Radio dis f-c "
|
|
|
+ :class="{ 'card-Radio-active': item.value == businessConfigForm.consumerConnectionMethod }"
|
|
|
+ @click="businessConfigForm.consumerConnectionMethod = item.value"
|
|
|
+ v-for="item in consumerConnectionMethodOptions" :key="item.value">
|
|
|
+ <span class="Method">{{ item.label }}</span>
|
|
|
+ <span class="annotation">{{ item.text }}</span>
|
|
|
+ <CheckCircleFilled v-if="item.value == businessConfigForm.consumerConnectionMethod" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ <template v-if="businessConfigForm.consumerConnectionMethod == '1'">
|
|
|
+ <a-form-item label="权益查询条件">
|
|
|
+ <div class="dis f-c table">
|
|
|
+ <div class="dis a-c ">
|
|
|
+ <a-popover trigger="click">
|
|
|
+ <template #content>
|
|
|
+ <a-checkbox-group v-model:value="rightsInquiryRulesValue" class="dis f-c"
|
|
|
+ @change="rightsInquiryRulesChange">
|
|
|
+ <a-checkbox :value="item.rulesId" :disabled="item.checked"
|
|
|
+ v-for="(item, index) in rightsInquiryRules" :key="index">{{
|
|
|
+ item.rulesName }}</a-checkbox>
|
|
|
+ </a-checkbox-group>
|
|
|
+ </template>
|
|
|
+ <a-button type="link" preIcon="ant-design:plus-outlined" style="color: #018FFB;">添加新条件</a-button>
|
|
|
+ </a-popover>
|
|
|
+ <span class="text">查询不到用户权益时,通过以下条件可查询到用户权益</span>
|
|
|
+ </div>
|
|
|
+ <a-table :dataSource="businessConfigForm.channelRightsInquiryRules" size="small"
|
|
|
+ :columns="channelRightsInquiryRulesColumns" :pagination="false" rowClassName="rowClassName">
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.dataIndex === 'operation'">
|
|
|
+ <a-button type="link" @click="editRule(column, record)">编辑</a-button>
|
|
|
+ <a-button type="link" @click="delRule(column, record)" :disabled="record.checked">删除</a-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.dataIndex === 'rules'">
|
|
|
+ <div v-if="record.isVerify == '1'">
|
|
|
+ <span v-if="record.rules == '1'">全部字符校验</span>
|
|
|
+ <span v-else-if="record.rules == '2'">校验前{{ record.number }}位{{ record.rulesName }}</span>
|
|
|
+ <span v-else>校验后{{ record.number }}位{{ record.rulesName }}</span>
|
|
|
+ </div>
|
|
|
+ <div v-else>不校验</div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="主题设置">
|
|
|
+ <a-popover trigger="click" overlayClassName="themeSettings">
|
|
|
+ <template #content>
|
|
|
+ <ChromePicker v-model="businessConfigForm.consumerThemeColor" />
|
|
|
+ </template>
|
|
|
+ <div class="color-preview dis a-c j-c">
|
|
|
+ <div class="colorBlock" :style="{ backgroundColor: businessConfigForm.consumerThemeColor }"></div>
|
|
|
+ <span>{{ businessConfigForm.consumerThemeColor }}</span>
|
|
|
+ </div>
|
|
|
+ </a-popover>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="业务配置">
|
|
|
+ <a-radio-group v-model:value="businessConfigForm.businessConfig">
|
|
|
+ <a-radio :value="0">全部商户参与服务</a-radio>
|
|
|
+ <a-radio :value="1">部分商户参与服务</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ <div class="" v-if="businessConfigForm.businessConfig == '1'">
|
|
|
+ <a-popover trigger="click" overlayClassName="channelSupplierConfiglist">
|
|
|
+ <template #content>
|
|
|
+ <a-checkbox-group v-model:value="channelSupplierConfiglistValue"
|
|
|
+ @change="changeChannelSupplierConfigChange" class="dis f-c">
|
|
|
+ <a-checkbox :value="item.id" v-for="(item, index) in channelSupplierConfiglist" :key="index">{{
|
|
|
+ item.purveyorName || "--" }}</a-checkbox>
|
|
|
+ </a-checkbox-group>
|
|
|
+ </template>
|
|
|
+ <a-button type="link" preIcon="ant-design:plus-outlined">选择商户供应商</a-button>
|
|
|
+ </a-popover>
|
|
|
+ <div class="dis a-c flex-wrap" style="gap: 10px;">
|
|
|
+ <div class="merchantSupplier" v-for="(item, index) in businessConfigForm.channelSupplierConfig"
|
|
|
+ :key="index">
|
|
|
+ {{ item.supplierName }}
|
|
|
+ <CloseOutlined @click="deleteSupplier(index)" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-if="businessConfigForm.consumerConnectionMethod == '2'">
|
|
|
+ <a-form-item label="接口权限">
|
|
|
+ <div class="dis f-c">
|
|
|
+ <div class="" v-for="item in businessConfigForm.consumerChannelSceneApiConfigs">
|
|
|
+ <a-checkbox class="mr-1 mb-1" v-model:checked="item.checked">{{ item.interfacePermissionName
|
|
|
+ }}</a-checkbox>
|
|
|
+ <div class="dis a-c mb-1">
|
|
|
+ <span class="fontsize14 mr-1 ">每分钟最大调用次数</span>
|
|
|
+ <a-input v-model:value="item.callCount" placeholder="请输入次数" class="w250">
|
|
|
+ <template #suffix>
|
|
|
+ 次
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-if="businessConfigForm.consumerConnectionMethod == '3'">
|
|
|
+ <a-form-item label="业务配置">
|
|
|
+ <div class="dis">
|
|
|
+ <a-alert show-icon message="选择使用生活服务,消费者的应用场景将使用“晋掌柜生活APP和小程序”供渠道的消费者使用" type="info" />
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ </template>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ <!-- 操作栏 -->
|
|
|
+ <div class="footer flex a-c j-c">
|
|
|
+ <a-button @click="onCancel">取消</a-button>
|
|
|
+ <a-button @click="onSubmit" style="margin-left: 40px" type="primary">保存</a-button>
|
|
|
+ </div>
|
|
|
+ </a-spin>
|
|
|
+ <a-modal v-model:open="editRuleShow" title="编辑规则" @ok="editRuleSave" width="700px" :bodyStyle="{ padding: '16px' }">
|
|
|
+ <a-form ref="editRuleFormRef" :model="editRuleInfo" :label-col="RulelabelCol" :wrapper-col="RulewrapperCol"
|
|
|
+ style="width: 100%;">
|
|
|
+ <a-form-item label="查询条件">
|
|
|
+ <a-input v-model:value="editRuleInfo.rulesName" disabled autocomplete="off" placeholder="请输入" />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="是否检验">
|
|
|
+ <a-radio-group v-model:value="editRuleInfo.isVerify">
|
|
|
+ <a-radio :value="1">是</a-radio>
|
|
|
+ <a-radio :value="0">否</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="检验规则">
|
|
|
+ <a-radio-group v-model:value="editRuleInfo.rules" class="dis f-c" style="gap: 10px 0 ;">
|
|
|
+ <a-radio :value="1">全部字符校验</a-radio>
|
|
|
+ <div class="dis a-c flex">
|
|
|
+ <a-radio :value="2" style="flex: none;">校验接收人手机号前</a-radio>
|
|
|
+ <a-input v-model:value="editRuleInfo.number" :disabled="editRuleInfo.rules != '2'" placeholder="请输入"
|
|
|
+ style="width: 100px;" />
|
|
|
+ <span class="fontsize14 ml-1">位</span>
|
|
|
+ </div>
|
|
|
+ <div class="dis a-c flex">
|
|
|
+ <a-radio :value="3" style="flex: none;">校验接收人手机号后</a-radio>
|
|
|
+ <a-input v-model:value="editRuleInfo.number" :disabled="editRuleInfo.rules != '3'" placeholder="请输入"
|
|
|
+ style="width: 100px;" />
|
|
|
+ <span class="fontsize14 ml-1">位</span>
|
|
|
+ </div>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
+
|
|
|
+ </a-modal>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<!-- 行为区域 -->
|
|
|
+<script lang='ts' setup>
|
|
|
+import {
|
|
|
+ CheckCircleFilled,
|
|
|
+} from '@ant-design/icons-vue';
|
|
|
+import { reactive, ref, onMounted, watch } from 'vue';
|
|
|
+import type { UnwrapRef } from 'vue';
|
|
|
+import { useRouter, useRoute } from 'vue-router';
|
|
|
+import { CloseOutlined } from '@ant-design/icons-vue';
|
|
|
+import type { Rule, } from 'ant-design-vue/es/form';
|
|
|
+import * as businessConfigAPI from '/@/api/channel/businessConfig';
|
|
|
+import { type TreeSelectProps } from 'ant-design-vue';
|
|
|
+import * as placementPlanAPI from '/@/api/adManagement/placementPlan';
|
|
|
+import { ChromePicker } from 'vue-color'//颜色选择器
|
|
|
+import { message, Modal } from 'ant-design-vue';
|
|
|
+import { RefSymbol } from '@vue/reactivity';
|
|
|
+const router = useRouter();
|
|
|
+const route = useRoute();
|
|
|
+onMounted(async () => {
|
|
|
+ spinning.value = true;
|
|
|
+ try {
|
|
|
+ await regionLinkage();//省市区
|
|
|
+ await queryChannelOrg();//获取渠道机构
|
|
|
+ await getRulesParams();//获取规则参数
|
|
|
+ await getlocalPurveyorInfo();//获取供应商列表
|
|
|
+ await getapiConfigPermissions() //获取接口配置字段
|
|
|
+ if (route.query.id) {
|
|
|
+ businessConfigid.value = route.query.id
|
|
|
+ await getDetails()//详情
|
|
|
+ }
|
|
|
+ spinning.value = false;
|
|
|
+ } catch (error) {
|
|
|
+ spinning.value = false;
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+interface FormState {
|
|
|
+ [key: string]: any;//默认全类型
|
|
|
+}
|
|
|
+// 校验规则弹窗
|
|
|
+const formRef = ref();
|
|
|
+const spinning = ref(false)//加载中
|
|
|
+const editRuleShow = ref(false)//编辑规则弹窗
|
|
|
+const businessConfigid = ref()//业务配置id
|
|
|
+const RulelabelCol = { span: 5 };
|
|
|
+const RulewrapperCol = { span: 13 };
|
|
|
+const editRuleInfo = reactive({
|
|
|
+ isVerify: "",
|
|
|
+ number: "",
|
|
|
+ rules: "",
|
|
|
+ rulesId: "",
|
|
|
+ rulesName: "",
|
|
|
+});
|
|
|
+// 业务配置表单
|
|
|
+const businessConfigForm: UnwrapRef<FormState> = reactive({
|
|
|
+ institutionId: '',//机构id
|
|
|
+ contact: '',//联系人
|
|
|
+ contactPhone: '',//联系人电话
|
|
|
+ contactAddr: '',//联系人地址
|
|
|
+ email: '',//联系人邮箱
|
|
|
+ issueConnectionMethod: '1',//发放对接方式 1 h5 2 api
|
|
|
+ consumerConnectionMethod: '1',//消费者对接方式 1 h5 2 api 3 原生(使用生活服务)
|
|
|
+ queryPermission: "1",//查询权益权限 1 静默访问 2 授权后访问
|
|
|
+ callbackUrl: '',//回调地址
|
|
|
+ provinceCode: '',//省份编码
|
|
|
+ cityCode: '',//城市编码
|
|
|
+ areaCode: '',//区县编码
|
|
|
+ issueThemeColor: '#0052d9',//权益发放主题颜色
|
|
|
+ consumerThemeColor: '#0052d9',//消费者主题颜色
|
|
|
+ businessConfig: "0",//业务配置 0 全部 1 部分
|
|
|
+ channelRightsDistributionConfig: [],//权益发放配置
|
|
|
+ channelRightsInquiryRules: [],//权益查询条件
|
|
|
+ issueChannelSceneApiConfigs: [],//权益发放接口权限
|
|
|
+ consumerChannelSceneApiConfigs: [],//消费者场景接口权限
|
|
|
+ channelSupplierConfig: [],//商户供应商配置
|
|
|
+});
|
|
|
+const channelRightsDistributionvalidator = async (value) => {
|
|
|
+ if (!businessConfigForm[value.field].some(item => item.isRequired === 1)) {
|
|
|
+ return Promise.reject('请至少添加一个必填字段');
|
|
|
+ }
|
|
|
+ return Promise.resolve();
|
|
|
+};
|
|
|
+const businessConfigFormRules: Record<string, Rule[]> = {
|
|
|
+ institutionId: [
|
|
|
+ { required: true, message: '请选择合作渠道机构', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ contact: [
|
|
|
+ { required: true, message: '联系人姓名必填', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ contactPhone: [
|
|
|
+ { required: true, message: '联系人手机号必填', trigger: 'blur' },
|
|
|
+ {
|
|
|
+ pattern: /^[0-9]+$/,
|
|
|
+ message: '请输入正确手机号',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ min: 11,
|
|
|
+ max: 11,
|
|
|
+ message: '请输入11位手机号',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ callbackUrl: [
|
|
|
+ { required: true, message: '回调地址必填', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ queryPermission: [
|
|
|
+ { required: true, message: '请选择查询权益权限', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ issueConnectionMethod: [
|
|
|
+ { required: true, message: '请选择权益发放对接方式', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ consumerConnectionMethod: [
|
|
|
+ { required: true, message: '请选择权益消费者对接方式', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ provinceCode: [
|
|
|
+ { required: true, message: '请选择权益查询页面位置精度', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ issueThemeColor: [
|
|
|
+ { required: true, message: '请选择权益发放主题颜色', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ consumerThemeColor: [
|
|
|
+ { required: true, message: '请选择消费者主题颜色', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ channelRightsDistributionConfig: [
|
|
|
+ { required: true, message: '请选择权益发放配置', trigger: 'change' },
|
|
|
+ { validator: channelRightsDistributionvalidator, trigger: 'change' }
|
|
|
+ ],
|
|
|
+};
|
|
|
+
|
|
|
+const channelRightsInquiryRulesColumns = [
|
|
|
+ {
|
|
|
+ title: '查询条件',
|
|
|
+ dataIndex: 'rulesName',
|
|
|
+ key: 'rulesName',
|
|
|
+ align: "center",
|
|
|
+ width: 200,
|
|
|
+
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '检验规则',
|
|
|
+ dataIndex: 'rules',
|
|
|
+ key: 'rules',
|
|
|
+ align: "center",
|
|
|
+
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'operation',
|
|
|
+ key: 'operation',
|
|
|
+ width: 200,
|
|
|
+ align: "center"
|
|
|
+ },
|
|
|
+]
|
|
|
+const labelCol = { style: { width: '160px' } };
|
|
|
+const queryTree = ref([]);//省市区数据
|
|
|
+const queryTreeList = ref();//省市区选中数据
|
|
|
+const rightsIssuanceRules = ref();//权益发放配置字段
|
|
|
+const rightsIssuanceRulesValue = ref([]);//权益发放配置选中值
|
|
|
+const rightsInquiryRules = ref();//权益查询条件列表
|
|
|
+const rightsInquiryRulesValue = ref([]);//权益查询条件选中值
|
|
|
+const channelSupplierConfiglist = ref();//商户供应商配置列表
|
|
|
+const channelSupplierConfiglistValue = ref(['1910251419283050497']);//商户供应商配置选中值
|
|
|
+
|
|
|
+const issueConnectionMethodOptions = ref([
|
|
|
+ {
|
|
|
+ label: 'H5链接',
|
|
|
+ value: '1',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: 'API接入',
|
|
|
+ value: '2',
|
|
|
+ },
|
|
|
+]);// 对接方式选项
|
|
|
+const consumerConnectionMethodOptions = ref([
|
|
|
+ {
|
|
|
+ label: 'H5链接',
|
|
|
+ value: '1',
|
|
|
+ text: "渠道使用H5页面,满足消费者场景",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: 'API接入',
|
|
|
+ value: '2',
|
|
|
+ text: "渠道调用API接口,满足消费者场景",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '原生(使用生活服务)',
|
|
|
+ value: '3',
|
|
|
+ text: "渠道使用生活服务应用,满足消费者场景",
|
|
|
+ },
|
|
|
+]);// 对接方式选项
|
|
|
+// 机构下拉选择树
|
|
|
+const treeData = ref<TreeSelectProps['treeData']>([]);//渠道机构数据
|
|
|
+watch(() => businessConfigForm.channelRightsDistributionConfig, (newValue) => {
|
|
|
+ // 权益发放配置必填项带入权益查询条件 businessConfigForm.channelRightsInquiryRules
|
|
|
+ if (newValue) {
|
|
|
+ if (rightsInquiryRules.value && rightsInquiryRules.value.length > 0) {
|
|
|
+ const List = newValue.filter(val => val.isRequired == 1);
|
|
|
+ const requiredRules = rightsInquiryRules.value.filter(item => List.some(id => id.rulesId === item.rulesId)).map(val => {
|
|
|
+ val.checked = true;
|
|
|
+ return val;
|
|
|
+ });
|
|
|
+ // 获取当前已有的查询规则
|
|
|
+ const currentRules = businessConfigForm.channelRightsInquiryRules || [];
|
|
|
+ // 合并逻辑:有就替换,没有就添加
|
|
|
+ requiredRules.forEach(requiredRule => {
|
|
|
+ const existingIndex = currentRules.findIndex(item => item.rulesId == requiredRule.rulesId);
|
|
|
+ if (existingIndex === -1) {
|
|
|
+ // 没有就加进去
|
|
|
+ currentRules.push(requiredRule);
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 更新数据
|
|
|
+ businessConfigForm.channelRightsInquiryRules = currentRules;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}, { immediate: true, deep: true });
|
|
|
+
|
|
|
+const getDetails = () => {
|
|
|
+ businessConfigAPI.supplierConfigById(businessConfigid.value).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ Object.assign(businessConfigForm, res.result);
|
|
|
+ queryTreeList.value = [businessConfigForm.provinceCode, businessConfigForm.cityCode, businessConfigForm.areaCode]
|
|
|
+ rightsIssuanceRulesValue.value = businessConfigForm.channelRightsDistributionConfig.map(item => item.rulesId)
|
|
|
+ rightsInquiryRulesValue.value = businessConfigForm.channelRightsInquiryRules.map(item => item.rulesId)
|
|
|
+ rightsInquiryRules.value.map(item => {
|
|
|
+ businessConfigForm.channelRightsInquiryRules.map(val => {
|
|
|
+ if (item.rulesId === val.rulesId) {
|
|
|
+ item.checked = val.checked
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+const onSubmit = () => {
|
|
|
+ formRef.value
|
|
|
+ .validate()
|
|
|
+ .then(() => {
|
|
|
+ if (businessConfigid.value) {
|
|
|
+ businessConfigAPI.supplierConfigEdit(businessConfigForm, businessConfigid.value).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ message.success('修改成功');
|
|
|
+ } else {
|
|
|
+ message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ businessConfigAPI.supplierConfigAdd(businessConfigForm).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ message.success('添加成功');
|
|
|
+ setTimeout(() => {
|
|
|
+ window.close();
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log('error', error);
|
|
|
+ });
|
|
|
+};
|
|
|
+const editRuleSave = () => {
|
|
|
+ businessConfigForm.channelRightsInquiryRules.map(item => {
|
|
|
+ if (item.rulesId === editRuleInfo.rulesId) {
|
|
|
+ Object.assign(item, editRuleInfo);
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ });
|
|
|
+ editRuleShow.value = false;
|
|
|
+}
|
|
|
+// 获取省市区数据
|
|
|
+const regionLinkage = () => {
|
|
|
+ placementPlanAPI.queryTree().then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ queryTree.value = res.result
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+// 获取业务配置渠道机构
|
|
|
+const queryChannelOrg = () => {
|
|
|
+ businessConfigAPI.getChannelDeptList().then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ treeData.value = res.result
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+// 获取商户供应商
|
|
|
+const getlocalPurveyorInfo = () => {
|
|
|
+ businessConfigAPI.localPurveyorInfoAllList().then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ channelSupplierConfiglist.value = res.result
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+// 获取接口配置字段
|
|
|
+const getapiConfigPermissions = () => {
|
|
|
+ businessConfigAPI.channelapiConfigPermissions().then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ businessConfigForm.issueChannelSceneApiConfigs = res.result.issueInterfacePermissions;//权益发放接口权限
|
|
|
+ businessConfigForm.consumerChannelSceneApiConfigs = res.result.consumerInterfacePermissions;//消费者场景接口权限
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+// 获取规则参数
|
|
|
+const getRulesParams = () => {
|
|
|
+ businessConfigAPI.getchannelRulesParams().then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ rightsIssuanceRules.value = res.result.rightsIssuanceRules;//权益发放字段列表
|
|
|
+ rightsInquiryRules.value = res.result.rightsInquiryRules;//权益条件列表
|
|
|
+ // 新增时将必填项默认选中 编辑时不处理
|
|
|
+ if (!businessConfigid.value) {
|
|
|
+ businessConfigForm.channelRightsDistributionConfig = rightsIssuanceRules.value.filter((item) => item.checked)
|
|
|
+ rightsIssuanceRulesValue.value = rightsIssuanceRules.value.filter((item) => item.checked).map((item) => item.rulesId)
|
|
|
+ } else {
|
|
|
+ // 编辑时不处理
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+// 权益发放配置选中值改变
|
|
|
+const rightsIssuanceRulesChange = (val) => {
|
|
|
+ rightsIssuanceRulesValue.value = val;
|
|
|
+ businessConfigForm.channelRightsDistributionConfig = rightsIssuanceRules.value.filter(item => val.some(id => id === item.rulesId));
|
|
|
+}
|
|
|
+// 权益查询条件选中值改变
|
|
|
+const rightsInquiryRulesChange = (val) => {
|
|
|
+ rightsInquiryRulesValue.value = val;
|
|
|
+ businessConfigForm.channelRightsInquiryRules = rightsInquiryRules.value.filter(item => val.some(id => id === item.rulesId)).sort((a, b) => b.rulesId - a.rulesId);
|
|
|
+}
|
|
|
+// 商户供应商配置选中值改变
|
|
|
+const changeChannelSupplierConfigChange = (val) => {
|
|
|
+ businessConfigForm.channelSupplierConfig = channelSupplierConfiglist.value.filter(item => val.some(id => id === item.id)).map((value) => {
|
|
|
+ return {
|
|
|
+ supplierId: value.id,
|
|
|
+ supplierName: value.purveyorName,
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+// 删除权益发放配置
|
|
|
+const channelRightsDistributionconfigDel = (value, id) => {
|
|
|
+ if (value == 'DEL') {
|
|
|
+ // 删除 权益发放配置 中对应的项
|
|
|
+ const configIndex = businessConfigForm.channelRightsDistributionConfig.findIndex(item => item.rulesId == id);
|
|
|
+ if (configIndex !== -1) {
|
|
|
+ businessConfigForm.channelRightsDistributionConfig.splice(configIndex, 1);
|
|
|
+ }
|
|
|
+ // 删除 权益查询条件 中对应的项
|
|
|
+ const inquiryIndex = businessConfigForm.channelRightsInquiryRules.findIndex(item => item.rulesId == id);
|
|
|
+ if (inquiryIndex !== -1) {
|
|
|
+ businessConfigForm.channelRightsInquiryRules.splice(inquiryIndex, 1);
|
|
|
+ rightsInquiryRules.value.find(val=>val.rulesId == id).checked = false;//同步解除权益规则删除限制
|
|
|
+ rightsInquiryRulesValue.value = rightsInquiryRulesValue.value.filter(item => item !== id);//同步解除权益规则删除限制
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (value == 0) {
|
|
|
+ // 改为非必填,同步删除
|
|
|
+ const inquiryIndex = businessConfigForm.channelRightsInquiryRules.findIndex(item => item.rulesId == id);
|
|
|
+ if (inquiryIndex !== -1) {
|
|
|
+ businessConfigForm.channelRightsInquiryRules.splice(inquiryIndex, 1);
|
|
|
+ rightsInquiryRules.value.find(val=>val.rulesId == id).checked = false;//同步解除权益规则删除限制
|
|
|
+ rightsInquiryRulesValue.value = rightsInquiryRulesValue.value.filter(item => item !== id);//同步解除权益规则删除限制
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+// 删除商户供应商配置
|
|
|
+const deleteSupplier = (index) => {
|
|
|
+ businessConfigForm.channelSupplierConfig.splice(index, 1);
|
|
|
+};
|
|
|
+// 选择位置精度
|
|
|
+async function selectAccuracy(value, selectedOptions) {
|
|
|
+ if (selectedOptions) {
|
|
|
+ businessConfigForm.provinceCode = selectedOptions[0]?.areaCode;
|
|
|
+ businessConfigForm.cityCode = selectedOptions[1]?.areaCode;
|
|
|
+ businessConfigForm.areaCode = selectedOptions[2]?.areaCode;
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+// 编辑规则
|
|
|
+const editRule = (column, record) => {
|
|
|
+ Object.assign(editRuleInfo, record);
|
|
|
+ editRuleShow.value = true;
|
|
|
+}
|
|
|
+const delRule = (column, record) => {
|
|
|
+ const inquiryIndex = businessConfigForm.channelRightsInquiryRules.findIndex(item => item.rulesId == record.rulesId);
|
|
|
+ if (inquiryIndex !== -1) {
|
|
|
+ businessConfigForm.channelRightsInquiryRules.splice(inquiryIndex, 1);
|
|
|
+ rightsInquiryRules.value.find(val=>val.rulesId == record.rulesId).checked = false;//同步解除权益规则删除限制
|
|
|
+ rightsInquiryRulesValue.value = rightsInquiryRulesValue.value.filter(item => item !== record.rulesId);//同步解除权益规则删除限制
|
|
|
+ }
|
|
|
+}
|
|
|
+// 新增渠道 - 带参数在新标签页中打开
|
|
|
+const onCancel = () => {
|
|
|
+ window.close();
|
|
|
+}
|
|
|
+</script>
|
|
|
+<!-- 样式区域 -->
|
|
|
+<style>
|
|
|
+.themeSettings .ant-popover-content .ant-popover-inner .ant-popover-inner-content {
|
|
|
+ padding: 0 !important;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+.channelSupplierConfiglist .ant-popover-content .ant-popover-inner .ant-popover-inner-content {
|
|
|
+ overflow-y: auto;
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang='less' scoped>
|
|
|
+.body {
|
|
|
+ padding: 10px 0px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .card {
|
|
|
+ padding: 0 24px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 4px;
|
|
|
+ overflow-y: auto;
|
|
|
+ height: calc(100vh - 192px);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 底部布局
|
|
|
+.footer {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ right: 0;
|
|
|
+ background: #fff;
|
|
|
+ width: calc(100vw - 210px);
|
|
|
+ height: 60px;
|
|
|
+ padding: 10px 30px;
|
|
|
+ box-sizing: border-box;
|
|
|
+
|
|
|
+ >span {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #1890FF;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.card-header {
|
|
|
+ padding: 20px 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+
|
|
|
+ .link {
|
|
|
+ width: 3px;
|
|
|
+ height: 20px;
|
|
|
+ border-radius: 0 5px 5px 0;
|
|
|
+ background-color: #018FFB;
|
|
|
+ margin-right: 7px;
|
|
|
+ }
|
|
|
+
|
|
|
+ font-size: 20px;
|
|
|
+ color: #333;
|
|
|
+ font-weight: bold;
|
|
|
+ border-bottom: 1px solid #E5E5E5;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+.card-Radio-container {
|
|
|
+ gap: 0 24px;
|
|
|
+
|
|
|
+ .card-Radio {
|
|
|
+ position: relative;
|
|
|
+ width: max-content;
|
|
|
+ padding: 16px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 4px 4px 4px 4px;
|
|
|
+ border: 2px solid #E5E5E5;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ .Method {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #333;
|
|
|
+ font-weight: bold;
|
|
|
+ line-height: 1.4;
|
|
|
+ margin-bottom: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .annotation {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
+
|
|
|
+ .anticon-check-circle {
|
|
|
+ position: absolute;
|
|
|
+ top: 7px;
|
|
|
+ right: 7px;
|
|
|
+ font-size: 21px;
|
|
|
+ color: #018FFB;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .card-Radio-active {
|
|
|
+ border: 2px solid #80C7FD;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.color-preview {
|
|
|
+ width: 120px;
|
|
|
+ padding: 3px 10px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 4px 4px 4px 4px;
|
|
|
+ border: 1px solid #E5E5E5;
|
|
|
+
|
|
|
+ .colorBlock {
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ span {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #333;
|
|
|
+ margin-left: 4px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.text {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #999;
|
|
|
+}
|
|
|
+
|
|
|
+.w250 {
|
|
|
+ width: 250px;
|
|
|
+}
|
|
|
+
|
|
|
+.fontsize14 {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #333;
|
|
|
+}
|
|
|
+
|
|
|
+.table {
|
|
|
+ width: 800px;
|
|
|
+}
|
|
|
+
|
|
|
+.merchantSupplier {
|
|
|
+ padding: 6px 10px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #E9F4FF;
|
|
|
+ border-radius: 2px 2px 2px 2px;
|
|
|
+ width: auto;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #018FFB;
|
|
|
+}
|
|
|
+
|
|
|
+.received {
|
|
|
+ margin-left: 160px;
|
|
|
+}
|
|
|
+</style>
|