buyClient.ftl 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <div class="weui-btn-area">
  2. <div style="display:flex; flex-direction: row; justify-content: space-between">
  3. <div class="weui-flex__item">
  4. <div class="placeholder" style="display: inline;align-items: flex-start">当前参团:</div>
  5. <div style="display: inline;align-items: flex-start" id="Buycount"></div>
  6. </div>
  7. </div>
  8. <div class="weui-flex__item">
  9. <div style="display: inline;align-items: flex-end">状&nbsp;&nbsp;&nbsp;&nbsp;态:</div>
  10. <div style="display: inline;" id="myStatus"></div>
  11. </div>
  12. <div class="weui-flex" style="display:flex; flex-direction: row; justify-content: space-between">
  13. <div class="weui-flex__item">
  14. <div style="display: inline;align-items: flex-start">我的团购:</div>
  15. <div style="display: inline;">
  16. <input type="text" id="buyCount"
  17. style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh; width: 20%;"
  18. maxlength="3" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" min="1"
  19. onchange="changeBuy()">
  20. </div>
  21. </div>
  22. </div>
  23. <div class="weui-flex__item" >
  24. <div style="display: inline;">金&nbsp;&nbsp;&nbsp;&nbsp;额¥:</div>
  25. <div style="display: inline;" id="myMenory"></div>
  26. </div>
  27. <div class="weui-flex">
  28. <div class="weui-flex__item">
  29. <div style="display: inline;">联系电话:</div>
  30. <div class="weui-flex__item" style="display: inline;">
  31. <input type="text" maxlength="11" id="myPhone" onkeyup="value=value.replace(/[^\d]/g,'')"
  32. maxlength=11
  33. style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh; width: 50%;"">
  34. </div>
  35. </div>
  36. </div>
  37. <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
  38. <div style="color:#1e282c;height: 5vh; line-height: 5vh;margin-right: 2vw;width: 13%;">备注:</div>
  39. <textarea id="Myremarks" class="weui-textarea" placeholder="输入内容(200字内)" rows="3"
  40. style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; margin-top: 1vh;"></textarea>
  41. </div>
  42. <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh; margin-bottom: 5vh;">
  43. <#if type==1>
  44. <a id="buyBack" onclick="buyBack()" href="javascript:;" class="weui-btn weui-btn_default"
  45. style="width: 30%;">返回</a>
  46. <#else>
  47. <a id="MybuyRepeal" onclick="MybuyBack()" href="javascript:;" class="weui-btn weui-btn_default"
  48. style="width: 30%;">撤销</a>
  49. </#if>
  50. <a id="buyCommit" onclick="buyCommit()" href="javascript:;" class="weui-btn weui-btn_primary"
  51. style="margin-top: 0;width: 30%;">提交</a>
  52. </div>
  53. </div>
  54. <#include "/home/frag.foot.ftl" />
  55. <script>
  56. (function ($) {
  57. $.ajax({
  58. url: '/query/getAll/status',
  59. data: {
  60. jmId: $('#jmBuy').val(),
  61. },
  62. type: 'GET',
  63. success: function (data) {
  64. console.log(data);
  65. $("#Buycount").html(data.data.count)
  66. $("#myStatus").html(getStatus(data.data.tgStatus))
  67. /* $("#myMenory").html(data.data.tgPrice)*/
  68. },
  69. error: function () {
  70. }
  71. });
  72. })(jQuery);
  73. <#--返回-->
  74. function buyBack() {
  75. window.location.href = "/user/homeIndex.html?userId=" + $('#buyuserId').val() + "&userType=" + 1 + '#tab3';
  76. }
  77. /*撤销*/
  78. function MybuyBack() {
  79. $.ajax({
  80. url: '/home/back/buyBack',
  81. data: {
  82. userId: $('#buyuserId').val(),
  83. buyCount: $('#buyCount').val(),
  84. phone: $('#myPhone').val(),
  85. myRemark: $('#Myremarks').val(),
  86. buyMoney: $('#myMenory').text(),
  87. jmId: $('#jmBuy').val(),
  88. },
  89. type: 'GET',
  90. success: function (data) {
  91. console.log(data);
  92. if (data.data == 1) {
  93. buyBack();
  94. } else {
  95. $.alert("该套餐已过截止日期或者已发货中不允许撤单");
  96. }
  97. },
  98. error: function () {
  99. }
  100. });
  101. }
  102. //提交
  103. function buyCommit() {
  104. if ($('#buyCount').val() == '' || $('#buyCount').val() == undefined) {
  105. $.alert("请填写团购数量");
  106. return;
  107. }
  108. if ($('#myPhone').val() == undefined || $('#myPhone').val() == '') {
  109. $.alert("请填写联系电话");
  110. return;
  111. }
  112. /* if ($('#Myremarks').val() == undefined || $('#Myremarks').val() == '') {
  113. $.alert("请填写备注");
  114. return;
  115. }*/
  116. $.ajax({
  117. url: '/home/home/buyGroup',
  118. data: {
  119. userId: $('#buyuserId').val(),
  120. buyCount: $('#buyCount').val(),
  121. phone: $('#myPhone').val(),
  122. myRemark: $('#Myremarks').val(),
  123. buyMoney: $('#myMenory').text(),
  124. jmId: $('#jmBuy').val(),
  125. },
  126. type: 'GET',
  127. success: function (data) {
  128. console.log(data.data);
  129. buyBack();
  130. },
  131. error: function () {
  132. }
  133. });
  134. }
  135. //输入购买的数量
  136. function changeBuy() {
  137. $.ajax({
  138. url: '/query/getAll/status',
  139. data: {
  140. jmId: $('#jmBuy').val(),
  141. },
  142. type: 'GET',
  143. success: function (data) {
  144. console.log(data);
  145. $("#myMenory").html($('#buyCount').val() * data.data.tgPrice)
  146. },
  147. error: function () {
  148. }
  149. });
  150. }
  151. //1 在团 2 发货 3完成 4取消',
  152. function getStatus(v) {
  153. if (v == 1) {
  154. return "<span style='color:green;'>在团</span>";
  155. } else if (v == 2) {
  156. return "<span style='color:Black;'>发货</span>";
  157. } else if (v == 3) {
  158. return "完成";
  159. } else if (v == 4) {
  160. return "<span style='color:red;'>取消</span>";
  161. }
  162. }
  163. </script>