Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

essential-information-two.vue 17KB

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