Bargainlist.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-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 goods-list single-column" @scrolltolower="loadMore" scroll-y="true">
  16. <view class="div goods-item"
  17. v-for='(item, index) in bargainList'
  18. v-bind:key='index'
  19. >
  20. <view class="div goods-img">
  21. <view class="div img-content" style="height: 100px;">
  22. <image mode="aspectFit" class="img" :src="item.bargain_goods_image_url" />
  23. </view>
  24. <!---->
  25. </view>
  26. <view class="div info-wrap">
  27. <view class="div name-wrap">
  28. <view class="div goods-name">
  29. {{item.bargain_goods_name}}
  30. </view>
  31. <view class="div progress-wrap">
  32. <view class="div progress-content">
  33. <view class="div progress-bar">
  34. <view class="div progress-inner-bar" :style="'width:'+item.order_percent+'%'"></view>
  35. </view>
  36. <!---->
  37. </view>
  38. <text class="span color-base-text font-size-activity-tag txt lineheight-clear">
  39. <text class="span">已砍{{item.order_count}}件</text>
  40. </text>
  41. </view>
  42. </view>
  43. <view class="div lineheight-clear">
  44. <view class="div discount-price">
  45. <text class="span font-size-tag lineheight-clear txt">
  46. <text class="span">底价:</text>
  47. </text>
  48. <text class="span unit color-base-text font-size-tag">
  49. <text class="span">&yen;</text>
  50. </text>
  51. <text class="span price color-base-text font-size-toolbar">
  52. <text class="span">{{item.bargain_floorprice}}</text>
  53. </text>
  54. </view>
  55. </view>
  56. <view class="div pro-info">
  57. <view class="div view-content delete-price font-size-activity-tag color-tip">
  58. <text class="span font-size-tag lineheight-clear txt">
  59. <text class="span">原价:</text>
  60. </text>
  61. <text class="span unit">
  62. <text class="span">&yen;</text>
  63. </text>
  64. <text class="span price">
  65. <text class="span">{{item.bargain_goods_price}}</text>
  66. </text>
  67. </view>
  68. <view class="div view-content">
  69. <view class="div button-content" @click="goDetail(item)">
  70. 去砍价
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="div loading-wrapper" v-if="bargainList.length > 0">
  77. <view class="p common-no-more" v-if='!isMore'>没有更多了</view>
  78. <uni-load-more status="loading" color='#e93b3d' v-if='isMore'></uni-load-more>
  79. </view>
  80. <empty-record v-if='bargainList.length <= 0 && !isMore'></empty-record>
  81. </scroll-view>
  82. </view>
  83. </view></home-base>
  84. </template>
  85. <script>
  86. import {getFontSize} from '@/util/common'
  87. import TitleHeader from '../../TitleHeader'
  88. import { urlencode } from '@/util/common'
  89. import HomeBase from '../HomeBase'
  90. import EmptyRecord from '../../EmptyRecord'
  91. import { getBargainList } from '../../../api/homeBargain'
  92. export default {
  93. name: 'PintuanList',
  94. components:{
  95. TitleHeader,
  96. HomeBase,
  97. EmptyRecord
  98. },
  99. mounted(){
  100. // #ifdef MP-WEIXIN
  101. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  102. // #endif
  103. },
  104. computed:{
  105. fontSize(){
  106. return getFontSize()
  107. },
  108. },
  109. data(){
  110. return {
  111. navHeight: 0,
  112. bargainList: [],
  113. params: { 'page': 0, 'per_page': 10 },
  114. loading: false, // 是否加载更多
  115. isMore: true // 是否有更多
  116. }
  117. },
  118. created () {
  119. this.loadMore()
  120. },
  121. methods:{
  122. goBack(){uni.navigateBack({delta:1})},
  123. loadMore () {
  124. this.loading = true
  125. this.params.page = ++this.params.page
  126. if (this.isMore) {
  127. this.loading = false
  128. this.getBargainList(true)
  129. }
  130. },
  131. getBargainList () {
  132. uni.showLoading({ title: '加载中' })
  133. getBargainList(this.params).then(res => {
  134. uni.hideLoading()
  135. if (res.result.hasmore) {
  136. this.isMore = true
  137. } else {
  138. this.isMore = false
  139. }
  140. if (this.bargainList) {
  141. this.bargainList = this.bargainList.concat(res.result.bargain_list)
  142. } else {
  143. this.bargainList = res.result.bargain_list
  144. }
  145. }).catch(function (error) {
  146. uni.hideLoading()
  147. uni.showToast({icon:'none',title: error.message})
  148. })
  149. },
  150. goDetail (item) {
  151. uni.navigateTo({ url: '/pages/home/goodsdetail/Goodsdetail'+'?'+urlencode( { 'goods_id': item.bargain_goods_id, 'bargain_id': item.bargain_id } )})
  152. }
  153. }
  154. }
  155. </script>
  156. <style scoped lang='scss'>
  157. .scroll-view-wrapper{display: flex;flex-direction: column;}
  158. .scroll-view{flex:1}
  159. .goods-list.single-column .pro-info .button-content {width: 70px;line-height: 2.3;font-size:$fontSize;border-radius: 20px;text-align: center;color: #fff;background: $primaryGradualColor;}
  160. .font-size-activity-tag {font-size:$h6!important;}
  161. .font-size-tag {font-size:$fontSize!important;}
  162. .font-size-toolbar {font-size:$h2!important;}
  163. .color-tip { color: #909399!important; }
  164. .color-base-text {color: #ff4544!important;}
  165. .img-content >img{width: 100%;height: 100%;}
  166. .goods-list.single-column .goods-item {padding: 13px;background: #fff;margin: 10px 15px;border-radius: 5px;display: -webkit-box;display: -webkit-flex;display: flex;position: relative}
  167. .goods-list.single-column .goods-item .goods-img {width: 100px;height: 100px;overflow: hidden;border-radius: 5px;margin-right: 10px}
  168. .goods-list.single-column .goods-item .goods-img .img-content {width: 100%;height: 100%}
  169. .goods-list.single-column .goods-item .goods-tag {color: #fff;line-height: 1;padding: 4px 6px;position: absolute;border-top-left-radius: 5px;border-bottom-right-radius: 5px;top: 13px;left: 13px;font-size:$fontSize}
  170. .goods-list.single-column .goods-item .info-wrap {-webkit-box-flex: 1;-webkit-flex: 1;flex: 1;display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-webkit-flex-direction: column;flex-direction: column}
  171. .goods-list.single-column .goods-item .name-wrap {-webkit-box-flex: 1;-webkit-flex: 1;flex: 1}
  172. .goods-list.single-column .goods-item .goods-name {font-size:$subFontSize;line-height: 1.3;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;height: 34px}
  173. .goods-list.single-column .goods-item .progress-wrap {display: -webkit-box;display: -webkit-flex;display: flex;margin-top: 5px;align-items: center;}
  174. .goods-list.single-column .goods-item .progress-wrap .progress-content {-webkit-box-flex: 1;-webkit-flex: 1;flex: 1}
  175. .goods-list.single-column .goods-item .progress-wrap .progress-content .progress-bar{background-color: rgb(255, 199, 199); height: 3px;}
  176. .goods-list.single-column .goods-item .progress-wrap .progress-content .progress-bar .progress-inner-bar{background-color: rgb(255, 69, 68);height:100%}
  177. .goods-list.single-column .goods-item .progress-wrap .txt {margin: 0 50px 0 10px}
  178. .goods-list.single-column .goods-item .discount-price {display: inline-block;font-weight: 700;line-height: 1;margin-top: 8px}
  179. .goods-list.single-column .goods-item .discount-price .unit {margin-right: 3px}
  180. .goods-list.single-column .goods-item .discount-price .txt {font-weight: 400}
  181. .goods-list.single-column .goods-item .pro-info {position: relative;margin-top: 8px}
  182. .goods-list.single-column .goods-item .pro-info .delete-price {-webkit-box-flex: 1;-webkit-flex: 1;flex: 1;display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-align: end;-webkit-align-items: flex-end;align-items: flex-end}
  183. .goods-list.single-column .goods-item .pro-info .delete-price .unit {margin-right: 3px;text-decoration: line-through}
  184. .goods-list.single-column .goods-item .pro-info .delete-price .price {text-decoration: line-through}
  185. .goods-list.single-column .goods-item .pro-info .view-content {line-height: 1}
  186. .goods-list.single-column .goods-item .pro-info .view-content:nth-child(2) {position: absolute;right: 0;bottom: 0}
  187. .goods-list.single-column .goods-item .member-price-tag {display: inline-block;width: 30px;line-height: 1;margin-left: 3px}
  188. .goods-list.single-column .goods-item .member-price-tag .img-content {width: 100%}
  189. </style>