select-address.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view>
  3. <uni-popup ref="popupAddress" type="bottom">
  4. <view class="pop-address box-border-box p-24">
  5. <view class="text-align-center fs-36 fw-600 box-title mb-32">
  6. 选择收货地址
  7. <uni-icons @click="closeCoupon" class="box-close" type="closeempty" size="20"></uni-icons>
  8. </view>
  9. <view v-if="list.length === 0" class="scroll-view-css">
  10. <EnBlank :customSrc='true'>
  11. <template v-slot:blankImg>
  12. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  13. </template>
  14. </EnBlank>
  15. </view>
  16. <view v-else class="scroll-view-css">
  17. <view class="item-box flex-justify-space align-items-center mb-20" v-for="(item,index) in list" :key="index" @click.stop="select(item)">
  18. <image v-if="id==item.id" class="s-icon" src="@/static/img/common/y-select.png" mode=""></image>
  19. <image v-else class="s-icon"src="@/static/img/common/n-select.png" mode=""></image>
  20. <view class="">
  21. <view class="fs-34 fw-600 w556 mb-12">
  22. <span v-if="item.is_default == 1" class="list-box-only fs-24 fc-FE9E11 text-align-center mr-8">默认</span>
  23. {{item.address}}{{item.school_name}}{{item.dorm_name}}
  24. </view>
  25. <view class="p-b-20">
  26. <span class="mr-24 fs-28 fc-9">{{item.consignee}}</span><span class="fs-28 fc-9">{{item.phone}}</span>
  27. </view>
  28. </view>
  29. <image class="edit-img" src="@/static/img/common/edit.png" mode="" @click.stop="toEdit(1,item)"></image>
  30. </view>
  31. </view>
  32. <view class="box-border-box p-24 bgc-f" @click="toEdit(2)">
  33. <view class="add-box text-align-center fs-34 fc-f">新增地址</view>
  34. </view>
  35. </view>
  36. </uni-popup>
  37. </view>
  38. </template>
  39. <script>
  40. import {getAddressList} from '@/api/member.js'
  41. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  42. import tools from "@/service/tools.js";
  43. export default {
  44. components:{EnBlank,},
  45. data(){
  46. return{
  47. id:'',
  48. list:[],
  49. }
  50. },
  51. onShow() {
  52. this.list = [];
  53. getAddressList().then((res)=>{
  54. if(res.code === 1){
  55. this.list = res.data;
  56. }
  57. })
  58. },
  59. methods:{
  60. getList(){
  61. getAddressList().then((res)=>{
  62. if(res.code === 1){
  63. this.list = res.data;
  64. this.openPop();
  65. }
  66. })
  67. },
  68. select(item){
  69. if(item.id != this.id){
  70. this.$emit('giveAddress',item);
  71. this.closeCoupon();
  72. }
  73. },
  74. openPop(){
  75. this.$refs.popupAddress.open();
  76. },
  77. closeCoupon(){
  78. this.list = [];
  79. this.$refs.popupAddress.close();
  80. },
  81. toEdit(type,item){
  82. if(type === 1){
  83. uni.navigateTo({
  84. url:"pages-address/edit-add?id=" + item.id
  85. })
  86. }else{
  87. uni.navigateTo({
  88. url:"pages-address/edit-add"
  89. })
  90. }
  91. },
  92. },
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. .add-box{
  97. width: 100%;
  98. height: 80rpx;
  99. line-height: 80rpx;
  100. background-color: #2F80ED;
  101. border-radius: 200rpx;
  102. }
  103. .w556{
  104. width: 556rpx;
  105. }
  106. .list-box-only{
  107. width: 64rpx;
  108. height: 34rpx;
  109. line-height: 34rpx;
  110. border-radius: 8rpx;
  111. border: 2rpx solid #FE9E11;
  112. }
  113. .item-box{
  114. border-bottom: 1rpx solid #f9f9f9;
  115. .s-icon{
  116. width: 32rpx;
  117. height: 32rpx;
  118. }
  119. .edit-img{
  120. width: 48rpx;
  121. height: 48rpx;
  122. }
  123. }
  124. .pop-address{
  125. width: 100%;
  126. height: 50vh;
  127. background-color: #fff;
  128. border-radius: 24rpx 24rpx 0rpx 0rpx;
  129. padding-top: 32rpx !important;
  130. display: flex;
  131. flex-direction: column;
  132. .box-title{
  133. position: relative;
  134. .box-close{
  135. position: absolute;
  136. right: 22rpx;
  137. }
  138. }
  139. }
  140. </style>