refund-detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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">品相:{{ conditionTypeMap[goods.conditionType] || '默认' }}
  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: 120rpx;" 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: "auto",
  122. right: 0,
  123. bottom: "20%",
  124. },
  125. conditionTypeMap: {
  126. '1': '良好',
  127. '2': '中等',
  128. '3': '次品',
  129. '4': '全新'
  130. },
  131. refundOrderId: '',
  132. orderInfo: {
  133. status: '',
  134. restAuditSecond: 0,
  135. detailList: [],
  136. refundMoney: 0,
  137. refundReason: '',
  138. createTime: '',
  139. refundOrderId: '',
  140. showCancel: 0,
  141. showModifyApply: 0,
  142. showComplaint: 0,
  143. showClose: 0
  144. },
  145. btnStyle: {
  146. marginLeft: '20rpx',
  147. minWidth: '160rpx',
  148. height: '64rpx',
  149. lineHeight: '64rpx',
  150. padding: '0 20rpx',
  151. color: '#666',
  152. borderColor: '#ccc',
  153. fontSize: '28rpx',
  154. },
  155. primaryBtnStyle: {
  156. marginLeft: '20rpx',
  157. minWidth: '160rpx',
  158. height: '64rpx',
  159. lineHeight: '64rpx',
  160. padding: '0 20rpx',
  161. backgroundColor: '#38C148',
  162. color: '#fff',
  163. border: 'none'
  164. }
  165. };
  166. },
  167. computed: {
  168. showBottomBar() {
  169. const { showCancel, showModifyApply, showComplaint, showClose } = this.orderInfo;
  170. return showCancel == 1 || showModifyApply == 1 || showComplaint == 1 || showClose == 1;
  171. }
  172. },
  173. onLoad(options) {
  174. if (options.refundOrderId) {
  175. this.refundOrderId = options.refundOrderId;
  176. this.getDetail();
  177. } else if (options.orderId) {
  178. // 兼容处理:如果传入的是 orderId,尝试通过 orderId 获取退款单(如果后端支持)
  179. // 或者提示错误
  180. // 假设暂时用 refundOrderId
  181. this.refundOrderId = options.orderId; // 尝试用这个ID
  182. this.getDetail();
  183. }
  184. },
  185. methods: {
  186. getDetail() {
  187. this.$u.api.getNewRefundOrderDetailAjax({
  188. refundOrderId: this.refundOrderId
  189. }).then(res => {
  190. if (res.code == 200) {
  191. this.orderInfo = res.data;
  192. }
  193. });
  194. },
  195. getStatusText(status) {
  196. // 状态 1-申请退款 2-审核通过 3-审核驳回 4-超时关闭 5-卖家已发货 6-已完成
  197. const map = {
  198. '1': '待卖家处理',
  199. '2': '审核通过',
  200. '3': '审核驳回',
  201. '4': '退款关闭', // 超时关闭
  202. '5': '卖家已发货', // 可能是换货场景
  203. '6': '退款成功'
  204. };
  205. return map[status] || '处理中';
  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. navigateToCustomerService() {
  220. // 联系客服
  221. uni.navigateTo({
  222. url: '/pages/customer-service/index'
  223. });
  224. },
  225. // 处理位置变更
  226. handlePositionChange(position) {
  227. this.servicePosition = position;
  228. },
  229. handleAction(type) {
  230. switch (type) {
  231. case 'cancel':
  232. // 撤销申请逻辑
  233. uni.showModal({
  234. title: '提示',
  235. content: '确定要撤销退款申请吗?',
  236. success: (res) => {
  237. if (res.confirm) {
  238. // 调用撤销接口 (需确认接口名)
  239. // 假设: cancelRefundAjax
  240. uni.showToast({ title: '撤销申请', icon: 'none' });
  241. }
  242. }
  243. });
  244. break;
  245. case 'modify':
  246. // 修改申请
  247. uni.showToast({ title: '修改申请', icon: 'none' });
  248. break;
  249. case 'complaint':
  250. uni.navigateTo({
  251. url: `/pages-car/pages/complaint?orderId=${this.orderInfo.originOrderId}`
  252. });
  253. break;
  254. case 'close':
  255. // 关闭退款
  256. uni.showToast({ title: '关闭退款', icon: 'none' });
  257. break;
  258. }
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .service-btn {
  265. height: max-content;
  266. background-color: transparent;
  267. padding: 0;
  268. &::after {
  269. border: none;
  270. }
  271. }
  272. .refund-detail-page {
  273. min-height: 100vh;
  274. background-color: #F5F5F5;
  275. padding-bottom: 20rpx;
  276. .status-header {
  277. background-color: #fff;
  278. padding: 40rpx 30rpx;
  279. text-align: center;
  280. margin-bottom: 20rpx;
  281. .status-title {
  282. font-size: 36rpx;
  283. font-weight: bold;
  284. color: #333;
  285. margin-bottom: 20rpx;
  286. }
  287. .status-desc {
  288. font-size: 26rpx;
  289. color: #999;
  290. margin-bottom: 10rpx;
  291. }
  292. .status-tip {
  293. font-size: 24rpx;
  294. color: #999;
  295. }
  296. .refund-amount-box {
  297. margin-top: 30rpx;
  298. padding-top: 30rpx;
  299. .amount-row {
  300. display: flex;
  301. justify-content: space-between;
  302. align-items: center;
  303. font-size: 30rpx;
  304. .label {
  305. color: #333;
  306. }
  307. .value {
  308. color: #333;
  309. font-weight: bold;
  310. }
  311. }
  312. }
  313. }
  314. .info-card {
  315. background-color: #fff;
  316. margin: 20rpx;
  317. border-radius: 16rpx;
  318. padding: 30rpx;
  319. &.goods-card {
  320. .goods-item {
  321. display: flex;
  322. margin-bottom: 20rpx;
  323. &:last-child {
  324. margin-bottom: 0;
  325. }
  326. .goods-cover {
  327. width: 140rpx;
  328. height: 160rpx;
  329. border-radius: 8rpx;
  330. margin-right: 20rpx;
  331. flex-shrink: 0;
  332. }
  333. .goods-info {
  334. flex: 1;
  335. position: relative;
  336. .goods-title {
  337. font-size: 28rpx;
  338. color: #333;
  339. margin-bottom: 10rpx;
  340. }
  341. .goods-sku {
  342. font-size: 24rpx;
  343. color: #999;
  344. margin-bottom: 10rpx;
  345. }
  346. .price-box {
  347. display: flex;
  348. justify-content: space-between;
  349. align-items: center;
  350. .price {
  351. font-size: 28rpx;
  352. color: #333;
  353. }
  354. .num {
  355. font-size: 24rpx;
  356. color: #999;
  357. }
  358. }
  359. .refund-status-tag {
  360. position: absolute;
  361. right: 0;
  362. top: 50%; // Adjust as needed
  363. transform: translateY(-50%);
  364. font-size: 24rpx;
  365. color: #999;
  366. &.red-tag {
  367. color: #ff3b30;
  368. border: 1rpx solid #ff3b30;
  369. padding: 2rpx 10rpx;
  370. border-radius: 6rpx;
  371. font-size: 22rpx;
  372. }
  373. }
  374. }
  375. }
  376. }
  377. &.detail-card {
  378. .row {
  379. display: flex;
  380. justify-content: space-between;
  381. margin-bottom: 20rpx;
  382. font-size: 26rpx;
  383. &:last-child {
  384. margin-bottom: 0;
  385. }
  386. .label {
  387. color: #999;
  388. }
  389. .value {
  390. color: #333;
  391. &.flex-row {
  392. display: flex;
  393. align-items: center;
  394. }
  395. &.link-text {
  396. color: #38C148; // 使用主题色
  397. display: flex;
  398. align-items: center;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. .bottom-bar {
  405. position: fixed;
  406. bottom: 0;
  407. left: 0;
  408. right: 0;
  409. background-color: #fff;
  410. padding: 20rpx 30rpx;
  411. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  412. display: flex;
  413. justify-content: space-between;
  414. align-items: center;
  415. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  416. z-index: 100;
  417. .service-btn {
  418. padding: 10rpx;
  419. }
  420. .btn-group {
  421. display: flex;
  422. align-items: center;
  423. justify-content: flex-end;
  424. width: 100%;
  425. }
  426. }
  427. }
  428. </style>