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.

go-account.vue 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class='content'>
  3. <view class='content_all'>
  4. <view class="change" @click='change()'>切换</view>
  5. <view v-if="state.inputCarNumber">
  6. <view class="car-input">
  7. <view class="title">车牌号</view>
  8. <car-number-input @numberInputResult="carNumber"></car-number-input>
  9. </view>
  10. <u-form :model="form" ref="form1" label-width=180>
  11. <u-form-item label="车牌颜色"><u-input v-model="state.form.carColor" type="select" :select-open="state.showColor" @click="state.showColor = true" placeholder='车牌颜色'/></u-form-item>
  12. </u-form>
  13. </view>
  14. <u-form :model="form" ref="form1" label-width=180 v-else>
  15. <u-form-item label="请选择车辆"><u-input v-model="state.form.choiceCarVal" type="select" :select-open="state.show" @click="state.show = true" placeholder='请选择车辆'/></u-form-item>
  16. <u-form-item label="车牌颜色"><u-input v-model="state.form.carColor" disabled placeholder='车牌颜色'/></u-form-item>
  17. </u-form>
  18. <u-form :model="form" ref="form1" label-width=180>
  19. <u-form-item label="手机号" class="phoneBox" v-if='state.showPhone'>
  20. <u-input placeholder='手机号' type="number" v-model="state.form.tel" />
  21. <u-button type="success" size="mini" @click="getCode" v-if="waitTime==0">获取验证码</u-button>
  22. <text class="btn" v-else>{{waitTime}}后重试</text>
  23. </u-form-item>
  24. <u-form-item v-if='state.showPhone' label="验证码"><u-input v-model="state.form.code" placeholder='请输入短信验证码'/></u-form-item>
  25. </u-form>
  26. </view>
  27. <u-picker mode="selector" :range="state.array" v-model="state.show" @confirm="regionConfirm"></u-picker>
  28. <u-picker mode="selector" :range="state.colorList" v-model="state.showColor" @confirm="regionConfirmColor"></u-picker>
  29. <button type="success" class='search' @click='goOpen'>开户</button>
  30. </view>
  31. </template>
  32. <script setup lang="ts">
  33. import { reactive,ref } from "vue";
  34. import {request} from "@/utils/network/request.js";
  35. import {sendCode} from "@/utils/network/api.js";
  36. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  37. import { navTo } from "@/utils/utils";
  38. import { msg } from "@/utils/utils";
  39. const state = reactive({
  40. index: 0,
  41. array: ['贵ZJSZ21 蓝色', '贵ZJSZ21 红色', '贵ZJSZ21 绿色', '贵ZJSZ21 白色'],
  42. colorList:['蓝色','白色'],
  43. form:{
  44. choiceCarVal:'',
  45. carColor:'',
  46. tel:'',
  47. code:''
  48. },
  49. show:false,
  50. vehiclePlate:'', //车牌号
  51. showPhone:false, //是否展示车牌号
  52. inputCarNumber:false, //是否需要输入车牌号
  53. showColor:false, //选择车牌颜色
  54. });
  55. let waitTime = ref(0);
  56. const getCode = () => {
  57. console.log(123);
  58. if (state.form.tel) {
  59. sendCodeApi()
  60. codeInterval()
  61. } else {
  62. uni.showToast({
  63. title: '请输入手机号',
  64. icon: 'none'
  65. });
  66. }
  67. }
  68. // 发送验证码
  69. const sendCodeApi = (type) => {
  70. //参数说明
  71. let options = {
  72. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  73. data: {
  74. mobile: state.form.tel
  75. }, //请求参数
  76. method: "POST", //提交方式(默认POST)
  77. showLoading: true, //是否显示加载中(默认显示)
  78. };
  79. //调用方式
  80. request(sendCode, options)
  81. .then((res) => {
  82. let data = stringToJson(res.bizContent)
  83. console.log(data, "#################");
  84. if (data.info == "成功.") {
  85. console.log('######################CCCCCCCCCCCCCCCCC');
  86. }
  87. })
  88. .catch((err) => {
  89. console.log(err);
  90. });
  91. }
  92. //倒计时函数
  93. const codeInterval = () => {
  94. waitTime.value = 60
  95. let timer = setInterval(() => {
  96. if (waitTime.value == 1) {
  97. clearInterval(timer)
  98. }
  99. waitTime.value -= 1
  100. }, 1000)
  101. }
  102. const bindPickerChange=(e)=>{
  103. state.index = e.detail.value
  104. }
  105. // 选择车牌回调
  106. const regionConfirm = (e : any) => {
  107. console.log("e",e)
  108. state.form.choiceCarVal = state.array[e];
  109. state.showPhone=true;
  110. };
  111. // 选择颜色的回调
  112. const regionConfirmColor=(e : any)=>{
  113. state.form.carColor=state.colorList[e]
  114. }
  115. const change=()=>{
  116. console.log("11")
  117. state.inputCarNumber=!state.inputCarNumber
  118. state.form.choiceCarVal='';
  119. state.form.carColor='';
  120. }
  121. const carNumber = (val: any) => {
  122. state.vehiclePlate = val;
  123. };
  124. // 去开户页面
  125. const goOpen=()=>{
  126. // choiceCarVal:'',
  127. // carColor:'',
  128. // tel:'',
  129. // code:''
  130. if(!state.form.choiceCarVal){
  131. msg('请选择车辆');
  132. return;
  133. }
  134. if(!state.form.tel){
  135. msg('请输入手机号');
  136. return;
  137. }
  138. if(!state.form.code){
  139. msg('请输入验证码');
  140. return;
  141. }
  142. navTo(`/subpackage/after-sale/account-recharge/open-account`);
  143. }
  144. </script>
  145. <style scoped>
  146. .content{
  147. background-color:rgb(246,246,246);
  148. height:100vh;
  149. }
  150. .content_all{
  151. background-color:white;
  152. }
  153. .change{
  154. text-align: right;
  155. padding-right: 20rpx;
  156. font-size: 32rpx;
  157. }
  158. .item{
  159. display:flex;
  160. border-bottom:2rpx solid rgb(239,239,239);
  161. padding: 18rpx 36rpx;
  162. font-size:32rpx;
  163. align-items: center;
  164. }
  165. /deep/.u-form{
  166. padding:0 40rpx !important;
  167. }
  168. .btn {
  169. flex: 1;
  170. background: rgb(25,190,107);
  171. font-size: 30rpx;
  172. color: white;
  173. z-index: 999;
  174. text-align: center;
  175. border-radius: 10rpx;
  176. }
  177. ::v-deep .u-form-item--right__content__slot{
  178. display: flex;
  179. justify-content: space-between;
  180. }
  181. .title{
  182. margin-top: -32rpx;
  183. font-size: 32rpx;
  184. margin-bottom: 40rpx;
  185. margin-left:30rpx;
  186. }
  187. .search{
  188. background-color: rgb(25,190,107);
  189. color: white;
  190. height: 100rpx;
  191. line-height: 100rpx;
  192. font-size: 40rpx;
  193. margin-top: 70rpx;
  194. }
  195. </style>