修复超粉价格设置

This commit is contained in:
al 2024-11-05 17:53:13 +08:00
parent adc47c4b26
commit 20537b9f59
2 changed files with 33 additions and 10 deletions

View File

@ -96,7 +96,7 @@ const ListItemWithCheckbox = ({
</div> </div>
<div className="flex items-center"> <div className="flex items-center">
<span className="text-[#ffffff26] mr-2">|</span> <span className="text-[#ffffff26] mr-2">|</span>
<Radio <Checkbox
block block
checked={formData.superSingle[superSingle.key].wechatFree} checked={formData.superSingle[superSingle.key].wechatFree}
onChange={(value) => { onChange={(value) => {
@ -106,7 +106,7 @@ const ListItemWithCheckbox = ({
}} }}
> >
<p className="text-sm whitespace-nowrap">赠送微信</p> <p className="text-sm whitespace-nowrap">赠送微信</p>
</Radio> </Checkbox>
{/* <Checkbox {/* <Checkbox
block block
checked={formData.superSingle[superSingle.key].wechatFree} checked={formData.superSingle[superSingle.key].wechatFree}
@ -288,12 +288,21 @@ export default function CreateProfile() {
} }
} }
if (isPrice) return; if (isPrice) return;
const superfan_price_list = superSingle.map((it, index) => ({ //
const superfanList = superSingle.map((it, index) => ({
period: index, period: index,
enable: it.enable ? 1 : 0, enable: it.enable ? 1 : 0,
price: parseInt(it.price * 100, 10), price: parseInt(it.price * 100, 10),
is_superfanship_give_wechat: it.wechatFree ? 1 : 0, is_superfanship_give_wechat: it.wechatFree ? 1 : 0,
})); }));
const superfanObj = superfanList.filter((it) => it.enable)[0];
//
// const superfan_price_list = superSingle.map((it, index) => ({
// period: index,
// enable: it.enable ? 1 : 0,
// price: parseInt(it.price * 100, 10),
// is_superfanship_give_wechat: it.wechatFree ? 1 : 0,
// }));
setIsSubmitting(true); setIsSubmitting(true);
try { try {
const body = { const body = {
@ -301,7 +310,14 @@ export default function CreateProfile() {
admission_price: parseInt(spacePrice * 100, 10), admission_price: parseInt(spacePrice * 100, 10),
ironfanship_price: parseInt(ironFanPrice * 100, 10), ironfanship_price: parseInt(ironFanPrice * 100, 10),
is_superfanship_enabled: openSuper ? 1 : 0, is_superfanship_enabled: openSuper ? 1 : 0,
superfan_price_list, //
superfanship_price: openSuper ? superfanObj.price : 0,
superfanship_valid_period: openSuper ? superfanObj.period : null,
is_superfanship_give_wechat: openSuper
? superfanObj.is_superfanship_give_wechat
: 0,
//
// superfan_price_list,
}; };
const _data = await requireAPI( const _data = await requireAPI(
"POST", "POST",

View File

@ -11,11 +11,18 @@ import { get } from "@/utils/storeInfo";
import { getStreamerInfo } from "@/api/space"; import { getStreamerInfo } from "@/api/space";
const superSingles = [ const superSingles = [
{ key: 0, text: "永久" }, { key: 0, text: "永久" },
{ key: 1, text: "按生效" }, { key: 1, text: "按生效" },
{ key: 2, text: "按半年生效" }, { key: 2, text: "按季度生效" },
{ key: 3, text: "按季度生效" }, { key: 3, text: "按半年生效" },
{ key: 4, text: "按生效" }, { key: 4, text: "按生效" },
]; ];
// const superSingles = [
// { key: 0, text: "" },
// { key: 1, text: "" },
// { key: 2, text: "" },
// { key: 3, text: "" },
// { key: 4, text: "" },
// ];
const ListItemWithCheckbox = ({ const ListItemWithCheckbox = ({
superSingle, superSingle,
formData, formData,
@ -87,7 +94,7 @@ const ListItemWithCheckbox = ({
</div> </div>
<div className="flex items-center"> <div className="flex items-center">
<span className="text-[#ffffff26] mr-2">|</span> <span className="text-[#ffffff26] mr-2">|</span>
<Radio <Checkbox
block block
checked={formData.superSingle[superSingle.key].wechatFree} checked={formData.superSingle[superSingle.key].wechatFree}
onChange={(value) => { onChange={(value) => {
@ -97,7 +104,7 @@ const ListItemWithCheckbox = ({
}} }}
> >
<p className="text-sm whitespace-nowrap">赠送微信</p> <p className="text-sm whitespace-nowrap">赠送微信</p>
</Radio> </Checkbox>
{/* <Checkbox {/* <Checkbox
block block
checked={formData.superSingle[superSingle.key].wechatFree} checked={formData.superSingle[superSingle.key].wechatFree}