金诚优选前端代码
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.

220 lines
4.8 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: 20rpx;
  134. margin: 10px 5px;
  135. margin-top: 0px;
  136. background-color: #ffffff;
  137. // padding: 8px;
  138. position: relative;
  139. overflow: hidden;
  140. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  141. }
  142. .u-close {
  143. position: absolute;
  144. top: 32rpx;
  145. right: 32rpx;
  146. }
  147. .list-image {
  148. width: 100%;
  149. border-radius: 4px;
  150. }
  151. .list-title {
  152. font-size: 28rpx;
  153. font-weight: bold;
  154. color: $u-main-color;
  155. }
  156. .list-label{
  157. position: absolute;
  158. bottom: 0;
  159. right: 0;
  160. background-color: rgba(0,0,0,0.5);
  161. width: 140rpx;
  162. height: 48rpx;
  163. border-radius: 20rpx 0rpx 0rpx 0rpx;
  164. font-size: 22rpx;
  165. color: #FFFFFF;
  166. line-height: 48rpx;
  167. text-align: center;
  168. }
  169. .list-tag {
  170. display: flex;
  171. margin-top: 5px;
  172. }
  173. .list-tag-owner {
  174. background-color: $u-type-error;
  175. color: #FFFFFF;
  176. display: flex;
  177. align-items: center;
  178. padding: 4rpx 14rpx;
  179. border-radius: 50rpx;
  180. font-size: 20rpx;
  181. line-height: 1;
  182. }
  183. .list-tag-text {
  184. border: 1px solid $u-type-primary;
  185. color: $u-type-primary;
  186. margin-left: 10px;
  187. border-radius: 50rpx;
  188. line-height: 1;
  189. padding: 4rpx 14rpx;
  190. display: flex;
  191. align-items: center;
  192. border-radius: 50rpx;
  193. font-size: 20rpx;
  194. }
  195. .list-price {
  196. font-size: 30rpx;
  197. color: $u-type-error;
  198. margin-top: 5px;
  199. display: flex;
  200. align-items: center;
  201. }
  202. // ====
  203. </style>