detail.vue 11 KB

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