refund-detail.vue 12 KB

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