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

verification.vue 11KB

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