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 16KB

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