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.

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