猫妈狗爸伴宠师小程序前端代码
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.

145 lines
3.4 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="page">
  3. <view class="tips flex-rowl">
  4. <image src="@/static/images/ydd/icon2.png" mode=""></image>
  5. <text class="color-ffb size-22 ml16">普通喂养员可设置3个接单地址优选喂养员可设置5个接单地址</text>
  6. </view>
  7. <view v-if="list.length">
  8. <view class="li bg-fff"
  9. v-for="(item, index) in list"
  10. :key="`address-${index}`"
  11. >
  12. <view class="size-30">
  13. {{ item.area }}
  14. </view>
  15. <view class="size-22 color-777 mt16">
  16. {{ `接单范围:${item.distance}km` }}
  17. </view>
  18. <view class="content mt16">
  19. <view class="flex-between">
  20. <text class="size-22 color-999">不接单日期</text>
  21. <view class="flex-rowr">
  22. <text class="size-22 color-ccc">修改</text>
  23. <image src="@/static/images/ydd/right.png" mode="widthFix" style="width: 20rpx;"></image>
  24. </view>
  25. </view>
  26. <view class="color-999 size-22 mt16 flex-rowl">
  27. <text>
  28. {{ `${item.disabledDate?.length}天:` }}
  29. </text>
  30. <text class="text-ellipsis" style="flex: 1;">
  31. {{ getDisabledDateDesc(item.disabledDate) }}
  32. </text>
  33. </view>
  34. </view>
  35. <view class="flex-between mt16">
  36. <view class="flex-rowl">
  37. <view class="color-ffb size-22">
  38. 接单中
  39. </view>
  40. <switch checked="true" color="#FFBF60" style="transform: scale(0.6);" />
  41. </view>
  42. <view class="flex-rowr">
  43. <view class="flex-rowl">
  44. <image src="@/static/images/ydd/edit.png" mode="widthFix" style="width: 20rpx;"></image>
  45. <text class="size-22 color-777 ml10">编辑</text>
  46. </view>
  47. <view class="flex-rowl" style="margin-left: 50rpx;">
  48. <image src="@/static/images/ydd/cancel.png" mode="widthFix" style="width: 20rpx;"></image>
  49. <text class="size-22 color-777 ml10">删除</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view v-else class="flex-rowc">
  56. <image class="icon-empty" src="../static/connectAddress/icon-empty.png" mode="widthFix"></image>
  57. </view>
  58. <view class="footer-btn">
  59. <view class="btn" @click="toAdd">
  60. 新增接单地址
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script setup>
  66. import { ref } from 'vue'
  67. import { onShow } from '@dcloudio/uni-app'
  68. import dayjs from 'dayjs'
  69. import { getAddressList } from '@/api/address'
  70. const list = ref([])
  71. const fetchAddressList = async () => {
  72. try {
  73. // todo: 对接接口字段
  74. list.value = await getAddressList()
  75. console.log('--list', list.value)
  76. } catch (err) {
  77. }
  78. }
  79. const getDisabledDateDesc = (dateArr) => {
  80. if (!dateArr?.length) {
  81. return '暂无不可接单日期'
  82. }
  83. return dateArr.map(date => dayjs(date).format('MM-DD')).join('、')
  84. }
  85. const toAdd = () => {
  86. uni.navigateTo({
  87. url: "/otherPages/authentication/connectAddress/detail"
  88. })
  89. }
  90. onShow(() => {
  91. fetchAddressList()
  92. })
  93. </script>
  94. <style lang="scss" scoped>
  95. .page {
  96. .icon-empty {
  97. width: 259rpx;
  98. height: auto;
  99. margin-top: 240rpx;
  100. }
  101. }
  102. .content {
  103. background-color: #F3F3F3;
  104. border-radius: 20rpx;
  105. padding: 24rpx;
  106. }
  107. .li {
  108. margin: 16rpx 24rpx 0 24rpx;
  109. border-radius: 20rpx;
  110. padding: 24rpx;
  111. }
  112. .tips {
  113. padding: 10rpx 32rpx;
  114. background-color: rgb(255, 250, 242);
  115. image {
  116. width: 32rpx;
  117. height: 32rpx;
  118. }
  119. }
  120. .text-ellipsis{
  121. overflow:hidden; //超出的文本隐藏
  122. text-overflow:ellipsis; //溢出用省略号显示
  123. white-space:nowrap; //溢出不换行
  124. }
  125. </style>