algorithm.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport"
  8. content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
  9. <meta http-equiv="Cache-Control" content="no-siteapp"/>
  10. <link rel="Bookmark" href="/favicon.ico">
  11. <link rel="Shortcut Icon" href="/favicon.ico"/>
  12. <link rel="stylesheet" href="css/ui/common.css">
  13. <!--<link rel="stylesheet" href="css/ui/style.css">-->
  14. <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
  15. <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
  16. <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
  17. <link rel="stylesheet" href="css/product-add.css">
  18. <script src="../js/jquery-2.2.3.min.js"></script>
  19. <!-- <script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
  20. <script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
  21. <script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
  22. <script src="js/product-add.js"></script>
  23. <script src="js/ui/plupload.full.min.js"></script>
  24. <script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script>
  25. <script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"></script>
  26. <script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
  27. <script src="js/ui/laydate.js"></script> -->
  28. </head>
  29. <body>
  30. <div class="page-container">
  31. <form class="form form-horizontal" style="position: static;">
  32. <div class="row cl">
  33. <label class="form-label col-xs-4 col-sm-2">售价:</label>
  34. <div class="formControls col-xs-8 col-sm-9">
  35. <input type="text" class="input-text" value="" placeholder="请输入产品售价" id="ProductPrice" onkeyup="check(this)" >
  36. </div>
  37. </div>
  38. <div class="row cl">
  39. <label class="form-label col-xs-4 col-sm-2">拿货成本:</label>
  40. <div class="formControls col-xs-8 col-sm-9">
  41. <input type="text" class="input-text" value="" placeholder="请输入产品拿货成本:" id="ProductPickingCost" onkeyup="check(this)">
  42. </div>
  43. </div>
  44. <div class="row cl">
  45. <label class="form-label col-xs-4 col-sm-2">快递成本:</label>
  46. <div class="formControls col-xs-8 col-sm-9">
  47. <input type="text" class="input-text" value="" placeholder="请输入产品快递成本:" id="ProductExpressCost" onkeyup="check(this)">
  48. </div>
  49. </div>
  50. <div class="row cl">
  51. <label class="form-label col-xs-4 col-sm-2">广告成本:</label>
  52. <div class="formControls col-xs-8 col-sm-9">
  53. <input type="text" id="ProductAdvertisementCost" placeholder="请输入产品广告成本" class="input-text" onkeyup="check(this)">
  54. </div>
  55. </div>
  56. <div class="row cl">
  57. <label class="form-label col-xs-4 col-sm-2">预估签收率 :</label>
  58. <div class="formControls col-xs-8 col-sm-9">
  59. <input type="text" id="PredictedYield" placeholder="请输入产品预估签收率" class="input-text">
  60. </div>
  61. </div>
  62. <div class="row cl">
  63. <label class="form-label col-xs-4 col-sm-2">利润率 :</label>
  64. <div class="formControls col-xs-8 col-sm-9">
  65. <input type="text" id="ProfitMargin" disabled="disabled" placeholder="产品利润率" class="input-text">
  66. </div>
  67. </div>
  68. <div class="Submission" onclick="Profitestimation()">
  69. 利润率估算
  70. </div>
  71. <textarea name="editorValue" id="ueditor_textarea_editorValue" style="display: none;"></textarea></form>
  72. </div>
  73. </body>
  74. </html>
  75. <script type="text/javascript">
  76. Profitestimation = function(){
  77. var ProductPrice = $("#ProductPrice")[0].value;
  78. var ProductPickingCost = $("#ProductPickingCost")[0].value;
  79. var ProductExpressCost = $("#ProductExpressCost")[0].value;
  80. var ProductAdvertisementCost = $("#ProductAdvertisementCost")[0].value;
  81. var PredictedYield = $("#PredictedYield")[0].value;
  82. var regbfb = /^\d+%$/;
  83. if(ProductPrice == "" ){
  84. alert("请输入正确的产品售价!");
  85. }else if(ProductPickingCost == "" ){
  86. alert("请输入正确的产品拿货成本!");
  87. }else if(ProductExpressCost == ""){
  88. alert("请输入正确的产品快递成本!");
  89. }else if(ProductAdvertisementCost == ""){
  90. alert("请输入正确的产品广告成本!");
  91. }else if(PredictedYield == "" || !regbfb.test(PredictedYield)){
  92. alert("请输入正确的产品预估签收率!");
  93. }else{
  94. var Predictedvalue = PredictedYield.replace("%","")/100;
  95. $("#ProfitMargin")[0].value = Math.floor((Predictedvalue*ProductPrice)-ProductPickingCost-ProductExpressCost-ProductAdvertisementCost)
  96. }
  97. }
  98. function check(e) {
  99. var re = /[^0-9\.]/g;
  100. if(re.test(e.value)){
  101. e.value = "";
  102. }
  103. }
  104. </script>