Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

essential-information.vue 15KB

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