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

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