index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="content">
  3. <view class="varHeight"></view>
  4. <view class="banner position-relative">
  5. <image class="bgImg" src="../../static/img/img10.png" mode="scaleToFill"></image>
  6. <view class="flex shpingInfo position-relative">
  7. <view class="logoBox flex">
  8. <image class="logo" :src="info.image" mode="scaleToFill"></image>
  9. <view class="shopingTitle">{{ info.name }}</view>
  10. </view>
  11. <icon class="shopingExit" type="clear" color="#FFFFFF" @click="backUrl"></icon>
  12. </view>
  13. <view class="serachBox flex position-relative">
  14. <view class="serachInput flex">
  15. <icon :size="iconSize" type="search" color="#FFFFFF"></icon>
  16. <input class="search" placeholder="搜索" @blur="confirm" placeholder-style="color:#ffffff" type="text" :value="search" @confirm="confirm" />
  17. </view>
  18. </view>
  19. </view>
  20. <view class="list position-relative"><list ref="dataList"></list></view>
  21. </view>
  22. </template>
  23. <script>
  24. import list from '@/pages/product/list';
  25. import { getShoping } from '@/api/shoping.js';
  26. export default {
  27. components: { list },
  28. data() {
  29. return {
  30. // 当前选中的滑块
  31. current: 0,
  32. // 门店信息
  33. info: {
  34. logo: '',
  35. title: ''
  36. },
  37. ratio: '', //页面比例信息
  38. search: '' //店铺搜索商品
  39. //商店详情
  40. };
  41. },
  42. onLoad(pt) {
  43. // 保存商户id
  44. this.info.id = pt.merid;
  45. this.getShoping();
  46. },
  47. onReachBottom(e) {
  48. // 底部加载数据
  49. this.$refs.dataList.loadData();
  50. },
  51. onReady() {
  52. // 保存商家id
  53. this.$refs.dataList.mer_id = this.info.id;
  54. // 加载分类
  55. this.$refs.dataList.loadCateList();
  56. let obj = this;
  57. let query = uni.createSelectorQuery();
  58. // 获取页面比例
  59. query
  60. .select('.content')
  61. .fields(
  62. {
  63. size: true
  64. },
  65. e => {
  66. // 保存比例
  67. this.ratio = e.width / 750;
  68. }
  69. )
  70. .exec();
  71. },
  72. computed: {
  73. // 计算图标大小
  74. iconSize() {
  75. return 28 * this.ratio;
  76. }
  77. },
  78. methods: {
  79. //获取商店信息
  80. getShoping() {
  81. let obj = this;
  82. getShoping({}, this.info.id)
  83. .then(function({ data }) {
  84. obj.info = data.info;
  85. obj.$refs.dataList.iszy = obj.info.is_triple;
  86. // 加载数据
  87. obj.$refs.dataList.loadData();
  88. })
  89. .catch(e => {
  90. console.log(e);
  91. });
  92. },
  93. // 滑块切换时触发方法
  94. changeIndex(e) {
  95. this.current = e.current;
  96. },
  97. // 搜索确认事件
  98. confirm(e) {
  99. this.$refs.dataList.keyword = e.detail.value;
  100. this.$refs.dataList.page = 1;
  101. this.$refs.dataList.loadData('refresh');
  102. },
  103. // 回退功能
  104. backUrl() {
  105. uni.navigateBack();
  106. }
  107. }
  108. };
  109. </script>
  110. <style lang="scss">
  111. page,
  112. .content {
  113. height: 100%;
  114. }
  115. .varHeight {
  116. height: var(--status-bar-height);
  117. }
  118. .banner {
  119. .shpingInfo {
  120. padding: 30rpx $page-row-spacing;
  121. .logoBox {
  122. .logo {
  123. height: 90rpx;
  124. width: 90rpx;
  125. border-radius: 50%;
  126. }
  127. .shopingTitle {
  128. padding-left: 20rpx;
  129. color: #ffffff;
  130. font-size: $font-lg;
  131. }
  132. }
  133. .shopingExit {
  134. }
  135. }
  136. .serachBox,
  137. .shpingInfo {
  138. z-index: 999;
  139. }
  140. .bgImg {
  141. position: absolute;
  142. top: 0;
  143. left: 0;
  144. width: 100%;
  145. height: 100%;
  146. }
  147. .serachBox {
  148. padding: 0 $page-row-spacing;
  149. padding-bottom: 20rpx;
  150. width: 100%;
  151. .serachInput {
  152. background-color: rgba($color: #f1f1f1, $alpha: 0.5);
  153. border-radius: 100rpx;
  154. padding: 10rpx 25rpx;
  155. width: 100%;
  156. .search {
  157. padding-left: 20rpx;
  158. width: 100%;
  159. color: #ffffff;
  160. font-size: 28rpx;
  161. }
  162. }
  163. }
  164. }
  165. </style>