♻️ 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为红包 转译字符方便处理 */
if (item.type === 1) {
item.upstream = '直连天下';
item.product_id = item.goods_id;
item.product_id = item.entity.goods_id;
resData.push(item);
} else if (item.type === 2) {
resData.push({
product_id: item.goods_id,
product_id: item.entity.goods_id,
product_type_text: '立减金',
upstream: String(item.channel) === '1' ? '支付宝' : '微信',
upstream:
String(item.entity.channel) === '1' ? '支付宝' : '微信',
code_batch_id: item.code_batch_id,
contract_price: item.price,
create_time: item.create_time,
official_price: item.reduce_amount,
channel_activity_id: item.channel_activity_id,
product_name: item.batch_goods_name,
contract_price: item.entity.price,
create_time: item.entity.create_time,
official_price: item.entity.reduce_amount,
channel_activity_id: item.entity.channel_activity_id,
product_name: item.entity.batch_goods_name,
quantity: item.stock,
weight: item.weight,
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 {
const price =
item.cash_amount_type === '1'
? item.denomination
: item.total_contract_price / item.num;
item.entity.cash_amount_type === '1'
? item.entity.denomination
: item.entity.total_contract_price / item.entity.num;
resData.push({
product_id: item.goods_id,
product_id: item.entity.goods_id,
product_type_text:
item.cash_amount_type === '2' ? '随机红包' : '固额红包',
upstream: item.channel === 1 ? '支付宝' : '微信',
item.entity.cash_amount_type === '2'
? '随机红包'
: '固额红包',
upstream: item.entity.channel === 1 ? '支付宝' : '微信',
code_batch_id: item.code_batch_id,
contract_price: price,
create_time: item.create_time,
create_time: item.entity.create_time,
official_price: price,
channel_activity_id: item.cash_activity_id,
product_name: item.batch_goods_name,
channel_activity_id: item.entity.cash_activity_id,
product_name: item.entity.batch_goods_name,
quantity: item.stock,
weight: item.weight,
effectDate: item.begin_time + ' 至 ' + item.end_time //有效时间
effectDate:
item.entity.begin_time + ' 至 ' + item.entity.end_time //有效时间
});
}
});