submitorder2.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. {include file="../application/h5/view/wx_book_dinner/header.html"}
  2. <style>
  3. .weui-form-preview-hd {
  4. padding: 0 15px;
  5. position: relative;
  6. text-align: right;
  7. }
  8. .pull-right{
  9. float: right!important;
  10. }
  11. .text-muted{
  12. color: #888888;
  13. }
  14. </style>
  15. <div class="weui-header bg-blue">
  16. <div class="weui-header-left"> <a class="icon icon-109 f-white" href="{:url('tc')}">返回</a> </div>
  17. <h1 class="weui-header-title">订单详情</h1>
  18. <div class="weui-header-right"></div>
  19. </div>
  20. <form id="form" action="{:url('submitorder2')}" enctype="multipart/form-data" method="post" class="ajax-form-order">
  21. <div class="weui_cells_title">所属机构</div>
  22. <div class="weui_cells">
  23. <div class="weui_cell" style="background-color: #ccc;">
  24. <div class="weui_cell_bd weui_cell_primary">
  25. <div class="weui_input" type="readonly" >{$HospitalName}</div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="weui_cells_title">联系方式</div>
  30. <div class="weui_cells weui_cells_form">
  31. <div class="weui_cell">
  32. <div class="weui_cell_hd"><label class="weui_label">姓名<i style="color:red;">*</i></label></div>
  33. <div class="weui_cell_bd weui_cell_primary">
  34. <input class="weui_input" name="name" type="text" value="{$name}" placeholder="请输入姓名">
  35. </div>
  36. </div>
  37. <div class="weui_cell">
  38. <div class="weui_cell_hd"><label class="weui_label">手机号<i style="color:red;">*</i></label></div>
  39. <div class="weui_cell_bd weui_cell_primary">
  40. <input class="weui_input" type="number" name='mobile' value="{$phone}" pattern="[0-9]*" placeholder="请输入号码">
  41. </div>
  42. </div>
  43. </div>
  44. <div class="weui_cells_title">收货地址<i style="color:red;">*</i></div>
  45. <div class="weui_cells">
  46. <div class="weui_cell">
  47. <div class="weui_cell_bd weui_cell_primary">
  48. <textarea id="textarea" readonly class="weui_textarea" name="address" placeholder="请输入“{$HospitalName}”里的具体位置" rows="3">{$address}</textarea>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="weui_cells_title">床号及备注<i style="color:red;">*</i></div>
  53. <div class="weui_cells">
  54. <div class="weui_cell">
  55. <div class="weui_cell_bd weui_cell_primary">
  56. <textarea id="textarea" class="weui_textarea" name="remark" placeholder="请输入床号及备注信息(最多15字)" rows="3"></textarea>
  57. </div>
  58. </div>
  59. </div>
  60. <div id="vueapp">
  61. <input type="hidden" name="goods" id="goods">
  62. <div v-for="(item,index) in lists" :key="index">
  63. <div class="weui_cells_title">{{item.day}} {{item.group}} ¥{{item.money}}</div>
  64. <div class="weui_cells weui_cells_form">
  65. <div v-for="(item2,index2) in item.dinners" :key="index2" class="weui_cell text-muted">
  66. [{{item2.dinner_type_name}}] {{item2.name}} ¥{{item2.money}}*{{item2.nums}}
  67. </div>
  68. </div>
  69. </div>
  70. <div v-if="type == 1" class="weui_cells_title">上传医嘱<i style="color:red;">*</i></div>
  71. <div v-if="type == 1" class="weui_cells">
  72. <div class="weui_cell">
  73. <div class="weui_cell_bd weui_cell_primary">
  74. <input class="weui_input" style="height: auto!important;" type="file" accept="image/png,image/jpeg" name="files">
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <div class="weui_btn_area">
  80. <button type="submit" class="weui_btn weui_btn_primary">提交订单</button>
  81. </div>
  82. <div style="height: 30px;"/>
  83. </form>
  84. <script src="/static/elementui2.15.5/vue-2.6.14.js"></script>
  85. <script>
  86. var vm = new Vue({
  87. el: '#vueapp',
  88. data: {
  89. type: 0, // 0=普通餐 1=含流食
  90. lists:[]
  91. },
  92. created: function () {
  93. let lists = localStorage.getItem('userdinners');
  94. if(!lists){
  95. $.toptips("未选择菜品",'warning');
  96. return false;
  97. }
  98. let dinners = JSON.parse(lists);
  99. console.log('dinners',dinners);
  100. let selected = [];
  101. let ids = [];
  102. dinners.forEach((item) => {
  103. if(item.count > 0){
  104. let ll = [];
  105. item.types.forEach((item2) => {
  106. item2.dinners.forEach((item3) => {
  107. if(item3.nums > 0){
  108. if(item3.type == 1){
  109. this.type = 1;
  110. }
  111. ids.push({id:item3.id,nums:item3.nums});
  112. ll.push({
  113. id: item3.id,
  114. name: item3.name,
  115. imgs: item3.imgs,
  116. money: item3.money,
  117. nums: item3.nums,
  118. dinner_type_id: item3.dinner_type_id,
  119. dinner_type_name: item2.name,
  120. })
  121. }
  122. });
  123. });
  124. selected.push({
  125. count: item.count,
  126. day: item.day,
  127. money: item.money,
  128. group: item.group,
  129. text: item.text,
  130. dinners: JSON.parse(JSON.stringify(ll))
  131. })
  132. }
  133. });
  134. this.lists = JSON.parse(JSON.stringify(selected));
  135. $('#goods').val(JSON.stringify(ids));
  136. console.log('dinners',dinners,selected);
  137. },
  138. methods: {
  139. },
  140. });
  141. </script>
  142. <script type="text/javascript">
  143. $(document).ready(function () {
  144. //提交数据
  145. // $('.ajax-form-order').ajaxSubmit(function(result){
  146. // if(result.code ==1){
  147. // $.toptips(result.message,'warning');
  148. // }else{
  149. // window.location.href = result.url;
  150. // }
  151. // return false;
  152. // });
  153. });
  154. function add() {
  155. $.post('submitorder',$('.ajax-form-order').serialize(),function (result) {
  156. if(result.code ==1){
  157. $.toptips(result.message,'warning');
  158. }else{
  159. window.location.href = result.data.url;
  160. }
  161. },'json')
  162. }
  163. function order() {
  164. layer.open({
  165. content: '请仔细确认您的订单数量及金额。如需退单,仅可在下单当日申请,并联系餐厅人员审核,方可退款。'
  166. ,btn: ['确定', '取消']
  167. ,yes: function(index){
  168. layer.closeAll();
  169. add();
  170. }
  171. });
  172. }
  173. </script>