|
@@ -87,19 +87,23 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
function getSelectGoods() {
|
|
function getSelectGoods() {
|
|
|
httpGet("/classification/allGoods", {
|
|
httpGet("/classification/allGoods", {
|
|
|
classificationId: selectId,
|
|
classificationId: selectId,
|
|
|
- }).then((res) => {
|
|
|
|
|
- setGoodsClass(res);
|
|
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ let list = res || [];
|
|
|
|
|
+ list = list.filter(item => {
|
|
|
|
|
+ return item != null;
|
|
|
|
|
+ });
|
|
|
|
|
+ setGoodsClass(list);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
function getAllGoods() {
|
|
function getAllGoods() {
|
|
|
- httpGet("/goods/my").then((res) => {
|
|
|
|
|
|
|
+ httpGet("/goods/my").then(res => {
|
|
|
changeGoods(res);
|
|
changeGoods(res);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const topGoods = React.useMemo(() => {
|
|
const topGoods = React.useMemo(() => {
|
|
|
if (pageType == "signboard") {
|
|
if (pageType == "signboard") {
|
|
|
- return goods.filter((item) => {
|
|
|
|
|
|
|
+ return goods.filter(item => {
|
|
|
return item.signboard;
|
|
return item.signboard;
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
@@ -109,14 +113,14 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
|
|
|
|
|
const elseGoods = React.useMemo(() => {
|
|
const elseGoods = React.useMemo(() => {
|
|
|
if (pageType === "signboard") {
|
|
if (pageType === "signboard") {
|
|
|
- return goods.filter((item) => {
|
|
|
|
|
|
|
+ return goods.filter(item => {
|
|
|
return !item.signboard;
|
|
return !item.signboard;
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- let _topIds = topGoods.map((item) => {
|
|
|
|
|
|
|
+ let _topIds = topGoods.map(item => {
|
|
|
return item.id;
|
|
return item.id;
|
|
|
});
|
|
});
|
|
|
- return goods.filter((item) => {
|
|
|
|
|
|
|
+ return goods.filter(item => {
|
|
|
return _topIds.indexOf(item.id) === -1;
|
|
return _topIds.indexOf(item.id) === -1;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -173,9 +177,9 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
signboard,
|
|
signboard,
|
|
|
},
|
|
},
|
|
|
{ body: "json" }
|
|
{ body: "json" }
|
|
|
- ).then((res) => {
|
|
|
|
|
|
|
+ ).then(res => {
|
|
|
success(tips + successText);
|
|
success(tips + successText);
|
|
|
- let _goods = goods.map((item) => {
|
|
|
|
|
|
|
+ let _goods = goods.map(item => {
|
|
|
if (item.id != id) {
|
|
if (item.id != id) {
|
|
|
return item;
|
|
return item;
|
|
|
} else {
|
|
} else {
|
|
@@ -190,7 +194,7 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
_goodsClass.push(info);
|
|
_goodsClass.push(info);
|
|
|
} else {
|
|
} else {
|
|
|
_goodsClass.splice(
|
|
_goodsClass.splice(
|
|
|
- _goodsClass.findIndex((item) => {
|
|
|
|
|
|
|
+ _goodsClass.findIndex(item => {
|
|
|
return item.id == id;
|
|
return item.id == id;
|
|
|
}),
|
|
}),
|
|
|
1
|
|
1
|
|
@@ -201,7 +205,7 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
changeSelect(_goodsClass);
|
|
changeSelect(_goodsClass);
|
|
|
} else {
|
|
} else {
|
|
|
if (signboard) {
|
|
if (signboard) {
|
|
|
- let ids = topGoods.map((item) => {
|
|
|
|
|
|
|
+ let ids = topGoods.map(item => {
|
|
|
return item.id;
|
|
return item.id;
|
|
|
});
|
|
});
|
|
|
ids.push(id);
|
|
ids.push(id);
|
|
@@ -212,7 +216,7 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
string: ids.join(","),
|
|
string: ids.join(","),
|
|
|
},
|
|
},
|
|
|
{ body: "json" }
|
|
{ body: "json" }
|
|
|
- ).then((res) => {
|
|
|
|
|
|
|
+ ).then(res => {
|
|
|
success(tips + successText);
|
|
success(tips + successText);
|
|
|
getSelectGoods();
|
|
getSelectGoods();
|
|
|
});
|
|
});
|
|
@@ -224,7 +228,7 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
goodId: id,
|
|
goodId: id,
|
|
|
},
|
|
},
|
|
|
{ body: "json" }
|
|
{ body: "json" }
|
|
|
- ).then((res) => {
|
|
|
|
|
|
|
+ ).then(res => {
|
|
|
success(tips + successText);
|
|
success(tips + successText);
|
|
|
getSelectGoods();
|
|
getSelectGoods();
|
|
|
});
|
|
});
|
|
@@ -239,7 +243,7 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
<Layout style={styles.container}>
|
|
<Layout style={styles.container}>
|
|
|
<Card
|
|
<Card
|
|
|
appearance='headerList'
|
|
appearance='headerList'
|
|
|
- header={(props) => {
|
|
|
|
|
|
|
+ header={props => {
|
|
|
return Header(props, goodsClassificationTitle2);
|
|
return Header(props, goodsClassificationTitle2);
|
|
|
}}
|
|
}}
|
|
|
disabled={true}
|
|
disabled={true}
|
|
@@ -254,7 +258,7 @@ export default function AddGoodsClassification({ navigation, route }) {
|
|
|
|
|
|
|
|
<Card
|
|
<Card
|
|
|
appearance='headerList'
|
|
appearance='headerList'
|
|
|
- header={(props) => {
|
|
|
|
|
|
|
+ header={props => {
|
|
|
return Header(props, goodsClassificationTitle3);
|
|
return Header(props, goodsClassificationTitle3);
|
|
|
}}
|
|
}}
|
|
|
disabled={true}
|
|
disabled={true}
|