Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

essential-information.vue 16KB

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