CheckoutAddress.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="div container" @click="onclick">
  3. <view class="div top-wrapper">
  4. <flex-line class="selected-wrapper" v-if="hasAddress" :show-border="true">
  5. <view class="div line">
  6. <text class="i icon iconfont">&#xe6d3;</text>
  7. <view class="div line-content">
  8. <view class="div title-wrapper">
  9. <label class="title">{{item.address_realname}}</label>
  10. <label class="title" style="margin-left:1rem;">{{item.address_mob_phone}}</label>
  11. <label class="default" v-if="isDefault">默认</label>
  12. </view>
  13. <view class="div desc address-text">{{item.area_info}}{{item.address_detail}}</view>
  14. </view>
  15. </view>
  16. </flex-line>
  17. <view v-else class="div unselected-wrapper">
  18. <label class="desc">您还没有收货地址,点击这里添加。</label>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import flexLine from '../../../flexLine'
  25. export default {
  26. props: ['item'],
  27. created: function () {
  28. },
  29. components: { flexLine },
  30. computed: {
  31. hasAddress () {
  32. if (this.item) {
  33. return true
  34. }
  35. this.onclick()
  36. return false
  37. },
  38. isDefault () {
  39. if (this.item && this.item.is_default) {
  40. return true
  41. }
  42. return false
  43. }
  44. },
  45. methods: {
  46. onclick () {
  47. this.$emit('onclick')
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .container {
  54. display: flex;
  55. flex-direction: column;
  56. justify-content: flex-start;
  57. align-items: stretch;
  58. background-color: #fff;
  59. }
  60. .line{display: flex;
  61. .line-content{flex:1}
  62. }
  63. .top-wrapper {
  64. flex: 1;
  65. display: flex;
  66. flex-direction: row;
  67. justify-content: flex-start;
  68. align-items: center;
  69. background-color: #fff;
  70. }
  71. .title-wrapper {
  72. height: 1rem;
  73. display: flex;
  74. flex-direction: row;
  75. justify-content: flex-start;
  76. align-items: center;
  77. }
  78. .icon {
  79. font-size:$h1;
  80. margin-right: .2rem;
  81. color:$primaryColor
  82. }
  83. .title {
  84. }
  85. .default {
  86. width: 1.4rem;
  87. margin-left: 0.5rem;
  88. margin-right: 0.5rem;
  89. border: 1px solid $primaryColor;
  90. color: $primaryColor;
  91. font-size:$h6;
  92. text-align: center;
  93. border-radius: 0.1rem;
  94. }
  95. .desc {
  96. color: $descTextColor;
  97. }
  98. .address-text {
  99. margin-top: .3rem;
  100. font-weight: normal;
  101. }
  102. .selected-wrapper{
  103. padding:1rem 0;
  104. }
  105. .unselected-wrapper {
  106. flex: 1;
  107. display: flex;
  108. flex-direction: column;
  109. justify-content: center;
  110. align-items: center;
  111. }
  112. .indicator {
  113. height: 0.6rem;
  114. margin-left: 0.5rem;
  115. margin-right: $pageSpace;
  116. }
  117. .line-wrapper {
  118. background:#eee;
  119. // position: relative;
  120. left: 0;
  121. right: 0;
  122. bottom: 0;
  123. width: 100%;
  124. height: 0.1rem;
  125. }
  126. </style>