Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

addressManager.vue 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="address-line">
  3. <view v-for="(item, index) in state.addressArray" :key="index" @click="addressSelected(item)"
  4. style="margin-bottom: 60rpx" class="flex-bettwen">
  5. <view class="flex">
  6. <view class="xing">
  7. {{ item.consignee.charAt(0) }}
  8. </view>
  9. <view class="content">
  10. <view class="flex">
  11. <view class="name">
  12. {{ item.consignee }}
  13. </view>
  14. <view class="phone">
  15. {{ item.consigneeTel }}
  16. <text class="default" v-if="item.defaultAddress==1">默认</text>
  17. </view>
  18. </view>
  19. <view class="address">
  20. {{ item.region + item.address }}
  21. </view>
  22. </view>
  23. </view>
  24. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  25. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`" style="width: 48rpx; height: 48rpx">
  26. </image>
  27. </view>
  28. </view>
  29. <NoDataView v-if="state.addressArray.length == 0" :text="'暂无收货地址'"></NoDataView>
  30. <view style="margin-top: 60rpx" class="action-bottom">
  31. <button type="default" class="ui-btn" @click="goToAddAddress()">
  32. 添加收货地址
  33. </button>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup lang="ts">
  38. import {
  39. getItem,
  40. StorageKeys
  41. } from "@/utils/storage";
  42. import {
  43. onLoad,
  44. onShow
  45. } from "@dcloudio/uni-app";
  46. import {
  47. addressQueryNew,
  48. } from "@/utils/network/api.js";
  49. import { requestNew} from "@/utils/network/request.js";
  50. import NoDataView from "@/components/no-data-view/no-data-view.vue";
  51. import {
  52. reactive,
  53. } from "vue";
  54. const state = reactive({
  55. addressArray: [],
  56. fromOrder: false, //是否来自订单
  57. });
  58. const goToAddAddress = () => {
  59. uni.navigateTo({
  60. url: "/subpackage/orders/addAddress",
  61. });
  62. };
  63. const editAddress = (val) => {
  64. uni.navigateTo({
  65. url: `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  66. });
  67. };
  68. const addressSelected = (val : any) => {
  69. if (state.fromOrder) {
  70. //来自订单-直接返回选中数据
  71. uni.$emit("selectAddressSuccess", val);
  72. uni.navigateBack({
  73. delta: 1
  74. });
  75. }
  76. };
  77. onShow(() => {
  78. const options = {
  79. type: 2,
  80. data: {},
  81. method: "POST",
  82. showLoading: true,
  83. };
  84. requestNew(addressQueryNew, options).then((res) => {
  85. console.log("/iaw/api/address/query",res)
  86. state.addressArray = []
  87. const data = res;
  88. if (data.result.length==0) {
  89. console.log("这是空");
  90. state.addressArray = []
  91. } else {
  92. state.addressArray = data.result;
  93. console.log(state.addressArray, "列表数组");
  94. }
  95. });
  96. });
  97. onLoad((option : any) => {
  98. state.fromOrder = option.fromOrder;
  99. });
  100. </script>
  101. <style lang="scss" scoped>
  102. .flex {
  103. display: flex;
  104. align-items: center;
  105. }
  106. .content-wrap {
  107. position: relative;
  108. margin-top: -50rpx;
  109. padding: 0rpx 30rpx;
  110. .title {
  111. font-size: 30rpx;
  112. font-family: Noto Sans S Chinese;
  113. font-weight: 400;
  114. color: #000000;
  115. line-height: 30rpx;
  116. margin-bottom: 30rpx;
  117. }
  118. .car-input {}
  119. .chepai-lane {
  120. margin-top: 60rpx;
  121. margin-bottom: 20rpx;
  122. }
  123. .address-lane {
  124. margin-bottom: 30rpx;
  125. .title {
  126. font-size: 30rpx;
  127. font-weight: 400;
  128. color: #000000;
  129. line-height: 30rpx;
  130. }
  131. }
  132. }
  133. .address-content {
  134. display: flex;
  135. align-items: center;
  136. justify-content: space-between;
  137. padding-bottom: 30rpx;
  138. border-bottom: 1rpx solid #dcdcdc;
  139. .name {
  140. font-size: 26rpx;
  141. font-family: Microsoft YaHei;
  142. font-weight: 400;
  143. color: #999999;
  144. font-size: 26rpx;
  145. }
  146. .phone {
  147. font-size: 26rpx;
  148. font-family: Microsoft YaHei;
  149. font-weight: 400;
  150. color: #999999;
  151. line-height: 26rpx;
  152. margin-left: 20rpx;
  153. }
  154. .arror {
  155. width: 16rpx;
  156. height: 30rpx;
  157. color: rgba(153, 153, 153, 1);
  158. }
  159. .address {
  160. font-size: 32rpx;
  161. font-family: Microsoft YaHei;
  162. font-weight: 400;
  163. color: #333333;
  164. line-height: 32rpx;
  165. }
  166. }
  167. .address-line {
  168. padding: 20px;
  169. .flex-bettwen {
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-between;
  173. }
  174. .xing {
  175. width: 68rpx;
  176. height: 68rpx;
  177. background: rgba(0, 69, 118, 0.2);
  178. border-radius: 50%;
  179. font-size: 26rpx;
  180. font-weight: 400;
  181. color:white;
  182. line-height: 68rpx;
  183. text-align: center;
  184. }
  185. .content {
  186. margin-left: 20px;
  187. .name {
  188. font-size: 30rpx;
  189. font-family: Microsoft YaHei;
  190. font-weight: 500;
  191. color: #333333;
  192. }
  193. .phone {
  194. margin-left: 10rpx;
  195. font-size: 24rpx;
  196. font-family: Microsoft YaHei;
  197. font-weight: 400;
  198. color: #999999;
  199. line-height: 36rpx;
  200. }
  201. .address {
  202. margin-top: 10rpx;
  203. font-size: 26rpx;
  204. font-family: Microsoft YaHei;
  205. font-weight: 400;
  206. color: #333333;
  207. line-height: 36rpx;
  208. }
  209. .picture {
  210. width: 48rpx;
  211. height: 48rpx;
  212. }
  213. .editIcon {
  214. width: 48rpx;
  215. height: 48rpx;
  216. }
  217. }
  218. }
  219. .action-bottom {
  220. padding-bottom: 30rpx;
  221. }
  222. .default {
  223. border: 1rpx solid #004576;
  224. border-radius: 5rpx;
  225. padding: 2rpx 4rpx;
  226. color: #004576;
  227. margin-left: 4rpx;
  228. }
  229. </style>