您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

verification-huanhuo.vue 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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" @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. changeCardObuExchangeApply,
  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: '1',
  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. id:""
  108. });
  109. // 单选数据列表
  110. const radiolist1 = reactive([{
  111. name: "卡",
  112. val: "1",
  113. },
  114. {
  115. name: "OBU",
  116. val: "2",
  117. }, {
  118. name: "卡和OBU",
  119. val: "3",
  120. },
  121. ]);
  122. // 单选数据列表
  123. const radiolist2 = reactive([{
  124. name: "人为损坏",
  125. val: "1",
  126. },
  127. {
  128. name: "自然损坏",
  129. val: "2",
  130. }
  131. ]);
  132. // 验证规则
  133. const rules = {
  134. code: [{
  135. required: true,
  136. message: "请输入验证码",
  137. trigger: ["change", "blur"],
  138. }],
  139. };
  140. // 验证提示类型(toast要版本为1.3.5才支持)
  141. const errorType = ["toast"];
  142. // 设置验证规则
  143. const myForm = ref(null);
  144. //倒计时时常
  145. const codeDuration = ref(0);
  146. let interval = null;
  147. /* 验证码倒计时 */
  148. const codeInterval = () => {
  149. codeDuration.value = 60;
  150. interval = setInterval(() => {
  151. codeDuration.value--;
  152. if (codeDuration.value === 0) {
  153. if (interval) {
  154. clearInterval(interval);
  155. interval = null;
  156. }
  157. }
  158. }, 1000);
  159. };
  160. onReady(() => {
  161. myForm.value.setRules(rules);
  162. });
  163. onLoad((option) => {
  164. form.mobile = option.mobile
  165. params.cardId = option.cardId
  166. params.obuId = option.obuId
  167. params.id = option.id
  168. params.orderId = option.orderId
  169. state.vehicleId = option.vehicleId
  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 == 2) {
  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 queryCckChangejzCardAction = () => {
  218. if (form.damageMode == "2") {
  219. if (state.imageList.length == 0) {
  220. msg('请上传图片');
  221. return;
  222. }
  223. }
  224. var data = {
  225. orderId: params.orderId,
  226. exchangeType: form.applyType, //换货类型 1-只换卡 2-只换签 3-卡签都换
  227. damageMode: form.damageMode,//0 --- 人为损坏 1 --- 自然损坏 当为换卡签的时候必传
  228. fileUrl: state.imageList.toString(),
  229. vehicleId:state.vehicleId,
  230. oldCardId:params.cardId,
  231. id:params.id // 售后订单 id
  232. };
  233. const options = {
  234. type: 2,
  235. data: data,
  236. method: "POST",
  237. showLoading: true,
  238. };
  239. return new Promise(async (resolve, reject) => {
  240. const res = await requestNew(changeCardObuExchangeApply, options);
  241. var resultData = res
  242. console.log("data88888", resultData)
  243. resolve(res);
  244. }).catch((error) => {
  245. reject(error);
  246. });
  247. }
  248. //下一步
  249. const toPage = () => {
  250. console.log("sdkchkdscn", apply.data)
  251. console.log("form.damageMode", form.damageMode,form.applyType)
  252. queryCckChangejzCardAction().then(val => {
  253. console.log("val888888", val)
  254. navTo(
  255. `/subpackage/after-sale/replace-equipment/form-huanhuo?orderId=${params.orderId}&&id=${val}&&damageMode=${form.damageMode}&&oldCardId=${params.cardId}&&oldObuId=${params.obuId}&&vehicleId=${state.vehicleId}`
  256. )
  257. })
  258. };
  259. </script>
  260. <style>
  261. page {
  262. width: 100%;
  263. height: 100%;
  264. display: flex;
  265. flex-direction: column;
  266. background-color: ##eef7f7;
  267. }
  268. </style>
  269. <style lang="scss" scoped>
  270. .radios {
  271. display: flex;
  272. }
  273. .radio-box {
  274. display: flex;
  275. align-items: center;
  276. padding-left: 20rpx;
  277. }
  278. .hint2 {
  279. display: flex;
  280. .green {
  281. font-size: 28rpx;
  282. color: #00b38b;
  283. }
  284. .grey {
  285. font-size: 24rpx;
  286. color: #000000;
  287. margin-left: 16rpx;
  288. }
  289. }
  290. .oderPage {
  291. flex: 1;
  292. width: 100%;
  293. .from1 {
  294. background-color: #fff;
  295. margin-top: 30rpx;
  296. padding: 0 30rpx;
  297. ::v-deep .uni-forms-item {
  298. border-bottom: 1rpx solid #ccc;
  299. padding: 15rpx 0;
  300. margin-bottom: 0;
  301. .uni-forms-item__label {
  302. font-size: 28rpx;
  303. height: 50rpx;
  304. }
  305. .uni-forms-item__content {
  306. display: flex;
  307. }
  308. .uni-easyinput__content-input {
  309. font-size: 28rpx;
  310. height: 50rpx;
  311. }
  312. }
  313. .btn {
  314. line-height: 38rpx;
  315. font-size: 24rpx;
  316. font-family: Microsoft YaHei;
  317. font-weight: 400;
  318. color: #ffffff;
  319. background: #00b38b;
  320. border-radius: 10rpx;
  321. padding: 10rpx 15rpx;
  322. }
  323. }
  324. .from {
  325. background-color: #fff;
  326. margin-top: 30rpx;
  327. padding: 0 30rpx;
  328. ::v-deep .u-form-item {
  329. padding: 0;
  330. line-height: normal;
  331. .u-form-item__message {
  332. margin-bottom: 12rpx;
  333. }
  334. }
  335. .from_item {
  336. display: flex;
  337. flex-wrap: nowrap;
  338. justify-content: space-between;
  339. align-items: center;
  340. height: 80rpx;
  341. border-bottom: 1rpx solid #dcdcdc;
  342. .btn {
  343. font-size: 24rpx;
  344. font-family: Microsoft YaHei;
  345. font-weight: 400;
  346. color: #ffffff;
  347. background: #00b38b;
  348. border-radius: 10rpx;
  349. padding: 10rpx 15rpx;
  350. }
  351. ::v-deep .input {
  352. text-align: left;
  353. flex: 1;
  354. background: transparent;
  355. input {
  356. text-align: left;
  357. }
  358. }
  359. }
  360. .from_item1 {
  361. display: flex;
  362. flex-wrap: nowrap;
  363. flex-direction: column;
  364. justify-content: space-between;
  365. padding: 30rpx;
  366. border-bottom: #dcdcdc 1px solid;
  367. input {
  368. text-align: right;
  369. }
  370. .textarea {
  371. background-color: #f1f1f1;
  372. width: 100%;
  373. border-radius: 20rpx;
  374. margin-top: 10rpx;
  375. text-indent: 1rem;
  376. height: 180rpx;
  377. padding: 20rpx;
  378. box-sizing: border-box;
  379. }
  380. }
  381. }
  382. }
  383. .btn-wrapper {
  384. display: flex;
  385. padding-top: 60rpx;
  386. }
  387. .button::after {
  388. border: none;
  389. }
  390. .default {
  391. height: 80rpx;
  392. background: rgba(0, 179, 139, .1);
  393. border-radius: 40rpx;
  394. font-size: 32rpx;
  395. font-weight: 400;
  396. color: #00B38B;
  397. line-height: 80rpx;
  398. width: 45%;
  399. border: 1px solid #00B38B;
  400. }
  401. .submit {
  402. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  403. height: 80rpx;
  404. line-height: 80rpx;
  405. color: #fff;
  406. border-radius: 100rpx;
  407. font-size: 32rpx;
  408. width: 45%;
  409. }
  410. .upload-img {
  411. margin-top: 10rpx;
  412. }
  413. .please {
  414. font-size: 28rpx;
  415. margin-bottom: 20rpx;
  416. }
  417. .attention {
  418. padding: 20rpx;
  419. font-size: 28rpx;
  420. }
  421. </style>