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.5KB

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