You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

addressManager.vue 5.6KB

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