pay_xfb.blade.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <!DOCTYPE html>
  2. <html class="bg-white">
  3. <head>
  4. <meta charset="utf-8">
  5. <!--此行代码为禁止苹果手机自动识别电话号码-->
  6. <meta name="format-detection" content="telephone=no">
  7. <meta name="viewport"
  8. content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
  9. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  10. <title>{{$shop_info['shop_name']}}支付</title>
  11. <link rel="stylesheet" type="text/css" href="{{asset('wap/css/weui.min.css')}}"/>
  12. <link rel="stylesheet" type="text/css" href="{{asset('wap/two/common.css')}}?t=43543543543"/>
  13. <link rel="stylesheet" type="text/css" href="{{asset('wap/two/pay-page.css')}}?t=43645645654654fdgfd"/>
  14. <link rel="stylesheet" type="text/css" href="{{asset('wap/two/keyboard.css')}}?t=4334543"/>
  15. <link rel="stylesheet" type="text/css" href="{{asset('wap/two/font/iconfont.css')}}"/>
  16. <script src="{{asset('wap/js/jquery-2.1.4.js')}}"></script>
  17. <script src="{{asset('wap/js/vue.js')}}?a=1"></script>
  18. <script src="{{asset('wap/js/common.js')}}?a=1"></script>
  19. </head>
  20. <body>
  21. <div id="app">
  22. <div class="layout">
  23. <!-- 导航栏 -->
  24. <div class="nav-bar">
  25. <!-- <div>
  26. <img src="./images//组 49@2x.png" class="nav-img">
  27. </div> -->
  28. <div class="nav-title">{{$shop_info['shop_name']}}</div>
  29. <!-- <div>
  30. <img src="./images/组 117@2x.png" class="nav-img">
  31. </div> -->
  32. </div>
  33. <!-- 支付详情 -->
  34. <form id="zfb_pay" method="post" action="{{route('pay.zfb_pay')}}">
  35. <div class="pay-detail">
  36. <div class="pay-layout">
  37. <div class="spend-total">消费总额</div>
  38. <div class="input-money">
  39. <span>¥</span>
  40. <input type="text" readonly="readonly" v-model="pay_money" name="pay_money" mix="0.01" ref="textarea">
  41. <input type="hidden" name="shop_id" value="{{$shop_info['id']}}"></input>
  42. </div>
  43. <div class="prompt">可询问工作人员应缴费用总额</div>
  44. </div>
  45. </div>
  46. </form>
  47. <!-- button -->
  48. <div class="button-layout" @click="creatZfbPay">
  49. <div class="button">
  50. <span>支付</span>
  51. </div>
  52. </div>
  53. <div class="block"></div>
  54. <div class="keyboard">
  55. <div class="one-row row">
  56. <div class="key" @click="pressKey('1')">1</div>
  57. <div class="key" @click="pressKey('2')">2</div>
  58. <div class="key" @click="pressKey('3')">3</div>
  59. </div>
  60. <div class="two-row row">
  61. <div class="key" @click="pressKey('4')">4</div>
  62. <div class="key" @click="pressKey('5')">5</div>
  63. <div class="key" @click="pressKey('6')">6</div>
  64. </div>
  65. <div class="three-row row">
  66. <div class="key" @click="pressKey('7')">7</div>
  67. <div class="key" @click="pressKey('8')">8</div>
  68. <div class="key" @click="pressKey('9')">9</div>
  69. </div>
  70. <div class="four-row row">
  71. <div class="key key-dot" @click="pressKey('.')"><div class="dot"></div></div>
  72. <div class="key" @click="pressKey('0')">0</div>
  73. <div class="key key-dot" @click="pressKey('x')" @touchstart="gtouchstart()" @touchmove="gtouchmove()" @touchend="gtouchend()"><span class="iconfont icon-24gl-delete"></span></div>
  74. </div>
  75. </div>
  76. </div>
  77. <!--BEGIN toast-->
  78. <div id="toast" style="display: none;">
  79. <div class="weui-mask_transparent"></div>
  80. <div class="weui-toast">
  81. <i class="weui-icon-success-no-circle weui-icon_toast"></i>
  82. <p class="weui-toast__content">@{{success_msg}}</p>
  83. </div>
  84. </div>
  85. <!--BEGIN toast-->
  86. <div id="textMoreToast" v-show="error_show">
  87. <div class="weui-mask_transparent"></div>
  88. <div class="weui-toast weui-toast_text-more">
  89. <i class="weui-icon-warn weui-icon_toast"></i>
  90. <p class="weui-toast__content">@{{error_msg}}</p>
  91. </div>
  92. </div>
  93. </div>
  94. <script>
  95. $(function () {
  96. var vm = new Vue({
  97. el: '#app',
  98. data: {
  99. pay_money: '',
  100. success_msg: '',
  101. error_msg: '',
  102. error_show: false,
  103. success_show: false,
  104. is_pay: false,
  105. is_ajax: false,
  106. payStr: '',
  107. longStatus: false,
  108. timeOutEvent: null,
  109. intervalEvent: null,
  110. },
  111. methods: {
  112. 'gtouchstart': function () {
  113. this.timeOutEvent = setTimeout(function () {
  114. vm.longStatus = true;
  115. vm.intervalEvent = setInterval(function () {
  116. console.log('定时任务执行了')
  117. let ret= vm.pressKey('x')
  118. if(!ret){
  119. clearInterval(vm.intervalEvent);
  120. }
  121. console.log(ret)
  122. }, 100)
  123. }, 500);//这里设置定时器,定义长按500毫秒触发长按事件,时间可以自己改,个人感觉500毫秒非常合适
  124. return false;
  125. },
  126. //手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件
  127. 'gtouchend': function () {
  128. if(this.intervalEvent) clearInterval(this.intervalEvent);
  129. if(this.timeOutEvent) clearTimeout(this.timeOutEvent);//清除定时器
  130. return false;
  131. },
  132. //如果手指有移动,则取消所有事件,此时说明用户只是要移动而不是长按
  133. 'gtouchmove': function () {
  134. if(this.intervalEvent) clearInterval(this.intervalEvent);
  135. if(this.timeOutEvent) clearTimeout(this.timeOutEvent);//清除定时器
  136. return false;
  137. },
  138. 'pressKey': function (key) {
  139. if (key === 'x') {
  140. console.log(key)
  141. if (this.payStr.length <= 0) {
  142. return false;
  143. }
  144. this.payStr = this.payStr.substr(0, this.payStr.length - 1);
  145. } else {
  146. let dNum = this.payStr.indexOf(".");
  147. if (dNum >= 0) {
  148. if (this.payStr.length - dNum >= 3) {
  149. return false;
  150. }
  151. }
  152. if (key === '.') {
  153. if (dNum >= 0) {
  154. return false;
  155. }
  156. } else if (key === '0') {
  157. if (this.payStr.length === 1 && this.payStr === '0') {
  158. return false;
  159. }
  160. }
  161. this.payStr = this.payStr + key;
  162. }
  163. this.pay_money = this.payStr;
  164. console.log(this.payStr)
  165. return true;
  166. },
  167. 'errorMgs': function (error_msg) {
  168. this.error_msg = error_msg;
  169. this.error_show = true;
  170. setTimeout(function () {
  171. vm.error_show = false;
  172. }, 2000)
  173. },
  174. 'successMsg': function (success_msg) {
  175. this.success_msg = success_msg;
  176. this.success_show = true;
  177. setTimeout(function () {
  178. vm.success_show = false;
  179. }, 2000)
  180. },
  181. 'creatZfbPay': function () {
  182. if (isNaN(this.pay_money) || this.pay_money * 1 < 0) {
  183. this.pay_money = '';
  184. this.errorMgs('支付金额不合法');
  185. return false;
  186. }
  187. if (this.pay_money * 1 < 0.01) {
  188. this.errorMgs('最低支付金额0.01元');
  189. return false;
  190. }
  191. if (this.is_ajax) {
  192. return false;
  193. }
  194. this.is_ajax = true;
  195. $('#zfb_pay').submit();
  196. }
  197. },
  198. watch: {
  199. 'pay_money': function () {
  200. if (this.pay_money * 1 == 0) {
  201. this.is_pay = false;
  202. return false;
  203. }
  204. this.is_pay = true;
  205. }
  206. },
  207. created: function () {
  208. console.log('------------------')
  209. }
  210. });
  211. })
  212. </script>
  213. <script>
  214. (function (doc, win) {
  215. var docEl = win.document.documentElement;
  216. var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
  217. var refreshRem = function () {
  218. var clientWidth = win.innerWidth ||
  219. doc.documentElement.clientWidth ||
  220. doc.body.clientWidth;
  221. console.log(clientWidth)
  222. if (!clientWidth) return;
  223. var fz;
  224. var width = clientWidth;
  225. fz = 16 * width / 375;
  226. docEl.style.fontSize = fz + 'px';
  227. };
  228. if (!doc.addEventListener) return;
  229. win.addEventListener(resizeEvt, refreshRem, false);
  230. doc.addEventListener('DOMContentLoaded', refreshRem, false);
  231. refreshRem();
  232. })(document, window)
  233. </script>
  234. </body>
  235. </html>