commodity.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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: 10 //每次信息条数
  42. };
  43. },
  44. onLoad() {
  45. this.loadData();
  46. },
  47. methods: {
  48. loadData() {
  49. let obj = this;
  50. console.log('加载数据');
  51. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  52. return;
  53. }
  54. obj.loadingType = 'loading'
  55. goods({page:obj.page,limit:obj.limit}).then(({data}) =>{
  56. console.log(data)
  57. obj.orderList = obj.orderList.concat(data.data);
  58. obj.page ++
  59. if (data.data.length == obj.limit) {
  60. obj.loadingType = 'more';
  61. } else {
  62. obj.loadingType = 'noMore';
  63. }
  64. })
  65. },
  66. // 点击返回 我的页面
  67. toBack() {
  68. uni.navigateBack({
  69. })
  70. },
  71. choose() {
  72. this.isBian = !this.isBian;
  73. },
  74. nav(url){
  75. uni.navigateTo({
  76. url
  77. })
  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. .status_bar {
  95. height: var(--status-bar-height);
  96. width: 100%;
  97. background: #ffffff;
  98. }
  99. .money-box {
  100. height: 80rpx;
  101. color: #000000;
  102. text-align: center;
  103. font-size: 35rpx;
  104. position: relative;
  105. background-color: #FFFFFF;
  106. .header {
  107. position: absolute;
  108. left: 0;
  109. top: 0;
  110. width: 100%;
  111. height: 80rpx;
  112. font-size: 32rpx;
  113. font-weight: 700;
  114. z-index: 99;
  115. display: flex;
  116. justify-content: center;
  117. align-items: center;
  118. }
  119. .goback-box {
  120. position: absolute;
  121. left: 24rpx;
  122. top: 0;
  123. height: 80rpx;
  124. display: flex;
  125. align-items: center;
  126. }
  127. .goback {
  128. z-index: 100;
  129. width: 20rpx;
  130. height: 34rpx;
  131. }
  132. }
  133. .commodity-box {
  134. width: 750rpx;
  135. // margin: 20rpx 0;
  136. // background-color: #FFFFFF;
  137. .commodity {
  138. width: 750rpx;
  139. background-color: #ffffff;
  140. .checkbox1 {
  141. font-size: 44rpx;
  142. line-height: 1;
  143. padding: 4rpx;
  144. color: $font-color-disabled;
  145. background: red;
  146. border-radius: 50rpx;
  147. }
  148. .commodity-detail {
  149. padding: 30rpx 0;
  150. padding: 30 34rpx 0 30rpx;
  151. display: flex;
  152. .commodity-img {
  153. margin: 0 30rpx;
  154. width: 147rpx;
  155. height: 146rpx;
  156. border-radius: 10rpx;
  157. image {
  158. width: 100%;
  159. height: 100%;
  160. }
  161. }
  162. .commodity-content {
  163. width: 500rpx;
  164. display: flex;
  165. flex-direction: column;
  166. justify-content: space-between;
  167. padding: 10rpx 0;
  168. .top {
  169. white-space: nowrap;
  170. overflow: hidden;
  171. text-overflow: ellipsis;
  172. font-size: 28rpx;
  173. font-family: PingFangSC;
  174. font-weight: 500;
  175. color: #333333;
  176. }
  177. .bottom {
  178. display: flex;
  179. justify-content: space-between;
  180. align-items: center;
  181. .price {
  182. font-size: 36rpx;
  183. font-family: PingFang SC;
  184. font-weight: bold;
  185. color: #fd5b23;
  186. .text {
  187. font-size: 24rpx;
  188. font-family: PingFang SC;
  189. font-weight: bold;
  190. color: #fd5b23;
  191. }
  192. }
  193. .status {
  194. padding: 6rpx;
  195. background: #fee1d7;
  196. border-radius: 5rpx;
  197. font-size: 20rpx;
  198. font-family: PingFangSC;
  199. font-weight: 500;
  200. color: #fd5b23;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. }
  207. </style>