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

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