address.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template name="address">
  2. <view class="address-template">
  3. <!-- 地址 -->
  4. <navigator :url="addressSrc" class="address-section">
  5. <view class="address-empty" v-if="isEmpty">
  6. <text class="iconfont icon-tianjiadizhi"></text><text>添加收货地址</text>
  7. </view>
  8. <view class="address-content" v-else>
  9. <view class="address-cen">
  10. <view class="top">
  11. <view class="name">{{addressData.shouHuoRen ? addressData.shouHuoRen : ''}}</view>
  12. <view class="mobile">{{addressData.mobile ? addressData.mobile : ''}}</view>
  13. </view>
  14. <view class="address">
  15. <view class="address-icon">
  16. <text class="iconfont icon-shouhuodizhi"></text>
  17. </view>
  18. <view class="address-text">
  19. 收货地址:
  20. {{addressData.provinceName ? addressData.provinceName : ''}}
  21. {{addressData.cityName ? addressData.cityName : ''}}
  22. {{addressData.townName ? addressData.townName : ''}}
  23. {{addressData.address ? addressData.address : ''}}
  24. </view>
  25. </view>
  26. <view class="nexpage"><text class="iconfont icon-genghuan"></text></view>
  27. </view>
  28. </view>
  29. </navigator>
  30. <image :src="StaticUrl+'icon-line.png'" mode=""></image>
  31. </view>
  32. </template>
  33. <script>
  34. export default{
  35. name:'address',
  36. props:{
  37. addressData:{
  38. type:Object
  39. }
  40. },
  41. data() {
  42. return{
  43. StaticUrl:this.$Static,
  44. isEmpty:false,
  45. addressSrc:'',
  46. }
  47. },
  48. created(){
  49. this.initData(this.addressData)
  50. },
  51. computed: {
  52. },
  53. watch:{
  54. addressData:{
  55. handler:function(val){
  56. this.initData(val)
  57. }
  58. }
  59. },
  60. methods:{
  61. initData(res) {
  62. if(Object.keys(res).length == 0){
  63. this.isEmpty = true
  64. this.addressSrc = '/pages/user/address/addressManage'
  65. }else{
  66. this.isEmpty = false
  67. this.$parent.isFreight = false
  68. this.addressSrc = '/pages/user/address/address?type=select'
  69. }
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. .address-template{
  76. width: 100%;
  77. height: auto;
  78. background: #FFFFFF;
  79. border-top: 1px solid #F8F8F8;
  80. image{
  81. float: left;
  82. width: 100%;
  83. height: 6rpx;
  84. }
  85. }
  86. .address-section {
  87. width: 100%;
  88. height: auto;
  89. position: relative;
  90. .address-empty{
  91. width: 100%;
  92. height: 117rpx;
  93. line-height: 117rpx;
  94. color: $color-system;
  95. text-align: center;
  96. font-size: $font-size-26;
  97. font-weight: bold;
  98. background: #fff;
  99. float: left;
  100. .icon-tianjiadizhi{
  101. font-size: 34rpx;
  102. margin: 0 8rpx;
  103. }
  104. }
  105. .address-content {
  106. display: flex;
  107. align-items: center;
  108. padding:20rpx 24rpx;
  109. background: #fff;
  110. }
  111. .icon-shouhuodizhi {
  112. flex-shrink: 0;
  113. display: flex;
  114. align-items: center;
  115. justify-content: center;
  116. width: 40rpx;
  117. color: $color-system;
  118. font-size: 40rpx;
  119. margin-right: 10rpx;
  120. }
  121. .address-cen {
  122. width: 100%;
  123. height: auto;
  124. position: relative;
  125. .top{
  126. padding-left: 50rpx;
  127. height: 42rpx;
  128. line-height: 42rpx;
  129. text-align: left;
  130. font-size: $font-size-30;
  131. color: $text-color;
  132. padding-bottom: 8rpx;
  133. display: flex;
  134. float: left;
  135. .name{
  136. font-weight: bold;
  137. margin-right: 48rpx;
  138. }
  139. .mobile{
  140. margin-right: 40rpx;
  141. font-weight: bold;
  142. }
  143. }
  144. .address {
  145. width: 100%;
  146. height: auto;
  147. float: left;
  148. .address-icon{
  149. width: 40rpx;
  150. height: auto;
  151. float: left;
  152. line-height: 40rpx;
  153. }
  154. .address-text{
  155. width: 610rpx;
  156. padding-left: 10rpx;
  157. float: left;
  158. line-height: 40rpx;
  159. font-size: $font-size-28;
  160. color: $text-color;
  161. text-align: left;
  162. -o-text-overflow: ellipsis;
  163. text-overflow: ellipsis;
  164. display: -webkit-box;
  165. word-break: break-all;
  166. -webkit-box-orient: vertical;
  167. -webkit-line-clamp: 2;
  168. overflow: hidden;
  169. }
  170. }
  171. .nexpage{
  172. text-align: right;
  173. font-size: $font-size-30;
  174. color: #666666;
  175. position: absolute;
  176. right: 0;
  177. top: 45rpx;
  178. .icon-genghuan{
  179. font-size: $font-size-30;
  180. }
  181. }
  182. }
  183. .icon-chakangengduo {
  184. font-size: 32rpx;
  185. color: $text-color;
  186. margin-right: 30rpx;
  187. }
  188. .a-bg {
  189. position: absolute;
  190. left: 0;
  191. bottom: 0;
  192. display: block;
  193. width: 100%;
  194. height: 5rpx;
  195. }
  196. }
  197. </style>