couponList_body.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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.couponDescribe}}</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: 0,
  110. }, {
  111. name: '未使用',
  112. code: 1,
  113. }, {
  114. name: '已使用',
  115. code: 2
  116. }, {
  117. name: '已失效',
  118. code: 4
  119. }],
  120. frist : 1,
  121. current : 1,
  122. size : 10,
  123. totalPages : 1,
  124. hasOther : false,
  125. mescroll : '',
  126. },
  127. methods: {
  128. init: function() {
  129. this.userid = $api.getStorage('userid');
  130. this.getCouponList();
  131. },
  132. addMore : function(){
  133. var _this = this;
  134. if (_this.current < _this.totalPages) {
  135. _this.current = _this.current + 1;
  136. _this.getCouponList(_this.mescroll, 1);
  137. } else {
  138. _this.hasOther = true;
  139. }
  140. },
  141. // 获取优惠券列表
  142. getCouponList: function(mescroll) {
  143. var url = "getCouponListU",_this = this,data = {
  144. useType : this.couponStatus[this.chooseStatusIndex].code,
  145. storeId : this.userid,
  146. current : this.current,
  147. size : this.size,
  148. url : 'json',
  149. type : 'body'
  150. };
  151. this.$post(url,data,function(ret){
  152. if(ret.code == 0 || ret.code == '0'){
  153. _this.couponList = _this.current == 1 ? ret.page.records : _this.couponList.concat(ret.page.records);
  154. _this.totalPages = ret.page.pages;
  155. if(mescroll){
  156. mescroll.endSuccess()
  157. }
  158. if(_this.frist == 1){
  159. _this.$nextTick(function(){
  160. _this.configs()
  161. })
  162. }
  163. }
  164. })
  165. },
  166. configs : function(){
  167. var _this = this;
  168. this.frist = 2;
  169. this.configDownAndPull("mescroll",function(mescroll){
  170. _this.mescroll = mescroll;
  171. _this.current = 1;
  172. _this.getCouponList(mescroll);
  173. },function(mescroll){
  174. if(_this.current < _this.totalPages){
  175. _this.current = _this.current + 1;
  176. _this.getCouponList(mescroll,1);
  177. }else{
  178. mescroll.endSuccess(_this.size,false);
  179. }
  180. });
  181. // this.configBottomRefush(function(){
  182. // if (_this.current < _this.totalPages) {
  183. // _this.current = _this.current + 1;
  184. // _this.getCouponList(_this.mescroll, 1);
  185. // } else {
  186. // _this.hasOther = true;
  187. // }
  188. // })
  189. },
  190. // 选择这个状态
  191. chooseStatus: function(index) {
  192. this.current = 1;
  193. this.chooseStatusIndex = index;
  194. this.getCouponList(this.mescroll);
  195. }
  196. },
  197. mounted: function() {
  198. this.init();
  199. }
  200. })
  201. }
  202. </script>
  203. </html>