index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <view class="container">
  3. <JHeader title="申请退款" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view class="content" style="padding-bottom:200upx;">
  5. <view v-for="(item, index) in orderList" :key="index" class="order-list-box">
  6. <view class="item">
  7. <view class="order-info-box">
  8. <view class="order-info">
  9. <view class="order-info-item">
  10. <image :src="common.seamingImgUrl(item.image)" class="product-img"></image>
  11. <view class="info-box">
  12. <text class="product-name">{{ item.productName }}</text>
  13. <view class="product-sku">{{ item.sku }} {{ item.value }}</view>
  14. <view class="price-sku-box">
  15. <text class="product-price">
  16. <text class="fuhao">¥</text>
  17. {{ item.price }}
  18. </text>
  19. <text class="product-num">x {{ item.number }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="afterSale-select-box">
  28. <view class="item" @click="refundType">
  29. <view class="l">退款类型</view>
  30. <view v-if="afterType == 1" class="r-box">
  31. <text>仅退款</text>
  32. <tui-icon name="arrowright" :size="48" unit="upx" color="#999999" margin="0 0 0 10upx"></tui-icon>
  33. </view>
  34. <view v-if="afterType == 2" class="r-box">
  35. <text>退货退款</text>
  36. <tui-icon name="arrowright" :size="48" unit="upx" color="#999999" margin="0 0 0 10upx"></tui-icon>
  37. </view>
  38. </view>
  39. <view class="item" @click="openStatusSelect">
  40. <view class="l">货物状态</view>
  41. <view v-if="ReturnMoneyQuery.goodsState == 0" class="r-box">
  42. <text>未收到货</text>
  43. <tui-icon name="arrowright" :size="48" unit="upx" color="#999999" margin="0 0 0 10upx"></tui-icon>
  44. </view>
  45. <view v-if="ReturnMoneyQuery.goodsState == 1" class="r-box">
  46. <text>已收到货</text>
  47. <tui-icon name="arrowright" :size="48" unit="upx" color="#999999" margin="0 0 0 10upx"></tui-icon>
  48. </view>
  49. </view>
  50. <view class="item" @click="openReasonSelect">
  51. <view class="l">退款原因</view>
  52. <view class="r-box">
  53. <text>{{ liyoutext }}</text>
  54. <tui-icon name="arrowright" :size="48" unit="upx" color="#999999" margin="0 0 0 10upx"></tui-icon>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="afterSale-select-box mt20">
  59. <view class="item">
  60. <view class="l">
  61. 退款金额:
  62. <text class="order-status">¥ {{ sellPriceitem.toFixed(2) }}</text>
  63. </view>
  64. </view>
  65. <view class="item item-start">
  66. <view class="l">退款说明:</view>
  67. <view class="r-box r-box2">
  68. <input
  69. v-model="ReturnMoneyQuery.returnDesc" maxlength="200" type="text" placeholder="选填"
  70. class="r-box-input"
  71. ></input>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="afterSale-select-box mt20">
  76. <view class="upload-title">上传凭证</view>
  77. <view class="mar-left-10 mar-top-10">
  78. <ATFMoreUpload :imgs="fileList" @upload="handleSaveImg" @delete="handleDeleteImg"></ATFMoreUpload>
  79. </view>
  80. </view>
  81. <view class="order-flow-box">
  82. <view class="flow-word">退款流程:</view>
  83. <view class="flow-word mt25">
  84. <text>1、退货说明并提交</text>
  85. <text>2、2天内等待卖家处理,超时默认同意退款</text>
  86. <text>3、卖家同意,退款金额原路退还</text>
  87. </view>
  88. <view class="flow-word mt50">注:退款金额以实际支付价格为准</view>
  89. </view>
  90. </view>
  91. <view
  92. class="order-confirm-box" style="padding-top:30upx;"
  93. :style="{ 'padding-bottom': (isIphone == true ? 60 : 0) + 'rpx' }"
  94. >
  95. <text class="btn" @click="confirmTap">
  96. 提交
  97. </text>
  98. </view>
  99. <!-- 货物状态弹框 -->
  100. <tui-bottom-popup :show="refundTypeShow" @close="refundTypeShow = false">
  101. <view class="alert-box">
  102. <view class="afterSale-status-box">
  103. <view class="status-title">退款类型</view>
  104. <view class="item-box">
  105. <view class="item" @click="afterType = 1">
  106. <text class="status-select-title">仅退款</text>
  107. <tui-icon
  108. v-if="afterType == 1" name="circle-fill" :size="40" unit="upx"
  109. color="#c5aa7b"
  110. margin="30upx"
  111. ></tui-icon>
  112. <tui-icon v-else name="circle" :size="40" unit="upx" color="#cccccc" margin="30upx"></tui-icon>
  113. </view>
  114. <view class="item" @click="afterType = 2">
  115. <text class="status-select-title">退货退款</text>
  116. <tui-icon
  117. v-if="afterType == 2" name="circle-fill" :size="40" unit="upx"
  118. color="#c5aa7b"
  119. margin="30upx"
  120. ></tui-icon>
  121. <tui-icon v-else name="circle" :size="40" unit="upx" color="#cccccc" margin="30upx"></tui-icon>
  122. </view>
  123. </view>
  124. <view class="status-btn" @click="closeAfterSelect">
  125. 确定
  126. </view>
  127. </view>
  128. </view>
  129. </tui-bottom-popup>
  130. <tui-bottom-popup :show="cargoStatusShowFalg" @close="closeStatusSelect">
  131. <view class="alert-box">
  132. <view class="afterSale-status-box">
  133. <view class="status-title">货物状态</view>
  134. <view class="item-box">
  135. <view class="item" @click="ReturnMoneyQuery.goodsState = 0">
  136. <text class="status-select-title">未收到货</text>
  137. <tui-icon
  138. v-if="ReturnMoneyQuery.goodsState == 0" name="circle-fill" :size="40" unit="upx"
  139. color="#c5aa7b"
  140. margin="30upx"
  141. ></tui-icon>
  142. <tui-icon v-else name="circle" :size="40" unit="upx" color="#cccccc" margin="30upx"></tui-icon>
  143. </view>
  144. <view class="item" @click="ReturnMoneyQuery.goodsState = 1">
  145. <text class="status-select-title">已收到货</text>
  146. <tui-icon
  147. v-if="ReturnMoneyQuery.goodsState == 1" name="circle-fill" :size="40" unit="upx"
  148. color="#c5aa7b"
  149. margin="30upx"
  150. ></tui-icon>
  151. <tui-icon v-else name="circle" :size="40" unit="upx" color="#cccccc" margin="30upx"></tui-icon>
  152. </view>
  153. </view>
  154. <view class="status-btn" @click="closeStatusSelect">
  155. 确定
  156. </view>
  157. </view>
  158. </view>
  159. </tui-bottom-popup>
  160. <!-- 退款原因弹框 -->
  161. <tui-bottom-popup :show="reasonShowFalg" @close="reasonShowFalg = false">
  162. <view class="alert-box">
  163. <view class="afterSale-status-box" scroll-y style="height:60%;">
  164. <view class="status-title">退款原因</view>
  165. <view class="item-box">
  166. <view v-for="(item, index) in liyouData" :key="index" class="item" @click="returnReasonTap(item, index)">
  167. <text class="status-select-title">{{ item }}</text>
  168. <tui-icon
  169. v-if="ReturnMoneyQuery.returnReason == index" name="circle-fill" :size="40" unit="upx"
  170. color="#c5aa7b" margin="30upx"
  171. ></tui-icon>
  172. <tui-icon v-else name="circle" :size="40" unit="upx" color="#cccccc" margin="30upx"></tui-icon>
  173. </view>
  174. </view>
  175. <view class="status-btn" @click="closeReasonSelect">
  176. 确定
  177. </view>
  178. </view>
  179. </view>
  180. </tui-bottom-popup>
  181. </view>
  182. </template>
  183. <script>
  184. import { getReturnPriceRefundMoneyApi, getReasonSelectEnumsApi, updateApplyReturnMoneySubmitApi } from '../../../api/anotherTFInterface'
  185. import { T_REFUND_APPLY_ITEM, T_AFTER_SALE_APPLY_REFUND } from '../../../constant'
  186. export default {
  187. name: 'AfterSaleApplyRefund',
  188. data() {
  189. return {
  190. cargoStatusShowFalg: false,
  191. refundTypeShow: false,
  192. reasonShowFalg: false,
  193. orderList: [],
  194. ReturnMoneyQuery: {
  195. goodsState: 0,
  196. orderCode: '',
  197. orderProductIds: '',
  198. refundFee: 0,
  199. returnDesc: '',
  200. returnImgs: '',
  201. returnReason: 0
  202. },
  203. fileList: [],
  204. sellPriceitem: 0, // 退款价格
  205. liyouData: [],
  206. liyoutext: '',
  207. orderId: 0,
  208. isIphone: false,
  209. commentImgs: '',
  210. afterType: 1,
  211. isAllSelect: 0
  212. }
  213. },
  214. onReady() {
  215. this.isIphone = getApp().globalData.isIphone
  216. },
  217. async onLoad(options) {
  218. if (uni.getStorageSync(T_REFUND_APPLY_ITEM)) {
  219. this.orderList.push(uni.getStorageSync(T_REFUND_APPLY_ITEM))
  220. } else if (uni.getStorageSync(T_AFTER_SALE_APPLY_REFUND)) {
  221. this.orderList = uni.getStorageSync(T_AFTER_SALE_APPLY_REFUND)
  222. }
  223. this.orderId = parseInt(options.orderId)
  224. this.isAllSelect = Number(options.isAllSelect)
  225. this.orderList.forEach((el) => {
  226. if (this.isAllSelect) {
  227. this.sellPriceitem = this.sellPriceitem + (el.number * el.price) + el.logisticsPrice
  228. } else {
  229. this.sellPriceitem = this.sellPriceitem + (el.number * el.price)
  230. }
  231. })
  232. this.getReasonEnums()
  233. uni.removeStorageSync(T_REFUND_APPLY_ITEM)
  234. uni.removeStorageSync(T_AFTER_SALE_APPLY_REFUND)
  235. this.sellPriceitem = await this.HandleGetRefundMoney()
  236. },
  237. methods: {
  238. handleSaveImg(imgUrl) {
  239. this.fileList.push(imgUrl)
  240. this.$forceUpdate()
  241. },
  242. handleDeleteImg(imgUrl) {
  243. this.fileList.splice(this.fileList.findIndex((item) => item === imgUrl), 1)
  244. this.$forceUpdate()
  245. },
  246. // 算钱
  247. HandleGetRefundMoney() {
  248. return new Promise((resolve, reject) => {
  249. uni.showLoading()
  250. getReturnPriceRefundMoneyApi({
  251. orderId: this.orderId,
  252. isAllSelect: this.isAllSelect,
  253. skus: this.orderList,
  254. afterType: 2,
  255. goodsState: this.ReturnMoneyQuery.goodsState
  256. }).then((res) => {
  257. uni.hideLoading()
  258. resolve(parseFloat(res.json))
  259. })
  260. .catch((e) => {
  261. uni.hideLoading()
  262. })
  263. })
  264. },
  265. confirmTap() {
  266. if (this.fileList.length > 0) {
  267. for (let i = 0; i < this.fileList.length; i++) {
  268. this.commentImgs += this.fileList[i] + ','
  269. }
  270. }
  271. this.ReturnMoney()
  272. },
  273. getReasonEnums() {
  274. getReasonSelectEnumsApi({}).then((res) => {
  275. this.liyouData = res.data
  276. this.liyoutext = this.liyouData[0]
  277. })
  278. },
  279. ReturnMoney() {
  280. if (this.ReturnMoneyQuery.goodsState === '') {
  281. uni.showToast({
  282. title: '请选择货物状态!',
  283. duration: 2000,
  284. icon: 'none'
  285. })
  286. } else if (this.liyoutext == '') {
  287. uni.showToast({
  288. title: '请选择退款原因!',
  289. duration: 2000,
  290. icon: 'none'
  291. })
  292. } else {
  293. uni.showLoading({
  294. mask: true,
  295. title: '正在提交...'
  296. })
  297. const skusobjdata = []
  298. this.orderList.forEach((i) => {
  299. const skusobj = {}
  300. skusobj.skuId = i.skuId
  301. skusobj.number = i.number
  302. skusobjdata.push(skusobj)
  303. })
  304. updateApplyReturnMoneySubmitApi({
  305. orderId: this.orderId,
  306. afterType: this.afterType,
  307. goodsState: this.ReturnMoneyQuery.goodsState,
  308. price: this.sellPriceitem,
  309. returnReason: this.liyoutext,
  310. explain: this.ReturnMoneyQuery.returnDesc,
  311. image: this.commentImgs,
  312. skus: skusobjdata,
  313. isAllSelect: this.isAllSelect
  314. }).then((res) => {
  315. uni.hideLoading()
  316. uni.showToast({
  317. title: '提交成功'
  318. })
  319. setTimeout(() => {
  320. uni.redirectTo({
  321. url: `/another-tf/another-serve/afterSale/index`
  322. })
  323. }, 1500)
  324. })
  325. .catch((res) => {
  326. uni.showToast({
  327. title: '商品已在售后,请勿重新操作!',
  328. duration: 2000,
  329. icon: 'none'
  330. })
  331. uni.hideLoading()
  332. })
  333. }
  334. },
  335. // 理由
  336. returnReasonTap(item, index) {
  337. this.ReturnMoneyQuery.returnReason = index
  338. this.liyoutext = item
  339. },
  340. openStatusSelect() {
  341. this.cargoStatusShowFalg = true
  342. },
  343. refundType() {
  344. this.refundTypeShow = true
  345. },
  346. openReasonSelect() {
  347. this.reasonShowFalg = true
  348. },
  349. async closeStatusSelect() {
  350. this.cargoStatusShowFalg = false
  351. this.sellPriceitem = await this.HandleGetRefundMoney()
  352. },
  353. closeAfterSelect() {
  354. this.refundTypeShow = false
  355. },
  356. closeReasonSelect() {
  357. this.reasonShowFalg = false
  358. }
  359. }
  360. }
  361. </script>
  362. <style lang="less" scoped>
  363. .content {
  364. padding: 0 0 120upx;
  365. box-sizing: border-box;
  366. }
  367. .order-list-box {
  368. padding: 20upx 30upx;
  369. box-sizing: border-box;
  370. }
  371. .order-list-box .item {
  372. /* margin-bottom: 20upx; */
  373. background: #fff;
  374. border-radius: 10upx;
  375. }
  376. .order-status {
  377. font-size: 28upx;
  378. color: #C83732;
  379. font-weight: 500;
  380. }
  381. .order-info-box {
  382. padding: 0 30upx;
  383. box-sizing: border-box;
  384. }
  385. .order-info-item {
  386. display: flex;
  387. flex-direction: row;
  388. padding: 20upx 0;
  389. border-bottom: solid 1px #eee;
  390. }
  391. .order-info-item:last-child {
  392. border-bottom: none;
  393. }
  394. .product-img {
  395. width: 180upx;
  396. height: 180upx;
  397. border-radius: 10upx;
  398. margin-right: 30upx;
  399. }
  400. .info-box {
  401. flex: 1;
  402. display: flex;
  403. flex-direction: column;
  404. }
  405. .product-name {
  406. font-size: 26upx;
  407. color: #333;
  408. height: 68upx;
  409. line-height: 34upx;
  410. display: -webkit-box;
  411. overflow: hidden;
  412. text-overflow: ellipsis;
  413. word-break: break-all;
  414. -webkit-box-orient: vertical;
  415. -webkit-line-clamp: 2;
  416. }
  417. .price-sku-box {
  418. display: flex;
  419. flex-direction: row;
  420. justify-content: space-between;
  421. }
  422. .product-sku {
  423. font-size: 24upx;
  424. color: #999;
  425. margin-top: 30upx;
  426. }
  427. .product-price {
  428. font-size: 28upx;
  429. color: #333;
  430. font-weight: 400;
  431. }
  432. .product-price .fuhao {
  433. font-size: 28upx;
  434. }
  435. .product-num {
  436. font-size: 28upx;
  437. color: #999;
  438. }
  439. .afterSale-select-box {
  440. width: 100%;
  441. background: #fff;
  442. padding: 0 30upx;
  443. box-sizing: border-box;
  444. }
  445. .afterSale-select-box .item {
  446. height: 100upx;
  447. border-bottom: 1px solid #e5e5e5;
  448. display: flex;
  449. flex-direction: row;
  450. align-items: center;
  451. justify-content: space-between;
  452. font-size: 28upx;
  453. color: #333;
  454. }
  455. .afterSale-select-box .item:last-of-type {
  456. border-bottom: none;
  457. }
  458. .afterSale-select-box .item.item-start {
  459. justify-content: flex-start;
  460. }
  461. .afterSale-select-box .item .l {
  462. display: flex;
  463. flex-direction: row;
  464. align-items: center;
  465. }
  466. .afterSale-select-box .item .afterSale-img {
  467. width: 26upx;
  468. height: 26upx;
  469. margin-right: 20upx;
  470. }
  471. .afterSale-select-box .item .r-box {
  472. display: flex;
  473. flex-direction: row;
  474. align-items: center;
  475. color: #999;
  476. }
  477. .afterSale-select-box .item .r-box2 {
  478. width: 100%;
  479. flex: 1;
  480. }
  481. .afterSale-select-box .item .r {
  482. width: 24upx;
  483. height: 24upx;
  484. margin-left: 10upx;
  485. }
  486. .mt20 {
  487. margin-top: 20upx;
  488. }
  489. .r-box-input {
  490. text-align: left;
  491. flex: 1;
  492. z-index: 0;
  493. }
  494. .upload-title {
  495. font-size: 28upx;
  496. color: #333;
  497. padding: 30upx 0;
  498. }
  499. .order-flow-box {
  500. display: flex;
  501. flex-direction: column;
  502. padding: 30upx;
  503. box-sizing: border-box;
  504. }
  505. .flow-word {
  506. font-size: 24upx;
  507. color: #999;
  508. display: flex;
  509. flex-direction: column;
  510. }
  511. .mt25 {
  512. margin-top: 20upx;
  513. }
  514. .mt50 {
  515. margin-top: 30upx;
  516. margin-bottom: 20upx;
  517. }
  518. .order-confirm-box {
  519. position: fixed;
  520. bottom: 0;
  521. left: 0;
  522. width: 100%;
  523. height: 180upx;
  524. background: #fff;
  525. padding: 0 30upx;
  526. box-sizing: border-box;
  527. display: flex;
  528. flex-direction: row;
  529. align-items: center;
  530. justify-content: center;
  531. }
  532. .order-confirm-box .btn {
  533. width: 100%;
  534. height: 100upx;
  535. line-height: 100upx;
  536. background: #333333;
  537. font-size: 28upx;
  538. color: #fff;
  539. text-align: center;
  540. }
  541. .alert-box {
  542. width: 100%;
  543. height: 100%;
  544. background: rgba(0, 0, 0, 0.5);
  545. }
  546. .afterSale-status-box {
  547. width: 100%;
  548. background: #fff;
  549. border-radius: 15upx 15upx 0upx 0upx;
  550. }
  551. .status-title {
  552. width: 100%;
  553. height: 140upx;
  554. background: #fff;
  555. border-radius: 15upx 15upx 0 0;
  556. font-size: 34upx;
  557. color: #333;
  558. text-align: center;
  559. line-height: 140upx;
  560. position: fixed;
  561. left: 0;
  562. }
  563. .afterSale-status-box .item {
  564. display: flex;
  565. flex-direction: row;
  566. align-items: center;
  567. justify-content: space-between;
  568. border-bottom: 1px solid #e5e5e5;
  569. }
  570. .afterSale-status-box .item:last-of-type {
  571. border-bottom: none;
  572. }
  573. .afterSale-status-box .item-box {
  574. padding: 140upx 0;
  575. }
  576. .afterSale-status-box .status-select-title {
  577. padding: 0 0 0 30upx;
  578. box-sizing: border-box;
  579. font-size: 28upx;
  580. color: #333;
  581. }
  582. .afterSale-status-box .status-btn {
  583. width: 100%;
  584. height: 100upx;
  585. line-height: 100upx;
  586. background: #333333;
  587. font-size: 28upx;
  588. color: #F5DEB2;
  589. text-align: center;
  590. position: fixed;
  591. bottom: 0;
  592. left: 0;
  593. }
  594. </style>