您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

essential-information.vue 11KB

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