您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

essential-information.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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 } 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. uni.navigateTo({
  148. url: "/subpackage/orders/addAddress",
  149. });
  150. };
  151. const editAddress = (val) => {
  152. console.log("val", val)
  153. uni.navigateTo({
  154. url: `/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. 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.orderId
  321. console.log(data);
  322. //提交产品信息 接口直接不要了
  323. // productReCodeAction(data.orderId).then((result) => {
  324. // 加购权益产品
  325. // addProductRequest().then((res) => { //接口直接不要了
  326. var vehicleId = state.data.vehiclePlate + "_" + state.data.vehiclePlateColor
  327. console.log("state.data.vehiclePlate", state.data.vehiclePlate, state.data.vehiclePlateColor, vehicleId)
  328. if (state.data.userType == 1) {
  329. uni.navigateTo({
  330. url: `/subpackage/orders/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  331. });
  332. } else {
  333. uni.navigateTo({
  334. url: `/subpackage/orders/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  335. });
  336. }
  337. // })
  338. // })
  339. }
  340. });
  341. }
  342. //按照订单阶段去跳转
  343. const orderGoAction = () => {
  344. var orderParmas = {
  345. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  346. opId: getItem(StorageKeys.OpenId),
  347. source: "WECHAT",
  348. };
  349. const options = {
  350. type: 2,
  351. data: orderParmas,
  352. method: "POST",
  353. showLoading: true,
  354. };
  355. requestNew(orderDetailQuery, options).then((res) => {
  356. const data = res;
  357. console.log(data);
  358. orderStepGoActon(data);
  359. });
  360. };
  361. //订单状态舔砖
  362. const orderStepGoActon = (val : any) => {
  363. console.log("订单状态舔砖", val);
  364. //完成填写基本信息
  365. if (val.orderStep === 1) {
  366. if (state.data.userType === 1 || val.orderStep === 27) {
  367. uni.redirectTo({
  368. url: `/ subpackage / orders / opening - account - people ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  369. });
  370. } else {
  371. uni.redirectTo({
  372. url: `/ subpackage / orders / opening - account - unit ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  373. });
  374. }
  375. } else if (val.orderStep === 2) {
  376. uni.redirectTo({
  377. url: `/ subpackage / orders / car - release ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  378. });
  379. } else if (val.orderStep === 3) {
  380. uni.redirectTo({
  381. url: `/ subpackage / orders / choice - product ? orderId = ${val.orderId} `,
  382. });
  383. } else if (val.orderStep === 4) {
  384. uni.redirectTo({
  385. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  386. });
  387. } else if (val.orderStep === 26) {
  388. uni.redirectTo({
  389. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  390. });
  391. }
  392. };
  393. // 老中台-检测能否提交订单
  394. // const isSubmitOrderRequest = (vehiclePlate, vehiclePlateColor) => {
  395. // const options = {
  396. // type: 2,
  397. // data: {
  398. // vehicleId: vehiclePlate + "_" + vehiclePlateColor
  399. // },
  400. // method: "POST",
  401. // showLoading: true,
  402. // };
  403. // return new Promise(async (resolve, reject) => {
  404. // const res = await request(isSubmitOrderApi, options);
  405. // const data = stringToJson(res.bizContent);
  406. // console.log("111")
  407. // resolve(data);
  408. // }).catch((error) => {
  409. // console.log("222")
  410. // reject(error);
  411. // });
  412. // }
  413. </script>
  414. <style lang="scss" scoped>
  415. .flex {
  416. display: flex;
  417. align-items: center;
  418. }
  419. .content-wrap {
  420. position: absolute;
  421. top: 370rpx;
  422. min-height: calc(100% - 370rpx);
  423. // background-color: #fff;
  424. // padding:20rpx 30rpx 50rpx;
  425. box-sizing: border-box;
  426. border-radius: 12rpx;
  427. padding: 0 30rpx 210rpx;
  428. .title {
  429. font-size: 30rpx;
  430. font-weight: bold;
  431. line-height: 30rpx;
  432. margin-bottom: 30rpx;
  433. font-family: SourceHanSansSC, SourceHanSansSC;
  434. color: #01243A;
  435. }
  436. .car-input {
  437. background-color: #fff;
  438. padding: 40rpx 30rpx;
  439. border-radius: 12rpx;
  440. }
  441. .chepai-lane {
  442. background-color: #fff;
  443. padding: 30rpx;
  444. margin-top: 20rpx;
  445. margin-bottom: 20rpx;
  446. border-radius: 12rpx;
  447. .tips {
  448. font-size: 24rpx;
  449. color: #999999;
  450. margin-left: 20rpx;
  451. font-weight: normal;
  452. }
  453. }
  454. .address-lane {
  455. margin-bottom: 30rpx;
  456. .title {
  457. font-size: 30rpx;
  458. font-weight: bold;
  459. line-height: 30rpx;
  460. margin-bottom: 30rpx;
  461. font-family: SourceHanSansSC, SourceHanSansSC;
  462. color: #01243A;
  463. }
  464. }
  465. }
  466. .address-box {
  467. .add-con {
  468. display: flex;
  469. align-items: center;
  470. justify-content: space-between;
  471. .l-icon {
  472. flex-shrink: 0;
  473. width: 74rpx;
  474. height: 74rpx;
  475. }
  476. .c-con {
  477. box-sizing: border-box;
  478. padding: 0 20rpx;
  479. flex: 1 1 auto;
  480. .add-txt {
  481. font-size: 28rpx;
  482. font-family: SourceHanSansSC, SourceHanSansSC;
  483. font-weight: 500;
  484. color: #111111;
  485. }
  486. .name {
  487. font-size: 24rpx;
  488. font-family: Microsoft YaHei;
  489. font-weight: 400;
  490. color: #999999;
  491. font-size: 24rpx;
  492. }
  493. .phone {
  494. font-size: 24rpx;
  495. font-family: Microsoft YaHei;
  496. font-weight: 400;
  497. color: #999999;
  498. line-height: 24rpx;
  499. margin-left: 20rpx;
  500. }
  501. }
  502. .arror {
  503. flex-shrink: 0;
  504. .icon {
  505. width: 24rpx;
  506. height: 24rpx;
  507. }
  508. }
  509. }
  510. .add-btn {
  511. background: #F8F4E7;
  512. border-radius: 14rpx;
  513. border: 1rpx solid #CCB375;
  514. display: flex;
  515. align-items: center;
  516. justify-content: center;
  517. height: 80rpx;
  518. margin-top: 30rpx;
  519. .l-icon {
  520. width: 34rpx;
  521. height: 34rpx;
  522. }
  523. .txt {
  524. margin-left: 10rpx;
  525. font-family: SourceHanSansSC, SourceHanSansSC;
  526. font-weight: 400;
  527. font-size: 28rpx;
  528. color: #CCB375;
  529. line-height: 34rpx;
  530. }
  531. }
  532. }
  533. .action {
  534. // padding-bottom: 100rpx;
  535. position: absolute;
  536. bottom: 0rpx;
  537. left: 0;
  538. height: 128rpx;
  539. background-color: #fff;
  540. border-radius: 30rpx 30rpx 0 0;
  541. width: 100vw;
  542. display: flex;
  543. align-items: center;
  544. justify-content: center;
  545. .button {
  546. height: 88rpx;
  547. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  548. border-radius: 40rpx;
  549. font-size: 32rpx;
  550. font-weight: 400;
  551. color: #ffffff;
  552. line-height: 88rpx;
  553. width: 660rpx;
  554. margin: 0 auto;
  555. }
  556. }
  557. .action-bottom {
  558. padding-bottom: 30rpx;
  559. .button {
  560. height: 80rpx;
  561. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  562. border-radius: 40rpx;
  563. font-size: 32rpx;
  564. font-weight: 400;
  565. color: #ffffff;
  566. line-height: 80rpx;
  567. }
  568. }
  569. :deep(.numberplates .numberplate-bg) {
  570. width: 190rpx;
  571. }
  572. :deep(.numberplates .numberplate) {
  573. margin-right: 0rpx !important;
  574. width: 190rpx;
  575. }
  576. :deep(.numberplates) {
  577. justify-content: space-between;
  578. }
  579. .default {
  580. border: 1rpx solid #00b38b;
  581. border-radius: 5rpx;
  582. padding: 2rpx 4rpx;
  583. color: #00b38b;
  584. margin-left: 4rpx;
  585. }
  586. .address-line {
  587. padding: 20px;
  588. .flex-bettwen {
  589. display: flex;
  590. align-items: center;
  591. justify-content: space-between;
  592. }
  593. .xing {
  594. width: 68rpx;
  595. height: 68rpx;
  596. background: rgba(0, 52, 87, 0.2);
  597. border-radius: 50%;
  598. font-size: 26rpx;
  599. font-weight: 400;
  600. color: #fff;
  601. line-height: 68rpx;
  602. text-align: center;
  603. }
  604. .content {
  605. margin-left: 20px;
  606. .name {
  607. font-size: 30rpx;
  608. font-family: Microsoft YaHei;
  609. font-weight: 500;
  610. color: #333333;
  611. }
  612. .phone {
  613. margin-left: 10rpx;
  614. font-size: 24rpx;
  615. font-family: Microsoft YaHei;
  616. font-weight: 400;
  617. color: #999999;
  618. line-height: 36rpx;
  619. }
  620. .address {
  621. margin-top: 10rpx;
  622. font-size: 26rpx;
  623. font-family: Microsoft YaHei;
  624. font-weight: 400;
  625. color: #333333;
  626. line-height: 36rpx;
  627. }
  628. .picture {
  629. width: 48rpx;
  630. height: 48rpx;
  631. }
  632. .editIcon {
  633. width: 48rpx;
  634. height: 48rpx;
  635. }
  636. }
  637. }
  638. </style>