index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <view class="container flex-col":style="{height: winHeight + 'px'}">
  3. <!-- #ifdef MP -->
  4. <view class="cart_nav">
  5. <nav-bar iconColor='#fff' ref="navBarRef" navTitle="美食" backgroundColor="#FF6702" :isBackgroundColor="false">
  6. </nav-bar>
  7. </view>
  8. <!-- #endif -->
  9. <view class="box-color"></view>
  10. <view class="box-merchant flex-col">
  11. <view class="top-merchant">
  12. <view class="flex-y-center">
  13. <image style="width: 80rpx; height: 80rpx;" src="/static/img/ic-message.png"></image>
  14. <view style="margin-left: 15rpx;">
  15. <view class="mer-name">BOOS盖饭·农家大碗香(德思勤店)</view>
  16. <view>
  17. <text>今日推荐</text>
  18. <text>4.8</text>
  19. <text>月销7000+</text>
  20. <text>配送约¥0</text>
  21. </view>
  22. </view>
  23. </view>
  24. <view style="position: absolute;right: 20rpx;top: 20rpx;">进店</view>
  25. <view class="flex-y-center" style="margin: 15rpx 0;">
  26. <view class="cert-box">28减1</view>
  27. <view class="cert-box">50减2</view>
  28. <view class="cert-box">1元优惠券</view>
  29. <view class="cert-box">2元优惠券</view>
  30. </view>
  31. <scroll-view :scroll-x="true" scroll-with-animation style="height: 130px;white-space: nowrap;">
  32. <view class="top-box-item">
  33. <image style="width: 100%; height: 120rpx;border-radius: 10rpx;" src="/static/img/ic-message.png"></image>
  34. <view class="name">请炒土豆丝|放就爱哦但是见附件就能看</view>
  35. <view>
  36. <text :class="$bg-color-primary">¥</text><text class="bg-color">2.88</text>
  37. <text style="text-decoration: line-through;">¥6</text>
  38. </view>
  39. </view>
  40. <view class="top-box-item">
  41. <image style="width: 100%; height: 120rpx;border-radius: 10rpx;" src="/static/img/ic-message.png"></image>
  42. <view class="name">肉末茄子|放就爱哦但是见附件就能看</view>
  43. <view>
  44. <text :class="$bg-color-primary">¥</text><text class="bg-color">2.88</text>
  45. <text style="text-decoration: line-through;">¥6</text>
  46. </view>
  47. </view>
  48. <view class="top-box-item">
  49. <image style="width: 100%; height: 120rpx;border-radius: 10rpx;" src="/static/img/ic-message.png"></image>
  50. <view class="name">辣椒炒肉盖饭|放就爱哦但是见附件就能看</view>
  51. <view>
  52. <text :class="$bg-color-primary">¥</text><text class="bg-color">2.88</text>
  53. <text style="text-decoration: line-through;">¥6</text>
  54. </view>
  55. </view>
  56. </scroll-view>
  57. </view>
  58. <scroll-view :scroll-x="true" scroll-with-animation style="white-space: nowrap;margin: 20rpx 0rpx;">
  59. <view style="display: inline-block;margin-right: 30rpx;" v-for="(item, index) in optionData">
  60. <view class="flex-col flex-center">
  61. <image style="border-radius: 50%;width: 80rpx;height: 80rpx;" src="/static/img/ic-message.png"></image>
  62. <view class="name">{{item.name}}</view>
  63. </view>
  64. </view>
  65. </scroll-view>
  66. <!-- 销量排行 -->
  67. <view class="tab-list" style="margin-top: 10rpx;">
  68. <view :class=" item.checked ? 'tab-item2' : 'tab-item2-false' " v-for="item in labelList" :key="item.id" @click="item2Click(item)">{{item.label}}</view>
  69. </view>
  70. <scroll-view scroll-y scroll-with-animation style="flex: 1;overflow: hidden;">
  71. <view class="content-goods2" v-for="item in merchantList" :key="item.id" @click="merchantTab(item)">
  72. <view>
  73. <image :src="item.pcLogo" style="width: 230rpx;height: 230rpx;"></image>
  74. </view>
  75. <view style="margin-left: 20rpx;flex: 1;">
  76. <view class="">
  77. <text class="goods-title">{{item.name}}</text>
  78. <image src="/static/img/ic-close.png" style="width: 32rpx;height: 32rpx;float: right; "></image>
  79. </view>
  80. <view style="margin-top: 10rpx;">
  81. <text class="goods-score">{{item.score}}</text>
  82. <text class="goods-info" style="margin-left: 10rpx;">月销 {{item.salesVolume}}</text>
  83. <text class="goods-info" style="margin-left: 25rpx;">人均 ¥ {{item.perCapita}}</text>
  84. </view>
  85. <view style="margin-top: 10rpx;display: flex;align-items: center;">
  86. <text class="goods-info">起送 ¥ {{item.perCapita}}</text>
  87. <text v-if="!item.isfreeDeliverfee" class="goods-info" style="color: #E5AD21;margin-left: 18rpx;">免配送费</text>
  88. <view v-if="!item.isfreeDeliverfee" style="color: #999999;font-size: 21rpx;margin-left: 10rpx;text-decoration: line-through;">¥
  89. {{item.freeDeliverFee}}</view>
  90. <text v-if="item.isfreeDeliverfee" style="color: #999999;font-size: 21rpx;margin-left: 10rpx;">配送费¥
  91. {{item.distCosts}}</text>
  92. <text class="goods-info" style="margin-left: 38rpx;">10分钟</text>
  93. <text class="goods-info" style="margin-left: 10rpx;">{{item.distance}}</text>
  94. </view>
  95. <view style="margin-top: 22rpx;"><text class="goods-sales">已售卖{{item.salesVolume}}件</text></view>
  96. <view style="margin-top: 14rpx;">
  97. <text class="goods-labels" v-for="(item2,index2) in item.discountLabel" :key="index2">{{item2}}</text>
  98. </view>
  99. </view>
  100. </view>
  101. </scroll-view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. // +----------------------------------------------------------------------
  107. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  108. // +----------------------------------------------------------------------
  109. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  110. // +----------------------------------------------------------------------
  111. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  112. // +----------------------------------------------------------------------
  113. // | Author: CRMEB Team <admin@crmeb.com>
  114. // +----------------------------------------------------------------------
  115. import navBar from '@/components/navBar';
  116. import {
  117. getMerchantList,
  118. getHomeInfo
  119. } from '@/api/home.js';
  120. let app = getApp();
  121. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'rpx';
  122. export default {
  123. components: {
  124. navBar
  125. },
  126. data() {
  127. return {
  128. winHeight: 0,
  129. optionData: [{
  130. id: 1,
  131. name: '全部',
  132. icon: '/static/img/ic-message.png'
  133. },
  134. {
  135. id: 2,
  136. name: '饺子混沌',
  137. icon: '/static/img/ic-message.png'
  138. },
  139. {
  140. id: 3,
  141. name: '汉堡薯条',
  142. icon: '/static/img/ic-message.png'
  143. },
  144. {
  145. id: 4,
  146. name: '意面披萨',
  147. icon: '/static/img/ic-message.png'
  148. },
  149. {
  150. id: 5,
  151. name: '包子粥店',
  152. icon: '/static/img/ic-message.png'
  153. },
  154. {
  155. id: 6,
  156. name: '快餐',
  157. icon: '/static/img/ic-message.png'
  158. },
  159. ],
  160. labelList: [{
  161. id: 1,
  162. label: "销量排行",
  163. checked: true
  164. }, {
  165. id: 2,
  166. label: "满减大促",
  167. checked: false
  168. }, {
  169. id: 3,
  170. label: "首单立减",
  171. checked: false
  172. }, {
  173. id: 4,
  174. label: "减配送费",
  175. checked: false
  176. }],
  177. merchantList: [],
  178. }
  179. },
  180. onLoad(options) {
  181. let that = this;
  182. uni.getSystemInfo({
  183. success: function(res) {
  184. that.winHeight = res.windowHeight
  185. },
  186. });
  187. uni.getLocation({
  188. type: 'wgs84',
  189. geocode: true, //设置该参数为true可直接获取经纬度及城市信息
  190. success: function(res) {
  191. getMerchantList({
  192. latitude: res.latitude,
  193. longitude: res.longitude
  194. }).then(res => {
  195. // that.merchantList = res.data.list;
  196. that.merchantList.push(res.data.list[0]);
  197. that.merchantList.push(res.data.list[0]);
  198. that.merchantList.push(res.data.list[0]);
  199. that.merchantList.push(res.data.list[0]);
  200. that.merchantList.push(res.data.list[0]);
  201. console.log('商品信息:', that.merchantList);
  202. });
  203. },
  204. fail: function() {
  205. uni.showToast({
  206. title: '获取地址失败,将导致部分功能不可用',
  207. icon: 'none'
  208. });
  209. }
  210. })
  211. },
  212. methods: {
  213. item2Click(item) {
  214. item.checked = !item.checked;
  215. },
  216. }
  217. }
  218. </script>
  219. <style lang="scss" scoped>
  220. .container {
  221. overflow: hidden;
  222. position: relative;
  223. }
  224. .box-color {
  225. width: 100%;
  226. height: 200rpx;
  227. margin-top: -1px;
  228. background-color: $bg-color-primary;
  229. position: absolute;
  230. z-index: -1;
  231. }
  232. .box-merchant {
  233. background-color: #F5F5F5;
  234. border-radius: 30rpx 30rpx 0 0;
  235. padding: 20rpx 20rpx 0 20rpx;
  236. margin-top: 30rpx;
  237. overflow: hidden;
  238. flex: 1;
  239. }
  240. .top-merchant {
  241. background-color: #fff;
  242. position: relative;
  243. padding: 20rpx;
  244. border-radius: 20rpx;
  245. .mer-name {
  246. font-weight: 600;
  247. font-size: 27rpx;
  248. color: #141414;
  249. }
  250. .cert-box {
  251. color: #FF4B4B;
  252. border: 2rpx solid #FF4B4B;
  253. border-radius: 8rpx;
  254. background: rgba(255, 75, 75, 0.05);
  255. padding: 10rpx;
  256. margin-right: 10rpx;
  257. }
  258. .top-box-item {
  259. width: 31%;
  260. margin-right: 20rpx;
  261. display: inline-block;
  262. .name {
  263. font-weight: 400;
  264. font-size: 23rpx;
  265. color: #141414;
  266. width: 100%;
  267. overflow: hidden;
  268. text-overflow: ellipsis;
  269. white-space: nowrap;
  270. }
  271. }
  272. }
  273. .bg-color {
  274. color: $bg-color-primary;
  275. font-size: 30rpx;
  276. }
  277. .tab-list {
  278. display: flex;
  279. /* 启用弹性布局 */
  280. flex-direction: row;
  281. /* 横向排列 */
  282. justify-content: space-between;
  283. /* 均匀分布子项 */
  284. flex-wrap: wrap;
  285. /* 允许换行(适用于屏幕宽度不足时) */
  286. .tab-item2 {
  287. width: 23%;
  288. /* 5个元素平分宽度,留2%作为间隙 */
  289. text-align: center;
  290. background-color: #FFC127;
  291. border-radius: 8rpx;
  292. font-size: 23rpx;
  293. padding: 6rpx;
  294. font-weight: 400;
  295. }
  296. .tab-item2-false {
  297. width: 23%;
  298. /* 5个元素平分宽度,留2%作为间隙 */
  299. text-align: center;
  300. background-color: #fff;
  301. border-radius: 8rpx;
  302. font-size: 23rpx;
  303. padding: 6rpx;
  304. font-weight: 400;
  305. }
  306. }
  307. .content-goods2 {
  308. background: #FFFFFF;
  309. border-radius: 23rpx;
  310. margin-top: 10rpx;
  311. padding: 20rpx;
  312. display: flex;
  313. .goods-title {
  314. color: #141414;
  315. font-size: 26rpx;
  316. font-weight: 600;
  317. }
  318. .goods-desc {
  319. color: #646464;
  320. font-size: 21rpx;
  321. margin-top: 10rpx;
  322. }
  323. .goods-price {
  324. color: #FF9805;
  325. font-size: 34rpx;
  326. font-weight: 600;
  327. }
  328. .goods-score {
  329. color: #FD6716;
  330. font-size: 26rpx;
  331. }
  332. .goods-info {
  333. color: #999999;
  334. font-size: 21rpx;
  335. }
  336. .goods-info3 {
  337. color: #999999;
  338. font-size: 21rpx;
  339. margin-left: 10rpx;
  340. text-decoration: line-through;
  341. }
  342. .goods-sales {
  343. background-color: #FEEFE5;
  344. color: #FF6702;
  345. border-radius: 8rpx;
  346. font-size: 21rpx;
  347. padding: 4rpx 20rpx;
  348. }
  349. .goods-labels {
  350. background-color: #FFF6F6;
  351. color: #FF4B4B;
  352. border: 2rpx solid #FF4B4B;
  353. border-radius: 8rpx;
  354. font-size: 21rpx;
  355. padding: 4rpx 16rpx;
  356. margin-right: 20rpx;
  357. }
  358. }
  359. </style>