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.

etc-log-off.vue 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="oderPage">
  3. <u-form :model="form" ref="myForm" :error-type="errorType">
  4. <view class="from">
  5. <u-form-item v-if="(form.type==='2'||form.type==='3')" prop="equipmentState">
  6. <view class="from_item">
  7. <text><text style="color: red">*</text>是否有设备注销::</text>
  8. <!-- <u-radio-group v-model="form.equipmentStateName">
  9. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  10. v-for="(item, index) in radiolist" :key="index" :label="item.disabled" :name="item.name"
  11. @change="radioChange(item)">
  12. {{ item.name }}
  13. </u-radio>
  14. </u-radio-group> -->
  15. <radio-group @change="radioChange" class="radios">
  16. <block v-for="(item, index) in radiolist" :key="item.val">
  17. <view class="radio-box">
  18. <radio :value="item.val" :checked="form.equipmentState == item.val" color="#13e7c1"
  19. style="transform:scale(0.75)" />
  20. <view>{{item.name}}</view>
  21. </view>
  22. </block>
  23. </radio-group>
  24. </view>
  25. </u-form-item>
  26. <u-form-item prop="phone">
  27. <view class="from_item" style="background-color: #f7f7f7">
  28. <text><text style="color: red"></text>手机号:</text>
  29. <u-input v-model="form.mobile" class="input" />
  30. </view>
  31. </u-form-item>
  32. <u-form-item prop="code">
  33. <view class="from_item">
  34. <text><text style="color: red"></text>验证码:</text>
  35. <u-input v-model="form.code" placeholder="请输入验证码" class="input" />
  36. <view class="hint2">
  37. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  38. <view class="grey" @click="getCode">{{
  39. codeDuration === 0 ? "发送验证码" : "秒后可重发"
  40. }}</view>
  41. </view>
  42. </view>
  43. </u-form-item>
  44. </view>
  45. </u-form>
  46. <button class="submit" @click="toPage()">下一步</button>
  47. </view>
  48. </template>
  49. <script setup lang="ts">
  50. import navBar from "./components/nav-bar.vue";
  51. import {
  52. checkStr
  53. } from "@/utils/utils";
  54. import {
  55. ref,
  56. reactive
  57. } from "vue";
  58. import {
  59. navTo
  60. } from "@/utils/utils";
  61. import {
  62. onReady,
  63. onLoad
  64. } from "@dcloudio/uni-app";
  65. import {
  66. request
  67. } from "@/utils/network/request.js";
  68. import {
  69. sendCode,
  70. checkCode
  71. } from "@/utils/network/api.js";
  72. import {
  73. msg
  74. } from "@/utils/utils";
  75. // 表单数据
  76. const form = reactive({
  77. equipmentState: 2,
  78. equipmentStateName: "否",
  79. mobile: "",
  80. code: '',
  81. type: undefined,
  82. });
  83. //入参
  84. const params = reactive({
  85. cardId: '',
  86. obuId: '',
  87. orderId: ''
  88. });
  89. // 验证规则
  90. const rules = {
  91. code: [{
  92. required: true,
  93. message: "请输入验证码",
  94. trigger: ["change", "blur"],
  95. }],
  96. };
  97. // 验证提示类型(toast要版本为1.3.5才支持)
  98. const errorType = ["toast"];
  99. // 单选数据列表
  100. const radiolist = reactive([{
  101. name: "是",
  102. val: 1,
  103. },
  104. {
  105. name: "否",
  106. val: 2,
  107. },
  108. ]);
  109. // 设置验证规则
  110. const myForm = ref(null);
  111. //倒计时时常
  112. const codeDuration = ref(0);
  113. let interval = null;
  114. /* 验证码倒计时 */
  115. const codeInterval = () => {
  116. codeDuration.value = 60;
  117. interval = setInterval(() => {
  118. codeDuration.value--;
  119. if (codeDuration.value === 0) {
  120. if (interval) {
  121. clearInterval(interval);
  122. interval = null;
  123. }
  124. }
  125. }, 1000);
  126. };
  127. onReady(() => {
  128. myForm.value.setRules(rules);
  129. });
  130. onLoad((option) => {
  131. form.mobile = option.mobile
  132. form.type = option.type
  133. params.cardId = option.cardId
  134. params.obuId = option.obuId
  135. params.orderId = option.orderId
  136. });
  137. const getCode = () => {
  138. if (codeDuration.value !== 0) {
  139. return;
  140. }
  141. const options = {
  142. type: 2,
  143. data: {
  144. mobile: form.mobile
  145. },
  146. method: "POST",
  147. showLoading: true,
  148. };
  149. request(sendCode, options)
  150. .then((res) => {
  151. codeInterval();
  152. msg("验证码发送成功!");
  153. })
  154. .catch((err) => {
  155. console.log(err);
  156. });
  157. }
  158. // 单选
  159. const radioChange = (e : any) => {
  160. console.log(e);
  161. form.equipmentState = e.detail.value
  162. // if (val.name === '是') {
  163. // form.equipmentState = '1';
  164. // } else {
  165. // form.equipmentState = '2';
  166. // }
  167. };
  168. //下一步
  169. const toPage = () => {
  170. myForm.value.validate((valid) => {
  171. console.log(valid);
  172. if (valid) {
  173. const options = {
  174. type: 2,
  175. data: {
  176. mobile: form.mobile,
  177. code: form.code
  178. },
  179. method: "POST",
  180. showLoading: true,
  181. };
  182. request(checkCode, options)
  183. .then(() => {
  184. navTo(
  185. `/subpackage/after-sale/ETC-log-off/upload-card?obuId=${params.obuId}&&cardId=${params.cardId}&&orderId=${params.orderId}&&equipmentState=${form.equipmentState}`
  186. );
  187. })
  188. .catch((err) => {
  189. console.log(err);
  190. });
  191. } else {
  192. console.log("验证未通过");
  193. }
  194. });
  195. };
  196. </script>
  197. <style>
  198. page {
  199. width: 100%;
  200. height: 100%;
  201. display: flex;
  202. flex-direction: column;
  203. background-color: ##eef7f7;
  204. }
  205. </style>
  206. <style lang="scss" scoped>
  207. .radios {
  208. display: flex;
  209. }
  210. .radio-box {
  211. display: flex;
  212. align-items: center;
  213. padding-left: 40rpx;
  214. }
  215. .hint2 {
  216. display: flex;
  217. .green {
  218. font-size: 28rpx;
  219. color: #00b38b;
  220. }
  221. .grey {
  222. font-size: 24rpx;
  223. color: #000000;
  224. margin-left: 16rpx;
  225. }
  226. }
  227. .oderPage {
  228. flex: 1;
  229. width: 100%;
  230. .from1 {
  231. background-color: #fff;
  232. margin-top: 30rpx;
  233. padding: 0 30rpx;
  234. ::v-deep .uni-forms-item {
  235. border-bottom: 1rpx solid #ccc;
  236. padding: 15rpx 0;
  237. margin-bottom: 0;
  238. .uni-forms-item__label {
  239. font-size: 28rpx;
  240. height: 50rpx;
  241. }
  242. .uni-forms-item__content {
  243. display: flex;
  244. }
  245. .uni-easyinput__content-input {
  246. font-size: 28rpx;
  247. height: 50rpx;
  248. }
  249. }
  250. .btn {
  251. line-height: 38rpx;
  252. font-size: 24rpx;
  253. font-family: Microsoft YaHei;
  254. font-weight: 400;
  255. color: #ffffff;
  256. background: #00b38b;
  257. border-radius: 10rpx;
  258. padding: 10rpx 15rpx;
  259. }
  260. }
  261. .from {
  262. background-color: #fff;
  263. margin-top: 30rpx;
  264. padding: 0 30rpx;
  265. ::v-deep .u-form-item {
  266. padding: 0;
  267. line-height: normal;
  268. .u-form-item__message {
  269. margin-bottom: 12rpx;
  270. }
  271. }
  272. .from_item {
  273. display: flex;
  274. flex-wrap: nowrap;
  275. justify-content: space-between;
  276. align-items: center;
  277. height: 80rpx;
  278. border-bottom: 1rpx solid #dcdcdc;
  279. .btn {
  280. font-size: 24rpx;
  281. font-family: Microsoft YaHei;
  282. font-weight: 400;
  283. color: #ffffff;
  284. background: #00b38b;
  285. border-radius: 10rpx;
  286. padding: 10rpx 15rpx;
  287. }
  288. ::v-deep .input {
  289. text-align: left;
  290. flex: 1;
  291. background: transparent;
  292. input {
  293. text-align: left;
  294. }
  295. }
  296. }
  297. .from_item1 {
  298. display: flex;
  299. flex-wrap: nowrap;
  300. flex-direction: column;
  301. justify-content: space-between;
  302. padding: 30rpx;
  303. border-bottom: #dcdcdc 1px solid;
  304. input {
  305. text-align: right;
  306. }
  307. .textarea {
  308. background-color: #f1f1f1;
  309. width: 100%;
  310. border-radius: 20rpx;
  311. margin-top: 10rpx;
  312. text-indent: 1rem;
  313. height: 180rpx;
  314. padding: 20rpx;
  315. box-sizing: border-box;
  316. }
  317. }
  318. }
  319. }
  320. .submit {
  321. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  322. width: 670rpx;
  323. height: 80rpx;
  324. color: #fff;
  325. border-radius: 100rpx;
  326. position: fixed;
  327. left: 50%;
  328. transform: translate(-50%);
  329. bottom: 60rpx;
  330. font-size: 32rpx;
  331. }
  332. </style>