選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

apply-ex-goods.vue 17KB

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