时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

262 lines
6.1 KiB

  1. <template>
  2. <view>
  3. <view class="padding-lr" style="margin-bottom: 10rpx;margin-top: 20rpx;">
  4. <me-tabs v-model="current" :tabs="tab_list" :fixed="true" @change="change"></me-tabs>
  5. </view>
  6. <view class="com" v-for="(tab, tabIndex) in tab_list" v-if="tabIndex == current" :key="tab.id">
  7. <view class="flex-direction justify-around list" v-for="(item, index) in tab.list" :key="item.id" @tap="goDetails(tabIndex,index)">
  8. <view class="lf-row-between">
  9. <view class="left" style="position: relative;">
  10. <image :src="item.goods.cover" mode=""></image>
  11. <view class="cu-tag badge tag-self lf-font-28" :style="{'background-color':item.state_text.bg_color,'color':item.state_text.color}">{{item.state_text.text}}</view>
  12. </view>
  13. <view class="right">
  14. <view class="lf-line-2 title" style="line-height: 40rpx;">{{item.goods.name}}</view>
  15. <view class="lf-flex tips" style="margin: 0!important;">
  16. <text class="progress margin-right-xs">数量</text>
  17. <text class="bought">x {{item.number}}</text>
  18. </view>
  19. <view class="lf-row-between price">
  20. <lf-price :price="item.selling_price" style="margin-top: 10rpx;" />
  21. </view>
  22. </view>
  23. </view>
  24. <view>
  25. <view class="u-border-top flex justify-between align-center text-center">
  26. <view class="text-gray lf-font-28" style="padding: 20rpx;">
  27. {{item.created_at_text}}
  28. </view>
  29. <view class="text-orange" v-if="item.state==1" style="padding: 20rpx;">
  30. {{item.comment_text}}
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 加载 -->
  36. <view class="loading-more">
  37. <text v-if="tab.list.length"
  38. :class="{'loading-more-text': tab.loadingClass}">{{ tab.loadingText }}</text>
  39. <my-nocontent v-else></my-nocontent>
  40. </view>
  41. <!-- 回到顶部 -->
  42. <u-back-top :scroll-top="pageScrollTop"></u-back-top>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. tab_list: [{
  51. name: '全部',
  52. type: 'all',
  53. list: [],
  54. loadingClass: true,
  55. loadingText: '正在加载中',
  56. page: 1,
  57. isPage: true
  58. }, {
  59. name: '待付款',
  60. type: 'unpaid',
  61. list: [],
  62. loadingClass: true,
  63. loadingText: '正在加载中',
  64. page: 1,
  65. isPage: true
  66. }, {
  67. name: '待核销',
  68. type: 'paid',
  69. list: [],
  70. loadingClass: true,
  71. loadingText: '正在加载中',
  72. page: 1,
  73. isPage: true
  74. },
  75. {
  76. name: '已核销',
  77. type: 'complete',
  78. list: [],
  79. loadingClass: true,
  80. loadingText: '正在加载中',
  81. page: 1,
  82. isPage: true
  83. },
  84. {
  85. name: '售后',
  86. type: 'after_sales',
  87. list: [],
  88. loadingClass: true,
  89. loadingText: '正在加载中',
  90. page: 1,
  91. isPage: true
  92. }
  93. ],
  94. current: 0, // tab下表
  95. pageSize: 10,
  96. assetsType: '', //账户类型
  97. orderType: []
  98. }
  99. },
  100. onLoad(e) {
  101. this.assetsType = e.type
  102. },
  103. onShow() {
  104. let tab_item = this.tab_list[this.current];
  105. tab_item.page = 1;
  106. tab_item.isPage = true;
  107. tab_item.loadingClass = true;
  108. tab_item.loadingText = '正在加载中';
  109. this.getUserOrder();
  110. },
  111. methods: {
  112. // 切换tab
  113. change(index) {
  114. this.current = index;
  115. this.getUserOrder();
  116. },
  117. goDetails(tabIndex,index) {
  118. let item = this.tab_list[tabIndex].list[index]
  119. this.$routerGo('/pages/shopOrder/order-details?order_id=' + item.id)
  120. },
  121. onReachBottom() {
  122. let tab_item = this.tab_list[this.current];
  123. if (tab_item.isPage) {
  124. tab_item.page = tab_item.page + 1;
  125. this.getUserOrder();
  126. }
  127. },
  128. onPullDownRefresh() {
  129. let tab_item = this.tab_list[this.current];
  130. tab_item.page = 1;
  131. tab_item.isPage = true;
  132. tab_item.loadingClass = true;
  133. tab_item.loadingText = '正在加载中';
  134. this.getUserOrder();
  135. uni.stopPullDownRefresh()
  136. },
  137. getUserOrder() {
  138. let per_page = this.pageSize;
  139. let tab_item = this.tab_list[this.current];
  140. this.$http(this.API.API_SHOPORDER, {
  141. state: this.tab_list[this.current].type,
  142. page: tab_item.page,
  143. per_page
  144. }).then(res => {
  145. let isPage = res.data.has_more_page;
  146. tab_item.isPage = isPage;
  147. if (isPage) {
  148. tab_item.loadingClass = true;
  149. tab_item.loadingText = '正在加载中';
  150. } else {
  151. tab_item.loadingClass = false;
  152. tab_item.loadingText = '没有更多数据啦~';
  153. }
  154. if (tab_item.page == 1) {
  155. tab_item.list = res.data.items;
  156. } else {
  157. tab_item.list.push(...res.data.items);
  158. }
  159. })
  160. }
  161. },
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .tag-self {
  166. position: absolute!important;
  167. top: 0!important;
  168. border-radius: 20rpx 0 20rpx 0!important;
  169. width: max-content;
  170. height: 32rpx!important;
  171. }
  172. .title {
  173. font-size: 28rpx;
  174. color: $u-content-color;
  175. height: 80rpx;
  176. }
  177. // tab
  178. .ctab {
  179. width: 100%;
  180. margin: 20rpx 0 0rpx 0rpx;
  181. padding: 0 22rpx;
  182. }
  183. // 商品列表
  184. .com {
  185. width: 100%;
  186. overflow: hidden;
  187. .list {
  188. border-radius: 10rpx;
  189. overflow: hidden;
  190. margin: 20rpx 32rpx;
  191. background-color: #FFFFFF;
  192. // box-shadow: 0 0 10px 5px #e5e5e5;
  193. box-shadow: 0 10rpx 20rpx 0 rgba(0, 0, 0, 0.1);
  194. align-items: flex-start;
  195. .left {
  196. overflow: hidden;
  197. image {
  198. width: 186rpx;
  199. height: 186rpx;
  200. margin: 20rpx;
  201. border-radius: 10rpx;
  202. }
  203. }
  204. .right {
  205. overflow: hidden;
  206. width: 64%;
  207. .title {
  208. margin: 0rpx 20rpx 10rpx 0;
  209. color: #222222;
  210. font-size: 32rpx;
  211. }
  212. .tips {
  213. margin: 16rpx 0;
  214. overflow: hidden;
  215. .u-line-progress {
  216. width: 112rpx;
  217. overflow: hidden;
  218. margin-right: 20rpx;
  219. }
  220. .progress {
  221. color: #777777;
  222. font-size: 24rpx;
  223. }
  224. .bought {
  225. color: #777777;
  226. font-size: 24rpx;
  227. margin-right: 20rpx;
  228. }
  229. }
  230. .price {
  231. overflow: hidden;
  232. color: #FF0000;
  233. margin-top: 10rpx;
  234. button {
  235. width: 176rpx;
  236. height: 60rpx;
  237. background: #FE9903;
  238. border-radius: 15px;
  239. font-size: 24rpx;
  240. color: #FFFFFF;
  241. margin: 0rpx 20rpx 0rpx 20rpx;
  242. border: none;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. </style>