miaosha.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" :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.yjprice}}</view>
  12. <view class="btn">秒杀价:¥{{item.price}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. data: [],
  22. classlist:[],
  23. xz:'全部'
  24. }
  25. },
  26. methods: {
  27. change(zt){
  28. this.xz=zt;
  29. this.getlist();
  30. },
  31. getlist() {
  32. var data = new Object();
  33. data.class=this.xz
  34. data.lx=2
  35. // console.log(this.xz)
  36. this.$api
  37. .MhGetModel(data, 'shop/list')
  38. .then(res => {
  39. this.data = res.data.data;
  40. this.classlist = res.data.class;
  41. })
  42. .catch(err => {
  43. // console.log('request fail', JSON.stringify(err));
  44. });
  45. },
  46. duihuan(item){
  47. //手动预约的 要求输入数量
  48. uni.navigateTo({
  49. url: 'dhtj?id='+item.id+'&cpmc='+item.proname+'&price='+item.price+'&lx=2'
  50. });
  51. },
  52. },
  53. onLoad() {
  54. this.getlist()
  55. }
  56. }
  57. </script>
  58. <style>
  59. page {
  60. padding: 15rpx;
  61. background: #98a737;
  62. background-attachment: fixed !important;
  63. background-repeat: no-repeat !important;
  64. }
  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. .btn{line-height: 200%;}
  79. .item {
  80. display: inline-block;
  81. background: #f1a325;width: calc(50% - 20rpx);
  82. border-radius: 10rpx;
  83. font-size: 28rpx;overflow: hidden;
  84. color: #fff;
  85. text-align: center;
  86. padding-bottom: 10rpx;margin-bottom: 20rpx;
  87. float: left;
  88. }
  89. .list .item:nth-child(even){margin-left: 20rpx;}
  90. .top{display: flex;justify-content: left;border-bottom: #fff solid 1rpx;line-height: 60rpx;padding-bottom: 10rpx;}
  91. .xuanzhong{color: #fff;background: #8a9e0a;display: inline-block;text-align: center;padding: 0 10rpx;font-size: 28rpx;}
  92. .wxz{color: #fff;display: inline-block;text-align: center;margin: 0 10rpx;padding: 0 10rpx;font-size: 28rpx;}
  93. </style>