duihuan.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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" :key="index" @click="duihuan(item)">
  9. <image :src="item.litpic" style="width: 100%;" mode="widthFix"></image>
  10. <view class="btn">{{item.proname}}</view>
  11. <view class="btn">复销:¥{{item.price}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. data: [],
  21. classlist:[],
  22. xz:'全部'
  23. }
  24. },
  25. methods: {
  26. change(zt){
  27. this.xz=zt;
  28. this.getlist();
  29. },
  30. getlist() {
  31. var data = new Object();
  32. data.class=this.xz
  33. data.lx=1
  34. // console.log(this.xz)
  35. this.$api
  36. .MhGetModel(data, 'shop/list')
  37. .then(res => {
  38. this.data = res.data.data;
  39. this.classlist = res.data.class;
  40. })
  41. .catch(err => {
  42. // console.log('request fail', JSON.stringify(err));
  43. });
  44. },
  45. duihuan(item){
  46. //手动预约的 要求输入数量
  47. uni.navigateTo({
  48. url: 'dhtj?id='+item.id+'&cpmc='+item.proname+'&price='+item.price+'&lx=1'
  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. .btn{line-height: 200%;}
  65. .b1 {
  66. overflow: hidden;
  67. padding: 10rpx 15rpx;
  68. color: #f1a325;
  69. background: #fff0d5;
  70. border: 1rpx solid #ffdcbc;
  71. }
  72. .list {
  73. display: table;
  74. justify-content: space-between;
  75. padding: 20rpx 0;
  76. width:100%;
  77. }
  78. .item {
  79. display: inline-block;
  80. background: #f1a325;width: calc(50% - 20rpx);
  81. border-radius: 10rpx;
  82. font-size: 28rpx;overflow: hidden;
  83. color: #fff;
  84. text-align: center;
  85. padding-bottom: 10rpx;margin-bottom: 20rpx;
  86. float: left;
  87. }
  88. .list .item:nth-child(even){margin-left: 20rpx;}
  89. .top{display: flex;justify-content: left;border-bottom: #fff solid 1rpx;line-height: 60rpx;padding-bottom: 10rpx;}
  90. .xuanzhong{color: #fff;background: #8a9e0a;display: inline-block;text-align: center;padding: 0 10rpx;font-size: 28rpx;}
  91. .wxz{color: #fff;display: inline-block;text-align: center;margin: 0 10rpx;padding: 0 10rpx;font-size: 28rpx;}
  92. </style>