選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

essential-information.vue 14KB

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