修改空间付费设置

This commit is contained in:
al 2024-11-05 16:43:23 +08:00
parent a898a097e2
commit adc47c4b26
2 changed files with 64 additions and 27 deletions

View File

@ -229,22 +229,22 @@ export default function EditSpacePost() {
</span>
<div className="mt-2 p-4 rounded-2xl bg-[#FFFFFF1A]">
{data.text_audit_opinion && (
<span className="text-sm font-medium text-white">
<p className="text-sm font-medium text-white">
<span className="text-[#F53030]">文案违规原因</span>
{data.text_audit_opinion}
</span>
</p>
)}
{data.image_audit_opinion && (
<span className="text-sm font-medium text-white">
<p className="text-sm font-medium text-white">
<span className="text-[#F53030]">图片/视频违规原因</span>
{data.image_audit_opinion}
</span>
</p>
)}
{data.manually_review_opinion && (
<span className="text-sm font-medium text-white">
<p className="text-sm font-medium text-white">
<span className="text-[#F53030]">运营追加</span>
{data.manually_review_opinion}
</span>
</p>
)}
</div>
</div>

View File

@ -138,29 +138,53 @@ export default function spacePaymentSetting() {
useEffect(() => {
const account = get("account");
getStreamerInfo(Number(account.mid)).then((res) => {
const haveChecked = res.superfan_price_list
.map((it, index) => ({ ...it, index }))
.filter((it) => it.enable);
if (haveChecked.length > 0) {
setSuperSingleChecked(haveChecked[0].period);
//
const haveChecked = res.is_superfanship_enabled;
if (haveChecked) {
setSuperSingleChecked(res.superfanship_valid_period);
}
const newFormData = {
spacePrice: res.admission_price / 100,
ironFanPrice: res.ironfanship_price / 100,
openSuper: !!res.is_superfanship_enabled,
superSingle: formData.superSingle.map((it, index) => {
if (index == res.superfanship_valid_period) {
return {
enable: !!res.is_superfanship_enabled,
price: res.superfanship_price / 100,
wechatFree: !!res.is_superfanship_give_wechat,
};
} else {
return it;
}
}),
spaceIntro: res.profile,
};
setFormData(newFormData);
//
// const haveChecked = res.superfan_price_list
// .map((it, index) => ({ ...it, index }))
// .filter((it) => it.enable);
// if (haveChecked.length > 0) {
// setSuperSingleChecked(haveChecked[0].period);
// }
// setSuperSingleCheckeds(
// res.superfan_price_list
// .map((it, index) => ({ ...it, index }))
// .filter((it) => it.enable)
// .map((it) => superSingles[it.index].key)
// );
setFormData({
spacePrice: res.admission_price / 100,
ironFanPrice: res.ironfanship_price / 100,
openSuper: !!res.is_superfanship_enabled,
superSingle: res.superfan_price_list.map((it) => ({
enable: !!it.enable,
price: it.price / 100,
wechatFree: !!it.is_superfanship_give_wechat,
})),
spaceIntro: res.profile,
});
// setFormData({
// spacePrice: res.admission_price / 100,
// ironFanPrice: res.ironfanship_price / 100,
// openSuper: !!res.is_superfanship_enabled,
// superSingle: res.superfan_price_list.map((it) => ({
// enable: !!it.enable,
// price: it.price / 100,
// wechatFree: !!it.is_superfanship_give_wechat,
// })),
// spaceIntro: res.profile,
// });
});
}, []);
const listItemWithCheckboxMemo = useMemo(() => {
@ -315,12 +339,21 @@ export default function spacePaymentSetting() {
// }
if (isSubmitting) return;
const superfan_price_list = superSingle.map((it, index) => ({
//
const superfanList = 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,
}));
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);
try {
const body = {
@ -328,10 +361,14 @@ export default function spacePaymentSetting() {
admission_price: parseInt(spacePrice * 100, 10),
ironfanship_price: parseInt(ironFanPrice * 100, 10),
is_superfanship_enabled: openSuper ? 1 : 0,
// superfanship_price: parseInt(superFanPrice * 100, 10),
// superfanship_valid_period: superFanExpiration,
// is_superfanship_give_wechat: unlockWechat ? 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,
};
// console.log("body", body);
const _data = await requireAPI(