refund-detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <view class="refund-detail-page">
  3. <!-- 状态头部 -->
  4. <view class="status-header">
  5. <template v-if="orderInfo.status == '1'">
  6. <view class="status-title">请等待平台处理</view>
  7. <!-- 倒计时 -->
  8. <view class="status-desc" v-if="orderInfo.restAuditSecond > 0">
  9. {{ formatCountDown(orderInfo.restAuditSecond) }}后平台未处理将自动同意
  10. </view>
  11. <view class="status-tip">您已成功发起退款申请,请耐心等待平台处理</view>
  12. </template>
  13. <template v-else>
  14. <view class="status-title">{{ getStatusText(orderInfo.status) }}</view>
  15. <!-- 退款成功金额展示 -->
  16. <view class="refund-amount-box" v-if="orderInfo.status == '6' || orderInfo.status == '2'">
  17. <view class="amount-row">
  18. <text class="label">退回余额</text>
  19. <text class="value">¥{{ orderInfo.refundMoney }}</text>
  20. </view>
  21. </view>
  22. </template>
  23. </view>
  24. <!-- 商品列表 -->
  25. <view class="info-card goods-card">
  26. <view class="goods-item" v-for="(goods, index) in orderInfo.detailList" :key="index">
  27. <image :src="goods.cover" mode="aspectFill" class="goods-cover"></image>
  28. <view class="goods-info">
  29. <view class="goods-title u-line-2">{{ goods.bookName }}</view>
  30. <view class="goods-sku" v-if="goods.isbn">品相:{{ goods.conditionName || '默认' }}</view>
  31. <view class="price-box">
  32. <text class="price">¥{{ goods.price }}</text>
  33. <text class="num">x{{ goods.refundNum }}</text>
  34. </view>
  35. <!-- 状态Badge -->
  36. <view class="refund-status-tag red-tag" v-if="orderInfo.status == '1'">
  37. <text>退款中</text>
  38. </view>
  39. <view class="refund-status-tag" v-if="orderInfo.status == '6'">退款成功</view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 退款信息 (包含协商历史) -->
  44. <view class="info-card detail-card">
  45. <!-- 协商历史 -->
  46. <view class="row history-row" @click="goToHistory">
  47. <text class="label">协商历史</text>
  48. <view class="value flex-row link-text">
  49. <text>查看</text>
  50. <!-- <u-icon name="arrow-right" color="#38C148" size="24"></u-icon> -->
  51. <image src="/static/images/arrow-right-green.png" style="width: 24rpx; height: 24rpx;" v-if="false"></image>
  52. <!-- 使用文字或默认图标 -->
  53. <u-icon name="lightning-fill" color="#38C148" size="28" style="margin-left: 6rpx;"></u-icon>
  54. </view>
  55. </view>
  56. <view class="row">
  57. <text class="label">退款原因</text>
  58. <text class="value">{{ orderInfo.refundReason }}</text>
  59. </view>
  60. <view class="row">
  61. <text class="label">申请金额</text>
  62. <text class="value">共{{ orderInfo.refundMoney }}元</text>
  63. </view>
  64. <view class="row">
  65. <text class="label">申请时间</text>
  66. <text class="value">{{ orderInfo.createTime }}</text>
  67. </view>
  68. <view class="row">
  69. <text class="label">退款编号</text>
  70. <view class="value flex-row">
  71. <text>{{ orderInfo.refundOrderId }}</text>
  72. <u-icon name="copy" size="28" color="#333" style="margin-left: 10rpx;" @click="copyOrderNo"></u-icon>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 底部操作栏 -->
  77. <view class="bottom-bar" v-if="showBottomBar">
  78. <view class="service-btn" @click="contactService">
  79. <!-- 假设有一个客服图标 -->
  80. <u-icon name="server-man" size="60" color="#666"></u-icon>
  81. </view>
  82. <view class="btn-group">
  83. <u-button v-if="orderInfo.showComplaint == 1" size="mini" shape="circle" plain :custom-style="btnStyle"
  84. @click="handleAction('complaint')">投诉</u-button>
  85. <u-button v-if="orderInfo.showCancel == 1" size="mini" shape="circle" plain :custom-style="btnStyle"
  86. @click="handleAction('cancel')">撤销申请</u-button>
  87. <u-button v-if="orderInfo.showModifyApply == 1" size="mini" shape="circle" type="success" :custom-style="primaryBtnStyle"
  88. @click="handleAction('modify')">修改申请</u-button>
  89. <u-button v-if="orderInfo.showClose == 1" size="mini" shape="circle" plain :custom-style="btnStyle"
  90. @click="handleAction('close')">关闭退款</u-button>
  91. </view>
  92. </view>
  93. <!-- 占位符 -->
  94. <view style="height: 120rpx;" v-if="showBottomBar"></view>
  95. </view>
  96. </template>
  97. <script>
  98. export default {
  99. data() {
  100. return {
  101. refundOrderId: '',
  102. orderInfo: {
  103. status: '',
  104. restAuditSecond: 0,
  105. detailList: [],
  106. refundMoney: 0,
  107. refundReason: '',
  108. createTime: '',
  109. refundOrderId: '',
  110. showCancel: 0,
  111. showModifyApply: 0,
  112. showComplaint: 0,
  113. showClose: 0
  114. },
  115. timer: null,
  116. btnStyle: {
  117. marginLeft: '20rpx',
  118. minWidth: '160rpx',
  119. height: '64rpx',
  120. lineHeight: '64rpx',
  121. padding: '0 20rpx',
  122. color: '#666',
  123. borderColor: '#ccc'
  124. },
  125. primaryBtnStyle: {
  126. marginLeft: '20rpx',
  127. minWidth: '160rpx',
  128. height: '64rpx',
  129. lineHeight: '64rpx',
  130. padding: '0 20rpx',
  131. backgroundColor: '#38C148',
  132. color: '#fff',
  133. border: 'none'
  134. }
  135. };
  136. },
  137. computed: {
  138. showBottomBar() {
  139. const { showCancel, showModifyApply, showComplaint, showClose } = this.orderInfo;
  140. return showCancel == 1 || showModifyApply == 1 || showComplaint == 1 || showClose == 1;
  141. }
  142. },
  143. onLoad(options) {
  144. if (options.refundOrderId) {
  145. this.refundOrderId = options.refundOrderId;
  146. this.getDetail();
  147. } else if (options.orderId) {
  148. // 兼容处理:如果传入的是 orderId,尝试通过 orderId 获取退款单(如果后端支持)
  149. // 或者提示错误
  150. // 假设暂时用 refundOrderId
  151. this.refundOrderId = options.orderId; // 尝试用这个ID
  152. this.getDetail();
  153. }
  154. },
  155. onUnload() {
  156. if (this.timer) clearInterval(this.timer);
  157. },
  158. methods: {
  159. getDetail() {
  160. this.$u.api.getNewRefundOrderDetailAjax({
  161. refundOrderId: this.refundOrderId
  162. }).then(res => {
  163. if (res.code == 200) {
  164. this.orderInfo = res.data;
  165. if (this.orderInfo.restAuditSecond > 0) {
  166. this.startTimer();
  167. }
  168. }
  169. });
  170. },
  171. getStatusText(status) {
  172. // 状态 1-申请退款 2-审核通过 3-审核驳回 4-超时关闭 5-卖家已发货 6-已完成
  173. const map = {
  174. '1': '待卖家处理',
  175. '2': '审核通过',
  176. '3': '审核驳回',
  177. '4': '退款关闭', // 超时关闭
  178. '5': '卖家已发货', // 可能是换货场景
  179. '6': '退款成功'
  180. };
  181. return map[status] || '处理中';
  182. },
  183. formatCountDown(seconds) {
  184. if (seconds <= 0) return '0分';
  185. const d = Math.floor(seconds / 86400);
  186. const h = Math.floor((seconds % 86400) / 3600);
  187. const m = Math.floor((seconds % 3600) / 60);
  188. let str = '';
  189. if (d > 0) str += `${d}天`;
  190. if (h > 0) str += `${h}时`;
  191. if (m > 0) str += `${m}分`;
  192. if (!str) str = '即将';
  193. return str;
  194. },
  195. startTimer() {
  196. if (this.timer) clearInterval(this.timer);
  197. this.timer = setInterval(() => {
  198. if (this.orderInfo.restAuditSecond > 0) {
  199. this.orderInfo.restAuditSecond--;
  200. } else {
  201. clearInterval(this.timer);
  202. // 倒计时结束,刷新页面
  203. this.getDetail();
  204. }
  205. }, 1000);
  206. },
  207. copyOrderNo() {
  208. uni.setClipboardData({
  209. data: String(this.orderInfo.refundOrderId || ''),
  210. success: () => {
  211. uni.showToast({ title: '复制成功', icon: 'none' });
  212. }
  213. });
  214. },
  215. goToHistory() {
  216. // 跳转协商历史页面 (如果有)
  217. uni.showToast({ title: '协商历史功能开发中', icon: 'none' });
  218. },
  219. contactService() {
  220. // 联系客服
  221. uni.navigateTo({
  222. url: '/pages/service/index'
  223. });
  224. },
  225. handleAction(type) {
  226. switch (type) {
  227. case 'cancel':
  228. // 撤销申请逻辑
  229. uni.showModal({
  230. title: '提示',
  231. content: '确定要撤销退款申请吗?',
  232. success: (res) => {
  233. if (res.confirm) {
  234. // 调用撤销接口 (需确认接口名)
  235. // 假设: cancelRefundAjax
  236. uni.showToast({ title: '撤销申请', icon: 'none' });
  237. }
  238. }
  239. });
  240. break;
  241. case 'modify':
  242. // 修改申请
  243. uni.showToast({ title: '修改申请', icon: 'none' });
  244. break;
  245. case 'complaint':
  246. // 投诉
  247. uni.navigateTo({
  248. url: `/pages-car/pages/complaint?orderId=${this.orderInfo.orderId}`
  249. });
  250. break;
  251. case 'close':
  252. // 关闭退款
  253. uni.showToast({ title: '关闭退款', icon: 'none' });
  254. break;
  255. }
  256. }
  257. }
  258. }
  259. </script>
  260. <style lang="scss" scoped>
  261. .refund-detail-page {
  262. min-height: 100vh;
  263. background-color: #F5F5F5;
  264. padding-bottom: 20rpx;
  265. .status-header {
  266. background-color: #fff;
  267. padding: 40rpx 30rpx;
  268. text-align: center;
  269. margin-bottom: 20rpx;
  270. .status-title {
  271. font-size: 36rpx;
  272. font-weight: bold;
  273. color: #333;
  274. margin-bottom: 20rpx;
  275. }
  276. .status-desc {
  277. font-size: 26rpx;
  278. color: #999;
  279. margin-bottom: 10rpx;
  280. }
  281. .status-tip {
  282. font-size: 24rpx;
  283. color: #999;
  284. }
  285. .refund-amount-box {
  286. margin-top: 30rpx;
  287. border-top: 1rpx solid #eee;
  288. padding-top: 30rpx;
  289. .amount-row {
  290. display: flex;
  291. justify-content: space-between;
  292. align-items: center;
  293. font-size: 30rpx;
  294. .label {
  295. color: #333;
  296. }
  297. .value {
  298. color: #333;
  299. font-weight: bold;
  300. }
  301. }
  302. }
  303. }
  304. .info-card {
  305. background-color: #fff;
  306. margin: 20rpx;
  307. border-radius: 16rpx;
  308. padding: 30rpx;
  309. &.goods-card {
  310. .goods-item {
  311. display: flex;
  312. margin-bottom: 20rpx;
  313. &:last-child {
  314. margin-bottom: 0;
  315. }
  316. .goods-cover {
  317. width: 140rpx;
  318. height: 140rpx;
  319. border-radius: 8rpx;
  320. margin-right: 20rpx;
  321. flex-shrink: 0;
  322. }
  323. .goods-info {
  324. flex: 1;
  325. position: relative;
  326. .goods-title {
  327. font-size: 28rpx;
  328. color: #333;
  329. margin-bottom: 10rpx;
  330. }
  331. .goods-sku {
  332. font-size: 24rpx;
  333. color: #999;
  334. margin-bottom: 10rpx;
  335. }
  336. .price-box {
  337. display: flex;
  338. justify-content: space-between;
  339. align-items: center;
  340. .price {
  341. font-size: 28rpx;
  342. color: #333;
  343. }
  344. .num {
  345. font-size: 24rpx;
  346. color: #999;
  347. }
  348. }
  349. .refund-status-tag {
  350. position: absolute;
  351. right: 0;
  352. top: 50%; // Adjust as needed
  353. transform: translateY(-50%);
  354. font-size: 24rpx;
  355. color: #999;
  356. &.red-tag {
  357. color: #ff3b30;
  358. border: 1rpx solid #ff3b30;
  359. padding: 2rpx 10rpx;
  360. border-radius: 6rpx;
  361. font-size: 22rpx;
  362. }
  363. }
  364. }
  365. }
  366. }
  367. &.detail-card {
  368. .row {
  369. display: flex;
  370. justify-content: space-between;
  371. margin-bottom: 20rpx;
  372. font-size: 26rpx;
  373. &:last-child {
  374. margin-bottom: 0;
  375. }
  376. .label {
  377. color: #999;
  378. }
  379. .value {
  380. color: #333;
  381. &.flex-row {
  382. display: flex;
  383. align-items: center;
  384. }
  385. &.link-text {
  386. color: #38C148; // 使用主题色
  387. display: flex;
  388. align-items: center;
  389. }
  390. }
  391. }
  392. }
  393. }
  394. .bottom-bar {
  395. position: fixed;
  396. bottom: 0;
  397. left: 0;
  398. right: 0;
  399. background-color: #fff;
  400. padding: 20rpx 30rpx;
  401. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: center;
  405. box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.05);
  406. z-index: 100;
  407. .service-btn {
  408. padding: 10rpx;
  409. }
  410. .btn-group {
  411. display: flex;
  412. align-items: center;
  413. }
  414. }
  415. }
  416. </style>