|
|
|
@ -212,13 +212,13 @@ |
|
|
|
<div style=" display: flex; "> |
|
|
|
<span |
|
|
|
style="color: #999999; display: flex; white-space: nowrap;align-items: center;">永久金币:</span> |
|
|
|
<el-input style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;" |
|
|
|
<el-input placeholder="0" style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;" |
|
|
|
v-model="addFormData.permanentGold" /> |
|
|
|
</div> |
|
|
|
<div style="padding-right: 5px; display: flex;"> |
|
|
|
<span |
|
|
|
style="color: #999999; display: flex; white-space: nowrap;align-items: center;">免费金币:</span> |
|
|
|
<el-input style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;" |
|
|
|
<el-input placeholder="0" style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;" |
|
|
|
v-model="addFormData.freeGold" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -589,7 +589,8 @@ const openAddForm = (row) => { |
|
|
|
if (row?.jwcode) { |
|
|
|
// 编辑模式 |
|
|
|
addOrEdit.value = 2 |
|
|
|
addFormData.value = { ...row, |
|
|
|
addFormData.value = { |
|
|
|
...row, |
|
|
|
activity: row.activityId |
|
|
|
} |
|
|
|
jwcodeSeachMarket() |
|
|
|
@ -610,11 +611,38 @@ const closeAddForm = () => { |
|
|
|
isGold.value = false |
|
|
|
addFormRef.value?.resetFields(); |
|
|
|
} |
|
|
|
const testGold = () => { |
|
|
|
// 转换为数字(处理字符串类型的数字) |
|
|
|
|
|
|
|
if(addFormData.value.permanentGold == null){ |
|
|
|
addFormData.value.permanentGold = 0 |
|
|
|
} |
|
|
|
if(addFormData.value.freeGold == null){ |
|
|
|
addFormData.value.freeGold = 0 |
|
|
|
} |
|
|
|
const permanentGold = Number(addFormData.value.permanentGold); |
|
|
|
const freeNum = Number(addFormData.value.freeGold); |
|
|
|
// 正则:仅允许0-999999的正整数(包括0) |
|
|
|
const reg = /^[0-9]{1,6}$/; |
|
|
|
if (!reg.test(permanentGold) || permanentGold < 0) { |
|
|
|
return { valid: false, message: '请检查永久金币格式' }; |
|
|
|
} |
|
|
|
if (!reg.test(freeNum) || freeNum < 0) { |
|
|
|
return { valid: false, message: '请检查免费金币格式' }; |
|
|
|
} |
|
|
|
if (permanentGold == 0 && freeNum == 0) { |
|
|
|
return { valid: false, message: '永久金币或免费金币不能同为0' }; |
|
|
|
} |
|
|
|
return { valid: true }; |
|
|
|
} |
|
|
|
// 客服新增收款 |
|
|
|
const handleAddForm = async () => { |
|
|
|
try { |
|
|
|
await addFormRef.value.validate(); |
|
|
|
if (!testGold().valid) { |
|
|
|
ElMessage.error(testGold().message); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 处理时间格式 |
|
|
|
if (addFormData.value.payTime) { |
|
|
|
addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss') |
|
|
|
@ -648,6 +676,10 @@ const handleAddForm = async () => { |
|
|
|
const handleEditForm = async () => { |
|
|
|
try { |
|
|
|
await addFormRef.value.validate(); |
|
|
|
if (!testGold().valid) { |
|
|
|
ElMessage.error(testGold().message); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 处理时间格式 |
|
|
|
if (addFormData.value.payTime) { |
|
|
|
addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss') |
|
|
|
|