couponList_body.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!DOCTYPE html>
  2. <html class="">
  3. <!--STATUS OK-->
  4. <head>
  5. <meta name="referrer" content="always" />
  6. <meta charset='utf-8' />
  7. <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta name="description" content="">
  10. <meta name="format-detection" content="telephone=no" />
  11. <link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="css/iconfont.css">
  13. <link rel="stylesheet" type="text/css" href="css/main.css" />
  14. <script src="js/vue.js"></script>
  15. <script src="js/vant-ui.js"></script>
  16. <script src="js/main.js"></script>
  17. <title></title>
  18. </head>
  19. <style>
  20. .youhuijuan .title {
  21. width: 100%;
  22. height: 0.7rem;
  23. position: fixed;
  24. left: 0;
  25. top: 0rem;
  26. font-size: 0.28rem;
  27. background-color: #fff;
  28. }
  29. .youhuijuan {
  30. padding-top: 0.8rem;
  31. }
  32. .mescroll{
  33. padding-top: .5rem;
  34. }
  35. </style>
  36. <body>
  37. <div id="app" style="overflow-y:scroll !important" v-cloak>
  38. <div class="pageView youhuijuan">
  39. <div class="title flex jlr a-center" style="background-color : #fff;z-index:2222;width : 100%">
  40. <div class="item flex a-center j-center" v-for="(status,index) in couponStatus" v-bind:class="chooseStatusIndex == index ? 'on' : ''" v-on:click="chooseStatus(index)">{{ status.name }}</div>
  41. </div>
  42. <div>
  43. <div class="boxs mescroll-touch-y mescroll" id="mescroll">
  44. <ul>
  45. <li v-for="(item,index) in couponList">
  46. <div class="youhuiLeft flex a-center j-center">
  47. <div class="flex a-end j-center">
  48. <em>¥</em>
  49. <h2>{{ item.bonus }}</h2>
  50. </div>
  51. </div>
  52. <div class="youhuiInfos flex col">
  53. <div class="infos">
  54. <h2>{{ item.bonus }}元优惠券</h2>
  55. <span>失效时间:{{ item.expireTime }}</span>
  56. </div>
  57. <div class="bottom flex a-center jlr" @click="item.state = !item.state">
  58. <span>适用型号:{{ item.tireSize }}</span>
  59. </div>
  60. </div>
  61. </li>
  62. </ul>
  63. <div v-show="couponList.length == 0" style="text-align:center;position:absolute;top:0px;width:100%">
  64. <img src="./image/noData.png" style="margin:1rem auto" />
  65. </div>
  66. </div>
  67. </div>
  68. <!-- <div style="overflow-y:scroll">
  69. <ul style="overflow-y:scroll">
  70. <div v-for="(item,index) in couponList" :key="index" id="mescroll">
  71. <li class="flex a-center">
  72. <div class="youhuiLeft flex a-center j-center">
  73. <div class="flex a-end j-center">
  74. <em>¥</em>
  75. <h2>{{ item.bonus }}</h2>
  76. </div>
  77. </div>
  78. <div class="youhuiInfos flex col">
  79. <div class="infos">
  80. <h2>{{ item.bonus }}元优惠劵</h2>
  81. <span>失效时间:{{ item.expireTime }}</span>
  82. </div>
  83. <div class="bottom flex a-center jlr" @click="item.state = !item.state">
  84. <span>适用型号:{{ item.tireSize }}</span>
  85. </div>
  86. </div>
  87. </li>
  88. </div>
  89. </div> -->
  90. </div>
  91. </div>
  92. </body>
  93. <link rel="stylesheet" href="./mescroll/mescroll.min.css">
  94. <script type="text/javascript" src="../script/aui-scroll.js"></script>
  95. <script type="text/javascript" src="./mescroll/mescroll.min.js"></script>
  96. <script type="text/javascript" src="../script/api.js"></script>
  97. <script type="text/javascript" src="../script/httpRequest.js"></script>
  98. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  99. <script type="text/javascript">
  100. apiready = function() {
  101. new Vue({
  102. el: '#app',
  103. data: {
  104. couponList: [],
  105. userid: '',
  106. chooseStatusIndex: 0,
  107. couponStatus: [{
  108. name: '未使用',
  109. code: 1,
  110. }, {
  111. name: '已使用',
  112. code: 2
  113. }, {
  114. name: '已失效',
  115. code: 3
  116. }],
  117. frist : 1,
  118. current : 1,
  119. size : 10,
  120. totalPages : 1,
  121. hasOther : false,
  122. mescroll : '',
  123. },
  124. methods: {
  125. init: function() {
  126. this.userid = $api.getStorage('userid');
  127. this.getCouponList();
  128. },
  129. addMore : function(){
  130. var _this = this;
  131. if (_this.current < _this.totalPages) {
  132. _this.current = _this.current + 1;
  133. _this.getCouponList(_this.mescroll, 1);
  134. } else {
  135. _this.hasOther = true;
  136. }
  137. },
  138. // 获取优惠券列表
  139. getCouponList: function(mescroll) {
  140. var url = "getCouponListU",_this = this,data = {
  141. useType : this.couponStatus[this.chooseStatusIndex].code,
  142. storeId : this.userid,
  143. current : this.current,
  144. size : this.size,
  145. url : 'json',
  146. type : 'body'
  147. };
  148. this.$post(url,data,function(ret){
  149. if(ret.code == 0 || ret.code == '0'){
  150. _this.couponList = _this.current == 1 ? ret.page.records : _this.couponList.concat(ret.page.records);
  151. _this.totalPages = ret.page.pages;
  152. if(mescroll){
  153. mescroll.endSuccess()
  154. }
  155. if(_this.frist == 1){
  156. _this.$nextTick(function(){
  157. _this.configs()
  158. })
  159. }
  160. }
  161. })
  162. },
  163. configs : function(){
  164. var _this = this;
  165. this.frist = 2;
  166. this.configDownAndPull("mescroll",function(mescroll){
  167. _this.mescroll = mescroll;
  168. _this.current = 1;
  169. _this.getCouponList(mescroll);
  170. },function(mescroll){
  171. if(_this.current < _this.totalPages){
  172. _this.current = _this.current + 1;
  173. _this.getCouponList(mescroll,1);
  174. }else{
  175. mescroll.endSuccess(_this.size,false);
  176. }
  177. });
  178. // this.configBottomRefush(function(){
  179. // if (_this.current < _this.totalPages) {
  180. // _this.current = _this.current + 1;
  181. // _this.getCouponList(_this.mescroll, 1);
  182. // } else {
  183. // _this.hasOther = true;
  184. // }
  185. // })
  186. },
  187. // 选择这个状态
  188. chooseStatus: function(index) {
  189. this.current = 1;
  190. this.chooseStatusIndex = index;
  191. this.getCouponList(this.mescroll);
  192. }
  193. },
  194. mounted: function() {
  195. this.init();
  196. }
  197. })
  198. }
  199. </script>
  200. </html>