Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

form.vue 16KB

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