getPrice

计算价格

目前为 2024-07-02 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/485233/1403817/getPrice.js

  1. const defaultRate = 7;
  2. const defaultShippingCost = 70;
  3.  
  4. function getPrice(cost, weight) {
  5. if (cost > 300) {
  6. alert('价格太高,请自行计算!');
  7. return 0;
  8. }
  9. let proRate = 0;
  10. if (cost <= 50) {
  11. proRate = 0.4;
  12. }
  13. if (cost <= 100 && cost > 50) {
  14. proRate = 0.36;
  15. }
  16. if (cost <= 200 && cost > 100) {
  17. proRate = 0.3;
  18. }
  19. if (cost <= 300 && cost > 200) {
  20. proRate = 0.32;
  21. }
  22. const rate = defaultRate * 0.944 * 0.985;
  23. const shippingCost = defaultShippingCost + 10;
  24. if (weight !== 0) {
  25. const price = (cost + cost * proRate + weight * shippingCost) / rate;
  26. return Math.ceil(price);
  27. }
  28. return 0;
  29. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址