order_list.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. {extend name="public/container"}
  2. {block name="title"}我的拼课订单{/block}
  3. {block name="head_top"}
  4. <style>
  5. .loading {
  6. font-size: .4rem;
  7. text-align: center;
  8. color: #999;
  9. }
  10. .loaded {
  11. font-size: .28rem;
  12. line-height: .72rem;
  13. text-align: center;
  14. color: #999;
  15. }
  16. .nothing {
  17. position: absolute;
  18. top: 30%;
  19. left: 50%;
  20. width: 4rem;
  21. height: 4rem;
  22. -webkit-transform: translate(-50%, -50%);
  23. transform: translate(-50%, -50%);
  24. }
  25. </style>
  26. {/block}
  27. {block name="content"}
  28. <div class="my-spelling-order swiper-details" v-cloak id="app">
  29. <div class="video-listn">
  30. <div class="list" v-for="item in pinkList" @click="goPinkUrl(item)">
  31. <div class="item acea-row row-between-wrapper">
  32. <div class="pictrue"><img :src="item.image"></div>
  33. <div class="text acea-row row-between row-column" style="flex: 1;margin-left: 0.2rem;">
  34. <div class="name line1" v-text="item.title"></div>
  35. <div class="num acea-row row-middle">{{item.pink_number}}人团<span class="money">¥
  36. {{item.money}}</span></div>
  37. </div>
  38. </div>
  39. <div class="bottom acea-row row-between-wrapper" v-if="item.pink_status==1">
  40. <div class="status line1">拼团进行中...</div>
  41. <div class="time">剩余时间 {{item.difftime.hour}} :{{item.difftime.minute}} :{{item.difftime.second}}</div>
  42. </div>
  43. <div class="bottom acea-row row-between-wrapper" v-else-if="item.pink_status==2">
  44. <div class="status line1">拼团成功</div>
  45. </div>
  46. <div class="bottom acea-row row-between-wrapper" v-else-if="item.pink_status==3">
  47. <div class="status line1">拼团失败</div>
  48. </div>
  49. <div class="bottom acea-row row-between-wrapper" v-else-if="item.pink_status==4">
  50. <div class="status line1">已退款</div>
  51. </div>
  52. </div>
  53. </div>
  54. <div v-show="loading" class="loading">
  55. <span class="fa fa-spinner"></span>
  56. </div>
  57. <div v-if="pinkList.length && loadend" class="loaded">已全部加载</div>
  58. <div v-if="!pinkList.length && !loading">
  59. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  60. </div>
  61. <shortcut></shortcut>
  62. </div>
  63. <script>
  64. (function () {
  65. require(['vue', 'helper', 'store', '{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, $h, app) {
  66. new Vue({
  67. el: "#app",
  68. data: {
  69. loadTitle: '加载更多',
  70. loadend: false,
  71. loading: false,
  72. pinkList: [],
  73. page: 1,
  74. limit: 10
  75. },
  76. methods: {
  77. goPinkUrl: function (item) {
  78. if (item.pink_status != 4) window.location.href = $h.U({ c: 'special', a: 'order_pink', q: { pink_id: item.pink_id } });
  79. },
  80. get_pink_list: function () {
  81. var that = this;
  82. if (this.loadend) return;
  83. if (this.loading) return;
  84. this.loadTitle = '';
  85. this.loading = true;
  86. app.baseGet($h.U({ c: 'my', a: 'get_order_list', q: { type: 3, page: this.page, limit: this.limit } }), function (res) {
  87. var list = res.data.data.list;
  88. var pinkList = $h.SplitArray(list, that.pinkList);
  89. that.loading = false;
  90. that.loadend = list.length < that.limit;
  91. that.loadTitle = that.loadend ? '已全部加载' : '加载更多';
  92. that.page = res.data.data.page;
  93. that.$set(that, 'pinkList', pinkList);
  94. that.CountDown({ name: 'pinkList', time_name: 'stop_time' });
  95. }, function (res) {
  96. that.loadTitle = '加载更多';
  97. that.loading = false;
  98. });
  99. },
  100. CountDown: function (opt, that) {
  101. if (typeof opt != 'object') opt = {};
  102. var name = opt.name || '', value = null, that = that ? that : this;
  103. if (name.indexOf('.') === -1)
  104. value = that[name];
  105. else {
  106. var nameArray = name.split('.');
  107. value = that[nameArray[0]][nameArray[1]];
  108. }
  109. var tiem = opt.time || 1000, timeName = opt.time_name || 'datatime', strName = { hour: "00", minute: "00", second: "00" },
  110. outputName = opt.output || 'difftime';
  111. if (!name) return false;
  112. if (value === undefined) return false;
  113. opt.nowTime = function () {
  114. if (Array.isArray(value)) {
  115. for (var i = 0; i < value.length; i++) {
  116. var intDiff = value[i][timeName] - Date.parse(new Date()) / 1000;//获取数据中的时间戳的时间差;
  117. var days = 0, hour = 0, minute = 0, second = 0;
  118. if (intDiff > 0) {
  119. hour = Math.floor(intDiff / (60 * 60)) - (days * 24);
  120. minute = Math.floor(intDiff / 60) - (hour * 60);
  121. second = Math.floor(intDiff) - (hour * 60 * 60) - (minute * 60);
  122. if (hour <= 9) hour = '0' + hour;
  123. if (minute <= 9) minute = '0' + minute;
  124. if (second <= 9) second = '0' + second;
  125. strName = {
  126. hour: hour,
  127. minute: minute,
  128. second: second
  129. };
  130. } else {
  131. strName = {
  132. hour: "00",
  133. minute: "00",
  134. second: "00"
  135. };
  136. }
  137. that.$set(that[name][i], outputName, strName);
  138. }
  139. } else {
  140. var intDiff = value[timeName] - Date.parse(new Date()) / 1000;
  141. var days = 0, hour = 0, minute = 0, second = 0;
  142. if (intDiff > 0) {
  143. hour = Math.floor(intDiff / (60 * 60)) - (days * 24);
  144. minute = Math.floor(intDiff / 60) - (hour * 60);
  145. second = Math.floor(intDiff) - (hour * 60 * 60) - (minute * 60);
  146. if (hour <= 9) hour = '0' + hour;
  147. if (minute <= 9) minute = '0' + minute;
  148. if (second <= 9) second = '0' + second;
  149. strName = {
  150. hour: hour,
  151. minute: minute,
  152. second: second
  153. };
  154. } else {
  155. strName = {
  156. hour: "00",
  157. minute: "00",
  158. second: "00"
  159. };
  160. }
  161. if (name.indexOf('.') === -1)
  162. that.$set(that[name], outputName, strName);
  163. else {
  164. var nameArray = name.split('.');
  165. that.$set(that[nameArray[0]][nameArray[1]], outputName, strName);
  166. }
  167. }
  168. };
  169. opt.nowTime();
  170. setInterval(opt.nowTime, tiem);
  171. }
  172. },
  173. mounted: function () {
  174. this.get_pink_list();
  175. $h.EventUtil.listenTouchDirection(document, function () {
  176. this.loading == false && this.get_pink_list();
  177. }.bind(this), false);
  178. }
  179. })
  180. })
  181. })();
  182. </script>
  183. {/block}