|
@@ -14,13 +14,10 @@
|
|
|
|
|
|
<cl-row>
|
|
|
<!-- 数据表格 -->
|
|
|
- <cl-table ref="Table">
|
|
|
+ <cl-table ref="Table" :contextMenu="[]">
|
|
|
<template #slot-info="{ scope }">
|
|
|
<el-button text bg type="success" @click="openInfo(scope.row)">商户信息</el-button>
|
|
|
</template>
|
|
|
- <template #slot-balance="{ scope }">
|
|
|
- <el-button text bg type="warning" @click="toBalance(scope.row)">余额变动</el-button>
|
|
|
- </template>
|
|
|
</cl-table>
|
|
|
</cl-row>
|
|
|
|
|
@@ -38,19 +35,16 @@
|
|
|
<el-button type="primary" @click="makeKey()">自动生成</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <template #slot-secret="{ scope }">
|
|
|
+ <div>
|
|
|
+ <el-input v-model="scope.secret" style="width: 84%"></el-input>
|
|
|
+ <el-button type="primary" @click="makeSecret()">自动生成</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</cl-upsert>
|
|
|
<cl-dialog title="商户信息" width="600" v-model="visible">
|
|
|
<el-input v-model="mchInfo" :rows="15" type="textarea" placeholder="Please input" />
|
|
|
</cl-dialog>
|
|
|
- <cl-form class="form" ref="form">
|
|
|
- <template #slot-type="{ scope }">
|
|
|
- <el-radio-group v-model="scope.type" class="ml-4" @change="typeChange">
|
|
|
- <el-radio label="2" size="large">下发</el-radio>
|
|
|
- <el-radio label="3" size="large">冲正</el-radio>
|
|
|
- <el-radio label="4" size="large">内充</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </template>
|
|
|
- </cl-form>
|
|
|
</cl-crud>
|
|
|
</template>
|
|
|
|
|
@@ -59,102 +53,8 @@ import { useCrud, useTable, useUpsert, useForm } from "@cool-vue/crud";
|
|
|
import { useCool } from "/@/cool";
|
|
|
import md5 from "md5";
|
|
|
import { ref } from "vue";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
-
|
|
|
const { service } = useCool();
|
|
|
|
|
|
-const form = useForm();
|
|
|
-
|
|
|
-function typeChange(value: any) {
|
|
|
- form.value?.setProps("amount", {
|
|
|
- min: +value === 3 ? -Infinity : 0
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-function toBalance(row: any) {
|
|
|
- form.value?.open({
|
|
|
- title: "余额变动",
|
|
|
- width: "700",
|
|
|
- props: {
|
|
|
- labelWidth: "120px"
|
|
|
- },
|
|
|
- items: [
|
|
|
- {
|
|
|
- label: "商户号",
|
|
|
- prop: "mchId",
|
|
|
- required: true,
|
|
|
- component: {
|
|
|
- name: "el-input",
|
|
|
- props: {
|
|
|
- readonly: true
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: "类型",
|
|
|
- prop: "type",
|
|
|
- required: true,
|
|
|
- component: {
|
|
|
- name: "slot-type"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: "金额",
|
|
|
- prop: "amount",
|
|
|
- required: true,
|
|
|
- component: {
|
|
|
- name: "el-input-number",
|
|
|
- props: {
|
|
|
- style: { width: "200px" },
|
|
|
- precision: 2,
|
|
|
- min: 0
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: "备注",
|
|
|
- prop: "remark",
|
|
|
- component: {
|
|
|
- name: "el-input",
|
|
|
- props: {
|
|
|
- type: "textarea",
|
|
|
- rows: 3
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- form: {
|
|
|
- mchId: row.mchId,
|
|
|
- type: "",
|
|
|
- amount: 0,
|
|
|
- remark: ""
|
|
|
- },
|
|
|
- on: {
|
|
|
- submit(data, { close, done }) {
|
|
|
- const payload = {
|
|
|
- ...data
|
|
|
- };
|
|
|
- if (+data.type === 2) {
|
|
|
- payload.amount = -Math.abs(data.amount);
|
|
|
- } else if (+data.type === 4) {
|
|
|
- payload.amount = +Math.abs(data.amount);
|
|
|
- }
|
|
|
- service.dj.balance
|
|
|
- .add(payload)
|
|
|
- .then(() => {
|
|
|
- ElMessage.success("操作成功,如余额未变化,请稍后刷新");
|
|
|
- close();
|
|
|
- Crud.value?.refresh();
|
|
|
- })
|
|
|
- .catch((err: any) => {
|
|
|
- ElMessage.error(err.message);
|
|
|
- done();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
const visible = ref(false);
|
|
|
|
|
|
const mchInfo = ref("");
|
|
@@ -164,7 +64,9 @@ function openInfo(row: any) {
|
|
|
mchInfo.value = `
|
|
|
商户号: ${row.mchId}
|
|
|
商户密码:
|
|
|
+ 商户资金密码:
|
|
|
商户密钥: ${row.key}
|
|
|
+ 商户谷歌验证码: ${row.secret}
|
|
|
商户后台: http://157.175.73.225
|
|
|
|
|
|
开发文档地址:https://doc.apipost.net/docs/detail/33d38ea154ee000?target_id=3d3371cff09002
|
|
@@ -179,6 +81,11 @@ function makeKey() {
|
|
|
Upsert.value?.setForm("key", md5(+new Date()));
|
|
|
}
|
|
|
|
|
|
+async function makeSecret() {
|
|
|
+ const secret = await service.dj.merchant.createSecret();
|
|
|
+ Upsert.value?.setForm("secret", secret);
|
|
|
+}
|
|
|
+
|
|
|
// cl-upsert
|
|
|
const Upsert = useUpsert({
|
|
|
dialog: {
|
|
@@ -204,21 +111,18 @@ const Upsert = useUpsert({
|
|
|
span: 12,
|
|
|
};
|
|
|
},
|
|
|
- { prop: "key", label: "密钥", required: true, component: { name: "slot-key" } },
|
|
|
{
|
|
|
- prop: "rate",
|
|
|
- label: "手续费(%)",
|
|
|
- component: {
|
|
|
- name: "el-input-number",
|
|
|
- props: { style: { width: "200px" }, precision: 2, min: 0 }
|
|
|
- },
|
|
|
+ prop: "email",
|
|
|
+ label: "邮箱",
|
|
|
required: true,
|
|
|
+ component: { name: "el-input" },
|
|
|
span: 12,
|
|
|
},
|
|
|
+ { prop: "key", label: "密钥", required: true, component: { name: "slot-key" } },
|
|
|
() => {
|
|
|
return {
|
|
|
prop: "password",
|
|
|
- label: "密码",
|
|
|
+ label: "登录密码",
|
|
|
span: 12,
|
|
|
required: Upsert.value?.mode == "add",
|
|
|
component: {
|
|
@@ -236,28 +140,31 @@ const Upsert = useUpsert({
|
|
|
]
|
|
|
};
|
|
|
},
|
|
|
- {
|
|
|
- prop: "status",
|
|
|
- label: "状态",
|
|
|
- value: 1,
|
|
|
- component: {
|
|
|
- name: "el-radio-group",
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: "开启",
|
|
|
- value: 1
|
|
|
- },
|
|
|
+ { prop: "secret", label: "谷歌验证码", required: true, component: { name: "slot-secret" } },
|
|
|
+ () => {
|
|
|
+ return {
|
|
|
+ prop: "fundPwd",
|
|
|
+ label: "资金密码",
|
|
|
+ span: 12,
|
|
|
+ required: Upsert.value?.mode == "add",
|
|
|
+ component: {
|
|
|
+ name: "el-input",
|
|
|
+ props: {
|
|
|
+ type: "password"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rules: [
|
|
|
{
|
|
|
- label: "关闭",
|
|
|
- value: 0
|
|
|
+ min: 6,
|
|
|
+ max: 16,
|
|
|
+ message: "密码长度在 6 到 16 个字符"
|
|
|
}
|
|
|
]
|
|
|
- },
|
|
|
-
|
|
|
+ };
|
|
|
},
|
|
|
{
|
|
|
prop: "status",
|
|
|
- label: "代付状态",
|
|
|
+ label: "状态",
|
|
|
value: 1,
|
|
|
component: {
|
|
|
name: "el-radio-group",
|
|
@@ -272,44 +179,18 @@ const Upsert = useUpsert({
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
-
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "withdrawRate",
|
|
|
- label: "代付手续费(%)",
|
|
|
- component: {
|
|
|
- name: "el-input-number",
|
|
|
- props: { style: { width: "200px" }, precision: 2, min: 0 }
|
|
|
- },
|
|
|
- required: true,
|
|
|
- span: 12,
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "withdrawBasicFee",
|
|
|
- label: "单笔固定费用",
|
|
|
- component: {
|
|
|
- name: "el-input-number",
|
|
|
- props: { style: { width: "200px" }, precision: 2, min: 0 }
|
|
|
- },
|
|
|
- required: true,
|
|
|
- span: 12,
|
|
|
},
|
|
|
{
|
|
|
- prop: "withdrawFeeMin",
|
|
|
- label: "单笔最低费用",
|
|
|
- component: {
|
|
|
- name: "el-input-number",
|
|
|
- props: { style: { width: "200px" }, precision: 2, min: 0 }
|
|
|
- },
|
|
|
- required: true,
|
|
|
- span: 12,
|
|
|
+ prop: "whiteIp",
|
|
|
+ label: "IP白名单",
|
|
|
+ component: { name: "el-input", props: { type: "textarea", rows: 4, placeholder: '请输入IP白名单,以英文逗号隔开' } }
|
|
|
},
|
|
|
{
|
|
|
prop: "remark",
|
|
|
label: "备注",
|
|
|
component: { name: "el-input", props: { type: "textarea", rows: 4 } }
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
});
|
|
|
|
|
|
// cl-table
|
|
@@ -319,15 +200,7 @@ const Table = useTable({
|
|
|
{ type: "selection" },
|
|
|
{ prop: "name", label: "商户名" },
|
|
|
{ prop: "mchId", label: "商户号" },
|
|
|
- { prop: "balance", label: "余额" },
|
|
|
- {
|
|
|
- prop: "rate",
|
|
|
- label: "手续费",
|
|
|
- formatter(row) {
|
|
|
- return row.rate + "%";
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
+ { prop: "email", label: "邮箱" },
|
|
|
{
|
|
|
prop: "status",
|
|
|
label: "状态",
|
|
@@ -336,9 +209,10 @@ const Table = useTable({
|
|
|
name: "cl-switch"
|
|
|
}
|
|
|
},
|
|
|
+ { prop: "whiteIp", label: "IP白名单", showOverflowTooltip: true },
|
|
|
{ prop: "remark", label: "备注", showOverflowTooltip: true },
|
|
|
{ prop: "createTime", label: "创建时间", sortable: "desc", width: 160 },
|
|
|
- { type: "op", width: 220, buttons: ["slot-info", "slot-balance", "edit", "delete"] }
|
|
|
+ { type: "op", width: 300, buttons: ["slot-info", "edit", "delete"] }
|
|
|
]
|
|
|
});
|
|
|
|