Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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