detail.vue 9.3 KB

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