Bargainlist.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="砍价活动" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div goodslist-body show-goods-list" style="position:relative">
  14. <!-- 无限加载滚动列表 -->
  15. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div flex-wrapper" @scrolltolower="loadMore" scroll-y="true">
  16. <view class="div ui-product-body"
  17. v-for='(item, index) in bargainList'
  18. v-bind:key='index'
  19. >
  20. <view class="div list" v-on:click='goDetail(item)'>
  21. <view class="div ui-image-wrapper">
  22. <image mode="aspectFit" class="img product-img" :src="item.bargain_goods_image_url">
  23. </view>
  24. <view class="div flex-right">
  25. <view class="div product-header">
  26. <text class="h3 title clear-bottom">{{ item.bargain_name }}</text>
  27. </view>
  28. <view class="div p-price">
  29. 当前价:¥{{ item.bargainorder_current_price }}
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="div loading-wrapper" v-if="bargainList.length > 0">
  35. <view class="p common-no-more" v-if='!isMore'>没有更多了</view>
  36. <uni-load-more status="loading" color='#e93b3d' v-if='isMore'></uni-load-more>
  37. </view>
  38. <empty-record v-if='bargainList.length <= 0 && !isMore'></empty-record>
  39. </scroll-view>
  40. </view>
  41. </view></member-base>
  42. </template>
  43. <script>
  44. import {getFontSize} from '@/util/common'
  45. import TitleHeader from '../../TitleHeader'
  46. import { urlencode } from '@/util/common'
  47. import MemberBase from '../MemberBase'
  48. import EmptyRecord from '../../EmptyRecord'
  49. import { getBargainList } from '../../../api/memberBargain'
  50. export default {
  51. name: 'PintuanList',
  52. components:{
  53. TitleHeader,
  54. MemberBase,
  55. EmptyRecord
  56. },
  57. mounted(){
  58. // #ifdef MP-WEIXIN
  59. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  60. // #endif
  61. },
  62. computed:{
  63. fontSize(){
  64. return getFontSize()
  65. },
  66. },
  67. data(){
  68. return {
  69. navHeight: 0,
  70. bargainList: [],
  71. params: { 'page': 0, 'per_page': 10 },
  72. loading: false, // 是否加载更多
  73. isMore: true // 是否有更多
  74. }
  75. },
  76. created () {
  77. this.loadMore()
  78. },
  79. methods:{
  80. goBack(){uni.navigateBack({delta:1})},
  81. loadMore () {
  82. this.loading = true
  83. this.params.page = ++this.params.page
  84. if (this.isMore) {
  85. this.loading = false
  86. this.getBargainList(true)
  87. }
  88. },
  89. getBargainList () {
  90. uni.showLoading({ title: '加载中' })
  91. getBargainList(this.params).then(res => {
  92. uni.hideLoading()
  93. if (res.result.hasmore) {
  94. this.isMore = true
  95. } else {
  96. this.isMore = false
  97. }
  98. if (this.bargainList) {
  99. this.bargainList = this.bargainList.concat(res.result.bargainorder_list)
  100. } else {
  101. this.bargainList = res.result.bargain_list
  102. }
  103. }).catch(function (error) {
  104. uni.hideLoading()
  105. uni.showToast({icon:'none',title: error.message})
  106. })
  107. },
  108. goDetail (item) {
  109. uni.navigateTo({ url: '/pages/home/bargain/Bargainshare'+'?'+urlencode( { 'bargainorder_id': item.bargainorder_id } )})
  110. }
  111. }
  112. }
  113. </script>
  114. <style scoped lang='scss'>
  115. .scroll-view-wrapper{display: flex;flex-direction: column;}
  116. .scroll-view{flex:1}
  117. .ui-product-body {
  118. background: #fff;
  119. .list {
  120. display: flex;
  121. width: auto;
  122. align-items: center;
  123. justify-content: space-between;
  124. padding:0.5rem;
  125. position: relative;
  126. .div.ui-image-wrapper {
  127. width: 5.5rem;
  128. height: 5.5rem;
  129. position: relative;
  130. display: flex;
  131. justify-content: center;
  132. align-content: center;
  133. align-items: center;
  134. flex-basis: 5.5rem;
  135. flex-shrink: 0;
  136. background-position:center center!important;
  137. background-size:5rem 5rem;
  138. background-repeat:no-repeat;
  139. -webkit-background-size: cover;
  140. -moz-background-size: cover;
  141. -o-background-size: cover;
  142. background-size: cover;
  143. .img.product-img{
  144. width:5.5rem;
  145. height:5.5rem;
  146. border-radius: .4rem;
  147. flex-basis:5.5rem;
  148. flex-shrink: 0;
  149. }
  150. .img.product-img[lazy=loading] {
  151. width:1.5rem;
  152. height:1.5rem;
  153. }
  154. .img.product-im[lazy=error] {
  155. width:1.5rem;
  156. height:1.5rem;
  157. }
  158. .img.product-img[lazy=loaded] {
  159. width:5.5rem;
  160. height:5.5rem;
  161. flex-basis:5.5rem;
  162. flex-shrink: 0;
  163. background:rgba(255,255,255,1);
  164. }
  165. .span {
  166. position: absolute;
  167. height:1rem;
  168. background:rgba(243,244,245,1);
  169. line-height:1rem;
  170. text-align: center;
  171. font-size:$subFontSize;
  172. color:$primaryColor;
  173. width:5.5rem;
  174. bottom: 0;
  175. left: 0;
  176. }
  177. }
  178. .flex-right {
  179. padding-left:0.7rem;
  180. width: 100%;
  181. position:relative;
  182. .title {
  183. color: #333;
  184. font-size:$subFontSize;
  185. line-height:1rem;
  186. font-weight: normal;
  187. display:-moz-box;
  188. display:-webkit-box;
  189. -webkit-line-clamp: 2;
  190. -moz-line-clamp: 2;
  191. -moz-box-orient:vertical;
  192. -webkit-box-orient:vertical;
  193. box-orient:vertical;
  194. overflow: hidden;
  195. margin-bottom:0.4rem;
  196. &.clear-bottom {
  197. margin-bottom: 0;
  198. }
  199. }
  200. .product-header {
  201. margin-bottom:.2rem;
  202. display: flex;
  203. align-items: center;
  204. }
  205. .p-price {
  206. color: $primaryColor;
  207. font-size:$h2;
  208. line-height:.8rem;
  209. }
  210. .p-info {
  211. margin-bottom:0.4rem;
  212. .platform_store{font-size:$h2;color: red;border: 1px solid red;border-radius:0.15rem;padding:0 .2rem;}
  213. .bargain_limit_number{font-size:$h2;color:#999;}
  214. }
  215. }
  216. }
  217. }
  218. </style>