detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <!-- 售后详情 -->
  2. <template>
  3. <s-layout :title="t('order.after_sales_details')" :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">{{ t('order.total_refund') }}:</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">{{ t('order.refund_amount') }}:</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"> {{ t('order.refund_commission') }}:</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"> {{ t('order.refund_points') }}:</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">{{ t('order.service_order_number') }}:</view>
  72. <view class="item-content ss-m-r-16">{{ state.info.no }}</view>
  73. <button class="ss-reset-button copy-btn" @tap="onCopy"> {{ t('order.copy') }} </button>
  74. </view>
  75. <view class="aftersale-item ss-flex ss-col-center">
  76. <view class="item-title">{{ t('order.application_time') }}:</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">{{ t('order.after_sales_type') }}:</view>
  83. <view class="item-content">{{ state.info.way === 10 ? t('order.refund_only') : t('order.refund_and_return') }}</view>
  84. </view>
  85. <view class="aftersale-item ss-flex ss-col-center">
  86. <view class="item-title">{{ t('order.application_reason') }}:</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">{{ t('order.related_description') }}:</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="t('order.no_after_sales_details')" />
  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. {{ t('order.cancel_request') }}
  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. {{ t('order.fill_return') }}
  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. import { t } from '@/locale';
  138. const userInfo = sheep.$store('user').userInfo;
  139. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  140. const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
  141. const state = reactive({
  142. id: 0, // 售后编号
  143. info: {}, // 收货信息
  144. loading: false,
  145. active: 0, // 在 list 的激活位置
  146. list: [{
  147. title: t('order.submit_application'),
  148. }, {
  149. title: t('order.processing'),
  150. }, {
  151. title: t('order.completed')
  152. }], // 时间轴
  153. });
  154. function onApply(id) {
  155. uni.showModal({
  156. title: t('setting.prompt'),
  157. content: t('order.confirm_cancel_request'),
  158. success: async function(res) {
  159. if (!res.confirm) {
  160. return;
  161. }
  162. const {
  163. code
  164. } = await AfterSaleApi.cancelAfterSale(id);
  165. if (code === 0) {
  166. await getDetail(id);
  167. }
  168. },
  169. });
  170. }
  171. // 复制
  172. const onCopy = () => {
  173. sheep.$helper.copyText(state.info.no);
  174. };
  175. async function getDetail(id) {
  176. state.loading = true;
  177. const {
  178. code,
  179. data
  180. } = await AfterSaleApi.getAfterSale(id);
  181. if (code !== 0) {
  182. state.info = null;
  183. return;
  184. }
  185. state.info = data;
  186. handleAfterSaleButtons(state.info);
  187. // 处理时间轴
  188. if ([10].includes(state.info.status)) {
  189. state.active = 0;
  190. } else if ([20, 30, 40].includes(state.info.status)) {
  191. state.active = 1;
  192. } else if ([50].includes(state.info.status)) {
  193. state.active = 2;
  194. } else if ([61, 62, 63].includes(state.info.status)) {
  195. state.active = 2;
  196. }
  197. }
  198. const isLogin = computed(() => sheep.$store('user').isLogin);
  199. // 监听到在这个页面登陆,并刷新页面
  200. watch(
  201. () => isLogin.value,
  202. (newVal) => {
  203. if (newVal) {
  204. window.location.reload()
  205. }
  206. }
  207. );
  208. onLoad((options) => {
  209. //如果没登陆就进来则有可能是在微信消息推送进来的 提示登陆
  210. if (!isLogin.value) {
  211. showAuthModal();
  212. sheep.$helper.toast(t('order.not_logged_in',{user:options.username}), 3000);
  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(t('order.account_switch_needed',{user1:JSON.parse(uni.getStorageSync("user-store")).userInfo.username,user2:options.username}),3000);
  220. }
  221. }
  222. }
  223. if (!options.id) {
  224. sheep.$helper.toast(t('order.missing_order_info'));
  225. return
  226. }
  227. state.id = options.id;
  228. getDetail(options.id);
  229. });
  230. </script>
  231. <style lang="scss" scoped>
  232. // 步骤条
  233. .steps-box {
  234. width: 100%;
  235. height: 190rpx;
  236. background: v-bind(headerBg) no-repeat,
  237. linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  238. background-size: 750rpx 100%;
  239. padding-left: 72rpx;
  240. .steps-item {
  241. .sicon-circleclose {
  242. font-size: 24rpx;
  243. color: #fff;
  244. }
  245. .sicon-circlecheck {
  246. font-size: 24rpx;
  247. }
  248. .steps-item-title {
  249. font-size: 24rpx;
  250. font-weight: 400;
  251. margin-top: 16rpx;
  252. margin-left: -36rpx;
  253. width: 100rpx;
  254. text-align: center;
  255. }
  256. }
  257. }
  258. .activity-color {
  259. color: #fff;
  260. }
  261. .info-color {
  262. color: rgba(#fff, 0.4);
  263. }
  264. .activity-bg {
  265. background: #fff;
  266. }
  267. .info-bg {
  268. background: rgba(#fff, 0.4);
  269. }
  270. .line {
  271. width: 270rpx;
  272. height: 4rpx;
  273. }
  274. // 服务状态
  275. .status-box {
  276. position: relative;
  277. z-index: 3;
  278. background-color: #fff;
  279. border-radius: 20rpx 20rpx 0px 0px;
  280. padding: 20rpx;
  281. margin-top: -20rpx;
  282. .status-text {
  283. font-size: 28rpx;
  284. font-weight: 500;
  285. color: rgba(51, 51, 51, 1);
  286. margin-bottom: 20rpx;
  287. }
  288. .status-time {
  289. font-size: 24rpx;
  290. font-weight: 400;
  291. color: rgba(153, 153, 153, 1);
  292. }
  293. }
  294. .aftersale-info{
  295. margin: 20rpx;
  296. }
  297. // 退款金额
  298. .aftersale-money {
  299. background-color: #fff;
  300. height: 98rpx;
  301. padding: 0 20rpx;
  302. .aftersale-money--title {
  303. font-size: 28rpx;
  304. font-weight: 500;
  305. color: rgba(51, 51, 51, 1);
  306. }
  307. .aftersale-money--num {
  308. font-size: 28rpx;
  309. font-family: OPPOSANS;
  310. font-weight: 500;
  311. color: #ff3000;
  312. }
  313. }
  314. // order-shop
  315. .order-shop {
  316. padding: 20rpx;
  317. background-color: #fff;
  318. margin: 0 20rpx 20rpx 20rpx;
  319. }
  320. // 服务内容
  321. .aftersale-content {
  322. background-color: #fff;
  323. padding: 20rpx;
  324. margin-left: 20rpx;
  325. margin-right: 20rpx;
  326. .aftersale-item {
  327. height: 60rpx;
  328. .copy-btn {
  329. background: #eeeeee;
  330. color: #333;
  331. border-radius: 20rpx;
  332. width: 75rpx;
  333. height: 40rpx;
  334. font-size: 22rpx;
  335. }
  336. .item-title {
  337. color: #999;
  338. font-size: 28rpx;
  339. }
  340. .item-content {
  341. color: #333;
  342. font-size: 28rpx;
  343. }
  344. }
  345. }
  346. // 底部功能
  347. .foot_box {
  348. height: 100rpx;
  349. background-color: #fff;
  350. display: flex;
  351. align-items: center;
  352. justify-content: flex-end;
  353. .btn {
  354. // width: 160rpx;
  355. padding:0 10rpx;
  356. line-height: 60rpx;
  357. background: rgba(238, 238, 238, 1);
  358. border-radius: 30rpx;
  359. padding: 0;
  360. margin-right: 20rpx;
  361. font-size: 26rpx;
  362. font-weight: 400;
  363. color: rgba(51, 51, 51, 1);
  364. }
  365. }
  366. </style>