codeing.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view class="pt-10 pr-60 pl-60">
  3. <view class="lh-0">
  4. <image
  5. src="../images/charge-input-head.png"
  6. mode="widthFix"
  7. style="width: 100%"
  8. ></image>
  9. </view>
  10. <view class="mt-20">
  11. <style-input
  12. title="充电编码"
  13. :value="value"
  14. :focus="focus"
  15. type="text"
  16. @input="input"
  17. />
  18. </view>
  19. <view style="margin-top: 100rpx">
  20. <style-button type="primary" @click="submit">确认</style-button>
  21. <view class="mt-20"></view>
  22. <style-button type="primary" :border="true" @click="scanCode"
  23. >扫码充电</style-button
  24. >
  25. </view>
  26. </view>
  27. </template>
  28. <script setup lang="ts">
  29. import { ref } from "vue";
  30. import { scanCode } from "../../utils/code";
  31. const value = ref("");
  32. const focus = ref(true);
  33. const submit = () => {
  34. if (!value.value) {
  35. uni.showToast({
  36. title: "请输入充电编码",
  37. icon: "none",
  38. });
  39. return;
  40. }
  41. uni.navigateTo({
  42. url: `/pages-charge/ordering/ordering?sn=${value.value}`,
  43. });
  44. };
  45. const input = (e: any) => {
  46. value.value = e.value;
  47. };
  48. </script>