goods.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="content">
  3. <view class="info">该类商品需购满{{goldLimit}}乐豆才能下单哦!</view>
  4. <view v-if="goodsList.length">
  5. <uni-coods :list="goodsList"></uni-coods>
  6. </view>
  7. <!-- 购物车 -->
  8. <uni-cart-fix></uni-cart-fix>
  9. </view>
  10. </template>
  11. <script>
  12. import {
  13. getGoodsList
  14. } from '@/api/goods.js'
  15. export default {
  16. data() {
  17. return {
  18. clsId: '',
  19. goldLimit:0,
  20. pageNo: 1,
  21. pageSize: 20,
  22. goodsList:[]
  23. };
  24. },
  25. onLoad(opts) {
  26. console.log(opts)
  27. this.clsId = opts.goodsTypeNo
  28. this.goldLimit = opts.goldLimit
  29. this.getGoods()
  30. },
  31. methods: {
  32. // 查询商品
  33. getGoods(item,index){
  34. getGoodsList({
  35. pageNo: this.pageNo,
  36. pageSize: this.pageSize,
  37. goodsTypeNo:this.clsId,
  38. }).then(res => {
  39. console.log(res,'goodsList')
  40. if(res.status == 200){
  41. this.goodsList = res.data.list
  42. }
  43. })
  44. }
  45. },
  46. }
  47. </script>
  48. <style lang="scss">
  49. .content {
  50. width: 100%;
  51. .goods{
  52. padding: 20upx 0;
  53. }
  54. .goods-list{
  55. display: flex;
  56. flex-wrap: wrap;
  57. justify-content: space-between;
  58. padding: 20upx 20upx 0;
  59. background: #FFFFFF;
  60. >view{
  61. margin-bottom: 20upx;
  62. }
  63. }
  64. .info{
  65. text-align: center;
  66. color: #DD524D;
  67. margin-bottom: 20upx;
  68. }
  69. }
  70. </style>