index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="page">
  3. <view class="top"><image src="../../static/dt.jpg" mode="widthFix"></image></view>
  4. <view class="flex">
  5. <view class="f">
  6. <view class="ic" style="background-color: #FF5722;"><text class="icon">&#xe60e;</text></view>
  7. <view class="">50+</view>
  8. <view>农机农技</view>
  9. </view>
  10. <view class="f">
  11. <view class="ic" style="background-color: #4CAF50;"><text class="icon">&#xe604;</text></view>
  12. <view class="">2000+</view>
  13. <view>提供服务</view>
  14. </view>
  15. </view>
  16. <u-divider>最新服务</u-divider>
  17. <view class="list">
  18. <view class="goods_item" v-for="(item, index) in goods_list" :key="index" @click="detail(item)">
  19. <image :src="ip + item.pic" mode="aspectFill"></image>
  20. <view class="title omit">
  21. <text>{{ item.title }}</text>
  22. </view>
  23. <view class="price">
  24. <text>¥{{ item.price }}</text>
  25. <text class="day">/天</text>
  26. <text class="icon" v-show="item.mType == 0">&#xe61e;</text>
  27. <text class="icon" v-show="item.mType == 1">&#xe61c;</text>
  28. </view>
  29. </view>
  30. <view class="clear"></view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. ip: this.$http.urls.ip,
  39. goods_list: []
  40. };
  41. },
  42. onLoad(e) {
  43. this.init();
  44. },
  45. methods: {
  46. init() {
  47. this.$http.request({
  48. url: this.$http.urls.home,
  49. success: res => {
  50. this.goods_list = res.data.data.goods_list;
  51. }
  52. });
  53. //let user={id:35,nickName:'微信用户',openId:'oD2_E4sMkz3zF_0xjhX_C4vaI_xo',sex:0,phone:'13097850972',token:'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6Ijc2NTVmOGM0LWY3YTAtNGU0Mi04MDU3LTdkNTA4NGY5NjE2NyJ9.f6xqQVYkm6zlfhZFbCOyj1-iOZtpkHJbUyCB2MNtTW-jgz1_9zcKKOdnw9uX_WJ_2VNrgOn6R5hmQAIm79YIZw'}
  54. // uni.setStorageSync('user',user);
  55. },
  56. click(typeId) {
  57. if (typeId === 0) {
  58. uni.navigateTo({
  59. url: '../product/product'
  60. });
  61. }
  62. if (typeId === 1) {
  63. uni.navigateTo({ url: '../service/list' });
  64. }
  65. if (typeId === 2) {
  66. uni.navigateTo({ url: '../park/cemetery/cemetery' });
  67. }
  68. },
  69. detail(item) {
  70. uni.navigateTo({ url: '/pages/goods/detail?id=' + item.id });
  71. }
  72. }
  73. };
  74. </script>
  75. <style lang="scss">
  76. .page {
  77. padding: 15px;
  78. }
  79. .top {
  80. image {
  81. width: 100%;
  82. border-radius: 5px;
  83. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  84. }
  85. }
  86. .flex {
  87. text-align: center;
  88. .f {
  89. padding: 15px 12px 15px 12px;
  90. border-radius: 5px;
  91. margin: 10px;
  92. font-size: 15px;
  93. text-align: left;
  94. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  95. .ic {
  96. float: left;
  97. background-color: $theme-color;
  98. width: 45px;
  99. height: 45px;
  100. border-radius: 50%;
  101. text-align: center;
  102. color: white;
  103. line-height: 45px;
  104. margin-right: 5px;
  105. .icon {
  106. font-size: 30px;
  107. }
  108. }
  109. }
  110. }
  111. .list {
  112. .goods_item {
  113. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  114. }
  115. }
  116. </style>