index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="commodity">
  3. <search></search>
  4. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  5. <view class="li" v-for="(item,index) in list" :key="index">
  6. <view class="h2_box">
  7. <view class="h2_left">
  8. <view class="btn">
  9. 启动
  10. </view>
  11. <h2>金龙鱼非转基因调和油</h2>
  12. </view>
  13. <img src="@/static/images/moreHorizontal@2x.png" alt="" @click="activeId = item.id">
  14. </view>
  15. <p>可抵扣积分:234</p>
  16. <p>会员优惠价:¥1234.00</p>
  17. <view class="footer">
  18. <view>抵扣金额:<text class="money">¥3214.59</text></view>
  19. <text>编辑</text>
  20. </view>
  21. <u-transition :show="item.id == activeId">
  22. <moreShow @moreShowActive="moreShowActive"></moreShow>
  23. </u-transition>
  24. </view>
  25. <view style="height:110rpx;"></view>
  26. </scroll-view>
  27. <view class="footer_btn">
  28. 添加商品
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import moreShow from "@/pagesA/components/more_show/index.vue"
  34. import search from "@/pagesA/components/search/index.vue"
  35. export default {
  36. components: {
  37. search,
  38. moreShow
  39. },
  40. data() {
  41. return {
  42. list: [{
  43. id: 1
  44. }, {
  45. id: 2
  46. }, {
  47. id: 3
  48. }, {
  49. id: 4
  50. }, {
  51. id: 5
  52. }, {
  53. id: 6
  54. }, {
  55. id: 7
  56. }],
  57. scrollTop: 0,
  58. activeId: 0, //当前展开ID
  59. };
  60. },
  61. methods: {
  62. moreShowActive(int) {
  63. console.log(this.activeId, int)
  64. this.activeId = 0 //完成操作置空
  65. },
  66. //触底
  67. lower: function(e) {
  68. console.log(e)
  69. },
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .strikeBalance {
  75. background-color: #f7f7f7;
  76. }
  77. .footer_btn {
  78. height: 104rpx;
  79. text-align: center;
  80. position: fixed;
  81. bottom: 0rpx;
  82. left: 32rpx;
  83. right: 32rpx;
  84. line-height: 104rpx;
  85. border-radius: 24rpx;
  86. background-color: #363c4f;
  87. font-size: 32rpx;
  88. font-weight: bold;
  89. color: #FFFFFF;
  90. }
  91. .scroll-Y {
  92. background-color: #fff;
  93. height: calc(100vh - 100rpx);
  94. .li {
  95. border-bottom: 2rpx solid #e9e9e9;
  96. padding: 40rpx 32rpx 30rpx;
  97. position: relative;
  98. .h2_box {
  99. display: flex;
  100. align-items: center;
  101. justify-content: space-between;
  102. margin-bottom: 24rpx;
  103. img {
  104. width: 40rpx;
  105. height: 40rpx;
  106. }
  107. .h2_left {
  108. display: flex;
  109. align-items: center;
  110. &>.btn {
  111. background: #DEF6E8;
  112. border-radius: 4rpx;
  113. font-size: 24rpx;
  114. font-weight: 400;
  115. padding: 4rpx 8rpx;
  116. color: #41CF7D;
  117. margin-right: 10rpx;
  118. }
  119. &>h2 {
  120. font-size: 32rpx;
  121. font-weight: 500;
  122. color: #222222;
  123. }
  124. }
  125. }
  126. p {
  127. font-size: 24rpx;
  128. font-weight: 400;
  129. color: #767A80;
  130. padding-bottom: 12rpx;
  131. }
  132. .footer {
  133. margin-top: 20rpx;
  134. display: flex;
  135. align-items: center;
  136. &>text {
  137. color: #0098ED;
  138. font-size: 22rpx;
  139. }
  140. &>view {
  141. flex: 0.5;
  142. flex-shrink: 0;
  143. margin-right: 20rpx;
  144. background: #F9F9F9;
  145. border-radius: 8rpx;
  146. padding: 20rpx;
  147. font-size: 24rpx;
  148. font-weight: 400;
  149. color: #767A80;
  150. &>.money {
  151. font-size: 28rpx;
  152. font-weight: bold;
  153. color: #F57737;
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>