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

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