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

225 lines
5.0 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" :height="!ifsale?333:0" :img-mode="ifsale?'aspectFill':''" :image="item.picture" :index="index">
  8. <view class="list-label" v-if="ifsale">已售{{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" :height="!ifsale?333:0" :img-mode="ifsale?'aspectFill':''" :image="item.picture" :index="index">
  35. <view class="list-label" v-if="ifsale">已售{{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. ifsale: {
  77. type: Boolean,
  78. default: true
  79. }
  80. },
  81. data(){
  82. return {
  83. // dataList: []
  84. }
  85. },
  86. computed: {
  87. dataList: {
  88. get() {
  89. console.log('组件当前数据====',this.list)
  90. console.log(this.ifsale)
  91. return this.list;
  92. },
  93. set(newValue) { console.log('newvalue',newValue) }
  94. },
  95. },
  96. // watch: {
  97. // list(newValue,oldValue) {
  98. // console.log('值变了',newValue)
  99. // console.log('旧值',this.$refs)
  100. // // this.$forceUpdate();
  101. // this.dataList = newValue
  102. // console.log('当前值',this.dataList)
  103. // return newValue
  104. // }
  105. // },
  106. onShow(){
  107. },
  108. deactivated() {
  109. },
  110. onLoad() {
  111. },
  112. destroyed() {
  113. },
  114. methods: {
  115. onClick(id){
  116. this.$url('/pages/goodsDetail/index?goods_id='+id);
  117. this.$emit('click');
  118. },
  119. goAd(type,url){
  120. if(url) {
  121. if(type == 0) {
  122. this.$url(url);
  123. }else {
  124. this.$url('/pages/index/urlWeb?url='+url);
  125. }
  126. }
  127. },
  128. clear() {
  129. console.log('组件名',this.$refs)
  130. this.$refs.uWaterfall[0].clear();
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped="scoped">
  136. // ====
  137. .list-warter {
  138. border-radius: 20rpx;
  139. margin: 10px 5px;
  140. margin-top: 0px;
  141. background-color: #ffffff;
  142. // padding: 8px;
  143. position: relative;
  144. overflow: hidden;
  145. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  146. }
  147. .u-close {
  148. position: absolute;
  149. top: 32rpx;
  150. right: 32rpx;
  151. }
  152. .list-image {
  153. width: 100%;
  154. border-radius: 4px;
  155. }
  156. .list-title {
  157. font-size: 28rpx;
  158. font-weight: bold;
  159. color: $u-main-color;
  160. }
  161. .list-label{
  162. position: absolute;
  163. bottom: 0;
  164. right: 0;
  165. background-color: rgba(0,0,0,0.5);
  166. width: 140rpx;
  167. height: 48rpx;
  168. border-radius: 20rpx 0rpx 0rpx 0rpx;
  169. font-size: 22rpx;
  170. color: #FFFFFF;
  171. line-height: 48rpx;
  172. text-align: center;
  173. }
  174. .list-tag {
  175. display: flex;
  176. margin-top: 5px;
  177. }
  178. .list-tag-owner {
  179. background-color: $u-type-error;
  180. color: #FFFFFF;
  181. display: flex;
  182. align-items: center;
  183. padding: 4rpx 14rpx;
  184. border-radius: 50rpx;
  185. font-size: 20rpx;
  186. line-height: 1;
  187. }
  188. .list-tag-text {
  189. border: 1px solid $u-type-primary;
  190. color: $u-type-primary;
  191. margin-left: 10px;
  192. border-radius: 50rpx;
  193. line-height: 1;
  194. padding: 4rpx 14rpx;
  195. display: flex;
  196. align-items: center;
  197. border-radius: 50rpx;
  198. font-size: 20rpx;
  199. }
  200. .list-price {
  201. font-size: 30rpx;
  202. color: $u-type-error;
  203. margin-top: 5px;
  204. display: flex;
  205. align-items: center;
  206. }
  207. // ====
  208. </style>