您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

essential-information.vue 15KB

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