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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. <template>
  2. <navBar title="九州ETC" :scrollTop="scrollTop"></navBar>
  3. <navBgCar></navBgCar>
  4. <view class="content-wrap">
  5. <!-- 车牌输入 -->
  6. <view class="car-input">
  7. <view class="title">请输入申办车牌</view>
  8. <car-number-input @numberInputResult="carNumber"></car-number-input>
  9. </view>
  10. <!-- 车牌颜色 -->
  11. <view class="chepai-lane">
  12. <view class="title">选择车牌颜色</view>
  13. <numberplate-color
  14. :numberplate="state.data.vehiclePlateNumber"
  15. :numberplateCor="{ id: 0 }"
  16. :type="state.data.type"
  17. @numberplateResult="checkNumberplateColor"
  18. >
  19. </numberplate-color>
  20. </view>
  21. <block >
  22. <!-- 收货地址 -->
  23. <view v-if="!state.data.address" class="address-lane">
  24. <view class="title">请选择或新增收货地址</view>
  25. <view style="margin-top: 30rpx" class="action">
  26. <button type="default" class="button" @click="state.show = true">
  27. 添加收货地址
  28. </button>
  29. </view>
  30. </view>
  31. <view v-if="state.data.address" class="address-lane">
  32. <view class="title">收货地址</view>
  33. <view
  34. @click="state.show = true"
  35. class="address-content"
  36. style="margin-top: 30rpx"
  37. >
  38. <view class="flex">
  39. <image
  40. :showLoading="true"
  41. :src="`${$imgUrl}applyCard/location.png`"
  42. style="width: 48rpx; height: 48rpx"
  43. >
  44. </image>
  45. <view style="margin-left: 18rpx" class="">
  46. <view class="address">
  47. {{ state.data.region + state.data.address }}
  48. </view>
  49. <view style="margin-top: 15rpx" class="flex">
  50. <view class="name">
  51. {{ state.data.consignee }}
  52. </view>
  53. <view class="phone">
  54. {{ state.data.consigneeTel }}
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="arror">
  60. <image
  61. :src="`${$imgUrl}common/arror-right.png`"
  62. class="icon"
  63. ></image>
  64. </view>
  65. </view>
  66. <view style="margin-top: 30rpx" class="action">
  67. <button type="default" class="button" @click="nextAction()">
  68. 下一步
  69. </button>
  70. </view>
  71. </view>
  72. </block>
  73. <!-- <block v-else>
  74. <view class="address-lane">
  75. <view style="margin-top: 30rpx" class="action">
  76. <button type="default" class="button" @click="nextAction()">
  77. 下一步
  78. </button>
  79. </view>
  80. </view>
  81. </block> -->
  82. </view>
  83. <!-- 地址弹窗 -->
  84. <u-popup mode="bottom" v-model="state.show">
  85. <view class="address-line">
  86. <view
  87. v-if="state.addressArray"
  88. v-for="(item, index) in state.addressArray"
  89. :key="index"
  90. @click="addressSelected(item)"
  91. style="margin-bottom: 60rpx"
  92. class="flex-bettwen"
  93. >
  94. <view class="flex">
  95. <view class="xing">
  96. {{ item.consignee.charAt(0) }}
  97. </view>
  98. <view class="content">
  99. <view class="flex">
  100. <view class="name">
  101. {{ item.consignee }}
  102. </view>
  103. <view class="phone">
  104. {{ item.consigneeTel }}
  105. </view>
  106. </view>
  107. <view class="address">
  108. {{ item.region + item.address }}
  109. </view>
  110. </view>
  111. </view>
  112. <view
  113. @click.stop="editAddress(item)"
  114. style="margin-left: 80rpx"
  115. class="picture"
  116. >
  117. <image
  118. :showLoading="true"
  119. :src="`${$imgUrl}applyCard/edit.png`"
  120. style="width: 48rpx; height: 48rpx"
  121. ></image>
  122. </view>
  123. </view>
  124. <view
  125. :style="state.addressArray ? 'margin-top: 60rpx;' : ''"
  126. class="action-bottom"
  127. >
  128. <button type="default" class="button" @click="goToAddAddress()">
  129. 添加收货地址
  130. </button>
  131. </view>
  132. </view>
  133. </u-popup>
  134. </template>
  135. <script setup lang="ts">
  136. /*导航*/
  137. import navBgCar from "./components/nav-bg-car2";
  138. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  139. import numberplateColor from "./components/layout-numberplate-color";
  140. import { getItem, StorageKeys } from "@/utils/storage";
  141. import { stringToJson } from "@/utils/network/encryption";
  142. import navBar from "@/components/nav-bar/nav-bar2.vue";
  143. import { onLoad, onShow, onPageScroll,onUnload } from "@dcloudio/uni-app";
  144. import {
  145. addressQuery,
  146. etcCreatOrder,
  147. etcVehiclePlateVer,
  148. searchOrder,
  149. productReCode,
  150. } from "@/utils/network/api.js";
  151. import { request } from "@/utils/network/request.js";
  152. import { reactive, ref } from "vue";
  153. import { msg } from "@/utils/utils";
  154. // import amap from "../../lib/amap-wx.130.js";//引入高德地图小程序插件
  155. const scrollTop = ref(0);
  156. const state = reactive({
  157. data: {
  158. vehiclePlate: undefined, //车牌号
  159. vehiclePlateNumber: "", //车牌号
  160. vehiclePlateColor: 0, //车盘颜色
  161. type: "0", //车牌类型
  162. userType: 1,
  163. whetherToMail: getItem(StorageKeys.OpenId) ? 0 : "", //是否需要邮寄 小程序默认邮寄 0邮寄||1不邮寄 不登录为1
  164. orderSource: "WECHAT",
  165. opId: "",
  166. consignee: "", //收货人
  167. consigneeTel: "", //收货电话
  168. region: "",
  169. address: "",
  170. postalCode: "",
  171. promoteId:"",
  172. longitude:"",
  173. latitude:"",
  174. detailedAddress:'', //通过经纬度转的地址
  175. },
  176. show: false,
  177. addressArray: [],
  178. isSign:''
  179. });
  180. /* 选择车牌颜色 */
  181. const checkNumberplateColor = (item: any) => {
  182. state.data.vehiclePlateColor = item.id;
  183. };
  184. const goToAddAddress = () => {
  185. uni.navigateTo({
  186. url: "/subpackage/applyCard/addAddress",
  187. });
  188. };
  189. const editAddress = (val) => {
  190. uni.navigateTo({
  191. url: `/subpackage/applyCard/editAddress?content=` + JSON.stringify(val),
  192. });
  193. };
  194. const carNumber = (val: any) => {
  195. state.data.vehiclePlate = val;
  196. state.data.vehiclePlateNumber = val;
  197. };
  198. const addressSelected = (val: any) => {
  199. state.data = {
  200. ...state.data,
  201. ...val,
  202. };
  203. state.show = false;
  204. };
  205. const nextAction = () => {
  206. if (!state.data.vehiclePlate) {
  207. msg("请输入申办车牌");
  208. return;
  209. }
  210. state.data.vehiclePlate = state.data.vehiclePlate.trim();
  211. console.log(state.data.vehiclePlate);
  212. console.log(state.data.vehiclePlate.length);
  213. if (state.data.vehiclePlate.length < 7) {
  214. msg("请输入正确的申办车牌");
  215. return;
  216. }
  217. //1.优先车牌校验 2.在进行订单创建
  218. var vehicleData = {
  219. vehiclePlate: state.data.vehiclePlate,
  220. vehiclePlateColor: state.data.vehiclePlateColor,
  221. };
  222. const options = {
  223. type: 2,
  224. data: vehicleData,
  225. method: "POST",
  226. showLoading: true,
  227. };
  228. request(etcVehiclePlateVer, options).then((res) => {
  229. var data = state.data;
  230. const options = {
  231. type: 2,
  232. data: data,
  233. method: "POST",
  234. showLoading: true,
  235. };
  236. request(etcCreatOrder, options).then((res) => {
  237. console.log(res);
  238. if (res.statusCode === 600) {
  239. orderGoAction();
  240. } else {
  241. const data = stringToJson(res.bizContent);
  242. console.log(data);
  243. //提交产品信息
  244. productReCodeAction(data.orderId).then((result)=>{
  245. console.log(state.data);
  246. console.log(result);
  247. if (state.data.userType == 1) {
  248. uni.navigateTo({
  249. url: `/subpackage/applyCard/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isSign}`,
  250. });
  251. } else {
  252. uni.navigateTo({
  253. url: `/subpackage/applyCard/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isSign}`,
  254. });
  255. }
  256. })
  257. // uni.navigateTo({
  258. // url: `/subpackage/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  259. // })
  260. // uni.redirectTo({
  261. // url: `/subpackage/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  262. // });
  263. }
  264. });
  265. });
  266. };
  267. //按照订单阶段去跳转
  268. const orderGoAction = () => {
  269. var orderParmas = {
  270. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  271. opId: getItem(StorageKeys.OpenId),
  272. source: "WECHAT",
  273. };
  274. const options = {
  275. type: 2,
  276. data: orderParmas,
  277. method: "POST",
  278. showLoading: true,
  279. };
  280. request(searchOrder, options).then((res) => {
  281. const data = stringToJson(res.bizContent);
  282. console.log(data);
  283. orderStepGoActon(data);
  284. });
  285. };
  286. //订单状态舔砖
  287. const orderStepGoActon = (val: any) => {
  288. console.log(val);
  289. //完成填写基本信息
  290. if (val.orderStep === 1) {
  291. if (state.data.userType === 1) {
  292. uni.redirectTo({
  293. url: `/subpackage/applyCard/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  294. });
  295. } else {
  296. uni.redirectTo({
  297. url: `/subpackage/applyCard/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  298. });
  299. }
  300. } else if (val.orderStep === 2) {
  301. uni.redirectTo({
  302. url: `/subpackage/applyCard/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  303. });
  304. } else if (val.orderStep === 3) {
  305. uni.redirectTo({
  306. url: `/subpackage/applyCard/choice-product?orderId=${val.orderId}`,
  307. });
  308. }else if (val.orderStep === 4) {
  309. uni.redirectTo({
  310. url: `/subpackage/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  311. });
  312. } else if (val.orderStep === 26 || val.orderStep === 27) {
  313. uni.redirectTo({
  314. url: `/subpackage/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  315. });
  316. }
  317. };
  318. onLoad((option: any) => {
  319. state.data.opId = getItem(StorageKeys.OpenId);
  320. state.data.type = option.type; //客车
  321. state.data.userType = option.userType;
  322. state.data.promoteId = option.promoteId;
  323. state.isSign=option.isSign
  324. console.log("订单选择推广发行产品接口",option)
  325. uni.getLocation({
  326. type: 'wgs84',
  327. success: function (res) {
  328. state.data.longitude=res.longitude;
  329. state.data.latitude=res.latitude;
  330. console.log("成功回调",res)
  331. uni.request({
  332. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  333. data: {
  334. location: (res.latitude + "," + res.longitude),
  335. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  336. },
  337. success: function(res) {
  338. console.log("成功回调",res)
  339. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  340. // 处理获取到的地址信息
  341. },
  342. fail: function(error) {
  343. // 请求失败的处理
  344. }
  345. });
  346. }
  347. });
  348. });
  349. //监听页面滚动
  350. onPageScroll((e) => {
  351. scrollTop.value = e.scrollTop;
  352. });
  353. onShow((option) => {
  354. var data = {
  355. openId: getItem(StorageKeys.OpenId),
  356. };
  357. if (getItem(StorageKeys.OpenId)) {
  358. const options = {
  359. type: 2,
  360. data: data,
  361. method: "POST",
  362. showLoading: true,
  363. };
  364. request(addressQuery, options).then((res) => {
  365. const data = stringToJson(res.bizContent);
  366. console.log("111",data);
  367. state.addressArray = data.data ?? [];
  368. });
  369. }
  370. uni.$on('updateData',function(data){
  371. var arr=[];
  372. arr.push(data)
  373. state.addressArray=arr
  374. console.log("dizhi",arr)
  375. })
  376. // 删除地址
  377. if(option){
  378. if(option.del==1){
  379. state.addressArray=[];
  380. }
  381. }
  382. });
  383. onUnload(()=>{
  384. uni.$off('updateData');
  385. })
  386. const productReCodeAction = (orderId) => {
  387. // var data = {
  388. // productId: state.data.productId,
  389. // orderId: orderId,
  390. // };
  391. var data = {
  392. promoteId: state.data.promoteId,
  393. orderId: orderId,
  394. };
  395. const options = {
  396. type: 2,
  397. data: data,
  398. method: "POST",
  399. showLoading: true,
  400. };
  401. return new Promise(async (resolve, reject) => {
  402. const res = await request(productReCode, options);
  403. const data = stringToJson(res.bizContent);
  404. console.log("111")
  405. resolve(data);
  406. }).catch((error) => {
  407. console.log("222")
  408. reject(error);
  409. });
  410. };
  411. </script>
  412. <style lang="scss" scoped>
  413. .flex {
  414. display: flex;
  415. align-items: center;
  416. }
  417. .content-wrap {
  418. position: relative;
  419. margin-top: -50rpx;
  420. padding: 0rpx 30rpx;
  421. .title {
  422. font-size: 30rpx;
  423. font-family: Noto Sans S Chinese;
  424. font-weight: 400;
  425. color: #000000;
  426. line-height: 30rpx;
  427. margin-bottom: 30rpx;
  428. }
  429. .car-input {
  430. }
  431. .chepai-lane {
  432. margin-top: 60rpx;
  433. margin-bottom: 20rpx;
  434. }
  435. .address-lane {
  436. margin-bottom: 30rpx;
  437. .title {
  438. font-size: 30rpx;
  439. font-weight: 400;
  440. color: #000000;
  441. line-height: 30rpx;
  442. }
  443. }
  444. }
  445. .address-content {
  446. display: flex;
  447. align-items: center;
  448. justify-content: space-between;
  449. padding-bottom: 30rpx;
  450. border-bottom: 1rpx solid #dcdcdc;
  451. .name {
  452. font-size: 26rpx;
  453. font-family: Microsoft YaHei;
  454. font-weight: 400;
  455. color: #999999;
  456. font-size: 26rpx;
  457. }
  458. .phone {
  459. font-size: 26rpx;
  460. font-family: Microsoft YaHei;
  461. font-weight: 400;
  462. color: #999999;
  463. line-height: 26rpx;
  464. margin-left: 20rpx;
  465. }
  466. .arror .icon {
  467. width: 36rpx;
  468. height: 36rpx;
  469. }
  470. .address {
  471. font-size: 32rpx;
  472. font-family: Microsoft YaHei;
  473. font-weight: 400;
  474. color: #333333;
  475. line-height: 32rpx;
  476. }
  477. }
  478. .address-line {
  479. padding: 20px;
  480. .flex-bettwen {
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-between;
  484. }
  485. .xing {
  486. width: 68rpx;
  487. height: 68rpx;
  488. background: rgba(0, 179, 139, 0.2);
  489. border-radius: 50%;
  490. font-size: 26rpx;
  491. font-weight: 400;
  492. color: #00b38b;
  493. line-height: 68rpx;
  494. text-align: center;
  495. }
  496. .content {
  497. margin-left: 20px;
  498. .name {
  499. font-size: 30rpx;
  500. font-family: Microsoft YaHei;
  501. font-weight: 500;
  502. color: #333333;
  503. }
  504. .phone {
  505. margin-left: 10rpx;
  506. font-size: 24rpx;
  507. font-family: Microsoft YaHei;
  508. font-weight: 400;
  509. color: #999999;
  510. line-height: 36rpx;
  511. }
  512. .address {
  513. margin-top: 10rpx;
  514. font-size: 26rpx;
  515. font-family: Microsoft YaHei;
  516. font-weight: 400;
  517. color: #333333;
  518. line-height: 36rpx;
  519. }
  520. .picture {
  521. width: 48rpx;
  522. height: 48rpx;
  523. }
  524. .editIcon {
  525. width: 48rpx;
  526. height: 48rpx;
  527. }
  528. }
  529. }
  530. .action {
  531. padding-bottom: 100rpx;
  532. .button {
  533. height: 80rpx;
  534. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  535. border-radius: 40rpx;
  536. font-size: 32rpx;
  537. font-weight: 400;
  538. color: #ffffff;
  539. line-height: 80rpx;
  540. }
  541. }
  542. .action-bottom {
  543. padding-bottom: 30rpx;
  544. .button {
  545. height: 80rpx;
  546. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  547. border-radius: 40rpx;
  548. font-size: 32rpx;
  549. font-weight: 400;
  550. color: #ffffff;
  551. line-height: 80rpx;
  552. }
  553. }
  554. :deep(.numberplates .numberplate-bg) {
  555. width: 190rpx;
  556. }
  557. :deep(.numberplates .numberplate){
  558. margin-right: 0rpx !important;
  559. width: 190rpx;
  560. }
  561. :deep(.numberplates){
  562. justify-content: space-between;
  563. }
  564. </style>