選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

verification.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  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. <radio-group @change="radioChange" class="radios">
  9. <block v-for="(item, index) in radiolist1" :key="item.val">
  10. <view class="radio-box">
  11. <radio :value="item.val" :checked="form.applyType == item.val" color="#13e7c1"
  12. style="transform:scale(0.75)" />
  13. <view>{{item.name}}</view>
  14. </view>
  15. </block>
  16. </radio-group>
  17. </view>
  18. </u-form-item>
  19. <u-form-item prop="cardState">
  20. <view class="from_item">
  21. <text><text style="color: red">*</text>设备损坏类型:</text>
  22. <radio-group @change="typeChange" class="radios">
  23. <block v-for="(item, index) in radiolist2" :key="item.val">
  24. <view class="radio-box">
  25. <radio :value="item.val" :checked="form.damageMode == item.val" color="#13e7c1"
  26. style="transform:scale(0.75)" />
  27. <view>{{item.name}}</view>
  28. </view>
  29. </block>
  30. </radio-group>
  31. </view>
  32. </u-form-item>
  33. </view>
  34. </u-form>
  35. <view style="margin: 30rpx;" v-if="state.isPicture">
  36. <view class="please"><text style="color: red">*</text>请上传图片:</view>
  37. <uni-file-picker fileMediatype="image" mode="grid" :limit="9" @select="select"
  38. :image-styles="state.imageStyles" />
  39. </view>
  40. <view class="attention">
  41. <view>注意事项:</view>
  42. <view>1.设备人为损坏时需要支付设备费用;</view>
  43. <view>2.设备自然损坏时:</view>
  44. <view>&nbsp;(1)更换的设备中有设备不在质保期内,需要支付对应的设备费用;</view>
  45. <view>&nbsp;(2)选择自然损坏需要将损坏的设备寄回,不寄回则视为人为损坏,需要支付设备费用;</view>
  46. <view>&nbsp;(3)寄回的设备由专业人员进行检测,检测结果为自然损坏且在质保期内,则免费更换,检测结果为人为损坏则需要支付设备费用;</view>
  47. <view>3.设备费用,卡20元,obu130元。</view>
  48. </view>
  49. <view class="btn-wrapper">
  50. <button class="submit button" v-if="apply.data.status === 'APPLY'||!apply.data.status" @click="toPage()"
  51. type="default">下一步填写资料</button>
  52. </view>
  53. </view>
  54. </template>
  55. <script setup lang="ts">
  56. import {
  57. ref,
  58. reactive
  59. } from "vue";
  60. import {
  61. navTo, uploadFile
  62. } from "@/utils/utils";
  63. import {
  64. onReady,
  65. onLoad,
  66. onShow,
  67. } from "@dcloudio/uni-app";
  68. import {requestNew} from "@/utils/network/request.js";
  69. import {
  70. sendMessage,
  71. changeCardObuApply,
  72. changeCardObuFillQuery
  73. } from "@/utils/network/api.js";
  74. import {
  75. msg
  76. } from "@/utils/utils";
  77. const state = reactive({
  78. imageList: [], //图片数据
  79. imageStyles: {
  80. width: 80,
  81. height: 80,
  82. },
  83. isPicture: false, //是否上传图片
  84. vehicleId:"",
  85. })
  86. // 表单数据
  87. const form = reactive({
  88. damageMode: "0",
  89. damageModeName: '人为损坏',
  90. applyType: 'EXCHANGE_CARD',
  91. applyTypeName: '卡',
  92. mobile: "",
  93. code: '',
  94. applyRes: ''
  95. });
  96. const apply = reactive({
  97. data: {
  98. status: undefined,
  99. id: ''
  100. }
  101. });
  102. //入参
  103. const params = reactive({
  104. cardId: '',
  105. obuId: '',
  106. orderId: ''
  107. });
  108. // 单选数据列表
  109. const radiolist1 = reactive([{
  110. name: "卡",
  111. val: "EXCHANGE_CARD",
  112. },
  113. {
  114. name: "OBU",
  115. val: "EXCHANGE_OBU",
  116. }, {
  117. name: "卡和OBU",
  118. val: "EXCHANGE_ALL",
  119. },
  120. ]);
  121. // 单选数据列表
  122. const radiolist2 = reactive([{
  123. name: "人为损坏",
  124. val: "0",
  125. },
  126. {
  127. name: "自然损坏",
  128. val: "1",
  129. }
  130. ]);
  131. // 验证规则
  132. const rules = {
  133. code: [{
  134. required: true,
  135. message: "请输入验证码",
  136. trigger: ["change", "blur"],
  137. }],
  138. };
  139. // 验证提示类型(toast要版本为1.3.5才支持)
  140. const errorType = ["toast"];
  141. // 设置验证规则
  142. const myForm = ref(null);
  143. //倒计时时常
  144. const codeDuration = ref(0);
  145. let interval = null;
  146. /* 验证码倒计时 */
  147. const codeInterval = () => {
  148. codeDuration.value = 60;
  149. interval = setInterval(() => {
  150. codeDuration.value--;
  151. if (codeDuration.value === 0) {
  152. if (interval) {
  153. clearInterval(interval);
  154. interval = null;
  155. }
  156. }
  157. }, 1000);
  158. };
  159. onReady(() => {
  160. myForm.value.setRules(rules);
  161. });
  162. onLoad((option) => {
  163. form.mobile = option.mobile
  164. params.cardId = option.cardId
  165. params.orderId = option.orderId
  166. state.vehicleId = option.vehicleId
  167. });
  168. onShow(() => {
  169. changeCardQueryAction()
  170. })
  171. const select = (e) => {
  172. console.log('选择文件:', e)
  173. uploadFile(e.tempFilePaths[0], "", "").then((data) => {
  174. const imgArr = state.imageList
  175. imgArr.push(data)
  176. state.imageList = imgArr;
  177. console.log("data.data.url", state.imageList)
  178. })
  179. }
  180. // 单选
  181. const radioChange = (e : any) => {
  182. console.log(e);
  183. form.applyType = e.detail.value
  184. };
  185. // 单选
  186. const typeChange = (e : any) => {
  187. console.log(e);
  188. form.damageMode = e.detail.value
  189. if (e.detail.value == 1) {
  190. state.isPicture = true
  191. } else {
  192. state.isPicture = false
  193. }
  194. };
  195. const getCode = () => {
  196. if (codeDuration.value !== 0) {
  197. return;
  198. }
  199. const options = {
  200. type: 2,
  201. data: {
  202. mobile: form.mobile
  203. },
  204. method: "POST",
  205. showLoading: true,
  206. };
  207. requestNew(sendMessage, options)
  208. .then((res) => {
  209. codeInterval();
  210. msg("验证码发送成功!");
  211. })
  212. .catch((err) => {
  213. console.log(err);
  214. });
  215. }
  216. //查询申请单
  217. const changeCardQueryAction = () => {
  218. var data = {
  219. vehicleId: state.vehicleId
  220. };
  221. const options = {
  222. type: 2,
  223. data: data,
  224. method: "POST",
  225. showLoading: true,
  226. };
  227. requestNew(changeCardObuFillQuery, options).then((res) => {
  228. const data = res;
  229. if (data) {
  230. apply.data = data;
  231. apply.data.status = data.status;
  232. }
  233. })
  234. }
  235. //申请
  236. const queryCckChangejzCardAction = () => {
  237. if (form.damageMode == "1") {
  238. if (state.imageList.length == 0) {
  239. msg('请上传图片');
  240. return;
  241. }
  242. }
  243. var data = {
  244. orderId: params.orderId,
  245. applyType: form.applyType,
  246. damageMode: form.damageMode,//0 --- 人为损坏 1 --- 自然损坏 当为换卡签的时候必传
  247. fileUrl: state.imageList.toString(),
  248. vehicleId:state.vehicleId,
  249. };
  250. const options = {
  251. type: 2,
  252. data: data,
  253. method: "POST",
  254. showLoading: true,
  255. };
  256. return new Promise(async (resolve, reject) => {
  257. const res = await requestNew(changeCardObuApply, options);
  258. var resultData = res
  259. console.log("data88888", resultData)
  260. resolve(res);
  261. }).catch((error) => {
  262. reject(error);
  263. });
  264. }
  265. //下一步
  266. const toPage = () => {
  267. console.log("sdkchkdscn", apply.data)
  268. console.log("form.damageMode", form.damageMode,form.applyType)
  269. if(form.damageMode==0){
  270. let money=0
  271. if(form.applyType=='EXCHANGE_CARD'){
  272. money=20
  273. }else if(form.applyType=='EXCHANGE_OBU'){
  274. money=130
  275. }else {
  276. money=150
  277. }
  278. uni.showModal({
  279. title: '提示',
  280. content: '费用需要您自理,金额是'+money+'元',
  281. success: function (res) {
  282. if (res.confirm) {
  283. queryCckChangejzCardAction().then(val => {
  284. console.log("val888888", val)
  285. navTo(
  286. `/subpackage/after-sale/replace-equipment/form?orderId=${params.orderId}&&id=${val.id}&&damageMode=${form.damageMode}&&msg=${val.msg}&&cardExpire=${val.cardExpire}&&obuExpire=${val.obuExpire}`
  287. )
  288. })
  289. } else if (res.cancel) {
  290. console.log('用户点击取消');
  291. }
  292. }
  293. });
  294. }else{
  295. queryCckChangejzCardAction().then(val => {
  296. console.log("val888888", val)
  297. navTo(
  298. `/subpackage/after-sale/replace-equipment/form?orderId=${params.orderId}&&id=${val.id}&&damageMode=${form.damageMode}&&msg=${val.msg}&&cardExpire=${val.cardExpire}&&obuExpire=${val.obuExpire}`
  299. )
  300. })
  301. }
  302. };
  303. </script>
  304. <style>
  305. page {
  306. width: 100%;
  307. height: 100%;
  308. display: flex;
  309. flex-direction: column;
  310. background-color: ##eef7f7;
  311. }
  312. </style>
  313. <style lang="scss" scoped>
  314. .radios {
  315. display: flex;
  316. }
  317. .radio-box {
  318. display: flex;
  319. align-items: center;
  320. padding-left: 20rpx;
  321. }
  322. .hint2 {
  323. display: flex;
  324. .green {
  325. font-size: 28rpx;
  326. color: #00b38b;
  327. }
  328. .grey {
  329. font-size: 24rpx;
  330. color: #000000;
  331. margin-left: 16rpx;
  332. }
  333. }
  334. .oderPage {
  335. flex: 1;
  336. width: 100%;
  337. .from1 {
  338. background-color: #fff;
  339. margin-top: 30rpx;
  340. padding: 0 30rpx;
  341. ::v-deep .uni-forms-item {
  342. border-bottom: 1rpx solid #ccc;
  343. padding: 15rpx 0;
  344. margin-bottom: 0;
  345. .uni-forms-item__label {
  346. font-size: 28rpx;
  347. height: 50rpx;
  348. }
  349. .uni-forms-item__content {
  350. display: flex;
  351. }
  352. .uni-easyinput__content-input {
  353. font-size: 28rpx;
  354. height: 50rpx;
  355. }
  356. }
  357. .btn {
  358. line-height: 38rpx;
  359. font-size: 24rpx;
  360. font-family: Microsoft YaHei;
  361. font-weight: 400;
  362. color: #ffffff;
  363. background: #00b38b;
  364. border-radius: 10rpx;
  365. padding: 10rpx 15rpx;
  366. }
  367. }
  368. .from {
  369. background-color: #fff;
  370. margin-top: 30rpx;
  371. padding: 0 30rpx;
  372. ::v-deep .u-form-item {
  373. padding: 0;
  374. line-height: normal;
  375. .u-form-item__message {
  376. margin-bottom: 12rpx;
  377. }
  378. }
  379. .from_item {
  380. display: flex;
  381. flex-wrap: nowrap;
  382. justify-content: space-between;
  383. align-items: center;
  384. height: 80rpx;
  385. border-bottom: 1rpx solid #dcdcdc;
  386. .btn {
  387. font-size: 24rpx;
  388. font-family: Microsoft YaHei;
  389. font-weight: 400;
  390. color: #ffffff;
  391. background: #00b38b;
  392. border-radius: 10rpx;
  393. padding: 10rpx 15rpx;
  394. }
  395. ::v-deep .input {
  396. text-align: left;
  397. flex: 1;
  398. background: transparent;
  399. input {
  400. text-align: left;
  401. }
  402. }
  403. }
  404. .from_item1 {
  405. display: flex;
  406. flex-wrap: nowrap;
  407. flex-direction: column;
  408. justify-content: space-between;
  409. padding: 30rpx;
  410. border-bottom: #dcdcdc 1px solid;
  411. input {
  412. text-align: right;
  413. }
  414. .textarea {
  415. background-color: #f1f1f1;
  416. width: 100%;
  417. border-radius: 20rpx;
  418. margin-top: 10rpx;
  419. text-indent: 1rem;
  420. height: 180rpx;
  421. padding: 20rpx;
  422. box-sizing: border-box;
  423. }
  424. }
  425. }
  426. }
  427. .btn-wrapper {
  428. display: flex;
  429. padding-top: 60rpx;
  430. }
  431. .button::after {
  432. border: none;
  433. }
  434. .default {
  435. height: 80rpx;
  436. background: rgba(0, 179, 139, .1);
  437. border-radius: 40rpx;
  438. font-size: 32rpx;
  439. font-weight: 400;
  440. color: #00B38B;
  441. line-height: 80rpx;
  442. width: 45%;
  443. border: 1px solid #00B38B;
  444. }
  445. .submit {
  446. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  447. height: 80rpx;
  448. line-height: 80rpx;
  449. color: #fff;
  450. border-radius: 100rpx;
  451. font-size: 32rpx;
  452. width: 45%;
  453. }
  454. .upload-img {
  455. margin-top: 10rpx;
  456. }
  457. .please {
  458. font-size: 28rpx;
  459. margin-bottom: 20rpx;
  460. }
  461. .attention {
  462. padding: 20rpx;
  463. font-size: 28rpx;
  464. }
  465. </style>