commodity.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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 class="bianj" @click="nav('/pages/merchant/compileCommodity')">
  11. 编辑
  12. </view>
  13. </view>
  14. </view>
  15. <view class="navbar">
  16. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  17. </view>
  18. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  19. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  20. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  21. <!-- 空白页 -->
  22. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  23. <!-- 已上架 -->
  24. <view class="commodity-box">
  25. <view class="commodity" v-for="item in 10">
  26. <view class="commodity-detail">
  27. <view class="commodity-img"><image src="../../static/user/ground.png" mode=""></image></view>
  28. <view class="commodity-content">
  29. <view class="top">满园春11111111111111111111111111111111111</view>
  30. <view class="bottom">
  31. <view class="price">
  32. <text class="text">¥</text>
  33. 999
  34. </view>
  35. <view class="status">已上架</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  41. </view>
  42. </scroll-view>
  43. </swiper-item>
  44. </swiper>
  45. <view class="input" @click="nav('/pages/merchant/Addcommodity')">添加商品</view>
  46. </view>
  47. </template>
  48. <script>
  49. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  50. export default {
  51. data() {
  52. return {
  53. tabCurrentIndex: 0,
  54. navList: [
  55. {
  56. state: 0,
  57. text: '全部',
  58. orderList: [],
  59. loadingType: 'more',
  60. page: 1, //当前页面
  61. limit: 10 //每次信息条数
  62. },
  63. {
  64. state: 0,
  65. text: '已上架',
  66. loadingType: 'more',
  67. orderList: [],
  68. page: 1, //当前页面
  69. limit: 10 //每次信息条数
  70. },
  71. {
  72. state: 0,
  73. text: '已下架',
  74. loadingType: 'more',
  75. orderList: [],
  76. page: 1, //当前页面
  77. limit: 10 //每次信息条数
  78. }
  79. ]
  80. };
  81. },
  82. onLoad() {
  83. this.loadData();
  84. },
  85. methods: {
  86. //顶部tab点击
  87. tabClick(index) {
  88. this.tabCurrentIndex = index;
  89. },
  90. changeTab(index) {
  91. this.tabCurrentIndex = index.detail.current;
  92. },
  93. loadData() {
  94. },
  95. // 点击返回 我的页面
  96. toBack() {
  97. uni.navigateBack({
  98. })
  99. },
  100. choose() {
  101. this.isBian = !this.isBian;
  102. },
  103. nav(url){
  104. uni.navigateTo({
  105. url
  106. })
  107. }
  108. }
  109. };
  110. </script>
  111. <style lang="scss">
  112. page,
  113. .content {
  114. background: $page-color-base;
  115. height: 100%;
  116. }
  117. .swiper-box {
  118. height: calc(100% - 40px);
  119. }
  120. .list-scroll-content {
  121. height: 100%;
  122. }
  123. .status_bar {
  124. height: var(--status-bar-height);
  125. width: 100%;
  126. background: #ffffff;
  127. }
  128. .money-box {
  129. height: 80rpx;
  130. color: #000000;
  131. text-align: center;
  132. font-size: 35rpx;
  133. position: relative;
  134. background-color: #FFFFFF;
  135. .header {
  136. position: absolute;
  137. left: 0;
  138. top: 0;
  139. width: 100%;
  140. height: 80rpx;
  141. font-size: 32rpx;
  142. font-weight: 700;
  143. z-index: 99;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. }
  148. .bianj {
  149. position: absolute;
  150. right: 28rpx;
  151. height: 80rpx;
  152. font-size: 28rpx;
  153. font-family: PingFangSC;
  154. font-weight: 400;
  155. color: #333333;
  156. z-index: 99;
  157. display: flex;
  158. justify-content: center;
  159. align-items: center;
  160. }
  161. .goback-box {
  162. position: absolute;
  163. left: 24rpx;
  164. top: 0;
  165. height: 80rpx;
  166. display: flex;
  167. align-items: center;
  168. }
  169. .goback {
  170. z-index: 100;
  171. width: 20rpx;
  172. height: 34rpx;
  173. }
  174. }
  175. .commodity-box {
  176. width: 750rpx;
  177. // margin: 20rpx 0;
  178. // background-color: #FFFFFF;
  179. .commodity {
  180. width: 750rpx;
  181. background-color: #ffffff;
  182. .checkbox1 {
  183. font-size: 44rpx;
  184. line-height: 1;
  185. padding: 4rpx;
  186. color: $font-color-disabled;
  187. background: red;
  188. border-radius: 50rpx;
  189. }
  190. .commodity-detail {
  191. padding: 30rpx 0;
  192. padding: 30 34rpx 0 30rpx;
  193. display: flex;
  194. .commodity-img {
  195. margin: 0 30rpx;
  196. width: 147rpx;
  197. height: 146rpx;
  198. border-radius: 10rpx;
  199. image {
  200. width: 100%;
  201. height: 100%;
  202. }
  203. }
  204. .commodity-content {
  205. width: 500rpx;
  206. display: flex;
  207. flex-direction: column;
  208. justify-content: space-between;
  209. padding: 10rpx 0;
  210. .top {
  211. white-space: nowrap;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. font-size: 28rpx;
  215. font-family: PingFangSC;
  216. font-weight: 500;
  217. color: #333333;
  218. }
  219. .bottom {
  220. display: flex;
  221. justify-content: space-between;
  222. align-items: center;
  223. .price {
  224. font-size: 36rpx;
  225. font-family: PingFang SC;
  226. font-weight: bold;
  227. color: #fd5b23;
  228. .text {
  229. font-size: 24rpx;
  230. font-family: PingFang SC;
  231. font-weight: bold;
  232. color: #fd5b23;
  233. }
  234. }
  235. .status {
  236. padding: 6rpx;
  237. background: #fee1d7;
  238. border-radius: 5rpx;
  239. font-size: 20rpx;
  240. font-family: PingFangSC;
  241. font-weight: 500;
  242. color: #fd5b23;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. }
  249. .navbar {
  250. display: flex;
  251. height: 40px;
  252. padding: 0 5px;
  253. background: #fff;
  254. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  255. position: relative;
  256. z-index: 10;
  257. .nav-item {
  258. flex: 1;
  259. display: flex;
  260. justify-content: center;
  261. align-items: center;
  262. height: 100%;
  263. font-size: 12px;
  264. color: $font-color-dark;
  265. position: relative;
  266. &.current {
  267. color: $base-color;
  268. &:after {
  269. content: '';
  270. position: absolute;
  271. left: 50%;
  272. bottom: 0;
  273. transform: translateX(-50%);
  274. width: 44px;
  275. height: 0;
  276. border-bottom: 2px solid $base-color;
  277. }
  278. }
  279. }
  280. }
  281. .input {
  282. position: fixed;
  283. bottom: 38rpx;
  284. left: 30rpx;
  285. text-align: center;
  286. width: 674rpx;
  287. height: 88rpx;
  288. background: #52c696;
  289. border-radius: 44rpx;
  290. font-size: 36rpx;
  291. font-family: PingFang SC;
  292. font-weight: 500;
  293. line-height: 88rpx;
  294. color: #ffffff;
  295. }
  296. </style>