package lingtao.net.util;

import java.text.DecimalFormat;
import java.util.List;

import lingtao.net.bean.Product;

public class FgqPrice {
    DecimalFormat df = new DecimalFormat("0.00");

    /**
     * 仿古旗报价
     */
    public List<Product> getPrice(int count, Double area, List<Product> list, String[] craftList, String kind, int num) {
        Product pro = new Product();
        pro = new Product();
        pro.setCount(count);
        String craft = craftList[0];
        double dj = 0, wei = 0;
        if (kind.equals("1")) {
            if (craft.equals("单面")) {
                dj = 90;
                wei = 0.065;
            } else {
                dj = 100;
                wei = 0.195;
            }
        } else {
            if (craft.equals("单面")) {
                dj = 100;
                wei = 0.165;
            } else {
                dj = 135;
                wei = 0.33;
            }
        }

        double price = Math.ceil(area * dj);
        pro.setPrice(price);
        pro.setWeight(df.format(area * wei * num));
        list.add(pro);

        return list;
    }

    /**
     * 手拉旗报价
     */
    public List<Product> getSlqPrice(int count, List<Product> list) {

        double basePrice = 0;
        if (count > 0 && count <= 10) {
            basePrice = 30;
        } else if (count > 10 && count <= 50) {
            basePrice = 26;
        } else if (count > 50 && count <= 100) {
            basePrice = 22;
        } else if (count > 100 && count <= 200) {
            basePrice = 20;
        } else {
            basePrice = 18;
        }
        Product pro = new Product();
        pro = new Product();
        pro.setCount(count);
        pro.setPrice(Math.ceil(basePrice * count));
        list.add(pro);

        return list;
    }

    public List<Product> getSlqSpeicPrice(int count, List<Product> list, int type) {
        Product pro = new Product();
        pro = new Product();
        pro.setCount(count);
        if (type == 1) {
            pro.setPrice(Math.ceil(16 * count));
        } else {
            pro.setPrice(Math.ceil(12 * count));
        }
        list.add(pro);
        return list;
    }
}
