wholesale.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <!-- <template>
  2. <view class="wholesale" v-if="goodList.length > 0">
  3. <view class="title">
  4. <view class="left">
  5. <view class="img">
  6. <image src="../../../static/img/list1.png" mode=""></image>
  7. </view>
  8. <view class="title-t"> 批发专区 </view>
  9. <view class="about"> 限时抢购 </view>
  10. </view>
  11. <view class="right" @click="navto('/pages/product/wholesale')">
  12. <view class="jj-more-tit">
  13. 更多
  14. </view>
  15. <image src="../../../static/img/img39.png" class="jj-more"></image>
  16. </view>
  17. </view>
  18. <view class="date" v-if="goodList.length > 0">
  19. <view class="date-item"
  20. v-for="item in goodList.slice(0,3)"
  21. @click="navto('/pages/product/realyWhole?id=' + item.id + '&time=' + item.time_id)">
  22. <image :src="item.whole.image"></image>
  23. <view class="item-tit clamp">
  24. {{item.whole.title}}
  25. </view>
  26. <view class="item-price">
  27. ¥{{item.price}}
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. getWholeTimeArea,
  36. getWholeList
  37. } from '@/api/whole.js'
  38. export default {
  39. data() {
  40. return {
  41. list: [],
  42. goodList: []
  43. }
  44. },
  45. filters: {
  46. timet(val) {
  47. let str = ''
  48. if (val) {
  49. let date = new Date(val * 1000);
  50. let h = date.getHours() >= 10 ? date.getHours() : ('0' + date.getHours())
  51. let m = date.getMinutes() >= 10 ? date.getMinutes() : ('0' + date.getMinutes())
  52. str = h + ':' + m
  53. }
  54. return str
  55. }
  56. },
  57. mounted() {
  58. this.getTimeArea()
  59. },
  60. methods: {
  61. navto(url) {
  62. uni.navigateTo({
  63. url: url
  64. })
  65. },
  66. getTimeArea() {
  67. getWholeTimeArea().then(({
  68. data
  69. }) => {
  70. this.list = data.seckillTime
  71. this.list.forEach(item => {
  72. // this.
  73. getWholeList({},item.id).then(res => {
  74. console.log(res.data.data)
  75. this.goodList = this.goodList.concat(res.data.data)
  76. })
  77. })
  78. })
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. $grey: #95A0B1;
  85. $text: #333333;
  86. $red: #FF4C4C;
  87. .wholesale {
  88. padding: 20rpx;
  89. background-color: #fff;
  90. margin: 20rpx 0;
  91. .title {
  92. display: flex;
  93. line-height: 40rpx;
  94. justify-content: space-between;
  95. .left {
  96. display: flex;
  97. align-items: center;
  98. }
  99. .title-t {
  100. color: $text;
  101. font-weight: bold;
  102. margin: 0 20rpx;
  103. font-size: 34rpx;
  104. }
  105. .about {
  106. font-size: 24rpx;
  107. color: $grey;
  108. }
  109. image {
  110. width: 40rpx;
  111. height: 40rpx;
  112. }
  113. .right {
  114. display: flex;
  115. width: 200rpx;
  116. font-size: 22rpx;
  117. // justify-content: sp;
  118. justify-content: flex-end;
  119. align-items: center;
  120. padding-right: 20rpx;
  121. color: #999;
  122. .jj-more {
  123. margin-left: 10rpx;
  124. width: 15rpx;
  125. height: 22rpx;
  126. }
  127. }
  128. }
  129. .date {
  130. padding: 30rpx 0;
  131. display: flex;
  132. justify-content: flex-start;
  133. .date-item {
  134. width: 220rpx;
  135. height: 270rpx;
  136. position: relative;
  137. margin-right: 20rpx;
  138. image {
  139. border-radius: 20rpx;
  140. // max-width: 32%;
  141. width: 220rpx;
  142. height: 222rpx;
  143. }
  144. .item-name {
  145. font-size: 32rpx;
  146. font-family: PingFang SC;
  147. font-weight: 500;
  148. color: #FFFFFF;
  149. position: absolute;
  150. top: 36rpx;
  151. padding-left: 30rpx;
  152. }
  153. .item-time {
  154. font-size: 22rpx;
  155. font-family: PingFang SC;
  156. font-weight: 500;
  157. color: #FFFFFF;
  158. position: absolute;
  159. top: 80rpx;
  160. padding-left: 30rpx;
  161. }
  162. .item-price {
  163. padding-left: 10rpx;
  164. font-size: 28rpx;
  165. color: $red;
  166. font-weight: bold;
  167. }
  168. .item-tit {
  169. padding-left: 10rpx;
  170. font-size: 30rpx;
  171. font-family: PingFang SC;
  172. font-weight: bold;
  173. color: #333333;
  174. }
  175. }
  176. // image {
  177. // border-radius: 20rpx;
  178. // // max-width: 32%;
  179. // width: 220rpx;
  180. // height: 300rpx;
  181. // }
  182. }
  183. }
  184. </style>
  185. -->
  186. <template>
  187. <view class="wholesale">
  188. <view class="title">
  189. <view class="img">
  190. <image src="../../../static/img/list1.png" mode=""></image>
  191. </view>
  192. <view class="title-t"> 批发专区 </view>
  193. <view class="about"> 限时抢购 </view>
  194. </view>
  195. <view class="date" v-if="list.length > 0">
  196. <view class="date-item"
  197. @click="navto('/pages/product/wholesale?bin=' + encodeURI(list[0].time) + '&stp=' + list[0].stop + '&status=' + list[0].status + '&state=' + list[0].state + '&wid=' + list[0].id)">
  198. <image src="../../../static/img/mom.png"></image>
  199. <view class="item-name">
  200. 上午场
  201. </view>
  202. <view class="item-time">
  203. {{list[0].time}}~{{list[0].stop | timet}}
  204. </view>
  205. </view>
  206. <view class="date-item"
  207. @click="navto('/pages/product/wholesale?bin=' + encodeURI(list[1].time) + '&stp=' + list[1].stop + '&status=' + list[1].status + '&state=' + list[1].state + '&wid=' + list[1].id)">
  208. <image src="../../../static/img/aft.png"></image>
  209. <view class="item-name">
  210. 下午场
  211. </view>
  212. <view class="item-time">
  213. {{list[1].time}}~{{list[1].stop | timet}}
  214. </view>
  215. </view>
  216. <view class="date-item"
  217. @click="navto('/pages/product/wholesale?bin=' + encodeURI(list[2].time) + '&stp=' + list[2].stop + '&status=' + list[2].status + '&state=' + list[2].state + '&wid=' + list[2].id)">
  218. <image src="../../../static/img/eve.png"></image>
  219. <view class="item-name">
  220. 晚上场
  221. </view>
  222. <view class="item-time">
  223. {{list[2].time}}~{{list[2].stop | timet}}
  224. </view>
  225. </view>
  226. </view>
  227. </view>
  228. </template>
  229. <script>
  230. import {
  231. getWholeTimeArea
  232. } from '@/api/whole.js'
  233. export default {
  234. data() {
  235. return {
  236. list: []
  237. }
  238. },
  239. filters: {
  240. timet(val) {
  241. let str = ''
  242. if (val) {
  243. let date = new Date(val * 1000);
  244. let h = date.getHours() >= 10 ? date.getHours() : ('0' + date.getHours())
  245. let m = date.getMinutes() >= 10 ? date.getMinutes() : ('0' + date.getMinutes())
  246. str = h + ':' + m
  247. }
  248. return str
  249. }
  250. },
  251. mounted() {
  252. this.getTimeArea()
  253. },
  254. methods: {
  255. navto(url) {
  256. uni.navigateTo({
  257. url: url
  258. })
  259. },
  260. getTimeArea() {
  261. getWholeTimeArea().then(({
  262. data
  263. }) => {
  264. this.list = data.seckillTime
  265. })
  266. }
  267. }
  268. }
  269. </script>
  270. <style lang="scss" scoped>
  271. $grey: #95A0B1;
  272. $text: #333333;
  273. $red: #FF4C4C;
  274. .wholesale {
  275. padding: 20rpx;
  276. background-color: #fff;
  277. margin: 20rpx 0;
  278. .title {
  279. display: flex;
  280. line-height: 40rpx;
  281. .title-t {
  282. color: $text;
  283. font-weight: bold;
  284. margin: 0 20rpx;
  285. font-size: 34rpx;
  286. }
  287. .about {
  288. font-size: 24rpx;
  289. color: $grey;
  290. }
  291. image {
  292. width: 40rpx;
  293. height: 40rpx;
  294. }
  295. }
  296. .date {
  297. padding: 30rpx 0;
  298. display: flex;
  299. justify-content: space-between;
  300. .date-item {
  301. width: 220rpx;
  302. height: 300rpx;
  303. position: relative;
  304. image {
  305. border-radius: 20rpx;
  306. // max-width: 32%;
  307. width: 220rpx;
  308. height: 300rpx;
  309. }
  310. .item-name {
  311. font-size: 32rpx;
  312. font-family: PingFang SC;
  313. font-weight: 500;
  314. color: #FFFFFF;
  315. position: absolute;
  316. top: 36rpx;
  317. padding-left: 30rpx;
  318. }
  319. .item-time {
  320. font-size: 22rpx;
  321. font-family: PingFang SC;
  322. font-weight: 500;
  323. color: #FFFFFF;
  324. position: absolute;
  325. top: 80rpx;
  326. padding-left: 30rpx;
  327. }
  328. }
  329. // image {
  330. // border-radius: 20rpx;
  331. // // max-width: 32%;
  332. // width: 220rpx;
  333. // height: 300rpx;
  334. // }
  335. }
  336. }
  337. </style>