confirmorder.cshtml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html>
  3. <head lang="en">
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  6. <meta name="viewport" content="height=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
  7. <title>确认推送订单</title>
  8. <link rel="stylesheet" href="css/common.css" />
  9. <link rel="stylesheet" href="css/register.css" />
  10. <script type="text/javascript" src="/lib/jquery/dist/jquery.js"></script>
  11. <script>
  12. $(function () {
  13. var json = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(@ViewData["rddata"]).Replace('/','_').Replace('\\','_'))';
  14. var obj = JSON.parse(json);
  15. var group = {};
  16. function initGroup(feedbacks) {
  17. for (var t in feedbacks['pfbs']) {
  18. if (!group[obj['pfbs'][t]['SuppliersId']]) {
  19. group[obj['pfbs'][t]['SuppliersId']] = obj['pfbs'][t]['BusinessName'];
  20. }
  21. }
  22. var inputhtml = '<div class="message" name="group" id="group" data="">' +
  23. '<span id="BusinessName"></span>' +
  24. '发货方式:<select name="ReceiveMd" id="ReceiveMd" placeholder="发货方式" required></select>' +
  25. '到货日期:<input name="RequestDate" id="RequestDate" type="date" placeholder="到货日期" pattern="" required />' +
  26. '</div>';
  27. for (var i in group) {
  28. var htmldom = inputhtml.replace('id="group"', 'id="group_' + i + '"').replace('data=""', 'data="' + i + '"')
  29. .replace('BusinessName">', 'BusinessName">'+group[i]);
  30. $("#form66").prepend(htmldom);
  31. }
  32. }
  33. group = initGroup(obj);
  34. function submit_22() {
  35. if (!obj) {
  36. alert("数据出现错误,请联系人开发人员!");
  37. return false;
  38. }
  39. var groupdom = $("div[name=group]");
  40. for (var i = 0; i < groupdom.length; i++ ) {
  41. var ReceiptMd = $(groupdom[i]).find("#ReceiveMd").val();
  42. var RequestDate = $(groupdom[i]).find("#RequestDate").val();
  43. var SuppliersId = $(groupdom[i]).attr("data");
  44. if (jQuery.trim($("#ReceiveMd").val()) == '') {
  45. alert("前填写发货方式");
  46. return false;
  47. }
  48. if (jQuery.trim($("#RequestDate").val()) == '') {
  49. alert("前填写到货日期");
  50. return false;
  51. }
  52. for (var t in obj['pfbs']) {
  53. //alert(JSON.stringify(obj['pfbs'][t]));
  54. if (obj['pfbs'][t]['SuppliersId'] == SuppliersId) {
  55. obj['pfbs'][t]['ReceiptMd'] = ReceiptMd;
  56. obj['pfbs'][t]['RequestDate'] = RequestDate;
  57. }
  58. }
  59. }
  60. json = JSON.stringify(obj);
  61. $.ajax({
  62. headers: {
  63. "Sso-Token":"@ViewData["staffId"]",
  64. },
  65. type: "POST",
  66. url: "/web/supplypush/confirmfeedback/" + "@ViewData["staffId"]" + "/4",
  67. contentType: "application/json; charset=utf-8",
  68. data: json,
  69. dataType: 'json',
  70. beforeSend: function (request) {
  71. request.setRequestHeader("Sso-Token", "@ViewData["staffId"]");
  72. },
  73. success: function (message) {
  74. if (message.success) {
  75. alert("订单已提交!");
  76. } else {
  77. alert(message.msg);
  78. }
  79. },
  80. error: function (message) {
  81. $("#request-process-patent").html("提交数据失败!");
  82. }
  83. });
  84. }
  85. $("#subconfirm").on("click",submit_22);
  86. $.ajax({
  87. type: "GET",
  88. url: "/web/purchaseplan/receiptmds",
  89. contentType: "application/json; charset=utf-8",
  90. dataType: 'json',
  91. beforeSend: function (request) {
  92. request.setRequestHeader("Sso-Token", "@ViewData["staffId"]");
  93. },
  94. success: function (data) {
  95. if (data && data.length) {
  96. var options = '';
  97. for (var i in data) {
  98. options += '<option value=' + data[i].value + ' ' + ((data[i].value === "2") ? 'selected' : '')+ '>' + data[i].label + '</option>';
  99. }
  100. $("#ReceiveMd").append(options);
  101. } else {
  102. alert("提取数据为空!");
  103. }
  104. },
  105. error: function (message) {
  106. $("#request-process-patent").html("提取数据失败!");
  107. }
  108. });
  109. });
  110. </script>
  111. </head>
  112. <body>
  113. <div class="register">
  114. <div class="regTop">
  115. <span>确认推送订单</span>
  116. </div>
  117. <div class="content">
  118. <div class="point">
  119. <span>
  120. 订单明细:
  121. <br />
  122. <br />
  123. @foreach (var x in (List<Dictionary<String, Object>>)ViewData["data"])
  124. {
  125. <ul>
  126. <li>@x["GoodsName"]</li>
  127. <li>供应数量:@x["StoreGapNum"]盒</li>
  128. <li>需求量:@x["PurchaseTotalNum"]盒</li>
  129. <li>标准进价:@x["ActPrice"]</li>
  130. <li>实际进价:@x["PurPrice"]</li>
  131. <li>@x["BusinessName"]</li>
  132. <li>@x["GoodsSpec"]</li>
  133. <li>@x["Manufacturer"]</li>
  134. <li>@x["BrandName"]</li>
  135. </ul>
  136. <br />
  137. }
  138. </span>
  139. <div id="request-process-patent"></div>
  140. <form action="/web/supplymobile/" enctype="multipart/form-data" method="post" name="form66" id="form66">
  141. <button class="submit" type="button" id="subconfirm">确认</button>
  142. </form>
  143. </div>
  144. </div>
  145. </div>
  146. </body>
  147. </html>