敢为人鲜小程序前端代码仓库
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.

196 lines
4.4 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.spotImage" class="shop-image" mode="aspectFill"></image>
  14. </view>
  15. <view class="center">
  16. <view class="shop-name">{{item.spotName}}</view>
  17. <view class="shop-address">
  18. <uv-icon name="map-fill" color="#019245" size="34rpx"></uv-icon>
  19. <text class="address-text"> {{ item.area }} {{ item.address }}{{item.area }}</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. // spotName: '轻奢时代芙蓉兴盛',
  48. // area: '长沙市雨花区时代阳光大道轻奢时代芙蓉兴盛',
  49. // phone: '15070023168',
  50. // spotImage: '/static/image/古茗店面.webp'
  51. // },
  52. // {
  53. // id: '2',
  54. // spotName: '芙蓉兴盛小文轩便利店',
  55. // area: '长沙市芙蓉区牛津街7栋102',
  56. // phone: '15070023168',
  57. // spotImage: '/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. onLoad() {
  87. this.$api('queryLeaderList', {}, res => {
  88. if (res.code == 200) {
  89. this.pickupPoints = res.result.records
  90. }
  91. })
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .page {
  97. background-color: #f5f5f5;
  98. min-height: 100vh;
  99. }
  100. .container {
  101. padding: 0 20rpx;
  102. }
  103. .header {
  104. margin-top: 20rpx;
  105. background-color: #f2f2f2;
  106. border-radius: 8rpx;
  107. .title {
  108. font-size: 32rpx;
  109. // font-weight: bold;
  110. padding: 20rpx;
  111. }
  112. }
  113. .pickup-list {
  114. margin-top: 20rpx;
  115. .pickup-item {
  116. display: flex;
  117. background-color: #fff;
  118. padding: 20rpx;
  119. margin-bottom: 20rpx;
  120. border-radius: 8rpx;
  121. .left {
  122. width: 160rpx;
  123. height: 160rpx;
  124. margin-right: 20rpx;
  125. .shop-image {
  126. width: 100%;
  127. height: 100%;
  128. border-radius: 8rpx;
  129. }
  130. }
  131. .center {
  132. flex: 1;
  133. display: flex;
  134. flex-direction: column;
  135. justify-content: space-between;
  136. // gap: 8rpx;
  137. .shop-name {
  138. font-size: 32rpx;
  139. // font-weight: bold;
  140. margin-bottom: 10rpx;
  141. }
  142. .shop-address, .shop-phone {
  143. font-size: 24rpx;
  144. color: #999;
  145. display: flex;
  146. align-items: start;
  147. margin-bottom: 6rpx;
  148. gap: 8rpx;
  149. width: 90%;
  150. }
  151. }
  152. .right {
  153. width: 100rpx;
  154. display: flex;
  155. align-items: center;
  156. justify-content: center;
  157. .select-btn {
  158. width: 90rpx;
  159. height: 60rpx;
  160. line-height: 60rpx;
  161. text-align: center;
  162. background-color: $uni-color;
  163. color: #fff;
  164. font-size: 24rpx;
  165. border-radius: 12rpx;
  166. padding: 0;
  167. }
  168. .select-btn-active {
  169. background-color: #106035;
  170. }
  171. }
  172. }
  173. }
  174. </style>