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

207 lines
4.3 KiB

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