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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <view class="oderPage">
  3. <u-form :model="form" ref="myForm" :error-type="errorType">
  4. <view class="from">
  5. <u-form-item prop="cardState">
  6. <view class="from_item">
  7. <text><text style="color: red;">*</text>是否有卡注销:</text>
  8. <u-radio-group v-model="form.cardState">
  9. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  10. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  11. :name="item.name" @change="radioChange">
  12. {{item.name}}
  13. </u-radio>
  14. </u-radio-group>
  15. </view>
  16. </u-form-item>
  17. <u-form-item prop="equipmentState">
  18. <view class="from_item">
  19. <text><text style="color: red;">*</text>是否有设备注销::</text>
  20. <u-radio-group v-model="form.equipmentState">
  21. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  22. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  23. :name="item.name" @change="radioChange">
  24. {{item.name}}
  25. </u-radio>
  26. </u-radio-group>
  27. </view>
  28. </u-form-item>
  29. <u-form-item prop="phone">
  30. <view class="from_item" style="background-color: #F7F7F7;">
  31. <text><text style="color: red;"></text>手机号:</text>
  32. <u-input v-model="form.phone" class="input" />
  33. </view>
  34. </u-form-item>
  35. <u-form-item prop="code">
  36. <view class="from_item">
  37. <text><text style="color: red;"></text>验证码:</text>
  38. <u-input v-model="form.code" class="input" />
  39. <view class="btn">
  40. 获取验证码
  41. </view>
  42. </view>
  43. </u-form-item>
  44. </view>
  45. </u-form>
  46. <!-- <view class="from1">
  47. <uni-forms ref="form_ref" :modelValue="form" :rules="rules">
  48. <uni-forms-item label="是否有卡注销" name="bank" label-width="112" required>
  49. <uni-data-checkbox v-model="form.cardState" class="radio" :localdata="range"
  50. @change="radioChange" />
  51. </uni-forms-item>
  52. <uni-forms-item label="是否有设备注销" name="bankID" label-width="112" required>
  53. <uni-data-checkbox v-model="form.equipmentState" class="radio" :localdata="range"
  54. @change="radioChange" />
  55. </uni-forms-item>
  56. <uni-forms-item label="手机号" name="phone" label-width="112" required>
  57. <uni-easyinput type="text" v-model="form.phone" :inputBorder="false"
  58. placeholderStyle="font-size: 28rpx;" placeholder="请输入" />
  59. </uni-forms-item>
  60. <uni-forms-item label="验证码" name="code" label-width="112">
  61. <uni-easyinput type="text" v-model="form.code" :inputBorder="false"
  62. placeholderStyle="font-size: 28rpx;" placeholder="请输入" />
  63. <view class="btn">
  64. 获取验证码
  65. </view>
  66. </uni-forms-item>
  67. </uni-forms>
  68. </view> -->
  69. <button class="submit" @click="toPage()">下一步</button>
  70. </view>
  71. </template>
  72. <script setup lang="ts">
  73. import navBar from "./components/nav-bar.vue"
  74. import {
  75. checkStr
  76. } from "@/utils/utils"
  77. import {
  78. ref,
  79. reactive
  80. } from "vue";
  81. import {
  82. navTo
  83. } from "../../utils/utils"
  84. import {
  85. onReady
  86. } from "@dcloudio/uni-app";
  87. // 表单数据
  88. const form = reactive({
  89. cardState: "",
  90. equipmentState: "",
  91. phone: "18223323235",
  92. code: ""
  93. })
  94. // 验证规则
  95. const rules = {
  96. cardState: [{
  97. required: true,
  98. message: '请选择',
  99. trigger: ['change', 'blur'],
  100. }],
  101. equipmentState: [{
  102. required: true,
  103. message: '请选择',
  104. trigger: ['change', 'blur'],
  105. }],
  106. code: [{
  107. required: true,
  108. message: '请输入',
  109. trigger: ['change', 'blur'],
  110. }],
  111. phone: [{
  112. required: true,
  113. message: '请输入手机号',
  114. trigger: ['change', 'blur'],
  115. },
  116. {
  117. // 自定义验证函数,见上说明
  118. validator: (rule, value, callback) => {
  119. // 上面有说,返回true表示校验通过,返回false表示不通过
  120. console.log(checkStr(value, 'mobile'), '0011');
  121. return checkStr(value, 'mobile')
  122. },
  123. message: '手机号码不正确',
  124. trigger: ['change', 'blur'],
  125. }
  126. ],
  127. }
  128. // 验证提示类型(toast要版本为1.3.5才支持)
  129. const errorType = ['toast']
  130. // 设置验证规则
  131. const myForm = ref(null)
  132. onReady(() => {
  133. myForm.value.setRules(rules)
  134. })
  135. // 单选数据列表
  136. const radiolist1 = reactive([{
  137. name: '是',
  138. disabled: false
  139. },
  140. {
  141. name: '否',
  142. disabled: false
  143. },
  144. ], )
  145. // 单选
  146. const radioChange = (n) => {
  147. console.log('radioChange', n);
  148. // if (n == '卡退费') {
  149. // flag.value = true
  150. // console.log(flag.value);
  151. // } else {
  152. // flag.value = false
  153. // console.log(flag.value);
  154. // }
  155. }
  156. //下一步
  157. const toPage = () => {
  158. myForm.value.validate((valid) => {
  159. console.log(valid);
  160. if (valid) {
  161. console.log('验证通过', form);
  162. wx.showModal({
  163. title: '模拟两种情况',
  164. confirmText: '有卡有签',
  165. cancelText: '无卡无签',
  166. success: function(res) {
  167. if (res.confirm) {
  168. console.log('用户点击确定');
  169. navTo('/pages/bluetooth/device-active-step1')
  170. } else if (res.cancel) {
  171. console.log('用户点击取消');
  172. navTo('/after-sale/ETC-log-off/upload-card')
  173. }
  174. }
  175. });
  176. } else {
  177. console.log('验证未通过');
  178. }
  179. })
  180. }
  181. </script>
  182. <style>
  183. page {
  184. width: 100%;
  185. height: 100%;
  186. display: flex;
  187. flex-direction: column;
  188. background-color: ##EEF7F7;
  189. }
  190. </style>
  191. <style lang="scss" scoped>
  192. .oderPage {
  193. flex: 1;
  194. width: 100%;
  195. .from1 {
  196. background-color: #fff;
  197. margin-top: 30rpx;
  198. padding: 0 30rpx;
  199. ::v-deep .uni-forms-item {
  200. border-bottom: 1rpx solid #ccc;
  201. padding: 15rpx 0;
  202. margin-bottom: 0;
  203. .uni-forms-item__label {
  204. font-size: 28rpx;
  205. height: 50rpx;
  206. }
  207. .uni-forms-item__content {
  208. display: flex;
  209. }
  210. .uni-easyinput__content-input {
  211. font-size: 28rpx;
  212. height: 50rpx;
  213. }
  214. }
  215. .btn {
  216. line-height: 38rpx;
  217. font-size: 24rpx;
  218. font-family: Microsoft YaHei;
  219. font-weight: 400;
  220. color: #FFFFFF;
  221. background: #00B38B;
  222. border-radius: 10rpx;
  223. padding: 10rpx 15rpx
  224. }
  225. }
  226. .from {
  227. background-color: #fff;
  228. margin-top: 30rpx;
  229. padding: 0 30rpx;
  230. ::v-deep .u-form-item {
  231. padding: 0;
  232. line-height: normal;
  233. .u-form-item__message {
  234. margin-bottom: 12rpx
  235. }
  236. }
  237. .from_item {
  238. display: flex;
  239. flex-wrap: nowrap;
  240. justify-content: space-between;
  241. align-items: center;
  242. height: 80rpx;
  243. border-bottom: 1rpx solid #DCDCDC;
  244. .btn {
  245. font-size: 24rpx;
  246. font-family: Microsoft YaHei;
  247. font-weight: 400;
  248. color: #FFFFFF;
  249. background: #00B38B;
  250. border-radius: 10rpx;
  251. padding: 10rpx 15rpx;
  252. }
  253. ::v-deep .input {
  254. text-align: left;
  255. flex: 1;
  256. input {
  257. text-align: left;
  258. }
  259. }
  260. }
  261. .from_item1 {
  262. display: flex;
  263. flex-wrap: nowrap;
  264. flex-direction: column;
  265. justify-content: space-between;
  266. padding: 30rpx;
  267. border-bottom: #DCDCDC 1px solid;
  268. input {
  269. text-align: right;
  270. }
  271. .textarea {
  272. background-color: #F1F1F1;
  273. width: 100%;
  274. border-radius: 20rpx;
  275. margin-top: 10rpx;
  276. text-indent: 1rem;
  277. height: 180rpx;
  278. padding: 20rpx;
  279. box-sizing: border-box;
  280. }
  281. }
  282. }
  283. }
  284. .submit {
  285. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  286. width: 670rpx;
  287. height: 80rpx;
  288. color: #fff;
  289. border-radius: 100rpx;
  290. position: fixed;
  291. left: 50%;
  292. transform: translate(-50%);
  293. bottom: 60rpx;
  294. font-size: 32rpx;
  295. }
  296. </style>