detail.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <!-- 售后详情 TODO-jj 测试-->
  2. <template>
  3. <s-layout :title="$t('order.aftersale.detail.title')" :navbar="!isEmpty(state.info) && !state.loading ? 'inner' : 'normal'">
  4. <view class="content_box" v-if="!isEmpty(state.info) && !state.loading">
  5. <!-- 步骤条 -->
  6. <!-- TODO-jj: 步骤条样式 -->
  7. <view
  8. class="steps-box ss-flex"
  9. :style="[
  10. {
  11. marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
  12. paddingTop: Number(statusBarHeight + 88) + 'rpx',
  13. },
  14. ]"
  15. >
  16. <!-- <uni-steps :options="state.list" :active="state.active" active-color="#fff" /> -->
  17. <view class="ss-flex">
  18. <view class="steps-item" v-for="(item, index) in state.list" :key="index">
  19. <view class="ss-flex">
  20. <text
  21. class="sicon-circleclose"
  22. v-if="
  23. (state.list.length - 1 == index && state.info.aftersale_status === -2) ||
  24. (state.list.length - 1 == index && state.info.aftersale_status === -1)
  25. "
  26. ></text>
  27. <text
  28. class="sicon-circlecheck"
  29. v-else
  30. :class="state.active >= index ? 'activity-color' : 'info-color'"
  31. ></text>
  32. <view
  33. v-if="state.list.length - 1 != index"
  34. class="line"
  35. :class="state.active >= index ? 'activity-bg' : 'info-bg'"
  36. ></view>
  37. </view>
  38. <view
  39. class="steps-item-title"
  40. :class="state.active >= index ? 'activity-color' : 'info-color'"
  41. >{{ item.title }}</view
  42. >
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 服务状态 -->
  47. <view
  48. class="status-box ss-flex ss-col-center ss-row-between ss-m-x-20"
  49. @tap="sheep.$router.go('/pages/order/aftersale/log', { id: state.aftersaleId })"
  50. >
  51. <view class="">
  52. <view class="status-text">{{ state.info.aftersale_status_desc }}</view>
  53. <view class="status-time">{{ state.info.updatetime }}</view>
  54. </view>
  55. <text class="ss-iconfont _icon-forward" style="color: #666"></text>
  56. </view>
  57. <!-- 退款金额 -->
  58. <view class="aftersale-money ss-flex ss-col-center ss-row-between">
  59. <view class="aftersale-money--title">{{$t('order.aftersale.detail.refundMoney')}}</view>
  60. <view class="aftersale-money--num">¥{{ state.info.refund_fee }}</view>
  61. </view>
  62. <!-- 服务商品 -->
  63. <view class="order-shop">
  64. <s-goods-item
  65. :title="state.info.goods_title"
  66. :price="state.info.goods_price"
  67. :img="state.info.goods_image"
  68. priceColor="#333333"
  69. :titleWidth="480"
  70. :skuText="state.info.goods_sku_text"
  71. :num="state.info.goods_num"
  72. ></s-goods-item>
  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.aftersale.detail.orderNo')}}:</view>
  78. <view class="item-content ss-m-r-16">{{ state.info.aftersale_sn }}</view>
  79. <button class="ss-reset-button copy-btn" @tap="onCopy">{{$t('order.aftersale.detail.copy')}}</button>
  80. </view>
  81. <view class="aftersale-item ss-flex ss-col-center">
  82. <view class="item-title">{{$t('order.aftersale.detail.applyTime')}}:</view>
  83. <view class="item-content">{{ state.info.createtime }}</view>
  84. </view>
  85. <view class="aftersale-item ss-flex ss-col-center">
  86. <view class="item-title">{{$t('order.aftersale.detail.type')}}:</view>
  87. <view class="item-content">{{ state.info.type_text }}</view>
  88. </view>
  89. <view class="aftersale-item ss-flex ss-col-center">
  90. <view class="item-title">{{$t('order.aftersale.detail.reason')}}:</view>
  91. <view class="item-content">{{ state.info.reason }}</view>
  92. </view>
  93. <view class="aftersale-item ss-flex ss-col-center">
  94. <view class="item-title">{{$t('order.aftersale.detail.desc')}}:</view>
  95. <view class="item-content">{{ state.info.content }}</view>
  96. </view>
  97. </view>
  98. </view>
  99. <s-empty v-else icon="/static/order-empty.png" :text="$t('order.aftersale.detail.empty')" />
  100. <su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info) && !state.loading">
  101. <view class="foot_box">
  102. <button
  103. class="ss-reset-button btn"
  104. v-if="state.info?.btns?.includes('cancel')"
  105. @tap="onApply(state.info.id)"
  106. >{{$t('order.aftersale.detail.cancleApply')}}</button
  107. >
  108. <!-- <button
  109. class="ss-reset-button btn"
  110. v-if="state.info.btns?.includes('delete')"
  111. @tap="onDelete(state.info.id)"
  112. >删除</button
  113. > -->
  114. <button class="ss-reset-button contcat-btn btn" @tap="sheep.$router.go('/pages/chat/index')"
  115. >{{$t('order.aftersale.detail.service')}}</button
  116. >
  117. </view>
  118. </su-fixed>
  119. </s-layout>
  120. </template>
  121. <script setup>
  122. import sheep from '@/sheep';
  123. import { onLoad } from '@dcloudio/uni-app';
  124. import { reactive } from 'vue';
  125. import { isEmpty } from 'lodash';
  126. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  127. const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/order/order_bg.png');
  128. const state = reactive({
  129. active: 0,
  130. aftersaleId: 0,
  131. info: {},
  132. list: [
  133. {
  134. title: $t('order.aftersale.detail.apply'),
  135. },
  136. {
  137. title: $t('order.aftersale.detail.dealing'),
  138. },
  139. ],
  140. loading: true,
  141. });
  142. function onApply(orderId) {
  143. uni.showModal({
  144. title: $t('order.aftersale.detail.tips'),
  145. content: $t('order.aftersale.detail.tipsCancle'),
  146. success: async function (res) {
  147. if (res.confirm) {
  148. const { code } = await sheep.$api.order.aftersale.cancel(orderId);
  149. if (code === 1) {
  150. getDetail(state.aftersaleId);
  151. }
  152. }
  153. },
  154. });
  155. }
  156. function onDelete(orderId) {
  157. uni.showModal({
  158. title: $t('order.aftersale.detail.tips'),
  159. content: $t('order.aftersale.detail.tipsDelete'),
  160. success: async function (res) {
  161. if (res.confirm) {
  162. const { code } = await sheep.$api.order.aftersale.delete(orderId);
  163. if (code === 1) {
  164. sheep.$router.back();
  165. }
  166. }
  167. },
  168. });
  169. }
  170. const onCopy = () => {
  171. sheep.$helper.copyText(state.info.aftersale_sn);
  172. };
  173. async function getDetail(id) {
  174. const { code, data } = await sheep.$api.order.aftersale.detail(id);
  175. if (code === 1) {
  176. state.info = data;
  177. if (state.info.aftersale_status === -2 || state.info.aftersale_status === -1) {
  178. state.list.push({ title: state.info.aftersale_status_text });
  179. state.active = 2;
  180. } else {
  181. state.list.push({ title: $t('order.aftersale.detail.complete') });
  182. state.active = state.info.aftersale_status;
  183. }
  184. } else {
  185. state.info = null;
  186. }
  187. state.loading = false;
  188. }
  189. onLoad((options) => {
  190. state.aftersaleId = options.id;
  191. getDetail(options.id);
  192. });
  193. </script>
  194. <style lang="scss" scoped>
  195. // 步骤条
  196. .steps-box {
  197. width: 100%;
  198. height: 190rpx;
  199. background: v-bind(headerBg)
  200. no-repeat,
  201. linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  202. background-size: 750rpx 100%;
  203. padding-left: 72rpx;
  204. .steps-item {
  205. .sicon-circleclose {
  206. font-size: 24rpx;
  207. color: #fff;
  208. }
  209. .sicon-circlecheck {
  210. font-size: 24rpx;
  211. }
  212. .steps-item-title {
  213. font-size: 24rpx;
  214. font-weight: 400;
  215. margin-top: 16rpx;
  216. margin-left: -36rpx;
  217. width: 100rpx;
  218. text-align: center;
  219. }
  220. }
  221. }
  222. .activity-color {
  223. color: #fff;
  224. }
  225. .info-color {
  226. color: rgba(#fff, 0.4);
  227. }
  228. .activity-bg {
  229. background: #fff;
  230. }
  231. .info-bg {
  232. background: rgba(#fff, 0.4);
  233. }
  234. .line {
  235. width: 270rpx;
  236. height: 4rpx;
  237. }
  238. // 服务状态
  239. .status-box {
  240. position: relative;
  241. z-index: 3;
  242. background-color: #fff;
  243. border-radius: 20rpx 20rpx 0px 0px;
  244. padding: 20rpx;
  245. margin-top: -20rpx;
  246. .status-text {
  247. font-size: 28rpx;
  248. font-weight: 500;
  249. color: rgba(51, 51, 51, 1);
  250. margin-bottom: 20rpx;
  251. }
  252. .status-time {
  253. font-size: 24rpx;
  254. font-weight: 400;
  255. color: rgba(153, 153, 153, 1);
  256. }
  257. }
  258. // 退款金额
  259. .aftersale-money {
  260. background-color: #fff;
  261. height: 98rpx;
  262. padding: 0 20rpx;
  263. margin: 20rpx;
  264. .aftersale-money--title {
  265. font-size: 28rpx;
  266. font-weight: 500;
  267. color: rgba(51, 51, 51, 1);
  268. }
  269. .aftersale-money--num {
  270. font-size: 28rpx;
  271. font-family: OPPOSANS;
  272. font-weight: 500;
  273. color: #ff3000;
  274. }
  275. }
  276. // order-shop
  277. .order-shop {
  278. padding: 20rpx;
  279. background-color: #fff;
  280. margin: 0 20rpx 20rpx 20rpx;
  281. }
  282. // 服务内容
  283. .aftersale-content {
  284. background-color: #fff;
  285. padding: 20rpx;
  286. margin: 0 20rpx;
  287. .aftersale-item {
  288. height: 60rpx;
  289. .copy-btn {
  290. background: #eeeeee;
  291. color: #333;
  292. border-radius: 20rpx;
  293. width: 75rpx;
  294. height: 40rpx;
  295. font-size: 22rpx;
  296. }
  297. .item-title {
  298. color: #999;
  299. font-size: 28rpx;
  300. }
  301. .item-content {
  302. color: #333;
  303. font-size: 28rpx;
  304. }
  305. }
  306. }
  307. // 底部功能
  308. .foot_box {
  309. height: 100rpx;
  310. background-color: #fff;
  311. display: flex;
  312. align-items: center;
  313. justify-content: flex-end;
  314. .btn {
  315. width: 160rpx;
  316. line-height: 60rpx;
  317. background: rgba(238, 238, 238, 1);
  318. border-radius: 30rpx;
  319. padding: 0;
  320. margin-right: 20rpx;
  321. font-size: 26rpx;
  322. font-weight: 400;
  323. color: rgba(51, 51, 51, 1);
  324. }
  325. }
  326. </style>