wholesale.vue 6.1 KB

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