detail.vue 8.4 KB

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