binding.blade.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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>员工微信账户绑定</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/css/common.css')}}"/>
  13. <link rel="stylesheet" type="text/css" href="{{asset('wap/css/pay-page.css')}}"/>
  14. <script src="{{asset('wap/js/jquery-2.1.4.js')}}"></script>
  15. <script src="{{asset('wap/js/vue.js')}}?a=1"></script>
  16. <script src="{{asset('wap/js/common.js')}}??aaa={{time()}}"></script>
  17. <script src="{{asset('wap/js/jweixin-1.6.0.js')}}?a=1"></script>
  18. </head>
  19. <body>
  20. <div id="app" style="min-height: 100vh;background-color: #fff">
  21. <div class="binding" >
  22. <div class="content" v-if="code*1==1">
  23. <div class="prompt">当前微信是否绑定此店铺员工账户</div>
  24. <div class="account">员工账户:@{{data.staff_phone}}</div>
  25. <div class="user">
  26. <img class="userImg" :src="data.shop_logo" alt=""/>
  27. <div class="userName">@{{data.shop_name}}</div>
  28. </div>
  29. <div class="allow" @click="setBinding(1)">允许</div>
  30. <div class="refuse" @click="setBinding(2)">拒绝</div>
  31. </div>
  32. <div class="failureContent" v-else>
  33. <img class="failureImg" v-if="code*1==0" src="{{asset('wap/images/lose.png')}}" alt=""/>
  34. <img v-else class="failureImg" src="{{asset('wap/images/win.png')}}" alt=""/>
  35. <div class="bindingLose" v-if="code*1==0">绑定失败</div>
  36. <div v-else class="bindingLose">绑定成功</div>
  37. <div class="loseWhy">@{{msg}}</div>
  38. <div class="determine" @click="closeWxWindow" >确定</div>
  39. </div>
  40. </div>
  41. </div>
  42. <script>
  43. $(function () {
  44. var vm = new Vue({
  45. el: '#app',
  46. data: {
  47. code: "{{$code==0?0:1}}",
  48. msg: "{{$msg}}",
  49. data:{!! $data !!},
  50. wx_config: {
  51. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  52. appId: "{{$wx_js['appid']}}", // 必填,公众号的唯一标识
  53. timestamp: {{$wx_js['timestamp']}}, // 必填,生成签名的时间戳
  54. nonceStr: "{{$wx_js['noncestr']}}", // 必填,生成签名的随机串
  55. signature: "{{$wx_js['signature']}}",// 必填,签名
  56. jsApiList: ['closeWindow'] // 必填,需要使用的JS接口列表
  57. },
  58. },
  59. methods: {
  60. startWx: function () {
  61. wx.config(this.wx_config);
  62. wx.error(function (res) {
  63. // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
  64. console.log(res);
  65. });
  66. },
  67. closeWxWindow:function (){
  68. wx.closeWindow();
  69. },
  70. setBinding: function (status) {
  71. //员工信息绑定
  72. // alert('调试开始')
  73. {{-- alert('{{route('member.set_bind')}}')--}}
  74. // alert(JSON.stringify({
  75. // 'binding_code': this.data.binding_code,
  76. // 'status': status,
  77. // }))
  78. sendAjax('{{route('member.set_bind')}}', {
  79. 'binding_code': this.data.binding_code,
  80. 'status': status,
  81. }, function (data) {
  82. if (data.code * 1 == 1) {
  83. vm.code = 2;
  84. vm.msg = data.msg;
  85. } else {
  86. vm.code = 0;
  87. vm.msg = data.msg;
  88. }
  89. })
  90. }
  91. },
  92. watch: {
  93. },
  94. created: function () {
  95. this.startWx();
  96. sendAjax('{{route('member.set_bind')}}', {
  97. 'binding_code': '',
  98. 'status': '',
  99. },function (data){
  100. })
  101. }
  102. });
  103. })
  104. </script>
  105. <style scoped>
  106. .binding {
  107. width: 100%;
  108. min-height: 100vh;
  109. background: #ffffff;
  110. }
  111. .binding .head {
  112. width: 100%;
  113. height: 44px;
  114. background: #f7f7f7;
  115. padding: 10px 0 10px 17px;
  116. }
  117. .binding .head .close {
  118. font-weight: 600;
  119. color: #333333;
  120. font-size: 17px;
  121. }
  122. .binding .content {
  123. padding: 20px 17px 0 18px;
  124. }
  125. .prompt {
  126. color: #333333;
  127. margin-bottom: 11px;
  128. }
  129. .account {
  130. font-size: 20px;
  131. color: #333333;
  132. font-weight: 600;
  133. }
  134. .user {
  135. width: 100%;
  136. min-height: 70px;
  137. padding: 12px 0;
  138. border-top: 0.5px solid #f2f2f2;
  139. border-bottom: 0.5px solid #f2f2f2;
  140. display: flex;
  141. align-items: center;
  142. margin: 22px 0 40px 0;
  143. }
  144. .userImg {
  145. width: 64px;
  146. height: 64px;
  147. margin: 0 10px 0 0;
  148. }
  149. .userName {
  150. font-size: 17px;
  151. font-weight: 500;
  152. color: #333333;
  153. }
  154. .allow {
  155. width: 170px;
  156. height: 44px;
  157. background: #07c160;
  158. border-radius: 6px;
  159. margin-bottom: 15px;
  160. text-align: center;
  161. line-height: 44px;
  162. color: #ffffff;
  163. margin: 0 auto 15px;
  164. }
  165. .refuse {
  166. width: 170px;
  167. height: 44px;
  168. background: #f2f2f2;
  169. color: #05b156;
  170. border-radius: 6px;
  171. text-align: center;
  172. line-height: 44px;
  173. margin: 0 auto;
  174. }
  175. /* 失败 */
  176. .failureContent {
  177. width: 100%;
  178. height: auto;
  179. padding: 36px 17px 0;
  180. text-align: center;
  181. }
  182. .failureImg {
  183. width: 72px;
  184. height: 72px;
  185. display: block;
  186. margin: 0 auto 20px;
  187. }
  188. .bindingLose {
  189. font-weight: 500px;
  190. color: #333333;
  191. font-size: 17px;
  192. }
  193. .loseWhy {
  194. font-size: 12px;
  195. color: #666666;
  196. margin: 12px 0 20px 0;
  197. }
  198. .determine {
  199. width: 100%;
  200. height: 44px;
  201. color: #ffffff;
  202. background: #07c160;
  203. text-align: center;
  204. line-height: 44px;
  205. border-radius: 6px;
  206. }
  207. </style>
  208. </body>
  209. </html>