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

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