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 17KB

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