afterSales.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="content">
  3. <view class="u-tabs-box">
  4. <u-tabs bg-color="#fff" :list="list" :is-scroll="false" :current="current" @change="change" :active-color="$lightColor"></u-tabs>
  5. </view>
  6. <div class="u-tabs-search">
  7. <u-search placeholder="请输入订单编号" @search="handleGetOrderList(current)" @clear="handleGetOrderList(current)" @custom="handleGetOrderList(current)" v-model="params.orderSn"></u-search>
  8. </div>
  9. <scroll-view class="body-view" scroll-y @scrolltolower="renderDate">
  10. <view class="seller-view" v-for="(order, orderIndex) in orderList" :key="orderIndex">
  11. <!-- 店铺名称 -->
  12. <view class="seller-info u-flex u-row-between" v-if="current == 0">
  13. <view class="seller-name">
  14. <view class="name">{{ order.storeName }}</view>
  15. </view>
  16. <view class="order-sn">订单编号:{{order.sn}}</view>
  17. </view>
  18. <!-- 申请记录 选项卡 -->
  19. <view class="seller-info u-flex u-row-between" v-if="current != 0">
  20. <view class="order-sn">售后单号:{{ order.service_sn || order.sn }}</view>
  21. <view class="order-sn">{{ order.serviceType_text }}</view>
  22. </view>
  23. <view v-for="(sku, goodsIndex) in order.orderItems" :key="goodsIndex">
  24. <view class="goods-item-view" @click="onDetail(sku)">
  25. <view class="goods-img">
  26. <u-image border-radius="6" width="100%" height="100%" :src="sku.image"></u-image>
  27. </view>
  28. <view class="goods-info">
  29. <view class="goods-title u-line-2">{{ sku.name }}</view>
  30. <!-- 如果商品多个则不显示每个商品价格-->
  31. <view class="goods-price" v-if="order.orderItems.length <= 1">
  32. ¥{{ order.flowPrice | unitPrice }}
  33. </view>
  34. </view>
  35. <view class="goods-num">
  36. <view>x{{ sku.num }}</view>
  37. </view>
  38. </view>
  39. <view class="btn-view u-flex u-row-between">
  40. <view class="description">
  41. <!-- 售后申请 -->
  42. <view v-if="
  43. current === 0 && order.groupAfterSaleStatus &&
  44. order.groupAfterSaleStatus === 'ALREADY_APPLIED'
  45. " class="cannot_apply">
  46. <u-icon class="icon" name="info-circle-fill"></u-icon>
  47. 该商品已申请售后服务
  48. </view>
  49. <view class="cannot_apply" v-if="current === 0 && order.groupAfterSaleStatus && order.groupAfterSaleStatus === 'EXPIRED'" @click="tipsShow = true">
  50. <u-icon class="icon" name="info-circle-fill"></u-icon>
  51. 该商品无法申请售后
  52. </view>
  53. <div v-if="current === 1 || current === 2">
  54. <!-- 申请中 -->
  55. <view class="cannot_apply" v-if="order.serviceType == 'RETURN_GOODS'">退货处理-{{ order.serviceStatus | serviceStatusList }}</view>
  56. <view class="cannot_apply" v-if="order.serviceType == 'SUPPLY_AGAIN_GOODS'">补发商品-{{ order.serviceStatus | serviceStatusList }}</view>
  57. <view class="cannot_apply" v-if="order.serviceType == 'RETURN_MONEY'">退款-{{ order.serviceStatus | serviceStatusList }}</view>
  58. <view class="cannot_apply" v-if="order.serviceType == 'EXCHANGE_GOODS'">换货-{{ order.serviceStatus | serviceStatusList }}</view>
  59. <view class="cannot_apply" v-if="order.serviceType == 'CANCEL'">取消订单-{{ order.serviceStatus | serviceStatusList }}</view>
  60. </div>
  61. <!-- 申请记录 -->
  62. </view>
  63. <view class="after-line">
  64. <!-- 售后申请 -->
  65. <view v-if="
  66. current === 0 && order.groupAfterSaleStatus=='NOT_APPLIED'
  67. " @click="applyService(sku.sn, order, sku)" class="rebuy-btn">
  68. 申请售后
  69. </view>
  70. <!-- 申请中 -->
  71. <view class="rebuy-btn" v-if="
  72. current === 2 &&
  73. order.serviceStatus &&
  74. order.serviceStatus == 'PASS' &&
  75. order.serviceType != 'RETURN_MONEY'
  76. " @click="onExpress(order, sku)">
  77. 提交物流
  78. </view>
  79. <view @click="afterDetails(order, sku)" v-if="current === 1 || current === 2" class="rebuy-btn">
  80. 售后详情
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view v-if="
  86. current === 0 && order.groupAfterSaleStatus &&
  87. order.groupAfterSaleStatus != 'ALREADY_APPLIED' &&
  88. order.orderItems.length >= 1
  89. " class="btn-view u-flex u-row-between">
  90. <!-- 多个商品显示订单总价格 -->
  91. <view class="cannot_apply">
  92. 订单总金额:<span class="countMoney">¥{{ order.flowPrice | unitPrice }}</span>
  93. </view>
  94. </view>
  95. </view>
  96. <u-loadmore bg-color="#f8f8f8" :status="status" />
  97. </scroll-view>
  98. <u-modal v-model="tipsShow" content="当订单未确认收货|已过售后服务有效期|已申请售后服务时,不能申请售后"></u-modal>
  99. </view>
  100. </template>
  101. <script>
  102. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  103. import { getAfterSaleList } from "@/api/after-sale.js";
  104. import { getOrderList } from "@/api/order.js";
  105. export default {
  106. components: {
  107. uniLoadMore,
  108. },
  109. data() {
  110. return {
  111. list: [
  112. //tab表头
  113. {
  114. name: "售后申请",
  115. },
  116. {
  117. name: "申请中",
  118. },
  119. {
  120. name: "申请记录",
  121. },
  122. ],
  123. current: 0, //当前表头索引
  124. tipsShow: false, //提示开关
  125. orderList: [], //订单集合
  126. params: {
  127. pageNumber: 1,
  128. pageSize: 10,
  129. sort: 'createTime',
  130. order: 'desc'
  131. },
  132. logParams: {
  133. pageNumber: 1,
  134. pageSize: 10,
  135. },
  136. status: "loadmore",
  137. };
  138. },
  139. onLoad(options) {
  140. this.orderList = [];
  141. this.params.pageNumber = 1;
  142. if (options.orderSn) this.params.orderSn = options.orderSn;
  143. this.getOrderList(this.current);
  144. },
  145. onPullDownRefresh() {
  146. this.change(this.current);
  147. },
  148. methods: {
  149. handleGetOrderList(current) {
  150. this.orderList = [];
  151. this.getOrderList(current);
  152. },
  153. /**
  154. * 切换tab页时,初始化数据
  155. */
  156. change(index) {
  157. this.current = index;
  158. this.params = {
  159. pageNumber: 1,
  160. pageSize: 10,
  161. };
  162. this.orderList = [];
  163. //如果是2 则读取售后申请记录列表
  164. if (index == 0) {
  165. this.getOrderList(index);
  166. } else {
  167. this.logParams = {
  168. pageNumber: 1,
  169. pageSize: 10,
  170. };
  171. if (index === 1) {
  172. this.logParams.serviceStatus = "APPLY";
  173. }
  174. this.orderList = [];
  175. this.getAfterSaleLogList();
  176. }
  177. uni.stopPullDownRefresh();
  178. },
  179. /**
  180. * 获取订单列表
  181. */
  182. getOrderList(index) {
  183. uni.showLoading({
  184. title: "加载中",
  185. mask: true,
  186. });
  187. getOrderList(this.params).then((res) => {
  188. uni.hideLoading();
  189. const orderlist = res.data.result.records;
  190. if (orderlist.length > 0) {
  191. this.orderList = this.orderList.concat(orderlist);
  192. this.params.pageNumber += 1;
  193. }
  194. if (orderlist.length < 10) {
  195. this.status = "nomore";
  196. } else {
  197. this.status = "loading";
  198. }
  199. });
  200. },
  201. /**
  202. * 售后详情
  203. */
  204. afterDetails(order) {
  205. uni.navigateTo({
  206. url: "./applyDetail?sn=" + order.sn,
  207. });
  208. },
  209. /**
  210. * 申请记录列表
  211. */
  212. getAfterSaleLogList() {
  213. getAfterSaleList(this.logParams).then((res) => {
  214. let afterSaleLogList = res.data.result.records;
  215. afterSaleLogList.forEach((item) => {
  216. item.orderItems = [
  217. {
  218. image: item.goodsImage,
  219. skuId: item.skuId,
  220. name: item.goodsName,
  221. num: item.num,
  222. price: item.flowPrice,
  223. },
  224. ];
  225. });
  226. this.orderList = this.orderList.concat(afterSaleLogList);
  227. if (afterSaleLogList.length < 10) {
  228. this.status = "nomore";
  229. } else {
  230. this.status = "loading";
  231. }
  232. });
  233. },
  234. /**
  235. * 申请售后
  236. */
  237. applyService(sn, order, sku) {
  238. let data = {
  239. ...order,
  240. ...sku,
  241. };
  242. uni.navigateTo({
  243. url: `/pages/order/afterSales/afterSalesSelect?sn=${sn}&sku=${encodeURIComponent(
  244. JSON.stringify(data)
  245. )}`,
  246. });
  247. },
  248. /**
  249. * 提交物流信息
  250. */
  251. onExpress(order, sku) {
  252. sku.storeName = order.storeName;
  253. uni.navigateTo({
  254. url: `./afterSalesDetailExpress?serviceSn=${
  255. order.sn
  256. }&sku=${encodeURIComponent(JSON.stringify(sku))}`,
  257. });
  258. },
  259. /**
  260. * 查看详情
  261. */
  262. onDetail(sku) {
  263. if (!this.$u.test.isEmpty(sku.skuId)) {
  264. uni.navigateTo({
  265. url: `/pages/product/goods?id=${sku.skuId}&goodsId=${sku.goodsId}`,
  266. });
  267. }
  268. },
  269. /**
  270. * 底部加载数据
  271. */
  272. renderDate() {
  273. if (this.current === 0) {
  274. this.params.pageNumber += 1;
  275. this.getOrderList();
  276. } else {
  277. this.logParams.pageNumber += 1;
  278. this.getAfterSaleLogList();
  279. }
  280. },
  281. },
  282. };
  283. </script>
  284. <style lang="scss">
  285. page,
  286. .content {
  287. background: $page-color-base;
  288. height: 100%;
  289. }
  290. .body-view {
  291. overflow-y: auto;
  292. height: calc(100vh - 44px - 80rpx - 104rpx);
  293. }
  294. .u-tabs-search {
  295. padding: 20rpx;
  296. background: #fff;
  297. }
  298. .countMoney {
  299. margin-left: 7rpx;
  300. color: $main-color;
  301. font-size: 28rpx;
  302. }
  303. .seller-view {
  304. background-color: #fff;
  305. margin: 20rpx 0rpx;
  306. padding: 0rpx 20rpx;
  307. border-radius: 20rpx;
  308. .seller-info {
  309. height: 70rpx;
  310. .seller-name {
  311. font-size: 28rpx;
  312. display: flex;
  313. flex-direction: row;
  314. .name {
  315. margin-left: 15rpx;
  316. margin-top: -2rpx;
  317. }
  318. }
  319. .order-sn {
  320. font-size: 22rpx;
  321. color: #909399;
  322. }
  323. }
  324. .goods-item-view {
  325. display: flex;
  326. flex-direction: row;
  327. padding: 10rpx 10rpx;
  328. .goods-img {
  329. width: 131rpx;
  330. height: 131rpx;
  331. }
  332. .goods-info {
  333. padding-left: 30rpx;
  334. flex: 1;
  335. .goods-title {
  336. margin-bottom: 10rpx;
  337. color: #333333;
  338. }
  339. .goods-specs {
  340. font-size: 24rpx;
  341. margin-bottom: 10rpx;
  342. color: #cccccc;
  343. }
  344. .goods-price {
  345. font-size: 28rpx;
  346. margin-bottom: 10rpx;
  347. color: #ff5a10;
  348. }
  349. }
  350. .goods-num {
  351. width: 60rpx;
  352. color: $main-color;
  353. }
  354. }
  355. .btn-view {
  356. padding: 16rpx 0;
  357. .after-line {
  358. display: flex;
  359. line-height: 90rpx;
  360. }
  361. }
  362. }
  363. .description {
  364. color: #909399;
  365. size: 25rpx;
  366. }
  367. .cannot_apply {
  368. text-align: center;
  369. font-size: 22rpx;
  370. color: #999999;
  371. height: 70rpx;
  372. line-height: 70rpx;
  373. }
  374. .icon {
  375. margin-right: 10rpx;
  376. }
  377. .cancel-btn {
  378. color: #999999;
  379. border-color: #999999;
  380. margin-left: 15rpx;
  381. height: 60rpx;
  382. }
  383. .pay-btn {
  384. background-color: #1abc9c;
  385. color: #ffffff;
  386. margin-left: 15rpx;
  387. height: 60rpx;
  388. }
  389. .rebuy-btn {
  390. background-color: #ffffff;
  391. margin-left: 15rpx;
  392. height: 60rpx;
  393. line-height: 60rpx;
  394. text-align: center;
  395. font-size: 24rpx;
  396. border: 2rpx solid $light-color;
  397. color: $light-color;
  398. padding: 0 24rpx;
  399. border-radius: 200px;
  400. }
  401. </style>