detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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-content ss-m-y-20">
  43. <view class="aftersale-item ss-flex ss-col-center">
  44. <view class="item-title">退款总额:</view>
  45. <view class="item-content">
  46. ¥{{ fen2yuan(state.info.refundPriceTotal) }}
  47. </view>
  48. </view>
  49. <view class="aftersale-item ss-flex ss-col-center">
  50. <view class="item-title">退款金额:</view>
  51. <view class="item-content">¥{{ fen2yuan(state.info.refundPrice) }}</view>
  52. </view>
  53. <view class="aftersale-item ss-flex ss-col-center">
  54. <view class="item-title">退款佣金:</view>
  55. <view class="item-content">¥{{ points2point(state.info.refundIntegral) }}</view>
  56. </view>
  57. <view class="aftersale-item ss-flex ss-col-center">
  58. <view class="item-title">退款消费分:</view>
  59. <view class="item-content">¥{{ points2point(state.info.refundConsumptionPoints) }}</view>
  60. </view>
  61. </view>
  62. <!-- 服务商品 -->
  63. <view class="order-shop">
  64. <s-goods-item :price="state.info.refundPriceTotal" :img="state.info.picUrl" :title="state.info.spuName" :titleWidth="480"
  65. :skuText="state.info.properties.map((property) => property.valueName).join(' ')"
  66. :num="state.info.count" />
  67. </view>
  68. <!-- 服务内容 -->
  69. <view class="aftersale-content">
  70. <view class="aftersale-item ss-flex ss-col-center">
  71. <view class="item-title">服务单号:</view>
  72. <view class="item-content ss-m-r-16">{{ state.info.no }}</view>
  73. <button class="ss-reset-button copy-btn" @tap="onCopy">复制</button>
  74. </view>
  75. <view class="aftersale-item ss-flex ss-col-center">
  76. <view class="item-title">申请时间:</view>
  77. <view class="item-content">
  78. {{ sheep.$helper.timeFormat(state.info.createTime, 'yyyy-mm-dd hh:MM:ss') }}
  79. </view>
  80. </view>
  81. <view class="aftersale-item ss-flex ss-col-center">
  82. <view class="item-title">售后类型:</view>
  83. <view class="item-content">{{ state.info.way === 10 ? '仅退款' : '退款退货' }}</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.applyReason }}</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.applyDescription }}</view>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- 操作区 -->
  96. <s-empty v-if="isEmpty(state.info) && state.loading" icon="/static/order-empty.png" text="暂无该订单售后详情" />
  97. <!--<su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info)">
  98. <view class="foot_box">
  99. <button class="ss-reset-button btn" v-if="state.info.buttons?.includes('cancel')"
  100. @tap="onApply(state.info.id)">
  101. 取消申请
  102. </button>
  103. <button class="ss-reset-button btn" v-if="state.info.buttons?.includes('delivery')"
  104. @tap="sheep.$router.go('/pages/order/aftersale/return-delivery', { id: state.info.id })">
  105. 填写退货
  106. </button> -->
  107. <!-- <button class="ss-reset-button contcat-btn btn" @tap="sheep.$router.go('/pages/chat/index')">
  108. 联系客服
  109. </button>
  110. </view>
  111. </su-fixed> -->
  112. </s-layout>
  113. </template>
  114. <script setup>
  115. import sheep from '@/sheep';
  116. import {
  117. onLoad
  118. } from '@dcloudio/uni-app';
  119. import {
  120. reactive,
  121. computed,
  122. watch
  123. } from 'vue';
  124. import {
  125. isEmpty
  126. } from 'lodash';
  127. import {
  128. showAuthModal
  129. } from '@/sheep/hooks/useModal';
  130. import {
  131. fen2yuan,
  132. points2point,
  133. formatAfterSaleStatusDescription,
  134. handleAfterSaleButtons
  135. } from '@/sheep/hooks/useGoods';
  136. import AfterSaleApi from '@/sheep/api/trade/afterSale';
  137. const userInfo = sheep.$store('user').userInfo;
  138. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  139. const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
  140. const state = reactive({
  141. id: 0, // 售后编号
  142. info: {}, // 收货信息
  143. loading: false,
  144. active: 0, // 在 list 的激活位置
  145. list: [{
  146. title: '提交申请',
  147. }, {
  148. title: '处理中',
  149. }, {
  150. title: '完成'
  151. }], // 时间轴
  152. });
  153. function onApply(id) {
  154. uni.showModal({
  155. title: '提示',
  156. content: '确定要取消此申请吗?',
  157. success: async function(res) {
  158. if (!res.confirm) {
  159. return;
  160. }
  161. const {
  162. code
  163. } = await AfterSaleApi.cancelAfterSale(id);
  164. if (code === 0) {
  165. await getDetail(id);
  166. }
  167. },
  168. });
  169. }
  170. // 复制
  171. const onCopy = () => {
  172. sheep.$helper.copyText(state.info.no);
  173. };
  174. async function getDetail(id) {
  175. state.loading = true;
  176. const {
  177. code,
  178. data
  179. } = await AfterSaleApi.getAfterSale(id);
  180. if (code !== 0) {
  181. state.info = null;
  182. return;
  183. }
  184. state.info = data;
  185. handleAfterSaleButtons(state.info);
  186. // 处理时间轴
  187. if ([10].includes(state.info.status)) {
  188. state.active = 0;
  189. } else if ([20, 30, 40].includes(state.info.status)) {
  190. state.active = 1;
  191. } else if ([50].includes(state.info.status)) {
  192. state.active = 2;
  193. } else if ([61, 62, 63].includes(state.info.status)) {
  194. state.active = 2;
  195. }
  196. }
  197. const isLogin = computed(() => sheep.$store('user').isLogin);
  198. // 监听到在这个页面登陆,并刷新页面
  199. watch(
  200. () => isLogin.value,
  201. (newVal) => {
  202. if (newVal) {
  203. window.location.reload()
  204. }
  205. }
  206. );
  207. onLoad((options) => {
  208. //如果没登陆就进来则有可能是在微信消息推送进来的 提示登陆
  209. if (!isLogin.value) {
  210. showAuthModal();
  211. sheep.$helper.toast("您尚未登录,请登录:" + options.username + "后再试", 3000);
  212. return false;
  213. } else {
  214. // 如果
  215. if (options.username) {
  216. // 如果登陆了但不是该订单的账号,提示有问题
  217. console.log(JSON.parse(uni.getStorageSync("user-store")).userInfo.username)
  218. if (options.username != JSON.parse(uni.getStorageSync("user-store")).userInfo.username) {
  219. sheep.$helper.toast("您当前登录的账号是" + JSON.parse(uni.getStorageSync("user-store")).userInfo.username + ",请切换到" + options.username +
  220. "后再试",
  221. 3000);
  222. return false;
  223. }
  224. }
  225. }
  226. if (!options.id) {
  227. sheep.$helper.toast(`缺少订单信息,请检查`);
  228. return
  229. }
  230. state.id = options.id;
  231. getDetail(options.id);
  232. });
  233. </script>
  234. <style lang="scss" scoped>
  235. // 步骤条
  236. .steps-box {
  237. width: 100%;
  238. height: 190rpx;
  239. background: v-bind(headerBg) no-repeat,
  240. linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  241. background-size: 750rpx 100%;
  242. padding-left: 72rpx;
  243. .steps-item {
  244. .sicon-circleclose {
  245. font-size: 24rpx;
  246. color: #fff;
  247. }
  248. .sicon-circlecheck {
  249. font-size: 24rpx;
  250. }
  251. .steps-item-title {
  252. font-size: 24rpx;
  253. font-weight: 400;
  254. margin-top: 16rpx;
  255. margin-left: -36rpx;
  256. width: 100rpx;
  257. text-align: center;
  258. }
  259. }
  260. }
  261. .activity-color {
  262. color: #fff;
  263. }
  264. .info-color {
  265. color: rgba(#fff, 0.4);
  266. }
  267. .activity-bg {
  268. background: #fff;
  269. }
  270. .info-bg {
  271. background: rgba(#fff, 0.4);
  272. }
  273. .line {
  274. width: 270rpx;
  275. height: 4rpx;
  276. }
  277. // 服务状态
  278. .status-box {
  279. position: relative;
  280. z-index: 3;
  281. background-color: #fff;
  282. border-radius: 20rpx 20rpx 0px 0px;
  283. padding: 20rpx;
  284. margin-top: -20rpx;
  285. .status-text {
  286. font-size: 28rpx;
  287. font-weight: 500;
  288. color: rgba(51, 51, 51, 1);
  289. margin-bottom: 20rpx;
  290. }
  291. .status-time {
  292. font-size: 24rpx;
  293. font-weight: 400;
  294. color: rgba(153, 153, 153, 1);
  295. }
  296. }
  297. .aftersale-info{
  298. margin: 20rpx;
  299. }
  300. // 退款金额
  301. .aftersale-money {
  302. background-color: #fff;
  303. height: 98rpx;
  304. padding: 0 20rpx;
  305. .aftersale-money--title {
  306. font-size: 28rpx;
  307. font-weight: 500;
  308. color: rgba(51, 51, 51, 1);
  309. }
  310. .aftersale-money--num {
  311. font-size: 28rpx;
  312. font-family: OPPOSANS;
  313. font-weight: 500;
  314. color: #ff3000;
  315. }
  316. }
  317. // order-shop
  318. .order-shop {
  319. padding: 20rpx;
  320. background-color: #fff;
  321. margin: 0 20rpx 20rpx 20rpx;
  322. }
  323. // 服务内容
  324. .aftersale-content {
  325. background-color: #fff;
  326. padding: 20rpx;
  327. margin-left: 20rpx;
  328. margin-right: 20rpx;
  329. .aftersale-item {
  330. height: 60rpx;
  331. .copy-btn {
  332. background: #eeeeee;
  333. color: #333;
  334. border-radius: 20rpx;
  335. width: 75rpx;
  336. height: 40rpx;
  337. font-size: 22rpx;
  338. }
  339. .item-title {
  340. color: #999;
  341. font-size: 28rpx;
  342. }
  343. .item-content {
  344. color: #333;
  345. font-size: 28rpx;
  346. }
  347. }
  348. }
  349. // 底部功能
  350. .foot_box {
  351. height: 100rpx;
  352. background-color: #fff;
  353. display: flex;
  354. align-items: center;
  355. justify-content: flex-end;
  356. .btn {
  357. width: 160rpx;
  358. line-height: 60rpx;
  359. background: rgba(238, 238, 238, 1);
  360. border-radius: 30rpx;
  361. padding: 0;
  362. margin-right: 20rpx;
  363. font-size: 26rpx;
  364. font-weight: 400;
  365. color: rgba(51, 51, 51, 1);
  366. }
  367. }
  368. </style>