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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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. promoteId:"",
  170. },
  171. show: false,
  172. addressArray: [],
  173. isSign:''
  174. });
  175. /* 选择车牌颜色 */
  176. const checkNumberplateColor = (item: any) => {
  177. state.data.vehiclePlateColor = item.id;
  178. };
  179. const goToAddAddress = () => {
  180. uni.navigateTo({
  181. url: "/subpackage/applyCard/addAddress",
  182. });
  183. };
  184. const editAddress = (val) => {
  185. uni.navigateTo({
  186. url: `/subpackage/applyCard/editAddress?content=` + JSON.stringify(val),
  187. });
  188. };
  189. const carNumber = (val: any) => {
  190. state.data.vehiclePlate = val;
  191. state.data.vehiclePlateNumber = val;
  192. };
  193. const addressSelected = (val: any) => {
  194. state.data = {
  195. ...state.data,
  196. ...val,
  197. };
  198. state.show = false;
  199. };
  200. const nextAction = () => {
  201. if (!state.data.vehiclePlate) {
  202. msg("请输入申办车牌");
  203. return;
  204. }
  205. state.data.vehiclePlate = state.data.vehiclePlate.trim();
  206. console.log(state.data.vehiclePlate);
  207. console.log(state.data.vehiclePlate.length);
  208. if (state.data.vehiclePlate.length < 7) {
  209. msg("请输入正确的申办车牌");
  210. return;
  211. }
  212. //1.优先车牌校验 2.在进行订单创建
  213. var vehicleData = {
  214. vehiclePlate: state.data.vehiclePlate,
  215. vehiclePlateColor: state.data.vehiclePlateColor,
  216. };
  217. const options = {
  218. type: 2,
  219. data: vehicleData,
  220. method: "POST",
  221. showLoading: true,
  222. };
  223. request(etcVehiclePlateVer, options).then((res) => {
  224. var data = state.data;
  225. const options = {
  226. type: 2,
  227. data: data,
  228. method: "POST",
  229. showLoading: true,
  230. };
  231. request(etcCreatOrder, options).then((res) => {
  232. console.log(res);
  233. if (res.statusCode === 600) {
  234. orderGoAction();
  235. } else {
  236. const data = stringToJson(res.bizContent);
  237. console.log(data);
  238. //提交产品信息
  239. productReCodeAction(data.orderId).then((result)=>{
  240. console.log(state.data);
  241. console.log(result);
  242. if (state.data.userType == 1) {
  243. uni.navigateTo({
  244. url: `/subpackage/applyCard/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isSign}`,
  245. });
  246. } else {
  247. uni.navigateTo({
  248. url: `/subpackage/applyCard/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isSign}`,
  249. });
  250. }
  251. })
  252. // uni.navigateTo({
  253. // url: `/subpackage/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  254. // })
  255. // uni.redirectTo({
  256. // url: `/subpackage/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  257. // });
  258. }
  259. });
  260. });
  261. };
  262. //按照订单阶段去跳转
  263. const orderGoAction = () => {
  264. var orderParmas = {
  265. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  266. opId: getItem(StorageKeys.OpenId),
  267. source: "WECHAT",
  268. };
  269. const options = {
  270. type: 2,
  271. data: orderParmas,
  272. method: "POST",
  273. showLoading: true,
  274. };
  275. request(searchOrder, options).then((res) => {
  276. const data = stringToJson(res.bizContent);
  277. console.log(data);
  278. orderStepGoActon(data);
  279. });
  280. };
  281. //订单状态舔砖
  282. const orderStepGoActon = (val: any) => {
  283. console.log(val);
  284. //完成填写基本信息
  285. if (val.orderStep === 1) {
  286. if (state.data.userType === 1) {
  287. uni.redirectTo({
  288. url: `/subpackage/applyCard/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  289. });
  290. } else {
  291. uni.redirectTo({
  292. url: `/subpackage/applyCard/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  293. });
  294. }
  295. } else if (val.orderStep === 2) {
  296. uni.redirectTo({
  297. url: `/subpackage/applyCard/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  298. });
  299. } else if (val.orderStep === 3) {
  300. uni.redirectTo({
  301. url: `/subpackage/applyCard/choice-product?orderId=${val.orderId}`,
  302. });
  303. }else if (val.orderStep === 4) {
  304. uni.redirectTo({
  305. url: `/subpackage/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  306. });
  307. } else if (val.orderStep === 26 || val.orderStep === 27) {
  308. uni.redirectTo({
  309. url: `/subpackage/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  310. });
  311. }
  312. };
  313. onLoad((option: any) => {
  314. state.data.opId = getItem(StorageKeys.OpenId);
  315. state.data.type = option.type; //客车
  316. state.data.userType = option.userType;
  317. state.data.promoteId = option.promoteId;
  318. state.isSign=option.isSign
  319. console.log("订单选择推广发行产品接口",option)
  320. });
  321. //监听页面滚动
  322. onPageScroll((e) => {
  323. scrollTop.value = e.scrollTop;
  324. });
  325. onShow(() => {
  326. var data = {
  327. openId: getItem(StorageKeys.OpenId),
  328. };
  329. if (getItem(StorageKeys.OpenId)) {
  330. const options = {
  331. type: 2,
  332. data: data,
  333. method: "POST",
  334. showLoading: true,
  335. };
  336. request(addressQuery, options).then((res) => {
  337. const data = stringToJson(res.bizContent);
  338. console.log("111",data);
  339. state.addressArray = data.data ?? [];
  340. });
  341. }
  342. });
  343. const productReCodeAction = (orderId) => {
  344. // var data = {
  345. // productId: state.data.productId,
  346. // orderId: orderId,
  347. // };
  348. var data = {
  349. promoteId: state.data.promoteId,
  350. orderId: orderId,
  351. };
  352. const options = {
  353. type: 2,
  354. data: data,
  355. method: "POST",
  356. showLoading: true,
  357. };
  358. return new Promise(async (resolve, reject) => {
  359. const res = await request(productReCode, options);
  360. const data = stringToJson(res.bizContent);
  361. console.log("111")
  362. resolve(data);
  363. }).catch((error) => {
  364. console.log("222")
  365. reject(error);
  366. });
  367. };
  368. </script>
  369. <style lang="scss" scoped>
  370. .flex {
  371. display: flex;
  372. align-items: center;
  373. }
  374. .content-wrap {
  375. position: relative;
  376. margin-top: -50rpx;
  377. padding: 0rpx 30rpx;
  378. .title {
  379. font-size: 30rpx;
  380. font-family: Noto Sans S Chinese;
  381. font-weight: 400;
  382. color: #000000;
  383. line-height: 30rpx;
  384. margin-bottom: 30rpx;
  385. }
  386. .car-input {
  387. }
  388. .chepai-lane {
  389. margin-top: 60rpx;
  390. margin-bottom: 20rpx;
  391. }
  392. .address-lane {
  393. margin-bottom: 30rpx;
  394. .title {
  395. font-size: 30rpx;
  396. font-weight: 400;
  397. color: #000000;
  398. line-height: 30rpx;
  399. }
  400. }
  401. }
  402. .address-content {
  403. display: flex;
  404. align-items: center;
  405. justify-content: space-between;
  406. padding-bottom: 30rpx;
  407. border-bottom: 1rpx solid #dcdcdc;
  408. .name {
  409. font-size: 26rpx;
  410. font-family: Microsoft YaHei;
  411. font-weight: 400;
  412. color: #999999;
  413. font-size: 26rpx;
  414. }
  415. .phone {
  416. font-size: 26rpx;
  417. font-family: Microsoft YaHei;
  418. font-weight: 400;
  419. color: #999999;
  420. line-height: 26rpx;
  421. margin-left: 20rpx;
  422. }
  423. .arror .icon {
  424. width: 36rpx;
  425. height: 36rpx;
  426. }
  427. .address {
  428. font-size: 32rpx;
  429. font-family: Microsoft YaHei;
  430. font-weight: 400;
  431. color: #333333;
  432. line-height: 32rpx;
  433. }
  434. }
  435. .address-line {
  436. padding: 20px;
  437. .flex-bettwen {
  438. display: flex;
  439. align-items: center;
  440. justify-content: space-between;
  441. }
  442. .xing {
  443. width: 68rpx;
  444. height: 68rpx;
  445. background: rgba(0, 179, 139, 0.2);
  446. border-radius: 50%;
  447. font-size: 26rpx;
  448. font-weight: 400;
  449. color: #00b38b;
  450. line-height: 68rpx;
  451. text-align: center;
  452. }
  453. .content {
  454. margin-left: 20px;
  455. .name {
  456. font-size: 30rpx;
  457. font-family: Microsoft YaHei;
  458. font-weight: 500;
  459. color: #333333;
  460. }
  461. .phone {
  462. margin-left: 10rpx;
  463. font-size: 24rpx;
  464. font-family: Microsoft YaHei;
  465. font-weight: 400;
  466. color: #999999;
  467. line-height: 36rpx;
  468. }
  469. .address {
  470. margin-top: 10rpx;
  471. font-size: 26rpx;
  472. font-family: Microsoft YaHei;
  473. font-weight: 400;
  474. color: #333333;
  475. line-height: 36rpx;
  476. }
  477. .picture {
  478. width: 48rpx;
  479. height: 48rpx;
  480. }
  481. .editIcon {
  482. width: 48rpx;
  483. height: 48rpx;
  484. }
  485. }
  486. }
  487. .action {
  488. padding-bottom: 100rpx;
  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. .action-bottom {
  500. padding-bottom: 30rpx;
  501. .button {
  502. height: 80rpx;
  503. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  504. border-radius: 40rpx;
  505. font-size: 32rpx;
  506. font-weight: 400;
  507. color: #ffffff;
  508. line-height: 80rpx;
  509. }
  510. }
  511. </style>