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.

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