anln_1.3 #23

Closed
yezian wants to merge 3 commits from anln_1.3 into main
3 changed files with 869 additions and 145 deletions

View File

@ -52,6 +52,8 @@ const BlockUserContent = (props) => {
<p>{data === 5 && "主播发现隐藏"}</p>
<p>{data === 6 && "主播广场隐藏"}</p>
<p>{data === 7 && "禁止付款"}</p>
<p>{data === 8 && "试运营限制广场发帖"}</p>
<p>{data === 9 && "试运营主播发现隐藏"}</p>
</div>
),
},
@ -402,6 +404,8 @@ const BlockUserContent = (props) => {
<option value={5}>主播发现隐藏</option>
<option value={6}>主播广场隐藏</option>
<option value={7}>禁止付款</option>
<option value={8}>试运营限制广场发帖</option>
<option value={9}>试运营主播发现隐藏</option>
</select>
</Form.Item>
<Form.Item

View File

@ -0,0 +1,445 @@
import React, {
useContext,
useEffect,
useRef,
useState,
useCallback,
useMemo,
} from "react";
import { Button, Form, Input, Popconfirm, Table, Select, message } from "antd";
import baseRequest from "../../../../utils/baseRequest";
const EditableContext = React.createContext(null);
const EditableRow = ({ index, ...props }) => {
const [form] = Form.useForm();
const handleCheck = () => {
return true;
};
return (
<Form form={form} component={false} onFinish={handleCheck}>
<EditableContext.Provider value={form}>
<tr {...props} />
</EditableContext.Provider>
</Form>
);
};
const EditableCell = ({
title,
editable,
children,
dataIndex,
record,
zone_third_partner_sharing_ratio,
handleSave,
handleSetEditable,
handleDelete,
handleSubmit,
currentSharingRatioTotal,
...restProps
}) => {
const [editing, setEditing] = useState(false);
const inputRef = useRef(null);
const form = useContext(EditableContext);
useEffect(() => {
setEditing(record?.editable || !record?.id);
if (record?.editable || !record?.id) {
form.setFieldsValue({
collaborator_user_id: record?.["collaborator_user_id"],
sharing_ratio: record?.["sharing_ratio"],
});
}
}, [record, form]);
const save = async () => {
try {
const values = await form.validateFields();
// toggleEdit();
handleSave({
...record,
...values,
});
} catch (errInfo) {
console.log("Save failed:", errInfo);
}
};
let childNode = children;
childNode =
dataIndex === "operation" ? (
<>
<>
{record?.id ? (
<>
{!editing ? (
<Button
type="text"
onClick={() => handleSetEditable(record.key)}
>
<span className="text-blue-400">编辑</span>
</Button>
) : (
<Button
type="primary"
onClick={() => handleSubmit(record, "update")}
>
确定
</Button>
)}
</>
) : (
<Button
type="primary"
onClick={async () => {
form
.validateFields()
.then((values) => {
handleSubmit({ ...values, key: record.key }, "create");
})
.catch((errorInfo) => {
console.log("Failed:", errorInfo);
});
// debugger;
}}
>
<span>创建</span>
</Button>
)}
</>
{record?.id && (
<Popconfirm
title="确定要删除吗?"
okText="确定"
cancelText="取消"
onConfirm={() => handleDelete(record.id)}
>
<Button type="text">
<span className="text-red-400">删除</span>
</Button>
</Popconfirm>
)}
</>
) : editing && record?.key !== undefined ? (
<Form.Item
style={{ margin: 0 }}
name={dataIndex}
rules={[{ required: true, message: `${title} 是必填的.` }]}
>
{dataIndex === "collaborator_user_id" ? (
<Input
ref={inputRef}
// onPressEnter={save}
onBlur={save}
placeholder="请输入ID"
allowClear
disabled={record?.id}
/>
) : (
<Select
ref={inputRef}
// onPressEnter={save}
onBlur={save}
placeholder="请选择分成比例"
>
{
// 分成比例
Array.from(
{
length:
zone_third_partner_sharing_ratio * 100 -
currentSharingRatioTotal * 100,
},
(_, index) => (
<Select.Option
key={index}
value={parseFloat(((index + 1) / 100).toFixed(2))}
>
{`${index + 1} %`}
</Select.Option>
)
)
}
</Select>
)}
</Form.Item>
) : (
<div
className="editable-cell-value-wrap"
style={{ paddingInlineEnd: 24 }}
// onClick={toggleEdit}
>
{dataIndex === "sharing_ratio"
? `${
record[dataIndex] &&
parseFloat((record[dataIndex] * 100)?.toPrecision(2))
}%`
: children}
</div>
);
return <td {...restProps}>{childNode}</td>;
};
const PartnerComponent = ({
getDataSource,
zid,
visitor_role,
zone_third_partner_sharing_ratio,
}) => {
const [dataSource, setDataSource] = useState([]);
const [count, setCount] = useState(0);
useEffect(() => {
getDataSource(dataSource);
}, [dataSource]);
useEffect(() => {
getData();
}, []);
const getData = async (changedId, type, changeKey) => {
try {
const base = baseRequest();
const detailResponse = await fetch(`/op/zone_collaborator/list`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
zid,
visitor_role,
...base,
}),
});
const detailData = await detailResponse.json();
if (detailData.ret === -1) {
alert(detailData.msg);
return;
}
setCount(detailData.data.offset);
setDataSource((prev) => {
if (!prev.length) {
return detailData.data.list.map(
({ collaborator_account, sharing_ratio, id }, index) => {
return {
collaborator_user_id: collaborator_account.user_id,
sharing_ratio,
id,
editable: false,
key: index,
};
}
);
}
const changedItem = detailData.data.list.find((item) => {
if (type === "create") {
return item.collaborator_account.user_id === changedId;
}
return item.id === changedId;
});
// debugger;
if (type === "create") {
return prev.map((item, index) => {
return item.key === changeKey
? {
collaborator_user_id:
changedItem?.collaborator_account.user_id,
sharing_ratio: changedItem?.sharing_ratio,
id: changedItem?.id,
editable: false,
key: index,
}
: item;
});
}
if (!changedItem && changedId) {
return prev.filter((item) => item.id !== changedId);
}
return prev.map((item, index) => {
return item.id === changedId && changedItem
? {
collaborator_user_id: changedItem?.collaborator_account.user_id,
sharing_ratio: changedItem?.sharing_ratio,
id: changedItem?.id,
editable: false,
key: index,
}
: item;
});
});
} catch (error) {
console.error(error);
}
};
const handleDelete = useCallback(async (id) => {
try {
const base = baseRequest();
const detailResponse = await fetch(`/op/zone_collaborator/delete`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
id,
...base,
}),
});
const detailData = await detailResponse.json();
if (detailData.ret === -1) {
alert(detailData.msg);
return;
}
message.success("删除成功");
getData(id);
} catch (error) {
console.error(error);
}
}, []);
const handleSetEditable = (key) => {
const newData = dataSource.map((item) => {
return { ...item, editable: item.key === key ? true : item.editable };
});
setDataSource(newData);
};
const handleSubmit = async (data, type) => {
// 创建接口要改,不能上传数组,因为更新是单条
try {
const base = baseRequest();
const baseBody =
type === "create"
? {
collaborator_user_id: parseInt(data.collaborator_user_id),
}
: { id: data.id };
const detailResponse = await fetch(
`/op/zone_collaborator/${type === "create" ? "create" : "update"}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...baseBody,
zid,
sharing_ratio: data.sharing_ratio,
...base,
}),
}
);
const detailData = await detailResponse.json();
if (detailData.ret === -1) {
alert(detailData.msg);
return;
}
message.success("提交成功");
await getData(
type === "create" ? parseInt(data.collaborator_user_id) : data.id,
type,
data.key
);
} catch (error) {
console.error(error);
}
};
const [defaultColumns] = useState([
{
title: "ID",
dataIndex: "collaborator_user_id",
editable: false,
},
{
title: "合伙人分成比例",
dataIndex: "sharing_ratio",
editable: false,
width: 160,
},
{
title: "操作",
dataIndex: "operation",
width: 160,
editable: false,
},
]);
const handleAdd = (newKey) => {
const newData = {
key: newKey,
collaborator_user_id: "",
sharing_ratio: "",
editable: false,
};
// debugger;
setDataSource((pre) => [...pre, newData]);
setCount(newKey + 1);
};
const handleSave = useCallback(
(row) => {
const newData = [...dataSource];
const index = newData.findIndex((item) => row.key === item.key);
const item = newData[index];
newData.splice(index, 1, {
...item,
...row,
});
setDataSource(newData);
},
[dataSource]
);
const components = {
body: {
row: EditableRow,
cell: EditableCell,
},
};
const columns = useMemo(() => {
const newColumns = defaultColumns.map((col) => {
// if (!col.editable) {
// return col;
// }
return {
...col,
onCell: (record) => ({
record,
editable: col.editable,
dataIndex: col.dataIndex,
title: col.title,
with: col.width,
currentSharingRatioTotal: dataSource.reduce(
(total, item) =>
total + (item.key === record.key ? 0 : item.sharing_ratio),
0
),
zone_third_partner_sharing_ratio,
handleSave,
handleSetEditable,
handleDelete,
handleSubmit,
}),
};
});
return newColumns;
}, [
defaultColumns,
handleSave,
handleDelete,
handleSetEditable,
handleSubmit,
]);
return (
<div>
<Button
onClick={() => handleAdd(count)}
type="primary"
style={{
marginBottom: 16,
}}
>
添加合伙人
</Button>
<Table
components={components}
rowClassName={() => "editable-row"}
bordered
dataSource={dataSource}
columns={columns}
pagination={{
pageSize: 5,
total: count,
}}
/>
</div>
);
};
export default PartnerComponent;

View File

@ -13,11 +13,14 @@ import {
} from "antd";
import baseRequest from "../../utils/baseRequest";
import { useNavigate } from "react-router-dom";
import PartnerComponent from "./components/PartnerComponent";
//tab
const StreamerSpaceContent = () => {
const navigate = useNavigate();
const { TextArea } = Input;
const [superSingles, setSuperSingles] = useState([]);
//
const [partners, setPartners] = useState([]);
//
const [showColumns, setShowColumns] = useState([
"baseInfo",
@ -26,6 +29,8 @@ const StreamerSpaceContent = () => {
"active",
"ratio",
]);
//
const [searchForm] = Form.useForm();
//
const dynamicColumns = showColumns.map((item) => {
switch (item) {
@ -73,43 +78,38 @@ const StreamerSpaceContent = () => {
<p>
是否开启超粉功能
<span className="text-red-400">
{data.is_superfanship_enabled === 1 ? "是" : "否"}
{data.is_superfanship_enabled === "1" ? "是" : "否"}
</span>
</p>
{data.is_superfanship_enabled === 1 && (
<>
<p>
超粉价格
<span className="text-red-400">
¥{data.superfanship_price}
<hr />
{data.is_superfanship_enabled === "1" &&
data?.superPriceList?.map((item, index) => (
<p key={index}>
{item.period === 4
? "年度超粉"
: item.period === 3
? "半年度超粉"
: item.period === 2
? "一季度超粉"
: item.period === 1
? "一个月超粉"
: "永久超粉"}
<span
className={
item.enable === "1" ? "text-green-400" : "text-red-400"
}
>
{item.enable === "1" ? "开启" : "关闭"}
</span>
</p>
<p>
超粉有效期
{data.superfanship_valid_period === 0 && (
<span className="text-red-400">永久</span>
)}
{data.superfanship_valid_period === 1 && (
<span className="text-red-400">月度</span>
)}
{data.superfanship_valid_period === 2 && (
<span className="text-red-400">季度</span>
)}
{data.superfanship_valid_period === 3 && (
<span className="text-red-400">半年</span>
)}
{data.superfanship_valid_period === 4 && (
<span className="text-red-400">年度</span>
{item.enable === "1" && (
<span className="text-red-400">
¥{item.price}
{item.is_superfanship_give_wechat === "1" &&
",赠送微信"}
</span>
)}
</p>
<p>
开通超粉是否送微信
<span className="text-red-400">
{data.is_superfanship_give_wechat === 1 ? "是" : "否"}
</span>
</p>
</>
)}
))}
</div>
),
};
@ -228,6 +228,14 @@ const StreamerSpaceContent = () => {
添加代运营
</Button>
)}
{record.ratio.zone_third_partner?.third_partner_account?.mid && (
<Button
type="primary"
onClick={() => handlePartnersModal(record)}
>
编辑合伙人
</Button>
)}
<Button
onClick={() =>
navigate(`/editSpacePost?user_id=${record.baseInfo.id}`)
@ -300,14 +308,26 @@ const StreamerSpaceContent = () => {
ct: new Date(zone.ct * 1000).toLocaleString(),
},
profile: zone.profile,
paymentSettings: {
admission_price: zone.admission_price / 100,
ironfanship_price: zone.ironfanship_price / 100,
is_superfanship_enabled: zone.is_superfanship_enabled,
superfanship_price: zone.superfanship_price / 100,
superfanship_valid_period: zone.superfanship_valid_period,
is_superfanship_give_wechat: zone.is_superfanship_give_wechat,
},
paymentSettings:
// {
// admission_price: zone.admission_price / 100,
// ironfanship_price: zone.ironfanship_price / 100,
// is_superfanship_enabled: zone.is_superfanship_enabled,
// superfanship_price: zone.superfanship_price / 100,
// superfanship_valid_period: zone.superfanship_valid_period,
// is_superfanship_give_wechat: zone.is_superfanship_give_wechat,
// },
{
superPriceList: zone.superfan_price_list?.map((item) => ({
...item,
price: item.price / 100,
enable: `${item.enable}`,
is_superfanship_give_wechat: `${item.is_superfanship_give_wechat}`,
})),
admission_price: zone.admission_price / 100,
ironfanship_price: zone.ironfanship_price / 100,
is_superfanship_enabled: `${zone.is_superfanship_enabled}`,
},
active: {
zone_moment_count: zone.zone_moment_count,
image_count: zone.image_count,
@ -345,7 +365,7 @@ const StreamerSpaceContent = () => {
},
body: JSON.stringify({
offset: 0,
limit: 2000,
limit: 100,
...base,
}),
});
@ -365,14 +385,26 @@ const StreamerSpaceContent = () => {
ct: new Date(item.ct * 1000).toLocaleString(),
},
profile: item.profile,
paymentSettings: {
admission_price: item.admission_price / 100,
ironfanship_price: item.ironfanship_price / 100,
is_superfanship_enabled: item.is_superfanship_enabled,
superfanship_price: item.superfanship_price / 100,
superfanship_valid_period: item.superfanship_valid_period,
is_superfanship_give_wechat: item.is_superfanship_give_wechat,
},
paymentSettings:
// {
// admission_price: item.admission_price / 100,
// ironfanship_price: item.ironfanship_price / 100,
// is_superfanship_enabled: item.is_superfanship_enabled,
// superfanship_price: item.superfanship_price / 100,
// superfanship_valid_period: item.superfanship_valid_period,
// is_superfanship_give_wechat: item.is_superfanship_give_wechat,
// },
{
superPriceList: item.superfan_price_list?.map((item) => ({
...item,
price: item.price / 100,
enable: `${item.enable}`,
is_superfanship_give_wechat: `${item.is_superfanship_give_wechat}`,
})),
admission_price: item.admission_price / 100,
ironfanship_price: item.ironfanship_price / 100,
is_superfanship_enabled: `${item.is_superfanship_enabled}`,
},
active: {
zone_moment_count: item.zone_moment_count,
image_count: item.image_count,
@ -403,9 +435,10 @@ const StreamerSpaceContent = () => {
const [isModalOpen, setIsModalOpen] = useState(false);
//modal
const handleCancel = () => {
setShowData([]);
// setShowData([]);
setDefaultValues({});
setIsModalOpen(false);
setSuperSingles([]);
};
//modal
const [defaultValues, setDefaultValues] = useState({});
@ -413,6 +446,68 @@ const StreamerSpaceContent = () => {
const handleModal = (record) => {
setDefaultValues(record);
setIsModalOpen(true);
const superList = [
{
period: "0",
text: "永久超粉",
enable: "0",
price: 0,
is_superfanship_give_wechat: "0",
},
{
period: "1",
text: "一个月超粉",
enable: "0",
price: 0,
is_superfanship_give_wechat: "0",
},
{
period: "2",
text: "一季度超粉",
enable: "0",
price: 0,
is_superfanship_give_wechat: "0",
},
{
period: "3",
text: "半年度超粉",
enable: "0",
price: 0,
is_superfanship_give_wechat: "0",
},
{
period: "4",
text: "年度超粉",
enable: "0",
price: 0,
is_superfanship_give_wechat: "0",
},
];
if (record.paymentSettings?.superPriceList.length > 0) {
setSuperSingles(
record.paymentSettings?.superPriceList.map((item) => {
return {
period: item.period.toString(),
text:
item.period === 4
? "年度超粉"
: item.period === 3
? "半年度超粉"
: item.period === 2
? "一季度超粉"
: item.period === 1
? "一个月超粉"
: "永久超粉",
enable: item.enable.toString(),
price: item.price,
is_superfanship_give_wechat:
item.is_superfanship_give_wechat.toString(),
};
})
);
} else {
setSuperSingles(superList);
}
};
//
const onModalFormFinish = async (value) => {
@ -426,15 +521,15 @@ const StreamerSpaceContent = () => {
alert("请完善表单信息");
return;
}
if (
parseInt(value.is_superfanship_enabled) === 1 &&
(!value.superfanship_price?.toString() ||
!value.superfanship_valid_period?.toString() ||
!value.is_superfanship_give_wechat?.toString())
) {
alert("请完善表单信息");
return;
}
// if (
// parseInt(value.is_superfanship_enabled) === 1 &&
// (!value.superfanship_price?.toString() ||
// !value.superfanship_valid_period?.toString() ||
// !value.is_superfanship_give_wechat?.toString())
// ) {
// alert("");
// return;
// }
const _spacePrice = parseInt(value.admission_price * 100, 10);
if (isNaN(_spacePrice) || _spacePrice < 0) {
alert("请输入有效的解锁空间价格");
@ -445,19 +540,52 @@ const StreamerSpaceContent = () => {
alert("请输入有效的铁粉价格");
return;
}
const _superFanPrice = parseInt(value.superfanship_price * 100, 10);
if (
parseInt(value.is_superfanship_enabled) === 1 &&
(isNaN(_superFanPrice) || _superFanPrice < 100 || _superFanPrice > 388800)
) {
alert("请输入有效的超粉价格");
return;
// const _superFanPrice = parseInt(value.superfanship_price * 100, 10);
// if (
// parseInt(value.is_superfanship_enabled) === 1 &&
// (isNaN(_superFanPrice) || _superFanPrice < 100 || _superFanPrice > 388800)
// ) {
// alert("");
// return;
// }
// if (
// parseInt(value.is_superfanship_enabled) === 1 &&
// _superFanPrice <= _ironFanPrice
// ) {
// alert("");
// return;
// }
const superPriceList = superSingles.map((item) => {
return {
period: parseInt(item.period), // int, 0:
enable: parseInt(item.enable), // int, 1:, 0:
price: parseInt(value[`superPrice${item.period}`] * 100, 10),
is_superfanship_give_wechat: parseInt(
value[`isSuperfanshipGiveWechat${item.period}`]
),
};
});
//
let pass = true;
if (value.is_superfanship_enabled === "1") {
superPriceList.forEach((item) => {
if (!pass) {
return;
}
if (item.enable && item.price <= _ironFanPrice) {
alert("请输入大于铁粉价格的超粉价格");
pass = false;
return;
}
});
}
if (
parseInt(value.is_superfanship_enabled) === 1 &&
_superFanPrice <= _ironFanPrice
) {
alert("请输入大于铁粉价格的超粉价格");
if (!pass) return;
const allClose = superPriceList.every((item) => {
return item.enable === 0;
});
if (allClose) {
alert("请至少开启一个超粉价格");
return;
}
try {
@ -473,15 +601,16 @@ const StreamerSpaceContent = () => {
admission_price: parseInt(value.admission_price * 100, 10),
ironfanship_price: parseInt(value.ironfanship_price * 100, 10),
is_superfanship_enabled: parseInt(value.is_superfanship_enabled),
superfanship_price: parseInt(value.superfanship_price * 100, 10),
superfanship_valid_period: parseInt(
value.superfanship_valid_period,
10
),
is_superfanship_give_wechat: parseInt(
value.is_superfanship_give_wechat,
10
),
// superfanship_price: parseInt(value.superfanship_price * 100, 10),
// superfanship_valid_period: parseInt(
// value.superfanship_valid_period,
// 10
// ),
// is_superfanship_give_wechat: parseInt(
// value.is_superfanship_give_wechat,
// 10
// ),
superfan_price_list: superPriceList,
...base,
}),
});
@ -490,11 +619,17 @@ const StreamerSpaceContent = () => {
alert(detailData.msg);
return;
}
const searchValue = searchForm.getFieldsValue();
if (searchValue.id) {
search(searchValue);
} else {
getAllSpace();
}
} catch (error) {
console.error(error);
}
//
setShowData([]);
// setShowData([]);
setDefaultValues({});
setIsModalOpen(false);
};
@ -561,13 +696,19 @@ const StreamerSpaceContent = () => {
console.error(error);
}
//
setShowData([]);
// setShowData([]);
setDefaultValues({});
setIsAddAgencyModalOpen(false);
const searchValue = searchForm.getFieldsValue();
if (searchValue.id) {
search(searchValue);
} else {
getAllSpace();
}
};
//Modal
const handleAddAgencyModalCancel = () => {
setShowData([]);
// setShowData([]);
setIsAddAgencyModalOpen(false);
};
//modal
@ -596,8 +737,11 @@ const StreamerSpaceContent = () => {
console.error(error);
}
};
//
const [selectedUser, setSelectedUser] = useState();
//
const [selectedPartners, setSelectedPartners] = useState([]);
const handleSelected = () => {
if (selectedUser) {
setSelectedUser();
@ -617,6 +761,8 @@ const StreamerSpaceContent = () => {
//Modal
const [isAgencyModalOpen, setIsAgencyModalOpen] = useState(false);
//Modal
const [isPartnerModalOpen, setPartnersModalOpen] = useState(false);
//
const handleAgencyModal = (record) => {
setDefaultValues(record);
@ -624,6 +770,11 @@ const StreamerSpaceContent = () => {
setSelectedUser();
setUserInfo();
};
//
const handlePartnersModal = (record) => {
setDefaultValues(record);
setPartnersModalOpen(true);
};
//
const handleSubmitAgencySetting = async (value) => {
if (!value.sharing_ratio?.toString() || !value.is_hided?.toString()) {
@ -673,13 +824,38 @@ const StreamerSpaceContent = () => {
alert(_data.msg);
return;
}
const _response2 = await fetch(`/op/zone_collaborator/create_batch`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
list: partners.map((item) => ({
zid: defaultValues.key,
collaborator_user_id: parseInt(item.collaborator_mid),
sharing_ratio: parseInt(item.sharing_ratio, 10) / 100,
})),
...base,
}),
});
const _data2 = await _response2.json();
if (_data2.ret === -1) {
alert(_data2.msg);
return;
}
} catch (error) {
console.error(error);
}
//
setShowData([]);
// setShowData([]);
setDefaultValues({});
setIsAgencyModalOpen(false);
const searchValue = searchForm.getFieldsValue();
if (searchValue.id) {
search(searchValue);
} else {
getAllSpace();
}
};
//
@ -703,19 +879,25 @@ const StreamerSpaceContent = () => {
}
message.success("删除成功");
//
setShowData([]);
// setShowData([]);
setDefaultValues({});
setIsAgencyModalOpen(false);
const searchValue = searchForm.getFieldsValue();
if (searchValue.id) {
search(searchValue);
} else {
getAllSpace();
}
} catch (error) {
console.error(error);
}
};
//Modal
const handleAgencyModalCancel = () => {
setShowData([]);
// setShowData([]);
setIsAgencyModalOpen(false);
};
const messageEle = (message) => <p className="text-right">{message}</p>;
return (
<div style={{ marginLeft: 20, marginRight: 20 }}>
<div style={{ marginTop: 20, marginBottom: 10 }}>
@ -726,7 +908,12 @@ const StreamerSpaceContent = () => {
onChange={(value) => setShowColumns(value)}
/>
</div>
<Form name="search" onFinish={search} onFinishFailed={onFinishFailed}>
<Form
form={searchForm}
name="search"
onFinish={search}
onFinishFailed={onFinishFailed}
>
<Space style={{ marginBottom: 20 }}>
<Form.Item label="ID" name="id" style={{ margin: 0 }}>
<Input />
@ -745,14 +932,19 @@ const StreamerSpaceContent = () => {
/>
{/* 编辑空间模态框是否显示 */}
{isModalOpen && (
<Modal footer={null} open={isModalOpen} onCancel={handleCancel}>
<Modal
style={{ minWidth: 600 }}
footer={null}
open={isModalOpen}
onCancel={handleCancel}
>
<Form
name="change"
onFinish={onModalFormFinish}
onFinishFailed={onModalFormFinishFailed}
autoComplete="off"
>
<div className="flex flex-col overflow-y-scroll">
<div className="flex flex-col">
<div className="flex flex-row mb-4">
<Image
width={80}
@ -833,63 +1025,114 @@ const StreamerSpaceContent = () => {
borderRadius: 4,
outline: "none",
}}
>
<option value={1}></option>
<option value={0}></option>
</select>
</Form.Item>
<Form.Item
name="superfanship_price"
label="超粉价格(元)"
initialValue={
defaultValues?.paymentSettings?.superfanship_price
}
>
<InputNumber min={0} />
</Form.Item>
<Form.Item
name="superfanship_valid_period"
label="超粉有效期"
initialValue={
defaultValues?.paymentSettings?.superfanship_valid_period
}
>
<select
style={{
height: 32,
padding: "4px 11px",
border: "1px solid #d9d9d9",
borderRadius: 4,
outline: "none",
onChange={(e) => {
setDefaultValues((prev) => {
return {
...prev,
paymentSettings: {
...prev.paymentSettings,
is_superfanship_enabled: e.target.value,
},
};
});
}}
>
<option value={0}>永久</option>
<option value={1}>月度</option>
<option value={2}>季度</option>
<option value={3}>半年</option>
<option value={4}>年度</option>
<option value="1"></option>
<option value="0"></option>
</select>
</Form.Item>
<Form.Item
name="is_superfanship_give_wechat"
label="开通超粉是否送微信"
initialValue={
defaultValues?.paymentSettings?.is_superfanship_give_wechat
}
<hr className="w-full m-0 border-red-500" />
<hr className="w-full mb-4 border-red-500" />
<div
style={{
display:
defaultValues?.paymentSettings
?.is_superfanship_enabled === "1"
? "block"
: "none",
}}
>
<select
style={{
height: 32,
padding: "4px 11px",
border: "1px solid #d9d9d9",
borderRadius: 4,
outline: "none",
}}
>
<option value={1}></option>
<option value={0}></option>
</select>
</Form.Item>
{superSingles.map((item) => (
<div className="flex gap-2" key={item.period}>
<Form.Item
name={"superPriceType" + item.period}
label={item.text}
initialValue={item?.enable}
>
<select
style={{
height: 32,
padding: "4px 11px",
border: "1px solid #d9d9d9",
borderRadius: 4,
outline: "none",
}}
onChange={(e) => {
setSuperSingles((prev) => {
return prev.map((it) => {
if (it.period === item.period) {
return {
...it,
enable: e.target.value,
};
}
return it;
});
});
}}
>
<option value="1">开启</option>
<option value="0">关闭</option>
</select>
</Form.Item>
<div
className="flex flex-nowrap gap-2"
style={{
display: item.enable === "1" ? "flex" : "none",
}}
>
<Form.Item
name={"superPrice" + item.period}
label="价格(元)"
initialValue={item?.price}
rules={[
{
required: true,
message: messageEle("请输入价格"),
},
]}
>
<InputNumber min={0} />
</Form.Item>
<Form.Item
name={"isSuperfanshipGiveWechat" + item.period}
label="赠送微信"
initialValue={item?.is_superfanship_give_wechat}
rules={[
{
required: true,
message: messageEle("请选择是否赠送微信"),
},
]}
>
<select
style={{
height: 32,
padding: "4px 11px",
border: "1px solid #d9d9d9",
borderRadius: 4,
outline: "none",
}}
>
<option value="1"></option>
<option value="0"></option>
</select>
</Form.Item>
</div>
</div>
))}
</div>
<Button type="primary" htmlType="submit">
确认
</Button>
@ -905,7 +1148,7 @@ const StreamerSpaceContent = () => {
open={isAddAgencyModalOpen}
onCancel={handleAddAgencyModalCancel}
>
<div className="flex flex-col overflow-y-scroll">
<div className="flex flex-col">
<div className="flex flex-row mb-4">
<Image
width={80}
@ -1036,8 +1279,10 @@ const StreamerSpaceContent = () => {
footer={null}
open={isAgencyModalOpen}
onCancel={handleAgencyModalCancel}
onClose={handleAgencyModalCancel}
style={{ minWidth: 600 }}
>
<div className="flex flex-col overflow-y-scroll">
<div className="flex flex-col">
<div className="flex flex-row mb-4">
<Image
width={80}
@ -1173,6 +1418,7 @@ const StreamerSpaceContent = () => {
<option value={0}></option>
</select>
</Form.Item>
<Button type="primary" htmlType="submit">
确认
</Button>
@ -1181,6 +1427,35 @@ const StreamerSpaceContent = () => {
</div>
</Modal>
)}
{/* 编辑合伙人Modal是否可见 */}
{isPartnerModalOpen && (
<Modal
footer={null}
open={isPartnerModalOpen}
onCancel={() => {
setPartnersModalOpen(false);
setDefaultValues({});
const searchValue = searchForm.getFieldsValue();
if (searchValue.id) {
search(searchValue);
} else {
getAllSpace();
}
}}
style={{ minWidth: 600 }}
>
<div className="flex flex-col">
<p className="mb-4">合伙人设置</p>
<PartnerComponent
getDataSource={setPartners}
zid={defaultValues?.key}
zone_third_partner_sharing_ratio={
defaultValues?.ratio?.zone_third_partner?.sharing_ratio
}
/>
</div>
</Modal>
)}
</div>
);
};