contractOrderForm.jsp 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. <%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
  2. <%@ page contentType="text/html;charset=UTF-8" %>
  3. <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
  4. <html>
  5. <head>
  6. <title>采购的名单管理</title>
  7. <meta name="decorator" content="default"/>
  8. <script type="text/javascript">
  9. $(document).ready(function() {
  10. //$("#name").focus();
  11. $("#inputForm").validate({
  12. submitHandler: function (form) {
  13. loading('正在提交,请稍等...');
  14. form.submit();
  15. },
  16. errorContainer: "#messageBox",
  17. errorPlacement: function (error, element) {
  18. $("#messageBox").text("输入有误,请先更正。");
  19. if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
  20. error.appendTo(element.parent().parent());
  21. } else {
  22. error.insertAfter(element);
  23. }
  24. }
  25. });
  26. $(":radio[name='invoice']").click(function () {
  27. var index = $(":radio[name='invoice']").index($(this));
  28. if (index == 1) //选中第2个时,div显示
  29. $("#invoiceTable").show();
  30. else //当被选中的不是第2个时,div隐藏
  31. $("#invoiceTable").hide();
  32. });
  33. var lenght =${fn:length(contractOrder.clubsubbranchList)};
  34. for (var i = 0; i < lenght; i++) {
  35. loadCity(i);
  36. }
  37. var $totalFees=$("#productTable").find("[name*='totalFee']");
  38. $totalFees.each(function(index,element){
  39. var totalFee = $(this).val();
  40. var totalFeeNumber = Number(totalFee);//当个商品总结
  41. $("#orderProduct" + index + "\\.shouldPayFee").val(totalFeeNumber);
  42. })
  43. //再次修改时候界面不能是数据库四舍五入值,(重新计算机最新值展示以防修改)
  44. var changeValue = $("#changeValue").val();//经理折扣金额
  45. if(null !=changeValue && ''!=changeValue){
  46. setProductTotalFee();
  47. }
  48. });
  49. function showProductSelect(contractId) {
  50. top.$.jBox("iframe:${ctx}/bulkpurchase/orderProduct/getContractpRroduct?contractId=" + contractId, {
  51. iframeScrolling: 'yes',
  52. width: $(top.document).width() - 330,
  53. height: $(top.document).height() - 160,
  54. persistent: true,
  55. showScrolling: false,
  56. title: "选择商品",
  57. bottomText: '请从可供选择的项目中选择一个',
  58. buttons: {"确定": '1', "关闭": '-1'},
  59. submit: function (v, h, f) {
  60. //确定
  61. var $jboxFrame = top.$('#jbox-iframe');
  62. var $mainFrame = top.$('#mainFrame');
  63. if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
  64. var items = $jboxFrame[0].contentWindow.getCheckedItems();
  65. if (items.length > 0) {
  66. setProductSelect(items);
  67. return true;
  68. } else {
  69. top.$.jBox.tip("请选择...");
  70. return false;
  71. }
  72. }
  73. return true;
  74. }
  75. });
  76. }
  77. function setProductSelect(items) {
  78. var item=items[0];
  79. var flag="false";
  80. $.ajax({
  81. url: "${ctx}/bulkpurchase/contractOrder/PutSession",
  82. data: {"items": item},
  83. type: "POST",
  84. async: false,
  85. success: function(data){
  86. flag=data.success;
  87. }
  88. });
  89. if(flag=='true'){
  90. closeP();
  91. }
  92. }
  93. function closeP(){
  94. var path = "${ctx}/bulkpurchase/contractOrder/putProductToOrder";
  95. $(".error").remove();
  96. $("#inputForm").attr("action", path).submit();
  97. }
  98. function managerDiscount(){
  99. var booleanFlag = setProductTotalFee();
  100. if(false !=booleanFlag){//有错误则不显示经理折扣
  101. var addValue = $("#addValue").text("已经理折扣");
  102. }
  103. }
  104. //经理折扣后计算
  105. function setProductTotalFee() {
  106. var changeValue = $("#changeValue").val();//经理折扣金额
  107. if(null ==changeValue || ''==changeValue){
  108. alertx("请先输入");
  109. var addValue = $("#addValue").text("");
  110. return false;
  111. }
  112. if(isNaN(changeValue)){
  113. alertx("您输入的折扣有误");
  114. $("#changeValue").focus();
  115. var addValue = $("#addValue").text("");
  116. return false;
  117. }
  118. var productTotalFeeNumber = parseFloat($("#productTotalFee").val());//商品总金额
  119. var dis = parseFloat(changeValue);//经理折扣金额
  120. //检查输入的折扣如果存在小数点最多只能两位
  121. var checknumFlag = checknum(dis);
  122. if(checknumFlag == false){
  123. return false;
  124. }
  125. var shouldPayFeeNumber = (productTotalFeeNumber*100000 - dis*100000)/10000;//应付金额数量
  126. shouldPayFeeNumber=((shouldPayFeeNumber).toFixed(1)/10).toFixed(2);
  127. if (shouldPayFeeNumber < 0.01) {
  128. $("#changeValue").val(0);
  129. alertx("您输入的折扣大于实付金额");
  130. var addValue = $("#addValue").text("");
  131. return false;
  132. } else if (shouldPayFeeNumber - dis == 0) {
  133. alertx("您输入的折扣等于实付金额");
  134. var addValue = $("#addValue").text("");
  135. return false;
  136. } else {
  137. var payTotalFee = $("#payTotalFee").val(shouldPayFeeNumber);
  138. var $totalFees=$("#productTable").find("[name*='totalFee']");
  139. $totalFees.each(function(index,element){
  140. var totalFee = $(this).val();
  141. var totalFeeNumber = Number(totalFee);//单个商品总金额
  142. var shouldPayFees = ((shouldPayFeeNumber * totalFeeNumber * 100000) / productTotalFeeNumber) / 10000; // 单个商品应付金额
  143. shouldPayFees=((shouldPayFees).toFixed(1)/10).toFixed(2);
  144. $("#shouldPayFee"+index).text(shouldPayFees);
  145. $("#orderProduct"+index+"\\.shouldPayFee").val(shouldPayFees);
  146. //单个商品应付隐藏域
  147. $("#shouldPayFeeHidden"+index).val(((shouldPayFeeNumber * totalFeeNumber * 100000) / productTotalFeeNumber) / 100000);
  148. var difference = totalFeeNumber - shouldPayFees;
  149. // 获取隐藏域的应付费用
  150. var cmFeeHidden = Number($("#cmFeeHidden"+index).val());
  151. var otherFeeHidden = Number($("#otherFeeHidden"+index).val());
  152. var totalProfit = (otherFeeHidden + cmFeeHidden) - difference;// 总盈利
  153. var totalCount = otherFeeHidden + cmFeeHidden;
  154. //除数和被除数都不能为0
  155. if(totalProfit != 0 && totalCount != 0 ){
  156. var profitRatio = totalProfit / (totalCount)// 盈利比
  157. }else{
  158. profitRatio =0;
  159. }
  160. /* //计算单个商品总增值税(久算法:(应付总额/商品总额)x 总价x 税率)
  161. var shouldPay = (((shouldPayFeeNumber * totalFeeNumber * 100000) / productTotalFeeNumber) / 10000).toFixed(1)/10;//单个商品应付总额
  162. var taxRateHidden = Number($("#taxRateHidden"+index).val());//税率
  163. var totalAddedValueTax = (shouldPay * (taxRateHidden / 100)).toFixed(2);*/
  164. if(profitRatio != 0){
  165. var otherFee = (((profitRatio * otherFeeHidden * 100000) / 10000).toFixed(1) / 10).toFixed(2);// 应付第三方
  166. }else{
  167. otherFee = 0;
  168. }
  169. var shouldPay = (((shouldPayFeeNumber * totalFeeNumber * 100000) / productTotalFeeNumber) / 10000).toFixed(1)/10;//单个商品应付总额
  170. //计算单个商品总增值税(新算法:(应付金额-[应付金额/(1+税率)](最后保留2位小数+四舍五入 ))
  171. var taxRateHidden = Number($("#taxRateHidden"+index).val());//税率
  172. var tax = ((shouldPay * 100000)/(1 * 100000 + (taxRateHidden / 100) * 100000)).toFixed(2);
  173. var totalTax =(shouldPay - tax);
  174. var totalAddedValueTax = (totalTax).toFixed(2);
  175. //计算单个商品应付采美(算法: 应付采美=应付金额-应付供应商-应付第三方-税费)
  176. var shopFee = Number($("#shopFeeHidden"+index).val());
  177. // var cmFee = (((profitRatio * cmFeeHidden * 100000) / 10000).toFixed(1) / 10).toFixed(2);// 应付采美
  178. var cmFee = (((shouldPay * 100000)-(shopFee * 100000)-(otherFee * 100000)-(totalAddedValueTax * 100000))/100000).toFixed(2) ;// 应付采美
  179. $("#otherFee"+index).text(otherFee);
  180. $("#cmFee"+index).text(cmFee);
  181. $("#totalAddedValueTax"+index).text(totalAddedValueTax);
  182. //更新提交隐藏域值
  183. $("#orderProduct"+index+"\\.totalAddedValueTax").val(totalAddedValueTax);
  184. $("#orderProduct"+index+"\\.otherFee").val(otherFee);
  185. $("#orderProduct"+index+"\\.cmFee").val(cmFee);
  186. });
  187. $("#discount").val(dis);
  188. $("#payPrice").text(keepTwoDecimalFull(((productTotalFeeNumber*1000 - dis*1000)/1000)));
  189. }
  190. }
  191. //检查输入的折扣如果存在小数点最多只能两位
  192. function checknum(obj){
  193. var reg=/^\d+[.]?\d{0,2}$/;
  194. if(!reg.test(obj)){
  195. alertx("经理折扣必须为整数或者两位小数以内的值");
  196. var addValue = $("#addValue").text("");
  197. return false;
  198. }
  199. }
  200. function retultAlert() {
  201. alertx("请先添加商品");
  202. }
  203. </script>
  204. </head>
  205. <body>
  206. <ul class="nav nav-tabs">
  207. <li><a href="${ctx}/bulkpurchase/contractOrder?contractId=${contractOrder.contractId}">采购的订单列表</a></li>
  208. <li class="active"><a
  209. href="${ctx}/bulkpurchase/contractOrder/form?id=${contractOrder.id}&contractId=${contractOrder.contractId}">采购的订单<shiro:hasPermission
  210. name="contractorder:contractOrder:edit">${not empty contractOrder.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission
  211. name="contractorder:contractOrder:edit">查看</shiro:lacksPermission></a></li>
  212. </ul>
  213. <br/>
  214. <form:form id="inputForm" modelAttribute="contractOrder" action="${ctx}/bulkpurchase/contractOrder/save" method="post" class="form-horizontal">
  215. <form:hidden path="id"/>
  216. <form:hidden path="contractId"/>
  217. <sys:message content="${message}"/>
  218. <input type="hidden" id="curProvince" name="curProvince" value="${contractOrder.bpOrderUserinfo.province }" disabled="disabled">
  219. <input type="hidden" id="curCity" name="curCity" value="${contractOrder.bpOrderUserinfo.city }" disabled="disabled">
  220. <input type="hidden" id="curTown" name="curTown" value="${contractOrder.bpOrderUserinfo.town }" disabled="disabled">
  221. <table id="contentTable" class="table table-striped table-bordered table-condensed">
  222. <form:hidden path="bpOrderUserinfo.id"/>
  223. <form:hidden path="bpOrderUserinfo.clubId"/>
  224. <form:hidden path="bpOrderUserinfo.userId"/>
  225. <form:hidden path="orderInvoice.id"/>
  226. <thead>
  227. <tr>
  228. <td colspan="4">用户信息</td>
  229. </tr>
  230. </thead>
  231. <tr>
  232. <td>买家</td>
  233. <td><form:input path="bpOrderUserinfo.name" readonly="true"/></td>
  234. <td>订单号</td>
  235. <td><form:input path="no" readonly="true" class="input-xlarg required"/></td>
  236. </tr>
  237. <tr>
  238. <td>收货人<span class="help-inline"><font color="red">*</font> </span></td>
  239. <td><form:input path="bpOrderUserinfo.shouHuoRen" class="input-medium required"/></td>
  240. <td>手机<span class="help-inline"><font color="red">*</font> </span></td>
  241. <td><form:input path="bpOrderUserinfo.mobile" minlength="11" maxlength="11" class="input-medium required " /></td>
  242. </tr>
  243. <tr>
  244. <td>电话</td>
  245. <td><form:input path="bpOrderUserinfo.phone" class="input-medium " /></td>
  246. <td> 收货地址</td>
  247. <td><%--form:input path="bpOrderUserinfo.address" class="input-medium required"/>--%>
  248. <form:select path="bpOrderUserinfo.province" class="input-xlarge required" id="province" onchange="loadCity()" style="width:100px;">
  249. <form:option value="" label="省" provinceId=""/>
  250. </form:select>
  251. <form:select path="bpOrderUserinfo.city" class="input-xlarge required" id="city" onchange="loadTown()" style="width:100px;">
  252. <form:option value="" label="市" cityId=""/>
  253. </form:select>
  254. <form:select path="bpOrderUserinfo.town" class="input-xlarge required" id="town" style="width:100px;">
  255. <form:option value="" label="区"/>
  256. </form:select>
  257. <from:input path="bpOrderUserinfo.address" class="input-group required"></from:input>
  258. </td>
  259. </tr>
  260. <c:if test="${not empty contractOrder.contract}">
  261. <tr>
  262. <td>采购编号</td>
  263. <td>${contractOrder.contract.no}</td>
  264. </tr>
  265. </c:if>
  266. </table>
  267. <br>
  268. <table id="orderTable" class="table table-striped table-bordered table-condensed">
  269. <thead>
  270. <tr>
  271. <td colspan="4">订单详情</td>
  272. </tr>
  273. </thead>
  274. <tr>
  275. <td>收货人邮编</td>
  276. <td><form:input path="bpOrderUserinfo.postalCode"/></td>
  277. <td>下单时间</td>
  278. <td><fmt:formatDate value="${contractOrder.createDate}" pattern="yyyy-MM-dd HH:mm"/></td>
  279. </tr>
  280. <tr>
  281. <td>支付方式</td>
  282. <td>
  283. <form:select path="payWay" class="input-medium required">
  284. <form:options items="${fns:getDictList('bp_order_pay')}" itemLabel="label" itemValue="value"
  285. htmlEscape="false"/>
  286. </form:select>
  287. </td>
  288. <td>订单状态</td>
  289. <td>
  290. <%--<form:select path="status" class="input-medium required">--%>
  291. <%--<form:options items="${fns:getDictList('order_status')}" itemLabel="label" itemValue="value"--%>
  292. <%--htmlEscape="false"/>--%>
  293. <%--</form:select>--%>
  294. ${fns:getDictLabel(contractOrder.status,'order_status' ,'未付款' )}
  295. </td>
  296. </tr>
  297. <tr>
  298. <td>订单备注</td>
  299. <td><form:input path="remarks"/></td>
  300. <td>来源</td><td>${fns:getDictLabel(contractOrder.orderSource,'bp_orderSource' ,'' )}
  301. <from:hidden path="orderSource"></from:hidden>
  302. <%--<from:select path="orderSource" class="input-medium required" disabled="true">
  303. <form:options items="${fns:getDictList('bp_orderSource')}" itemLabel="label" itemValue="value"
  304. htmlEscape="false"/>
  305. </from:select>--%>
  306. </td>
  307. </tr>
  308. </table>
  309. <c:if test="${empty contractOrder.confirmFlag || contractOrder.confirmFlag eq 0 }">
  310. <input type="button" value="添加商品" class="btn btn-primary" onclick="showProductSelect(${contractOrder.contractId})"/>
  311. </c:if>
  312. <table id="productTable" class="table table-striped table-bordered table-condensed">
  313. <tr>
  314. <th>商品ID</th>
  315. <th>商品名称</th>
  316. <th>供应商名称</th>
  317. <th>数量(赠品数)</th>
  318. <th>单价</th>
  319. <th>折扣</th>
  320. <th>折后单价</th>
  321. <th>税率</th>
  322. <th>单个税费</th>
  323. <th>税费</th>
  324. <th>总价</th>
  325. <th>应付金额</th>
  326. <th>应付供应商</th>
  327. <th>应付第三方</th>
  328. <th>应付采美</th>
  329. </tr>
  330. <c:if test="${not empty contractOrder.orderProduct}">
  331. <c:forEach items="${contractOrder.orderProduct}" var="orderProduct" varStatus="step">
  332. <from:hidden path="orderProduct[${step.index}].orderId"/>
  333. <from:hidden path="orderProduct[${step.index}].contractId"/>
  334. <from:hidden path="orderProduct[${step.index}].shopId"/>
  335. <from:hidden path="orderProduct[${step.index}].productId"/>
  336. <tr class="indexp">
  337. <td>
  338. ${orderProduct.productId}
  339. <form:hidden path="orderProduct[${step.index}].id"/>
  340. <form:hidden path="orderProduct[${step.index}].contractProductId"/>
  341. </td>
  342. <td>
  343. <div style='width:120px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;' title='${orderProduct.name}'>${orderProduct.name}</div>
  344. <form:hidden path="orderProduct[${step.index}].name"/>
  345. </td>
  346. <td>
  347. <div style='width:120px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;' title='${orderProduct.shopName}'>${orderProduct.shopName}</div>
  348. <form:hidden path="orderProduct[${step.index}].shopName"/>
  349. </td>
  350. <td>
  351. ${orderProduct.num}(${orderProduct.presentNum})
  352. <form:hidden path="orderProduct[${step.index}].num"/>
  353. <form:hidden path="orderProduct[${step.index}].presentNum"/>
  354. </td>
  355. <td>
  356. <fmt:formatNumber value="${orderProduct.price}" type="currency" pattern="0.00"/>
  357. <form:hidden path="orderProduct[${step.index}].price"/>
  358. </td>
  359. <td>
  360. <fmt:formatNumber value="${orderProduct.discount/100}" type="currency" pattern="0.00%"/>
  361. <form:hidden path="orderProduct[${step.index}].discount"/>
  362. </td>
  363. <td>
  364. <fmt:formatNumber value="${orderProduct.discountPrice}" type="currency" pattern="0.00"/>
  365. <form:hidden path="orderProduct[${step.index}].discountPrice"/>
  366. </td>
  367. <td>
  368. <fmt:formatNumber value="${orderProduct.taxRate/100}" type="currency" pattern="0%"/>
  369. <form:hidden path="orderProduct[${step.index}].taxRate"/>
  370. <input type="hidden" id="taxRateHidden${step.index}" value="${orderProduct.taxRate}">
  371. </td>
  372. <td>
  373. <fmt:formatNumber value="${orderProduct.addedValueTax}" type="currency" pattern="0.00"/>
  374. <form:hidden path="orderProduct[${step.index}].addedValueTax"/>
  375. </td>
  376. <td>
  377. <span id="totalAddedValueTax${step.index}"><fmt:formatNumber value="${orderProduct.totalAddedValueTax}" type="currency" pattern="0.00"/></span>
  378. <form:hidden path="orderProduct[${step.index}].totalAddedValueTax"/>
  379. <input type="hidden" id="totalAddedValueTaxHidden${step.index}" value="${orderProduct.totalAddedValueTax}">
  380. </td>
  381. <td>
  382. <fmt:formatNumber value="${orderProduct.totalFee}" type="currency" pattern="0.00"/>
  383. <form:hidden path="orderProduct[${step.index}].totalFee"/>
  384. </td>
  385. <td>
  386. <span id="shouldPayFee${step.index}"><fmt:formatNumber value= "${empty orderProduct.shouldPayFee ? (orderProduct.totalFee) : (orderProduct.shouldPayFee)}" type="currency" pattern="0.00"/>
  387. </span>
  388. <form:hidden path="orderProduct[${step.index}].shouldPayFee"/>
  389. <input type="hidden" id="shouldPayFeeHidden${step.index}" value="">
  390. </td>
  391. <td>
  392. <span id="shopFee${step.index}"><fmt:formatNumber value= "${orderProduct.shopFee}" type="currency" pattern="0.00"/></span>
  393. <form:hidden path="orderProduct[${step.index}].shopFee"/>
  394. <input type="hidden" id="shopFeeHidden${step.index}" value="${orderProduct.shopFee}">
  395. </td>
  396. <td>
  397. <span id="otherFee${step.index}"><fmt:formatNumber value= "${orderProduct.otherFee}" type="currency" pattern="0.00"/></span>
  398. <form:hidden path="orderProduct[${step.index}].otherFee"/>
  399. <input type="hidden" id="otherFeeHidden${step.index}" value="${empty orderProduct.otherBppFee ? (orderProduct.otherFee) : (orderProduct.otherBppFee)}">
  400. </td>
  401. <td>
  402. <span id="cmFee${step.index}"><fmt:formatNumber value= "${orderProduct.cmFee}" type="currency" pattern="0.00"/></span>
  403. <form:hidden path="orderProduct[${step.index}].cmFee"/>
  404. <input type="hidden" id="cmFeeHidden${step.index}" value="${empty orderProduct.cmBppFee ? (orderProduct.cmFee) : (orderProduct.cmBppFee)}">
  405. </td>
  406. </tr>
  407. </c:forEach>
  408. </c:if>
  409. </table>
  410. <br><br>
  411. <table id="orderPrice" class="table table-striped table-bordered table-condensed">
  412. <thead>
  413. <tr>
  414. <td colspan="4">订单金额</td>
  415. </tr>
  416. </thead>
  417. <tr>
  418. <td>商品总金额</td>
  419. <td>
  420. <c:if test="${ empty contractOrder.productTotalFee}">0.00元</c:if>
  421. <c:if test="${ !empty contractOrder.productTotalFee}">
  422. <fmt:formatNumber value="${contractOrder.productTotalFee}" type="currency" pattern="0.00"/>元</c:if>
  423. </td>
  424. <form:hidden path="productTotalFee"/>
  425. <td>商品总数</td>
  426. <td><c:if test="${ empty contractOrder.productCount}">0</c:if>
  427. <c:if test="${ !empty contractOrder.productCount}">
  428. <fmt:formatNumber value="${contractOrder.productCount}" type="currency" pattern="0"/>
  429. </c:if>
  430. </td>
  431. <form:hidden path="productCount"/>
  432. </tr>
  433. <tr>
  434. <td>账户余额支付金额</td>
  435. <td><c:if test="${ empty contractOrder.balancePayFee||contractOrder.balancePayFee==null}">0.00元</c:if>
  436. <c:if test="${ !empty contractOrder.balancePayFee}">
  437. <fmt:formatNumber value="${contractOrder.balancePayFee}" type="currency" pattern="0.00"/>
  438. 元</c:if>
  439. </td>
  440. <td>赠送商品数</td>
  441. <td>
  442. <c:if test="${ empty contractOrder.presentCount}">0</c:if>
  443. <c:if test="${ !empty contractOrder.presentCount}">
  444. <fmt:formatNumber value="${contractOrder.presentCount}" type="currency" pattern="0"/>
  445. </c:if>
  446. <form:hidden path="presentCount"/>
  447. </td>
  448. </tr>
  449. <tr>
  450. <td>订单总额</td>
  451. <td>
  452. <c:if test="${ empty contractOrder.orderTotalFee}">0.00 元</c:if>
  453. <c:if test="${ !empty contractOrder.orderTotalFee}">
  454. <fmt:formatNumber value="${contractOrder.orderTotalFee}" type="currency" pattern="0.00"/> 元</c:if>
  455. </td>
  456. <form:hidden path="orderTotalFee"/>
  457. <td>运费</td>
  458. <td> ${contractOrder.freePostFlag ==0?"包邮":"到付"}
  459. <form:hidden path="freePostFlag"/>
  460. </td>
  461. </tr>
  462. <tr>
  463. <td>经理折扣</td>
  464. <td>
  465. <input type="text" id="changeValue" name="changeValue" value="<fmt:formatNumber value="${contractOrder.discount}" type="currency" pattern="0.00"/>"/>
  466. <c:if test="${empty contractOrder.orderProduct}">
  467. <c:if test="${empty contractOrder.confirmFlag || contractOrder.confirmFlag eq 0 }"><input type="button" onchange="retultAlert()" value="确认折扣" </c:if>
  468. </c:if>
  469. <c:if test="${!empty contractOrder.orderProduct}">
  470. <c:if test="${empty contractOrder.confirmFlag || contractOrder.confirmFlag eq 0 }"><input type="button" onclick="managerDiscount()"value="确认折扣"></c:if>
  471. <span id="addValue" style="color: red"></span>
  472. </c:if>
  473. <from:hidden path="discount"/></td>
  474. </td>
  475. <td>应付总额</td>
  476. <td>
  477. <span id="payPrice"><c:if test="${ empty contractOrder.payTotalFee}">0.00 元</c:if>
  478. <c:if test="${ !empty contractOrder.payTotalFee}">
  479. <fmt:formatNumber value="${contractOrder.payTotalFee}" type="currency" pattern="0.00"/> 元</c:if>
  480. </span>
  481. <form:hidden path="payTotalFee"/>
  482. </td>
  483. </tr>
  484. </table>
  485. <br>
  486. <c:if test="${empty contractOrder.confirmFlag || contractOrder.confirmFlag eq 0 }">
  487. <c:if test="${empty contractOrder.orderInvoice.invoiceTitle}">
  488. <div>
  489. <input type="radio" name="invoice" checked="checked"> 不需要发票
  490. <input type="radio" name="invoice"> 需要发票
  491. </div>
  492. <div class="panel panel-default" id="invoiceTable" style="display:none">
  493. <table class="table">
  494. <td>发票类型</td>
  495. <td><input type="radio" checked="checked">普通发票</td>
  496. <tr>
  497. <td>发票内容</td>
  498. <td><input type="radio" checked="checked">明细</td>
  499. </tr>
  500. <tr>
  501. <td>发票抬头</td>
  502. <td><form:input path="orderInvoice.invoiceTitle"/></td>
  503. </tr>
  504. </table>
  505. </div>
  506. </c:if>
  507. <c:if test="${!empty contractOrder.orderInvoice.invoiceTitle}">
  508. <div>
  509. <input type="radio" name="invoice"> 不需要发票
  510. <input type="radio" name="invoice" checked="checked"> 需要发票
  511. </div>
  512. <div class="panel panel-default" id="invoiceTable">
  513. <table class="table">
  514. <td>发票类型</td>
  515. <td><input type="radio" checked="checked">普通发票</td>
  516. <tr>
  517. <td>发票内容</td>
  518. <td><input type="radio" checked="checked">明细</td>
  519. </tr>
  520. <tr>
  521. <td>发票抬头</td>
  522. <td><form:input path="orderInvoice.invoiceTitle"/></td>
  523. </tr>
  524. </table>
  525. </div>
  526. </c:if>
  527. </c:if>
  528. <c:if test="${contractOrder.confirmFlag eq 1 }">
  529. <c:if test="${!empty contractOrder.id}">
  530. <c:if test="${empty contractOrder.orderInvoice.invoiceTitle}">
  531. <div>
  532. <input type="radio" name="invoice" checked="checked"> 不需要发票
  533. </c:if>
  534. <c:if test="${!empty contractOrder.orderInvoice.invoiceTitle}">
  535. <div>
  536. <input type="radio" name="invoice" checked="checked"> 需要发票
  537. </div>
  538. <div class="panel panel-default" id="invoiceTable">
  539. <table class="table">
  540. <td>发票类型</td>
  541. <td><input type="radio" checked="checked">普通发票</td>
  542. <tr>
  543. <td>发票内容</td>
  544. <td><input type="radio" checked="checked">明细</td>
  545. </tr>
  546. <tr>
  547. <td>发票抬头</td>
  548. <td><form:input path="orderInvoice.invoiceTitle"/></td>
  549. </tr>
  550. </table>
  551. </div>
  552. </div>
  553. </c:if>
  554. </c:if>
  555. </c:if>
  556. <div class="form-actions">
  557. <c:if test="${empty contractOrder.confirmFlag || contractOrder.confirmFlag eq 0 }">
  558. <shiro:hasPermission name="contractorder:contractOrder:orderEdit"><input id="btnSubmit" class="btn btn-primary"
  559. type="submit"
  560. value="保 存"/>&nbsp;</shiro:hasPermission>
  561. </c:if>
  562. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  563. </div>
  564. </form:form>
  565. <script type="text/javascript">
  566. var curProvince = $("#curProvince").val();
  567. var curCity = $("#curCity").val();
  568. var curTown = $("#curTown").val();
  569. $(function() {
  570. $.ajax({
  571. type: 'POST',
  572. dataType: 'json',
  573. url: '/area/loadProvince',
  574. success: function(data) {
  575. $("#province").html("");
  576. $("#province").append("<option value=''>省</option>");
  577. for(var i=0; i<data.length; i++) {
  578. if(curProvince != '' && curProvince != null && typeof(curProvince) != "undefined" && curProvince == data[i].name) {
  579. $("#province").append("<option value='" + data[i].name + "' provinceId=" + data[i].id +" selected>" + data[i].name +"</option>");
  580. $(".select2-chosen").eq(0).html(curProvince);
  581. loadCity();
  582. } else {
  583. $("#province").append("<option value='" + data[i].name + "' provinceId=" + data[i].id +">" + data[i].name +"</option>");
  584. }
  585. }
  586. }
  587. });
  588. });
  589. function loadCity() {
  590. var provinceId = $("#province option:selected").attr("provinceId");
  591. $("#town").html("");
  592. $(".select2-chosen").eq(2).html("区");
  593. $("#town").append("<option value=''>区</option>");
  594. if(typeof(provinceId) != "undefined") {
  595. $.ajax({
  596. type: 'POST',
  597. dataType: 'json',
  598. data: {'provinceId':provinceId},
  599. url: '/area/loadCity',
  600. success: function(data) {
  601. $(".select2-chosen").eq(1).html("市");
  602. $("#city").html("");
  603. $("#city").append("<option value=''>市</option>");
  604. for(var i=0; i<data.length; i++) {
  605. if(curCity != null && typeof(curCity) != "undefined" && curCity == data[i].name) {
  606. $("#city").append("<option value='" + data[i].name + "' selected cityId=" + data[i].id +">" + data[i].name +"</option>");
  607. $(".select2-chosen").eq(1).html(curCity);
  608. loadTown();
  609. } else {
  610. $("#city").append("<option value='" + data[i].name + "' cityId=" + data[i].id +">" + data[i].name +"</option>");
  611. }
  612. }
  613. }
  614. });
  615. } else {
  616. $("#city").html("");
  617. $(".select2-chosen").eq(1).html("市");
  618. $("#city").append("<option value=''>市</option>");
  619. $("#town").html("");
  620. $(".select2-chosen").eq(2).html("区");
  621. $("#town").append("<option value=''>区</option>");
  622. }
  623. }
  624. function loadTown() {
  625. var cityId = $("#city option:selected").attr("cityId");
  626. if(typeof(cityId) != "undefined") {
  627. $.ajax({
  628. type: 'POST',
  629. dataType: 'json',
  630. data: {'cityId':cityId},
  631. url: '/area/loadTown',
  632. success: function(data) {
  633. $(".select2-chosen").eq(2).html("区");
  634. $("#town").html("");
  635. $("#town").append("<option value=''>区</option>");
  636. for(var i=0; i<data.length; i++) {
  637. if(curTown != null && typeof(curTown) != "undefined" && curTown == data[i].name) {
  638. $("#town").append("<option value='" + data[i].name + "' selected>" + data[i].name +"</option>");
  639. $(".select2-chosen").eq(2).html(curTown);
  640. } else {
  641. $("#town").append("<option value='" + data[i].name + "'>" + data[i].name +"</option>");
  642. }
  643. }
  644. }
  645. });
  646. } else {
  647. $("#town").html("");
  648. $(".select2-chosen").eq(2).html("区");
  649. $("#town").append("<option value=''>区</option>");
  650. }
  651. }
  652. </script>
  653. </body>
  654. </html>