commodity.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="content">
  3. <!-- <view class="status_bar"></view>
  4. <view class="content-money">
  5. <view class="money-box">
  6. <view class="goback-box" @click="toBack">
  7. <image class="goback" src="../../static/img/back.png" mode=""></image>
  8. </view>
  9. <view class="header">商品管理</view>
  10. </view>
  11. </view> -->
  12. <view class="commodity-box">
  13. <view class="commodity" v-for="item in orderList">
  14. <view class="commodity-detail">
  15. <view class="commodity-img"><image :src="item.image" mode=""></image></view>
  16. <view class="commodity-content">
  17. <view class="top">{{item.store_name}}</view>
  18. <view class="bottom">
  19. <view class="price">
  20. <text class="text">¥</text>
  21. {{item.price}}
  22. </view>
  23. <view class="status">库存:{{item.in_stock}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <uni-load-more :status="loadingType"></uni-load-more>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  34. import { goods } from '@/api/merchant.js'
  35. export default {
  36. data() {
  37. return {
  38. loadingType: 'more',
  39. orderList: [],
  40. page: 1, //当前页面
  41. limit: 20 //每次信息条数
  42. };
  43. },
  44. onLoad() {
  45. this.loadData();
  46. },
  47. onReachBottom() {
  48. this.loadData();
  49. },
  50. methods: {
  51. loadData() {
  52. let obj = this;
  53. console.log('加载数据');
  54. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  55. return;
  56. }
  57. obj.loadingType = 'loading'
  58. goods({page:obj.page,limit:obj.limit}).then(({data}) =>{
  59. console.log(data)
  60. obj.orderList = obj.orderList.concat(data.data);
  61. obj.page ++
  62. if (data.data.length == obj.limit) {
  63. obj.loadingType = 'more';
  64. } else {
  65. obj.loadingType = 'noMore';
  66. }
  67. })
  68. },
  69. // 点击返回 我的页面
  70. toBack() {
  71. uni.navigateBack({
  72. })
  73. },
  74. choose() {
  75. this.isBian = !this.isBian;
  76. },
  77. nav(url){
  78. uni.navigateTo({
  79. url
  80. })
  81. }
  82. }
  83. };
  84. </script>
  85. <style lang="scss">
  86. page,
  87. .content {
  88. background: $page-color-base;
  89. height: 100%;
  90. }
  91. .swiper-box {
  92. height: calc(100% - 40px);
  93. }
  94. .list-scroll-content {
  95. height: 100%;
  96. }
  97. .status_bar {
  98. height: var(--status-bar-height);
  99. width: 100%;
  100. background: #ffffff;
  101. }
  102. .money-box {
  103. height: 80rpx;
  104. color: #000000;
  105. text-align: center;
  106. font-size: 35rpx;
  107. position: relative;
  108. background-color: #FFFFFF;
  109. .header {
  110. position: absolute;
  111. left: 0;
  112. top: 0;
  113. width: 100%;
  114. height: 80rpx;
  115. font-size: 32rpx;
  116. font-weight: 700;
  117. z-index: 99;
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. }
  122. .goback-box {
  123. position: absolute;
  124. left: 24rpx;
  125. top: 0;
  126. height: 80rpx;
  127. display: flex;
  128. align-items: center;
  129. }
  130. .goback {
  131. z-index: 100;
  132. width: 20rpx;
  133. height: 34rpx;
  134. }
  135. }
  136. .commodity-box {
  137. width: 750rpx;
  138. // margin: 20rpx 0;
  139. // background-color: #FFFFFF;
  140. .commodity {
  141. width: 750rpx;
  142. background-color: #ffffff;
  143. .checkbox1 {
  144. font-size: 44rpx;
  145. line-height: 1;
  146. padding: 4rpx;
  147. color: $font-color-disabled;
  148. background: red;
  149. border-radius: 50rpx;
  150. }
  151. .commodity-detail {
  152. padding: 30rpx 0;
  153. padding: 30 34rpx 0 30rpx;
  154. display: flex;
  155. .commodity-img {
  156. margin: 0 30rpx;
  157. width: 147rpx;
  158. height: 146rpx;
  159. border-radius: 10rpx;
  160. image {
  161. width: 100%;
  162. height: 100%;
  163. }
  164. }
  165. .commodity-content {
  166. width: 500rpx;
  167. display: flex;
  168. flex-direction: column;
  169. justify-content: space-between;
  170. padding: 10rpx 0;
  171. .top {
  172. white-space: nowrap;
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  175. font-size: 28rpx;
  176. font-family: PingFangSC;
  177. font-weight: 500;
  178. color: #333333;
  179. }
  180. .bottom {
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. .price {
  185. font-size: 36rpx;
  186. font-family: PingFang SC;
  187. font-weight: bold;
  188. color: #fd5b23;
  189. .text {
  190. font-size: 24rpx;
  191. font-family: PingFang SC;
  192. font-weight: bold;
  193. color: #fd5b23;
  194. }
  195. }
  196. .status {
  197. padding: 6rpx;
  198. background: #fee1d7;
  199. border-radius: 5rpx;
  200. font-size: 20rpx;
  201. font-family: PingFangSC;
  202. font-weight: 500;
  203. color: #fd5b23;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. }
  210. </style>