order.vue 6.2 KB

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