You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

essential-information.vue 13KB

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