fix: 增加数据格式

This commit is contained in:
zhangds 2022-10-21 16:11:15 +08:00
parent e093e7d9ac
commit 850b34545a
2 changed files with 25 additions and 16 deletions

View File

@ -32,16 +32,14 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
//
const format_product_model = () => {
let new_tableData = tableData;
let form_model = productEl.current.state.form_data;
form_model.type = 1;
let form_model = productEl.current.getFormModel();
form_model.upstream = "直连天下";
form_model.type = 1;
form_model.all_budget = mulNum(
Number(form_model.contract_price),
Number(form_model.quantity)
);
form_model.effectDate = "-";
if (product_title === "编辑商品") {
if (table_index !== -1) {
form_model.checked = false;

View File

@ -163,18 +163,31 @@ const UseProductPop = forwardRef((props, ref) => {
quantity: model.quantity,
show_url: model.show_url[0].src,
describe_url: model.describe_url.map((item) => item.src),
detail_url: model.detail_url[0].src,
detail_url: model.detail_url[0] ? model.detail_url[0].src : "",
account_type: model.account_type,
map_product_name: model.product_name,
type: 1,
};
};
const submit = () => {
//
let param = getFormModel();
console.log("param =>", param);
return false;
const submit = async () => {
let visible = false;
// :
if (formEl.current.validator()) {
//
if (model.show_url.length <= 0) {
Notify.error(`请上传商品Logo`);
return;
}
if (model.describe_url.length <= 0) {
Notify.error(`请上传商品Logo`);
return;
}
visible = true;
}
return visible;
};
const onProductChange = (e) => {
@ -183,14 +196,12 @@ const UseProductPop = forwardRef((props, ref) => {
//
let cur_product = state.productDataAll.find((item) => {
return item.id == e.key;
return item.id === e.key;
});
console.log("cur_product =>", cur_product);
// logo
let picItem = window.goods.find((item) => {
return item.id == cur_product.product_category_id;
return Number(item.id) === Number(cur_product.product_category_id);
});
console.log("picItem =>", picItem);
setModel({
product_id: cur_product.id,
official_price: cur_product.official_price,
@ -204,7 +215,7 @@ const UseProductPop = forwardRef((props, ref) => {
if (picItem) {
let goodsArr = [];
const productItem = picItem.products.find(
(item) => item.id == cur_product.id
(item) => Number(item.id) === Number(cur_product.id)
);
productItem?.pic.map((item, index) => {
goodsArr.push({