♻️ refactor: 调整商品范围列表代码

This commit is contained in:
wangsongsole 2023-06-09 11:26:37 +08:00
parent 96581eed80
commit cad0966826
1 changed files with 24 additions and 20 deletions

View File

@ -137,45 +137,49 @@ export default class commodityList extends React.Component {
/* type 1为商品 2为立减金 3为红包 转译字符方便处理 */ /* type 1为商品 2为立减金 3为红包 转译字符方便处理 */
if (item.type === 1) { if (item.type === 1) {
item.upstream = '直连天下'; item.upstream = '直连天下';
item.product_id = item.goods_id; item.product_id = item.entity.goods_id;
resData.push(item); resData.push(item);
} else if (item.type === 2) { } else if (item.type === 2) {
resData.push({ resData.push({
product_id: item.goods_id, product_id: item.entity.goods_id,
product_type_text: '立减金', product_type_text: '立减金',
upstream: String(item.channel) === '1' ? '支付宝' : '微信', upstream:
String(item.entity.channel) === '1' ? '支付宝' : '微信',
code_batch_id: item.code_batch_id, code_batch_id: item.code_batch_id,
contract_price: item.price, contract_price: item.entity.price,
create_time: item.create_time, create_time: item.entity.create_time,
official_price: item.reduce_amount, official_price: item.entity.reduce_amount,
channel_activity_id: item.channel_activity_id, channel_activity_id: item.entity.channel_activity_id,
product_name: item.batch_goods_name, product_name: item.entity.batch_goods_name,
quantity: item.stock, quantity: item.stock,
weight: item.weight, weight: item.weight,
effectDate: effectDate:
item.time_limit.effect_time.start_time + item.entity.time_limit.effect_time.start_time +
' 至 ' + ' 至 ' +
item.time_limit.effect_time.end_time //有效时间 item.entity.time_limit.effect_time.end_time //有效时间
}); });
} else { } else {
const price = const price =
item.cash_amount_type === '1' item.entity.cash_amount_type === '1'
? item.denomination ? item.entity.denomination
: item.total_contract_price / item.num; : item.entity.total_contract_price / item.entity.num;
resData.push({ resData.push({
product_id: item.goods_id, product_id: item.entity.goods_id,
product_type_text: product_type_text:
item.cash_amount_type === '2' ? '随机红包' : '固额红包', item.entity.cash_amount_type === '2'
upstream: item.channel === 1 ? '支付宝' : '微信', ? '随机红包'
: '固额红包',
upstream: item.entity.channel === 1 ? '支付宝' : '微信',
code_batch_id: item.code_batch_id, code_batch_id: item.code_batch_id,
contract_price: price, contract_price: price,
create_time: item.create_time, create_time: item.entity.create_time,
official_price: price, official_price: price,
channel_activity_id: item.cash_activity_id, channel_activity_id: item.entity.cash_activity_id,
product_name: item.batch_goods_name, product_name: item.entity.batch_goods_name,
quantity: item.stock, quantity: item.stock,
weight: item.weight, weight: item.weight,
effectDate: item.begin_time + ' 至 ' + item.end_time //有效时间 effectDate:
item.entity.begin_time + ' 至 ' + item.entity.end_time //有效时间
}); });
} }
}); });