index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <view class="">
  3. <view class="search">
  4. <view class="searchCard">
  5. <view class="input">
  6. <view style="min-width: 120rpx;">
  7. <text class="iconfont icon-sousuo2"></text>
  8. </view>
  9. <!-- <form @submit.prevent="submit"></form> -->
  10. <input style="margin-left: -34rpx;" type="text" placeholder="搜索店内服务" v-model="search"
  11. placeholder-class="co" />
  12. <view class="bnt" @click="submit">搜索</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="">
  17. <view class="shopBody" v-for="(item, index) in shopList" :key="index" @tap="goBack(item)">
  18. <view class="classBody" style="margin-left: 30rpx;">
  19. <image class="classImg" :src="baseImagePath+item.logoUrl">
  20. <view style="padding: 0 0 0 22rpx;display: flex;flex-direction: column;justify-content: center;">
  21. <view class="classBodyHead">
  22. {{item.name}}
  23. </view>
  24. <view class="classBodyContent">
  25. {{item.address}}
  26. </view>
  27. </view>
  28. <view class="viewRight">
  29. <image class="location" :src="require('../../../static/address.png')">
  30. <view class="locationNum">
  31. {{item.distance}}km
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. getSelectStore
  42. } from "@/api/shop.js"
  43. const app = getApp();
  44. export default {
  45. data: function() {
  46. return {
  47. baseImagePath: this.baseImagePath,
  48. longitude: app.globalData.longitude,
  49. latitude: app.globalData.latitude,
  50. shopList: [],
  51. pageNo: 1,
  52. pageSize: 20,
  53. search:"",
  54. page:'',
  55. pageType : ''
  56. }
  57. },
  58. onLoad: function(option) { //option为object类型,会序列化上个页面传递的参数
  59. console.log('option',option);
  60. this.page = option.page
  61. this.pageType = option.type
  62. this.getPage()
  63. },
  64. onReachBottom() {
  65. this.getPage()
  66. },
  67. methods: {
  68. submit(){
  69. let that = this;
  70. that.pageNo = 1;
  71. that.shopList = [];
  72. let data = {
  73. pageNo: that.pageNo,
  74. pageSize: that.pageSize,
  75. type : 2,
  76. longitude: that.longitude,
  77. latitude: that.latitude,
  78. name:that.search,
  79. isRepair:null,
  80. isCarwash:null,
  81. }
  82. console.log(this.pageType === "washCar",'this.pageType === "washCar"');
  83. if(this.pageType === "washCar"){
  84. data.isCarwash = 1
  85. }else{
  86. data.isRepair = 1
  87. }
  88. getSelectStore(data).then(res => {
  89. that.shopList = that.shopList.concat(res.data.rows)
  90. that.pageNo++
  91. })
  92. },
  93. getPage(){
  94. let that = this;
  95. let data = {
  96. pageNo: that.pageNo,
  97. pageSize: that.pageSize,
  98. isRepair:null,
  99. isCarwash:null,
  100. type : 2,
  101. longitude: that.longitude,
  102. latitude: that.latitude
  103. }
  104. console.log(this.pageType === "washCar",'this.pageType === "washCar"');
  105. if(this.pageType === "washCar"){
  106. data.isCarwash = 1
  107. }else{
  108. data.isRepair = 1
  109. }
  110. getSelectStore(data).then(res => {
  111. that.shopList = that.shopList.concat(res.data.rows)
  112. that.pageNo++
  113. })
  114. },
  115. /* routerTo(item) {
  116. this.$yrouter.push({
  117. path: "/pages/shop/shopDetail/index?id=" + item.id
  118. });
  119. } */
  120. goBack(datas) {
  121. console.log(datas);
  122. if(this.page === 'index'){
  123. this.$yrouter.push({
  124. path: "/pages/shop/shopDetail/index?id=" + datas.id
  125. });
  126. }else{
  127. uni.setStorageSync('chooseShop',datas)
  128. uni.$emit('chooseShop',datas)
  129. uni.navigateBack({
  130. delta: 1
  131. })
  132. }
  133. },
  134. }
  135. }
  136. </script>
  137. <style>
  138. page {
  139. background: #EDEDED;
  140. }
  141. .classBodyHead {
  142. height: 31rpx;
  143. font-size: 32rpx;
  144. font-family: PingFang SC;
  145. font-weight: bold;
  146. color: #333333;
  147. line-height: 31rpx;
  148. margin-bottom: 32rpx;
  149. }
  150. .classBodyContent {
  151. width: 370rpx;
  152. height: 23rpx;
  153. font-size: 24rpx;
  154. font-family: PingFang SC;
  155. font-weight: 500;
  156. color: #666666;
  157. line-height: 31rpx;
  158. }
  159. .viewRight {
  160. height: calc(100% - 56rpx);
  161. display: flex;
  162. align-items: center;
  163. position: absolute;
  164. right: 30rpx;
  165. bottom: 0;
  166. }
  167. .location {
  168. width: 23rpx;
  169. height: 23rpx;
  170. }
  171. .locationNum {
  172. font-size: 24rpx;
  173. font-weight: 500;
  174. color: #333333;
  175. line-height: 31rpx;
  176. margin-left: 6rpx;
  177. }
  178. .classImg {
  179. width: 120rpx;
  180. height: 120rpx;
  181. background: linear-gradient(135deg, #D10498 0%, #D21728 100%);
  182. border-radius: 8rpx;
  183. }
  184. .classBody {
  185. display: flex;
  186. align-items: center;
  187. }
  188. .search {
  189. width: 100%;
  190. height: 90rpx;
  191. background: #FFFFFF;
  192. box-shadow: 0px 1px 0px 0px rgba(55, 55, 55, 0.1);
  193. }
  194. .searchCard {
  195. width: 710rpx;
  196. height: 70rpx;
  197. background: #ECECEC;
  198. border: 1px solid #FFFFFF;
  199. border-radius: 34rpx;
  200. margin-left: 20rpx;
  201. }
  202. .iconfont {
  203. font-family: "iconfont" !important;
  204. font-size: 35rpx;
  205. font-style: normal;
  206. -webkit-font-smoothing: antialiased;
  207. -moz-osx-font-smoothing: grayscale;
  208. background: #ECECEC;
  209. padding-left: 37rpx;
  210. line-height: 70rpx;
  211. border-radius: 34rpx;
  212. }
  213. .acea-row {
  214. display: flex;
  215. flex-wrap: wrap;
  216. }
  217. .co {
  218. background: #ECECEC;
  219. font-size: 26rpx;
  220. font-family: PingFang SC;
  221. font-weight: 500;
  222. color: #999999;
  223. }
  224. .input {
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-between;
  228. }
  229. .bnt {
  230. width: 130rpx;
  231. height: 58rpx;
  232. background: linear-gradient(0deg, #005AFF 0%, #0078FF 100%);
  233. border-radius: 29rpx;
  234. line-height: 58rpx;
  235. text-align: center;
  236. font-size: 26rpx;
  237. font-family: PingFang SC;
  238. font-weight: 500;
  239. color: #FFFFFF;
  240. position: relative;
  241. right: 8rpx;
  242. }
  243. .shopBody {
  244. width: 710rpx;
  245. height: 170rpx;
  246. background: #FFFFFF;
  247. border-radius: 10rpx;
  248. margin-left: 20rpx;
  249. margin-top: 20rpx;
  250. position: relative;
  251. display: flex;
  252. align-items: center;
  253. }
  254. </style>