Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

essential-information.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  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. nextActionRequest()
  180. // noticeUser(() => {
  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. } else {
  217. msg(res.info);
  218. }
  219. });
  220. }
  221. onLoad((option : any) => {
  222. state.data.vanType = option.vanType; //1客车 2货车
  223. state.data.opId = getItem(StorageKeys.OpenId);
  224. state.data.userType = option.userType;
  225. state.data.productId = option.productId;
  226. state.isValueCard = option.isValueCard
  227. state.data.cardType = option.cardType
  228. state.totalAmount = option.totalAmount;
  229. state.equityId = option.equityId;
  230. console.log("订单选择推广发行产品接口", option)
  231. uni.getLocation({
  232. type: 'wgs84',
  233. success: function (res) {
  234. state.data.longitude = res.longitude;
  235. state.data.latitude = res.latitude;
  236. console.log("成功回调", res)
  237. uni.request({
  238. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  239. data: {
  240. location: (res.latitude + "," + res.longitude),
  241. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  242. },
  243. success: function (res) {
  244. console.log("成功回调", res)
  245. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  246. // 处理获取到的地址信息
  247. },
  248. fail: function (error) {
  249. // 请求失败的处理
  250. }
  251. });
  252. }
  253. });
  254. });
  255. //监听页面滚动
  256. onPageScroll((e) => {
  257. scrollTop.value = e.scrollTop;
  258. });
  259. onShow((option) => {
  260. let opid = getItem(StorageKeys.OpenId)
  261. if (opid) {
  262. var data = {
  263. openId: opid,
  264. };
  265. getAddressArray(data)
  266. }
  267. uni.$on('updateData', function (data) {
  268. var arr = [];
  269. arr.push(data)
  270. state.addressArray = arr
  271. console.log("dizhi", arr)
  272. })
  273. // 删除地址
  274. if (option) {
  275. if (option.del == 1) {
  276. state.addressArray = [];
  277. }
  278. }
  279. });
  280. onUnload(() => {
  281. uni.$off('updateData');
  282. })
  283. const getAddressArray = (data) => {
  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. let addKey = false //表示未添加
  305. const nextAddress = () => {
  306. var data = state.data;
  307. // #ifdef MP-ALIPAY
  308. data.orderSource = 'ALI'
  309. // #endif
  310. const options = {
  311. type: 2,
  312. data: data,
  313. method: "POST",
  314. showLoading: true,
  315. };
  316. requestNew(orderAdd, options).then((res) => {
  317. console.log("res===", res);
  318. if (res.statusCode === 600) {
  319. orderGoAction();
  320. } else {
  321. const data = res.orderNo;
  322. state.orderId = data
  323. console.log(data);
  324. addKey = true
  325. var vehicleId = state.data.vehiclePlate + "_" + state.data.vehiclePlateColor
  326. console.log("state.data.vehiclePlate", state.data.vehiclePlate, state.data.vehiclePlateColor, vehicleId)
  327. if (state.data.userType == 1) {
  328. navTo(
  329. `/subpackage/orders/opening-account-people?orderId=${data}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  330. );
  331. } else {
  332. navTo(
  333. `/subpackage/orders/opening-account-unit?orderId=${data}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  334. );
  335. }
  336. }
  337. });
  338. }
  339. //按照订单阶段去跳转
  340. const orderGoAction = () => {
  341. var orderParmas = {
  342. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  343. opId: getItem(StorageKeys.OpenId),
  344. source: "WECHAT",
  345. };
  346. const options = {
  347. type: 2,
  348. data: orderParmas,
  349. method: "POST",
  350. showLoading: true,
  351. };
  352. requestNew(orderDetailQuery, options).then((res) => {
  353. const data = res;
  354. console.log(data);
  355. orderStepGoActon(data);
  356. });
  357. };
  358. //订单状态舔砖
  359. const orderStepGoActon = (val : any) => {
  360. console.log("订单状态舔砖", val);
  361. //完成填写基本信息
  362. if (val.orderStep === 1) {
  363. if (state.data.userType === 1 || val.orderStep === 27) {
  364. uni.redirectTo({
  365. url: `/ subpackage / orders / opening - account - people ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  366. });
  367. } else {
  368. uni.redirectTo({
  369. url: `/ subpackage / orders / opening - account - unit ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  370. });
  371. }
  372. } else if (val.orderStep === 2) {
  373. uni.redirectTo({
  374. url: `/ subpackage / orders / car - release ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  375. });
  376. } else if (val.orderStep === 3) {
  377. uni.redirectTo({
  378. url: `/ subpackage / orders / choice - product ? orderId = ${val.orderId} `,
  379. });
  380. } else if (val.orderStep === 4) {
  381. uni.redirectTo({
  382. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  383. });
  384. } else if (val.orderStep === 26) {
  385. uni.redirectTo({
  386. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  387. });
  388. }
  389. };
  390. </script>
  391. <style lang="scss" scoped>
  392. .flex {
  393. display: flex;
  394. align-items: center;
  395. }
  396. .content-wrap {
  397. position: absolute;
  398. top: 370rpx;
  399. min-height: calc(100% - 370rpx);
  400. width: 100%;
  401. box-sizing: border-box;
  402. border-radius: 12rpx;
  403. padding: 0 30rpx 30rpx 30rpx;
  404. .title {
  405. font-size: 30rpx;
  406. font-weight: bold;
  407. line-height: 30rpx;
  408. margin-bottom: 30rpx;
  409. font-family: SourceHanSansSC, SourceHanSansSC;
  410. color: #01243A;
  411. }
  412. .car-input {
  413. background-color: #fff;
  414. padding: 40rpx 30rpx;
  415. border-radius: 12rpx;
  416. }
  417. .chepai-lane {
  418. background-color: #fff;
  419. padding: 30rpx;
  420. margin-top: 20rpx;
  421. margin-bottom: 20rpx;
  422. border-radius: 12rpx;
  423. .tips {
  424. font-size: 24rpx;
  425. color: #999999;
  426. margin-left: 20rpx;
  427. font-weight: normal;
  428. }
  429. }
  430. .address-lane {
  431. margin-bottom: 30rpx;
  432. .title {
  433. font-size: 30rpx;
  434. font-weight: bold;
  435. line-height: 30rpx;
  436. margin-bottom: 30rpx;
  437. font-family: SourceHanSansSC, SourceHanSansSC;
  438. color: #01243A;
  439. }
  440. }
  441. }
  442. .address-box {
  443. .add-con {
  444. display: flex;
  445. align-items: center;
  446. justify-content: space-between;
  447. .l-icon {
  448. flex-shrink: 0;
  449. width: 74rpx;
  450. height: 74rpx;
  451. }
  452. .c-con {
  453. box-sizing: border-box;
  454. padding: 0 20rpx;
  455. flex: 1 1 auto;
  456. .add-txt {
  457. font-size: 28rpx;
  458. font-family: SourceHanSansSC, SourceHanSansSC;
  459. font-weight: 500;
  460. color: #111111;
  461. }
  462. .name {
  463. font-size: 24rpx;
  464. font-family: Microsoft YaHei;
  465. font-weight: 400;
  466. color: #999999;
  467. font-size: 24rpx;
  468. }
  469. .phone {
  470. font-size: 24rpx;
  471. font-family: Microsoft YaHei;
  472. font-weight: 400;
  473. color: #999999;
  474. line-height: 24rpx;
  475. margin-left: 20rpx;
  476. }
  477. }
  478. .arror {
  479. flex-shrink: 0;
  480. .icon {
  481. width: 24rpx;
  482. height: 24rpx;
  483. }
  484. }
  485. }
  486. .add-btn {
  487. background: #F8F4E7;
  488. border-radius: 14rpx;
  489. border: 1rpx solid #CCB375;
  490. display: flex;
  491. align-items: center;
  492. justify-content: center;
  493. height: 80rpx;
  494. margin-top: 30rpx;
  495. .l-icon {
  496. width: 34rpx;
  497. height: 34rpx;
  498. }
  499. .txt {
  500. margin-left: 10rpx;
  501. font-family: SourceHanSansSC, SourceHanSansSC;
  502. font-weight: 400;
  503. font-size: 28rpx;
  504. color: #CCB375;
  505. line-height: 34rpx;
  506. }
  507. }
  508. }
  509. .action {
  510. // padding-bottom: 100rpx;
  511. position: absolute;
  512. bottom: 0rpx;
  513. left: 0;
  514. height: 128rpx;
  515. background-color: #fff;
  516. border-radius: 30rpx 30rpx 0 0;
  517. width: 100vw;
  518. display: flex;
  519. align-items: center;
  520. justify-content: center;
  521. .button {
  522. height: 88rpx;
  523. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  524. border-radius: 40rpx;
  525. font-size: 32rpx;
  526. font-weight: 400;
  527. color: #ffffff;
  528. line-height: 88rpx;
  529. width: 660rpx;
  530. margin: 0 auto;
  531. }
  532. }
  533. .action-bottom {
  534. padding-bottom: 30rpx;
  535. .button {
  536. height: 80rpx;
  537. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  538. border-radius: 40rpx;
  539. font-size: 32rpx;
  540. font-weight: 400;
  541. color: #ffffff;
  542. line-height: 80rpx;
  543. }
  544. }
  545. :deep(.numberplates .numberplate-bg) {
  546. width: 190rpx;
  547. }
  548. :deep(.numberplates .numberplate) {
  549. margin-right: 0rpx !important;
  550. width: 190rpx;
  551. }
  552. :deep(.numberplates) {
  553. justify-content: space-between;
  554. }
  555. .default {
  556. border: 1rpx solid #00b38b;
  557. border-radius: 5rpx;
  558. padding: 2rpx 4rpx;
  559. color: #00b38b;
  560. margin-left: 4rpx;
  561. }
  562. .address-line {
  563. padding: 20px;
  564. .flex-bettwen {
  565. display: flex;
  566. align-items: center;
  567. justify-content: space-between;
  568. }
  569. .xing {
  570. width: 68rpx;
  571. height: 68rpx;
  572. background: rgba(0, 52, 87, 0.2);
  573. border-radius: 50%;
  574. font-size: 26rpx;
  575. font-weight: 400;
  576. color: #fff;
  577. line-height: 68rpx;
  578. text-align: center;
  579. }
  580. .content {
  581. margin-left: 20px;
  582. .name {
  583. font-size: 30rpx;
  584. font-family: Microsoft YaHei;
  585. font-weight: 500;
  586. color: #333333;
  587. }
  588. .phone {
  589. margin-left: 10rpx;
  590. font-size: 24rpx;
  591. font-family: Microsoft YaHei;
  592. font-weight: 400;
  593. color: #999999;
  594. line-height: 36rpx;
  595. }
  596. .address {
  597. margin-top: 10rpx;
  598. font-size: 26rpx;
  599. font-family: Microsoft YaHei;
  600. font-weight: 400;
  601. color: #333333;
  602. line-height: 36rpx;
  603. }
  604. .picture {
  605. width: 48rpx;
  606. height: 48rpx;
  607. }
  608. .editIcon {
  609. width: 48rpx;
  610. height: 48rpx;
  611. }
  612. }
  613. }
  614. </style>