海南旅游项目 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
4.7 KiB

  1. <template>
  2. <view>
  3. <u-waterfall v-model="dataList" ref="uWaterfall" v-for="itemFather of listlength" :key="itemFather" v-if="itemFather == tabindex">
  4. <template v-slot:left="{leftList}">
  5. <view class="list-warter" v-for="(item, index) in leftList" :key="index">
  6. <view v-if="!item.is_ad" @click="onClick(item.id)">
  7. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index">
  8. <view class="list-label">已售{{item.sale}}</view>
  9. </u-lazy-load>
  10. <view class="lf-p-20">
  11. <view class="list-title">
  12. {{item.title}}
  13. </view>
  14. <view class="list-price">
  15. <!-- <text>{{item.price}}</text> -->
  16. <lf-price :price="item.price"></lf-price>
  17. <text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view v-else @click="goAd(item.type,item.url)">
  22. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
  23. <view class="lf-p-20">
  24. <view class="list-title">
  25. {{item.title}}
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <template v-slot:right="{rightList}">
  32. <view class="list-warter" v-for="(item, index) in rightList" :key="index">
  33. <view v-if="!item.is_ad" @click="onClick(item.id)">
  34. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index">
  35. <view class="list-label">已售{{item.sale}}</view>
  36. </u-lazy-load>
  37. <view class="lf-p-20">
  38. <view class="list-title">
  39. {{item.title}}
  40. </view>
  41. <view class="list-price">
  42. <!-- <text>{{item.price}}</text> -->
  43. <lf-price :price="item.price"></lf-price>
  44. <text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view v-else @click="goAd(item.type,item.url)">
  49. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
  50. <view class="lf-p-20">
  51. <view class="list-title">
  52. {{item.title}}
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. </u-waterfall>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. props: {
  64. list: {
  65. type: Array,
  66. default: []
  67. },
  68. tabindex: {
  69. type: Number,
  70. default: 0
  71. },
  72. listlength: {
  73. type: Number,
  74. default: 1
  75. }
  76. },
  77. data(){
  78. return {
  79. dataList: []
  80. }
  81. },
  82. computed: {
  83. // dataList: {
  84. // get() {
  85. // console.log('组件当前数据====',this.list)
  86. // return this.list;
  87. // },
  88. // set(newValue) { console.log('newvalue',newValue) }
  89. // },
  90. },
  91. watch: {
  92. list(newValue,oldValue) {
  93. console.log('值变了',newValue)
  94. console.log('旧值',this.$refs)
  95. // this.$forceUpdate();
  96. this.dataList = newValue
  97. console.log('当前值',this.dataList)
  98. return newValue
  99. }
  100. },
  101. onShow(){
  102. },
  103. deactivated() {
  104. },
  105. onLoad() {
  106. },
  107. destroyed() {
  108. },
  109. methods: {
  110. onClick(id){
  111. this.$url('/pages/goodsDetail/index?goods_id='+id);
  112. this.$emit('click');
  113. },
  114. goAd(type,url){
  115. if(url) {
  116. if(type == 0) {
  117. this.$url(url);
  118. }else {
  119. this.$url('/pages/index/urlWeb?url='+url);
  120. }
  121. }
  122. },
  123. clear() {
  124. console.log('组件名',this.$refs)
  125. this.$refs.uWaterfall[0].clear();
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped="scoped">
  131. // ====
  132. .list-warter {
  133. border-radius: 8px;
  134. margin: 10px 5px;
  135. margin-top: 0px;
  136. background-color: #ffffff;
  137. // padding: 8px;
  138. position: relative;
  139. overflow: hidden;
  140. }
  141. .u-close {
  142. position: absolute;
  143. top: 32rpx;
  144. right: 32rpx;
  145. }
  146. .list-image {
  147. width: 100%;
  148. border-radius: 4px;
  149. }
  150. .list-title {
  151. font-size: 28rpx;
  152. font-weight: bold;
  153. color: $u-main-color;
  154. }
  155. .list-label{
  156. position: absolute;
  157. bottom: 0;
  158. right: 0;
  159. background-color: rgba(0,0,0,0.5);
  160. width: 140rpx;
  161. height: 48rpx;
  162. border-radius: 20rpx 0rpx 0rpx 0rpx;
  163. font-size: 22rpx;
  164. color: #FFFFFF;
  165. line-height: 48rpx;
  166. text-align: center;
  167. }
  168. .list-tag {
  169. display: flex;
  170. margin-top: 5px;
  171. }
  172. .list-tag-owner {
  173. background-color: $u-type-error;
  174. color: #FFFFFF;
  175. display: flex;
  176. align-items: center;
  177. padding: 4rpx 14rpx;
  178. border-radius: 50rpx;
  179. font-size: 20rpx;
  180. line-height: 1;
  181. }
  182. .list-tag-text {
  183. border: 1px solid $u-type-primary;
  184. color: $u-type-primary;
  185. margin-left: 10px;
  186. border-radius: 50rpx;
  187. line-height: 1;
  188. padding: 4rpx 14rpx;
  189. display: flex;
  190. align-items: center;
  191. border-radius: 50rpx;
  192. font-size: 20rpx;
  193. }
  194. .list-price {
  195. font-size: 30rpx;
  196. color: $u-type-error;
  197. margin-top: 5px;
  198. display: flex;
  199. align-items: center;
  200. }
  201. // ====
  202. </style>