index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view>
  3. <view class="item" v-for="(res, index) in siteList" :key="res.id">
  4. <view class="top">
  5. <view class="name">{{ res.name }}</view>
  6. <view class="phone">{{ res.phone }}</view>
  7. <view class="tag">
  8. <text v-for="(item, index) in res.tag" :key="index" :class="{red:item.tagText=='默认'}">{{ item.tagText }}</text>
  9. </view>
  10. </view>
  11. <view class="bottom">
  12. 广东省深圳市宝安区 自由路66号
  13. <u-icon name="edit-pen" :size="40" color="#999999"></u-icon>
  14. </view>
  15. </view>
  16. <view class="addSite" @tap="toAddSite">
  17. <view class="add">
  18. <u-icon name="plus" color="#ffffff" class="icon" :size="30"></u-icon>新建收货地址
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. siteList: []
  28. };
  29. },
  30. onLoad() {
  31. this.getData();
  32. },
  33. methods: {
  34. getData() {
  35. this.siteList = [
  36. {
  37. id: 1,
  38. name: '游X',
  39. phone: '183****5523',
  40. tag: [
  41. {
  42. tagText: '默认'
  43. },
  44. {
  45. tagText: '家'
  46. }
  47. ],
  48. site: '广东省深圳市宝安区 自由路66号'
  49. },
  50. {
  51. id: 2,
  52. name: '李XX',
  53. phone: '183****5555',
  54. tag: [
  55. {
  56. tagText: '公司'
  57. }
  58. ],
  59. site: '广东省深圳市宝安区 翻身路xx号'
  60. },
  61. {
  62. id: 3,
  63. name: '王YY',
  64. phone: '153****5555',
  65. tag: [],
  66. site: '广东省深圳市宝安区 平安路13号'
  67. }
  68. ];
  69. },
  70. toAddSite(){
  71. uni.navigateTo({
  72. url: '/pages_template/pages/address/addSite'
  73. });
  74. }
  75. }
  76. };
  77. </script>
  78. <style lang="scss" scoped>
  79. .item {
  80. padding: 40rpx 20rpx;
  81. .top {
  82. display: flex;
  83. font-weight: bold;
  84. font-size: 34rpx;
  85. .phone {
  86. margin-left: 60rpx;
  87. }
  88. .tag {
  89. display: flex;
  90. font-weight: normal;
  91. align-items: center;
  92. text {
  93. display: block;
  94. width: 60rpx;
  95. height: 34rpx;
  96. line-height: 34rpx;
  97. color: #ffffff;
  98. font-size: 20rpx;
  99. border-radius: 6rpx;
  100. text-align: center;
  101. margin-left: 30rpx;
  102. background-color:rgb(49, 145, 253);
  103. }
  104. .red{
  105. background-color:red
  106. }
  107. }
  108. }
  109. .bottom {
  110. display: flex;
  111. margin-top: 20rpx;
  112. font-size: 28rpx;
  113. justify-content: space-between;
  114. color: #999999;
  115. }
  116. }
  117. .addSite {
  118. display: flex;
  119. justify-content: space-around;
  120. width: 600rpx;
  121. line-height: 100rpx;
  122. position: absolute;
  123. bottom: 30rpx;
  124. left: 80rpx;
  125. background-color: red;
  126. border-radius: 60rpx;
  127. font-size: 30rpx;
  128. .add{
  129. display: flex;
  130. align-items: center;
  131. color: #ffffff;
  132. .icon{
  133. margin-right: 10rpx;
  134. }
  135. }
  136. }
  137. </style>