wholesale.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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="../../static/icon/pf-logo.png" 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. obj.navto('/pages/product/realyWhole?id=' + item.id + '&time=' + item.time_id)
  132. // if(obj.status == 1 ) {
  133. // obj.navto('/pages/product/wholesaleDetail?id=' + item.id)
  134. // }
  135. // if(obj.status == 0) {
  136. // obj.$api.msg('今日该场次已结束')
  137. // }
  138. // if(obj.status == 2) {
  139. // obj.$api.msg('今日该场次未开始,请稍后')
  140. // }
  141. },
  142. navto(url) {
  143. uni.navigateTo({
  144. url: url
  145. })
  146. },
  147. // 获取剩余时间
  148. getSyTime() {
  149. let obj = this
  150. let stopTime = timeComputed(obj.stop * 1000)
  151. console.log(stopTime, 'stopTime')
  152. obj.stopTimeH = stopTime.hours
  153. obj.stopTimeM = stopTime.minutes >= 10 ? stopTime.minutes : ('0' + stopTime.minutes)
  154. obj.stopTimeS = stopTime.seconds >= 10 ? stopTime.seconds : ('0' + stopTime.seconds)
  155. if (stopTime.hours == 0 && stopTime.minutes == 0 && stopTime.seconds == 0) {
  156. obj.status = 0
  157. }
  158. if (!obj.timer) {
  159. if (obj.status == 1) {
  160. obj.timer = setTimeout(this.getSyTime, 1000)
  161. }
  162. } else {
  163. clearTimeout(obj.timer)
  164. if (obj.status == 1) {
  165. obj.timer = setTimeout(this.getSyTime, 1000)
  166. }
  167. }
  168. // console.log(obj.stopTimeH + ':' + obj.stopTimeM + ':' + obj.stopTimeS)
  169. },
  170. getWholeList() {
  171. let obj = this
  172. // obj.loadingType == 'loading'
  173. getWholeList({}, obj.wid).then(({
  174. data
  175. }) => {
  176. obj.list = data.data
  177. // if()
  178. obj.loadingType = 'noMore'
  179. console.log(obj.loadingType)
  180. console.log(obj.list, 'obj.list+++++')
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. .to-bg {
  188. width: 750rpx;
  189. height: 427rpx;
  190. background-color: #fff;
  191. }
  192. .top-tit {
  193. position: absolute;
  194. top: 170rpx;
  195. left: 0;
  196. right: 0;
  197. margin: auto;
  198. text-align: center;
  199. font-size: 30rpx;
  200. font-family: PingFang SC;
  201. font-weight: 500;
  202. color: #FFFFFF;
  203. }
  204. .top-time {
  205. position: absolute;
  206. top: 240rpx;
  207. left: 0;
  208. right: 0;
  209. margin: auto;
  210. font-size: 83rpx;
  211. text-align: center;
  212. font-family: PingFang SC;
  213. font-weight: bold;
  214. color: #FFFFFF;
  215. }
  216. .center-btn {
  217. padding: 20rpx 32rpx;
  218. background-color: #fff;
  219. margin-bottom: 20rpx;
  220. .center-logo {
  221. width: 83rpx;
  222. height: 106rpx;
  223. flex-shrink: 0;
  224. background-color: #eee;
  225. }
  226. .center-tit {
  227. padding-left: 30rpx;
  228. flex-grow: 1;
  229. font-size: 24rpx;
  230. font-family: PingFang SC;
  231. font-weight: 500;
  232. color: #999999;
  233. line-height: 1.5;
  234. .tit-top {
  235. font-size: 32rpx;
  236. font-family: PingFang SC;
  237. font-weight: bold;
  238. color: #333333;
  239. }
  240. }
  241. .look-more {
  242. width: 16rpx;
  243. height: 30rpx;
  244. flex-shrink: 0;
  245. }
  246. }
  247. .swiper-box {
  248. // background-color: red;
  249. // position: relative;
  250. }
  251. .good-wrap {
  252. display: flex;
  253. // padding: 0 0 20rpx 20rpx;
  254. padding-left: 20rpx;
  255. flex-wrap: wrap;
  256. }
  257. .good {
  258. width: 345rpx;
  259. height: 480rpx;
  260. margin-right: 20rpx;
  261. margin-bottom: 20rpx;
  262. background: #FFFFFF;
  263. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  264. border-radius: 10rpx;
  265. .goo-img {
  266. width: 345rpx;
  267. height: 345rpx;
  268. border-radius: 10rpx 10rpx 0 0;
  269. // background-color: #bfa;
  270. }
  271. .good-tit {
  272. padding: 15rpx 20rpx;
  273. font-size: 30rpx;
  274. font-family: PingFang SC;
  275. font-weight: bold;
  276. color: #333333;
  277. line-height: 35rpx;
  278. }
  279. .good-price {
  280. padding-left: 20rpx;
  281. justify-content: flex-start;
  282. .new-price {
  283. font-size: 36rpx;
  284. font-family: PingFang SC;
  285. font-weight: bold;
  286. color: #FF4C4C;
  287. }
  288. .old-price {
  289. padding-left: 8rpx;
  290. font-size: 26rpx;
  291. font-family: PingFang SC;
  292. font-weight: bold;
  293. text-decoration: line-through;
  294. color: #999999;
  295. }
  296. }
  297. }
  298. </style>