外贸加价算法
程序员文章站
2022-07-12 20:30:12
...
usd_price = ( case when data.vendor_amount <= 500 then (data.vendor_amount + 200) / 6.7 + 9 when data.vendor_amount > 500 && data.vendor_amount <= 1500 then (data.vendor_amount + 300) / 6.7 + 9 when data.vendor_amount > 1500 && data.vendor_amount <= 3000 then (data.vendor_amount * 1.18) / 6.7 + 9 when data.vendor_amount > 3000 && data.vendor_amount <= 5000 then (data.vendor_amount * 1.15) / 6.7 + 9 when data.vendor_amount > 5000 && data.vendor_amount <= 7000 then (data.vendor_amount * 1.13) / 6.7 + 9 when data.vendor_amount > 7000 && data.vendor_amount <= 10000 then (data.vendor_amount * 1.10) / 6.7 + 9 end ).to_i