refund-detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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="service-btn" @click="contactService">
  83. <!-- 假设有一个客服图标 -->
  84. <u-icon name="server-man" size="60" color="#666"></u-icon>
  85. </view>
  86. <view class="btn-group">
  87. <u-button v-if="orderInfo.showComplaint == 1" shape="circle" plain :custom-style="btnStyle"
  88. @click="handleAction('complaint')">投诉</u-button>
  89. <u-button v-if="orderInfo.showCancel == 1" shape="circle" plain :custom-style="btnStyle"
  90. @click="handleAction('cancel')">撤销申请</u-button>
  91. <u-button v-if="orderInfo.showModifyApply == 1" shape="circle" type="success"
  92. :custom-style="primaryBtnStyle" @click="handleAction('modify')">修改申请</u-button>
  93. <u-button v-if="orderInfo.showClose == 1" shape="circle" plain :custom-style="btnStyle"
  94. @click="handleAction('close')">关闭退款</u-button>
  95. </view>
  96. </view>
  97. <!-- 占位符 -->
  98. <view style="height: 120rpx;" v-if="showBottomBar"></view>
  99. </view>
  100. </template>
  101. <script>
  102. export default {
  103. data() {
  104. return {
  105. conditionTypeMap: {
  106. '1': '良好',
  107. '2': '中等',
  108. '3': '次品',
  109. '4': '全新'
  110. },
  111. refundOrderId: '',
  112. orderInfo: {
  113. status: '',
  114. restAuditSecond: 0,
  115. detailList: [],
  116. refundMoney: 0,
  117. refundReason: '',
  118. createTime: '',
  119. refundOrderId: '',
  120. showCancel: 0,
  121. showModifyApply: 0,
  122. showComplaint: 0,
  123. showClose: 0
  124. },
  125. btnStyle: {
  126. marginLeft: '20rpx',
  127. minWidth: '160rpx',
  128. height: '64rpx',
  129. lineHeight: '64rpx',
  130. padding: '0 20rpx',
  131. color: '#666',
  132. borderColor: '#ccc',
  133. fontSize: '28rpx',
  134. },
  135. primaryBtnStyle: {
  136. marginLeft: '20rpx',
  137. minWidth: '160rpx',
  138. height: '64rpx',
  139. lineHeight: '64rpx',
  140. padding: '0 20rpx',
  141. backgroundColor: '#38C148',
  142. color: '#fff',
  143. border: 'none'
  144. }
  145. };
  146. },
  147. computed: {
  148. showBottomBar() {
  149. const { showCancel, showModifyApply, showComplaint, showClose } = this.orderInfo;
  150. return showCancel == 1 || showModifyApply == 1 || showComplaint == 1 || showClose == 1;
  151. }
  152. },
  153. onLoad(options) {
  154. if (options.refundOrderId) {
  155. this.refundOrderId = options.refundOrderId;
  156. this.getDetail();
  157. } else if (options.orderId) {
  158. // 兼容处理:如果传入的是 orderId,尝试通过 orderId 获取退款单(如果后端支持)
  159. // 或者提示错误
  160. // 假设暂时用 refundOrderId
  161. this.refundOrderId = options.orderId; // 尝试用这个ID
  162. this.getDetail();
  163. }
  164. },
  165. methods: {
  166. getDetail() {
  167. this.$u.api.getNewRefundOrderDetailAjax({
  168. refundOrderId: this.refundOrderId
  169. }).then(res => {
  170. if (res.code == 200) {
  171. this.orderInfo = res.data;
  172. }
  173. });
  174. },
  175. getStatusText(status) {
  176. // 状态 1-申请退款 2-审核通过 3-审核驳回 4-超时关闭 5-卖家已发货 6-已完成
  177. const map = {
  178. '1': '待卖家处理',
  179. '2': '审核通过',
  180. '3': '审核驳回',
  181. '4': '退款关闭', // 超时关闭
  182. '5': '卖家已发货', // 可能是换货场景
  183. '6': '退款成功'
  184. };
  185. return map[status] || '处理中';
  186. },
  187. copyOrderNo() {
  188. uni.setClipboardData({
  189. data: String(this.orderInfo.refundOrderId || ''),
  190. success: () => {
  191. uni.showToast({ title: '复制成功', icon: 'none' });
  192. }
  193. });
  194. },
  195. goToHistory() {
  196. // 跳转协商历史页面 (如果有)
  197. uni.showToast({ title: '协商历史功能开发中', icon: 'none' });
  198. },
  199. contactService() {
  200. // 联系客服
  201. uni.navigateTo({
  202. url: '/pages/service/index'
  203. });
  204. },
  205. handleAction(type) {
  206. switch (type) {
  207. case 'cancel':
  208. // 撤销申请逻辑
  209. uni.showModal({
  210. title: '提示',
  211. content: '确定要撤销退款申请吗?',
  212. success: (res) => {
  213. if (res.confirm) {
  214. // 调用撤销接口 (需确认接口名)
  215. // 假设: cancelRefundAjax
  216. uni.showToast({ title: '撤销申请', icon: 'none' });
  217. }
  218. }
  219. });
  220. break;
  221. case 'modify':
  222. // 修改申请
  223. uni.showToast({ title: '修改申请', icon: 'none' });
  224. break;
  225. case 'complaint':
  226. uni.navigateTo({
  227. url: `/pages-car/pages/complaint?orderId=${this.orderInfo.originOrderId}`
  228. });
  229. break;
  230. case 'close':
  231. // 关闭退款
  232. uni.showToast({ title: '关闭退款', icon: 'none' });
  233. break;
  234. }
  235. }
  236. }
  237. }
  238. </script>
  239. <style lang="scss" scoped>
  240. .refund-detail-page {
  241. min-height: 100vh;
  242. background-color: #F5F5F5;
  243. padding-bottom: 20rpx;
  244. .status-header {
  245. background-color: #fff;
  246. padding: 40rpx 30rpx;
  247. text-align: center;
  248. margin-bottom: 20rpx;
  249. .status-title {
  250. font-size: 36rpx;
  251. font-weight: bold;
  252. color: #333;
  253. margin-bottom: 20rpx;
  254. }
  255. .status-desc {
  256. font-size: 26rpx;
  257. color: #999;
  258. margin-bottom: 10rpx;
  259. }
  260. .status-tip {
  261. font-size: 24rpx;
  262. color: #999;
  263. }
  264. .refund-amount-box {
  265. margin-top: 30rpx;
  266. border-top: 1rpx solid #eee;
  267. padding-top: 30rpx;
  268. .amount-row {
  269. display: flex;
  270. justify-content: space-between;
  271. align-items: center;
  272. font-size: 30rpx;
  273. .label {
  274. color: #333;
  275. }
  276. .value {
  277. color: #333;
  278. font-weight: bold;
  279. }
  280. }
  281. }
  282. }
  283. .info-card {
  284. background-color: #fff;
  285. margin: 20rpx;
  286. border-radius: 16rpx;
  287. padding: 30rpx;
  288. &.goods-card {
  289. .goods-item {
  290. display: flex;
  291. margin-bottom: 20rpx;
  292. &:last-child {
  293. margin-bottom: 0;
  294. }
  295. .goods-cover {
  296. width: 140rpx;
  297. height: 140rpx;
  298. border-radius: 8rpx;
  299. margin-right: 20rpx;
  300. flex-shrink: 0;
  301. }
  302. .goods-info {
  303. flex: 1;
  304. position: relative;
  305. .goods-title {
  306. font-size: 28rpx;
  307. color: #333;
  308. margin-bottom: 10rpx;
  309. }
  310. .goods-sku {
  311. font-size: 24rpx;
  312. color: #999;
  313. margin-bottom: 10rpx;
  314. }
  315. .price-box {
  316. display: flex;
  317. justify-content: space-between;
  318. align-items: center;
  319. .price {
  320. font-size: 28rpx;
  321. color: #333;
  322. }
  323. .num {
  324. font-size: 24rpx;
  325. color: #999;
  326. }
  327. }
  328. .refund-status-tag {
  329. position: absolute;
  330. right: 0;
  331. top: 50%; // Adjust as needed
  332. transform: translateY(-50%);
  333. font-size: 24rpx;
  334. color: #999;
  335. &.red-tag {
  336. color: #ff3b30;
  337. border: 1rpx solid #ff3b30;
  338. padding: 2rpx 10rpx;
  339. border-radius: 6rpx;
  340. font-size: 22rpx;
  341. }
  342. }
  343. }
  344. }
  345. }
  346. &.detail-card {
  347. .row {
  348. display: flex;
  349. justify-content: space-between;
  350. margin-bottom: 20rpx;
  351. font-size: 26rpx;
  352. &:last-child {
  353. margin-bottom: 0;
  354. }
  355. .label {
  356. color: #999;
  357. }
  358. .value {
  359. color: #333;
  360. &.flex-row {
  361. display: flex;
  362. align-items: center;
  363. }
  364. &.link-text {
  365. color: #38C148; // 使用主题色
  366. display: flex;
  367. align-items: center;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. .bottom-bar {
  374. position: fixed;
  375. bottom: 0;
  376. left: 0;
  377. right: 0;
  378. background-color: #fff;
  379. padding: 20rpx 30rpx;
  380. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  381. display: flex;
  382. justify-content: space-between;
  383. align-items: center;
  384. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  385. z-index: 100;
  386. .service-btn {
  387. padding: 10rpx;
  388. }
  389. .btn-group {
  390. display: flex;
  391. align-items: center;
  392. }
  393. }
  394. }
  395. </style>