index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <van-tabs v-model="active">
  10. <van-tab title="我的全部">
  11. <list :list="oneList" status="3" @query="search" @checkBtn="checkBtn"></list>
  12. </van-tab>
  13. <van-tab title="我的洽谈">
  14. <list :list="twoList" status="0" @query="search" @checkBtn="checkBtn"></list>
  15. </van-tab>
  16. <van-tab title="我的意向">
  17. <list :list="threeList" status="1" @query="search" @checkBtn="checkBtn"></list>
  18. </van-tab>
  19. <van-tab title="我的交易">
  20. <list :list="fourList" status="2" @query="search" @checkBtn="checkBtn"></list>
  21. </van-tab>
  22. </van-tabs>
  23. </el-col>
  24. </el-col>
  25. </el-row>
  26. </div>
  27. </template>
  28. <script>
  29. import list from './parts/list.vue';
  30. import NavBar from '@/layout/common/topInfo.vue';
  31. import { mapState, createNamespacedHelpers } from 'vuex';
  32. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  33. export default {
  34. name: 'index',
  35. props: {},
  36. components: {
  37. NavBar,
  38. list,
  39. },
  40. data: function() {
  41. return {
  42. // 头部标题
  43. title: '',
  44. // meta为true
  45. isleftarrow: '',
  46. // 返回
  47. navShow: true,
  48. active: 0,
  49. oneList: [],
  50. twoList: [],
  51. threeList: [],
  52. fourList: [],
  53. };
  54. },
  55. async created() {
  56. await this.search({ status: '3' });
  57. await this.search({ status: '0' });
  58. await this.search({ status: '1' });
  59. await this.search({ status: '2' });
  60. },
  61. methods: {
  62. ...transaction({ transactionsfetch: 'fetch', transactionslist: 'query', transactiondetele: 'detele', shenheupdate: 'update' }),
  63. async search({ skip = 0, status, ...info } = {}) {
  64. let userid = this.user.uid;
  65. let market_userid = this.user.uid;
  66. if (status == '3') {
  67. const res = await this.transactionslist({ skip, userid, ...info });
  68. const arr = await this.transactionslist({ skip, market_userid, ...info });
  69. var newData = res.data.concat(arr.data);
  70. if (this.$checkRes(newData)) {
  71. this.$set(this, `oneList`, newData);
  72. }
  73. } else if (status == '0') {
  74. const res = await this.transactionslist({ skip, market_userid, status: 0, ...info });
  75. if (this.$checkRes(res)) {
  76. this.$set(this, `twoList`, res.data);
  77. }
  78. } else if (status == '1') {
  79. const res = await this.transactionslist({ skip, market_userid, status: 1, ...info });
  80. const arr = await this.transactionslist({ skip, market_userid, status: 4, ...info });
  81. var newData = res.data.concat(arr.data);
  82. if (this.$checkRes(newData)) {
  83. this.$set(this, `threeList`, newData);
  84. }
  85. } else if (status == '2') {
  86. const res = await this.transactionslist({ skip, market_userid, status: 2, ...info });
  87. const arr = await this.transactionslist({ skip, userid, status: 2, ...info });
  88. var newData = res.data.concat(arr.data);
  89. if (this.$checkRes(newData)) {
  90. this.$set(this, `fourList`, newData);
  91. }
  92. }
  93. },
  94. // 交易按钮
  95. async checkBtn(data) {
  96. // 同意交易%交易完成
  97. if (data.status == '0') {
  98. data.status = '1';
  99. let res = await this.shenheupdate(data);
  100. this.$notify({
  101. message: ' 同意交易成功',
  102. type: 'success',
  103. });
  104. this.searchevery();
  105. } else if (data.status == '1') {
  106. this.$router.push({ path: '/userCenter/matter/detail', query: { id: data.id } });
  107. }
  108. },
  109. // 提交刷新
  110. searchevery() {
  111. this.search({ status: '3' });
  112. this.search({ status: '0' });
  113. this.search({ status: '1' });
  114. this.search({ status: '2' });
  115. },
  116. },
  117. computed: {
  118. ...mapState(['user']),
  119. },
  120. mounted() {
  121. this.title = this.$route.meta.title;
  122. this.isleftarrow = this.$route.meta.isleftarrow;
  123. },
  124. metaInfo() {
  125. return { title: this.$route.meta.title };
  126. },
  127. };
  128. </script>
  129. <style lang="less" scoped>
  130. .style {
  131. width: 100%;
  132. min-height: 667px;
  133. position: relative;
  134. background-color: #f9fafc;
  135. }
  136. .top {
  137. height: 46px;
  138. overflow: hidden;
  139. }
  140. .main {
  141. min-height: 570px;
  142. }
  143. </style>