2 Commits 132bd5a418 ... 3a9c080f93

Author SHA1 Message Date
  wuhongyu 3a9c080f93 Merge branch 'master' of http://git.cc-lotus.info/service-platform/web-test 4 years ago
  wuhongyu 93bac2efb5 gengxin 4 years ago

+ 98 - 9
src/views/adminCenter/transaction/index.vue

@@ -4,7 +4,12 @@
       <el-col :span="24">
         <el-col :span="24" class="leftTop"> <span>|</span> <span>交易审核</span> </el-col>
         <el-col :span="24" class="info">
-          交易审核
+          <span v-if="view">
+            <list :recruitInfo="recruitInfo" :total="total" @handleCurrentChange="handleCurrentChange" @shareBtn="shareBtn" @deleteBtn="deleteBtn"></list>
+          </span>
+          <span v-else>
+            <detail :form="form" @submitDate="onSubmit"></detail>
+          </span>
         </el-col>
       </el-col>
     </el-row>
@@ -12,16 +17,101 @@
 </template>
 
 <script>
-import { mapState, createNamespacedHelpers } from 'vuex';
+import list from './parts/list.vue';
+import detail from './parts/detail.vue';
+import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
+const { mapActions: product } = createNamespacedHelpers('market');
+const { mapActions: tranaudit } = createNamespacedHelpers('tranaudit');
+const { mapActions: transactions } = createNamespacedHelpers('transaction');
+const { mapActions: productpact } = createNamespacedHelpers('productpact');
+
 export default {
-  name: 'index',
+  name: 'recruit',
   props: {},
-  components: {},
-  data: function() {
-    return {};
+  components: {
+    list,
+    detail,
+  },
+  data: () => ({
+    form: {},
+    view: true,
+    total: 1,
+    currentPage: 0,
+    pageSize: 10,
+    tranList: [
+      {
+        title: 'zxlfcjsdl',
+      },
+    ],
+    topTitle: '审核信息',
+    recruitInfo: [],
+    total: 1,
+    skip: '',
+  }),
+  created() {
+    this.search();
+  },
+  methods: {
+    // 审核
+    shareBtn(id) {
+      this.searchinfo(id), (this.view = false);
+    },
+    // 删除
+    async deleteBtn(id) {
+      console.log(id);
+      const res = await this.transactiondetele(id);
+      this.$checkRes(res, '删除成功', '删除失败');
+      this.search();
+    },
+    ...product(['query', 'delete', 'fetch', 'update']),
+    ...productpact({ transactionQuery: 'query', productpactFetch: 'findpact', productpactUpdate: 'update' }),
+    ...tranaudit({ tranauditList: 'query', tranauditListupdate: 'update' }),
+    ...transactions({ transactionsfetch: 'fetch', transactionslist: 'query', transactiondetele: 'detele', transactionupdate: 'update' }),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      if (this.user.role == '4') {
+        skip = this.skip;
+        console.log(this.user.uid);
+        let create_userid = this.user.uid;
+        const res = await this.transactionslist({ skip, create_userid, limit, ...info });
+        this.$set(this, `recruitInfo`, res.data);
+        this.$set(this, `total`, res.total);
+      } else {
+        skip = this.skip;
+        const res = await this.transactionslist({ skip, limit, ...info });
+        this.$set(this, `recruitInfo`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+
+    async handleCurrentChange({ skip, limit, currentPage }) {
+      this.$set(this, `skip`, skip);
+      this.search();
+    },
+
+    //审核页面
+
+    async searchinfo(id) {
+      const res = await this.productpactFetch(id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    async onSubmit() {
+      const res = await this.productpactUpdate(this.form);
+      if (this.$checkRes(res)) {
+        this.form.status = '2';
+        this.form.id = this.form.transaction_id;
+        const arr = await this.transactionupdate(this.form);
+        if (this.$checkRes(arr)) {
+          this.$message({
+            message: '审核通过',
+            type: 'success',
+          });
+        }
+        this.view = true;
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
     pageTitle() {
@@ -33,7 +123,6 @@ export default {
   },
 };
 </script>
-
 <style lang="less" scoped>
 .leftTop {
   font-size: 18px;

+ 62 - 0
src/views/adminCenter/transaction/parts/detail.vue

@@ -0,0 +1,62 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="messgae">
+          <el-form ref="form" :model="form" label-width="120px">
+            <el-form-item label="产品名称">
+              <el-input v-model="form.product_name" :disabled="true"></el-input>
+            </el-form-item>
+            <el-form-item label=" 营销人名称">
+              <el-input v-model="form.market_username" :disabled="true"></el-input>
+            </el-form-item>
+            <el-form-item label="购买人名称">
+              <el-input v-model="form.username" :disabled="true"></el-input>
+            </el-form-item>
+            <el-form-item label="审核">
+              <el-radio v-model="form.status" label="0">待审核</el-radio>
+              <el-radio v-model="form.status" label="1">审核通过</el-radio>
+            </el-form-item>
+            <el-form-item label="描述">
+              <el-input v-model="form.description"></el-input>
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="onSubmit()">提交</el-button>
+            </el-form-item>
+          </el-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'detail',
+  props: {
+    form: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {
+    onSubmit() {
+      this.$emit('submitDate', { data: this.form, id: this.form.id });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top {
+  padding: 15px 0;
+}
+.top .topTitle {
+  text-align: left;
+}
+.top .topBtn {
+  text-align: right;
+  padding: 0 5px;
+}
+</style>

+ 107 - 0
src/views/adminCenter/transaction/parts/list.vue

@@ -0,0 +1,107 @@
+<template>
+  <div id="column">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="list">
+          <template>
+            <el-table :data="recruitInfo" style="width: 100%">
+              <el-table-column prop="product_name" label="商品名称 " align="center"> </el-table-column>
+              <el-table-column prop="username" label="购买人名称" align="center"> </el-table-column>
+              <el-table-column prop="market_username" label="营销人名称" align="center"> </el-table-column>
+              <el-table-column prop="state" label="状态" align="center">
+                <template v-slot="scoped">
+                  {{
+                    `${scoped.row.status}` === `0`
+                      ? '未交易'
+                      : `${scoped.row.status}` === `1`
+                      ? '交易中'
+                      : `${scoped.row.status}` === `2`
+                      ? '交易成功'
+                      : `${scoped.row.status}` === `3`
+                      ? '交易失败'
+                      : `${scoped.row.status}` === `4`
+                      ? '合同待审核'
+                      : '未识别'
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" align="center">
+                <template slot-scope="scoped">
+                  <el-button v-if="scoped.row.status == 4" type="primary" size="mini" @click="shareBtn(scoped.row.id)">审核 </el-button>
+                  <el-button type="danger" size="mini" @click="handleDelete(scoped.row.id)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-col :span="24" class="page">
+              <el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                layout="total, prev, pager, next, jumper"
+                :total="total"
+                :page-size="pageSize"
+              >
+              </el-pagination>
+            </el-col>
+          </template>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'column',
+  props: {
+    recruitInfo: null,
+    total: null,
+
+    view: null,
+  },
+  components: {},
+  data: () => ({
+    currentPage: 0,
+    pageSize: 10,
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    shareBtn(id) {
+      this.$emit('shareBtn', id);
+    },
+
+    handleDelete(id) {
+      this.$emit('deleteBtn', id);
+    },
+    handleEdit(row) {
+      this.$emit('edit', { data: row });
+    },
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`);
+    },
+    handleCurrentChange(currentPage) {
+      console.log(currentPage);
+      this.$emit('handleCurrentChange', { skip: (currentPage - 1) * this.pageSize, limit: this.pageSize, currentPage });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top {
+  padding: 15px 0;
+  border-bottom: 1px solid #cccc;
+}
+.top .topTitle {
+  padding: 0 10px;
+}
+.top .topAdd {
+  padding: 0 10px 0 0;
+  text-align: right;
+}
+.page {
+  padding: 20px 0;
+  text-align: center;
+}
+</style>