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

231 lines
5.1 KiB

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