detail.vue 8.7 KB

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