mirror of
https://github.com/certd/certd.git
synced 2026-05-15 20:47:31 +08:00
fix: 免费套餐支持购买
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
<div style="height: 400px">
|
||||
<ProductManager @refreshed="onTableRefresh"></ProductManager>
|
||||
</div>
|
||||
<div class="helper">不建议设置免费套餐,可以在下方配置注册赠送套餐</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="注册赠送套餐" name="registerGift">
|
||||
|
||||
@@ -7,6 +7,10 @@ import { ref, watch } from "vue";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { request } from "/@/api/service";
|
||||
|
||||
defineOptions({
|
||||
name: "SuiteDurationSelector"
|
||||
});
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: {
|
||||
productId?: number;
|
||||
|
||||
@@ -155,7 +155,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
component: {
|
||||
name: DurationValue,
|
||||
vModel: "modelValue"
|
||||
}
|
||||
},
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
amount: {
|
||||
@@ -182,7 +183,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
]
|
||||
}),
|
||||
column: {
|
||||
width: 100
|
||||
width: 100,
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
payType: {
|
||||
@@ -193,14 +195,16 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
data: [
|
||||
{ label: "聚合支付", value: "yizhifu" },
|
||||
{ label: "支付宝", value: "alipay" },
|
||||
{ label: "微信", value: "wxpay" }
|
||||
{ label: "微信", value: "wxpay" },
|
||||
{ label: "免费", value: "free" }
|
||||
]
|
||||
}),
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
color: "auto"
|
||||
}
|
||||
},
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
payTime: {
|
||||
|
||||
@@ -1,62 +1,65 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
export function createApi() {
|
||||
const apiPrefix = "/sys/suite/user-suite";
|
||||
return {
|
||||
async GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
});
|
||||
},
|
||||
const apiPrefix = "/sys/suite/user-suite";
|
||||
export const sysUserSuiteApi = {
|
||||
async GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
});
|
||||
},
|
||||
|
||||
async AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
async AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
|
||||
async UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
async UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
|
||||
async DelObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
async DelObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
|
||||
async GetObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
async ListAll() {
|
||||
return await request({
|
||||
url: apiPrefix + "/all",
|
||||
method: "post"
|
||||
});
|
||||
},
|
||||
async GetObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
async ListAll() {
|
||||
return await request({
|
||||
url: apiPrefix + "/all",
|
||||
method: "post"
|
||||
});
|
||||
},
|
||||
|
||||
async GetSimpleUserByIds(ids: number[]) {
|
||||
return await request({
|
||||
url: "/sys/authority/user/getSimpleUserByIds",
|
||||
method: "post",
|
||||
data: { ids }
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const pipelineGroupApi = createApi();
|
||||
async GetSimpleUserByIds(ids: number[]) {
|
||||
return await request({
|
||||
url: "/sys/authority/user/getSimpleUserByIds",
|
||||
method: "post",
|
||||
data: { ids }
|
||||
});
|
||||
},
|
||||
async PresentSuite(form: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/presentSuite",
|
||||
method: "post",
|
||||
data: form
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { pipelineGroupApi } from "./api";
|
||||
import { sysUserSuiteApi } from "./api";
|
||||
import { useRouter } from "vue-router";
|
||||
import SuiteValueEdit from "/@/views/sys/suite/product/suite-value-edit.vue";
|
||||
import SuiteValue from "/@/views/sys/suite/product/suite-value.vue";
|
||||
import DurationValue from "/@/views/sys/suite/product/duration-value.vue";
|
||||
import dayjs from "dayjs";
|
||||
import createCrudOptionsUser from "/@/views/sys/authority/user/crud";
|
||||
import UserSuiteStatus from "/@/views/certd/suite/mine/user-suite-status.vue";
|
||||
|
||||
import SuiteDurationSelector from "../setting/suite-duration-selector.vue";
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const api = pipelineGroupApi;
|
||||
const api = sysUserSuiteApi;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
@@ -26,7 +25,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
|
||||
const addRequest = async (req: AddReq) => {
|
||||
const { form } = req;
|
||||
const res = await api.AddObj(form);
|
||||
const res = await api.PresentSuite(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -57,16 +56,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
actionbar: {
|
||||
buttons: {
|
||||
add: { show: false }
|
||||
// buy: {
|
||||
// text: "购买",
|
||||
// type: "primary",
|
||||
// click() {
|
||||
// router.push({
|
||||
// path: "/certd/suite/buy"
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
add: { text: "赠送套餐" }
|
||||
}
|
||||
},
|
||||
toolbar: { show: false },
|
||||
@@ -112,7 +102,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: true
|
||||
},
|
||||
form: {
|
||||
rules: [{ required: true, message: "此项必填" }]
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 200
|
||||
@@ -143,6 +133,27 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
}
|
||||
}
|
||||
},
|
||||
//赠送
|
||||
presentSuiteId: {
|
||||
title: "赠送套餐",
|
||||
type: "dict-select",
|
||||
column: { show: false },
|
||||
addForm: {
|
||||
component: {
|
||||
name: SuiteDurationSelector,
|
||||
vModel: "modelValue"
|
||||
},
|
||||
rules: [{ required: true, message: "请选择套餐" }]
|
||||
},
|
||||
valueResolve({ form, value }) {
|
||||
if (value) {
|
||||
const arr = value.splict("_");
|
||||
form.productId = parseInt(arr[0]);
|
||||
form.duration = parseInt(arr[1]);
|
||||
}
|
||||
},
|
||||
form: { show: false }
|
||||
},
|
||||
productType: {
|
||||
title: "类型",
|
||||
type: "dict-select",
|
||||
@@ -158,7 +169,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
rules: [{ required: true, message: "此项必填" }]
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 80,
|
||||
@@ -179,6 +190,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
title: "域名数量",
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxDomainCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
@@ -201,6 +213,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
title: "流水线数量",
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxPipelineCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
@@ -223,6 +236,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
title: "部署次数",
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxDeployCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
@@ -248,6 +262,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
title: "证书监控数量",
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxMonitorCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
@@ -269,7 +284,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
duration: {
|
||||
title: "时长",
|
||||
type: "text",
|
||||
form: {},
|
||||
form: { show: false },
|
||||
column: {
|
||||
component: {
|
||||
name: DurationValue,
|
||||
@@ -304,11 +319,17 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "date",
|
||||
column: {
|
||||
width: 150
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
expiresTime: {
|
||||
title: "过期时间",
|
||||
type: "date",
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 150,
|
||||
component: {
|
||||
@@ -328,7 +349,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
value: true
|
||||
value: true,
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineComponent, onActivated, onMounted } from "vue";
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { createApi } from "./api";
|
||||
|
||||
defineOptions({
|
||||
name: "UserSuites"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user