cm-choose-address.vue 4.4 KB

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