Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

essential-information.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  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(state.data);
  240. console.log(result);
  241. if (state.data.userType == 1) {
  242. uni.navigateTo({
  243. url: `/subpackage/applyCard/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  244. });
  245. } else {
  246. uni.navigateTo({
  247. url: `/subpackage/applyCard/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  248. });
  249. }
  250. })
  251. // uni.navigateTo({
  252. // url: `/subpackage/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  253. // })
  254. // uni.redirectTo({
  255. // url: `/subpackage/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  256. // });
  257. }
  258. });
  259. });
  260. };
  261. //按照订单阶段去跳转
  262. const orderGoAction = () => {
  263. var orderParmas = {
  264. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  265. opId: getItem(StorageKeys.OpenId),
  266. source: "WECHAT",
  267. };
  268. const options = {
  269. type: 2,
  270. data: orderParmas,
  271. method: "POST",
  272. showLoading: true,
  273. };
  274. request(searchOrder, options).then((res) => {
  275. const data = stringToJson(res.bizContent);
  276. console.log(data);
  277. orderStepGoActon(data);
  278. });
  279. };
  280. //订单状态舔砖
  281. const orderStepGoActon = (val: any) => {
  282. console.log(val);
  283. //完成填写基本信息
  284. if (val.orderStep === 1) {
  285. if (state.data.userType === 1) {
  286. uni.redirectTo({
  287. url: `/subpackage/applyCard/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  288. });
  289. } else {
  290. uni.redirectTo({
  291. url: `/subpackage/applyCard/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  292. });
  293. }
  294. } else if (val.orderStep === 2) {
  295. uni.redirectTo({
  296. url: `/subpackage/applyCard/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  297. });
  298. } else if (val.orderStep === 3) {
  299. uni.redirectTo({
  300. url: `/subpackage/applyCard/choice-product?orderId=${val.orderId}`,
  301. });
  302. } else if (val.orderStep === 4) {
  303. uni.redirectTo({
  304. url: `/subpackage/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  305. });
  306. }
  307. };
  308. onLoad((option: any) => {
  309. state.data.opId = getItem(StorageKeys.OpenId);
  310. state.data.type = option.type; //客车
  311. state.data.userType = option.userType;
  312. state.data.productId = option.productId;
  313. });
  314. //监听页面滚动
  315. onPageScroll((e) => {
  316. scrollTop.value = e.scrollTop;
  317. });
  318. onShow(() => {
  319. var data = {
  320. openId: getItem(StorageKeys.OpenId),
  321. };
  322. console.log(getItem(StorageKeys.OpenId));
  323. if (getItem(StorageKeys.OpenId)) {
  324. const options = {
  325. type: 2,
  326. data: data,
  327. method: "POST",
  328. showLoading: true,
  329. };
  330. request(addressQuery, options).then((res) => {
  331. console.log(res.bizContent);
  332. const data = stringToJson(res.bizContent);
  333. console.log(data);
  334. state.addressArray = data.data ?? [];
  335. });
  336. }
  337. });
  338. const productReCodeAction = (orderId) => {
  339. var data = {
  340. productId: state.data.productId,
  341. orderId: orderId,
  342. };
  343. const options = {
  344. type: 2,
  345. data: data,
  346. method: "POST",
  347. showLoading: true,
  348. };
  349. return new Promise(async (resolve, reject) => {
  350. const res = await request(productReCode, options);
  351. const data = stringToJson(res.bizContent);
  352. resolve(data);
  353. }).catch((error) => {
  354. reject(error);
  355. });
  356. };
  357. </script>
  358. <style lang="scss" scoped>
  359. .flex {
  360. display: flex;
  361. align-items: center;
  362. }
  363. .content-wrap {
  364. position: relative;
  365. margin-top: -50rpx;
  366. padding: 0rpx 30rpx;
  367. .title {
  368. font-size: 30rpx;
  369. font-family: Noto Sans S Chinese;
  370. font-weight: 400;
  371. color: #000000;
  372. line-height: 30rpx;
  373. margin-bottom: 30rpx;
  374. }
  375. .car-input {
  376. }
  377. .chepai-lane {
  378. margin-top: 60rpx;
  379. margin-bottom: 20rpx;
  380. }
  381. .address-lane {
  382. margin-bottom: 30rpx;
  383. .title {
  384. font-size: 30rpx;
  385. font-weight: 400;
  386. color: #000000;
  387. line-height: 30rpx;
  388. }
  389. }
  390. }
  391. .address-content {
  392. display: flex;
  393. align-items: center;
  394. justify-content: space-between;
  395. padding-bottom: 30rpx;
  396. border-bottom: 1rpx solid #dcdcdc;
  397. .name {
  398. font-size: 26rpx;
  399. font-family: Microsoft YaHei;
  400. font-weight: 400;
  401. color: #999999;
  402. font-size: 26rpx;
  403. }
  404. .phone {
  405. font-size: 26rpx;
  406. font-family: Microsoft YaHei;
  407. font-weight: 400;
  408. color: #999999;
  409. line-height: 26rpx;
  410. margin-left: 20rpx;
  411. }
  412. .arror .icon {
  413. width: 36rpx;
  414. height: 36rpx;
  415. }
  416. .address {
  417. font-size: 32rpx;
  418. font-family: Microsoft YaHei;
  419. font-weight: 400;
  420. color: #333333;
  421. line-height: 32rpx;
  422. }
  423. }
  424. .address-line {
  425. padding: 20px;
  426. .flex-bettwen {
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. }
  431. .xing {
  432. width: 68rpx;
  433. height: 68rpx;
  434. background: rgba(0, 179, 139, 0.2);
  435. border-radius: 50%;
  436. font-size: 26rpx;
  437. font-weight: 400;
  438. color: #00b38b;
  439. line-height: 68rpx;
  440. text-align: center;
  441. }
  442. .content {
  443. margin-left: 20px;
  444. .name {
  445. font-size: 30rpx;
  446. font-family: Microsoft YaHei;
  447. font-weight: 500;
  448. color: #333333;
  449. }
  450. .phone {
  451. margin-left: 10rpx;
  452. font-size: 24rpx;
  453. font-family: Microsoft YaHei;
  454. font-weight: 400;
  455. color: #999999;
  456. line-height: 36rpx;
  457. }
  458. .address {
  459. margin-top: 10rpx;
  460. font-size: 26rpx;
  461. font-family: Microsoft YaHei;
  462. font-weight: 400;
  463. color: #333333;
  464. line-height: 36rpx;
  465. }
  466. .picture {
  467. width: 48rpx;
  468. height: 48rpx;
  469. }
  470. .editIcon {
  471. width: 48rpx;
  472. height: 48rpx;
  473. }
  474. }
  475. }
  476. .action {
  477. padding-bottom: 100rpx;
  478. .button {
  479. height: 80rpx;
  480. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  481. border-radius: 40rpx;
  482. font-size: 32rpx;
  483. font-weight: 400;
  484. color: #ffffff;
  485. line-height: 80rpx;
  486. }
  487. }
  488. .action-bottom {
  489. padding-bottom: 30rpx;
  490. .button {
  491. height: 80rpx;
  492. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  493. border-radius: 40rpx;
  494. font-size: 32rpx;
  495. font-weight: 400;
  496. color: #ffffff;
  497. line-height: 80rpx;
  498. }
  499. }
  500. </style>