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.

additional-equipment-verification.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. <template>
  2. <view class="oderPage">
  3. <!-- <view v-if="form.receiveMethodName==='邮寄'" class="addr-box">
  4. <view class="addr-box-left">
  5. <view class="text-image">{{form.customerName.charAt(0)}} </view>
  6. <view class="content">
  7. <view class="">
  8. <text class="item1">{{form.customerName}}</text>
  9. <text class="item2">{{form.customerTel}}</text>
  10. <text class="item3">默认</text>
  11. </view>
  12. <view class=""> {{form.area +form.address}}</view>
  13. </view>
  14. </view>
  15. <view class="edit" @click="address.show = true">
  16. <image :src="`${$imgUrl}applyCard/edit.png`" mode=""></image>
  17. </view>
  18. </view> -->
  19. <view class="addr-box" v-if="form.receiveMethodName==='邮寄'">
  20. <view class="addr-box-left">
  21. <view class="text-image">{{form.customerName.charAt(0)}} </view>
  22. <view class="content">
  23. <view class="">
  24. <text class="item1">{{form.customerName}}</text>
  25. <text class="item2">{{form.customerTel}}</text>
  26. <text class="item3" v-if="form.defaultAddress ==1">默认</text>
  27. </view>
  28. <view class=""> {{form.area +form.address}}</view>
  29. </view>
  30. </view>
  31. <view class="edit" @click="address.show = true">
  32. <image :src="`${$imgUrl}applyCard/edit.png`" mode=""></image>
  33. </view>
  34. </view>
  35. <u-form :model="form" ref="myForm" :error-type="errorType">
  36. <view class="from">
  37. <u-form-item prop="cardState">
  38. <view class="from_item">
  39. <text><text style="color: red">*</text>是否邮寄:</text>
  40. <!-- <u-radio-group v-model="form.receiveMethodName">
  41. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  42. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  43. :name="item.name">
  44. {{ item.name }}
  45. </u-radio>
  46. </u-radio-group> -->
  47. <radio-group @change="radioChange" class="radios">
  48. <block v-for="(item, index) in radiolist1" :key="item.val">
  49. <view class="radio-box">
  50. <radio :value="item.val" :checked="form.receiveMethod == item.val" color="#13e7c1"
  51. style="transform:scale(0.75)" />
  52. <view>{{item.name}}</view>
  53. </view>
  54. </block>
  55. </radio-group>
  56. </view>
  57. </u-form-item>
  58. <!-- <u-form-item prop="phone">
  59. <view class="from_item" style="background-color: #f7f7f7">
  60. <text><text style="color: red"></text>手机号:</text>
  61. <u-input v-model="form.mobile" :disabled="true" class="input" />
  62. </view>
  63. </u-form-item>
  64. <u-form-item prop="code">
  65. <view class="from_item">
  66. <text><text style="color: red"></text>验证码:</text>
  67. <u-input v-model="form.code" placeholder="请输入验证码" class="input" />
  68. <view class="hint2">
  69. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  70. <view class="grey" @click="getCode">{{
  71. codeDuration === 0 ? "发送验证码" : "秒后可重发"
  72. }}</view>
  73. </view>
  74. </view>
  75. </u-form-item> -->
  76. </view>
  77. </u-form>
  78. <button style="margin-top: 50rpx;" class="submit" @click="toPage()">OBU增补申请</button>
  79. </view>
  80. <!-- 地址弹窗 -->
  81. <u-popup mode="bottom" v-model="address.show">
  82. <view class="address-line">
  83. <view v-if="address.list" v-for="(item, index) in address.list" :key="index" @click="addressSelected(item)"
  84. style="margin-bottom: 40rpx" class="flex-bettwen">
  85. <view class="flex">
  86. <view class="xing">
  87. {{ item.consignee.charAt(0) }}
  88. </view>
  89. <view class="content">
  90. <view class="flex">
  91. <view class="name">
  92. {{ item.consignee }}
  93. </view>
  94. <view class="phone">
  95. {{ item.consigneeTel }}
  96. </view>
  97. </view>
  98. <view class="address">
  99. {{ item.region + item.address }}
  100. </view>
  101. </view>
  102. </view>
  103. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  104. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`"
  105. style="width: 48rpx; height: 48rpx"></image>
  106. </view>
  107. </view>
  108. <view :style="address.list ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  109. <button type="default" class="button" @click="goToAddAddress()">
  110. 添加收货地址
  111. </button>
  112. </view>
  113. </view>
  114. </u-popup>
  115. </template>
  116. <script setup lang="ts">
  117. import navBar from "./components/nav-bar.vue";
  118. import {
  119. checkStr
  120. } from "@/utils/utils";
  121. import {
  122. ref,
  123. reactive
  124. } from "vue";
  125. import {
  126. navTo
  127. } from "@/utils/utils";
  128. import {
  129. onReady,
  130. onLoad
  131. } from "@dcloudio/uni-app";
  132. import {
  133. request
  134. } from "@/utils/network/request.js";
  135. import {
  136. getItem,
  137. StorageKeys
  138. } from "@/utils/storage";
  139. import {
  140. sendCode,
  141. checkCode,
  142. addressQuery,
  143. queryOBUAdd,
  144. wechatPayConfigId
  145. } from "@/utils/network/api.js";
  146. import {
  147. stringToJson
  148. } from "@/utils/network/encryption";
  149. import {
  150. msg
  151. } from "@/utils/utils";
  152. // 表单数据
  153. const form = reactive({
  154. receiveMethod: "0",
  155. receiveMethodName: '不邮寄',
  156. customerName: '',
  157. customerTel: '',
  158. mobile: "",
  159. code: '',
  160. address: '',
  161. area: '',
  162. postCode: '',
  163. defaultAddress: 2
  164. });
  165. const apply = reactive({
  166. data: {
  167. status: undefined,
  168. id: ''
  169. }
  170. });
  171. //入参
  172. const params = reactive({
  173. cardId: '',
  174. obuId: '',
  175. orderId: ''
  176. });
  177. // 单选数据列表
  178. const radiolist1 = reactive([{
  179. name: "不邮寄",
  180. val: "0",
  181. },
  182. {
  183. name: "邮寄",
  184. val: "1",
  185. },
  186. ]);
  187. // 单选数据列表
  188. const radiolist2 = reactive([{
  189. name: "人为损坏",
  190. disabled: false,
  191. },
  192. {
  193. name: "自然损坏",
  194. disabled: false,
  195. }
  196. ]);
  197. // 验证规则
  198. const rules = {
  199. code: [{
  200. required: true,
  201. message: "请输入验证码",
  202. trigger: ["change", "blur"],
  203. }],
  204. };
  205. // 验证提示类型(toast要版本为1.3.5才支持)
  206. const errorType = ["toast"];
  207. // 设置验证规则
  208. const myForm = ref(null);
  209. //倒计时时常
  210. const codeDuration = ref(0);
  211. let interval = null;
  212. const address = reactive({
  213. list: [],
  214. show: false
  215. }); //地址list
  216. /* 验证码倒计时 */
  217. const codeInterval = () => {
  218. codeDuration.value = 60;
  219. interval = setInterval(() => {
  220. codeDuration.value--;
  221. if (codeDuration.value === 0) {
  222. if (interval) {
  223. clearInterval(interval);
  224. interval = null;
  225. }
  226. }
  227. }, 1000);
  228. };
  229. onReady(() => {
  230. myForm.value.setRules(rules);
  231. });
  232. onLoad((option) => {
  233. form.mobile = option.mobile
  234. params.cardId = option.cardId
  235. params.orderId = option.orderId
  236. getAddressList()
  237. });
  238. const getAddressList = () => {
  239. var data = {
  240. openId: getItem(StorageKeys.OpenId),
  241. };
  242. const options = {
  243. type: 2,
  244. data: data,
  245. method: "POST",
  246. showLoading: true,
  247. };
  248. request(addressQuery, options).then((res) => {
  249. const data = stringToJson(res.bizContent);
  250. address.list = data.data;
  251. if (address.list.length > 0) {
  252. var defaultAddress = address.list[0]
  253. form.customerName = defaultAddress.consignee
  254. form.customerTel = defaultAddress.consigneeTel
  255. form.address = defaultAddress.address
  256. form.area = defaultAddress.region
  257. form.postCode = defaultAddress.postalCode
  258. }
  259. });
  260. };
  261. const getCode = () => {
  262. if (codeDuration.value !== 0) {
  263. return;
  264. }
  265. const options = {
  266. type: 2,
  267. data: {
  268. mobile: form.mobile
  269. },
  270. method: "POST",
  271. showLoading: true,
  272. };
  273. request(sendCode, options)
  274. .then((res) => {
  275. codeInterval();
  276. msg("验证码发送成功!");
  277. })
  278. .catch((err) => {
  279. console.log(err);
  280. });
  281. }
  282. // 单选
  283. const radioChange = (e : any) => {
  284. console.log(e);
  285. form.receiveMethod = e.detail.value
  286. if (e.detail.value == 1) {
  287. form.receiveMethodName = "邮寄"
  288. } else {
  289. form.receiveMethodName = "不邮寄"
  290. }
  291. // if (val.name === '是') {
  292. // form.equipmentState = '1';
  293. // } else {
  294. // form.equipmentState = '2';
  295. // }
  296. };
  297. //申请
  298. const queryOBUAddAction = () => {
  299. // if (form.receiveMethodName === '不邮寄') {
  300. // form.receiveMethod = '0'
  301. // } else {
  302. // form.receiveMethod = '1'
  303. // }
  304. var data = {
  305. orderId: params.orderId,
  306. openId: getItem(StorageKeys.OpenId),
  307. configId: wechatPayConfigId,
  308. receiveMethod: form.receiveMethod,
  309. customerName: form.customerName,
  310. customerTel: form.customerTel,
  311. address: form.address,
  312. area: form.area,
  313. postCode: form.postCode
  314. };
  315. const options = {
  316. type: 2,
  317. data: data,
  318. method: "POST",
  319. showLoading: true,
  320. };
  321. return new Promise(async (resolve, reject) => {
  322. const res = await request(queryOBUAdd, options);
  323. const data = stringToJson(res.bizContent);
  324. resolve(data);
  325. }).catch((error) => {
  326. reject(error);
  327. });
  328. }
  329. //下一步
  330. const toPage = () => {
  331. queryOBUAddAction().then(val => {
  332. navTo(
  333. `/subpackage/after-sale/additional-equipment/result`
  334. )
  335. })
  336. };
  337. const addressSelected = (val : any) => {
  338. console.log(val);
  339. // state.data = {
  340. // ...state.data,
  341. // ...val,
  342. // };
  343. // state.show = false;
  344. form.customerName = val.consignee
  345. form.customerTel = val.consigneeTel
  346. form.address = val.address
  347. form.area = val.region
  348. form.postCode = val.postalCode
  349. form.defaultAddress = val.defaultAddress
  350. address.show = false
  351. console.log("form.address", form.area, form.address)
  352. };
  353. const editAddress = (val) => {
  354. uni.navigateTo({
  355. url: `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  356. });
  357. };
  358. const goToAddAddress = () => {
  359. uni.navigateTo({
  360. url: "/subpackage/orders/addAddress",
  361. });
  362. };
  363. </script>
  364. <style>
  365. page {
  366. width: 100%;
  367. height: 100%;
  368. display: flex;
  369. flex-direction: column;
  370. background-color: ##eef7f7;
  371. }
  372. </style>
  373. <style lang="scss" scoped>
  374. .addr-box {
  375. margin-top: 20rpx;
  376. display: flex;
  377. background: #fff;
  378. padding: 30rpx;
  379. justify-content: space-between;
  380. align-items: center;
  381. .addr-box-left {
  382. display: flex;
  383. .text-image {
  384. width: 68rpx;
  385. height: 68rpx;
  386. background: #00b38b;
  387. border-radius: 50%;
  388. text-align: center;
  389. font-size: 26rpx;
  390. font-family: Microsoft YaHei;
  391. font-weight: 400;
  392. color: #ffffff;
  393. line-height: 68rpx;
  394. margin-right: 30rpx;
  395. }
  396. .content {
  397. view {
  398. font-size: 26rpx;
  399. font-family: Microsoft YaHei;
  400. font-weight: 400;
  401. color: #333333;
  402. .item1 {
  403. font-size: 30rpx;
  404. font-family: Microsoft YaHei;
  405. font-weight: 400;
  406. color: #333333;
  407. }
  408. .item2 {
  409. font-size: 24rpx;
  410. font-family: Microsoft YaHei;
  411. font-weight: 400;
  412. color: #999999;
  413. margin-left: 10rpx;
  414. }
  415. .item3 {
  416. width: 71rpx;
  417. height: 37rpx;
  418. background: #ffffff;
  419. border: 1px solid #ff8000;
  420. border-radius: 6rpx;
  421. font-size: 22rpx;
  422. font-family: Microsoft YaHei;
  423. font-weight: 400;
  424. color: #ff8000;
  425. padding: 3rpx 6rpx;
  426. margin-left: 10rpx;
  427. }
  428. }
  429. }
  430. }
  431. .edit {
  432. image {
  433. width: 50rpx;
  434. height: 50rpx;
  435. }
  436. }
  437. }
  438. .radios {
  439. display: flex;
  440. }
  441. .radio-box {
  442. display: flex;
  443. align-items: center;
  444. padding-left: 40rpx;
  445. }
  446. .hint2 {
  447. display: flex;
  448. .green {
  449. font-size: 28rpx;
  450. color: #00b38b;
  451. }
  452. .grey {
  453. font-size: 24rpx;
  454. color: #000000;
  455. margin-left: 16rpx;
  456. }
  457. }
  458. .addr-box {
  459. margin-top: 20rpx;
  460. display: flex;
  461. background: #fff;
  462. padding: 30rpx;
  463. justify-content: space-between;
  464. align-items: center;
  465. .addr-box-left {
  466. display: flex;
  467. .text-image {
  468. width: 68rpx;
  469. height: 68rpx;
  470. background: #00b38b;
  471. border-radius: 50%;
  472. text-align: center;
  473. font-size: 26rpx;
  474. font-family: Microsoft YaHei;
  475. font-weight: 400;
  476. color: #ffffff;
  477. line-height: 68rpx;
  478. margin-right: 30rpx;
  479. }
  480. .content {
  481. view {
  482. font-size: 26rpx;
  483. font-family: Microsoft YaHei;
  484. font-weight: 400;
  485. color: #333333;
  486. .item1 {
  487. font-size: 30rpx;
  488. font-family: Microsoft YaHei;
  489. font-weight: 400;
  490. color: #333333;
  491. }
  492. .item2 {
  493. font-size: 24rpx;
  494. font-family: Microsoft YaHei;
  495. font-weight: 400;
  496. color: #999999;
  497. margin-left: 10rpx;
  498. }
  499. .item3 {
  500. width: 71rpx;
  501. height: 37rpx;
  502. background: #ffffff;
  503. border: 1px solid #ff8000;
  504. border-radius: 6rpx;
  505. font-size: 22rpx;
  506. font-family: Microsoft YaHei;
  507. font-weight: 400;
  508. color: #ff8000;
  509. padding: 3rpx 6rpx;
  510. margin-left: 10rpx;
  511. }
  512. }
  513. }
  514. }
  515. .edit {
  516. image {
  517. width: 50rpx;
  518. height: 50rpx;
  519. }
  520. }
  521. }
  522. .oderPage {
  523. flex: 1;
  524. width: 100%;
  525. background-color: #f3f3f3;
  526. .from1 {
  527. background-color: #fff;
  528. margin-top: 30rpx;
  529. padding: 0 30rpx;
  530. ::v-deep .uni-forms-item {
  531. border-bottom: 1rpx solid #ccc;
  532. padding: 15rpx 0;
  533. margin-bottom: 0;
  534. .uni-forms-item__label {
  535. font-size: 28rpx;
  536. height: 50rpx;
  537. }
  538. .uni-forms-item__content {
  539. display: flex;
  540. }
  541. .uni-easyinput__content-input {
  542. font-size: 28rpx;
  543. height: 50rpx;
  544. }
  545. }
  546. .btn {
  547. line-height: 38rpx;
  548. font-size: 24rpx;
  549. font-family: Microsoft YaHei;
  550. font-weight: 400;
  551. color: #ffffff;
  552. background: #00b38b;
  553. border-radius: 10rpx;
  554. padding: 10rpx 15rpx;
  555. }
  556. }
  557. .from {
  558. background-color: #fff;
  559. margin-top: 30rpx;
  560. padding: 0 30rpx;
  561. ::v-deep .u-form-item {
  562. padding: 0;
  563. line-height: normal;
  564. .u-form-item__message {
  565. margin-bottom: 12rpx;
  566. }
  567. }
  568. .from_item {
  569. display: flex;
  570. flex-wrap: nowrap;
  571. justify-content: space-between;
  572. align-items: center;
  573. height: 80rpx;
  574. border-bottom: 1rpx solid #dcdcdc;
  575. .btn {
  576. font-size: 24rpx;
  577. font-family: Microsoft YaHei;
  578. font-weight: 400;
  579. color: #ffffff;
  580. background: #00b38b;
  581. border-radius: 10rpx;
  582. padding: 10rpx 15rpx;
  583. }
  584. ::v-deep .input {
  585. text-align: left;
  586. flex: 1;
  587. background: transparent;
  588. input {
  589. text-align: left;
  590. }
  591. }
  592. }
  593. .from_item1 {
  594. display: flex;
  595. flex-wrap: nowrap;
  596. flex-direction: column;
  597. justify-content: space-between;
  598. padding: 30rpx;
  599. border-bottom: #dcdcdc 1px solid;
  600. input {
  601. text-align: right;
  602. }
  603. .textarea {
  604. background-color: #f1f1f1;
  605. width: 100%;
  606. border-radius: 20rpx;
  607. margin-top: 10rpx;
  608. text-indent: 1rem;
  609. height: 180rpx;
  610. padding: 20rpx;
  611. box-sizing: border-box;
  612. }
  613. }
  614. }
  615. }
  616. .submit {
  617. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  618. width: 670rpx;
  619. height: 80rpx;
  620. color: #fff;
  621. border-radius: 100rpx;
  622. font-size: 32rpx;
  623. }
  624. .address-line {
  625. padding: 20px;
  626. .flex {
  627. display: flex;
  628. }
  629. .flex-bettwen {
  630. display: flex;
  631. align-items: center;
  632. justify-content: space-between;
  633. }
  634. .xing {
  635. width: 68rpx;
  636. height: 68rpx;
  637. background: rgba(0, 179, 139, 0.2);
  638. border-radius: 50%;
  639. font-size: 26rpx;
  640. font-weight: 400;
  641. color: #00b38b;
  642. line-height: 68rpx;
  643. text-align: center;
  644. }
  645. .content {
  646. margin-left: 20px;
  647. .name {
  648. font-size: 30rpx;
  649. font-family: Microsoft YaHei;
  650. font-weight: 500;
  651. color: #333333;
  652. display: inline-block;
  653. }
  654. .phone {
  655. margin-left: 10rpx;
  656. font-size: 24rpx;
  657. font-family: Microsoft YaHei;
  658. font-weight: 400;
  659. color: #999999;
  660. line-height: 36rpx;
  661. }
  662. .address {
  663. margin-top: 10rpx;
  664. font-size: 26rpx;
  665. font-family: Microsoft YaHei;
  666. font-weight: 400;
  667. color: #333333;
  668. line-height: 36rpx;
  669. }
  670. .picture {
  671. width: 48rpx;
  672. height: 48rpx;
  673. }
  674. .editIcon {
  675. width: 48rpx;
  676. height: 48rpx;
  677. }
  678. }
  679. }
  680. .action-bottom {
  681. padding-bottom: 30rpx;
  682. .button {
  683. height: 80rpx;
  684. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  685. border-radius: 40rpx;
  686. font-size: 32rpx;
  687. font-weight: 400;
  688. color: #ffffff;
  689. line-height: 80rpx;
  690. }
  691. }
  692. </style>