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.

form.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <view class="oderPage">
  3. <view class="addr-box">
  4. <view class="addr-box-left">
  5. <view class="text-image">{{form.consignee.charAt(0)}} </view>
  6. <view class="content">
  7. <view class="">
  8. <text class="item1">{{form.consignee}}</text>
  9. <text class="item2">{{form.consigneeTel}}</text>
  10. <text class="item3" v-if="form.defaultAddress ==1">默认</text>
  11. </view>
  12. <view class=""> {{form.region +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. <u-form ref="myForm">
  20. <view class="from">
  21. <u-form-item prop="cardState">
  22. <view class="from_item">
  23. <text><text style="color: red">*</text>是否寄回设备:</text>
  24. <!-- <u-radio-group v-model="form.sendStatusName">
  25. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  26. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  27. :name="item.name">
  28. {{ item.name }}
  29. </u-radio>
  30. </u-radio-group> -->
  31. <radio-group @change="sendChange" class="radios">
  32. <block v-for="(item, index) in radiolist1" :key="item.val">
  33. <view class="radio-box">
  34. <radio :value="item.val" :checked="form.sendStatus == item.val" color="#13e7c1"
  35. style="transform:scale(0.75)" />
  36. <view>{{item.name}}</view>
  37. </view>
  38. </block>
  39. </radio-group>
  40. </view>
  41. </u-form-item>
  42. <u-form-item prop="logistics" v-if="form.sendStatusName == '寄回'">
  43. <view class="from_item">
  44. <text><text style="color: red">*</text>退货物流公司:</text>
  45. <view style="display: flex">
  46. <u-input v-model="form.courierCompany" class="input" @click="showPicker"
  47. placeholder="请选择" />
  48. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  49. </view>
  50. </view>
  51. </u-form-item>
  52. <u-form-item prop="returnNum" v-if="form.sendStatusName == '寄回'">
  53. <view class="from_item">
  54. <text><text style="color: red"></text>退货单号:</text>
  55. <u-input v-model="form.courierOrderId" class="input" />
  56. </view>
  57. </u-form-item>
  58. <u-form-item prop="cardState">
  59. <view class="from_item">
  60. <text><text style="color: red">*</text>收货方式:</text>
  61. <!-- <u-radio-group v-model="form.receiveMethodName">
  62. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  63. v-for="(item, index) in radiolist2" :key="index" :label="item.disabled"
  64. :name="item.name">
  65. {{ item.name }}
  66. </u-radio>
  67. </u-radio-group> -->
  68. <radio-group @change="receiveChange" class="radios">
  69. <block v-for="(item, index) in radiolist2" :key="item.val">
  70. <view class="radio-box">
  71. <radio :value="item.val" :checked="form.receiveMethod == item.val" color="#13e7c1"
  72. style="transform:scale(0.75)" />
  73. <view>{{item.name}}</view>
  74. </view>
  75. </block>
  76. </radio-group>
  77. </view>
  78. </u-form-item>
  79. <u-form-item prop="remark">
  80. <view class="from_item">
  81. <text><text style="color: red"></text>注销原因:</text>
  82. <view style="display: flex">
  83. <u-input v-model="form.applyRes" @click="showApplyResPicker()" class="input" disabled
  84. placeholder="请选择" />
  85. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  86. </view>
  87. </view>
  88. </u-form-item>
  89. </view>
  90. </u-form>
  91. <!-- 物流弹窗 -->
  92. <view>
  93. <!-- 物流 -->
  94. <u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
  95. <!-- 原因 -->
  96. <u-select v-model="showApplyRes" mode="single-column" :list="applyResList" @confirm="applyResConfirm">
  97. </u-select>
  98. </view>
  99. <button class="submit" @click="submit">下一步</button>
  100. </view>
  101. <!-- 地址弹窗 -->
  102. <u-popup mode="bottom" v-model="address.show">
  103. <view class="address-line">
  104. <view v-if="address.list" v-for="(item, index) in address.list" :key="index" @click="addressSelected(item)"
  105. style="margin-bottom: 40rpx" class="flex-bettwen">
  106. <view class="flex">
  107. <view class="xing">
  108. {{ item.consignee.charAt(0) }}
  109. </view>
  110. <view class="content">
  111. <view class="flex">
  112. <view class="name">
  113. {{ item.consignee }}
  114. </view>
  115. <view class="phone">
  116. {{ item.consigneeTel }}
  117. </view>
  118. </view>
  119. <view class="address">
  120. {{ item.region + item.address }}
  121. </view>
  122. </view>
  123. </view>
  124. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  125. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`"
  126. style="width: 48rpx; height: 48rpx"></image>
  127. </view>
  128. </view>
  129. <view :style="address.list ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  130. <button type="default" class="button" @click="goToAddAddress()">
  131. 添加收货地址
  132. </button>
  133. </view>
  134. </view>
  135. </u-popup>
  136. </template>
  137. <script setup lang="ts">
  138. // import navBar from "../ETCcancellation/components/nav-bar.vue";
  139. import {
  140. reactive,
  141. ref
  142. } from "vue";
  143. import {
  144. onLoad,
  145. onShow,
  146. onReady
  147. } from "@dcloudio/uni-app";
  148. import {
  149. navTo,
  150. checkStr
  151. } from "@/utils/utils";
  152. import {
  153. request
  154. } from "@/utils/network/request.js";
  155. import {
  156. getLogistics,
  157. addressQuery,
  158. changeCardInfo
  159. } from "@/utils/network/api.js";
  160. import {
  161. stringToJson
  162. } from "@/utils/network/encryption.js";
  163. import {
  164. getItem,
  165. StorageKeys
  166. } from "@/utils/storage";
  167. import {
  168. wechatPayConfigId,
  169. } from "@/utils/network/api";
  170. const list = reactive([]); //物流数据
  171. const address = reactive({
  172. list: [],
  173. show: false
  174. }); //地址list
  175. const form = reactive({
  176. consignee: '',
  177. consigneeTel: '',
  178. address: '',
  179. region: '',
  180. sendStatusName: '寄回',
  181. sendStatus: '1', //0 --- 不邮寄 1 --- 邮寄
  182. courierCompany: '',
  183. courierOrderId: '',
  184. receiveMethod: '1',
  185. postCode: '',
  186. receiveMethodName: '邮寄', //0 --- 不邮寄 1 --- 邮寄
  187. applyRes: '',
  188. defaultAddress: 2
  189. });
  190. //入参
  191. const params = reactive({
  192. /* cardId: '',
  193. obuId: '', */
  194. orderId: '',
  195. id: '',
  196. });
  197. const applyResList = reactive([{
  198. //原因
  199. value: "原因1",
  200. label: "原因1",
  201. },
  202. {
  203. value: "原因1",
  204. label: "原因1",
  205. },
  206. {
  207. value: "原因1",
  208. label: "原因1",
  209. },
  210. ]);
  211. // 单选数据列表
  212. const radiolist1 = reactive([{
  213. name: "寄回",
  214. val: "1",
  215. },
  216. {
  217. name: "不寄回",
  218. val: "0",
  219. },
  220. ]);
  221. const radiolist2 = reactive([{
  222. name: "邮寄",
  223. val: "1",
  224. },
  225. {
  226. name: "不邮寄",
  227. val: "0",
  228. },
  229. ]);
  230. const goToAddAddress = () => {
  231. uni.navigateTo({
  232. url: "/subpackage/applyCard/addAddress",
  233. });
  234. };
  235. const editAddress = (val) => {
  236. uni.navigateTo({
  237. url: `/subpackage/applyCard/editAddress?content=` + JSON.stringify(val),
  238. });
  239. };
  240. const addressSelected = (val : any) => {
  241. console.log(val);
  242. // state.data = {
  243. // ...state.data,
  244. // ...val,
  245. // };
  246. // state.show = false;
  247. form.consignee = val.consignee
  248. form.consigneeTel = val.consigneeTel
  249. form.address = val.address
  250. form.region = val.region
  251. form.postCode = val.postalCode
  252. form.defaultAddress = val.defaultAddress
  253. address.show = false
  254. };
  255. // 寄回单选
  256. const sendChange = (e : any) => {
  257. console.log(e);
  258. form.sendStatus = e.detail.value
  259. };
  260. // 邮寄单选
  261. const receiveChange = (e : any) => {
  262. console.log(e);
  263. form.receiveMethod = e.detail.value
  264. };
  265. let showApplyRes = ref(false);
  266. // 打开物流先择器
  267. const showApplyResPicker = function () {
  268. showApplyRes.value = true;
  269. };
  270. const applyResConfirm = (e) => {
  271. form.applyRes = e[0].value;
  272. console.log(e[0].value);
  273. };
  274. let show = ref(false);
  275. // 打开物流先择器
  276. const showPicker = function () {
  277. show.value = true;
  278. };
  279. const confirm = (e) => {
  280. form.courierCompany = e[0].value;
  281. console.log(e[0].value);
  282. };
  283. onLoad((option) => {
  284. params.orderId = option.orderId
  285. params.id = option.id
  286. getexpresslist();
  287. getAddressList();
  288. });
  289. const getexpresslist = () => {
  290. //参数说明
  291. let options = {
  292. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  293. data: {
  294. // opId: getItem("openId"),
  295. // source: "WECHAT",
  296. // tabIndex: "0",
  297. }, //请求参数
  298. method: "POST", //提交方式(默认POST)
  299. showLoading: true, //是否显示加载中(默认显示)
  300. };
  301. //调用方式
  302. request(getLogistics, options)
  303. .then((res) => {
  304. // stringToJson(res.bizContent)
  305. stringToJson(res.bizContent).forEach((item) => {
  306. list.push({
  307. value: item,
  308. label: item,
  309. });
  310. });
  311. })
  312. .catch((err) => {
  313. console.log(err);
  314. });
  315. };
  316. const getAddressList = () => {
  317. var data = {
  318. openId: getItem(StorageKeys.OpenId),
  319. };
  320. const options = {
  321. type: 2,
  322. data: data,
  323. method: "POST",
  324. showLoading: true,
  325. };
  326. request(addressQuery, options).then((res) => {
  327. const data = stringToJson(res.bizContent);
  328. address.list = data.data;
  329. if (address.list.length > 0) {
  330. var defaultAddress = address.list[0]
  331. form.consignee = defaultAddress.consignee
  332. form.consigneeTel = defaultAddress.consigneeTel
  333. form.address = defaultAddress.address
  334. form.region = defaultAddress.region
  335. form.postCode = defaultAddress.postalCode
  336. form.defaultAddress = defaultAddress.defaultAddress
  337. }
  338. });
  339. };
  340. const submit = () => {
  341. // if (form.sendStatusName === '寄回') {
  342. // form.sendStatus = '1'
  343. // } else {
  344. // form.sendStatus = '0'
  345. // }
  346. // if (form.receiveMethodName === '邮寄') {
  347. // form.receiveMethod = '1'
  348. // } else {
  349. // form.receiveMethod = '0'
  350. // }
  351. queryCckChangejzCardInfo().then(val => {
  352. console.log(val)
  353. navTo(
  354. `/subpackage/after-sale/replace-equipment/result`
  355. )
  356. })
  357. };
  358. const queryCckChangejzCardInfo = () => {
  359. var data = {
  360. id: params.id,
  361. sendStatus: form.sendStatus,
  362. configId: wechatPayConfigId,
  363. courierCompany: form.courierCompany,
  364. courierOrderId: form.courierOrderId,
  365. receiveMethod: form.receiveMethod,
  366. consignee: form.consignee,
  367. consigneeTel: form.consigneeTel,
  368. address: form.address,
  369. region: form.region,
  370. postCode: form.postCode,
  371. applyRes: form.applyRes
  372. };
  373. const options = {
  374. type: 2,
  375. data: data,
  376. method: "POST",
  377. showLoading: true,
  378. };
  379. return new Promise(async (resolve, reject) => {
  380. const res = await request(changeCardInfo, options);
  381. const data = stringToJson(res.bizContent);
  382. resolve(data);
  383. }).catch((error) => {
  384. reject(error);
  385. });
  386. }
  387. </script>
  388. <style>
  389. page {
  390. width: 100%;
  391. height: 100%;
  392. display: flex;
  393. flex-direction: column;
  394. background-color: #f3f3f3;
  395. }
  396. </style>
  397. <style lang="scss" scoped>
  398. .radios{
  399. display: flex;
  400. }
  401. .radio-box{
  402. display: flex;
  403. align-items: center;
  404. padding-left: 20rpx;
  405. }
  406. .oderPage {
  407. flex: 1;
  408. width: 100%;
  409. .addr-box {
  410. margin-top: 20rpx;
  411. display: flex;
  412. background: #fff;
  413. padding: 30rpx;
  414. justify-content: space-between;
  415. align-items: center;
  416. .addr-box-left {
  417. display: flex;
  418. .text-image {
  419. width: 68rpx;
  420. height: 68rpx;
  421. background: #00b38b;
  422. border-radius: 50%;
  423. text-align: center;
  424. font-size: 26rpx;
  425. font-family: Microsoft YaHei;
  426. font-weight: 400;
  427. color: #ffffff;
  428. line-height: 68rpx;
  429. margin-right: 30rpx;
  430. }
  431. .content {
  432. view {
  433. font-size: 26rpx;
  434. font-family: Microsoft YaHei;
  435. font-weight: 400;
  436. color: #333333;
  437. .item1 {
  438. font-size: 30rpx;
  439. font-family: Microsoft YaHei;
  440. font-weight: 400;
  441. color: #333333;
  442. }
  443. .item2 {
  444. font-size: 24rpx;
  445. font-family: Microsoft YaHei;
  446. font-weight: 400;
  447. color: #999999;
  448. margin-left: 10rpx;
  449. }
  450. .item3 {
  451. width: 71rpx;
  452. height: 37rpx;
  453. background: #ffffff;
  454. border: 1px solid #ff8000;
  455. border-radius: 6rpx;
  456. font-size: 22rpx;
  457. font-family: Microsoft YaHei;
  458. font-weight: 400;
  459. color: #ff8000;
  460. padding: 3rpx 6rpx;
  461. margin-left: 10rpx;
  462. }
  463. }
  464. }
  465. }
  466. .edit {
  467. image {
  468. width: 50rpx;
  469. height: 50rpx;
  470. }
  471. }
  472. }
  473. .from {
  474. background-color: #fff;
  475. margin-top: 30rpx;
  476. padding: 0 30rpx;
  477. ::v-deep .u-form-item {
  478. padding: 0;
  479. line-height: normal;
  480. .u-form-item__message {
  481. margin-bottom: 12rpx;
  482. }
  483. }
  484. .from_item {
  485. display: flex;
  486. flex-wrap: nowrap;
  487. justify-content: space-between;
  488. align-items: center;
  489. height: 80rpx;
  490. border-bottom: 1rpx solid #dcdcdc;
  491. .btn {
  492. font-size: 24rpx;
  493. font-family: Microsoft YaHei;
  494. font-weight: 400;
  495. color: #ffffff;
  496. background: #00b38b;
  497. border-radius: 10rpx;
  498. padding: 10rpx 15rpx;
  499. }
  500. ::v-deep .input {
  501. text-align: right;
  502. flex: 1;
  503. background: transparent;
  504. input {
  505. text-align: right;
  506. }
  507. }
  508. }
  509. .from_item1 {
  510. display: flex;
  511. flex-wrap: nowrap;
  512. flex-direction: column;
  513. justify-content: space-between;
  514. padding: 30rpx 0;
  515. border-bottom: #dcdcdc 1px solid;
  516. input {
  517. text-align: right;
  518. }
  519. .textarea {
  520. background-color: #f1f1f1;
  521. width: 100%;
  522. border-radius: 20rpx;
  523. margin-top: 10rpx;
  524. text-indent: 1rem;
  525. height: 180rpx;
  526. padding: 20rpx;
  527. box-sizing: border-box;
  528. }
  529. }
  530. }
  531. }
  532. .address-line {
  533. padding: 20px;
  534. .flex-bettwen {
  535. display: flex;
  536. align-items: center;
  537. justify-content: space-between;
  538. }
  539. .xing {
  540. width: 68rpx;
  541. height: 68rpx;
  542. background: rgba(0, 179, 139, 0.2);
  543. border-radius: 50%;
  544. font-size: 26rpx;
  545. font-weight: 400;
  546. color: #00b38b;
  547. line-height: 68rpx;
  548. text-align: center;
  549. }
  550. .content {
  551. margin-left: 20px;
  552. .name {
  553. font-size: 30rpx;
  554. font-family: Microsoft YaHei;
  555. font-weight: 500;
  556. color: #333333;
  557. }
  558. .phone {
  559. margin-left: 10rpx;
  560. font-size: 24rpx;
  561. font-family: Microsoft YaHei;
  562. font-weight: 400;
  563. color: #999999;
  564. line-height: 36rpx;
  565. }
  566. .address {
  567. margin-top: 10rpx;
  568. font-size: 26rpx;
  569. font-family: Microsoft YaHei;
  570. font-weight: 400;
  571. color: #333333;
  572. line-height: 36rpx;
  573. }
  574. .picture {
  575. width: 48rpx;
  576. height: 48rpx;
  577. }
  578. .editIcon {
  579. width: 48rpx;
  580. height: 48rpx;
  581. }
  582. }
  583. }
  584. .action {
  585. padding-bottom: 100rpx;
  586. .button {
  587. height: 80rpx;
  588. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  589. border-radius: 40rpx;
  590. font-size: 32rpx;
  591. font-weight: 400;
  592. color: #ffffff;
  593. line-height: 80rpx;
  594. }
  595. }
  596. .action-bottom {
  597. padding-bottom: 30rpx;
  598. .button {
  599. height: 80rpx;
  600. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  601. border-radius: 40rpx;
  602. font-size: 32rpx;
  603. font-weight: 400;
  604. color: #ffffff;
  605. line-height: 80rpx;
  606. }
  607. }
  608. .flex {
  609. display: flex;
  610. align-items: center;
  611. }
  612. .submit {
  613. width: 670rpx;
  614. height: 80rpx;
  615. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  616. box-shadow: 0rpx 4rpx 11rpx 1rpx rgba(223, 223, 223, 0.5);
  617. border-radius: 40rpx;
  618. font-size: 32rpx;
  619. font-family: Microsoft YaHei;
  620. font-weight: 400;
  621. color: #ffffff;
  622. line-height: 80rpx;
  623. margin-top: 60rpx;
  624. }
  625. </style>