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.

essential-information.vue 16KB

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