shop.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <view class="top">
  4. <view :class="xz=='全部'?'xuanzhong':'wxz'" @click="change('全部')">全部</view>
  5. <view :class="xz==item?'xuanzhong':'wxz'" @click="change(item)" v-for="(item, index) in classlist">{{item}}</view>
  6. </view>
  7. <view class="list">
  8. <view class="item" v-for="(item, index) in data.jflist" :key="index">
  9. <image :src="item.litpic" style="width: 100%;" mode="widthFix"></image>
  10. <view>{{item.proname}}</view>
  11. <view class="btn">{{item.price}}积分</view>
  12. </view>
  13. </view>
  14. <view class="list">
  15. <view class="item" v-for="(item, index) in data.lplist" :key="index">
  16. <image :src="item.litpic" style="width: 100%;" mode="widthFix"></image>
  17. <view>{{item.proname}}</view>
  18. <view class="btn">{{item.price}}乐票</view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. data: [],
  28. classlist:[],
  29. xz:'全部'
  30. }
  31. },
  32. methods: {
  33. change(zt){
  34. this.xz=zt;
  35. this.getlist();
  36. },
  37. getlist() {
  38. var data = new Object();
  39. data.class=this.xz
  40. // console.log(this.xz)
  41. this.$api
  42. .MhGetModel(data, 'shop/list')
  43. .then(res => {
  44. this.data = res.data.data;
  45. this.classlist = res.data.class;
  46. })
  47. .catch(err => {
  48. // console.log('request fail', JSON.stringify(err));
  49. });
  50. }
  51. },
  52. onLoad() {
  53. this.getlist()
  54. }
  55. }
  56. </script>
  57. <style>
  58. page {
  59. padding: 15rpx;
  60. background: #98a737;
  61. background-attachment: fixed !important;
  62. background-repeat: no-repeat !important;
  63. }
  64. .b1 {
  65. overflow: hidden;
  66. padding: 10rpx 15rpx;
  67. color: #f1a325;
  68. background: #fff0d5;
  69. border: 1rpx solid #ffdcbc;
  70. }
  71. .list {
  72. display: table;
  73. justify-content: space-between;
  74. padding: 20rpx 0;
  75. width:100%;
  76. }
  77. .item {
  78. display: inline-block;
  79. background: #f1a325;width: calc(50% - 10rpx);
  80. border-radius: 10rpx;
  81. font-size: 28rpx;overflow: hidden;
  82. color: #fff;
  83. text-align: center;
  84. padding-bottom: 10rpx;margin-bottom: 20rpx;
  85. float: left;
  86. }
  87. .list .item:nth-child(even){margin-left: 20rpx;}
  88. .top{display: flex;justify-content: left;border-bottom: #fff solid 1rpx;line-height: 60rpx;padding-bottom: 10rpx;}
  89. .xuanzhong{color: #fff;background: #8a9e0a;display: inline-block;text-align: center;padding: 0 10rpx;font-size: 28rpx;}
  90. .wxz{color: #fff;display: inline-block;text-align: center;margin: 0 10rpx;padding: 0 10rpx;font-size: 28rpx;}
  91. </style>