refund-detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  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.showToast({ title: '修改申请', icon: 'none' });
  242. break;
  243. case 'complaint':
  244. uni.navigateTo({
  245. url: `/pages-car/pages/complaint?orderId=${this.orderInfo.originOrderId}`
  246. });
  247. break;
  248. case 'close':
  249. // 关闭退款
  250. uni.showToast({ title: '关闭退款', icon: 'none' });
  251. break;
  252. }
  253. }
  254. }
  255. }
  256. </script>
  257. <style lang="scss" scoped>
  258. .service-btn {
  259. height: max-content;
  260. background-color: transparent;
  261. padding: 0;
  262. &::after {
  263. border: none;
  264. }
  265. }
  266. .refund-detail-page {
  267. min-height: 100vh;
  268. background-color: #F5F5F5;
  269. padding-bottom: 20rpx;
  270. .status-header {
  271. background-color: #fff;
  272. padding: 40rpx 30rpx;
  273. text-align: center;
  274. margin-bottom: 20rpx;
  275. .status-title {
  276. font-size: 36rpx;
  277. font-weight: bold;
  278. color: #333;
  279. margin-bottom: 20rpx;
  280. }
  281. .status-desc {
  282. font-size: 26rpx;
  283. color: #999;
  284. margin-bottom: 10rpx;
  285. }
  286. .status-tip {
  287. font-size: 24rpx;
  288. color: #999;
  289. }
  290. .refund-amount-box {
  291. margin-top: 30rpx;
  292. padding-top: 30rpx;
  293. .amount-row {
  294. display: flex;
  295. justify-content: space-between;
  296. align-items: center;
  297. font-size: 30rpx;
  298. .label {
  299. color: #333;
  300. }
  301. .value {
  302. color: #333;
  303. font-weight: bold;
  304. }
  305. }
  306. }
  307. }
  308. .info-card {
  309. background-color: #fff;
  310. margin: 20rpx;
  311. border-radius: 16rpx;
  312. padding: 30rpx;
  313. &.goods-card {
  314. .goods-item {
  315. display: flex;
  316. margin-bottom: 20rpx;
  317. &:last-child {
  318. margin-bottom: 0;
  319. }
  320. .goods-cover {
  321. width: 140rpx;
  322. height: 160rpx;
  323. border-radius: 8rpx;
  324. margin-right: 20rpx;
  325. flex-shrink: 0;
  326. }
  327. .goods-info {
  328. flex: 1;
  329. position: relative;
  330. .goods-title {
  331. font-size: 28rpx;
  332. color: #333;
  333. margin-bottom: 10rpx;
  334. }
  335. .goods-sku {
  336. font-size: 24rpx;
  337. color: #999;
  338. margin-bottom: 10rpx;
  339. }
  340. .price-box {
  341. display: flex;
  342. justify-content: space-between;
  343. align-items: center;
  344. margin-top: 20rpx;
  345. .price {
  346. font-size: 28rpx;
  347. color: #333;
  348. }
  349. .num {
  350. font-size: 24rpx;
  351. color: #999;
  352. }
  353. }
  354. .refund-status-tag {
  355. position: absolute;
  356. right: 0;
  357. top: 50%; // Adjust as needed
  358. transform: translateY(-50%);
  359. font-size: 24rpx;
  360. color: #999;
  361. &.red-tag {
  362. color: #ff3b30;
  363. border: 1rpx solid #ff3b30;
  364. padding: 2rpx 10rpx;
  365. border-radius: 6rpx;
  366. font-size: 22rpx;
  367. }
  368. }
  369. }
  370. }
  371. }
  372. &.detail-card {
  373. .row {
  374. display: flex;
  375. justify-content: space-between;
  376. margin-bottom: 20rpx;
  377. font-size: 26rpx;
  378. &:last-child {
  379. margin-bottom: 0;
  380. }
  381. .label {
  382. color: #999;
  383. }
  384. .value {
  385. color: #333;
  386. &.flex-row {
  387. display: flex;
  388. align-items: center;
  389. }
  390. &.link-text {
  391. color: #38C148; // 使用主题色
  392. display: flex;
  393. align-items: center;
  394. }
  395. }
  396. }
  397. }
  398. }
  399. .bottom-bar {
  400. position: fixed;
  401. bottom: 0;
  402. left: 0;
  403. right: 0;
  404. background-color: #fff;
  405. padding: 20rpx 30rpx;
  406. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  407. display: flex;
  408. justify-content: space-between;
  409. align-items: center;
  410. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  411. z-index: 100;
  412. .service-btn {
  413. padding: 10rpx;
  414. }
  415. .btn-group {
  416. display: flex;
  417. align-items: center;
  418. justify-content: flex-end;
  419. width: 100%;
  420. }
  421. }
  422. }
  423. </style>