index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. <el-col :span="24" class="main">
  10. <el-col :span="24" class="one">
  11. <van-tabs v-model="active" animated>
  12. <van-tab>
  13. <template #title>
  14. <van-icon name="todo-list" />
  15. <p>我的全部</p>
  16. </template>
  17. <wholeList></wholeList>
  18. </van-tab>
  19. <van-tab>
  20. <template #title>
  21. <van-icon name="column" />
  22. <p>我的洽谈</p>
  23. </template>
  24. <negotiation></negotiation>
  25. </van-tab>
  26. <van-tab>
  27. <template #title>
  28. <van-icon name="label" />
  29. <p>我的意向</p>
  30. </template>
  31. <intentionList @submit="submit"></intentionList>
  32. </van-tab>
  33. <van-tab>
  34. <template #title>
  35. <van-icon name="label" />
  36. <p>我的交易</p>
  37. </template>
  38. <transaction></transaction>
  39. </van-tab>
  40. </van-tabs>
  41. </el-col>
  42. </el-col>
  43. </el-col>
  44. </el-col>
  45. </el-row>
  46. <van-popup v-model="show" position="bottom"
  47. ><van-form @submit="onSubmit">
  48. <van-field
  49. v-model="newform.product_name"
  50. name="产品名称"
  51. label="产品名称"
  52. placeholder="用户名"
  53. :rules="[{ required: true, message: '请填写用户名' }]"
  54. />
  55. <van-field
  56. v-model="newform.username"
  57. name="购买人名称"
  58. label="购买人名称"
  59. placeholder="购买人名称"
  60. :rules="[{ required: true, message: '请填写购买人名称' }]"
  61. />
  62. <van-field v-model="newform.market_username" name="营销人名称" label="营销人名称" placeholder="营销人名称" />
  63. <van-field v-model="newform.description" name="描述" label="描述" placeholder="描述" />
  64. <div style="margin: 16px;">
  65. <van-button round block type="info" native-type="submit">
  66. 提交
  67. </van-button>
  68. </div>
  69. </van-form></van-popup
  70. >
  71. </div>
  72. </template>
  73. <script>
  74. import { mapState, createNamespacedHelpers } from 'vuex';
  75. import NavBar from '@/layout/common/topInfo.vue';
  76. import wholeList from './parts/wholeList.vue';
  77. import negotiation from './parts/negotiation.vue';
  78. import intentionList from './parts/intentionList.vue';
  79. import transaction from './parts/transaction.vue';
  80. const { mapActions: transactions } = createNamespacedHelpers('transaction');
  81. const { mapActions: productpact } = createNamespacedHelpers('productpact');
  82. export default {
  83. name: 'index',
  84. props: {},
  85. components: { NavBar, wholeList, negotiation, intentionList, transaction },
  86. data: () => ({
  87. // 头部标题
  88. title: '',
  89. // meta为true
  90. isleftarrow: '',
  91. // 返回
  92. navShow: true,
  93. img_path: require('@/assets/logo.png'),
  94. active: 0,
  95. show: false,
  96. newform: {},
  97. }),
  98. created() {},
  99. computed: {},
  100. methods: {
  101. ...transactions({ transactionList: 'query', transactiondtetle: 'delete', shenheupdate: 'update' }),
  102. ...productpact({ productpactCreate: 'create' }),
  103. submit(data) {
  104. console.log(data);
  105. this.show = true;
  106. this.$set(this, `newform`, data);
  107. },
  108. async onSubmit() {
  109. this.newform.status = '0';
  110. this.newform.transaction_id = this.newform.id;
  111. const res = await this.productpactCreate(this.newform);
  112. if (this.$checkRes(res)) {
  113. this.newform.status = '4';
  114. const arr = await this.shenheupdate(this.newform);
  115. if (this.$checkRes(arr)) {
  116. this.$message({
  117. message: '提交交易成功,等待管理员审核,方可交易完成',
  118. type: 'success',
  119. });
  120. }
  121. }
  122. this.show = false;
  123. },
  124. },
  125. mounted() {
  126. this.title = this.$route.meta.title;
  127. this.isleftarrow = this.$route.meta.isleftarrow;
  128. },
  129. };
  130. </script>
  131. <style lang="less" scoped>
  132. .style {
  133. width: 100%;
  134. min-height: 667px;
  135. position: relative;
  136. background-color: #f9fafc;
  137. }
  138. .top {
  139. height: 46px;
  140. overflow: hidden;
  141. position: relative;
  142. z-index: 999;
  143. }
  144. .main {
  145. min-height: 570px;
  146. .two {
  147. position: fixed;
  148. top: 80%;
  149. left: 10px;
  150. z-index: 999;
  151. }
  152. }
  153. /deep/.van-tab {
  154. text-align: center;
  155. }
  156. /deep/.van-tabs--line .van-tabs__wrap {
  157. height: 70px;
  158. margin: 0 0 10px 0;
  159. }
  160. /deep/.van-tab--active {
  161. color: red;
  162. }
  163. .van-icon {
  164. font-size: 20px;
  165. }
  166. /deep/.van-popup--bottom {
  167. bottom: 0;
  168. left: 0;
  169. width: 100%;
  170. height: 300px;
  171. }
  172. </style>