- {{ t('如需扣余额,则输入负数,例如:-10.50') }}
+
+
+
+
+ {{ getcurrencySign(formAdjustment.currencyCode) }} {{ formAdjustment.creditBalance }}
+
+
+
+
+
+
+
+
+ {{ t('如需扣余额,则输入负数,例如:-10.50') }}
+
@@ -138,6 +150,11 @@ const props = defineProps({ // 父组件向子组件传值
}
})
+let resData = getLocalStorage('currencySelect');
+ const currencyCodesOptions = ref([]);
+ currencyCodesOptions.value = resData.map(item => {
+ return { label:`${item.currencyName}(${item.currencyCode})`, value: item.currencyCode }
+ })
const currencySelectAll = getLocalStorage('currencySelect').map(item => {
return {...item, label: item.currencyCode, value: item.currencyCode }
});
@@ -179,7 +196,6 @@ const formCreditType = ref({
})
const getcurrencySign = (val) => {
let currencySignItem = currencySelectAll.find(item => item.value == val);
- console.log(currencySignItem)
return currencySignItem.currencySign
}
const rulesCreditType = ref({
@@ -196,7 +212,68 @@ const rules = ref({
realBalanceNum: [{ required: true, message: proxy.t('信誉额度不能为空'), trigger: "change" }],
})
const rulesAdjustment = ref({
- balance: [{ required: true, message: proxy.t('调额额度不能为空'), trigger: "change" }],
+ balanceReal: [
+ {
+ validator: (rule, value, callback) => {
+ // 1. 如果禁用,不校验
+ if (props.modifyDate.tenantType == 2) {
+ return callback();
+ }
+
+ // 2. 必填
+ if (value === '' || value === null || value === undefined) {
+ return callback(new Error("请输入可用额度"));
+ }
+
+ const num = Number(value);
+ const realBalance = Number(formAdjustment.value.realBalance);
+
+ // 3. 如果是负数,绝对值不能超过 realBalance
+ if (num < 0) {
+ if (Math.abs(num) > realBalance) {
+ return callback(
+ new Error(`要减的额度绝对值不能超过可用余额 ${realBalance}`)
+ );
+ }
+ }
+
+ // 4. 通过
+ return callback();
+ },
+ trigger: "change"
+ }
+],
+balanceCredit: [
+ {
+ validator: (rule, value, callback) => {
+ // 1. 如果禁用,不校验
+ if (props.modifyDate.tenantType == 1) {
+ return callback();
+ }
+
+ // 2. 必填
+ if (value === '' || value === null || value === undefined) {
+ return callback(new Error("请输入额度"));
+ }
+
+ const num = Number(value);
+ const creditBalance = Number(formAdjustment.value.creditBalance);
+
+ // 3. 如果是负数,绝对值不能超过 creditBalance
+ if (num < 0) {
+ if (Math.abs(num) > creditBalance) {
+ return callback(
+ new Error(`要减的额度绝对值不能超过信誉余额 ${creditBalance}`)
+ );
+ }
+ }
+
+ // 4. 通过
+ return callback();
+ },
+ trigger: "change"
+ }
+],
googleCode: [{ required: true, message: proxy.t('谷歌验证码不能为空'), trigger: "change" }],
})
const platAdjustment = ref({
@@ -216,6 +293,43 @@ const handleAdjustment = (row) => {
})
}
+
+//
+const sumPlatformBalance = (jsonStr) => {
+
+ try {
+ // 转成对象
+ const obj = JSON.parse(jsonStr);
+
+ // 累加所有 value
+ return Object.values(obj).reduce((sum, val) => sum + Number(val), 0).toFixed(4);
+ } catch (e) {
+ // console.error("JSON 解析失败:", e);
+ return 0;
+ }
+}
+//
+const parsePlatformBalance = (jsonStr) => {
+
+ try {
+ const obj = JSON.parse(jsonStr);
+
+ // 遍历生成数组
+ const result = Object.entries(obj).map(([key, value]) => {
+ // 取前缀("_" 前面的部分,比如 "AG_VND_FALSE" → "AG")
+ const name = key.split("_")[0];
+ return {
+ name,
+ balance: Number(value)
+ };
+ });
+
+ return result;
+ } catch (e) {
+ // console.error("JSON 解析失败:", e);
+ return [];
+ }
+}
//修改时数据更新区域
nextTick(() => {
handleAdjustment(props.modifyDate);
@@ -270,37 +384,44 @@ superCommonCurrencySelects();
superCommonQuotaTypeSelects();
const openCreditType = ref(false);
const handleAddType = (value) => {
- openCreditType.value = true;
+ if (!platAdjustment.value.currencyCode){
+ ElMessage.warning('请选择币种!');
+ return
+ }
+ // openCreditType.value = true;
+ visible.value = true;
+ formAdjustment.value.id = '';
+ formAdjustment.value.platformBalanceJson = '{}';
+ formAdjustment.value.realBalance = 0;
+ formAdjustment.value.creditBalance = 0;
+ formAdjustment.value.tenantKey = props.modifyDate.tenantKey;
+ formAdjustment.value.currencyCode = platAdjustment.value.currencyCode;
}
const visible = ref(false);
const handleAdd = (value,row) => {
+ let rowOpen = JSON.parse(JSON.stringify(row));
visible.value = true;
- formAdjustment.value.id = row.id;
- formAdjustment.value.googleCode = '';
- formAdjustment.value.balance = row.balance
- formAdjustment.value.currencyCode = row.currencyCode;
- formAdjustment.value.tenantKey = row.tenantKey;
-
-
-}
-//减金额
-const handleReduce = (value,row) => {
- visible.value = true;
- formAdjustment.value.id = row.id;
- formAdjustment.value.isOut = false;
- formAdjustment.value.googleCode = '';
- formAdjustment.value.balance = ''
+ formAdjustment.value.id = rowOpen.id;
+ formAdjustment.value = rowOpen;
}
const onSubmit = () => {
proxy.$refs["formAdjustmentRef"].validate(valid => {
if (valid) {
let numBalance = 0;
- if(Number(formAdjustment.value.balance) <= 0){
+ if(Number(formAdjustment.value.balanceReal) <= 0 || Number(formAdjustment.value.balanceCredit) <= 0){
formAdjustment.value.isOut = false;
- numBalance = Math.abs(formAdjustment.value.balance)
- }else{
+ if (formAdjustment.value.balanceReal !=0){
+ numBalance = Math.abs(formAdjustment.value.balanceReal);
+ }else if (formAdjustment.value.balanceCredit !=0){
+ numBalance = Math.abs(formAdjustment.value.balanceCredit);
+ }
+ }else{
formAdjustment.value.isOut = true;
- numBalance = formAdjustment.value.balance
+ if (formAdjustment.value.balanceReal !=0){
+ numBalance = formAdjustment.value.balanceReal
+ }else if (formAdjustment.value.balanceCredit ==0){
+ numBalance = formAdjustment.value.balanceCredit;
+ }
}
let obj = {
id: formAdjustment.value.id,
@@ -359,6 +480,8 @@ function submitForm() {
openCreditType.value = false;
formCreditTypes.value?.resetFields()
handleAdjustment(props.modifyDate);
+ }).catch(() => {
+ loadingButton.value = false;
});
}
diff --git a/src/views/merchant/quota/index.vue b/src/views/merchant/quota/index.vue
index 4a642c2..4bc2c1f 100644
--- a/src/views/merchant/quota/index.vue
+++ b/src/views/merchant/quota/index.vue
@@ -2,6 +2,7 @@
+
-
+
-
+
{{ row.memberAccount? row.memberAccount : '--' }}
-
+
{{ row.gameAccount? row.gameAccount : '--' }}
@@ -220,14 +221,15 @@
import { getLocalStorage } from "@/utils/auth";
import CopyIcon from '@/components/CopyIcon'
import CustomSelect from '@/components/CustomSelect'
+ import TableSearchDate from '@/components/TableSearchDate'
import IconTips from '@/components/IconTips'
import { parseTime } from '@/utils/ruoyi'; // 时间格式化
-import { nextTick } from "vue";
+import { nextTick, onMounted } from "vue";
import { get } from "@vueuse/core";
const router = useRouter();
const { proxy } = getCurrentInstance();
const { ff_tenant_type, ff_tenant_status } = proxy.useDict("ff_tenant_type", "ff_tenant_status");
-
+ const dateRange = ref([]),operateTimeType = ref("day");
const agentList = ref([]);
const open = ref(false);
@@ -248,17 +250,22 @@ import { get } from "@vueuse/core";
{ label: proxy.t('商户账号'), value: "account" },
{ label: proxy.t('商户状态'), value: "status" },
]);
+ const today = new Date();
+const yyyy = today.getFullYear();
+const mm = String(today.getMonth() + 1).padStart(2, '0');
+const dd = String(today.getDate()).padStart(2, '0');
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
orderByColumn:'createTime',
+ currencyCode: 'VND',
isAsc:'desc',
- params:{
- beginTime:'',
- endTime:'',
- },
+ // params:{
+ // beginTime: `${yyyy}-${mm}-${dd} 00:00:00`,
+ // endTime: `${yyyy}-${mm}-${dd} 23:59:59`
+ // },
tenantKey: "",
memberAccount:''
},
@@ -279,7 +286,7 @@ import { get } from "@vueuse/core";
/** 查询列表 */
function getList() {
loading.value = true;
- superTenantQuotaflow(queryParams.value).then(response => {
+ superTenantQuotaflow(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
agentList.value = response.rows;
total.value = response.total;
loading.value = false;
@@ -427,10 +434,13 @@ const getsuperCommonPlatformTypeSelect = async () => {
}
});
}
-
- getList();
- getsuperCommonCurrencySelect();
- getsuperCommonPlatformTypeSelect();
+ //初始化
+ onMounted(() => {
+ getList();
+ getsuperCommonCurrencySelect();
+ getsuperCommonPlatformTypeSelect();
+ })
+
+
\ No newline at end of file