after-sale.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <template>
  2. <view class="audit">
  3. <view>
  4. <view class="audit_bg flexC" :style="{
  5. background:
  6. (orderInfo.status == 2 && type == 1) || (orderInfo.apply_cancel == 3 && type == 0)
  7. ? failBg
  8. : (orderInfo.status == 1 && type == 1) || (orderInfo.apply_cancel == 2 && type == 0)
  9. ? suceBg
  10. : auditBg
  11. }">
  12. <view class="audit_state flexC"
  13. v-if="(orderInfo.status == 0 && type == 1) || (orderInfo.apply_cancel == 1 && type == 0)">
  14. <image src="../../../static/imgs/shop/audit.png" class="state_icon"></image>
  15. <view>
  16. <view>{{ type == 0 ? '取消订单' : '退货' }}审核中...</view>
  17. <text>正在审核请耐心等待</text>
  18. </view>
  19. </view>
  20. <view class="audit_state flexC"
  21. v-if="(orderInfo.status == 2 && type == 1) || (orderInfo.apply_cancel == 3 && type == 0)">
  22. <image src="../../static/fail.png" class="state_icon"></image>
  23. <view>
  24. <view>{{ type == 0 ? '取消订单失败' : '退货已驳回' }}</view>
  25. <text>{{ orderInfo.updated_at }}</text>
  26. </view>
  27. </view>
  28. <view class="audit_state flexC"
  29. v-if="(orderInfo.status == 1 && type == 1) || (orderInfo.apply_cancel == 2 && type == 0)">
  30. <image src="../../static/suce.png" class="state_icon"></image>
  31. <view>
  32. <view>{{ type == 0 ? '取消订单' : '退货' }}成功</view>
  33. <text>{{ orderInfo.updated_at }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="audit_con">
  38. <view class="refund flexB">
  39. <view>退款金额</view>
  40. <view class="total">
  41. <text class="price">¥</text>
  42. <text v-if="goods">{{ goods | cancelPrice }}</text>
  43. </view>
  44. </view>
  45. <view class="goods_info">
  46. <view class="title">{{ type == 0 ? '商品信息' : '退货信息' }}</view>
  47. <view v-for="item in goods" :key="item.id" class="goods_con">
  48. <view class="flexS">
  49. <image :src="item.img" class="goods_img"></image>
  50. <view>
  51. <text class="goods_name">{{ item.name }}</text>
  52. <view class="one_year" style="width:120rpx;">3条装</view>
  53. </view>
  54. </view>
  55. <view class="goods_size">
  56. <view class="size_box flexB" v-for="temp in item.sku" :key="temp.id">
  57. <text>{{ temp.type }}</text>
  58. <text>{{ temp.size }}</text>
  59. <text>{{ temp.price }}</text>
  60. <text>X{{ temp.num }}</text>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="flexE" style="margin-top:20rpx;">
  65. <text class="gray" v-if="goods">共{{ goods | totalNum }}套</text>
  66. <text class="gray">合计:</text>
  67. <text class="total">
  68. <text>¥</text>
  69. <text class="price" v-if="goods">{{ goods | cancelPrice }}</text>
  70. </text>
  71. </view>
  72. </view>
  73. <view class="audit_order">
  74. <view class="order_top">
  75. <view class="label flexS">
  76. <view>
  77. <text>订单号:</text>
  78. <text style="font-size:24rpx;">{{ orderInfo.order_no }}</text>
  79. </view>
  80. <view class="copy_new_btn" @click="copy(orderInfo.order_no)">复制</view>
  81. </view>
  82. <view class="label flexS" v-if="type == 1">
  83. <view>
  84. <text>退单号:</text>
  85. <text style="font-size:24rpx;">{{ orderInfo.refund_no }}</text>
  86. </view>
  87. <view class="copy_new_btn" @click="copy(orderInfo.refund_no)">复制</view>
  88. </view>
  89. <view class="label">
  90. <text>申请时间:</text>
  91. <text>{{ orderInfo.created_at ? orderInfo.created_at : orderInfo.cancel && orderInfo.cancel.created_at }}</text>
  92. </view>
  93. <view class="label">
  94. <text>服务类型:</text>
  95. <text>{{ type == 0 ? '取消订单' : '退货' }}</text>
  96. </view>
  97. </view>
  98. <view class="order_bottom" v-if="orderInfo.reason">
  99. <view class="label">
  100. <text>{{ type == 0 ? '取消' : '退货' }}原因:</text>
  101. <text
  102. style="color:#F76454">{{ orderInfo.reason ? orderInfo.reason : orderInfo.cancel && orderInfo.cancel.reason }}</text>
  103. </view>
  104. <view class="label" v-if="type == 1 && orderInfo.reason_all">
  105. <text>补充说明:</text>
  106. <text style="color:#F76454">{{ orderInfo.reason_all }}</text>
  107. </view>
  108. <view class="img_box flexS" v-if="type == 1 && imgs">
  109. <view v-for="(item, index) in imgs" :key="index">
  110. <image :src="item" @click="previewImg(item,imgs)"></image>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="reject_box" v-if="orderInfo.cancel && orderInfo.cancel.remark">
  116. <view class="label">
  117. <text>驳回原因:</text>
  118. <text>{{ orderInfo.cancel.remark }}</text>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="fixed_bottom flexC" v-if="orderInfo.status == 0 && orderInfo.op_type == 2"
  123. @click.stop="cancelRefund()">
  124. <view class="flexC">取消退货</view>
  125. </view>
  126. </view>
  127. </view>
  128. </template>
  129. <script>
  130. import {
  131. handleClipboard
  132. } from '@/common/util/utils.js';
  133. import {
  134. orderQuery,
  135. refundOrderDetail,
  136. cancelRefund
  137. } from '@/apis/shop.js';
  138. export default {
  139. data() {
  140. return {
  141. orderInfo: '', //订单信息
  142. goods: '', //商品信息
  143. imgs: '', //退货时上传的图片
  144. type: '', //类型 1是取消订单 0退货订单
  145. remark: '', //驳回申请的原因
  146. suceBg: 'linear-gradient(315deg, #5fbc23 0%, #85ce52 100%)', //成功背景
  147. failBg: 'linear-gradient(45deg, #f86638 0%, #f44545 100%)', //失败背景
  148. auditBg: 'linear-gradient(89deg, #ffbf63 0%, #fc8924 100%)', //审核中背景
  149. refund_id: '' //退货id
  150. };
  151. },
  152. onLoad(ops) {
  153. this.type = ops.type;
  154. this.refund_id = ops.refund_id;
  155. if (ops.refund_id) {
  156. this.getDetail(ops.refund_id);
  157. } else {
  158. this.getOrder(ops.order_no);
  159. }
  160. },
  161. filters: {
  162. //取消订单总金额
  163. cancelPrice(data) {
  164. let cancelPrice = 0;
  165. data.map(i => {
  166. i.sku.map(j => {
  167. cancelPrice += j.num * j.price;
  168. });
  169. });
  170. return cancelPrice;
  171. }
  172. },
  173. methods: {
  174. //点击预览图片
  175. previewImg(img, imgs) {
  176. uni.previewImage({
  177. urls: imgs,
  178. current: img
  179. })
  180. },
  181. //取消退货
  182. cancelRefund() {
  183. uni.showModal({
  184. content: '你确定要取消退货吗?',
  185. success: res => {
  186. if (res.confirm) {
  187. uni.showLoading({
  188. title: '取消中...'
  189. });
  190. cancelRefund({
  191. refund_id: this.refund_id
  192. })
  193. .then(res => {
  194. if (res.code == 200) {
  195. uni.showModal({
  196. content: '取消退货成功',
  197. showCancel: false,
  198. success: res => {
  199. if (res.confirm) {
  200. uni.reLaunch({
  201. url: '../refund-manage/refund-manage?status=' +
  202. 0
  203. });
  204. }
  205. }
  206. });
  207. } else {
  208. uni.showModal({
  209. content: res.data || '取消退货失败',
  210. showCancel: false
  211. });
  212. }
  213. uni.hideLoading();
  214. })
  215. .catch(err => {
  216. uni.hideLoading();
  217. });
  218. }
  219. }
  220. });
  221. },
  222. /*复制订单号*/
  223. copy(data) {
  224. uni.setClipboardData({
  225. data,
  226. success: res => {
  227. uni.showToast({
  228. title: '复制成功'
  229. });
  230. },
  231. fail() {
  232. uni.showToast({
  233. title: '复制失败',
  234. icon: 'none',
  235. });
  236. }
  237. })
  238. },
  239. /*获取退货订单详情*/
  240. getDetail(refund_id) {
  241. uni.showLoading({
  242. title: '加载中...'
  243. });
  244. refundOrderDetail({
  245. refund_id
  246. })
  247. .then(res => {
  248. if (res.code == 200) {
  249. this.orderInfo = res.data;
  250. this.goods = res.data.goods;
  251. let img = res.data.img;
  252. if (img) {
  253. this.imgs = JSON.parse(img);
  254. }
  255. } else {
  256. uni.showModal({
  257. content: res.msg || '获取详情失败',
  258. showCancel: false
  259. });
  260. }
  261. uni.hideLoading();
  262. })
  263. .catch(err => {
  264. uni.hideLoading();
  265. });
  266. },
  267. /*取消订单详情*/
  268. getOrder(order_no) {
  269. uni.showLoading({
  270. title: '加载中...'
  271. });
  272. orderQuery({
  273. order_no
  274. })
  275. .then(res => {
  276. if (res.code == 200) {
  277. this.orderInfo = res.data;
  278. this.goods = res.data.goods;
  279. } else {
  280. uni.showModal({
  281. content: res.msg || '获取订单详情失败',
  282. showCancel: false
  283. });
  284. }
  285. uni.hideLoading();
  286. })
  287. .catch(err => {
  288. uni.hideLoading();
  289. });
  290. },
  291. //查看订单详情
  292. skipDetail() {
  293. uni.navigateTo({
  294. url: '../order-info/order-info?order_no=' + this.info.order_no
  295. });
  296. }
  297. }
  298. };
  299. </script>
  300. <style>
  301. page {
  302. min-height: 100%;
  303. width: 100%;
  304. background: #f7f7f7;
  305. }
  306. </style>
  307. <style lang="scss" scoped>
  308. .audit {
  309. padding-bottom: 180rpx;
  310. }
  311. .audit_bg {
  312. width: 100%;
  313. height: 282rpx;
  314. .audit_state {
  315. view,
  316. text {
  317. color: #fff;
  318. font-size: 28rpx;
  319. }
  320. view {
  321. magin-bottom: 15rpx;
  322. font-size: 36rpx;
  323. font-weight: bold;
  324. }
  325. .state_icon {
  326. width: 150rpx;
  327. height: 115rpx;
  328. }
  329. }
  330. }
  331. .audit_con {
  332. width: 690rpx;
  333. margin: -52rpx auto 0;
  334. position: relative;
  335. // padding-bottom: 180rpx;
  336. >view {
  337. padding: 0 30rpx;
  338. background: #fff;
  339. border-radius: 24rpx;
  340. }
  341. .refund {
  342. height: 110rpx;
  343. }
  344. .goods_info {
  345. margin: 30rpx 0;
  346. padding: 30rpx 30rpx;
  347. .title {
  348. font-size: 32rpx;
  349. font-weight: bold;
  350. padding: 0 0 20rpx 0;
  351. }
  352. .goods_con {
  353. padding-bottom: 20rpx;
  354. .goods_img {
  355. width: 180rpx;
  356. height: 144rpx;
  357. border-radius: 8rpx;
  358. margin-right: 20rpx;
  359. }
  360. .goods_name {
  361. font-size: 30rpx;
  362. font-weight: bold;
  363. }
  364. }
  365. .size_box {
  366. width: 100%;
  367. background: #f9f9f9;
  368. padding: 15rpx 0;
  369. margin-top: 15rpx;
  370. border-radius: 8rpx;
  371. text {
  372. width: 20%;
  373. text-align: center;
  374. }
  375. }
  376. }
  377. .label {
  378. padding: 10rpx 0;
  379. text:first-child {
  380. font-size: 30rpx;
  381. color: #999;
  382. }
  383. text:last-child {
  384. font-size: 28rpx;
  385. color: #333;
  386. }
  387. }
  388. .audit_order {
  389. padding: 15rpx 20rpx;
  390. margin-bottom: 15rpx;
  391. .order_bottom {
  392. border-top: 2rpx solid #eeeeee;
  393. .img_box {
  394. image {
  395. width: 140rpx;
  396. height: 140rpx;
  397. border-radius: 8rpx;
  398. margin-right: 10rpx;
  399. }
  400. }
  401. }
  402. }
  403. .reject_box {
  404. padding: 15rpx 30rpx;
  405. }
  406. }
  407. .btn_box {
  408. width: 100%;
  409. height: 120rpx;
  410. background: #fff;
  411. position: fixed;
  412. bottom: 0;
  413. left: 0;
  414. z-index: 999;
  415. padding: 0 30rpx;
  416. view {
  417. width: 300rpx;
  418. height: 88rpx;
  419. border-radius: 44rpx;
  420. }
  421. view:first-child {
  422. border: 2rpx solid #cccccc;
  423. }
  424. view:last-child {
  425. background: linear-gradient(93deg, #ffbf63 0%, #fc8924 100%);
  426. color: #fff;
  427. }
  428. }
  429. //取消弹窗样式
  430. .cancel_box {
  431. padding-top: 30rpx;
  432. .reason_box {
  433. width: 90%;
  434. margin: 15rpx auto 0;
  435. textarea {
  436. width: 100%;
  437. height: 282rpx;
  438. background: #f7f7f7;
  439. padding: 30rpx;
  440. box-sizing: border-box;
  441. border-radius: 24rpx;
  442. }
  443. }
  444. .cancel_btn {
  445. margin-top: 50rpx;
  446. width: 100%;
  447. view {
  448. width: 300rpx;
  449. text-align: center;
  450. height: 88rpx;
  451. line-height: 88rpx;
  452. color: $base-color;
  453. border-radius: 44rpx;
  454. font-size: 32rpx;
  455. background: #fff4f3;
  456. border: 1rpx solid $base-color;
  457. }
  458. view:last-child {
  459. color: #fff;
  460. background: $base-color;
  461. }
  462. }
  463. }
  464. .fixed_bottom {
  465. width: 100%;
  466. background: #fff;
  467. height: 100rpx;
  468. position: fixed;
  469. bottom: 0;
  470. left: 0;
  471. view {
  472. width: 690rpx;
  473. height: 88rpx;
  474. margin: 0 auto;
  475. background: $base-line-bg;
  476. border-radius: 44rpx;
  477. color: #fff;
  478. font-size: 32rpx;
  479. }
  480. }
  481. </style>