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

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