feat: 套餐购买支持易支付、支付宝支付

This commit is contained in:
xiaojunnuo
2024-12-23 00:24:31 +08:00
parent 9c8c7a7812
commit faa28f88f9
69 changed files with 1073 additions and 407 deletions
@@ -53,7 +53,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
groups: {
base: {
header: "基础信息",
columns: ["title", "type", "isBootstrap", "disabled", "order", "intro"]
columns: ["title", "type", "disabled", "order", "supportBuy", "intro"]
},
content: {
header: "套餐内容",
@@ -244,12 +244,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
type: "dict-switch",
dict: dict({
data: [
{ label: "", value: true, color: "success" },
{ label: "", value: false, color: "gray" }
{ label: "支持购买", value: true, color: "success" },
{ label: "不能购买", value: false, color: "gray" }
]
}),
form: {
value: false
value: true
},
column: {
width: 120
@@ -5,6 +5,9 @@
<script lang="ts" setup>
import { durationDict } from "/@/views/certd/suite/api";
defineOptions({
name: "DurationValue"
});
const props = defineProps<{
modelValue: number;
}>();
@@ -1,17 +1,34 @@
<template>
<div class="flex-o price-input">
<a-input-number v-if="edit" prefix="¥" :value="priceValue" :precision="2" class="ml-5" @update:value="onPriceChange"> </a-input-number>
<span v-else class="price-text">{{ priceLabel }}</span>
<span v-else class="price-text" :style="style">{{ priceLabel }}</span>
</div>
</template>
<script lang="ts" setup>
import { computed } from "vue";
const props = defineProps<{
modelValue?: number;
edit?: boolean;
}>();
const props = withDefaults(
defineProps<{
modelValue?: number;
edit?: boolean;
fontSize?: number;
}>(),
{
modelValue: 0,
edit: false,
fontSize: 14
}
);
const style = computed(() => {
if (props.fontSize == null) {
return {};
}
return {
fontSize: props.fontSize + "px"
};
});
const priceValue = computed(() => {
if (props.modelValue == null) {
@@ -37,7 +54,6 @@ const onPriceChange = (price: number) => {
<style lang="less">
.price-input {
.price-text {
font-size: 18px;
color: red;
}
}
@@ -58,18 +58,18 @@ export async function DeleteBatch(ids: any[]) {
});
}
export async function SetDefault(id: any) {
export async function UpdatePaid(id: any) {
return await request({
url: apiPrefix + "/setDefault",
url: apiPrefix + "/updatePaid",
method: "post",
data: { id }
});
}
export async function SetDisabled(id: any, disabled: boolean) {
export async function SyncStatus(id: any) {
return await request({
url: apiPrefix + "/setDisabled",
url: apiPrefix + "/syncStatus",
method: "post",
data: { id, disabled }
data: { id }
});
}
@@ -6,6 +6,8 @@ import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq,
import { useUserStore } from "/@/store/modules/user";
import { useSettingStore } from "/@/store/modules/settings";
import { Modal } from "ant-design-vue";
import DurationValue from "/@/views/sys/suite/product/duration-value.vue";
import PriceInput from "/@/views/sys/suite/product/price-input.vue";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter();
@@ -56,9 +58,63 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
editRequest,
delRequest
},
actionbar: {
buttons: {
add: {
show: false
}
}
},
toolbar: { show: false },
rowHandle: {
minWidth: 200,
fixed: "right"
width: 320,
fixed: "right",
buttons: {
copy: {
show: false
},
edit: {
show: false
},
syncStatus: {
show: compute(({ row }) => {
return row.status === "wait_pay";
}),
text: "同步订单状态",
type: "link",
click: async ({ row }) => {
Modal.confirm({
title: "确认",
content: "确认同步订单状态?",
onOk: async () => {
await api.SyncStatus(row.id);
await crudExpose.doRefresh();
}
});
}
},
updatePaid: {
show: compute(({ row }) => {
return row.status === "wait_pay";
}),
text: "确认已支付",
type: "link",
click({ row }) {
Modal.confirm({
title: "确认",
content: "确认修改订单状态为已支付?",
onOk: async () => {
await api.UpdatePaid(row.id);
await crudExpose.doRefresh();
}
});
}
}
}
},
tabs: {
name: "status",
show: true
},
columns: {
id: {
@@ -72,156 +128,88 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
show: false
}
},
domain: {
title: "CNAME域名",
type: "text",
editForm: {
component: {
disabled: true
}
},
search: {
show: true
},
form: {
component: {
placeholder: "cname.handsfree.work"
},
helper: "需要一个右边DNS提供商注册的域名(也可以将其他域名的dns服务器转移到这几家来)。\nCNAME域名一旦确定不可修改,建议使用一级子域名",
rules: [{ required: true, message: "此项必填" }]
},
column: {
width: 200
}
},
dnsProviderType: {
title: "DNS提供商",
type: "dict-select",
search: {
show: true
},
dict: dict({
url: "pi/dnsProvider/list",
value: "key",
label: "title"
}),
form: {
rules: [{ required: true, message: "此项必填" }]
},
column: {
width: 150,
component: {
color: "auto"
}
}
},
accessId: {
title: "DNS提供商授权",
type: "dict-select",
dict: dict({
url: "/pi/access/list",
value: "id",
label: "name"
}),
form: {
component: {
name: "access-selector",
vModel: "modelValue",
type: compute(({ form }) => {
return form.dnsProviderType;
})
},
rules: [{ required: true, message: "此项必填" }]
},
column: {
width: 150,
component: {
color: "auto"
}
}
},
isDefault: {
title: "是否默认",
type: "dict-switch",
dict: dict({
data: [
{ label: "是", value: true, color: "success" },
{ label: "否", value: false, color: "default" }
]
}),
form: {
value: false,
rules: [{ required: true, message: "请选择是否默认" }]
},
column: {
align: "center",
width: 100
}
},
setDefault: {
title: "设置默认",
tradeNo: {
title: "订单号",
type: "text",
search: { show: true },
form: {
show: false
},
column: {
width: 100,
align: "center",
conditionalRenderDisabled: true,
cellRender: ({ row }) => {
if (row.isDefault) {
return;
}
const onClick = async () => {
Modal.confirm({
title: "提示",
content: `确定要设置为默认吗?`,
onOk: async () => {
await api.SetDefault(row.id);
await crudExpose.doRefresh();
}
});
};
return (
<a-button type={"link"} size={"small"} onClick={onClick}>
</a-button>
);
}
width: 250
}
},
disabled: {
title: "禁用/启用",
type: "dict-switch",
dict: dict({
data: [
{ label: "启用", value: false, color: "success" },
{ label: "禁用", value: true, color: "error" }
]
}),
form: {
value: false
},
title: {
title: "商品名称",
type: "text",
search: { show: true },
column: {
width: 150
}
},
duration: {
title: "时长",
type: "number",
column: {
width: 100,
component: {
title: "点击可禁用/启用",
on: {
async click({ value, row }) {
Modal.confirm({
title: "提示",
content: `确定要${!value ? "禁用" : "启用"}吗?`,
onOk: async () => {
await api.SetDisabled(row.id, !value);
await crudExpose.doRefresh();
}
});
}
}
name: DurationValue,
vModel: "modelValue"
}
}
},
amount: {
title: "金额",
type: "number",
column: {
width: 100,
component: {
name: PriceInput,
vModel: "modelValue",
edit: false
}
}
},
status: {
title: "状态",
search: { show: true },
type: "dict-select",
dict: dict({
data: [
{ label: "待支付", value: "wait_pay", color: "warning" },
{ label: "已支付", value: "paid", color: "success" },
{ label: "已取消", value: "canceled", color: "error" }
]
}),
column: {
width: 100
}
},
payType: {
title: "支付方式",
search: { show: true },
type: "dict-select",
dict: dict({
data: [
{ label: "聚合支付", value: "yizhifu" },
{ label: "支付宝", value: "alipay" },
{ label: "微信", value: "wxpay" }
]
}),
column: {
width: 100,
component: {
color: "auto"
}
}
},
payTime: {
title: "支付时间",
type: "datetime",
column: {
width: 160
}
},
createTime: {
title: "创建时间",
type: "datetime",
@@ -2,11 +2,8 @@
<fs-page class="page-cert">
<template #header>
<div class="title">
CNAME服务配置
<span class="sub">
此处配置的域名作为其他域名校验的代理当别的域名需要申请证书时通过CNAME映射到此域名上来验证所有权好处是任何域名都可以通过此方式申请证书也无需填写AccessSecret
<a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">CNAME功能原理及使用说明</a>
</span>
订单管理
<span class="sub"> </span>
</div>
</template>
<fs-crud ref="crudRef" v-bind="crudBinding">
@@ -27,7 +24,7 @@ import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api";
defineOptions({
name: "CnameProvider"
name: "TradeManager"
});
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });