commodity.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  6. </view>
  7. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  8. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  9. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  10. <!-- 空白页 -->
  11. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  12. <!-- 已上架 -->
  13. <view class="commodity-box" >
  14. <view class="commodity" v-for="item in 10">
  15. <view class="commodity-detail">
  16. <view class="commodity-img">
  17. <image src="../../static/user/ground.png" mode=""></image>
  18. </view>
  19. <view class="commodity-content">
  20. <view class="top">
  21. 满园春11111111111111111111111111111111111
  22. </view>
  23. <view class="bottom">
  24. <view class="price">
  25. <text class="text">¥</text>999
  26. </view>
  27. <view class="status">
  28. 已上架
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  35. <!-- <view class="input">
  36. 添加商品
  37. </view> -->
  38. </view>
  39. </scroll-view>
  40. </swiper-item>
  41. </swiper>
  42. </view>
  43. </template>
  44. <script>
  45. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  46. export default {
  47. data() {
  48. return {
  49. tabCurrentIndex: 0,
  50. navList: [{
  51. state: 0,
  52. text: '全部',
  53. orderList: [],
  54. page: 1, //当前页面
  55. limit: 10 //每次信息条数
  56. },
  57. {
  58. state: 0,
  59. text: '已上架',
  60. orderList: [],
  61. page: 1, //当前页面
  62. limit: 10 //每次信息条数
  63. },
  64. {
  65. state: 0,
  66. text: '已下架',
  67. orderList: [],
  68. page: 1, //当前页面
  69. limit: 10 //每次信息条数
  70. }
  71. ]
  72. };
  73. },
  74. methods: {
  75. //顶部tab点击
  76. tabClick(index) {
  77. this.tabCurrentIndex = index;
  78. },
  79. }
  80. }
  81. </script>
  82. <style lang="scss">
  83. page,
  84. .content {
  85. background: $page-color-base;
  86. height: 100%;
  87. }
  88. .swiper-box {
  89. height: calc(100% - 40px);
  90. }
  91. .list-scroll-content {
  92. height: 100%;
  93. }
  94. .commodity-box {
  95. width: 750rpx;
  96. // margin: 20rpx 0;
  97. // background-color: #FFFFFF;
  98. .commodity {
  99. width: 750rpx;
  100. background-color: #FFFFFF;
  101. .checkbox1 {
  102. font-size: 44rpx;
  103. line-height: 1;
  104. padding: 4rpx;
  105. color: $font-color-disabled;
  106. background: red;
  107. border-radius: 50rpx;
  108. }
  109. .commodity-detail {
  110. padding: 30rpx 0;
  111. padding: 30 34rpx 0 30rpx;
  112. display: flex;
  113. .commodity-img {
  114. margin: 0 30rpx;
  115. width: 147rpx;
  116. height: 146rpx;
  117. border-radius: 10rpx;
  118. image {
  119. width: 100%;
  120. height: 100%;
  121. }
  122. }
  123. .commodity-content {
  124. width: 500rpx;
  125. display: flex;
  126. flex-direction: column;
  127. justify-content: space-between;
  128. .top {
  129. white-space: nowrap;
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. font-size: 28rpx;
  133. font-family: PingFangSC;
  134. font-weight: 500;
  135. color: #333333;
  136. }
  137. .bottom {
  138. display: flex;
  139. justify-content: space-between;
  140. align-items: center;
  141. .price {
  142. font-size: 36rpx;
  143. font-family: PingFang SC;
  144. font-weight: bold;
  145. color: #FD5B23;
  146. .text{
  147. font-size: 24rpx;
  148. font-family: PingFang SC;
  149. font-weight: bold;
  150. color: #FD5B23;
  151. }
  152. }
  153. .status {
  154. width: 80rpx;
  155. height: 34rpx;
  156. background: #FEE1D7;
  157. border-radius: 5rpx;
  158. font-size: 20rpx;
  159. font-family: PingFangSC;
  160. font-weight: 500;
  161. color: #FD5B23;
  162. }
  163. }
  164. }
  165. }
  166. }
  167. .input{
  168. margin: 30rpx;
  169. text-align: center;
  170. position: absolute;
  171. bottom: 0;
  172. width: 674rpx;
  173. height: 88rpx;
  174. background: #52C696;
  175. border-radius: 44rpx;
  176. font-size: 36rpx;
  177. font-family: PingFang SC;
  178. font-weight: 500;
  179. line-height: 88rpx;
  180. color: #FFFFFF;
  181. }
  182. }
  183. .navbar {
  184. display: flex;
  185. height: 40px;
  186. padding: 0 5px;
  187. background: #fff;
  188. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  189. position: relative;
  190. z-index: 10;
  191. .nav-item {
  192. flex: 1;
  193. display: flex;
  194. justify-content: center;
  195. align-items: center;
  196. height: 100%;
  197. font-size: 12px;
  198. color: $font-color-dark;
  199. position: relative;
  200. &.current {
  201. color: $base-color;
  202. &:after {
  203. content: '';
  204. position: absolute;
  205. left: 50%;
  206. bottom: 0;
  207. transform: translateX(-50%);
  208. width: 44px;
  209. height: 0;
  210. border-bottom: 2px solid $base-color;
  211. }
  212. }
  213. }
  214. }
  215. </style>