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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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 :numberplate="state.data.vehiclePlateNumber" :numberplateCor="{ id: 0 }"
  14. @numberplateResult="checkNumberplateColor">
  15. </numberplate-color>
  16. </view>
  17. <block v-if="getItem(StorageKeys.OpenId)">
  18. <!-- 收货地址 -->
  19. <view v-if="!state.data.address" class="address-lane">
  20. <view class="title">请选择或新增收货地址</view>
  21. <view style="margin-top: 30rpx" class="action">
  22. <button type="default" class="button" @click="state.show = true">
  23. 添加收货地址
  24. </button>
  25. </view>
  26. </view>
  27. <view v-if="state.data.address" class="address-lane">
  28. <view class="title">收货地址</view>
  29. <view @click="state.show = true" class="address-content" style="margin-top: 30rpx">
  30. <view class="flex">
  31. <image :showLoading="true" :src="`${$imgUrl}applyCard/location.png`"
  32. style="width: 48rpx; height: 48rpx">
  33. </image>
  34. <view style="margin-left: 18rpx" class="">
  35. <view class="address">
  36. {{ state.data.region + state.data.address }}
  37. </view>
  38. <view style="margin-top: 15rpx" class="flex">
  39. <view class="name">
  40. {{ state.data.consignee }}
  41. </view>
  42. <view class="phone">
  43. {{ state.data.consigneeTel }}
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="arror">
  49. <image :src="`${$imgUrl}common/arror-right.png`" class="icon"></image>
  50. </view>
  51. </view>
  52. <view style="margin-top: 30rpx" class="action">
  53. <button type="default" class="button" @click="nextAction()">
  54. 下一步
  55. </button>
  56. </view>
  57. </view>
  58. </block>
  59. <block v-else>
  60. <view class="address-lane">
  61. <view style="margin-top: 30rpx" class="action">
  62. <button type="default" class="button" @click="nextAction()">
  63. 下一步
  64. </button>
  65. </view>
  66. </view>
  67. </block>
  68. </view>
  69. <!-- 地址弹窗 -->
  70. <u-popup mode="bottom" v-model="state.show">
  71. <view class="address-line">
  72. <view v-if="state.addressArray" v-for="(item, index) in state.addressArray" :key="index"
  73. @click="addressSelected(item)" style="margin-bottom: 60rpx" class="flex-bettwen">
  74. <view class="flex">
  75. <view class="xing">
  76. {{ item.consignee.charAt(0) }}
  77. </view>
  78. <view class="content">
  79. <view class="flex">
  80. <view class="name">
  81. {{ item.consignee }}
  82. </view>
  83. <view class="phone">
  84. {{ item.consigneeTel }}
  85. </view>
  86. </view>
  87. <view class="address">
  88. {{ item.region + item.address }}
  89. </view>
  90. </view>
  91. </view>
  92. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  93. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`"
  94. style="width: 48rpx; height: 48rpx"></image>
  95. </view>
  96. </view>
  97. <view :style="state.addressArray ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  98. <button type="default" class="button" @click="goToAddAddress()">
  99. 添加收货地址
  100. </button>
  101. </view>
  102. </view>
  103. </u-popup>
  104. </template>
  105. <script setup lang="ts">
  106. /*导航*/
  107. import navBgCar from "./components/nav-bg-car1";
  108. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  109. import numberplateColor from "./components/layout-numberplate-color";
  110. import { getItem, StorageKeys } from "@/utils/storage";
  111. import { stringToJson } from "@/utils/network/encryption";
  112. import navBar from "../components/nav-bar/nav-bar2.vue";
  113. import { onLoad, onShow,onPageScroll } from "@dcloudio/uni-app";
  114. import {
  115. addressQuery,
  116. etcCreatOrder,
  117. etcVehiclePlateVer,
  118. searchOrder,
  119. } from "@/utils/network/api.js";
  120. import { request } from "@/utils/network/request.js";
  121. import { reactive, ref } from "vue";
  122. import { msg } from "@/utils/utils";
  123. const scrollTop =ref(0);
  124. const state = reactive({
  125. data: {
  126. vehiclePlate: undefined, //车牌号
  127. vehiclePlateNumber: "贵A12345", //车牌号
  128. vehiclePlateColor: 0, //车盘颜色
  129. type: "0", //车牌类型
  130. userType: "1",
  131. whetherToMail: getItem(StorageKeys.OpenId) ? 0 : "", //是否需要邮寄 小程序默认邮寄 0邮寄||1不邮寄 不登录为1
  132. orderSource: "WECHAT",
  133. opId: "",
  134. consignee: "", //收货人
  135. consigneeTel: "", //收货电话
  136. region: "",
  137. address: "",
  138. postalCode: "",
  139. },
  140. show: false,
  141. addressArray: [],
  142. });
  143. /* 选择车牌颜色 */
  144. const checkNumberplateColor = (item : any) => {
  145. state.data.vehiclePlateColor = item.id;
  146. };
  147. const goToAddAddress = () => {
  148. uni.navigateTo({
  149. url: "/applyCard/addAddress",
  150. });
  151. };
  152. const editAddress = (val) => {
  153. uni.navigateTo({
  154. url: `/applyCard/editAddress?content=` + JSON.stringify(val),
  155. });
  156. };
  157. const carNumber = (val : any) => {
  158. state.data.vehiclePlate = val;
  159. state.data.vehiclePlateNumber = val;
  160. };
  161. const addressSelected = (val : any) => {
  162. state.data = {
  163. ...state.data,
  164. ...val,
  165. };
  166. state.show = false;
  167. };
  168. const nextAction = () => {
  169. if (!state.data.vehiclePlate) {
  170. msg("请输入申办车牌");
  171. return;
  172. }
  173. state.data.vehiclePlate = state.data.vehiclePlate.trim();
  174. console.log(state.data.vehiclePlate);
  175. console.log(state.data.vehiclePlate.length);
  176. if (state.data.vehiclePlate.length < 7) {
  177. msg("请输入正确的申办车牌");
  178. return;
  179. }
  180. //1.优先车牌校验 2.在进行订单创建
  181. var vehicleData = {
  182. vehiclePlate: state.data.vehiclePlate,
  183. vehiclePlateColor: state.data.vehiclePlateColor,
  184. };
  185. const options = {
  186. type: 2,
  187. data: vehicleData,
  188. method: "POST",
  189. showLoading: true,
  190. };
  191. request(etcVehiclePlateVer, options).then((res) => {
  192. var data = state.data;
  193. const options = {
  194. type: 2,
  195. data: data,
  196. method: "POST",
  197. showLoading: true,
  198. };
  199. request(etcCreatOrder, options).then((res) => {
  200. console.log(res);
  201. if (res.statusCode === 600) {
  202. orderGoAction();
  203. } else {
  204. const data = stringToJson(res.bizContent);
  205. // uni.navigateTo({
  206. // url: `/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  207. // })
  208. uni.redirectTo({
  209. url: `/applyCard/choice-product?orderId=${data.orderId}&userType=${state.data.userType}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  210. })
  211. // if (state.data.userType === "1") {
  212. // uni.navigateTo({
  213. // url: `/applyCard/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  214. // });
  215. // } else {
  216. // uni.navigateTo({
  217. // url: `/applyCard/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  218. // });
  219. // }
  220. }
  221. });
  222. });
  223. };
  224. //按照订单阶段去跳转
  225. const orderGoAction = () => {
  226. var orderParmas = {
  227. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  228. opId: getItem(StorageKeys.OpenId),
  229. source: "WECHAT",
  230. };
  231. const options = {
  232. type: 2,
  233. data: orderParmas,
  234. method: "POST",
  235. showLoading: true,
  236. };
  237. request(searchOrder, options).then((res) => {
  238. const data = stringToJson(res.bizContent);
  239. console.log(data);
  240. orderStepGoActon(data);
  241. });
  242. };
  243. //订单状态舔砖
  244. const orderStepGoActon = (val : any) => {
  245. console.log(val);
  246. //完成填写基本信息
  247. if (val.orderStep === 1) {
  248. if (state.data.userType === "1") {
  249. uni.redirectTo({
  250. url: `/applyCard/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  251. });
  252. } else {
  253. uni.redirectTo({
  254. url: `/applyCard/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  255. });
  256. }
  257. } else if (val.orderStep === 2) {
  258. uni.redirectTo({
  259. url: `/applyCard/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  260. });
  261. } else if (val.orderStep === 3) {
  262. uni.redirectTo({
  263. url: `/applyCard/choice-product?orderId=${val.orderId}`,
  264. });
  265. } else if (val.orderStep === 4) {
  266. uni.redirectTo({
  267. url: `/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  268. });
  269. }
  270. };
  271. onLoad((option : any) => {
  272. state.data.opId = getItem(StorageKeys.OpenId);
  273. state.data.type = option.type; //客车
  274. state.data.userType = option.userType;
  275. });
  276. //监听页面滚动
  277. onPageScroll((e) => {
  278. scrollTop.value = e.scrollTop;
  279. });
  280. onShow(() => {
  281. var data = {
  282. openId: getItem(StorageKeys.OpenId),
  283. };
  284. console.log(getItem(StorageKeys.OpenId));
  285. if (getItem(StorageKeys.OpenId)) {
  286. const options = {
  287. type: 2,
  288. data: data,
  289. method: "POST",
  290. showLoading: true,
  291. };
  292. request(addressQuery, options).then((res) => {
  293. console.log(res.bizContent);
  294. const data = stringToJson(res.bizContent);
  295. console.log(data);
  296. state.addressArray = data.data??[];
  297. });
  298. }
  299. });
  300. </script>
  301. <style lang="scss" scoped>
  302. .flex {
  303. display: flex;
  304. align-items: center;
  305. }
  306. .content-wrap {
  307. position: relative;
  308. margin-top: -50rpx;
  309. padding: 0rpx 30rpx;
  310. .title {
  311. font-size: 30rpx;
  312. font-family: Noto Sans S Chinese;
  313. font-weight: 400;
  314. color: #000000;
  315. line-height: 30rpx;
  316. margin-bottom: 30rpx;
  317. }
  318. .car-input {}
  319. .chepai-lane {
  320. margin-top: 60rpx;
  321. margin-bottom: 20rpx;
  322. }
  323. .address-lane {
  324. margin-bottom: 30rpx;
  325. .title {
  326. font-size: 30rpx;
  327. font-weight: 400;
  328. color: #000000;
  329. line-height: 30rpx;
  330. }
  331. }
  332. }
  333. .address-content {
  334. display: flex;
  335. align-items: center;
  336. justify-content: space-between;
  337. padding-bottom: 30rpx;
  338. border-bottom: 1rpx solid #dcdcdc;
  339. .name {
  340. font-size: 26rpx;
  341. font-family: Microsoft YaHei;
  342. font-weight: 400;
  343. color: #999999;
  344. font-size: 26rpx;
  345. }
  346. .phone {
  347. font-size: 26rpx;
  348. font-family: Microsoft YaHei;
  349. font-weight: 400;
  350. color: #999999;
  351. line-height: 26rpx;
  352. margin-left: 20rpx;
  353. }
  354. .arror .icon {
  355. width: 36rpx;
  356. height: 36rpx;
  357. }
  358. .address {
  359. font-size: 32rpx;
  360. font-family: Microsoft YaHei;
  361. font-weight: 400;
  362. color: #333333;
  363. line-height: 32rpx;
  364. }
  365. }
  366. .address-line {
  367. padding: 20px;
  368. .flex-bettwen {
  369. display: flex;
  370. align-items: center;
  371. justify-content: space-between;
  372. }
  373. .xing {
  374. width: 68rpx;
  375. height: 68rpx;
  376. background: rgba(0, 179, 139, 0.2);
  377. border-radius: 50%;
  378. font-size: 26rpx;
  379. font-weight: 400;
  380. color: #00b38b;
  381. line-height: 68rpx;
  382. text-align: center;
  383. }
  384. .content {
  385. margin-left: 20px;
  386. .name {
  387. font-size: 30rpx;
  388. font-family: Microsoft YaHei;
  389. font-weight: 500;
  390. color: #333333;
  391. }
  392. .phone {
  393. margin-left: 10rpx;
  394. font-size: 24rpx;
  395. font-family: Microsoft YaHei;
  396. font-weight: 400;
  397. color: #999999;
  398. line-height: 36rpx;
  399. }
  400. .address {
  401. margin-top: 10rpx;
  402. font-size: 26rpx;
  403. font-family: Microsoft YaHei;
  404. font-weight: 400;
  405. color: #333333;
  406. line-height: 36rpx;
  407. }
  408. .picture {
  409. width: 48rpx;
  410. height: 48rpx;
  411. }
  412. .editIcon {
  413. width: 48rpx;
  414. height: 48rpx;
  415. }
  416. }
  417. }
  418. .action {
  419. padding-bottom: 100rpx;
  420. .button {
  421. height: 80rpx;
  422. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  423. border-radius: 40rpx;
  424. font-size: 32rpx;
  425. font-weight: 400;
  426. color: #ffffff;
  427. line-height: 80rpx;
  428. }
  429. }
  430. .action-bottom {
  431. padding-bottom: 30rpx;
  432. .button {
  433. height: 80rpx;
  434. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  435. border-radius: 40rpx;
  436. font-size: 32rpx;
  437. font-weight: 400;
  438. color: #ffffff;
  439. line-height: 80rpx;
  440. }
  441. }
  442. </style>