敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
4.6 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="取餐点" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  5. <view class="container">
  6. <view class="header">
  7. <view class="title">附近取餐点</view>
  8. </view>
  9. <!-- 取餐点列表 -->
  10. <view class="pickup-list">
  11. <view class="pickup-item" v-for="(item, index) in pickupPoints" :key="index">
  12. <view class="left">
  13. <image :src="item.image" class="shop-image" mode="aspectFill"></image>
  14. </view>
  15. <view class="center">
  16. <view class="shop-name">{{item.name}}</view>
  17. <view class="shop-address">
  18. <uv-icon name="map-fill" color="#019245" size="34rpx"></uv-icon>
  19. <text class="address-text">{{item.address}}</text>
  20. </view>
  21. <view class="shop-phone">
  22. <uv-icon name="phone-fill" color="#019245" size="34rpx"></uv-icon>
  23. <text class="phone-text">{{item.phone}}</text>
  24. </view>
  25. </view>
  26. <view class="right">
  27. <button class="select-btn" hover-class="select-btn-active" @tap="selectPoint(item)">选择</button>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 无数据提示 -->
  32. <uv-empty v-if="pickupPoints.length === 0" text="暂无取餐点" mode="list"></uv-empty>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import navbar from '@/components/base/navbar.vue'
  38. export default {
  39. components: {
  40. navbar
  41. },
  42. data() {
  43. return {
  44. pickupPoints: [
  45. {
  46. id: '1',
  47. name: '轻奢时代芙蓉兴盛',
  48. address: '长沙市雨花区时代阳光大道轻奢时代芙蓉兴盛',
  49. phone: '15070023168',
  50. image: '/static/image/古茗店面.webp'
  51. },
  52. {
  53. id: '2',
  54. name: '芙蓉兴盛小文轩便利店',
  55. address: '长沙市芙蓉区牛津街7栋102',
  56. phone: '15070023168',
  57. image: '/static/image/古茗店面.webp'
  58. }
  59. ]
  60. }
  61. },
  62. methods: {
  63. // 选择取餐点
  64. selectPoint(point) {
  65. // 将选择的取餐点信息存储到 store 或 storage 中
  66. uni.setStorageSync('selectedPickupPoint', JSON.stringify(point));
  67. // 通知上一页面已选择取餐点,并返回
  68. // const pages = getCurrentPages();
  69. // const prevPage = pages[pages.length - 2];
  70. // if (prevPage) {
  71. // // 如果需要可以设置上一页的数据
  72. // prevPage.$vm.pickupPoint = point;
  73. // }
  74. uni.$emit('updatePickupPoint', point);
  75. uni.showToast({
  76. title: '已选择取餐点',
  77. icon: 'success',
  78. duration: 400
  79. });
  80. setTimeout(() => {
  81. // uni.navigateBack();
  82. this.$utils.navigateBack()
  83. }, 800);
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .page {
  90. background-color: #f5f5f5;
  91. min-height: 100vh;
  92. }
  93. .container {
  94. padding: 0 20rpx;
  95. }
  96. .header {
  97. margin-top: 20rpx;
  98. background-color: #f2f2f2;
  99. border-radius: 8rpx;
  100. .title {
  101. font-size: 32rpx;
  102. // font-weight: bold;
  103. padding: 20rpx;
  104. }
  105. }
  106. .pickup-list {
  107. margin-top: 20rpx;
  108. .pickup-item {
  109. display: flex;
  110. background-color: #fff;
  111. padding: 20rpx;
  112. margin-bottom: 20rpx;
  113. border-radius: 8rpx;
  114. .left {
  115. width: 160rpx;
  116. height: 160rpx;
  117. margin-right: 20rpx;
  118. .shop-image {
  119. width: 100%;
  120. height: 100%;
  121. border-radius: 8rpx;
  122. }
  123. }
  124. .center {
  125. flex: 1;
  126. display: flex;
  127. flex-direction: column;
  128. justify-content: space-between;
  129. // gap: 8rpx;
  130. .shop-name {
  131. font-size: 32rpx;
  132. // font-weight: bold;
  133. margin-bottom: 10rpx;
  134. }
  135. .shop-address, .shop-phone {
  136. font-size: 24rpx;
  137. color: #999;
  138. display: flex;
  139. align-items: start;
  140. margin-bottom: 6rpx;
  141. gap: 8rpx;
  142. width: 90%;
  143. }
  144. }
  145. .right {
  146. width: 100rpx;
  147. display: flex;
  148. align-items: center;
  149. justify-content: center;
  150. .select-btn {
  151. width: 90rpx;
  152. height: 60rpx;
  153. line-height: 60rpx;
  154. text-align: center;
  155. background-color: $uni-color;
  156. color: #fff;
  157. font-size: 24rpx;
  158. border-radius: 12rpx;
  159. padding: 0;
  160. }
  161. .select-btn-active {
  162. background-color: #106035;
  163. }
  164. }
  165. }
  166. }
  167. </style>