trade:优化交易配置的参数校验

This commit is contained in:
YunaiV 2023-09-28 15:29:15 +08:00
parent 2f82eff526
commit 74de8e9687
2 changed files with 45 additions and 18 deletions

View File

@ -278,12 +278,16 @@ export const PromotionDiscountTypeEnum = {
*/ */
export const BrokerageBindModeEnum = { export const BrokerageBindModeEnum = {
ANYTIME: { ANYTIME: {
mode: 0, mode: 1,
name: '没有推广人' name: '首次绑定'
}, },
REGISTER: { REGISTER: {
mode: 1, mode: 2,
name: '新用户' name: '注册绑定'
},
OVERRIDE: {
mode: 3,
name: '覆盖绑定'
} }
} }
/** /**
@ -291,11 +295,11 @@ export const BrokerageBindModeEnum = {
*/ */
export const BrokerageEnabledConditionEnum = { export const BrokerageEnabledConditionEnum = {
ALL: { ALL: {
condition: 0, condition: 1,
name: '人人分销' name: '人人分销'
}, },
ADMIN: { ADMIN: {
condition: 1, condition: 2,
name: '指定分销' name: '指定分销'
} }
} }

View File

@ -10,7 +10,7 @@
<el-form-item label="hideId" v-show="false"> <el-form-item label="hideId" v-show="false">
<el-input v-model="formData.id" /> <el-input v-model="formData.id" />
</el-form-item> </el-form-item>
<!-- 配送 -->
<el-tabs> <el-tabs>
<el-tab-pane label="配送"> <el-tab-pane label="配送">
<el-form-item label="启用包邮" prop="deliveryExpressFreeEnabled"> <el-form-item label="启用包邮" prop="deliveryExpressFreeEnabled">
@ -22,10 +22,15 @@
v-model="formData.deliveryExpressFreePrice" v-model="formData.deliveryExpressFreePrice"
placeholder="请输入满额包邮" placeholder="请输入满额包邮"
class="!w-xs" class="!w-xs"
:precision="2"
:min="0"
/> />
<el-text class="w-full" size="small" type="info"> 商城商品满多少金额即可包邮 </el-text> <el-text class="w-full" size="small" type="info">
商城商品满多少金额即可包邮单位
</el-text>
</el-form-item> </el-form-item>
</el-tab-pane> </el-tab-pane>
<!-- 分销 -->
<el-tab-pane label="分销"> <el-tab-pane label="分销">
<el-form-item label="分佣启用" prop="brokerageEnabled"> <el-form-item label="分佣启用" prop="brokerageEnabled">
<el-switch v-model="formData.brokerageEnabled" style="user-select: none" /> <el-switch v-model="formData.brokerageEnabled" style="user-select: none" />
@ -59,10 +64,10 @@
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
<el-text class="w-full" size="small" type="info"> <el-text class="w-full" size="small" type="info">
没有推广人只要用户没有推广人随时都可以绑定推广关系 首次绑定只要用户没有推广人随时都可以绑定推广关系
</el-text> </el-text>
<el-text class="w-full" size="small" type="info"> <el-text class="w-full" size="small" type="info">
新用户只有新用户注册时或首次进入系统时才可以绑定推广关系 注册绑定只有新用户注册时或首次进入系统时才可以绑定推广关系
</el-text> </el-text>
</el-form-item> </el-form-item>
<el-form-item label="分销海报图"> <el-form-item label="分销海报图">
@ -76,6 +81,8 @@
v-model="formData.brokerageFirstPercent" v-model="formData.brokerageFirstPercent"
placeholder="请输入一级返佣比例" placeholder="请输入一级返佣比例"
class="!w-xs" class="!w-xs"
:min="0"
:max="100"
/> />
<el-text class="w-full" size="small" type="info"> <el-text class="w-full" size="small" type="info">
订单交易成功后给推广人返佣的百分比 订单交易成功后给推广人返佣的百分比
@ -86,6 +93,8 @@
v-model="formData.brokerageSecondPercent" v-model="formData.brokerageSecondPercent"
placeholder="请输入二级返佣比例" placeholder="请输入二级返佣比例"
class="!w-xs" class="!w-xs"
:min="0"
:max="100"
/> />
<el-text class="w-full" size="small" type="info"> <el-text class="w-full" size="small" type="info">
订单交易成功后给推广人的推荐人返佣的百分比 订单交易成功后给推广人的推荐人返佣的百分比
@ -96,6 +105,7 @@
v-model="formData.brokerageFrozenDays" v-model="formData.brokerageFrozenDays"
placeholder="请输入佣金冻结天数" placeholder="请输入佣金冻结天数"
class="!w-xs" class="!w-xs"
:min="0"
/> />
<el-text class="w-full" size="small" type="info"> <el-text class="w-full" size="small" type="info">
防止用户退款佣金被提现了所以需要设置佣金冻结时间单位 防止用户退款佣金被提现了所以需要设置佣金冻结时间单位
@ -106,6 +116,8 @@
v-model="formData.brokerageWithdrawMinPrice" v-model="formData.brokerageWithdrawMinPrice"
placeholder="请输入提现最低金额" placeholder="请输入提现最低金额"
class="!w-xs" class="!w-xs"
:precision="2"
:min="0"
/> />
<el-text class="w-full" size="small" type="info"> <el-text class="w-full" size="small" type="info">
用户提现最低金额限制单位 用户提现最低金额限制单位
@ -116,9 +128,12 @@
v-model="formData.brokerageWithdrawFeePercent" v-model="formData.brokerageWithdrawFeePercent"
placeholder="请输入提现手续费" placeholder="请输入提现手续费"
class="!w-xs" class="!w-xs"
:min="0"
:max="100"
/> />
<el-text class="w-full" size="small" type="info"> <el-text class="w-full" size="small" type="info">
提现手续费百分比范围0-1000为无提现手续费设置10即收取10%手续费提现100元到账90元10元手续费 提现手续费百分比范围 0-1000 为无提现手续费设置 10即收取 10% 手续费提现
10 到账 9 1 元手续费
</el-text> </el-text>
</el-form-item> </el-form-item>
<el-form-item label="提现方式" prop="brokerageWithdrawTypes"> <el-form-item label="提现方式" prop="brokerageWithdrawTypes">
@ -146,7 +161,7 @@
</el-form-item> </el-form-item>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<!-- 保存 -->
<el-form-item> <el-form-item>
<el-button type="primary" @click="submitForm" :loading="formLoading"> 保存 </el-button> <el-button type="primary" @click="submitForm" :loading="formLoading"> 保存 </el-button>
</el-form-item> </el-form-item>
@ -167,11 +182,11 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formRef = ref() const formRef = ref()
const formData = ref({ const formData = ref({
id: null, id: null,
deliveryExpressFreeEnabled: true, deliveryExpressFreeEnabled: false,
deliveryExpressFreePrice: 0, deliveryExpressFreePrice: 0,
brokerageEnabled: true, brokerageEnabled: false,
brokerageEnabledCondition: BrokerageEnabledConditionEnum.ALL.condition, brokerageEnabledCondition: undefined,
brokerageBindMode: BrokerageBindModeEnum.ANYTIME.mode, brokerageBindMode: undefined,
brokeragePosterUrls: [], brokeragePosterUrls: [],
brokerageFirstPercent: 0, brokerageFirstPercent: 0,
brokerageSecondPercent: 0, brokerageSecondPercent: 0,
@ -211,10 +226,15 @@ const submitForm = async () => {
// //
formLoading.value = true formLoading.value = true
try { try {
const data = formData.value as unknown as ConfigApi.ConfigVO const data = {
...formData.value
} as unknown as ConfigApi.ConfigVO
data.brokeragePosterUrls = formData.value.brokeragePosterUrls.map((item: any) => { data.brokeragePosterUrls = formData.value.brokeragePosterUrls.map((item: any) => {
return item?.url ? item.url : item return item?.url ? item.url : item
}) })
//
data.deliveryExpressFreePrice = data.deliveryExpressFreePrice * 100
data.brokerageWithdrawMinPrice = data.brokerageWithdrawMinPrice * 100
await ConfigApi.saveTradeConfig(data) await ConfigApi.saveTradeConfig(data)
message.success('保存成功') message.success('保存成功')
} finally { } finally {
@ -230,6 +250,9 @@ const getConfig = async () => {
if (data != null) { if (data != null) {
data.brokeragePosterUrls = data.brokeragePosterUrls.map((url) => ({ url })) data.brokeragePosterUrls = data.brokeragePosterUrls.map((url) => ({ url }))
formData.value = data formData.value = data
//
formData.value.deliveryExpressFreePrice = data.deliveryExpressFreePrice / 100
formData.value.brokerageWithdrawMinPrice = data.brokerageWithdrawMinPrice / 100
} }
} finally { } finally {
formLoading.value = false formLoading.value = false