order.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="all">
  3. <view class="fixedBox">
  4. <view class="navList flex">
  5. <view v-for="(item, index) in navItem" :key="index" class="navItem"
  6. :class="{ activeItem: tabIndex === index,tip:index == 0 }" @click="tabClick(index,1)">{{ item }}
  7. </view>
  8. </view>
  9. <view class="navList flex navList2">
  10. <view v-for="(item, index) in navList[tabIndex]" :key="index" class="navItem"
  11. :class="{ activeItem: tabCurr === index}" @click="tabClick(index,2)">{{ item.name }}
  12. </view>
  13. </view>
  14. </view>
  15. <view class="listItemBox">
  16. <view class="listItem" v-for="item,index in list" :key="index">
  17. <view class="itemInfo flex">
  18. <view class="flex_item">
  19. <image src="/static/image/img20.png" style="width: 55rpx;" mode="widthFix"></image>
  20. <view class="name">李丹丹</view>
  21. </view>
  22. <view class="" style="font-size: 24rpx;font-weight: bold;color: #0C5AFA;">进行中</view>
  23. </view>
  24. <view class="itemTip flex">
  25. <view class="tipBox">
  26. <view class="tipText">数量:10USTD</view>
  27. <view class="tipText">总价:¥500</view>
  28. <view class="tipText">2023-04-25 14:20:30</view>
  29. </view>
  30. <view class="" style="text-align: right;">
  31. <image src="/static/image/img21.png" style="width: 40rpx;margin-bottom: 25rpx;" mode="widthFix">
  32. </image>
  33. <view class="tipBtn">查看凭证</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. sellMy,
  43. sellBuyMy
  44. } from '@/api/game.js';
  45. import {
  46. mapState
  47. } from 'vuex';
  48. export default {
  49. computed: {
  50. ...mapState('user', ['hasLogin'])
  51. },
  52. data() {
  53. return {
  54. tabIndex: 0, //当前选中的一级分类
  55. navItem: ['卖币订单', '买币订单'],
  56. tabCurr: 0, //当前选中的二级分类
  57. status: 0, //当前选中状态
  58. navList: [
  59. [ {
  60. name: '挂出',
  61. status: 1
  62. }, {
  63. name: '待确认',
  64. status: 3
  65. }, {
  66. name: '完成',
  67. status: 2
  68. },{
  69. name: '结束',
  70. status: 0
  71. },],
  72. [ {
  73. name: '待上传',
  74. status: 3
  75. }, {
  76. name: '已上传',
  77. status: 5
  78. }, {
  79. name: '完成',
  80. status: 2
  81. },{
  82. name: '结束',
  83. status: 0
  84. },]
  85. ],
  86. page: 1,
  87. limit: 10,
  88. loadingType: "more",
  89. list: []
  90. }
  91. },
  92. onLoad() {
  93. this.loadData()
  94. },
  95. onReachBottom() {
  96. this.loadData()
  97. },
  98. methods: {
  99. loadData() {
  100. let obj = this;
  101. if (obj.loadingType == "nomore" ||
  102. obj.loadingType == "loading") {
  103. return;
  104. }
  105. obj.loadingType = "loading";
  106. if (this.tabIndex == 0) {
  107. sellMy({
  108. page: obj.page,
  109. limit: 10,
  110. status:obj.status
  111. }, obj.status).then(res => {
  112. obj.dataList(res.data.list)
  113. });
  114. } else if (this.tabIndex == 1) {
  115. sellBuyMy({
  116. page: obj.page,
  117. limit: 10,
  118. status:obj.status
  119. }, obj.status).then(res => {
  120. obj.dataList(res.data.list)
  121. });
  122. }
  123. },
  124. dataList(ar) {
  125. const obj = this;
  126. if (ar.length > 0) {
  127. obj.list = obj.list.concat(ar);
  128. obj.page++;
  129. if (obj.limit == ar.length) {
  130. obj.loadingType = "more";
  131. } else {
  132. obj.loadingType = "nomore";
  133. }
  134. }
  135. console.log(obj.list,"list");
  136. },
  137. tabClick(index,type) {
  138. if (type == 1) {
  139. if (index == this.tabIndex) {
  140. return
  141. }
  142. this.tabIndex = index;
  143. this.tabCurr = 0
  144. } else if (type == 2) {
  145. if (index == this.tabCurr) {
  146. return
  147. }
  148. this.tabCurr = index
  149. }
  150. this.status = this.navList[this.tabIndex][this.tabCurr].status;
  151. this.page = 1;
  152. this.loadingType = "more";
  153. this.list = []
  154. this.loadData()
  155. },
  156. }
  157. };
  158. </script>
  159. <style lang="scss">
  160. .all {
  161. width: 750rpx;
  162. height: 100%;
  163. background-color: #051137;
  164. padding-top: var(--status-bar-height);
  165. }
  166. .fixedBox {
  167. position: fixed;
  168. top: 44px;
  169. left: 0;
  170. width: 100%;
  171. z-index: 9;
  172. }
  173. .navList {
  174. padding: 20rpx 50rpx 20rpx 50rpx;
  175. background: #1F2A4A;
  176. .navItem {
  177. color: #fff;
  178. font-size: 30rpx;
  179. text-align: center;
  180. width: 50%;
  181. &.activeItem {
  182. color: #0C5AFA;
  183. position: relative;
  184. &:after {
  185. content: '';
  186. position: absolute;
  187. left: 36%;
  188. bottom: -20rpx;
  189. width: 30%;
  190. height: 8rpx;
  191. // transform: translateX(-50%);
  192. border-bottom: 4rpx solid #0C5AFA;
  193. border-radius: 0rpx 20rpx 0rpx 0rpx;
  194. }
  195. }
  196. &.tip {
  197. border-right: 1rpx solid #333D5B;
  198. }
  199. }
  200. }
  201. .navList2 {
  202. background: #051137;
  203. padding: 20rpx 25rpx 20rpx 25rpx;
  204. }
  205. .listItemBox {
  206. padding-top: 88px;
  207. .listItem {
  208. padding: 34rpx 34rpx;
  209. background: #1F2A4A;
  210. margin-bottom: 25rpx;
  211. .name {
  212. font-family: PingFang SC;
  213. font-weight: bold;
  214. font-size: 30rpx;
  215. color: #FFFFFF;
  216. padding-left: 25rpx;
  217. }
  218. .itemTpl {
  219. font-family: PingFang SC;
  220. font-weight: bold;
  221. font-size: 36rpx;
  222. color: #0C5AFA;
  223. padding-top: 25rpx;
  224. }
  225. .itemTip {
  226. .tipText {
  227. font-family: PingFang SC;
  228. font-weight: 500;
  229. font-size: 26rpx;
  230. color: #999999;
  231. padding-top: 15rpx;
  232. }
  233. .tipBtn {
  234. font-family: PingFang SC;
  235. font-weight: bold;
  236. font-size: 24rpx;
  237. color: #FFFFFF;
  238. background: linear-gradient(90deg, #0C5AFA, #1356FF);
  239. border-radius: 7rpx;
  240. padding: 15rpx 35rpx;
  241. }
  242. }
  243. }
  244. }
  245. </style>