meal.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <style>
  4. .layui-input-block button {
  5. border: 1px solid rgba(0, 0, 0, 0.1);
  6. }
  7. .layui-card-body {
  8. padding-left: 10px;
  9. padding-right: 10px;
  10. }
  11. .layui-card-body p.layuiadmin-big-font {
  12. font-size: 36px;
  13. color: #666;
  14. line-height: 36px;
  15. padding: 5px 0 10px;
  16. overflow: hidden;
  17. text-overflow: ellipsis;
  18. word-break: break-all;
  19. white-space: nowrap;
  20. }
  21. .layui-fluid .layui-row . {
  22. position: absolute;
  23. right: 15px;
  24. }
  25. .layuiadmin-badge {
  26. top: 50%;
  27. margin-top: -9px;
  28. color: #01AAED;
  29. }
  30. .layuiadmin-span-color i {
  31. padding-left: 5px;
  32. }
  33. .layui-card.card {
  34. border: 2px solid #F2F2F2;
  35. border-radius: 2%;
  36. }
  37. .layui-card.checkcard {
  38. border: 2px solid #F47822;
  39. border-radius: 5px;
  40. }
  41. .block-rigit button {
  42. width: 100px;
  43. letter-spacing: .5em;
  44. line-height: 28px;
  45. }
  46. .layui-form-item {
  47. margin-bottom: .5rem;
  48. }
  49. .layui-form-item .code {
  50. width: 15rem;
  51. }
  52. .layui-form-item .code img {
  53. width: 100%;
  54. height: 100%;
  55. }
  56. </style>
  57. <script src="{__PLUG_PATH}echarts.common.min.js"></script>
  58. {/block}
  59. {block name="content"}
  60. <div class="layui-fluid" id="app" v-cloak>
  61. <div class="layui-row layui-col-space15">
  62. <div class="layui-card">
  63. <div class="layui-card-header">
  64. 购买服务
  65. </div>
  66. <div class="layui-tab layui-tab-brief" lay-filter="tab">
  67. <ul class="layui-tab-title">
  68. <li lay-id="list" class="layui-this" @click="changeMealType('sms')">短信
  69. </li>
  70. <li lay-id="list" @click="changeMealType('expr_query')">物流查询
  71. </li>
  72. </ul>
  73. </div>
  74. <div class="layui-row">
  75. <div class="layui-card-body layui-col-space10">
  76. <div class="layui-col-sm1 layui-col-md2" v-if="priceList.length" v-for="(item,index) in priceList"
  77. @click="checkMeal(item,index)">
  78. <div class="layui-card" :class="param == index ? 'checkcard' : 'card'">
  79. <div class="layui-card-body" style="padding: 27px 15px 0;">
  80. <p style="text-align: center;color: #F47822;font-size: 30px;line-height: 30px;">{{item.num }}条</p>
  81. </div>
  82. <div class="layui-card-header">
  83. <p style="text-align: center;color: #C2C5BE;font-size: 16px;">¥{{ item.price }}</p>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="layui-row layui-col-space15">
  91. <div class="layui-card" v-show="checked">
  92. <div class="layui-card-header">
  93. 立即支付
  94. </div>
  95. <div class="layui-card-body">
  96. <div class="layui-row">
  97. <form class="layui-form" action="">
  98. <div class="layui-form-item">
  99. <label class="layui-form-label">短信账户:</label>
  100. <div class="layui-input-block">
  101. <span style="font-size: 24px;line-height: 33px;">{$info['account']}</span>
  102. </div>
  103. </div>
  104. <div class="layui-form-item">
  105. <label class="layui-form-label">支付方式:</label>
  106. <div class="layui-input-block">
  107. <button type="button" class="layui-btn" :class="payType == 'weixin'? 'layui-btn-normal' : 'layui-btn-primary'" @click="changeType('weixin')">微信支付
  108. </button>
  109. <!-- <button type="button" class="layui-btn" :class="payType == 'alipay'? 'layui-btn-normal' : 'layui-btn-primary'" @click="changeType('alipay')">支付宝-->
  110. <!-- </button>-->
  111. </div>
  112. </div>
  113. <div class="layui-form-item">
  114. <label class="layui-form-label">充值条数:</label>
  115. <div class="layui-input-block">
  116. <span style="font-size: 24px;line-height: 33px;">{{ checked.num }} 条</span>
  117. </div>
  118. </div>
  119. <div class="layui-form-item">
  120. <label class="layui-form-label">支付金额:</label>
  121. <div class="layui-input-block">
  122. <p style="line-height: 33px;font-size: 16px;color: #F47822;">¥{{ checked.price }}</p>
  123. </div>
  124. </div>
  125. <div class="layui-form-item" v-show="code.code_show">
  126. <div class="layui-input-block code" >
  127. <div id="qrcode" style="width:100px; height:100px; margin-top:15px;"></div>
  128. </div>
  129. <div class="layui-input-block">
  130. <span>
  131. 支付码过期时间:{{code.invalid}}
  132. </span>
  133. </div>
  134. </div>
  135. <div class="layui-form-item" v-show="!code.code_show">
  136. <span>您尚未开通短信服务,请先开启<a href="{:Url('setting.systemPlat/sms_open')}" style="color: rgb(244, 120, 34);font-size: 20px;">开通服务</a></span>
  137. </div>
  138. </form>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  146. <script src="{__ADMIN_PATH}js/qrcode.js"></script>
  147. <script>
  148. require(['vue'], function (Vue) {
  149. new Vue({
  150. el: "#app",
  151. data: {
  152. type: 'sms',
  153. number: 0,
  154. send_total: 0,
  155. option: {},
  156. status: '',
  157. data: '',
  158. title: '全部商品',
  159. myChart: {},
  160. showtime: false,
  161. priceList: [],
  162. checked: false,
  163. param: '',
  164. payType: 'weixin',
  165. code: '',
  166. qrcode: ''
  167. },
  168. watch: {
  169. "param": function (newVal) {
  170. let that = this;
  171. that.checked = that.priceList[newVal];
  172. that.param = newVal;
  173. that.getCode();
  174. }
  175. },
  176. methods: {
  177. checkMeal: function (item, index) {
  178. this.param = index;
  179. },
  180. changeMealType: function (val) {
  181. if (val != this.type) {
  182. this.type = val;
  183. this.getLackList();
  184. }
  185. },
  186. getLackList: function () {
  187. var that = this;
  188. var index = layList.layer.load(2, {shade: [0.3, '#fff']});
  189. layList.baseGet(layList.Url({a: 'get_meal', p: {type: that.type}}), function (res) {
  190. layList.layer.close(index);
  191. that.priceList = res.data.data;
  192. if (that.priceList.length > 0) {
  193. that.checked = res.data.data[0];
  194. that.param = 0;
  195. }
  196. that.getCode();
  197. }, function (err) {
  198. layList.layer.close(index);
  199. });
  200. },
  201. changeType: function (val) {
  202. if (val != this.payType) {
  203. this.payType = val;
  204. this.getCode();
  205. }
  206. },
  207. getCode: function () {
  208. let that = this;
  209. let index = layList.layer.load(2, {shade: [0.3, '#fff']});
  210. layList.basePost(layList.Url({a: 'pay'}), {
  211. type: that.checked.type,
  212. num: that.checked.num,
  213. price: that.checked.price,
  214. meal_id: that.checked.id,
  215. pay_type: that.payType
  216. }, function (res) {
  217. layList.layer.close(index);
  218. that.code = res.data;
  219. that.qrcode.makeCode(res.data.qr_code);
  220. }, function (err) {
  221. layList.layer.close(index);
  222. });
  223. },
  224. },
  225. mounted: function () {
  226. this.getLackList();
  227. this.$nextTick(function () {
  228. this.qrcode = new QRCode(document.getElementById("qrcode"), {
  229. width : 100,
  230. height : 100
  231. });
  232. })
  233. }
  234. });
  235. })
  236. </script>
  237. {/block}