detail.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <!-- 售后详情 -->
  2. <template>
  3. <s-layout title="售后详情" :navbar="!isEmpty(state.info) && state.loading ? 'inner' : 'normal'">
  4. <view class="content_box" v-if="!isEmpty(state.info) && state.loading">
  5. <!-- 步骤条 -->
  6. <view
  7. class="steps-box ss-flex"
  8. :style="[
  9. {
  10. marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
  11. paddingTop: Number(statusBarHeight + 88) + 'rpx',
  12. },
  13. ]"
  14. >
  15. <view class="ss-flex">
  16. <view class="steps-item" v-for="(item, index) in state.list" :key="index">
  17. <view class="ss-flex">
  18. <text
  19. class="sicon-circleclose"
  20. v-if="state.list.length - 1 === index && [61, 62, 63].includes(state.info.status)"
  21. />
  22. <text
  23. class="sicon-circlecheck"
  24. v-else
  25. :class="state.active >= index ? 'activity-color' : 'info-color'"
  26. />
  27. <view
  28. v-if="state.list.length - 1 !== index"
  29. class="line"
  30. :class="state.active >= index ? 'activity-bg' : 'info-bg'"
  31. />
  32. </view>
  33. <view
  34. class="steps-item-title"
  35. :class="state.active >= index ? 'activity-color' : 'info-color'"
  36. >
  37. {{ item.title }}
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 服务状态 -->
  43. <view
  44. class="status-box ss-flex ss-col-center ss-row-between ss-m-x-20"
  45. @tap="sheep.$router.go('/pages/order/aftersale/log', { id: state.id })"
  46. >
  47. <view class="">
  48. <view class="status-text">
  49. {{ formatAfterSaleStatusDescription(state.info) }}
  50. </view>
  51. <view class="status-time">
  52. {{ sheep.$helper.timeFormat(state.info.updateTime, 'yyyy-mm-dd hh:MM:ss') }}
  53. </view>
  54. </view>
  55. <text class="ss-iconfont _icon-forward" style="color: #666" />
  56. </view>
  57. <!-- 退款金额 -->
  58. <view class="aftersale-money ss-flex ss-col-center ss-row-between">
  59. <view class="aftersale-money--title">退款总额</view>
  60. <view class="aftersale-money--num">¥{{ fen2yuan(state.info.refundPrice) }}</view>
  61. </view>
  62. <!-- 服务商品 -->
  63. <view class="order-shop">
  64. <s-goods-item
  65. :img="state.info.picUrl"
  66. :title="state.info.spuName"
  67. :titleWidth="480"
  68. :skuText="state.info.properties.map((property) => property.valueName).join(' ')"
  69. :num="state.info.count"
  70. />
  71. </view>
  72. <!-- 服务内容 -->
  73. <view class="aftersale-content">
  74. <view class="aftersale-item ss-flex ss-col-center">
  75. <view class="item-title">服务单号:</view>
  76. <view class="item-content ss-m-r-16">{{ state.info.no }}</view>
  77. <button class="ss-reset-button copy-btn" @tap="onCopy">复制</button>
  78. </view>
  79. <view class="aftersale-item ss-flex ss-col-center">
  80. <view class="item-title">申请时间:</view>
  81. <view class="item-content">
  82. {{ sheep.$helper.timeFormat(state.info.createTime, 'yyyy-mm-dd hh:MM:ss') }}
  83. </view>
  84. </view>
  85. <view class="aftersale-item ss-flex ss-col-center">
  86. <view class="item-title">售后类型:</view>
  87. <view class="item-content">{{ state.info.way === 10 ? '仅退款' : '退款退货' }}</view>
  88. </view>
  89. <view class="aftersale-item ss-flex ss-col-center">
  90. <view class="item-title">申请原因:</view>
  91. <view class="item-content">{{ state.info.applyReason }}</view>
  92. </view>
  93. <view class="aftersale-item ss-flex ss-col-center">
  94. <view class="item-title">相关描述:</view>
  95. <view class="item-content">{{ state.info.applyDescription }}</view>
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 操作区 -->
  100. <s-empty
  101. v-if="isEmpty(state.info) && state.loading"
  102. icon="/static/order-empty.png"
  103. text="暂无该订单售后详情"
  104. />
  105. <su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info)">
  106. <view class="foot_box">
  107. <button
  108. class="ss-reset-button btn"
  109. v-if="state.info.buttons?.includes('cancel')"
  110. @tap="onApply(state.info.id)"
  111. >
  112. 取消申请
  113. </button>
  114. <button
  115. class="ss-reset-button btn"
  116. v-if="state.info.buttons?.includes('delivery')"
  117. @tap="sheep.$router.go('/pages/order/aftersale/return-delivery', { id: state.info.id })"
  118. >
  119. 填写退货
  120. </button>
  121. <button
  122. class="ss-reset-button contcat-btn btn"
  123. @tap="sheep.$router.go('/pages/chat/index')"
  124. >
  125. 联系客服
  126. </button>
  127. </view>
  128. </su-fixed>
  129. </s-layout>
  130. </template>
  131. <script setup>
  132. import sheep from '@/sheep';
  133. import { onLoad } from '@dcloudio/uni-app';
  134. import { reactive } from 'vue';
  135. import { isEmpty } from 'lodash-es';
  136. import {
  137. fen2yuan,
  138. formatAfterSaleStatusDescription,
  139. handleAfterSaleButtons,
  140. } from '@/sheep/hooks/useGoods';
  141. import AfterSaleApi from '@/sheep/api/trade/afterSale';
  142. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  143. const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
  144. const state = reactive({
  145. id: 0, // 售后编号
  146. info: {}, // 收货信息
  147. loading: false,
  148. active: 0, // 在 list 的激活位置
  149. list: [
  150. {
  151. title: '提交申请',
  152. },
  153. {
  154. title: '处理中',
  155. },
  156. {
  157. title: '完成',
  158. },
  159. ], // 时间轴
  160. });
  161. function onApply(id) {
  162. uni.showModal({
  163. title: '提示',
  164. content: '确定要取消此申请吗?',
  165. success: async function (res) {
  166. if (!res.confirm) {
  167. return;
  168. }
  169. const { code } = await AfterSaleApi.cancelAfterSale(id);
  170. if (code === 0) {
  171. await getDetail(id);
  172. }
  173. },
  174. });
  175. }
  176. // 复制
  177. const onCopy = () => {
  178. sheep.$helper.copyText(state.info.no);
  179. };
  180. async function getDetail(id) {
  181. state.loading = true;
  182. const { code, data } = await AfterSaleApi.getAfterSale(id);
  183. if (code !== 0) {
  184. state.info = null;
  185. return;
  186. }
  187. state.info = data;
  188. handleAfterSaleButtons(state.info);
  189. // 处理时间轴
  190. if ([10].includes(state.info.status)) {
  191. state.active = 0;
  192. } else if ([20, 30].includes(state.info.status)) {
  193. state.active = 1;
  194. } else if ([40, 50].includes(state.info.status)) {
  195. state.active = 2;
  196. } else if ([61, 62, 63].includes(state.info.status)) {
  197. state.active = 2;
  198. }
  199. }
  200. onLoad((options) => {
  201. if (!options.id) {
  202. sheep.$helper.toast(`缺少订单信息,请检查`);
  203. return;
  204. }
  205. state.id = options.id;
  206. getDetail(options.id);
  207. });
  208. </script>
  209. <style lang="scss" scoped>
  210. // 步骤条
  211. .steps-box {
  212. width: 100%;
  213. height: 190rpx;
  214. background: v-bind(headerBg) no-repeat,
  215. linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  216. background-size: 750rpx 100%;
  217. padding-left: 72rpx;
  218. .steps-item {
  219. .sicon-circleclose {
  220. font-size: 24rpx;
  221. color: #fff;
  222. }
  223. .sicon-circlecheck {
  224. font-size: 24rpx;
  225. }
  226. .steps-item-title {
  227. font-size: 24rpx;
  228. font-weight: 400;
  229. margin-top: 16rpx;
  230. margin-left: -36rpx;
  231. width: 100rpx;
  232. text-align: center;
  233. }
  234. }
  235. }
  236. .activity-color {
  237. color: #fff;
  238. }
  239. .info-color {
  240. color: rgba(#fff, 0.4);
  241. }
  242. .activity-bg {
  243. background: #fff;
  244. }
  245. .info-bg {
  246. background: rgba(#fff, 0.4);
  247. }
  248. .line {
  249. width: 270rpx;
  250. height: 4rpx;
  251. }
  252. // 服务状态
  253. .status-box {
  254. position: relative;
  255. z-index: 3;
  256. background-color: #fff;
  257. border-radius: 20rpx 20rpx 0px 0px;
  258. padding: 20rpx;
  259. margin-top: -20rpx;
  260. .status-text {
  261. font-size: 28rpx;
  262. font-weight: 500;
  263. color: rgba(51, 51, 51, 1);
  264. margin-bottom: 20rpx;
  265. }
  266. .status-time {
  267. font-size: 24rpx;
  268. font-weight: 400;
  269. color: rgba(153, 153, 153, 1);
  270. }
  271. }
  272. // 退款金额
  273. .aftersale-money {
  274. background-color: #fff;
  275. height: 98rpx;
  276. padding: 0 20rpx;
  277. margin: 20rpx;
  278. .aftersale-money--title {
  279. font-size: 28rpx;
  280. font-weight: 500;
  281. color: rgba(51, 51, 51, 1);
  282. }
  283. .aftersale-money--num {
  284. font-size: 28rpx;
  285. font-family: OPPOSANS;
  286. font-weight: 500;
  287. color: #ff3000;
  288. }
  289. }
  290. // order-shop
  291. .order-shop {
  292. padding: 20rpx;
  293. background-color: #fff;
  294. margin: 0 20rpx 20rpx 20rpx;
  295. }
  296. // 服务内容
  297. .aftersale-content {
  298. background-color: #fff;
  299. padding: 20rpx;
  300. margin: 0 20rpx;
  301. .aftersale-item {
  302. height: 60rpx;
  303. .copy-btn {
  304. background: #eeeeee;
  305. color: #333;
  306. border-radius: 20rpx;
  307. width: 75rpx;
  308. height: 40rpx;
  309. font-size: 22rpx;
  310. }
  311. .item-title {
  312. color: #999;
  313. font-size: 28rpx;
  314. }
  315. .item-content {
  316. color: #333;
  317. font-size: 28rpx;
  318. }
  319. }
  320. }
  321. // 底部功能
  322. .foot_box {
  323. height: 100rpx;
  324. background-color: #fff;
  325. display: flex;
  326. align-items: center;
  327. justify-content: flex-end;
  328. .btn {
  329. width: 160rpx;
  330. line-height: 60rpx;
  331. background: rgba(238, 238, 238, 1);
  332. border-radius: 30rpx;
  333. padding: 0;
  334. margin-right: 20rpx;
  335. font-size: 26rpx;
  336. font-weight: 400;
  337. color: rgba(51, 51, 51, 1);
  338. }
  339. }
  340. </style>