detail.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div id="detail">
  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-form>
  10. <van-field v-model="form.product_name" name="产品名称" label="产品名称" placeholder="产品名称" readonly />
  11. <van-field v-model="form.market_username" name="营销人名称" label="营销人名称" placeholder="营销人名称" readonly />
  12. <van-field v-model="form.username" name="购买人名称" label="购买人名称" placeholder="购买人名称" readonly />
  13. <van-field v-model="form.description" rows="1" autosize label="描述" type="textarea" placeholder="描述" />
  14. <van-field name="radio" label="状态">
  15. <template #input>
  16. <van-radio-group v-model="form.status" direction="horizontal">
  17. <van-radio name="0">待审核</van-radio>
  18. <van-radio name="1">通过</van-radio>
  19. </van-radio-group>
  20. </template>
  21. </van-field>
  22. <div style="margin: 16px;">
  23. <van-button round block type="info" @click="onSubmit">
  24. 提交
  25. </van-button>
  26. </div>
  27. </van-form>
  28. </el-col>
  29. </el-col>
  30. </el-row>
  31. </div>
  32. </template>
  33. <script>
  34. import NavBar from '@/layout/common/topInfo.vue';
  35. import { mapState, createNamespacedHelpers } from 'vuex';
  36. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  37. const { mapActions: productpact } = createNamespacedHelpers('productpact');
  38. export default {
  39. name: 'detail',
  40. props: {},
  41. components: {
  42. NavBar,
  43. },
  44. data: function() {
  45. return {
  46. // 头部标题
  47. title: '',
  48. // meta为true
  49. isleftarrow: '',
  50. // 返回
  51. navShow: true,
  52. form: {},
  53. };
  54. },
  55. async created() {
  56. await this.search();
  57. },
  58. methods: {
  59. ...transaction({ transactionfetch: 'fetch', transactionlist: 'query', transactiondetele: 'detele', transactionupdate: 'update' }),
  60. ...productpact({ transactionQuery: 'query', productpactFetch: 'findpact', productpactUpdate: 'update' }),
  61. async search() {
  62. let res = await this.productpactFetch(this.id);
  63. if (this.$checkRes(res)) {
  64. this.$set(this, 'form', res.data);
  65. }
  66. },
  67. // 提交审核
  68. async onSubmit() {
  69. let data = this.form;
  70. const res = await this.productpactUpdate(data);
  71. if (this.$checkRes(res)) {
  72. data.status = '2';
  73. data.id = data.transaction_id;
  74. const arr = await this.transactionupdate(data);
  75. if (this.$checkRes(arr)) {
  76. this.$notify({
  77. message: '审核成功',
  78. type: 'success',
  79. });
  80. this.$router.push({ path: '/adminCenter/transaction/index' });
  81. }
  82. }
  83. },
  84. },
  85. computed: {
  86. ...mapState(['user']),
  87. id() {
  88. return this.$route.query.id;
  89. },
  90. },
  91. mounted() {
  92. this.title = this.$route.meta.title;
  93. this.isleftarrow = this.$route.meta.isleftarrow;
  94. },
  95. metaInfo() {
  96. return { title: this.$route.meta.title };
  97. },
  98. };
  99. </script>
  100. <style lang="less" scoped>
  101. .style {
  102. width: 100%;
  103. min-height: 667px;
  104. position: relative;
  105. background-color: #f9fafc;
  106. }
  107. .top {
  108. height: 46px;
  109. overflow: hidden;
  110. }
  111. .main {
  112. min-height: 570px;
  113. }
  114. </style>