consume.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. {php define('MUI', true);}
  2. {template 'common/header'}
  3. <div class="mui-content scan-pay">
  4. <form action="{php echo url('mc/card/consume')}" method="post" id="pay-form">
  5. <div class="mui-pa10 mui-bg-white">
  6. <h5 class="mui-desc-title">请选择门店</h5>
  7. <div class="mui-input-row">
  8. <input class="js-user-options" type="text" value="" readonly="" placeholder="请选择门店">
  9. <input type="hidden" name="store_id">
  10. </div>
  11. <h5 class="mui-desc-title">设置付款金额</h5>
  12. <div class="mui-input-row"><input type="text" value="" name="fee" placeholder="输入金额"/></div>
  13. <button class="mui-btn mui-btn-success mui-btn-block">付款</button>
  14. <input type="hidden" name="token" value="{$_W['token']}"/>
  15. <input type="hidden" name="submit" value="{$_W['token']}"/>
  16. </div>
  17. </form>
  18. </div>
  19. <script>
  20. require(['jquery.qrcode'], function(){
  21. stores = {php echo json_encode($stores_data)};
  22. $('#pay-form').submit(function(){
  23. var fee = $.trim($('#pay-form :text[name="fee"]').val());
  24. var store_id = $('input[name="store_id"]').val();
  25. reg = /^[0-9]+([.]{1}[0-9]{1,2})?$/;
  26. if (stores.data.length >= 1) {
  27. if (!store_id) {
  28. util.toast('请选择门店', '', 'error');
  29. return false;
  30. }
  31. }
  32. if(!fee) {
  33. util.toast('付款金额应大于0', '', 'error');
  34. return false;
  35. }
  36. if (!reg.test(fee)) {
  37. $('#pay-form :text[name="fee"]').val('');
  38. util.toast('付款金额有误', '', 'error')
  39. return false;
  40. }
  41. return true;
  42. });
  43. $(".js-user-options").on("tap", function(){
  44. if (stores.data.length == 0) {
  45. util.toast('当前无可用门店');
  46. return false;
  47. }
  48. var $this = $(this);
  49. util.poppicker(stores, function(items){
  50. $('input[name="store_id"]').val(items[0].value);
  51. $this.val(items[0].text);
  52. });
  53. });
  54. });
  55. </script>
  56. {template 'mc/footer'}
  57. {template 'common/footer'}