💪 optimize: 优化代码

This commit is contained in:
wangsongsole 2023-06-09 11:31:46 +08:00
parent cad0966826
commit a95fedd39e
1 changed files with 3 additions and 7 deletions

View File

@ -136,22 +136,20 @@ export default class commodityList extends React.Component {
req.data.map((item) => {
/* type 1为商品 2为立减金 3为红包 转译字符方便处理 */
if (item.type === 1) {
item.upstream = '直连天下';
item.product_id = item.entity.goods_id;
resData.push(item);
item.entity.upstream = '直连天下';
item.entity.weight = item.weight;
resData.push(item.entity);
} else if (item.type === 2) {
resData.push({
product_id: item.entity.goods_id,
product_type_text: '立减金',
upstream:
String(item.entity.channel) === '1' ? '支付宝' : '微信',
code_batch_id: item.code_batch_id,
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.entity.time_limit.effect_time.start_time +
@ -170,13 +168,11 @@ export default class commodityList extends React.Component {
? '随机红包'
: '固额红包',
upstream: item.entity.channel === 1 ? '支付宝' : '微信',
code_batch_id: item.code_batch_id,
contract_price: price,
create_time: item.entity.create_time,
official_price: price,
channel_activity_id: item.entity.cash_activity_id,
product_name: item.entity.batch_goods_name,
quantity: item.stock,
weight: item.weight,
effectDate:
item.entity.begin_time + ' 至 ' + item.entity.end_time //有效时间