list.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <!-- 售后列表 -->
  2. <template>
  3. <view class="page_box">
  4. <!-- tab -->
  5. <view class="head_box">
  6. <view class="order-nav u-flex">
  7. <view class="nav-item u-flex-col u-flex-1 u-col-center" v-for="nav in orderState" :key="nav.id" @tap="onNav(nav.type)">
  8. <view class="item-title">{{ nav.title }}</view>
  9. <text class="nav-line" :class="{ 'line-active': orderType === nav.type }"></text>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="content_box">
  14. <scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" class="scroll-box">
  15. <view class="order-list" v-for="(order, orderIndex) in orderList" :key="order.id" @tap="jump('/pages/order/after-sale/detail', { aftersaleId: order.id })">
  16. <view class="order-head u-flex u-row-between">
  17. <text class="no">服务单号:{{ order.aftersale_sn }}</text>
  18. <view class="order-status u-flex">
  19. <text class="status-text">{{ order.aftersale_status_text }}</text>
  20. </view>
  21. </view>
  22. <view class="order-content">
  23. <shopro-mini-card :title="order.goods_title" :image="order.goods_image">
  24. <template #describe>
  25. <view class="order-sku u-ellipsis-1">
  26. <text class="order-num">数量:{{ order.goods_num || 0 }};</text>
  27. {{ order.goods_sku_text ? order.goods_sku_text : '' }}
  28. </view>
  29. </template>
  30. <template #cardBottom>
  31. <view class="card-price-box u-flex">
  32. <text class="order-price font-OPPOSANS">¥{{ order.goods_price || 0 }}</text>
  33. <button class="u-reset-button status-btn">{{ order.type_text }}</button>
  34. </view>
  35. </template>
  36. </shopro-mini-card>
  37. </view>
  38. <view class="order-bottom">
  39. <view class="serve-status u-flex u-row-between" @tap.stop="jump('/pages/order/after-sale/log', { aftersaleId: order.id })">
  40. <view class="u-flex">
  41. <view class="serve-title">{{ order.aftersale_status_text }}</view>
  42. <view class="serve-content">{{ order.aftersale_status_desc }}</view>
  43. </view>
  44. <text class="u-iconfont uicon-arrow-right" style="color: #666"></text>
  45. </view>
  46. <view class="btn-box u-flex" v-for="orderBtn in order.btns" :key="orderBtn">
  47. <button v-if="orderBtn === 'cancel'" @tap.stop="onCancel(order.id, orderIndex)" class="u-reset-button obtn">取消</button>
  48. <button v-if="orderBtn === 'delete'" style="background:#FFEEEE;color:#E50808" @tap.stop="onDelete(order.id, orderIndex)" class="u-reset-button obtn">
  49. 删除
  50. </button>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 缺省页 -->
  55. <shopro-empty v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/empty_groupon.png'" tipText="暂无相关记录~"></shopro-empty>
  56. <!-- 更多 -->
  57. <u-loadmore v-if="orderList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
  58. </scroll-view>
  59. </view>
  60. <view class="foot_box"></view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. components: {},
  66. data() {
  67. return {
  68. orderType: 'all', //分类id
  69. isEmpty: false,
  70. orderList: [], //售后列表
  71. loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
  72. currentPage: 1,
  73. lastPage: 1,
  74. orderState: [
  75. {
  76. id: 0,
  77. title: '全部',
  78. type: 'all'
  79. },
  80. {
  81. id: 1,
  82. title: '处理中',
  83. type: 'ing'
  84. },
  85. {
  86. id: 2,
  87. title: '已完成',
  88. type: 'finish'
  89. }
  90. ]
  91. };
  92. },
  93. computed: {},
  94. onLoad() {},
  95. onShow() {
  96. this.orderList = [];
  97. this.currentPage = 1;
  98. this.lastPage = 1;
  99. this.getAftersaleList();
  100. },
  101. methods: {
  102. jump(path, parmas) {
  103. this.$Router.push({
  104. path: path,
  105. query: parmas
  106. });
  107. },
  108. // 切换导航
  109. onNav(type) {
  110. if (this.orderType !== type) {
  111. this.orderType = type;
  112. this.currentPage = 1;
  113. this.lastPage = 1;
  114. this.orderList = [];
  115. this.getAftersaleList();
  116. }
  117. },
  118. // 售后列表
  119. getAftersaleList() {
  120. let that = this;
  121. that.loadStatus = 'loading';
  122. that.$http('order.aftersaleList', {
  123. type: that.orderType,
  124. page: that.currentPage
  125. }, '加载中...').then(res => {
  126. if (res.code === 1) {
  127. that.orderList = [...that.orderList, ...res.data.data];
  128. that.isEmpty = !that.orderList.length;
  129. that.lastPage = res.data.last_page;
  130. that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
  131. }
  132. });
  133. },
  134. //取消
  135. onCancel(aftersaleId, orderIndex) {
  136. let that = this;
  137. that.$http(
  138. 'order.cancelAftersaleOrder',
  139. {
  140. id: aftersaleId
  141. },
  142. '取消中...'
  143. ).then(res => {
  144. if (res.code === 1) {
  145. this.$u.toast(res.msg);
  146. this.orderList.splice(orderIndex, 1);
  147. }
  148. });
  149. },
  150. // 删除
  151. onDelete(aftersaleId, orderIndex) {
  152. let that = this;
  153. uni.showModal({
  154. title: '删除订单',
  155. content: '确定要删除这个订单么?',
  156. cancelText: '取消',
  157. confirmText: '删除',
  158. success: res => {
  159. if (res.confirm) {
  160. that.$http(
  161. 'order.deleteAftersaleOrder',
  162. {
  163. id: aftersaleId
  164. },
  165. '删除中...'
  166. ).then(res => {
  167. if (res.code === 1) {
  168. this.$u.toast(res.msg);
  169. this.orderList.splice(orderIndex, 1);
  170. }
  171. });
  172. }
  173. }
  174. });
  175. },
  176. // 加载更多
  177. loadMore() {
  178. if (this.currentPage < this.lastPage) {
  179. this.currentPage += 1;
  180. this.getAftersaleList();
  181. }
  182. }
  183. }
  184. };
  185. </script>
  186. <style lang="scss">
  187. // 导航切换
  188. .order-nav {
  189. background: #fff;
  190. height: 80rpx;
  191. border-top: 1rpx solid #f5f5f5;
  192. .nav-item {
  193. flex: 1;
  194. .item-title {
  195. font-size: 30rpx;
  196. font-weight: 400;
  197. color: rgba(51, 51, 51, 1);
  198. line-height: 76rpx;
  199. }
  200. .nav-line {
  201. width: 100rpx;
  202. height: 4rpx;
  203. background: #fff;
  204. }
  205. .line-active {
  206. background: rgba(230, 184, 115, 1);
  207. }
  208. }
  209. }
  210. // 售后列表卡片
  211. .order-list {
  212. background: #fff;
  213. margin: 20rpx 0;
  214. .order-bottom {
  215. padding-bottom: 20rpx;
  216. .serve-status {
  217. height: 94rpx;
  218. background: rgba(246, 246, 246, 1);
  219. border-radius: 4rpx;
  220. margin: 0 20rpx 20rpx;
  221. padding: 0 20rpx;
  222. .serve-title {
  223. font-size: 26rpx;
  224. font-weight: 500;
  225. color: rgba(51, 51, 51, 1);
  226. margin-right: 30rpx;
  227. }
  228. .serve-content {
  229. font-size: 20rpx;
  230. font-weight: 400;
  231. color: rgba(102, 102, 102, 1);
  232. }
  233. }
  234. .btn-box {
  235. justify-content: flex-end;
  236. }
  237. .obtn {
  238. width: 160rpx;
  239. line-height: 60rpx;
  240. background: rgba(238, 238, 238, 1);
  241. border-radius: 30rpx;
  242. font-size: 26rpx;
  243. font-weight: 400;
  244. color: rgba(102, 102, 102, 1);
  245. margin-right: 20rpx;
  246. padding: 0;
  247. }
  248. }
  249. .order-head {
  250. padding: 0 25rpx;
  251. height: 77rpx;
  252. border-bottom: 1rpx solid #dfdfdf;
  253. .no {
  254. font-size: 26rpx;
  255. color: #999;
  256. }
  257. .order-status {
  258. .iconfont {
  259. color: #f83942;
  260. font-size: 30rpx;
  261. font-weight: 600;
  262. }
  263. .status-text {
  264. font-size: 26rpx;
  265. font-weight: 400;
  266. color: #f83942;
  267. margin-left: 10rpx;
  268. }
  269. }
  270. }
  271. .order-content {
  272. padding: 20rpx;
  273. .order-sku {
  274. font-size: 24rpx;
  275. font-weight: 400;
  276. color: rgba(153, 153, 153, 1);
  277. width: 450rpx;
  278. margin-bottom: 20rpx;
  279. .order-num {
  280. margin-right: 10rpx;
  281. }
  282. }
  283. .card-price-box {
  284. .status-btn {
  285. height: 32rpx;
  286. border: 1rpx solid rgba(207, 169, 114, 1);
  287. border-radius: 15rpx;
  288. font-size: 20rpx;
  289. font-weight: 400;
  290. color: rgba(168, 112, 13, 1);
  291. padding: 0 10rpx;
  292. margin-left: 20rpx;
  293. background: rgba(233, 183, 102, 0.16);
  294. }
  295. .order-price {
  296. font-size: 26rpx;
  297. font-weight: 600;
  298. color: rgba(51, 51, 51, 1);
  299. }
  300. }
  301. }
  302. .goods-order {
  303. border-bottom: 1px solid rgba(223, 223, 223, 0.5);
  304. padding: 20rpx 20rpx 0;
  305. margin-bottom: 20rpx;
  306. }
  307. .goods-bottom {
  308. background: #fff;
  309. padding-bottom: 30rpx;
  310. }
  311. }
  312. </style>