refund-details.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <view class="page">
  3. <u-navbar title="退款详情" :autoBack="true" :placeholder="true" :border-bottom="false"></u-navbar>
  4. <view v-if="loading" class="state-tip">加载中...</view>
  5. <view v-else-if="!hasDetail" class="state-tip">暂无退款详情</view>
  6. <scroll-view v-else class="content" scroll-y>
  7. <view class="status-card">
  8. <text class="status-title">{{ product.orderStatusName || '--' }}</text>
  9. <text class="status-time">{{ statusTimeLabel }}:{{ formatApplyTime(refundTime) }}</text>
  10. </view>
  11. <view class="card product-card">
  12. <view class="product-row">
  13. <u-image
  14. width="120rpx"
  15. height="120rpx"
  16. border-radius="12rpx"
  17. :src="productImageUrl"
  18. mode="aspectFill"
  19. ></u-image>
  20. <view class="product-info">
  21. <view class="product-title-row">
  22. <text class="product-name">{{ product.packageName || product.productName || '团餐套餐' }}</text>
  23. <text class="delivery-status">{{ deliveryStatusText }}</text>
  24. </view>
  25. <view class="product-desc-row">
  26. <text class="product-desc">{{ dishDescription }}</text>
  27. <text class="quantity">x{{ quantity }}</text>
  28. </view>
  29. <view class="item-price">
  30. <text class="currency">¥</text>
  31. <text>{{ formatMoney(itemPrice) }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="product-summary">
  36. <text>餐盒费:{{ formatMoney(containerFee) }}元</text>
  37. <view class="refund-amount">
  38. <text class="refund-label">退款金额</text>
  39. <text class="refund-currency">¥</text>
  40. <text class="refund-value">{{ formatMoney(refundAmount) }}</text>
  41. <text class="refund-note">不包含餐盒费</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="card negotiate-card" @click="goRecord">
  46. <text class="card-title">协商历史</text>
  47. <view class="negotiate-link">
  48. <text>查看详情</text>
  49. <u-icon name="arrow-right" size="22" color="#4e5969"></u-icon>
  50. </view>
  51. </view>
  52. <view class="card info-card">
  53. <text class="card-title">订单信息</text>
  54. <view class="info-row">
  55. <text class="info-label">订单号</text>
  56. <text class="info-value">{{ product.orderId || product.hostOrderId || '--' }}</text>
  57. </view>
  58. <view class="info-row">
  59. <text class="info-label">支付流水号</text>
  60. <text class="info-value">{{ product.tradeId || product.paymentNo || '--' }}</text>
  61. </view>
  62. <view class="info-row">
  63. <text class="info-label">用户姓名</text>
  64. <text class="info-value">{{ product.linkName || product.userName || '--' }}</text>
  65. </view>
  66. <view class="info-row">
  67. <text class="info-label">联系电话</text>
  68. <view class="phone-value" @click.stop="makePhoneCall(userPhone)">
  69. <text>{{ userPhone || '--' }}</text>
  70. <image v-if="userPhone" class="phone-icon" src="/static/merchantDish/call.png" mode="aspectFit"></image>
  71. </view>
  72. </view>
  73. <view class="info-row">
  74. <text class="info-label">下单时间</text>
  75. <text class="info-value">{{ formatDateTime(product.orderDate || product.createTime) }}</text>
  76. </view>
  77. <view class="info-row">
  78. <text class="info-label">付款时间</text>
  79. <text class="info-value">{{ formatDateTime(product.paymentTime || product.payTime) }}</text>
  80. </view>
  81. <view v-if="product.completeTime" class="info-row">
  82. <text class="info-label">成团时间</text>
  83. <text class="info-value">{{ formatDateTime(product.completeTime) }}</text>
  84. </view>
  85. <view v-if="product.sendTime" class="info-row">
  86. <text class="info-label">送达时间</text>
  87. <text class="info-value">{{ formatDateTime(product.sendTime) }}</text>
  88. </view>
  89. </view>
  90. <view class="card info-card delivery-card">
  91. <text class="card-title">配送信息</text>
  92. <view class="info-row">
  93. <text class="info-label">配送团长</text>
  94. <text class="info-value">{{ product.nickName || product.headName || product.leaderName || '--' }}</text>
  95. </view>
  96. <view class="info-row">
  97. <text class="info-label">联系方式</text>
  98. <view class="phone-value" @click.stop="makePhoneCall(deliveryPhone)">
  99. <text>{{ deliveryPhone || '--' }}</text>
  100. <image v-if="deliveryPhone" class="phone-icon" src="/static/merchantDish/call.png" mode="aspectFit"></image>
  101. </view>
  102. </view>
  103. </view>
  104. </scroll-view>
  105. </view>
  106. </template>
  107. <script>
  108. export default {
  109. data() {
  110. return {
  111. query: {},
  112. product: {},
  113. loading: true
  114. }
  115. },
  116. computed: {
  117. hasDetail() {
  118. return Object.keys(this.product || {}).length > 0
  119. },
  120. productImageUrl() {
  121. const image = String(this.product.productImage || '').split(',').filter(Boolean)[0] || ''
  122. if (!image || /^https?:\/\//.test(image)) return image
  123. return this.$config && this.$config.apiUrl ? `${this.$config.apiUrl}/${image}` : image
  124. },
  125. statusTimeLabel() {
  126. return Number(this.product.fundStatus) === 1 ? '退款时间' : '申请时间'
  127. },
  128. refundTime() {
  129. return this.product.applyTime || this.product.refundApplyTime || this.product.refundTime || this.product.createTime
  130. },
  131. deliveryStatusText() {
  132. const statusMap = {
  133. 0: '未成团',
  134. 1: '已成团',
  135. 2: '已出餐',
  136. 3: '已送达',
  137. 4: '成团失败',
  138. 9: '已到达',
  139. 10: '已取餐'
  140. }
  141. const orderStatus = this.product.orderStatus
  142. if (orderStatus !== '' && orderStatus != null && Object.prototype.hasOwnProperty.call(statusMap, Number(orderStatus))) {
  143. return statusMap[Number(orderStatus)]
  144. }
  145. const text = this.product.deliveryStatusName || this.product.packageOrderStatusName || this.product.merchantOrderStatusName || this.product.statusName
  146. if (text) return text
  147. const orderText = String(this.product.orderStatusName || '')
  148. return orderText && !orderText.includes('退款') && !orderText.includes('售后') ? orderText : '待送达'
  149. },
  150. dishDescription() {
  151. return this.product.dishName || this.product.packageContent || this.product.dishNames || '暂无菜品信息'
  152. },
  153. quantity() {
  154. return Number(this.product.packageNumber || this.product.buyNumber || this.product.quantity || 1)
  155. },
  156. itemPrice() {
  157. if (this.product.priceEach != null) return this.product.priceEach
  158. if (this.product.groupPrice != null) return this.product.groupPrice
  159. return this.product.price || 0
  160. },
  161. refundAmount() {
  162. if (this.product.refundAmount != null) return this.product.refundAmount
  163. if (this.product.refundPrice != null) return this.product.refundPrice
  164. return this.product.price || 0
  165. },
  166. containerFee() {
  167. if (this.product.containerFee != null) return this.product.containerFee
  168. if (this.product.boxFee != null) return this.product.boxFee
  169. return Number(this.product.boxPrice || 0) * this.quantity
  170. },
  171. userPhone() {
  172. return this.product.phone || this.product.maskedPhone || this.product.mobile || ''
  173. },
  174. deliveryPhone() {
  175. return this.product.nickPhone || this.product.leaderPhone || this.product.headPhone || ''
  176. }
  177. },
  178. onLoad(query) {
  179. this.query = query || {}
  180. },
  181. onShow() {
  182. this.getDetail()
  183. },
  184. methods: {
  185. getDetail() {
  186. if (!this.query.hostOrderId) {
  187. this.loading = false
  188. uni.showToast({ title: '缺少订单信息', icon: 'none' })
  189. return
  190. }
  191. this.loading = true
  192. this.$http.post('/groupmeal/merchantPackageOrder/refundDetails', this.query).then((res) => {
  193. if (res.data.code !== 200) {
  194. uni.showToast({ title: res.data.message || '退款详情加载失败', icon: 'none' })
  195. return
  196. }
  197. this.product = res.data.result || {}
  198. }).catch(() => {
  199. uni.showToast({ title: '退款详情加载失败', icon: 'none' })
  200. }).finally(() => {
  201. this.loading = false
  202. })
  203. },
  204. goRecord() {
  205. const query = this.$u.queryParams(this.query)
  206. uni.navigateTo({
  207. url: `/pages/merchantDish/orders/refund-record${query}`
  208. })
  209. },
  210. makePhoneCall(phone) {
  211. const phoneNumber = String(phone || '')
  212. if (!phoneNumber || phoneNumber.includes('*')) {
  213. uni.showToast({ title: '手机号暂不可拨打', icon: 'none' })
  214. return
  215. }
  216. uni.makePhoneCall({ phoneNumber })
  217. },
  218. formatMoney(value) {
  219. const number = Number(value)
  220. if (!Number.isFinite(number)) return '0'
  221. return number.toFixed(2).replace(/\.00$/, '').replace(/(\.\d)0$/, '$1')
  222. },
  223. formatDateTime(value) {
  224. if (!value) return '--'
  225. return String(value).replace(/-/g, '.')
  226. },
  227. formatApplyTime(value) {
  228. if (!value) return '--'
  229. const text = String(value).trim()
  230. const match = text.match(/^(\d{4})[-/.](\d{1,2})[-/.](\d{1,2})(.*)$/)
  231. return match ? `${match[1]}.${Number(match[2])}.${Number(match[3])}${match[4]}` : text
  232. }
  233. }
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .page {
  238. display: flex;
  239. flex-direction: column;
  240. height: 100vh;
  241. background: #f7f8fa;
  242. overflow: hidden;
  243. }
  244. .content {
  245. flex: 1;
  246. height: 0;
  247. box-sizing: border-box;
  248. padding: 32rpx 32rpx calc(32rpx + env(safe-area-inset-bottom));
  249. }
  250. .state-tip {
  251. padding: 100rpx 24rpx;
  252. color: #86909c;
  253. font-size: 28rpx;
  254. text-align: center;
  255. }
  256. .card,
  257. .status-card {
  258. box-sizing: border-box;
  259. margin-bottom: 16rpx;
  260. border-radius: 16rpx;
  261. background: #fff;
  262. }
  263. .status-card {
  264. display: flex;
  265. min-height: 164rpx;
  266. padding: 32rpx;
  267. flex-direction: column;
  268. align-items: center;
  269. justify-content: center;
  270. gap: 8rpx;
  271. }
  272. .status-title {
  273. color: #1d2129;
  274. font-size: 40rpx;
  275. font-weight: 600;
  276. }
  277. .status-time {
  278. color: #86909c;
  279. font-size: 26rpx;
  280. }
  281. .card {
  282. padding: 32rpx;
  283. }
  284. .product-row {
  285. display: flex;
  286. align-items: stretch;
  287. gap: 20rpx;
  288. }
  289. .product-info {
  290. display: flex;
  291. flex: 1;
  292. min-width: 0;
  293. flex-direction: column;
  294. justify-content: space-between;
  295. }
  296. .product-title-row,
  297. .product-desc-row,
  298. .product-summary,
  299. .refund-amount,
  300. .negotiate-card,
  301. .negotiate-link,
  302. .info-row,
  303. .phone-value {
  304. display: flex;
  305. align-items: center;
  306. }
  307. .product-title-row,
  308. .product-desc-row,
  309. .product-summary,
  310. .negotiate-card,
  311. .info-row {
  312. justify-content: space-between;
  313. }
  314. .product-name {
  315. flex: 1;
  316. min-width: 0;
  317. overflow: hidden;
  318. color: #1d2129;
  319. font-size: 30rpx;
  320. font-weight: 600;
  321. text-overflow: ellipsis;
  322. white-space: nowrap;
  323. }
  324. .delivery-status {
  325. flex-shrink: 0;
  326. margin-left: 16rpx;
  327. color: #86909c;
  328. font-size: 28rpx;
  329. }
  330. .product-desc {
  331. flex: 1;
  332. min-width: 0;
  333. overflow: hidden;
  334. color: #86909c;
  335. font-size: 24rpx;
  336. text-overflow: ellipsis;
  337. white-space: nowrap;
  338. }
  339. .quantity {
  340. flex-shrink: 0;
  341. margin-left: 16rpx;
  342. color: #86909c;
  343. font-size: 24rpx;
  344. }
  345. .item-price {
  346. color: #1d2129;
  347. font-size: 28rpx;
  348. font-weight: 600;
  349. }
  350. .currency {
  351. font-size: 20rpx;
  352. }
  353. .product-summary {
  354. margin-top: 16rpx;
  355. color: #333;
  356. font-size: 24rpx;
  357. }
  358. .refund-amount {
  359. align-items: baseline;
  360. white-space: nowrap;
  361. }
  362. .refund-label {
  363. margin-right: 6rpx;
  364. }
  365. .refund-currency {
  366. color: #1d2129;
  367. font-size: 26rpx;
  368. font-weight: 600;
  369. }
  370. .refund-value {
  371. color: #1d2129;
  372. font-size: 36rpx;
  373. font-weight: 600;
  374. }
  375. .refund-note {
  376. margin-left: 8rpx;
  377. color: #1c7cf9;
  378. font-size: 20rpx;
  379. }
  380. .negotiate-card {
  381. height: 108rpx;
  382. }
  383. .card-title {
  384. color: #1d2129;
  385. font-size: 32rpx;
  386. font-weight: 500;
  387. }
  388. .negotiate-link {
  389. color: #4e5969;
  390. font-size: 28rpx;
  391. }
  392. .info-card {
  393. display: flex;
  394. flex-direction: column;
  395. gap: 24rpx;
  396. }
  397. .info-row {
  398. gap: 24rpx;
  399. min-height: 32rpx;
  400. font-size: 28rpx;
  401. }
  402. .info-label {
  403. flex-shrink: 0;
  404. color: #4e5969;
  405. }
  406. .info-value,
  407. .phone-value {
  408. min-width: 0;
  409. color: #1d2129;
  410. text-align: right;
  411. }
  412. .info-value {
  413. overflow: hidden;
  414. text-overflow: ellipsis;
  415. white-space: nowrap;
  416. }
  417. .phone-value {
  418. justify-content: flex-end;
  419. gap: 12rpx;
  420. }
  421. .phone-icon {
  422. flex-shrink: 0;
  423. width: 32rpx;
  424. height: 32rpx;
  425. }
  426. .delivery-card {
  427. margin-bottom: 0;
  428. }
  429. </style>