meal.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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('copy')">商品采集
  71. </li>
  72. <li lay-id="list" @click="changeMealType('expr_query')">物流查询
  73. </li>
  74. </ul>
  75. </div>
  76. <div class="layui-row">
  77. <div class="layui-card-body layui-col-space10">
  78. <div class="layui-col-sm1 layui-col-md2" v-for="(item,index) in priceList"
  79. @click="checkMeal(item,index)">
  80. <div class="layui-card" :class="param == index ? 'checkcard' : 'card'">
  81. <div class="layui-card-body" style="padding: 27px 15px 0;">
  82. <p style="text-align: center;color: #F47822;font-size: 30px;line-height: 30px;">{{
  83. item.num }}条</p>
  84. </div>
  85. <div class="layui-card-header">
  86. <p style="text-align: center;color: #C2C5BE;font-size: 16px;">¥{{ item.price }}</p>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="layui-row layui-col-space15">
  94. <div class="layui-card" v-show="checked">
  95. <div class="layui-card-header">
  96. 立即支付
  97. </div>
  98. <div class="layui-card-body">
  99. <div class="layui-row">
  100. <form class="layui-form" action="">
  101. <div class="layui-form-item">
  102. <label class="layui-form-label">支付方式:</label>
  103. <div class="layui-input-block">
  104. <button type="button" class="layui-btn"
  105. :class="payType == 'weixin'? 'layui-btn-normal' : 'layui-btn-primary'"
  106. @click="changeType('weixin')">微信支付
  107. </button>
  108. <button type="button" class="layui-btn"
  109. :class="payType == 'alipay'? 'layui-btn-normal' : 'layui-btn-primary'"
  110. @click="changeType('alipay')">支付宝
  111. </button>
  112. </div>
  113. </div>
  114. <div class="layui-form-item">
  115. <label class="layui-form-label">充值条数:</label>
  116. <div class="layui-input-block">
  117. <span style="font-size: 24px;line-height: 33px;">{{ checked.num }} 条</span>
  118. </div>
  119. </div>
  120. <div class="layui-form-item">
  121. <label class="layui-form-label">支付金额:</label>
  122. <div class="layui-input-block">
  123. <p style="line-height: 33px;font-size: 16px;color: #F47822;">¥{{ checked.price
  124. }}</p>
  125. </div>
  126. </div>
  127. <div class="layui-form-item">
  128. <div class="layui-input-block code">
  129. <img :src="code.code_url" alt="">
  130. </div>
  131. <div class="layui-input-block">
  132. <span>
  133. 支付码过期时间:{{code.invalid}}
  134. </span>
  135. </div>
  136. </div>
  137. </form>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  145. <script>
  146. require(['vue'], function (Vue) {
  147. new Vue({
  148. el: "#app",
  149. data: {
  150. type: 'sms',
  151. number: 0,
  152. send_total: 0,
  153. option: {},
  154. status: '',
  155. data: '',
  156. title: '全部商品',
  157. myChart: {},
  158. showtime: false,
  159. priceList: [],
  160. checked: false,
  161. param: '',
  162. payType: 'weixin',
  163. code: ''
  164. },
  165. watch: {
  166. "param": function (newVal) {
  167. let that = this;
  168. that.checked = that.priceList[newVal];
  169. that.param = newVal;
  170. that.getCode();
  171. }
  172. },
  173. methods: {
  174. checkMeal: function (item, index) {
  175. this.param = index;
  176. },
  177. changeMealType: function (val) {
  178. if (val != this.type) {
  179. this.type = val;
  180. this.getLackList();
  181. }
  182. },
  183. getLackList: function () {
  184. var that = this;
  185. var index = layList.layer.load(2, {shade: [0.3, '#fff']});
  186. layList.baseGet(layList.Url({a: 'get_meal', p: {type: that.type}}), function (res) {
  187. layList.layer.close(index);
  188. that.priceList = res.data.data;
  189. if (that.priceList.length > 0) {
  190. that.checked = res.data[0];
  191. that.param = 0;
  192. }
  193. }, function (err) {
  194. layList.layer.close(index);
  195. });
  196. },
  197. changeType: function (val) {
  198. if (val != this.payType) {
  199. this.payType = val;
  200. this.getCode();
  201. }
  202. },
  203. getCode: function () {
  204. let that = this;
  205. let index = layList.layer.load(2, {shade: [0.3, '#fff']});
  206. layList.basePost(layList.Url({a: 'pay'}), {
  207. type: that.checked.type,
  208. num: that.checked.num,
  209. price: that.checked.price,
  210. meal_id: that.checked.id,
  211. pay_type: that.payType
  212. }, function (res) {
  213. layList.layer.close(index);
  214. that.code = res.data;
  215. }, function (err) {
  216. layList.layer.close(index);
  217. });
  218. },
  219. },
  220. mounted: function () {
  221. this.getLackList();
  222. }
  223. });
  224. })
  225. </script>
  226. {/block}