Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

form.vue 17KB

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