supermarketdetail.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div id="policy">
  3. <supermarketlist-detail
  4. @handleCurrentChange="handleCurrentChange"
  5. :contentList="contentList"
  6. :total="total"
  7. :columnName="columnName"
  8. @fetch="fetchInfo"
  9. :display="display"
  10. :policyInfo="policyInfo"
  11. @onSubmit="onSubmit"
  12. ></supermarketlist-detail>
  13. </div>
  14. </template>
  15. <script>
  16. import supermarketlistDetail from '@/components/supermaket/supermarketlistDetail.vue';
  17. import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
  18. import _ from 'loadsh';
  19. const { mapActions: mapEnterpriseproject } = createNamespacedHelpers('enterpriseproject');
  20. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  21. const { mapActions: tranaudit } = createNamespacedHelpers('tranaudit');
  22. export default {
  23. name: 'policy',
  24. props: {},
  25. components: {
  26. supermarketlistDetail,
  27. },
  28. data: () => ({
  29. policyInfo: {},
  30. display: 'detail',
  31. columnName: '',
  32. contentList: [],
  33. total: 1,
  34. skip: '',
  35. }),
  36. async created() {
  37. this.searchinfos();
  38. },
  39. computed: {
  40. id() {
  41. return this.$route.query.id;
  42. },
  43. ...mapState(['user']),
  44. totaltype() {
  45. return this.$route.query.totaltype;
  46. },
  47. },
  48. methods: {
  49. ...mapEnterpriseproject({ list: 'query', fetch: 'newfetch' }),
  50. ...transaction({ transactioncreate: 'create', transactionfetch: 'fetch' }),
  51. ...tranaudit({ tranauditcreate: 'create' }),
  52. fetchInfo() {},
  53. async searchinfos() {
  54. console.log(this.id);
  55. this.display = 'detail';
  56. const res = await this.fetch(this.id);
  57. this.$set(this, `policyInfo`, res.data);
  58. },
  59. async handleCurrentChange({ skip, limit, currentPage }) {
  60. this.$set(this, `skip`, skip);
  61. this.search();
  62. },
  63. async onSubmit() {
  64. console.log(this.user.uid);
  65. let form = {};
  66. form.userid = this.user.uid;
  67. form.username = this.user.name;
  68. form.product_id = this.policyInfo.id;
  69. form.product_name = this.policyInfo.name;
  70. form.market_userid = this.policyInfo.userid;
  71. form.market_username = this.policyInfo.contact_user;
  72. form.status = '0';
  73. console.log(form);
  74. let res = await this.transactioncreate(form);
  75. this.$checkRes(res, '发起交易成功', '交易失败');
  76. let shenhe = {};
  77. shenhe.result = '0';
  78. shenhe.transaction_id = res.data.id;
  79. shenhe.userid = this.policyInfo.userid;
  80. shenhe.product_id = this.policyInfo.userid;
  81. console.log(shenhe);
  82. let ress = await this.tranauditcreate(shenhe);
  83. },
  84. },
  85. };
  86. </script>
  87. <style lang="scss" scoped></style>