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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="bg">
  3. <!-- 车牌输入 -->
  4. <view class="car-input">
  5. <view class="title" style="margin-top: 10rpx;">车牌号</view>
  6. <car-number-input @numberInputResult="carNumber" inputColor='#ECF1F4'></car-number-input>
  7. </view>
  8. <!-- 车牌颜色 -->
  9. <view class="chepai-lane">
  10. <view class="title">车牌颜色 <text class='tips'></text></view>
  11. <numberplate-color :numberplate="state.vehiclePlate"
  12. :numberplateCor='state.vehiclePlateColor' @numberplateResult="checkNumberplateColor">
  13. </numberplate-color>
  14. </view>
  15. </view>
  16. <view class="action">
  17. <button type="default" class="ui-btn" @click="add()">
  18. 绑定
  19. </button>
  20. </view>
  21. </template>
  22. <script setup lang="ts">
  23. import { reactive } from "vue";
  24. import { onLoad } from "@dcloudio/uni-app";
  25. import {vehicleBind } from "@/utils/network/api.js";
  26. import {requestNew } from "@/utils/network/request.js";
  27. import {getItem,StorageKeys } from "@/utils/storage";
  28. import carNumberInput from "../components/car-number-input.vue";
  29. import numberplateColor from "../components/layout-numberplate-color";
  30. import {msg} from "@/utils/utils";
  31. const state = reactive({
  32. vehiclePlate: "",
  33. vehiclePlateColor: ""
  34. });
  35. onLoad((option : any) => {
  36. })
  37. const carNumber = (val : any) => {
  38. state.vehiclePlate = val.trim();
  39. };
  40. /* 选择车牌颜色 */
  41. const checkNumberplateColor = (item : any) => {
  42. state.vehiclePlateColor = item;
  43. };
  44. const add = () => {
  45. const options = {
  46. type: 2,
  47. data: {
  48. "vehiclePlate": state.vehiclePlate,
  49. "vehiclePlateColor": state.vehiclePlateColor,
  50. "operaterId":getItem(StorageKeys.OpenId)
  51. },
  52. method: 'POST',
  53. showLoading: true,
  54. }
  55. requestNew(vehicleBind, options).then((res) => {
  56. console.log("res==",res)
  57. msg("新增成功")
  58. setTimeout(()=>{
  59. uni.navigateBack()
  60. },1500)
  61. })
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .bg {
  66. background-color: white;
  67. width: 88%;
  68. margin: 0 auto;
  69. margin-top: 20rpx;
  70. border-radius: 12px;
  71. border: 1px solid #FFFFFF;
  72. padding: 20rpx;
  73. overflow: hidden;
  74. .title{
  75. font-weight: 400;
  76. font-size: 30rpx;
  77. color: #01243A;
  78. margin: 30rpx 0;
  79. }
  80. }
  81. .action {
  82. position: fixed;
  83. left: 0;
  84. bottom: 0;
  85. height: 160rpx;
  86. background-color: #fff;
  87. border-radius: 30rpx 30rpx 0 0;
  88. width: 100vw;
  89. display: flex;
  90. align-items: center;
  91. justify-content: space-evenly;
  92. flex-direction: column;
  93. margin-top: 20rpx;
  94. }
  95. </style>