Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

essential-information.vue 16KB

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