Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

essential-information.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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. }else if (val.orderStep === 4) {
  313. uni.redirectTo({
  314. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  315. });
  316. } else if (val.orderStep === 26 || val.orderStep === 27) {
  317. uni.redirectTo({
  318. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  319. });
  320. }
  321. };
  322. onLoad((option: any) => {
  323. globalParam();
  324. state.data.opId = getItem(StorageKeys.OpenId);
  325. state.data.type = option.type; //客车
  326. state.data.userType = option.userType;
  327. state.data.promoteId = option.promoteId;
  328. state.isValueCard=option.isValueCard
  329. console.log("订单选择推广发行产品接口",option)
  330. uni.getLocation({
  331. type: 'wgs84',
  332. success: function (res) {
  333. state.data.longitude=res.longitude;
  334. state.data.latitude=res.latitude;
  335. console.log("成功回调",res)
  336. uni.request({
  337. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  338. data: {
  339. location: (res.latitude + "," + res.longitude),
  340. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  341. },
  342. success: function(res) {
  343. console.log("成功回调",res)
  344. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  345. // 处理获取到的地址信息
  346. },
  347. fail: function(error) {
  348. // 请求失败的处理
  349. }
  350. });
  351. }
  352. });
  353. });
  354. //监听页面滚动
  355. onPageScroll((e) => {
  356. scrollTop.value = e.scrollTop;
  357. });
  358. onShow((option) => {
  359. var data = {
  360. openId: getItem(StorageKeys.OpenId),
  361. };
  362. if (getItem(StorageKeys.OpenId)) {
  363. const options = {
  364. type: 2,
  365. data: data,
  366. method: "POST",
  367. showLoading: true,
  368. };
  369. request(addressQuery, options).then((res) => {
  370. const data = stringToJson(res.bizContent);
  371. console.log("111",data);
  372. state.addressArray = data.data ?data.data: [];
  373. });
  374. }
  375. uni.$on('updateData',function(data){
  376. var arr=[];
  377. arr.push(data)
  378. state.addressArray=arr
  379. console.log("dizhi",arr)
  380. })
  381. // 删除地址
  382. if(option){
  383. if(option.del==1){
  384. state.addressArray=[];
  385. }
  386. }
  387. });
  388. onUnload(()=>{
  389. uni.$off('updateData');
  390. })
  391. const productReCodeAction = (orderId) => {
  392. // var data = {
  393. // productId: state.data.productId,
  394. // orderId: orderId,
  395. // };
  396. var data = {
  397. promoteId: state.data.promoteId,
  398. orderId: orderId,
  399. isValueCard:state.isValueCard
  400. };
  401. const options = {
  402. type: 2,
  403. data: data,
  404. method: "POST",
  405. showLoading: true,
  406. };
  407. return new Promise(async (resolve, reject) => {
  408. const res = await request(productReCode, options);
  409. const data = stringToJson(res.bizContent);
  410. console.log("111")
  411. resolve(data);
  412. }).catch((error) => {
  413. console.log("222")
  414. reject(error);
  415. });
  416. };
  417. </script>
  418. <style lang="scss" scoped>
  419. .flex {
  420. display: flex;
  421. align-items: center;
  422. }
  423. .content-wrap {
  424. position: relative;
  425. margin-top: -50rpx;
  426. padding: 0rpx 30rpx;
  427. .title {
  428. font-size: 30rpx;
  429. font-family: Noto Sans S Chinese;
  430. font-weight: 400;
  431. color: #000000;
  432. line-height: 30rpx;
  433. margin-bottom: 30rpx;
  434. }
  435. .car-input {
  436. }
  437. .chepai-lane {
  438. margin-top: 60rpx;
  439. margin-bottom: 20rpx;
  440. }
  441. .address-lane {
  442. margin-bottom: 30rpx;
  443. .title {
  444. font-size: 30rpx;
  445. font-weight: 400;
  446. color: #000000;
  447. line-height: 30rpx;
  448. }
  449. }
  450. }
  451. .address-content {
  452. display: flex;
  453. align-items: center;
  454. justify-content: space-between;
  455. padding-bottom: 30rpx;
  456. border-bottom: 1rpx solid #dcdcdc;
  457. .name {
  458. font-size: 26rpx;
  459. font-family: Microsoft YaHei;
  460. font-weight: 400;
  461. color: #999999;
  462. font-size: 26rpx;
  463. }
  464. .phone {
  465. font-size: 26rpx;
  466. font-family: Microsoft YaHei;
  467. font-weight: 400;
  468. color: #999999;
  469. line-height: 26rpx;
  470. margin-left: 20rpx;
  471. }
  472. .arror .icon {
  473. width: 36rpx;
  474. height: 36rpx;
  475. }
  476. .address {
  477. font-size: 32rpx;
  478. font-family: Microsoft YaHei;
  479. font-weight: 400;
  480. color: #333333;
  481. line-height: 32rpx;
  482. }
  483. }
  484. .address-line {
  485. padding: 20px;
  486. .flex-bettwen {
  487. display: flex;
  488. align-items: center;
  489. justify-content: space-between;
  490. }
  491. .xing {
  492. width: 68rpx;
  493. height: 68rpx;
  494. background: rgba(0, 179, 139, 0.2);
  495. border-radius: 50%;
  496. font-size: 26rpx;
  497. font-weight: 400;
  498. color: #00b38b;
  499. line-height: 68rpx;
  500. text-align: center;
  501. }
  502. .content {
  503. margin-left: 20px;
  504. .name {
  505. font-size: 30rpx;
  506. font-family: Microsoft YaHei;
  507. font-weight: 500;
  508. color: #333333;
  509. }
  510. .phone {
  511. margin-left: 10rpx;
  512. font-size: 24rpx;
  513. font-family: Microsoft YaHei;
  514. font-weight: 400;
  515. color: #999999;
  516. line-height: 36rpx;
  517. }
  518. .address {
  519. margin-top: 10rpx;
  520. font-size: 26rpx;
  521. font-family: Microsoft YaHei;
  522. font-weight: 400;
  523. color: #333333;
  524. line-height: 36rpx;
  525. }
  526. .picture {
  527. width: 48rpx;
  528. height: 48rpx;
  529. }
  530. .editIcon {
  531. width: 48rpx;
  532. height: 48rpx;
  533. }
  534. }
  535. }
  536. .action {
  537. padding-bottom: 100rpx;
  538. .button {
  539. height: 80rpx;
  540. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  541. border-radius: 40rpx;
  542. font-size: 32rpx;
  543. font-weight: 400;
  544. color: #ffffff;
  545. line-height: 80rpx;
  546. }
  547. }
  548. .action-bottom {
  549. padding-bottom: 30rpx;
  550. .button {
  551. height: 80rpx;
  552. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  553. border-radius: 40rpx;
  554. font-size: 32rpx;
  555. font-weight: 400;
  556. color: #ffffff;
  557. line-height: 80rpx;
  558. }
  559. }
  560. :deep(.numberplates .numberplate-bg) {
  561. width: 190rpx;
  562. }
  563. :deep(.numberplates .numberplate){
  564. margin-right: 0rpx !important;
  565. width: 190rpx;
  566. }
  567. :deep(.numberplates){
  568. justify-content: space-between;
  569. }
  570. </style>