wholesale.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view class="content">
  3. <image src="../../static/img/wh-bg.png" mode="" class="to-bg"></image>
  4. <view class="top-tit">
  5. {{state}}
  6. </view>
  7. <view class="top-time" v-if="status != 1">
  8. {{showTime}}
  9. </view>
  10. <view class="top-time" v-if="status == 1">
  11. {{stopTimeH + ':' + stopTimeM + ':' + stopTimeS}}
  12. </view>
  13. <view class="center-btn flex" @click="navto('/pages/user/myWholesale')">
  14. <image src="" mode="" class="center-logo"></image>
  15. <view class="center-tit">
  16. <view class="tit-top">
  17. 批发订单
  18. </view>
  19. <view class="">
  20. 查看我购买的批发订单
  21. </view>
  22. </view>
  23. <image src="../../static/img/img74.png" mode="" class="look-more"></image>
  24. </view>
  25. <scroll-view scroll-y="true" class="swiper-box" :style="{'height': height}">
  26. <!-- <empty v-if="loadingType == 'noMore' && list.length === 0"></empty> -->
  27. <view class="good-wrap">
  28. <view class="good" v-for="item in list" @click="gotoDetail(item)">
  29. <image :src="item.whole.image" mode="" class="goo-img"></image>
  30. <view class="good-tit clamp">
  31. {{item.whole.title}}
  32. </view>
  33. <view class="good-price flex">
  34. <view class="new-price">
  35. ¥{{item.price}}
  36. </view>
  37. <!-- <view class="old-price">
  38. ¥{{item.}}
  39. </view> -->
  40. </view>
  41. </view>
  42. </view>
  43. <uni-load-more :status="loadingType" v-if="loadingType == 'loading'"></uni-load-more>
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. timeComputed
  50. } from '@/utils/rocessor.js'
  51. import {
  52. getWholeList
  53. } from '@/api/whole.js'
  54. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  55. import empty from '@/components/empty';
  56. export default {
  57. components: {
  58. empty,
  59. uniCountdown
  60. },
  61. data() {
  62. return {
  63. height: '',
  64. list: [],
  65. page: 1,
  66. limit: 10,
  67. loadingType: 'loading',
  68. loaded: false,
  69. bin: '',
  70. stop: '',
  71. status: '',
  72. state: '',
  73. stopTimeH: '',
  74. stopTimeM: '',
  75. stopTimeS: '',
  76. timer: '',
  77. wid: ''
  78. }
  79. },
  80. onReady(res) {
  81. var obj = this;
  82. uni.getSystemInfo({
  83. success: resu => {
  84. const query = uni.createSelectorQuery();
  85. query.select('.swiper-box').boundingClientRect();
  86. query.exec(function(res) {
  87. obj.height = resu.windowHeight - res[0].top + 'px';
  88. console.log('打印页面的剩余高度', obj.height);
  89. });
  90. },
  91. fail: res => {}
  92. });
  93. },
  94. onLoad(opt) {
  95. let obj = this
  96. obj.bin = decodeURI(opt.bin)
  97. obj.stop = opt.stp
  98. obj.status = opt.status
  99. obj.state = opt.state
  100. obj.wid = opt.wid
  101. obj.getWholeList()
  102. console.log(obj.bin, obj.stop, obj.status)
  103. },
  104. onShow() {
  105. let obj = this
  106. if (obj.status == 1) {
  107. if (obj.timer) {
  108. clearTimeout(obj.timer)
  109. }
  110. this.getSyTime()
  111. }
  112. },
  113. computed: {
  114. showTime() {
  115. let obj = this
  116. console.log(obj.status, obj.state, 'obj.status++++++++')
  117. if (obj.status == 1) {
  118. return ''
  119. }
  120. if (obj.status == 0) {
  121. return ''
  122. }
  123. if (obj.status == 2) {
  124. return obj.bin
  125. }
  126. }
  127. },
  128. methods: {
  129. gotoDetail(item) {
  130. let obj = this
  131. if(obj.status == 1 ) {
  132. obj.navto('/pages/product/wholesaleDetail?id=' + item.id + '&time=' + item.time_id + '&status=' + item.status)
  133. }
  134. if(obj.status == 0) {
  135. obj.$api.msg('今日该场次已结束')
  136. }
  137. if(obj.status == 2) {
  138. obj.$api.msg('今日该场次未开始,请稍后')
  139. }
  140. },
  141. navto(url) {
  142. uni.navigateTo({
  143. url: url
  144. })
  145. },
  146. // 获取剩余时间
  147. getSyTime() {
  148. let obj = this
  149. let stopTime = timeComputed(obj.stop * 1000)
  150. console.log(stopTime, 'stopTime')
  151. obj.stopTimeH = stopTime.hours
  152. obj.stopTimeM = stopTime.minutes >= 10 ? stopTime.minutes : ('0' + stopTime.minutes)
  153. obj.stopTimeS = stopTime.seconds >= 10 ? stopTime.seconds : ('0' + stopTime.seconds)
  154. if (stopTime.hours == 0 && stopTime.minutes == 0 && stopTime.seconds == 0) {
  155. obj.status = 0
  156. }
  157. if (!obj.timer) {
  158. if (obj.status == 1) {
  159. obj.timer = setTimeout(this.getSyTime, 1000)
  160. }
  161. } else {
  162. clearTimeout(obj.timer)
  163. if (obj.status == 1) {
  164. obj.timer = setTimeout(this.getSyTime, 1000)
  165. }
  166. }
  167. // console.log(obj.stopTimeH + ':' + obj.stopTimeM + ':' + obj.stopTimeS)
  168. },
  169. getWholeList() {
  170. let obj = this
  171. // obj.loadingType == 'loading'
  172. getWholeList({}, obj.wid).then(({
  173. data
  174. }) => {
  175. obj.list = data.data
  176. // if()
  177. obj.loadingType = 'noMore'
  178. console.log(obj.loadingType)
  179. console.log(obj.list, 'obj.list+++++')
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. .to-bg {
  187. width: 750rpx;
  188. height: 427rpx;
  189. background-color: #fff;
  190. }
  191. .top-tit {
  192. position: absolute;
  193. top: 170rpx;
  194. left: 0;
  195. right: 0;
  196. margin: auto;
  197. text-align: center;
  198. font-size: 30rpx;
  199. font-family: PingFang SC;
  200. font-weight: 500;
  201. color: #FFFFFF;
  202. }
  203. .top-time {
  204. position: absolute;
  205. top: 240rpx;
  206. left: 0;
  207. right: 0;
  208. margin: auto;
  209. font-size: 83rpx;
  210. text-align: center;
  211. font-family: PingFang SC;
  212. font-weight: bold;
  213. color: #FFFFFF;
  214. }
  215. .center-btn {
  216. padding: 20rpx 32rpx;
  217. background-color: #fff;
  218. margin-bottom: 20rpx;
  219. .center-logo {
  220. width: 83rpx;
  221. height: 106rpx;
  222. flex-shrink: 0;
  223. background-color: #eee;
  224. }
  225. .center-tit {
  226. padding-left: 30rpx;
  227. flex-grow: 1;
  228. font-size: 24rpx;
  229. font-family: PingFang SC;
  230. font-weight: 500;
  231. color: #999999;
  232. line-height: 1.5;
  233. .tit-top {
  234. font-size: 32rpx;
  235. font-family: PingFang SC;
  236. font-weight: bold;
  237. color: #333333;
  238. }
  239. }
  240. .look-more {
  241. width: 16rpx;
  242. height: 30rpx;
  243. flex-shrink: 0;
  244. }
  245. }
  246. .swiper-box {
  247. // background-color: red;
  248. // position: relative;
  249. }
  250. .good-wrap {
  251. display: flex;
  252. // padding: 0 0 20rpx 20rpx;
  253. padding-left: 20rpx;
  254. flex-wrap: wrap;
  255. }
  256. .good {
  257. width: 345rpx;
  258. height: 480rpx;
  259. margin-right: 20rpx;
  260. margin-bottom: 20rpx;
  261. background: #FFFFFF;
  262. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  263. border-radius: 10rpx;
  264. .goo-img {
  265. width: 345rpx;
  266. height: 345rpx;
  267. border-radius: 10rpx 10rpx 0 0;
  268. // background-color: #bfa;
  269. }
  270. .good-tit {
  271. padding: 15rpx 20rpx;
  272. font-size: 30rpx;
  273. font-family: PingFang SC;
  274. font-weight: bold;
  275. color: #333333;
  276. line-height: 35rpx;
  277. }
  278. .good-price {
  279. padding-left: 20rpx;
  280. justify-content: flex-start;
  281. .new-price {
  282. font-size: 36rpx;
  283. font-family: PingFang SC;
  284. font-weight: bold;
  285. color: #FF4C4C;
  286. }
  287. .old-price {
  288. padding-left: 8rpx;
  289. font-size: 26rpx;
  290. font-family: PingFang SC;
  291. font-weight: bold;
  292. text-decoration: line-through;
  293. color: #999999;
  294. }
  295. }
  296. }
  297. </style>