人人商城

2_recharge.tpl.php 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite) ? (include $this->template('common/header', TEMPLATE_INCLUDEPATH)) : (include template('common/header', TEMPLATE_INCLUDEPATH));?>
  2. <div class="mui-content mc-recharge">
  3. <form method="post" role="form" id="form1">
  4. <input type="hidden" name="c" value="entry" />
  5. <input type="hidden" name="m" value="recharge" />
  6. <input type="hidden" name="i" value="<?php echo $_W['uniacid'];?>" />
  7. <input type="hidden" name="do" value="pay" />
  8. <div class="mui-row mui-mr5 mui-ml5">
  9. <?php if(!empty($recharge_settings['params']['recharge_type']) && !empty($recharge_settings['params']['recharges'])) { ?>
  10. <?php if(is_array($recharge_settings['params']['recharges'])) { foreach($recharge_settings['params']['recharges'] as $key => $row) { ?>
  11. <?php if(!empty($row['back']) && !empty($row['condition'])) { ?>
  12. <div class="mui-col-xs-4 mui-pa5 mui-mt5">
  13. <div class="mui-thumbnail mui-text-center mui-text-info" data-recharge="<?php echo $row['condition'];?>" data-backtype="<?php echo $row['backtype'];?>" data-back="<?php echo $row['back'];?>">
  14. <div class="mui-big mui-rmb"><?php echo $row['condition'];?></div>
  15. <div class="mui-small">
  16. <?php if($row['backtype'] == '0') { ?>
  17. 送<?php echo $row['back'];?>元
  18. <?php } else { ?>
  19. 送<?php echo $row['back'];?>积分
  20. <?php } ?>
  21. </div>
  22. <span class="selected-status"></span>
  23. </div>
  24. </div>
  25. <?php } ?>
  26. <?php } } ?>
  27. <?php } ?>
  28. <div class="mui-col-xs-4 mui-pa5 mui-mt5 other-sum">
  29. <div class="mui-thumbnail mui-text-center mui-text-info js-inputpay">
  30. <input type="text" placeholder="输入金额" name="inputpay" style="display:none;text-align:center;">
  31. <span class="paytext">其他金额</span>
  32. <span class="selected-status"></span>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="mui-section">
  37. 支付金额 <span class="mui-text-success mui-big mui-pull-right add-pay mui-rmb">0元</span>
  38. </div>
  39. <div class="mui-content-padded">
  40. <input type="hidden" name="backtype">
  41. <input type="hidden" name="back">
  42. <input type="hidden" name="token" value="<?php echo $_W['token'];?>">
  43. <input type="hidden" name="fee" />
  44. <button type="submit" name="submit" class="mui-btn mui-btn-success mui-btn-block dopay" value="确认充值">确认充值</button>
  45. </div>
  46. </form>
  47. </div>
  48. <script>
  49. $(function(){
  50. $('.mui-thumbnail').click(function(){
  51. $('.add-pay').addClass('mui-rmb');
  52. $('.mui-thumbnail').removeClass('selected');
  53. $(this).addClass('selected');
  54. $('.paytext').show();
  55. $('input[name="inputpay"]').hide();
  56. var backtype = $(this).data('backtype');
  57. var back = $(this).data('back');
  58. var recharge = $(this).data('recharge');
  59. $('input[name="back"]').val(back);
  60. $('input[name="backtype"]').val(backtype);
  61. exists = $(this).hasClass('js-inputpay');
  62. if (exists) {
  63. $('.paytext').hide();
  64. $('input[name="inputpay"]').show();
  65. $('input[name="inputpay"]').focus();
  66. $('input[name="backtype"]').val('2');
  67. recharge = $('input[name="inputpay"]').val();
  68. if(!recharge) {
  69. recharge = 0;
  70. }
  71. if(isNaN(recharge)) {
  72. util.toast('请输入正确的金额', '', 'error');
  73. $('.dopay').attr('href', 'javascript:;');
  74. $('input[name="fee"]').val('0');
  75. $('.add-pay').text(0 + '元');
  76. return;
  77. }
  78. }
  79. $('input[name="fee"]').val(recharge);
  80. $('.add-pay').text(recharge + '元');
  81. })
  82. $('input[name="inputpay"]').bind('input propertchange', function() {
  83. $('.add-pay').addClass('mui-rmb');
  84. $('.mui-thumbnail').removeClass('selected');
  85. var recharge = $('input[name="inputpay"]').val();
  86. if(isNaN(recharge) || recharge <= 0) {
  87. util.toast('请输入正确的金额', '', 'error');
  88. $('.dopay').attr('href', 'javascript:;');
  89. return false;
  90. }
  91. $('input[name="fee"]').val(recharge);
  92. $('.add-pay').text(recharge + '元');
  93. })
  94. $(document).on('click', '.dopay', function() {
  95. var recharge = $('input[name="fee"]').val();
  96. recharge = parseFloat(recharge);
  97. if(isNaN(recharge)) {
  98. util.toast('请输入正确的金额', '', 'error');
  99. $('input[name="inputpay"]').val('');
  100. return false;
  101. }
  102. if(!recharge || recharge == '0') {
  103. $('input[name="inputpay"]').val('');
  104. util.toast('请输入或选择充值金额', '', 'error');
  105. return false;
  106. }
  107. })
  108. })
  109. </script>