pingDetails.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view class="center">
  3. <view class="top"><image :src="list.data.background_image" mode=""></image></view>
  4. <view class="name-box">
  5. <view class="price-box">
  6. <text class="price">
  7. {{
  8. list.data.cost_money_type === list.data.cost_2_money_type
  9. ? list.data.cost * 1 + list.data.cost_money_type
  10. : list.data.cost * 1 + list.data.cost_money_type + '/' + list.data.cost_2 * 1 + list.data.cost_2_money_type
  11. }}
  12. </text>
  13. <!-- <text class="yuan">¥229</text> -->
  14. </view>
  15. <view class="name clamp">{{ list.data.name }}</view>
  16. <view class="info">
  17. <view class="info-item">门票:{{ list.data.ticket * 1 }}{{ list.data.ticket_money_type }}</view>
  18. <view class="info-item">销量:56件</view>
  19. <view class="info-item">浙江省台州市</view>
  20. </view>
  21. </view>
  22. <view class="tip-box">
  23. <view class="tip-titele">拼团玩法</view>
  24. <view class="tip-main">开团/参团-满员开团-拼中发货</view>
  25. </view>
  26. <view class="tip-box">
  27. <view class="tip-titele">拼团须知</view>
  28. <view class="tip-main">
  29. 本轮预约开始时间:{{ list.start }}
  30. <br />
  31. 本轮预约结束时间:{{ list.end }}
  32. <br />
  33. 本轮开奖时间:{{ list.next_pink.name }}
  34. <br />
  35. 下轮预约开始时间:{{ list.next_pink.name }}
  36. </view>
  37. </view>
  38. <view class="detail">
  39. <view class="detail-title">商品详情</view>
  40. <view class="systom"></view>
  41. </view>
  42. <view class="btn" @click="buy()">立即拼团</view>
  43. </view>
  44. </template>
  45. <script>
  46. import { lalaDetial } from '@/api/product.js';
  47. import { getTime } from '@/utils/rocessor.js';
  48. import uniNumberBox from '@/components/uni-number-box.vue';
  49. export default {
  50. components: {
  51. uniNumberBox
  52. },
  53. data() {
  54. return {
  55. id: '',
  56. list: {}
  57. };
  58. },
  59. onLoad(option) {
  60. this.id = option.id;
  61. this.loadData();
  62. },
  63. computed: {
  64. money() {
  65. return this.num * this.price * this.step;
  66. }
  67. },
  68. onShow() {},
  69. methods: {
  70. async loadData() {
  71. let obj = this;
  72. lalaDetial({}, obj.id).then(({ data }) => {
  73. obj.list = data;
  74. obj.list.end = getTime(data.next_pink.value - data.close_join * 60);
  75. //当前时间
  76. for (let i = 0; i < data.open_times.length; i++) {
  77. //拼团开始时间
  78. if (data.open_times[i].value == data.next_pink.value) {
  79. if (i != 0) {
  80. let j = i - 1;
  81. obj.list.start = getTime(data.open_times[j].value);
  82. } else {
  83. let date = data.open_times[0].name.split(' ');
  84. let start = date[0] + ' ' + data.lala_pink_open + ':00';
  85. start = new Date(start);
  86. start = start.getTime();
  87. obj.list.start = getTime(start);
  88. }
  89. }
  90. }
  91. console.log(obj.list);
  92. });
  93. },
  94. buy() {
  95. //当前时间
  96. let dateTime = new Date().valueOf();
  97. let start = new Date(this.list.start).valueOf();
  98. let end = new Date(this.list.end).valueOf();
  99. console.log(dateTime, start, end);
  100. if(dateTime < start){
  101. this.$api.msg('当前场次还未开始');
  102. return;
  103. }
  104. if(dateTime > end){
  105. this.$api.msg('当前场次已经结束,请等待下一场');
  106. return;
  107. }
  108. uni.navigateTo({
  109. url: '/pages/product/pingOrder?id=' + this.id
  110. });
  111. },
  112. changeCurrent(index) {
  113. this.current = index;
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss" scoped>
  119. page,
  120. .center {
  121. background: #f8f6f6;
  122. height: 100%;
  123. }
  124. .top {
  125. width: 750rpx;
  126. height: 710rpx;
  127. image {
  128. width: 100%;
  129. height: 100%;
  130. }
  131. }
  132. .name-box {
  133. padding: 30rpx 26rpx;
  134. line-height: 1;
  135. background-color: #ffffff;
  136. .price-box {
  137. font-size: 28rpx;
  138. font-family: PingFang SC;
  139. font-weight: bold;
  140. color: #e83f30;
  141. .price {
  142. font-size: 48rpx;
  143. }
  144. .yuan {
  145. padding-left: 10rpx;
  146. font-size: 30rpx;
  147. font-weight: 500;
  148. text-decoration: line-through;
  149. color: #999999;
  150. }
  151. }
  152. .name {
  153. font-size: 34rpx;
  154. font-family: PingFang SC;
  155. font-weight: bold;
  156. color: #1d2023;
  157. margin-top: 30rpx;
  158. }
  159. .info {
  160. display: flex;
  161. align-items: center;
  162. justify-content: space-between;
  163. margin-top: 30rpx;
  164. font-size: 24rpx;
  165. font-family: PingFang SC;
  166. font-weight: 500;
  167. color: #999999;
  168. }
  169. }
  170. .tip-box {
  171. margin-top: 20rpx;
  172. padding: 34rpx 60rpx 50rpx 30rpx;
  173. display: flex;
  174. align-items: flex-start;
  175. background-color: #ffffff;
  176. .tip-titele {
  177. font-size: 32rpx;
  178. font-family: PingFang SC;
  179. font-weight: bold;
  180. color: #3b3b3b;
  181. }
  182. .tip-main {
  183. margin-left: 30rpx;
  184. width: 500rpx;
  185. font-size: 26rpx;
  186. font-family: PingFang SC;
  187. font-weight: 500;
  188. color: #8a8a8a;
  189. }
  190. }
  191. .detail {
  192. .detail-title {
  193. width: 750rpx;
  194. height: 80rpx;
  195. line-height: 80rpx;
  196. text-align: center;
  197. font-size: 28rpx;
  198. font-family: PingFangSC;
  199. font-weight: bold;
  200. color: #1d2023;
  201. }
  202. }
  203. .btn {
  204. position: fixed;
  205. bottom: 0;
  206. left: 0;
  207. right: 0;
  208. width: 750rpx;
  209. height: 98rpx;
  210. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  211. text-align: center;
  212. line-height: 98rpx;
  213. font-size: 36rpx;
  214. font-family: PingFang SC;
  215. font-weight: bold;
  216. color: #ffffff;
  217. }
  218. </style>