Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

essential-information.vue 18KB

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