index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="discountsDetail">
  3. <zs-choose-tab></zs-choose-tab>
  4. <!-- 内容 -->
  5. <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
  6. <view class="item" v-for="(item,index) in list" :key="index">
  7. <!-- <image :src="item.src" mode="" class="icon" @click="goDetail(item)"></image> -->
  8. <zs-img :src="item.logoPath" width="200rpx" height="200rpx" radius="full" @click.native="goDetail(item)"></zs-img>
  9. <view class="info">
  10. <view class="title">
  11. {{item.shopVo.shopName}}
  12. </view>
  13. <view class="desc">
  14. 2人24菜12嫩牛肉、精品千层肚、嫩肉
  15. 片、老肉片、午餐肉24菜12嫩牛肉、精品千层肚、嫩肉
  16. 片、老肉片、午餐肉24菜12嫩牛肉、精品千层肚、嫩肉
  17. 片、老肉片、午餐肉
  18. </view>
  19. <view class="price-box">
  20. <view class="left">
  21. <view class="unit">
  22. </view>
  23. <view class="price">
  24. 50
  25. </view>
  26. <view class="old-price">
  27. 市场价 ¥299
  28. </view>
  29. </view>
  30. <view class="right">
  31. 销量5999
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </zs-list>
  37. </view>
  38. </template>
  39. <script>
  40. import { search } from '@/api/shop.js';
  41. export default {
  42. options: { styleIsolation: 'shared' },
  43. data() {
  44. return {
  45. longitude: '',
  46. latitude: '',
  47. destination: '',
  48. _mapContext: null,
  49. status:'more',
  50. list: [],
  51. btnText:'去使用',
  52. banner:'',
  53. filterResultData: [],
  54. query:{
  55. menuId:'',
  56. queryName:'',
  57. 'location.lat':0,
  58. 'location.lon':0,
  59. pageCurrent:1,
  60. pageSize:10
  61. }
  62. }
  63. },
  64. methods: {
  65. goDetail(item){
  66. uni.setStorageSync('shopInfo',JSON.stringify(item))
  67. uni.navigateTo({
  68. url:'../shopDetail/shopDetail'
  69. })
  70. },
  71. loadMore(){
  72. this.search()
  73. },
  74. search() {
  75. return new Promise((resolve,reject)=>{
  76. if(this.status == 'noMore') return
  77. this.status = 'loading'
  78. search(this.query).then(res=>{
  79. if(res.state == 'Success'){
  80. this.list = this.list.concat(res.content.records)
  81. if(this.list.length >= res.content.total){
  82. this.status = 'noMore'
  83. }else{
  84. this.status = 'more'
  85. this.query.pageCurrent++
  86. }
  87. resolve()
  88. }
  89. })
  90. })
  91. },
  92. },
  93. onPullDownRefresh() {
  94. this.query.pageCurrent = 1
  95. this.list = []
  96. this.status = 'more'
  97. this.search().then(()=>{
  98. uni.stopPullDownRefresh()
  99. })
  100. },
  101. onLoad(option) {
  102. let that = this
  103. const eventChannel = this.getOpenerEventChannel();
  104. if(JSON.stringify(eventChannel) !=='{}'){
  105. eventChannel.on('banner', function(data) {
  106. that.banner = data
  107. })
  108. }
  109. uni.setNavigationBarTitle({
  110. title: option.title
  111. });
  112. this.query.menuId = option.id
  113. let location = JSON.parse(uni.getStorageSync('location'))
  114. this.query['location.lat'] = location.latitude
  115. this.query['location.lon'] = location.longitude
  116. this.search()
  117. },
  118. }
  119. </script>
  120. <style lang="scss">
  121. .bar-item-text {
  122. max-width: 250rpx !important;
  123. }
  124. .screen-bar::after {
  125. display: none;
  126. }
  127. .discountsDetail cc-drop-down-menu .screen-bar{
  128. // position: fixed;
  129. top: 0%;
  130. left: 0;
  131. width: 100%;
  132. }
  133. .discountsDetail {
  134. background: #F9F9F9;
  135. padding-top: 80rpx;
  136. .banner{
  137. width: 100%;
  138. height: 310rpx;
  139. position: relative;
  140. z-index: 99;
  141. }
  142. .zs-list {
  143. margin: 0 24rpx;
  144. .item {
  145. display: flex;
  146. padding: 24rpx;
  147. background: #fff;
  148. border-radius: 16rpx;
  149. margin: 20rpx 0 0;
  150. .icon{
  151. border-radius: 16px;
  152. }
  153. .info{
  154. flex: 1;
  155. padding-left: 20rpx;
  156. display: flex;
  157. flex-direction: column;
  158. justify-content: space-between;
  159. position: relative;
  160. .title{
  161. font-size: 28rpx;
  162. font-weight: bold;
  163. width: 340rpx;
  164. white-space: nowrap;
  165. overflow: hidden;
  166. text-overflow: ellipsis;
  167. margin-top: 10rpx;
  168. }
  169. .desc{
  170. font-size: 24rpx;
  171. color: #AAAAAA;
  172. overflow: hidden;
  173. text-overflow: ellipsis;
  174. /* 弹性伸缩盒子模型显示 */
  175. display: -webkit-box;
  176. /* 限制在一个块元素显示的文本的行数 */
  177. -webkit-line-clamp: 2;
  178. /* 设置或检索伸缩盒对象的子元素的排列方式 */
  179. -webkit-box-orient: vertical;
  180. }
  181. .price-box{
  182. display: flex;
  183. justify-content: space-between;
  184. align-items: center;
  185. .left{
  186. display: flex;
  187. align-items: flex-end;
  188. .unit{
  189. font-size: 20rpx;
  190. color: #FF4D3A;
  191. font-weight: bold;
  192. }
  193. .price{
  194. font-size: 32rpx;
  195. color: #FF4D3A;
  196. font-weight: bold;
  197. }
  198. .old-price{
  199. font-size: 20rpx;
  200. color: #AAAAAA;
  201. text-decoration: line-through;
  202. margin-left: 12rpx;
  203. }
  204. }
  205. .right{
  206. font-size: 24rpx;
  207. color: #AAAAAA;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. }
  214. </style>