Browse Source

收款新增金币校验

lihuilin/feature-20251104102812-现金二期
ZhangYong 2 weeks ago
parent
commit
61be044fe8
  1. 19
      src/views/moneyManage/receiveDetail/receiveFinance.vue
  2. 19
      src/views/moneyManage/receiveDetail/receiveManage.vue
  3. 38
      src/views/moneyManage/receiveDetail/receiveService.vue
  4. 24
      src/views/moneyManage/receiveDetail/utils/recriveFormRules.js

19
src/views/moneyManage/receiveDetail/receiveFinance.vue

@ -1244,16 +1244,15 @@ onMounted(async () => {
//
await getlist();
//
if (!hasMenuPermission(menuTree.value, 67)) {
ElMessageBox.alert(
'您暂无该页面操作权限,请联系管理员',
'权限提示',
{ type: 'error' }
).then(() => {
window.history.back();
});
}
// if (!hasMenuPermission(menuTree.value, 67)) {
// ElMessageBox.alert(
// '',
// '',
// { type: 'error' }
// ).then(() => {
// window.history.back();
// });
// }
//
const bgImg = new Image();
bgImg.src = '/src/assets/receive-recall.png';

19
src/views/moneyManage/receiveDetail/receiveManage.vue

@ -1244,16 +1244,15 @@ onMounted(async () => {
//
await getlist();
//
if (!hasMenuPermission(menuTree.value, 67)) {
ElMessageBox.alert(
'您暂无该页面操作权限,请联系管理员',
'权限提示',
{ type: 'error' }
).then(() => {
window.history.back();
});
}
// if (!hasMenuPermission(menuTree.value, 67)) {
// ElMessageBox.alert(
// '',
// '',
// { type: 'error' }
// ).then(() => {
// window.history.back();
// });
// }
//
const bgImg = new Image();
bgImg.src = '/src/assets/receive-recall.png';

38
src/views/moneyManage/receiveDetail/receiveService.vue

@ -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-9999990
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')

24
src/views/moneyManage/receiveDetail/utils/recriveFormRules.js

@ -24,30 +24,6 @@ export const addFormRule = {
goodNum: [
{ required: true, message: '请输入产品数量', trigger: 'blur' },
],
// 永久金币:纯数字(非必填,可按需调整)
permanentGold: [
{
validator: (rule, value, callback) => {
if (value && !/^\d+$/.test(value)) {
callback(new Error('请输入纯数字'));
} else {
callback();
}
}, trigger: 'blur'
}
],
// 免费金币:纯数字(非必填,可按需调整)
freeGold: [
{
validator: (rule, value, callback) => {
if (value && !/^\d+$/.test(value)) {
callback(new Error('请输入纯数字'));
} else {
callback();
}
}, trigger: 'blur'
}
],
// 付款币种:必填
paymentCurrency: [
{ required: true, message: '请选择付款币种', trigger: 'change' }

Loading…
Cancel
Save