accessory.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="content">
  3. <empty v-if="loaded && goodList.length == 0"></empty>
  4. <view class="good flex" v-for="item in goodList" @click="navTo('/pages/product/product?id=' + item.id)">
  5. <view class="good-img">
  6. <image :src="item.image" mode=""></image>
  7. </view>
  8. <view class="good-info flex">
  9. <view class="good-name clamp2">
  10. {{item.store_name}}
  11. </view>
  12. <view class="good-price">
  13. <view class="old-price" v-if="item.ot_price*1 > item.price*1">
  14. <text class="old-left">¥{{item.ot_price}}</text>
  15. <image src="../../static/icon/down.png" mode="widthFix"></image>
  16. <text class="old-right">直降{{item.ot_price*1 - item.price*1}}元</text>
  17. </view>
  18. <view class="new-price flex">
  19. <view class="">
  20. ¥{{item.price}}
  21. </view>
  22. <view class="good-tip">
  23. 立即购买
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <uni-load-more :status="loadingType" v-if="!(loaded && goodList.length == 0)"></uni-load-more>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. goodList: [],
  37. page: 1,
  38. limit: 10,
  39. loadingType: 'more',
  40. loaded:false
  41. }
  42. },
  43. onLoad() {
  44. },
  45. onShow() {
  46. },
  47. onReachBottom() {
  48. this.getGoodList()
  49. },
  50. onReady() {
  51. },
  52. methods: {
  53. navTo(url) {
  54. if (url.indexOf('http') != -1) {
  55. window.location.href = url
  56. } else {
  57. uni.navigateTo({
  58. url,
  59. fail() {
  60. uni.switchTab({
  61. url
  62. })
  63. }
  64. })
  65. }
  66. },
  67. getGoodList() {
  68. let obj = this
  69. if (obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  70. return
  71. }
  72. obj.loadingType = 'loading'
  73. getProducts({
  74. page: obj.page,
  75. limit: obj.limit
  76. }).then(res => {
  77. obj.goodList = obj.goodList.concat(res.data)
  78. obj.page++
  79. if (obj.limit == res.data.length) {
  80. obj.loadingType = 'more'
  81. } else {
  82. obj.loadingType = 'noMore'
  83. }
  84. obj.loaded = true
  85. })
  86. },
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. .good {
  92. width: 690rpx;
  93. height: 276rpx;
  94. background: #FFFFFF;
  95. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  96. border-radius: 10rpx;
  97. margin: auto;
  98. padding: 20rpx 15rpx;
  99. margin-bottom: 20rpx;
  100. &:last-of-type {
  101. margin-bottom: 0rpx;
  102. }
  103. .good-img {
  104. flex-shrink: 0;
  105. width: 236rpx;
  106. height: 236rpx;
  107. border-radius: 10rpx;
  108. margin-right: 22rpx;
  109. image {
  110. width: 236rpx;
  111. height: 236rpx;
  112. border-radius: 10rpx;
  113. }
  114. }
  115. .good-info {
  116. flex-grow: 1;
  117. height: 100%;
  118. flex-direction: column;
  119. justify-content: space-between;
  120. align-items: flex-start;
  121. .good-name {
  122. font-size: 32rpx;
  123. font-weight: bold;
  124. padding-top: 10rpx;
  125. color: #333333;
  126. }
  127. .good-price {
  128. width: 100%;
  129. image {
  130. width: 14rpx;
  131. margin: 0 6rpx 0 10rpx;
  132. }
  133. .old-price {
  134. .old-left {
  135. font-size: 26rpx;
  136. font-weight: 500;
  137. text-decoration: line-through;
  138. color: #999999;
  139. }
  140. .old-right {
  141. font-size: 24rpx;
  142. font-weight: bold;
  143. color: #B59467;
  144. }
  145. }
  146. .new-price {
  147. width: 100%;
  148. font-size: 36rpx;
  149. font-weight: bold;
  150. color: #FF4C4C;
  151. justify-content: space-between;
  152. .good-tip {
  153. width: 137rpx;
  154. height: 52rpx;
  155. background: $base-color;
  156. border-radius: 26rpx;
  157. position: relative;
  158. font-size: 26rpx;
  159. font-weight: 500;
  160. color: #FFFFFF;
  161. line-height: 52rpx;
  162. text-align: center;
  163. }
  164. }
  165. }
  166. }
  167. }
  168. </style>