refund.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <!-- 售后提交 -->
  2. <template>
  3. <view class="apply-return">
  4. <!-- 申请售后 -->
  5. <view class="container" v-if="selected">
  6. <view class="goodsStyle acea-row row-between"
  7. v-for="cart in selectProduct"
  8. :key="cart.id"
  9. >
  10. <view class="pictrue">
  11. <image :src="JSON.parse(cart.img)[0].url" class="image" />
  12. </view>
  13. <view class="text acea-row row-between">
  14. <view class="name line2">{{ cart.productTitle }}</view>
  15. <view class="money">
  16. <view>
  17. ¥{{ cart.price }}
  18. </view>
  19. <view class="num">x{{ cart.num }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="list">
  24. <view v-if="serviceType === 1" class="item acea-row row-between-wrapper">
  25. <view>退货件数</view>
  26. <view class="num">{{ totalNum || 0 }}</view>
  27. </view>
  28. <view class="item acea-row row-between-wrapper">
  29. <view>退款金额</view>
  30. <view class="num">¥{{ totalMoney || 0 }}</view>
  31. </view>
  32. <picker :value="reason" :range="reasonList" @change="changeReason">
  33. <view class="item acea-row row-between-wrapper">
  34. <view>退款原因</view>
  35. <view class="num">{{reason}}</view>
  36. <text class="iconfont icon-jiantou"></text>
  37. </view>
  38. </picker>
  39. <view class="item textarea acea-row row-between">
  40. <view>备注说明</view>
  41. <textarea class="num"
  42. placeholder="填写备注信息,100字以内"
  43. v-model="refund_reason_wap_explain"
  44. ></textarea>
  45. </view>
  46. </view>
  47. <view v-if="serviceType === 0"
  48. class="returnBnt bg-color-red"
  49. @click="submit"
  50. >申请退款</view>
  51. <view v-if="serviceType === 1"
  52. class="returnBnt bg-color-red"
  53. @click="submit"
  54. >申请退货</view>
  55. </view>
  56. <!-- 选择商品 -->
  57. <view class="selectProduct" v-else>
  58. <view class="selectContainer"
  59. v-for="(cart, index) in selectProduct"
  60. :key="cart.id"
  61. >
  62. <view class="checkbox-wrapper">
  63. <checkbox-group @change="switchSelect(index)">
  64. <label class="well-check">
  65. <checkbox color="#eb3729" value :checked="cart.checked"></checkbox>
  66. </label>
  67. </checkbox-group>
  68. </view>
  69. <view class="pictrue">
  70. <image :src="JSON.parse(cart.img)[0].url" class="image" />
  71. </view>
  72. <view class="content">
  73. <view class="title">{{ cart.productTitle || '' }}</view>
  74. <view class="skus">
  75. <view class="sku">
  76. {{ cart.productAttrTitle || '' }}
  77. </view>
  78. <view class="num">x{{ cart.num || 0 }}</view>
  79. </view>
  80. <view class="money">
  81. ¥<view>
  82. {{ cart.price }}
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="choose">
  88. <view class="checkTotal">
  89. <checkbox-group @change="allChecked">
  90. <label class="well-check">
  91. <checkbox
  92. color="#eb3729"
  93. value="allSelect"
  94. :checked="isAllSelect"
  95. ></checkbox>
  96. <text class="checkAll">全选 ({{ cartCount || 0 }})</text>
  97. </label>
  98. </checkbox-group>
  99. <view class="total">
  100. <view class="proTotal">
  101. {{ totalNum || 0 }}件商品
  102. </view>
  103. <view class="moneyTotal">
  104. 合计 ¥ {{ orderInfo.totalPrice || 0 }}
  105. </view>
  106. </view>
  107. </view>
  108. <view class="typeBtn">
  109. <view class="button def" @click="chooseType(0)">仅退款</view>
  110. <view class="button greenBtn" @click="chooseType(1)" v-if="orderInfo.status === 40 || orderInfo.status === 50">退货退款</view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. export default {
  118. name: "goodsReturn",
  119. data() {
  120. return {
  121. id: 0,
  122. selected: false,
  123. orderInfo: {},
  124. rebackList: [],
  125. reasonList: ['收货地址填错了','与描述不符','信息填错了,重新拍','收到商品损坏了','未按预定时间发货','其它原因'],
  126. reason: "",
  127. refund_reason_wap_explain: '',
  128. refund_reason_wap_img: [],
  129. serviceType: null,
  130. // 选中售后商品
  131. selectProduct: [],
  132. productParamList: [],
  133. totalNum: 0,
  134. totalMoney: 0,
  135. isAllSelect: false
  136. };
  137. },
  138. onLoad(option) {
  139. const that = this
  140. uni.showLoading({
  141. title: '正在加载'
  142. })
  143. that.$api.request('get', 'order/app/getOrderDetail', {
  144. orderId : option.id
  145. }, failres => {
  146. uni.hideLoading()
  147. that.$api.msg(failres.msg)
  148. }).then(res => {
  149. uni.hideLoading()
  150. that.orderInfo = res.data
  151. that.selectProduct = res.data.productList
  152. that.totalNum = 0
  153. that.orderInfo.productList.forEach(item => {
  154. that.totalNum = item.num + that.totalNum
  155. item.imgs = []
  156. })
  157. })
  158. },
  159. methods: {
  160. changeReason(e) {
  161. this.reason = this.reasonList[e.mp.detail.value];
  162. },
  163. imageuploaded(res) {
  164. if (res.status !== 200) {
  165. uni.showToast({
  166. title: err.msg || err.response.data.msg|| err.response.data.message,
  167. icon: 'none',
  168. duration: 2000
  169. });
  170. return
  171. }
  172. this.refund_reason_wap_img.push(res.data.url);
  173. },
  174. getAfterSalesMoney() {
  175. this.$api.request('post', 'order/app/storeAfterSales/getRefundAmount', {
  176. orderCode: this.orderInfo.orderId,
  177. productParamList: this.productParamList
  178. }).then(res => {
  179. this.totalMoney = res.data
  180. }
  181. )
  182. },
  183. getOrderDetail() {
  184. uni.showLoading({
  185. title: '正在查询商品',
  186. duration: 2000,
  187. })
  188. orderDetail(this.id)
  189. .then(res => {
  190. this.orderInfo = res.data;
  191. this.selectProduct = res.data.cartInfo.map(item => {
  192. item.checked = false
  193. return item
  194. })
  195. if (res.data.cartInfo.length === 0) {
  196. uni.showToast({
  197. title: "订单无可售后商品",
  198. icon: 'none',
  199. duration: 2000
  200. });
  201. return
  202. }
  203. uni.hideLoading()
  204. })
  205. .catch(err => {
  206. uni.hideLoading()
  207. // uni.showToast({
  208. // title: err.msg || err.response.data.msg|| err.response.data.message,
  209. // icon: 'none',
  210. // duration: 2000
  211. // });
  212. });
  213. },
  214. getRefundReason() {
  215. getRefundReason().then(res => {
  216. this.reasonList = res.data;
  217. });
  218. },
  219. // 选择退款商品
  220. switchSelect (index) {
  221. let isAll = true
  222. this.selectProduct[index].checked = !this.selectProduct[index].checked
  223. this.selectProduct.forEach(item => {
  224. if (!item.checked) {
  225. isAll = false
  226. }
  227. })
  228. this.isAllSelect = isAll
  229. },
  230. // 全选
  231. allChecked () {
  232. this.isAllSelect = !this.isAllSelect
  233. this.selectProduct.forEach(item => {
  234. item.checked = this.isAllSelect
  235. })
  236. },
  237. // 选择退款类型
  238. chooseType (val) {
  239. this.selectProduct = this.selectProduct.map(item => {
  240. if (item.checked) {
  241. this.productParamList.push({
  242. productId: item.productId
  243. })
  244. return item
  245. }
  246. }).filter(r => r)
  247. this.selected = true;
  248. this.serviceType = val;
  249. this.getAfterSalesMoney();
  250. },
  251. submit() {
  252. const refund_reason_wap_explain = this.refund_reason_wap_explain;
  253. if (!this.reason) {
  254. uni.showToast({
  255. title: "请选择退款原因",
  256. icon: 'none',
  257. duration: 2000
  258. });
  259. return
  260. }
  261. this.$api.request('post', 'order/app/storeAfterSales/applyForAfterSales', {
  262. orderCode: this.orderInfo.orderId,
  263. serviceType: this.serviceType,
  264. reasonForApplication: this.reason,
  265. applicationInstructions: refund_reason_wap_explain,
  266. applicationDescriptionPicture: this.refund_reason_wap_img.join(","),
  267. productParamList: this.productParamList
  268. }).then(res => {
  269. if (res.code === 200) {
  270. uni.showToast({
  271. title: res.msg,
  272. icon: "success",
  273. duration: 2000
  274. });
  275. setTimeout(() => {
  276. uni.navigateTo({
  277. url: "/pages/refund/index"
  278. })
  279. }, 1500)
  280. }
  281. })
  282. .catch(err => {
  283. uni.showToast({
  284. title: err.msg || err.response.data.msg|| err.response.data.message,
  285. icon: 'none',
  286. duration: 2000
  287. });
  288. });
  289. }
  290. }
  291. };
  292. </script>
  293. <style lang="scss" scoped>
  294. .apply-return{
  295. .selectProduct{
  296. margin-bottom: 180rpx;
  297. .selectContainer{
  298. padding: 20rpx 32rpx;
  299. background-color: #FFF;
  300. display: flex;
  301. align-items: center;
  302. .pictrue{
  303. .image{
  304. width: 180rpx;
  305. height: 180rpx;
  306. }
  307. }
  308. .content{
  309. width: 100%;
  310. height: 100%;
  311. margin-left: 16rpx;
  312. font-size: 24rpx;
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: space-between;
  316. .title{
  317. width: 100%;
  318. height: 80rpx;
  319. text-overflow: ellipsis;
  320. font-size: 28rpx;
  321. }
  322. .skus{
  323. display: flex;
  324. justify-content: space-between;
  325. color: #999999;
  326. }
  327. .money{
  328. margin-top: 10rpx;
  329. display: flex;
  330. view{
  331. color: #EB3729;
  332. }
  333. }
  334. }
  335. }
  336. .choose{
  337. width: 100%;
  338. padding: 20rpx 30rpx;
  339. background-color: #FFF;
  340. position: fixed;
  341. bottom: 0;
  342. height: 180rpx;
  343. .checkTotal{
  344. height: 80rpx;
  345. font-size: 28rpx;
  346. border-bottom: 2rpx solid #F3F4F5;
  347. display: flex;
  348. justify-content: space-between;
  349. align-items: center;
  350. .total{
  351. display: flex;
  352. .proTotal{
  353. color: #666;
  354. }
  355. .moneyTotal{
  356. color: #333;
  357. margin-left: 30rpx;
  358. }
  359. }
  360. }
  361. .typeBtn{
  362. margin-top: 10rpx;
  363. display: flex;
  364. justify-content: flex-end;
  365. align-items: center;
  366. .button{
  367. width: 160rpx;
  368. height: 60rpx;
  369. margin: 0 10rpx;
  370. line-height: 60rpx;
  371. text-align: center;
  372. font-size: 24rpx;
  373. border-radius: 180rpx;
  374. }
  375. .def{
  376. color: #AAAAAA;
  377. border: 2rpx solid #DDDDDD;
  378. }
  379. .greenBtn{
  380. color: #FFF;
  381. background-color: #EB3729;
  382. }
  383. }
  384. }
  385. }
  386. }
  387. /**/
  388. .goodsStyle {
  389. background-color: #fff;
  390. padding: 0.22 * 100rpx 0.3 * 100rpx;
  391. }
  392. .goodsStyle .pictrue {
  393. width: 1.2 * 100rpx;
  394. height: 1.2 * 100rpx;
  395. }
  396. .goodsStyle .pictrue .image {
  397. width: 100%;
  398. height: 100%;
  399. border-radius: 0.06 * 100rpx;
  400. }
  401. .goodsStyle .text {
  402. width: 5.45 * 100rpx;
  403. font-size: 0.28 * 100rpx;
  404. color: #999;
  405. }
  406. .goodsStyle .text .name {
  407. width: 3.6 * 100rpx;
  408. color: #282828;
  409. }
  410. .goodsStyle .text .money {
  411. text-align: right;
  412. }
  413. .goodsStyle .text .money .num {
  414. margin-top: 0.07 * 100rpx;
  415. }
  416. /* layout */
  417. .acea-row {
  418. display: flex;
  419. flex-wrap: wrap;
  420. /* 辅助类 */
  421. }
  422. .acea-row.row-between {
  423. justify-content: space-between;
  424. }
  425. /*申请退货*/
  426. .apply-return .list {
  427. background-color: #fff;
  428. margin-top: 0.18 * 100rpx;
  429. }
  430. .apply-return .list .item {
  431. margin-left: 0.3 * 100rpx;
  432. padding-right: 0.3 * 100rpx;
  433. min-height: 0.9 * 100rpx;
  434. border-bottom: 1px solid #eee;
  435. font-size: 0.3 * 100rpx;
  436. color: #333;
  437. }
  438. .apply-return .list .item .num {
  439. color: #282828;
  440. flex: 1;
  441. text-align: right;
  442. position: relative;
  443. }
  444. .apply-return .list .item .num .picker {
  445. text-align: right;
  446. }
  447. .apply-return .list .item .num .iconfont {
  448. color: #666;
  449. font-size: 0.3 * 100rpx;
  450. position: absolute;
  451. right: 0;
  452. top: 50%;
  453. transform: translateY(-50%);
  454. }
  455. .apply-return .list .item.textarea {
  456. padding: 0.3 * 100rpx 0.3 * 100rpx 0.3 * 100rpx 0;
  457. }
  458. .apply-return .list .item textarea {
  459. height: 1 * 100rpx;
  460. font-size: 0.3 * 100rpx;
  461. }
  462. .apply-return .list .item textarea::placeholder {
  463. color: #bbb;
  464. }
  465. .apply-return .list .item .title {
  466. height: 0.95 * 100rpx;
  467. width: 100%;
  468. }
  469. .apply-return .list .item .title .tip {
  470. font-size: 0.3 * 100rpx;
  471. color: #bbb;
  472. }
  473. .apply-return .list .item .upload {
  474. padding-bottom: 0.36 * 100rpx;
  475. }
  476. .apply-return .list .item .upload .pictrue {
  477. margin: 0.22 * 100rpx 0.23 * 100rpx 0 0;
  478. width: 1.56 * 100rpx;
  479. height: 1.56 * 100rpx;
  480. position: relative;
  481. font-size: 0.24 * 100rpx;
  482. color: #bbb;
  483. border: 1px solid #bbb;
  484. }
  485. .apply-return .list .item .upload .pictrue:nth-of-type(4n) {
  486. margin-right: 0;
  487. }
  488. .apply-return .list .item .upload .pictrue image {
  489. width: 100%;
  490. height: 100%;
  491. border-radius: 0.03 * 100rpx;
  492. }
  493. .apply-return .list .item .upload .pictrue .icon-guanbi1 {
  494. position: absolute;
  495. font-size: 0.45 * 100rpx;
  496. top: -0.1 * 100rpx;
  497. right: -0.1 * 100rpx;
  498. width: 0.45 * 100rpx;
  499. height: 0.45 * 100rpx;
  500. line-height: 0.45 * 100rpx;
  501. }
  502. .apply-return .list .item .upload .pictrue .icon-icon25201 {
  503. color: #bfbfbf;
  504. font-size: 0.5 * 100rpx;
  505. width: 0.5 * 100rpx;
  506. height: 0.6 * 100rpx;
  507. line-height: 0.6 * 100rpx;
  508. }
  509. .apply-return .list .item .upload .pictrue:nth-last-child(1) {
  510. border: 1px solid #ddd;
  511. }
  512. .apply-return .returnBnt {
  513. font-size: 0.32 * 100rpx;
  514. color: #fff;
  515. width: 6.9 * 100rpx;
  516. height: 0.86 * 100rpx;
  517. border-radius: 0.5 * 100rpx;
  518. text-align: center;
  519. line-height: 0.86 * 100rpx;
  520. margin: 0.43 * 100rpx auto;
  521. }
  522. .acea-row.row-between-wrapper {
  523. align-items: center;
  524. justify-content: space-between;
  525. }
  526. .bg-color-red {
  527. background-color: #eb3729 !important;
  528. }
  529. </style>