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 14KB

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