select-address.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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(AddressId){
  61. getAddressList().then((res)=>{
  62. if(res.code === 1){
  63. this.list = res.data;
  64. let isConfirmAddressFlag = uni.getStorageSync('isConfirmAddressFlag');
  65. if (isConfirmAddressFlag && AddressId) {
  66. let item = ''
  67. res.data.forEach((v,k) => {
  68. if(v.id == AddressId){
  69. item = v
  70. }
  71. })
  72. this.$emit('giveAddress',item);
  73. }
  74. this.openPop();
  75. }
  76. })
  77. },
  78. select(item){
  79. if(item.id != this.id){
  80. this.$emit('giveAddress',item);
  81. this.closeCoupon();
  82. }
  83. },
  84. openPop(){
  85. this.$refs.popupAddress.open();
  86. },
  87. closeCoupon(){
  88. this.list = [];
  89. this.$refs.popupAddress.close();
  90. },
  91. toEdit(type,item){
  92. if(type === 1){
  93. uni.navigateTo({
  94. url:"pages-address/edit-add?id=" + item.id
  95. })
  96. }else{
  97. uni.navigateTo({
  98. url:"pages-address/edit-add"
  99. })
  100. }
  101. },
  102. },
  103. }
  104. </script>
  105. <style scoped lang="scss">
  106. .add-box{
  107. width: 100%;
  108. height: 80rpx;
  109. line-height: 80rpx;
  110. background-color: #2F80ED;
  111. border-radius: 200rpx;
  112. }
  113. .w556{
  114. width: 556rpx;
  115. }
  116. .list-box-only{
  117. width: 64rpx;
  118. height: 34rpx;
  119. line-height: 34rpx;
  120. border-radius: 8rpx;
  121. border: 2rpx solid #FE9E11;
  122. }
  123. .item-box{
  124. border-bottom: 1rpx solid #f9f9f9;
  125. .s-icon{
  126. width: 32rpx;
  127. height: 32rpx;
  128. }
  129. .edit-img{
  130. width: 48rpx;
  131. height: 48rpx;
  132. }
  133. }
  134. .pop-address{
  135. width: 100%;
  136. height: 50vh;
  137. background-color: #fff;
  138. border-radius: 24rpx 24rpx 0rpx 0rpx;
  139. padding-top: 32rpx !important;
  140. display: flex;
  141. flex-direction: column;
  142. .box-title{
  143. position: relative;
  144. .box-close{
  145. position: absolute;
  146. right: 22rpx;
  147. }
  148. }
  149. }
  150. </style>