1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | function sellItem() { var rate, qty, zone, amount, discount, total, discrate, savings, delOpt, delCost, Webcon; var url = "page/getRateAmt"; cocoon.sendPageAndWait(url); rate = parseFloat(cocoon.request.getParameter("rate")); qty = parseInt(cocoon.request.getParameter("qty")); amount = rate*qty; url="page/getZone"; Webcon = cocoon.sendPageAndWait(url, {"rate":rate, "qty":qty}); zone = cocoon.request.getParameter("zone"); discount=0.02; if (zone=="A") { if (qty >= 100) { discount=0.1; } } else if (zone=="B") { if (qty >= 200) { discount=0.2; } } discrate = 100*discount; savings = discount*amount; delCost=0.0; delOpt = cocoon.request.getParameter("delOpt"); if (delOpt=="S") { url="page/getShipOpt"; cocoon.sendPageAndWait(url); delCost = parseInt(cocoon.request.getParameter("delCost")); } total = amount + delCost - savings; url="page/displayResult"; cocoon.sendPageAndWait(url, {"discrate":discrate, "total":total, "savings":savings, "delCost":delCost, "amount":amount, "discount":discount, "zone":zone}); } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |