Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

essential-information-two.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <template>
  2. <navBar title="九州ETC" navbgClass="nav-bgXin" fontColor='#fff' :scrollTop="scrollTop" :type="state.data.vanType"
  3. :userType="state.data.userType"></navBar>
  4. <navBgCar :activeNum='2'></navBgCar>
  5. <view class="content-wrap">
  6. <view>
  7. <!-- 收货地址 -->
  8. <view v-if="!state.data.region" class="address-lane">
  9. <view class="title">请选择或新增收货地址</view>
  10. <view style="margin-top: 30rpx" class="action">
  11. <button type="default" class="ui-btn" @click="state.show = true">
  12. 添加收货地址
  13. </button>
  14. </view>
  15. </view>
  16. <view v-if="state.data.region" class="address-lane">
  17. <view class="title">收货地址</view>
  18. <view @click="state.show = true" class="address-content" style="margin-top: 30rpx">
  19. <view class="flex l-info">
  20. <image :showLoading="true" :src="`${$imgUrl}issuance/l-icon.png`" class="l-icon">
  21. </image>
  22. <view style="margin-left: 18rpx;flex: 1 1 auto;" class="">
  23. <view class="address">
  24. {{ state.data.region + state.data.address }}
  25. </view>
  26. <view style="margin-top: 15rpx" class="flex">
  27. <view class="name">
  28. {{ state.data.consignee }}
  29. </view>
  30. <view class="phone">
  31. {{ state.data.consigneeTel }}
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="arror">
  37. <image :src="`${$imgUrl}issuance/r-more.png`" class="icon" mode='aspectFit'></image>
  38. </view>
  39. </view>
  40. <view style="margin-top: 30rpx" class="action">
  41. <button type="default" class="button" @click="nextAction()">
  42. 下一步
  43. </button>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 地址弹窗 -->
  49. <u-popup mode="bottom" v-model="state.show">
  50. <view class="address-line">
  51. <view v-if="state.addressArray" v-for="(item, index) in state.addressArray" :key="index"
  52. @click="addressSelected(item)" style="margin-bottom: 60rpx" class="flex-bettwen">
  53. <view class="flex">
  54. <view class="xing">
  55. {{ item.consignee.charAt(0) }}
  56. </view>
  57. <view class="content">
  58. <view class="flex">
  59. <view class="name">
  60. {{ item.consignee }}
  61. </view>
  62. <view class="phone">
  63. {{ item.consigneeTel }}
  64. <text class="default" v-if="item.defaultAddress==1">默认</text>
  65. </view>
  66. </view>
  67. <view class="address">
  68. {{ item.region + item.address }}
  69. </view>
  70. </view>
  71. </view>
  72. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  73. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`" style="width: 48rpx; height: 48rpx"></image>
  74. </view>
  75. </view>
  76. <view :style="state.addressArray ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  77. <button type="default" class="ui-btn" @click="goToAddAddress()">
  78. 添加收货地址
  79. </button>
  80. </view>
  81. </view>
  82. </u-popup>
  83. </template>
  84. <script setup lang="ts">
  85. /*导航*/
  86. import navBgCar from "./components/nav-bg-car1";
  87. import numberplateColor from "./components/layout-numberplate-color";
  88. import { getItem, StorageKeys } from "@/utils/storage";
  89. import { stringToJson } from "@/utils/network/encryption";
  90. import navBar from "@/components/nav-bar/nav-bar2.vue";
  91. import { onLoad, onShow, onPageScroll, onUnload } from "@dcloudio/uni-app";
  92. import {
  93. addressQueryNew,
  94. productReCode,
  95. addProduct,
  96. orderAdd, orderDetailQuery
  97. } from "@/utils/network/api.js";
  98. import { request, requestNew } from "@/utils/network/request.js";
  99. import { reactive, ref } from "vue";
  100. import { msg, noticeUse,navTo } from "@/utils/utils";
  101. const scrollTop = ref(0);
  102. const state = reactive({
  103. data: {
  104. vehiclePlate: undefined, //车牌号
  105. vehiclePlateNumber: "", //车牌号
  106. vehiclePlateColor: 0, //车牌颜色
  107. vanType: 1, //客货类型
  108. userType: 1,
  109. whetherToMail: getItem(StorageKeys.OpenId) ? true : "", //是否需要邮寄 小程序默认邮寄 true邮寄||1不邮寄 不登录为1
  110. orderSource: "WECHAT",
  111. opId: "",
  112. consignee: "", //收货人
  113. consigneeTel: "", //收货电话
  114. region: "",
  115. address: "",
  116. postalCode: "",
  117. longitude: "",
  118. latitude: "",
  119. detailedAddress: '', //通过经纬度转的地址
  120. cardType: '', //卡类型
  121. productId: "",//产品编号
  122. },
  123. show: false,
  124. addressArray: [],
  125. isSign: '',
  126. isValueCard: '',
  127. agreeURL: "",
  128. orderId: "",
  129. totalAmount: "",
  130. equityId: ""
  131. });
  132. const goToAddAddress = () => {
  133. navTo(
  134. "/subpackage/orders/addAddress",
  135. );
  136. };
  137. const editAddress = (val) => {
  138. console.log("val", val)
  139. navTo(
  140. `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  141. );
  142. };
  143. const addressSelected = (val : any) => {
  144. console.log("val", val)
  145. state.data = {
  146. ...state.data,
  147. ...val,
  148. };
  149. console.log("state.data.address", state.data.address)
  150. state.show = false;
  151. };
  152. const nextAction = () => {
  153. nextActionRequest()
  154. };
  155. const nextActionRequest = () => {
  156. var data = state.data;
  157. // #ifdef MP-ALIPAY
  158. data.orderSource = 'ALI'
  159. // #endif
  160. const options = {
  161. type: 2,
  162. data: data,
  163. method: "POST",
  164. showLoading: true,
  165. };
  166. requestNew(orderAdd, options).then((res) => {
  167. console.log("res===", res);
  168. if (res.statusCode === 600) {
  169. orderGoAction();
  170. } else {
  171. const data = res;
  172. state.orderId = data.orderId
  173. console.log(data);
  174. var vehicleId = state.data.vehiclePlate + "_" + state.data.vehiclePlateColor
  175. console.log("state.data.vehiclePlate", state.data.vehiclePlate, state.data.vehiclePlateColor, vehicleId)
  176. if (state.data.userType == 1) {
  177. navTo(
  178. `/subpackage/orders/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  179. );
  180. } else {
  181. navTo(
  182. `/subpackage/orders/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  183. );
  184. }
  185. }
  186. });
  187. }
  188. //按照订单阶段去跳转
  189. const orderGoAction = () => {
  190. var orderParmas = {
  191. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  192. opId: getItem(StorageKeys.OpenId),
  193. source: "WECHAT",
  194. };
  195. const options = {
  196. type: 2,
  197. data: orderParmas,
  198. method: "POST",
  199. showLoading: true,
  200. };
  201. requestNew(orderDetailQuery, options).then((res) => {
  202. const data = res;
  203. console.log(data);
  204. orderStepGoActon(data);
  205. });
  206. };
  207. //订单状态舔砖
  208. const orderStepGoActon = (val : any) => {
  209. console.log("订单状态舔砖", val);
  210. //完成填写基本信息
  211. if (val.orderStep === 1) {
  212. if (state.data.userType === 1 || val.orderStep === 27) {
  213. uni.redirectTo({
  214. url: `/ subpackage / orders / opening - account - people ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  215. });
  216. } else {
  217. uni.redirectTo({
  218. url: `/ subpackage / orders / opening - account - unit ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  219. });
  220. }
  221. } else if (val.orderStep === 2) {
  222. uni.redirectTo({
  223. url: `/ subpackage / orders / car - release ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  224. });
  225. } else if (val.orderStep === 3) {
  226. uni.redirectTo({
  227. url: `/ subpackage / orders / choice - product ? orderId = ${val.orderId} `,
  228. });
  229. } else if (val.orderStep === 4) {
  230. uni.redirectTo({
  231. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  232. });
  233. } else if (val.orderStep === 26) {
  234. uni.redirectTo({
  235. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  236. });
  237. }
  238. };
  239. onLoad((option : any) => {
  240. state.data.vanType = Number(option.vanType); //1客车 2货车
  241. state.data.opId = getItem(StorageKeys.OpenId);
  242. state.data.userType = Number(option.userType);
  243. state.data.productId = option.productId;
  244. state.data.vehiclePlate = option.vehiclePlate;
  245. state.data.vehiclePlateColor = option.vehiclePlateColor;
  246. state.isValueCard = option.isValueCard
  247. state.data.cardType = option.cardType
  248. state.totalAmount = option.totalAmount;
  249. state.equityId = option.equityId;
  250. console.log("订单选择推广发行产品接口", option)
  251. uni.getLocation({
  252. type: 'wgs84',
  253. success: function (res) {
  254. state.data.longitude = res.longitude;
  255. state.data.latitude = res.latitude;
  256. console.log("成功回调", res)
  257. uni.request({
  258. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  259. data: {
  260. location: (res.latitude + "," + res.longitude),
  261. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  262. },
  263. success: function (res) {
  264. console.log("成功回调", res)
  265. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  266. // 处理获取到的地址信息
  267. },
  268. fail: function (error) {
  269. // 请求失败的处理
  270. }
  271. });
  272. }
  273. });
  274. });
  275. //监听页面滚动
  276. onPageScroll((e) => {
  277. scrollTop.value = e.scrollTop;
  278. });
  279. onShow((option) => {
  280. var data = {
  281. openId: getItem(StorageKeys.OpenId),
  282. };
  283. if (getItem(StorageKeys.OpenId)) {
  284. const options = {
  285. type: 2,
  286. data: data,
  287. method: "POST",
  288. showLoading: true,
  289. };
  290. requestNew(addressQueryNew, options).then((res) => {
  291. const data = res;
  292. console.log("111", data);
  293. state.addressArray = data.result ? data.result : [];
  294. for (var i = 0; i < state.addressArray.length; i++) {
  295. if (state.addressArray[i]['defaultAddress'] == 1) {
  296. state.data = {
  297. ...state.data,
  298. ...state.addressArray[i],
  299. };
  300. }
  301. }
  302. });
  303. }
  304. uni.$on('updateData', function (data) {
  305. var arr = [];
  306. arr.push(data)
  307. state.addressArray = arr
  308. console.log("dizhi", arr)
  309. })
  310. // 删除地址
  311. if (option) {
  312. if (option.del == 1) {
  313. state.addressArray = [];
  314. }
  315. }
  316. });
  317. onUnload(() => {
  318. uni.$off('updateData');
  319. })
  320. const productReCodeAction = (orderId) => {
  321. var data = {
  322. promoteId: state.data.productId,
  323. orderId: orderId,
  324. isValueCard: state.isValueCard,
  325. loginSource: getItem("loginSource")
  326. };
  327. const options = {
  328. type: 2,
  329. data: data,
  330. method: "POST",
  331. showLoading: true,
  332. };
  333. return new Promise(async (resolve, reject) => {
  334. const res = await request(productReCode, options);
  335. const data = stringToJson(res.bizContent);
  336. console.log("111")
  337. resolve(data);
  338. }).catch((error) => {
  339. console.log("222")
  340. reject(error);
  341. });
  342. };
  343. </script>
  344. <style lang="scss" scoped>
  345. .flex {
  346. display: flex;
  347. align-items: center;
  348. }
  349. .content-wrap {
  350. position: absolute;
  351. padding: 0rpx 30rpx;
  352. top: 370rpx;
  353. min-height: calc(100% - 370rpx);
  354. box-sizing: border-box;
  355. width: 100%;
  356. .title {
  357. font-size: 30rpx;
  358. font-family: Noto Sans S Chinese;
  359. font-weight: 400;
  360. color: #000000;
  361. line-height: 30rpx;
  362. margin-bottom: 30rpx;
  363. }
  364. .car-input {}
  365. .chepai-lane {
  366. margin-top: 60rpx;
  367. margin-bottom: 20rpx;
  368. }
  369. .address-lane {
  370. background-color: #fff;
  371. padding: 30rpx;
  372. border-radius: 12rpx;
  373. .title {
  374. font-size: 30rpx;
  375. font-weight: bold;
  376. line-height: 30rpx;
  377. margin-bottom: 30rpx;
  378. font-family: SourceHanSansSC, SourceHanSansSC;
  379. color: #01243A;
  380. }
  381. }
  382. }
  383. .address-content {
  384. display: flex;
  385. align-items: center;
  386. justify-content: space-between;
  387. padding-bottom: 30rpx;
  388. border-bottom: 1rpx solid #dcdcdc;
  389. .l-info {
  390. flex: 1 1 auto;
  391. .l-icon {
  392. flex-shrink: 0;
  393. width: 74rpx;
  394. height: 74rpx;
  395. }
  396. }
  397. .arror {
  398. flex-shrink: 0;
  399. .icon {
  400. width: 24rpx;
  401. height: 24rpx;
  402. }
  403. }
  404. .name {
  405. font-size: 26rpx;
  406. font-family: Microsoft YaHei;
  407. font-weight: 400;
  408. color: #999999;
  409. font-size: 26rpx;
  410. }
  411. .phone {
  412. font-size: 26rpx;
  413. font-family: Microsoft YaHei;
  414. font-weight: 400;
  415. color: #999999;
  416. line-height: 26rpx;
  417. margin-left: 20rpx;
  418. }
  419. .address {
  420. font-size: 32rpx;
  421. font-family: Microsoft YaHei;
  422. font-weight: 400;
  423. color: #333333;
  424. line-height: 32rpx;
  425. width: 86%;
  426. word-break: break-word;
  427. }
  428. }
  429. .address-line {
  430. padding: 20px;
  431. .flex-bettwen {
  432. display: flex;
  433. align-items: center;
  434. justify-content: space-between;
  435. }
  436. .xing {
  437. width: 68rpx;
  438. height: 68rpx;
  439. background: rgba(0, 52, 87, 0.2);
  440. border-radius: 50%;
  441. font-size: 26rpx;
  442. font-weight: 400;
  443. color: #fff;
  444. line-height: 68rpx;
  445. text-align: center;
  446. }
  447. .content {
  448. margin-left: 20px;
  449. .name {
  450. font-size: 30rpx;
  451. font-family: Microsoft YaHei;
  452. font-weight: 500;
  453. color: #333333;
  454. }
  455. .phone {
  456. margin-left: 10rpx;
  457. font-size: 24rpx;
  458. font-family: Microsoft YaHei;
  459. font-weight: 400;
  460. color: #999999;
  461. line-height: 36rpx;
  462. }
  463. .address {
  464. margin-top: 10rpx;
  465. font-size: 26rpx;
  466. font-family: Microsoft YaHei;
  467. font-weight: 400;
  468. color: #333333;
  469. line-height: 36rpx;
  470. }
  471. .picture {
  472. width: 48rpx;
  473. height: 48rpx;
  474. }
  475. .editIcon {
  476. width: 48rpx;
  477. height: 48rpx;
  478. }
  479. }
  480. }
  481. .action {
  482. position: absolute;
  483. bottom: 0rpx;
  484. left: 0;
  485. height: 128rpx;
  486. background-color: #fff;
  487. border-radius: 30rpx 30rpx 0 0;
  488. width: 100vw;
  489. display: flex;
  490. align-items: center;
  491. justify-content: center;
  492. .button {
  493. height: 88rpx;
  494. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  495. border-radius: 40rpx;
  496. font-size: 32rpx;
  497. font-weight: 400;
  498. color: #ffffff;
  499. line-height: 88rpx;
  500. width: 660rpx;
  501. margin: 0 auto;
  502. }
  503. }
  504. .action-bottom {
  505. padding-bottom: 30rpx;
  506. .button {
  507. height: 88rpx;
  508. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  509. border-radius: 40rpx;
  510. font-size: 32rpx;
  511. font-weight: 400;
  512. color: #ffffff;
  513. line-height: 88rpx;
  514. width: 660rpx;
  515. margin: 0 auto;
  516. }
  517. }
  518. :deep(.numberplates .numberplate-bg) {
  519. width: 190rpx;
  520. }
  521. :deep(.numberplates .numberplate) {
  522. margin-right: 0rpx !important;
  523. width: 190rpx;
  524. }
  525. :deep(.numberplates) {
  526. justify-content: space-between;
  527. }
  528. .default {
  529. border: 1rpx solid #00b38b;
  530. border-radius: 5rpx;
  531. padding: 2rpx 4rpx;
  532. color: #00b38b;
  533. margin-left: 4rpx;
  534. }
  535. </style>