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

2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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.region" 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.region" 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. isValueCard:'',
  172. });
  173. const globalParam=()=>{
  174. const options = {
  175. type: 2,
  176. data: {
  177. "loginSource":getItem("loginSource")
  178. },
  179. method: "POST",
  180. showLoading: true,
  181. };
  182. request(getGlobalParam, options).then((res) => {
  183. const result = stringToJson(res.bizContent);
  184. console.log("配置",result);
  185. });
  186. }
  187. /* 选择车牌颜色 */
  188. const checkNumberplateColor = (item: any) => {
  189. state.data.vehiclePlateColor = item.id;
  190. };
  191. const goToAddAddress = () => {
  192. uni.navigateTo({
  193. url: "/subpackage/orders/addAddress",
  194. });
  195. };
  196. const editAddress = (val) => {
  197. console.log("val",val)
  198. uni.navigateTo({
  199. url: `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  200. });
  201. };
  202. const carNumber = (val: any) => {
  203. state.data.vehiclePlate = val;
  204. state.data.vehiclePlateNumber = val;
  205. };
  206. const addressSelected = (val: any) => {
  207. console.log("val",val)
  208. state.data = {
  209. ...state.data,
  210. ...val,
  211. };
  212. console.log("state.data.address",state.data.address)
  213. state.show = false;
  214. };
  215. const nextAction = () => {
  216. if (!state.data.vehiclePlate) {
  217. msg("请输入申办车牌");
  218. return;
  219. }
  220. state.data.vehiclePlate = state.data.vehiclePlate.trim();
  221. console.log(state.data.vehiclePlate);
  222. console.log(state.data.vehiclePlate.length);
  223. if (state.data.vehiclePlate.length < 7) {
  224. msg("请输入正确的申办车牌");
  225. return;
  226. }
  227. //1.优先车牌校验 2.在进行订单创建
  228. var vehicleData = {
  229. vehiclePlate: state.data.vehiclePlate,
  230. vehiclePlateColor: state.data.vehiclePlateColor,
  231. };
  232. const options = {
  233. type: 2,
  234. data: vehicleData,
  235. method: "POST",
  236. showLoading: true,
  237. };
  238. request(etcVehiclePlateVer, options).then((res) => {
  239. var data = state.data;
  240. const options = {
  241. type: 2,
  242. data: data,
  243. method: "POST",
  244. showLoading: true,
  245. };
  246. request(etcCreatOrder, options).then((res) => {
  247. console.log(res);
  248. if (res.statusCode === 600) {
  249. orderGoAction();
  250. } else {
  251. const data = stringToJson(res.bizContent);
  252. console.log(data);
  253. //提交产品信息
  254. productReCodeAction(data.orderId).then((result)=>{
  255. console.log(state.data);
  256. console.log(result);
  257. if (state.data.userType == 1) {
  258. uni.navigateTo({
  259. url: `/subpackage/orders/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&type=${state.data.type}`,
  260. });
  261. } else {
  262. uni.navigateTo({
  263. url: `/subpackage/orders/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&type=${state.data.type}`,
  264. });
  265. }
  266. })
  267. }
  268. });
  269. });
  270. };
  271. //按照订单阶段去跳转
  272. const orderGoAction = () => {
  273. var orderParmas = {
  274. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  275. opId: getItem(StorageKeys.OpenId),
  276. source: "WECHAT",
  277. };
  278. const options = {
  279. type: 2,
  280. data: orderParmas,
  281. method: "POST",
  282. showLoading: true,
  283. };
  284. request(searchOrder, options).then((res) => {
  285. const data = stringToJson(res.bizContent);
  286. console.log(data);
  287. orderStepGoActon(data);
  288. });
  289. };
  290. //订单状态舔砖
  291. const orderStepGoActon = (val: any) => {
  292. console.log("订单状态舔砖",val);
  293. //完成填写基本信息
  294. if (val.orderStep === 1) {
  295. if (state.data.userType === 1) {
  296. uni.redirectTo({
  297. url: `/subpackage/orders/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  298. });
  299. } else {
  300. uni.redirectTo({
  301. url: `/subpackage/orders/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  302. });
  303. }
  304. } else if (val.orderStep === 2) {
  305. uni.redirectTo({
  306. url: `/subpackage/orders/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  307. });
  308. } else if (val.orderStep === 3) {
  309. uni.redirectTo({
  310. url: `/subpackage/orders/choice-product?orderId=${val.orderId}`,
  311. });
  312. // if(val.isValueCard==2){
  313. // uni.redirectTo({
  314. // url:`/subpackage/orders/interestsList?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`
  315. // });
  316. // }else{
  317. // uni.redirectTo({
  318. // url: `/subpackage/orders/choice-product?orderId=${val.orderId}`,
  319. // });
  320. // }
  321. }else if (val.orderStep === 4) {
  322. uni.redirectTo({
  323. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  324. });
  325. } else if (val.orderStep === 26 || val.orderStep === 27) {
  326. uni.redirectTo({
  327. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  328. });
  329. }
  330. };
  331. onLoad((option: any) => {
  332. globalParam();
  333. state.data.opId = getItem(StorageKeys.OpenId);
  334. state.data.type = option.type; //客车
  335. state.data.userType = option.userType;
  336. state.data.promoteId = option.promoteId;
  337. state.isValueCard=option.isValueCard
  338. console.log("订单选择推广发行产品接口",option)
  339. uni.getLocation({
  340. type: 'wgs84',
  341. success: function (res) {
  342. state.data.longitude=res.longitude;
  343. state.data.latitude=res.latitude;
  344. console.log("成功回调",res)
  345. uni.request({
  346. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  347. data: {
  348. location: (res.latitude + "," + res.longitude),
  349. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  350. },
  351. success: function(res) {
  352. console.log("成功回调",res)
  353. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  354. // 处理获取到的地址信息
  355. },
  356. fail: function(error) {
  357. // 请求失败的处理
  358. }
  359. });
  360. }
  361. });
  362. });
  363. //监听页面滚动
  364. onPageScroll((e) => {
  365. scrollTop.value = e.scrollTop;
  366. });
  367. onShow((option) => {
  368. var data = {
  369. openId: getItem(StorageKeys.OpenId),
  370. };
  371. if (getItem(StorageKeys.OpenId)) {
  372. const options = {
  373. type: 2,
  374. data: data,
  375. method: "POST",
  376. showLoading: true,
  377. };
  378. request(addressQuery, options).then((res) => {
  379. const data = stringToJson(res.bizContent);
  380. console.log("111",data);
  381. state.addressArray = data.data ?data.data: [];
  382. });
  383. }
  384. uni.$on('updateData',function(data){
  385. var arr=[];
  386. arr.push(data)
  387. state.addressArray=arr
  388. console.log("dizhi",arr)
  389. })
  390. // 删除地址
  391. if(option){
  392. if(option.del==1){
  393. state.addressArray=[];
  394. }
  395. }
  396. });
  397. onUnload(()=>{
  398. uni.$off('updateData');
  399. })
  400. const productReCodeAction = (orderId) => {
  401. // var data = {
  402. // productId: state.data.productId,
  403. // orderId: orderId,
  404. // };
  405. var data = {
  406. promoteId: state.data.promoteId,
  407. orderId: orderId,
  408. isValueCard:state.isValueCard
  409. };
  410. const options = {
  411. type: 2,
  412. data: data,
  413. method: "POST",
  414. showLoading: true,
  415. };
  416. return new Promise(async (resolve, reject) => {
  417. const res = await request(productReCode, options);
  418. const data = stringToJson(res.bizContent);
  419. console.log("111")
  420. resolve(data);
  421. }).catch((error) => {
  422. console.log("222")
  423. reject(error);
  424. });
  425. };
  426. </script>
  427. <style lang="scss" scoped>
  428. .flex {
  429. display: flex;
  430. align-items: center;
  431. }
  432. .content-wrap {
  433. position: relative;
  434. margin-top: -50rpx;
  435. padding: 0rpx 30rpx;
  436. .title {
  437. font-size: 30rpx;
  438. font-family: Noto Sans S Chinese;
  439. font-weight: 400;
  440. color: #000000;
  441. line-height: 30rpx;
  442. margin-bottom: 30rpx;
  443. }
  444. .car-input {
  445. }
  446. .chepai-lane {
  447. margin-top: 60rpx;
  448. margin-bottom: 20rpx;
  449. }
  450. .address-lane {
  451. margin-bottom: 30rpx;
  452. .title {
  453. font-size: 30rpx;
  454. font-weight: 400;
  455. color: #000000;
  456. line-height: 30rpx;
  457. }
  458. }
  459. }
  460. .address-content {
  461. display: flex;
  462. align-items: center;
  463. justify-content: space-between;
  464. padding-bottom: 30rpx;
  465. border-bottom: 1rpx solid #dcdcdc;
  466. .name {
  467. font-size: 26rpx;
  468. font-family: Microsoft YaHei;
  469. font-weight: 400;
  470. color: #999999;
  471. font-size: 26rpx;
  472. }
  473. .phone {
  474. font-size: 26rpx;
  475. font-family: Microsoft YaHei;
  476. font-weight: 400;
  477. color: #999999;
  478. line-height: 26rpx;
  479. margin-left: 20rpx;
  480. }
  481. .arror .icon {
  482. width: 36rpx;
  483. height: 36rpx;
  484. }
  485. .address {
  486. font-size: 32rpx;
  487. font-family: Microsoft YaHei;
  488. font-weight: 400;
  489. color: #333333;
  490. line-height: 32rpx;
  491. }
  492. }
  493. .address-line {
  494. padding: 20px;
  495. .flex-bettwen {
  496. display: flex;
  497. align-items: center;
  498. justify-content: space-between;
  499. }
  500. .xing {
  501. width: 68rpx;
  502. height: 68rpx;
  503. background: rgba(0, 179, 139, 0.2);
  504. border-radius: 50%;
  505. font-size: 26rpx;
  506. font-weight: 400;
  507. color: #00b38b;
  508. line-height: 68rpx;
  509. text-align: center;
  510. }
  511. .content {
  512. margin-left: 20px;
  513. .name {
  514. font-size: 30rpx;
  515. font-family: Microsoft YaHei;
  516. font-weight: 500;
  517. color: #333333;
  518. }
  519. .phone {
  520. margin-left: 10rpx;
  521. font-size: 24rpx;
  522. font-family: Microsoft YaHei;
  523. font-weight: 400;
  524. color: #999999;
  525. line-height: 36rpx;
  526. }
  527. .address {
  528. margin-top: 10rpx;
  529. font-size: 26rpx;
  530. font-family: Microsoft YaHei;
  531. font-weight: 400;
  532. color: #333333;
  533. line-height: 36rpx;
  534. }
  535. .picture {
  536. width: 48rpx;
  537. height: 48rpx;
  538. }
  539. .editIcon {
  540. width: 48rpx;
  541. height: 48rpx;
  542. }
  543. }
  544. }
  545. .action {
  546. padding-bottom: 100rpx;
  547. .button {
  548. height: 80rpx;
  549. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  550. border-radius: 40rpx;
  551. font-size: 32rpx;
  552. font-weight: 400;
  553. color: #ffffff;
  554. line-height: 80rpx;
  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. </style>