index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view>
  3. <view class="mvxyck">
  4. <!-- <view class="vimgb">
  5. <image src="@/static/penlo1669267729817.png" mode="widthFix" class="the_path_168uy"></image>
  6. <view class="enjoy_a_clap_169iw">惊喜区</view>
  7. <image src="@/static/spvzc1669267807530.png" mode="widthFix" class="the_path_168uy"></image>
  8. </view> -->
  9. <image src="@/static/blrkv1669267657514.png" mode="widthFix" class="sybxn"></image>
  10. <view v-for="(item, index) in goodlist" :key="index">
  11. <view class="rectangular_54nz">
  12. <view class="rectangular_46ue">
  13. <view class="ynusc">{{index+1}}</view>
  14. <view class="the_warehouse">号仓</view>
  15. </view>
  16. <view class="box_fff">
  17. <view class="bnrmd">
  18. <view class="rectangular_67lk">{{item.name}}</view>
  19. <image :src="item.litpic" mode="widthFix" class="the_mask_73jy"></image>
  20. <view class="since">{{item.price}}起</view>
  21. </view>
  22. <view class="stwdcp">
  23. <view class="le_ticket">乐票:
  24. <view class="sfwitk">{{ item.lpnum }}&nbsp;/&nbsp;{{item.cgkc}}%</view>
  25. </view>
  26. <view class="cycle_day">周期:
  27. <view class="sfwitk">{{ item.tianshu }}天&nbsp;/&nbsp;{{ item.shouyi }}%</view>
  28. </view>
  29. <view class="ws60cef">{{ item.kssj}}&nbsp;~&nbsp;{{ item.jssj}}</view>
  30. <view class="fjpar">
  31. <view class="rectangular_61de_ismxl" @click="autoYuyue(item.id, 1, index)" v-if="item.zt1==0">自动一单</view>
  32. <view class="rectangular_61de"v-if="item.zt1==1">{{item.ztmc1}}</view>
  33. <view class="rectangular_61de_ismxl" @click="autoYuyue(item.id, 2, index)" v-if="item.zt2==0">自动二单</view>
  34. <view class="rectangular_61de" v-if="item.zt2==1">{{item.ztmc2}}</view>
  35. <view class="rectangular_61de_ismxl" @click="autoYuyue(item.id, 0, index)" v-if="item.zt3==0">手动预约</view>
  36. <view class="rectangular_61de" v-if="item.zt3==1">{{item.ztmc3}}</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. constants: {},
  50. goodlist: [],
  51. num: 0,
  52. id: 0,
  53. userinfo: null
  54. };
  55. },
  56. onShow() {
  57. var user = this.$api.getUserinfo();
  58. if (user) {
  59. this.userinfo = user;
  60. } else {
  61. this.userinfo = null;
  62. }
  63. this.getMhGoodlist();
  64. },
  65. filters: {
  66. formatDate: function(value, args) {
  67. var dt = new Date(value);
  68. if (args == 'yyyy-M-d') {
  69. // yyyy-M-d
  70. let year = dt.getFullYear();
  71. let month = dt.getMonth() + 1;
  72. let date = dt.getDate();
  73. return `${year}-${month}-${date}`;
  74. } else if (args == 'yyyy-M-d H:m:s') {
  75. // yyyy-M-d H:m:s
  76. let year = dt.getFullYear();
  77. let month = dt.getMonth() + 1;
  78. let date = dt.getDate();
  79. let hour = dt.getHours();
  80. let minute = dt.getMinutes();
  81. let second = dt.getSeconds();
  82. return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
  83. } else if (args == 'yyyy-MM-dd') {
  84. // yyyy-MM-dd
  85. let year = dt.getFullYear();
  86. let month = (dt.getMonth() + 1).toString().padStart(2, '0');
  87. let date = dt
  88. .getDate()
  89. .toString()
  90. .padStart(2, '0');
  91. return `${year}-${month}-${date}`;
  92. } else if (args == 'HH:mm') {
  93. // yyyy-MM-dd
  94. let hour = dt
  95. .getHours()
  96. .toString()
  97. .padStart(2, '0');
  98. let minute = dt
  99. .getMinutes()
  100. .toString()
  101. .padStart(2, '0');
  102. return `${hour}:${minute}`;
  103. } else {
  104. // yyyy-MM-dd HH:mm:ss
  105. let year = dt.getFullYear();
  106. let month = (dt.getMonth() + 1).toString().padStart(2, '0');
  107. let date = dt
  108. .getDate()
  109. .toString()
  110. .padStart(2, '0');
  111. let hour = dt
  112. .getHours()
  113. .toString()
  114. .padStart(2, '0');
  115. let minute = dt
  116. .getMinutes()
  117. .toString()
  118. .padStart(2, '0');
  119. let second = dt
  120. .getSeconds()
  121. .toString()
  122. .padStart(2, '0');
  123. return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
  124. }
  125. }
  126. },
  127. onLoad(option) {
  128. // console.log(option);
  129. },
  130. methods: {
  131. autoYuyue(id, num, index) {
  132. if (!this.userinfo) {
  133. uni.showToast({
  134. title: '请先登录',
  135. icon: 'none'
  136. });
  137. return;
  138. }
  139. var that=this;
  140. var data = new Object();
  141. data.cid = id;
  142. data.uid = this.userinfo.id;
  143. data.num = num;
  144. this.$api
  145. .MhGetModel(data, 'jingxi/yuyue')
  146. .then(res => {
  147. if (res.data.code != 0) {
  148. uni.showToast({
  149. title: res.data.msg,
  150. icon: 'none'
  151. });
  152. that.getMhGoodlist()
  153. return;
  154. } else {
  155. uni.showToast({
  156. title: res.data.msg,
  157. icon: 'none'
  158. });
  159. }
  160. })
  161. .catch(err => {
  162. // console.log('request fail', JSON.stringify(err));
  163. });
  164. },
  165. getMhGoodlist() {
  166. var data = new Object();
  167. data.uid = this.userinfo.id;
  168. this.$api
  169. .MhGetModel(data, 'jingxi/list')
  170. .then(res => {
  171. //// console.log(res.data.code)
  172. //// console.log('jingxi/list信息',JSON.stringify(res.data.data));
  173. this.goodlist = res.data.data;
  174. })
  175. .catch(err => {
  176. // console.log('request fail', JSON.stringify(err));
  177. });
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. @import "index.scss";
  184. </style>
  185. <style>
  186. page{
  187. background: #f1f2f6;
  188. }
  189. </style>