index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view class="discountsDetail">
  3. <zs-img width="100%" height="310rpx" :src="banner"></zs-img>
  4. <!-- titleArr: 选择项数组 dropArr: 下拉项数组 二维数组 @finishDropClick: 下拉筛选完成事件-->
  5. <cc-dropDownMenu :titleArr="titleArr" :dropArr="dropArr" @finishDropClick="finishClick"></cc-dropDownMenu>
  6. <!-- 内容 -->
  7. <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
  8. <view class="item" v-for="(item,index) in list" :key="index">
  9. <!-- <image :src="item.src" mode="" class="icon" @click="goDetail(item)"></image> -->
  10. <zs-img :src="item.logoPath" width="164rpx" height="164rpx" radius="full" @click.native="goDetail(item)"></zs-img>
  11. <view class="info">
  12. <view class="title">
  13. {{item.shopVo.shopName}}
  14. </view>
  15. <view class="activity" :class="!item.activityContent?'white':''">
  16. <image class="card" src="../../static/card-icon.png" mode=""></image>
  17. {{item.activityContent || '-'}}
  18. </view>
  19. <view class="address" >
  20. <image class="position" src="../../static/address-icon.png" mode=""></image>
  21. 距离你{{(item.shopVo.distance/1000).toFixed(2)}}km ·{{item.district}}
  22. </view>
  23. </view>
  24. </view>
  25. </zs-list>
  26. </view>
  27. </template>
  28. <script>
  29. import { search } from '@/api/shop.js';
  30. export default {
  31. options: { styleIsolation: 'shared' },
  32. data() {
  33. return {
  34. longitude: '',
  35. latitude: '',
  36. destination: '',
  37. _mapContext: null,
  38. status:'more',
  39. list: [],
  40. btnText:'去使用',
  41. titleArr: ['全城', '距离最近'],
  42. dropArr: [
  43. // 距离
  44. [
  45. {
  46. text: '全城',
  47. value: "440103"
  48. }
  49. ],
  50. // 类型
  51. [
  52. {
  53. text: '距离最近',
  54. value: "40-60"
  55. }
  56. ],
  57. ],
  58. banner:'',
  59. filterResultData: [],
  60. query:{
  61. menuId:'',
  62. queryName:'',
  63. 'location.lat':0,
  64. 'location.lon':0,
  65. pageCurrent:1,
  66. pageSize:10
  67. }
  68. }
  69. },
  70. methods: {
  71. finishClick(resultData) {
  72. this.filterResultData = resultData;
  73. },
  74. goDetail(item){
  75. uni.setStorageSync('shopInfo',JSON.stringify(item))
  76. uni.navigateTo({
  77. url:'../shopDetail/shopDetail'
  78. })
  79. },
  80. loadMore(){
  81. this.search()
  82. },
  83. search() {
  84. return new Promise((resolve,reject)=>{
  85. if(this.status == 'noMore') return
  86. this.status = 'loading'
  87. search(this.query).then(res=>{
  88. if(res.state == 'Success'){
  89. this.list = this.list.concat(res.content.records)
  90. if(this.list.length >= res.content.total){
  91. this.status = 'noMore'
  92. }else{
  93. this.status = 'more'
  94. this.query.pageCurrent++
  95. }
  96. resolve()
  97. }
  98. })
  99. })
  100. },
  101. },
  102. onPullDownRefresh() {
  103. this.query.pageCurrent = 1
  104. this.list = []
  105. this.status = 'more'
  106. this.search().then(()=>{
  107. uni.stopPullDownRefresh()
  108. })
  109. },
  110. onLoad(option) {
  111. let that = this
  112. const eventChannel = this.getOpenerEventChannel();
  113. if(JSON.stringify(eventChannel) !=='{}'){
  114. eventChannel.on('banner', function(data) {
  115. that.banner = data
  116. })
  117. }
  118. uni.setNavigationBarTitle({
  119. title: option.title
  120. });
  121. this.query.menuId = option.id
  122. let location = JSON.parse(uni.getStorageSync('location'))
  123. this.query['location.lat'] = location.latitude
  124. this.query['location.lon'] = location.longitude
  125. this.search()
  126. },
  127. }
  128. </script>
  129. <style lang="scss">
  130. .bar-item-text {
  131. max-width: 250rpx !important;
  132. }
  133. .screen-bar::after {
  134. display: none;
  135. }
  136. .discountsDetail cc-drop-down-menu .screen-bar{
  137. // position: fixed;
  138. top: 0%;
  139. left: 0;
  140. width: 100%;
  141. }
  142. .discountsDetail {
  143. .banner{
  144. width: 100%;
  145. height: 310rpx;
  146. position: relative;
  147. z-index: 99;
  148. }
  149. .recommend{
  150. display: flex;
  151. justify-content: space-between;
  152. margin: 20rpx 30rpx;
  153. .recommend-item.color{
  154. background: linear-gradient(0deg, #FFDA84 0%, #FFF6E1 100%);
  155. }
  156. .recommend-item{
  157. padding: 18rpx;
  158. border-radius: 16rpx;
  159. width: 335rpx;
  160. box-sizing: border-box;
  161. background: linear-gradient(0deg, #FF9898 0%, rgba(255,101,101,0.09) 100%);;
  162. box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255,255,255,0.16);
  163. .top{
  164. display: flex;
  165. align-items: center;
  166. justify-content: space-between;
  167. .title{
  168. color: #0F0F0F;
  169. font-size: 26rpx;
  170. }
  171. .type-box{
  172. display: flex;
  173. align-items: center;
  174. padding: 0 16rpx;
  175. height: 40rpx;
  176. line-height: 40rpx;
  177. border-radius: 20rpx;
  178. border: 1rpx solid #FF4343;
  179. .hot{
  180. width: 16.7rpx;
  181. height: 21.7rpx;
  182. }
  183. .type{
  184. font-size: 20rpx;
  185. font-weight: 400;
  186. color: #FF4343;
  187. margin-left: 6rpx;
  188. }
  189. }
  190. }
  191. .image-box{
  192. position: relative;
  193. margin-top: 20rpx;
  194. background: #fff;
  195. border-radius: 16rpx;
  196. display: flex;
  197. .icon{
  198. width: 116rpx;
  199. height: 116rpx;
  200. margin-left: 15rpx;
  201. }
  202. .info{
  203. padding: 16rpx;
  204. display: flex;
  205. flex-direction: column;
  206. justify-content: space-between;
  207. .title{
  208. font-size: 20rpx;
  209. font-weight: bold;
  210. }
  211. .btn-box{
  212. display: flex;
  213. align-items: center;
  214. width: 100%;
  215. font-size: 18rpx;
  216. height: 36rpx;
  217. line-height: 36rpx;
  218. margin-top: 10rpx;
  219. .btn{
  220. height: 36rpx;
  221. line-height: 36rpx;
  222. padding: 0 14rpx;
  223. background: #FE5B47;
  224. color: #FFFFFF;
  225. }
  226. .desc{
  227. height: 36rpx;
  228. line-height: 36rpx;
  229. font-weight: 400;
  230. color: #FF4343;
  231. padding: 0 18rpx 0 10rpx;
  232. background: rgba(254, 91, 71, .17);
  233. border-radius: 0 8rpx 8rpx 0;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. .zs-list {
  241. // padding-top: 20rpx;
  242. .item {
  243. display: flex;
  244. padding: 20rpx 30rpx;
  245. background: #fff;
  246. border-radius: 16rpx;
  247. margin: 20rpx 30rpx 0;
  248. border-bottom: 1rpx solid #F0F0F0;
  249. .icon{
  250. border-radius: 8px;
  251. }
  252. .info{
  253. flex: 1;
  254. padding-left: 20rpx;
  255. display: flex;
  256. flex-direction: column;
  257. justify-content: space-between;
  258. position: relative;
  259. .title{
  260. font-size: 28rpx;
  261. font-weight: bold;
  262. width: 340rpx;
  263. white-space: nowrap;
  264. overflow: hidden;
  265. text-overflow: ellipsis;
  266. margin-top: 10rpx;
  267. }
  268. .address{
  269. color: #bebebe;
  270. display: flex;
  271. align-items: center;
  272. font-size: 24rpx;
  273. .u-icon{
  274. align-self: flex-start;
  275. }
  276. .position {
  277. width: 30rpx;
  278. height: 30rpx;
  279. margin-right: 8rpx;
  280. }
  281. }
  282. .activity.white{
  283. color: #fff;
  284. background: #fff;
  285. .card{
  286. display: none;
  287. }
  288. }
  289. .activity{
  290. font-size: 24rpx;
  291. color: #FF4D3A;
  292. line-height: 42rpx;
  293. display: flex;
  294. align-items: center;
  295. background: linear-gradient(90deg, #FAF4EB 0%, rgba(255,235,207,0) 100%);
  296. .card{
  297. width: 30.4rpx;
  298. height: 30rpx;
  299. vertical-align: bottom;
  300. margin: 0 8rpx 0 14rpx;
  301. }
  302. // text-align: center;
  303. // background: linear-gradient(90deg, rgba(253,149,108,0) 0%, #FD8B64 50%, rgba(253,140,101,0) 100%);
  304. }
  305. }
  306. }
  307. }
  308. #map {
  309. position: relative;
  310. top: -100000px;
  311. left: -1000000px;
  312. }
  313. }
  314. </style>