order.vue 5.9 KB

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