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

273 lines
8.0 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="解绑团长" leftClick @leftClick="$utils.navigateBack" bgColor="#019245" color="#fff" />
  5. <!-- 当前取餐点 -->
  6. <view class="section">
  7. <view class="section-title">当前取餐点</view>
  8. <view class="pickup-item" v-if="currentPickupPoint">
  9. <view class="pickup-image">
  10. <image :src="currentPickupPoint.spotImage" mode="aspectFill"></image>
  11. </view>
  12. <view class="pickup-info">
  13. <view class="pickup-name">{{ currentPickupPoint.spotName }}</view>
  14. <view class="pickup-address">
  15. <view class="pickup-address-icon">
  16. <uv-icon name="map-fill" color="#019245" size="24"></uv-icon>
  17. </view>
  18. <text>{{ currentPickupPoint.area }}{{ currentPickupPoint.address }}</text>
  19. </view>
  20. <view class="pickup-phone">
  21. <uv-icon name="phone-fill" color="#019245" size="24"></uv-icon>
  22. <text>{{ currentPickupPoint.phone }}</text>
  23. </view>
  24. </view>
  25. <view class="select-btn" @click="deleteLeader">
  26. <text>解绑</text>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 附近取餐点 -->
  31. <view class="section">
  32. <view class="section-title">附近取餐点</view>
  33. <!-- 提示信息 -->
  34. <view class="warning-tip">
  35. <uv-icon name="info-circle" color="#FF5722" size="36"></uv-icon>
  36. <text>更换取餐地址和团长,需通过平台审核方可更换!</text>
  37. </view>
  38. <!-- 取餐点列表 -->
  39. <view class="pickup-list">
  40. <view class="pickup-item" v-for="(item, index) in nearbyPickupPoints" :key="index">
  41. <view class="pickup-image">
  42. <image :src="item.spotImage" mode="aspectFill"></image>
  43. </view>
  44. <view class="pickup-info">
  45. <view class="pickup-name">{{ item.spotName }}</view>
  46. <view class="pickup-address">
  47. <view class="pickup-address-icon">
  48. <uv-icon name="map-fill" color="#019245" size="24"></uv-icon>
  49. </view>
  50. <text>{{ item.area }} {{ item.address }} </text>
  51. </view>
  52. <view class="pickup-phone">
  53. <uv-icon name="phone-fill" color="#019245" size="24"></uv-icon>
  54. <text>{{ item.phone }}</text>
  55. </view>
  56. </view>
  57. <view class="select-btn" @click="updateLeader(item)">
  58. <text>选择</text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import navbar from '@/components/base/navbar.vue'
  67. // import { currentPickupPoint, nearbyPickupPoints } from '@/static/js/mockTeam.js'
  68. export default {
  69. components: {
  70. navbar
  71. },
  72. data() {
  73. return {
  74. // 当前取餐点
  75. currentPickupPoint:{},
  76. // 附近取餐点列表
  77. nearbyPickupPoints:[]
  78. }
  79. },
  80. methods: {
  81. // 选择取餐点
  82. deleteLeader() {
  83. uni.showModal({
  84. title: '确认解绑',
  85. content: '您确定要解绑团长吗?',
  86. confirmColor: '#019245',
  87. success: (res) => {
  88. if (res.confirm) {
  89. uni.showLoading({
  90. title: '提交中...'
  91. })
  92. this.$api('deleteLeader',{
  93. leaderId: this.currentPickupPoint.id
  94. }, res => {
  95. if (res.code === 200){
  96. uni.hideLoading()
  97. uni.showToast({
  98. title: `${res.message}`
  99. })
  100. }
  101. })
  102. }
  103. }
  104. })
  105. },
  106. updateLeader(point) {
  107. uni.showModal({
  108. title: '确认选择',
  109. content: '您确定要选择该取餐点吗?需要平台审核通过后才能更换。',
  110. confirmColor: '#019245',
  111. success: (res) => {
  112. if (res.confirm) {
  113. uni.showLoading({
  114. title: '提交中...'
  115. })
  116. this.$api('updateLeader', {
  117. leaderId: point.id
  118. // leaderId: 1915305988566077441
  119. }, res => {
  120. if (res.code == 200) {
  121. uni.hideLoading()
  122. uni.showToast({
  123. title: `${res.message}`,
  124. icon: 'success',
  125. })
  126. }
  127. })
  128. }
  129. }
  130. })
  131. }
  132. },
  133. onLoad() {
  134. // this.currentPickupPoint = currentPickupPoint
  135. this.$api('queryLeaderList', {}, res => {
  136. if (res.code == 200){
  137. this.nearbyPickupPoints = res.result.records
  138. }
  139. })
  140. this.$api('queryMyLeader', {}, res => {
  141. if (res.code == 200){
  142. this.currentPickupPoint = res.result
  143. }
  144. })
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. .page {
  150. // background-color: #f5f5f5;
  151. // min-height: 100vh;
  152. }
  153. .section {
  154. width: 96%;
  155. margin: 0 auto;
  156. margin-bottom: 20rpx;
  157. // border-radius: 10rpx;
  158. &-title {
  159. font-size: 32rpx;
  160. font-weight: bold;
  161. color: #333;
  162. padding: 30rpx 30rpx 20rpx;
  163. }
  164. }
  165. .pickup {
  166. &-item {
  167. background-color: #fff;
  168. padding: 20rpx 20rpx;
  169. display: flex;
  170. position: relative;
  171. margin-bottom: 2rpx;
  172. border-radius: 20rpx;
  173. }
  174. &-image {
  175. width: 170rpx;
  176. height: 170rpx;
  177. margin: auto 20rpx auto 0;
  178. overflow: hidden;
  179. image {
  180. width: 100%;
  181. height: 100%;
  182. }
  183. }
  184. &-info {
  185. flex: 1;
  186. display: flex;
  187. flex-direction: column;
  188. justify-content: space-between;
  189. }
  190. &-name {
  191. font-size: 30rpx;
  192. font-weight: bold;
  193. color: #3B3B3B;
  194. margin-bottom: 10rpx;
  195. }
  196. &-address, &-phone {
  197. font-size: 26rpx;
  198. color: $uni-color-third;
  199. display: flex;
  200. align-items: center;
  201. margin-bottom: 8rpx;
  202. width: 85%;
  203. text {
  204. margin-left: 8rpx;
  205. }
  206. &-icon {
  207. height: 100%;
  208. padding-top: 20rpx;
  209. }
  210. }
  211. }
  212. .status-icon {
  213. position: absolute;
  214. right: 30rpx;
  215. top: 50%;
  216. transform: translateY(-50%);
  217. }
  218. .select-btn {
  219. background-color: $uni-color;
  220. color: #fff;
  221. width: 100rpx;
  222. height: 60rpx;
  223. display: flex;
  224. justify-content: center;
  225. align-items: center;
  226. border-radius: 10rpx;
  227. align-self: center;
  228. font-size: 24rpx;
  229. }
  230. .warning-tip {
  231. background-color: #FFDBDB;
  232. // width: 90%;
  233. margin: 0rpx 40rpx 20rpx 30rpx;
  234. border-radius: 10rpx;
  235. padding: 15rpx 15rpx;
  236. display: flex;
  237. align-items: center;
  238. margin-bottom: 20rpx;
  239. text {
  240. font-size: 26rpx;
  241. color: $uni-color-second;
  242. margin-left: 10rpx;
  243. }
  244. }
  245. .pickup-list {
  246. gap: 20rpx;
  247. .pickup-item {
  248. margin-bottom: 20rpx;
  249. }
  250. }
  251. </style>