Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

essential-information.vue 15KB

pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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. // #ifdef MP-ALIPAY
  211. data.orderSource = 'ALI'
  212. // #endif
  213. const options = {
  214. type: 2,
  215. data: data,
  216. method: "POST",
  217. showLoading: true,
  218. };
  219. request(etcCreatOrder, options).then((res) => {
  220. console.log(res);
  221. if (res.statusCode === 600) {
  222. orderGoAction();
  223. } else {
  224. const data = stringToJson(res.bizContent);
  225. console.log(data);
  226. //提交产品信息
  227. productReCodeAction(data.orderId).then((result) => {
  228. console.log(state.data);
  229. console.log(result);
  230. if (state.data.userType == 1) {
  231. uni.navigateTo({
  232. url: `/subpackage/orders/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&type=${state.data.type}`,
  233. });
  234. } else {
  235. uni.navigateTo({
  236. url: `/subpackage/orders/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&type=${state.data.type}`,
  237. });
  238. }
  239. })
  240. }
  241. });
  242. });
  243. };
  244. //按照订单阶段去跳转
  245. const orderGoAction = () => {
  246. var orderParmas = {
  247. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  248. opId: getItem(StorageKeys.OpenId),
  249. source: "WECHAT",
  250. };
  251. const options = {
  252. type: 2,
  253. data: orderParmas,
  254. method: "POST",
  255. showLoading: true,
  256. };
  257. request(searchOrder, options).then((res) => {
  258. const data = stringToJson(res.bizContent);
  259. console.log(data);
  260. orderStepGoActon(data);
  261. });
  262. };
  263. //订单状态舔砖
  264. const orderStepGoActon = (val : any) => {
  265. console.log("订单状态舔砖", val);
  266. //完成填写基本信息
  267. if (val.orderStep === 1) {
  268. if (state.data.userType === 1) {
  269. uni.redirectTo({
  270. url: `/subpackage/orders/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  271. });
  272. } else {
  273. uni.redirectTo({
  274. url: `/subpackage/orders/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  275. });
  276. }
  277. } else if (val.orderStep === 2) {
  278. uni.redirectTo({
  279. url: `/subpackage/orders/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  280. });
  281. } else if (val.orderStep === 3) {
  282. uni.redirectTo({
  283. url: `/subpackage/orders/choice-product?orderId=${val.orderId}`,
  284. });
  285. // if(val.isValueCard==2){
  286. // uni.redirectTo({
  287. // url:`/subpackage/orders/interestsList?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`
  288. // });
  289. // }else{
  290. // uni.redirectTo({
  291. // url: `/subpackage/orders/choice-product?orderId=${val.orderId}`,
  292. // });
  293. // }
  294. } else if (val.orderStep === 4) {
  295. uni.redirectTo({
  296. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  297. });
  298. } else if (val.orderStep === 26 || val.orderStep === 27) {
  299. uni.redirectTo({
  300. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  301. });
  302. }
  303. };
  304. onLoad((option : any) => {
  305. globalParam();
  306. state.data.opId = getItem(StorageKeys.OpenId);
  307. state.data.type = option.type; //客车
  308. state.data.userType = option.userType;
  309. state.data.promoteId = option.promoteId;
  310. state.isValueCard = option.isValueCard
  311. console.log("订单选择推广发行产品接口", option)
  312. uni.getLocation({
  313. type: 'wgs84',
  314. success: function (res) {
  315. state.data.longitude = res.longitude;
  316. state.data.latitude = res.latitude;
  317. console.log("成功回调", res)
  318. uni.request({
  319. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  320. data: {
  321. location: (res.latitude + "," + res.longitude),
  322. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  323. },
  324. success: function (res) {
  325. console.log("成功回调", res)
  326. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  327. // 处理获取到的地址信息
  328. },
  329. fail: function (error) {
  330. // 请求失败的处理
  331. }
  332. });
  333. }
  334. });
  335. });
  336. //监听页面滚动
  337. onPageScroll((e) => {
  338. scrollTop.value = e.scrollTop;
  339. });
  340. onShow((option) => {
  341. var data = {
  342. openId: getItem(StorageKeys.OpenId),
  343. };
  344. if (getItem(StorageKeys.OpenId)) {
  345. const options = {
  346. type: 2,
  347. data: data,
  348. method: "POST",
  349. showLoading: true,
  350. };
  351. request(addressQuery, options).then((res) => {
  352. const data = stringToJson(res.bizContent);
  353. console.log("111", data);
  354. state.addressArray = data.data ? data.data : [];
  355. });
  356. }
  357. uni.$on('updateData', function (data) {
  358. var arr = [];
  359. arr.push(data)
  360. state.addressArray = arr
  361. console.log("dizhi", arr)
  362. })
  363. // 删除地址
  364. if (option) {
  365. if (option.del == 1) {
  366. state.addressArray = [];
  367. }
  368. }
  369. });
  370. onUnload(() => {
  371. uni.$off('updateData');
  372. })
  373. const productReCodeAction = (orderId) => {
  374. // var data = {
  375. // productId: state.data.productId,
  376. // orderId: orderId,
  377. // };
  378. var data = {
  379. promoteId: state.data.promoteId,
  380. orderId: orderId,
  381. isValueCard: state.isValueCard
  382. };
  383. const options = {
  384. type: 2,
  385. data: data,
  386. method: "POST",
  387. showLoading: true,
  388. };
  389. return new Promise(async (resolve, reject) => {
  390. const res = await request(productReCode, options);
  391. const data = stringToJson(res.bizContent);
  392. console.log("111")
  393. resolve(data);
  394. }).catch((error) => {
  395. console.log("222")
  396. reject(error);
  397. });
  398. };
  399. </script>
  400. <style lang="scss" scoped>
  401. .flex {
  402. display: flex;
  403. align-items: center;
  404. }
  405. .content-wrap {
  406. position: relative;
  407. margin-top: -50rpx;
  408. padding: 0rpx 30rpx;
  409. .title {
  410. font-size: 30rpx;
  411. font-family: Noto Sans S Chinese;
  412. font-weight: 400;
  413. color: #000000;
  414. line-height: 30rpx;
  415. margin-bottom: 30rpx;
  416. }
  417. .car-input {}
  418. .chepai-lane {
  419. margin-top: 60rpx;
  420. margin-bottom: 20rpx;
  421. }
  422. .address-lane {
  423. margin-bottom: 30rpx;
  424. .title {
  425. font-size: 30rpx;
  426. font-weight: 400;
  427. color: #000000;
  428. line-height: 30rpx;
  429. }
  430. }
  431. }
  432. .address-content {
  433. display: flex;
  434. align-items: center;
  435. justify-content: space-between;
  436. padding-bottom: 30rpx;
  437. border-bottom: 1rpx solid #dcdcdc;
  438. .name {
  439. font-size: 26rpx;
  440. font-family: Microsoft YaHei;
  441. font-weight: 400;
  442. color: #999999;
  443. font-size: 26rpx;
  444. }
  445. .phone {
  446. font-size: 26rpx;
  447. font-family: Microsoft YaHei;
  448. font-weight: 400;
  449. color: #999999;
  450. line-height: 26rpx;
  451. margin-left: 20rpx;
  452. }
  453. .arror .icon {
  454. width: 36rpx;
  455. height: 36rpx;
  456. }
  457. .address {
  458. font-size: 32rpx;
  459. font-family: Microsoft YaHei;
  460. font-weight: 400;
  461. color: #333333;
  462. line-height: 32rpx;
  463. }
  464. }
  465. .address-line {
  466. padding: 20px;
  467. .flex-bettwen {
  468. display: flex;
  469. align-items: center;
  470. justify-content: space-between;
  471. }
  472. .xing {
  473. width: 68rpx;
  474. height: 68rpx;
  475. background: rgba(0, 179, 139, 0.2);
  476. border-radius: 50%;
  477. font-size: 26rpx;
  478. font-weight: 400;
  479. color: #00b38b;
  480. line-height: 68rpx;
  481. text-align: center;
  482. }
  483. .content {
  484. margin-left: 20px;
  485. .name {
  486. font-size: 30rpx;
  487. font-family: Microsoft YaHei;
  488. font-weight: 500;
  489. color: #333333;
  490. }
  491. .phone {
  492. margin-left: 10rpx;
  493. font-size: 24rpx;
  494. font-family: Microsoft YaHei;
  495. font-weight: 400;
  496. color: #999999;
  497. line-height: 36rpx;
  498. }
  499. .address {
  500. margin-top: 10rpx;
  501. font-size: 26rpx;
  502. font-family: Microsoft YaHei;
  503. font-weight: 400;
  504. color: #333333;
  505. line-height: 36rpx;
  506. }
  507. .picture {
  508. width: 48rpx;
  509. height: 48rpx;
  510. }
  511. .editIcon {
  512. width: 48rpx;
  513. height: 48rpx;
  514. }
  515. }
  516. }
  517. .action {
  518. padding-bottom: 100rpx;
  519. .button {
  520. height: 80rpx;
  521. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  522. border-radius: 40rpx;
  523. font-size: 32rpx;
  524. font-weight: 400;
  525. color: #ffffff;
  526. line-height: 80rpx;
  527. }
  528. }
  529. .action-bottom {
  530. padding-bottom: 30rpx;
  531. .button {
  532. height: 80rpx;
  533. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  534. border-radius: 40rpx;
  535. font-size: 32rpx;
  536. font-weight: 400;
  537. color: #ffffff;
  538. line-height: 80rpx;
  539. }
  540. }
  541. :deep(.numberplates .numberplate-bg) {
  542. width: 190rpx;
  543. }
  544. :deep(.numberplates .numberplate) {
  545. margin-right: 0rpx !important;
  546. width: 190rpx;
  547. }
  548. :deep(.numberplates) {
  549. justify-content: space-between;
  550. }
  551. </style>