cm-choose-address.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. overflow: hidden;
  88. image{
  89. float: left;
  90. width: 100%;
  91. height: 6rpx;
  92. }
  93. }
  94. .address-section {
  95. width: 100%;
  96. height: auto;
  97. position: relative;
  98. .address-empty{
  99. width: 100%;
  100. height: 117rpx;
  101. line-height: 117rpx;
  102. color: $color-system;
  103. text-align: center;
  104. font-size: $font-size-26;
  105. font-weight: bold;
  106. background: #fff;
  107. float: left;
  108. .icon-tianjiadizhi{
  109. font-size: 34rpx;
  110. margin: 0 8rpx;
  111. }
  112. }
  113. .address-content {
  114. display: flex;
  115. align-items: center;
  116. padding:20rpx 24rpx;
  117. background: #fff;
  118. }
  119. .icon-shouhuodizhi {
  120. flex-shrink: 0;
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. width: 40rpx;
  125. color: $color-system;
  126. font-size: 40rpx;
  127. margin-right: 10rpx;
  128. }
  129. .address-cen {
  130. width: 100%;
  131. height: auto;
  132. position: relative;
  133. .top{
  134. padding-left: 50rpx;
  135. height: 42rpx;
  136. line-height: 42rpx;
  137. text-align: left;
  138. font-size: $font-size-30;
  139. color: $text-color;
  140. padding-bottom: 8rpx;
  141. display: flex;
  142. float: left;
  143. .name{
  144. font-weight: bold;
  145. margin-right: 48rpx;
  146. }
  147. .mobile{
  148. margin-right: 40rpx;
  149. font-weight: bold;
  150. }
  151. }
  152. .address {
  153. width: 100%;
  154. height: auto;
  155. float: left;
  156. .address-icon{
  157. width: 40rpx;
  158. height: auto;
  159. float: left;
  160. line-height: 40rpx;
  161. }
  162. .address-text{
  163. width: 610rpx;
  164. padding-left: 10rpx;
  165. float: left;
  166. line-height: 40rpx;
  167. font-size: $font-size-28;
  168. color: $text-color;
  169. text-align: left;
  170. -o-text-overflow: ellipsis;
  171. text-overflow: ellipsis;
  172. display: -webkit-box;
  173. word-break: break-all;
  174. -webkit-box-orient: vertical;
  175. -webkit-line-clamp: 2;
  176. overflow: hidden;
  177. }
  178. }
  179. .nexpage{
  180. text-align: right;
  181. font-size: $font-size-30;
  182. color: #666666;
  183. position: absolute;
  184. right: 0;
  185. top: 45rpx;
  186. .icon-genghuan{
  187. font-size: $font-size-30;
  188. }
  189. }
  190. }
  191. .icon-chakangengduo {
  192. font-size: 32rpx;
  193. color: $text-color;
  194. margin-right: 30rpx;
  195. }
  196. .a-bg {
  197. position: absolute;
  198. left: 0;
  199. bottom: 0;
  200. display: block;
  201. width: 100%;
  202. height: 5rpx;
  203. }
  204. }
  205. </style>