1) 修复key批次新建不能选择对象绑定

This commit is contained in:
zhangds 2022-09-26 16:55:27 +08:00
parent 49ac172d38
commit aafce8ea5d
3 changed files with 535 additions and 503 deletions

View File

@ -225,6 +225,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
sessionStorage.setItem("keyType", 2); sessionStorage.setItem("keyType", 2);
// 1.1 // 1.1
await getPlanList().then((arr) => { await getPlanList().then((arr) => {
console.log("arr =>1", arr);
// 1.2 // 1.2
if (editData && editData !== "") { if (editData && editData !== "") {
setState({ isEdit: true }); setState({ isEdit: true });
@ -232,7 +233,11 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
let plan_row = arr.find( let plan_row = arr.find(
(item) => item.text === editData.plan_title (item) => item.text === editData.plan_title
); );
if (plan_row) { if (
plan_row &&
plan_row !== undefined &&
plan_row !== "undefined"
) {
setForm_info_data({ setForm_info_data({
plan_id: plan_row, plan_id: plan_row,
}); });
@ -240,7 +245,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
setState({ setState({
direct_reseller_id: plan_row.key.reseller_id, direct_reseller_id: plan_row.key.reseller_id,
}); });
}
// 1.5 key // 1.5 key
getKey(plan_row.key.key).then((arr_key) => { getKey(plan_row.key.key).then((arr_key) => {
let el_key = arr_key.find( let el_key = arr_key.find(
@ -250,6 +254,8 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
setForm_info_data({ key_batch_id: el_key }); setForm_info_data({ key_batch_id: el_key });
} }
}); });
}
// 1.6 // 1.6
editFun(); editFun();
@ -559,7 +565,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
(item) => !item.checked && (item.goods_id || item.only.goods_id) (item) => !item.checked && (item.goods_id || item.only.goods_id)
) )
.map((item) => { .map((item) => {
console.log("item =>", item);
if (item.type === 1) { if (item.type === 1) {
return item.goods_id; return item.goods_id;
} else { } else {
@ -799,7 +804,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
table_index: index, table_index: index,
}); });
} else { } else {
console.log("rowData =>", rowData);
setState({ setState({
product_title: "编辑商品", product_title: "编辑商品",
productData: rowData, productData: rowData,

View File

@ -127,7 +127,9 @@ export default class acclist extends React.Component {
product_title: "新建商品", product_title: "新建商品",
addIsType: "", addIsType: "",
keyCodeId: "", //key批次ID keyCodeId: "", //key批次ID
keyType: 1, keyType: sessionStorage.getItem("isKeyAdd")
? Number(sessionStorage.getItem("isKeyAdd"))
: 1,
couponData: [], couponData: [],
Column: [ Column: [
{ {
@ -1554,7 +1556,11 @@ export default class acclist extends React.Component {
<FormItem labelname="绑定类型" prop="bind_object" id="bind_object"> <FormItem labelname="绑定类型" prop="bind_object" id="bind_object">
<Radio.Group <Radio.Group
value={this.state.keyType} value={this.state.keyType}
disabled={this.state.isEdit} disabled={
this.state.isEdit || sessionStorage.getItem("isKeyAdd")
? true
: false
}
onChange={(e) => { onChange={(e) => {
this.onCheckChange(e); this.onCheckChange(e);
}} }}

File diff suppressed because it is too large Load Diff