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