Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

essential-information.vue 13KB

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