修复比例默认选择和二维码预警崩溃
This commit is contained in:
@@ -316,7 +316,7 @@ func checkQrCodeStockAndAlert(tx *gorm.DB, conversation *model.ChatConversation)
|
|||||||
alertContent := fmt.Sprintf("企业微信群二维码库存不足(剩余 %d 张),请及时补充", count)
|
alertContent := fmt.Sprintf("企业微信群二维码库存不足(剩余 %d 张),请及时补充", count)
|
||||||
|
|
||||||
// 发送站内信给所有客服
|
// 发送站内信给所有客服
|
||||||
var entries []interface{}
|
entries := make([]map[string]interface{}, 0, len(csAdmins))
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
for _, admin := range csAdmins {
|
for _, admin := range csAdmins {
|
||||||
entries = append(entries, map[string]interface{}{
|
entries = append(entries, map[string]interface{}{
|
||||||
|
|||||||
@@ -89,8 +89,9 @@ function normalizeDraftForm(value: unknown): PublishForm {
|
|||||||
next.common_regions = Array.isArray(value.common_regions)
|
next.common_regions = Array.isArray(value.common_regions)
|
||||||
? value.common_regions.filter((region): region is string => typeof region === 'string')
|
? value.common_regions.filter((region): region is string => typeof region === 'string')
|
||||||
: []
|
: []
|
||||||
// 默认使用参考比例:如果草稿中的 accelerated_sale_ratio 是 0 或未设置,重置为空字符串
|
// 默认使用参考比例:如果草稿中的 accelerated_sale_ratio 是 0、未设置或非法值,重置为空字符串
|
||||||
if (!next.accelerated_sale_ratio || next.accelerated_sale_ratio === 0) {
|
const acceleratedRatio = Number(next.accelerated_sale_ratio)
|
||||||
|
if (!Number.isFinite(acceleratedRatio) || acceleratedRatio <= 0) {
|
||||||
next.accelerated_sale_ratio = ''
|
next.accelerated_sale_ratio = ''
|
||||||
}
|
}
|
||||||
if (next.haf_coin_amount === 0) next.haf_coin_amount = ''
|
if (next.haf_coin_amount === 0) next.haf_coin_amount = ''
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ function selectDailyLoss(value: string | number) {
|
|||||||
class="ratio-mode-btn"
|
class="ratio-mode-btn"
|
||||||
:class="{
|
:class="{
|
||||||
active:
|
active:
|
||||||
form.accelerated_sale_ratio === maxAcceleratedSaleRatio &&
|
Number(form.accelerated_sale_ratio) === maxAcceleratedSaleRatio &&
|
||||||
maxAcceleratedSaleRatio > 0,
|
maxAcceleratedSaleRatio > 0,
|
||||||
}"
|
}"
|
||||||
:disabled="maxAcceleratedSaleRatio <= 0"
|
:disabled="maxAcceleratedSaleRatio <= 0"
|
||||||
@@ -584,7 +584,7 @@ function selectDailyLoss(value: string | number) {
|
|||||||
:class="{
|
:class="{
|
||||||
active:
|
active:
|
||||||
hasAcceleratedSaleRatioInput() &&
|
hasAcceleratedSaleRatioInput() &&
|
||||||
form.accelerated_sale_ratio !== maxAcceleratedSaleRatio,
|
Number(form.accelerated_sale_ratio) !== maxAcceleratedSaleRatio,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<strong>自定比例</strong>
|
<strong>自定比例</strong>
|
||||||
|
|||||||
@@ -170,8 +170,9 @@ export function readFinalSaleRatio(
|
|||||||
return roundRatio(Math.min(Math.max(ratio, defaultRatio), maxAcceleratedSaleRatio))
|
return roundRatio(Math.min(Math.max(ratio, defaultRatio), maxAcceleratedSaleRatio))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasAcceleratedSaleRatioInput(value: number | '') {
|
export function hasAcceleratedSaleRatioInput(value: number | '' | null | undefined) {
|
||||||
return value !== '' && value !== null
|
const ratio = Number(value)
|
||||||
|
return value !== '' && value !== null && value !== undefined && Number.isFinite(ratio) && ratio > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculatePlatformPricing(options: {
|
export function calculatePlatformPricing(options: {
|
||||||
|
|||||||
Reference in New Issue
Block a user