Browse Source

绿色回收功能

liyuan 3 weeks ago
parent
commit
2a97e7633f

+ 83 - 0
src/api/tirePartsMall/cycling/cycling.js

@@ -0,0 +1,83 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getRecyclingItemList = (data) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/getGreenRecyclingItemList?id=' + data,
+    method: 'post'
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+
+export const greenRecyclingAudit = (row) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/greenRecyclingAudit',
+    method: 'post',
+    data: row
+  })
+}
+
+
+
+
+export const del = (data) => {
+  return request({
+    url: '/api/blade-sales-part/green/recycling/delGreenRecycling?id=' + data,
+    method: 'post'
+  })
+}
+
+export const getCustomerGreenRecyclingRecordList = (row) => {
+    return request({
+        url: '/api/blade-sales-part/green/recycling/getCustomerGreenRecyclingRecordList',
+        method: 'post',
+        data: row
+    })
+}

+ 249 - 0
src/views/tirePartsMall/recycling/detailsPage.vue

@@ -0,0 +1,249 @@
+<template>
+  <div>
+    <div class="borderless">
+      <div class="customer-head">
+        <div class="customer-back">
+          <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
+                     @click="backToList">
+            返回列表
+          </el-button>
+        </div>
+        <div class="add-customer-btn">
+          <el-button v-if="onLoad.status === 0" type="primary" size="small" @click="audit(2)">
+            通 过
+          </el-button>
+          <el-button v-if="onLoad.status === 0" type="warning" size="small" @click="audit(1)">
+            驳 回
+          </el-button>
+        </div>
+      </div>
+      <trade-card title="主要信息" style="margin-top: 60px">
+        <avue-form ref="form" class="trading-form" v-model="onLoad" :option="option" :key="key">
+        </avue-form>
+      </trade-card>
+      <trade-card title="明细数据" style="margin-top: 10px">
+        <avue-crud :option="tableOption"
+                   :data="tableData"
+                   ref="crud">
+        </avue-crud>
+      </trade-card>
+    </div>
+  </div>
+</template>
+
+<script>
+import {getRecyclingItemList, greenRecyclingAudit} from "@/api/tirePartsMall/cycling/cycling";
+
+export default {
+  name: "index",
+  data() {
+    return {
+      form: {},
+      key: 0,
+      option: {
+        menuBtn: false,
+        labelWidth: 100,
+        disabled: true,
+        column: [
+          {
+            label: "客户名称",
+            prop: "customerName",
+            span: 6
+          },
+          {
+            label: "总金额",
+            prop: "amount",
+            span: 6
+          },
+          {
+            label: "总数量",
+            prop: "quantity",
+            span: 6
+          },
+          {
+            label: "审核状态",
+            prop: "status",
+            type: 'select',
+            dicData: [
+              {
+                label: "待审批",
+                value: 0
+              },
+              {
+                label: "已通过",
+                value: 2
+              },
+              {
+                label: "已拒绝",
+                value: 1
+              }
+            ],
+            span: 6
+          },
+          {
+            label: "创建人",
+            prop: "createUserName",
+            span: 6
+          },
+          {
+            label: "创建时间",
+            prop: "createTime",
+            span: 6
+          },
+          {
+            label: "更新人",
+            prop: "updateUserName",
+            span: 6
+          },
+          {
+            label: "更新时间",
+            prop: "updateTime",
+            span: 6
+          },
+          {
+            label: "备注",
+            prop: "remark",
+            span: 24
+          },
+          {
+            label: "上传图片",
+            prop: "imgs",
+            type: "upload",
+            span: 24,
+            listType: "picture-card",
+            propsHttp: {
+              res: "data",
+            }
+          }
+        ]
+      },
+      tableOption: {
+        height: 'auto',
+        calcHeight: 30,
+        tip: false,
+        searchShow: false,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        menu: false,
+        addBtn: false,
+        viewBtn: false,
+        selection: false,
+        dialogClickModal: false,
+        align: "center",
+        column: [
+          {
+            label: "尺寸",
+            prop: "productName",
+            search: true
+          },
+          {
+            label: "单价",
+            prop: "productPrice"
+          },
+          {
+            label: "数量",
+            prop: "productQuantity"
+          },
+
+          {
+            label: "金额",
+            prop: "productAmount"
+          }
+        ]
+      },
+      tableLoading: false,
+      tableData: []
+    };
+  },
+  props: {
+    onLoad: Object,
+  },
+  watch: {
+    onLoad: {
+      handler(val) {
+        this.getItemList()
+      },
+      deep: true
+    }
+  },
+  mounted() {
+    console.info(this.onLoad)
+  },
+  methods: {
+    backToList() {
+      this.$emit("backToList");
+    },
+    audit(status) {
+      this.$confirm("确认要审核" + (status === 2 ? '通过' : '驳回') + '吗?', {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        greenRecyclingAudit({id: this.onLoad.id, status: status}).then(res => {
+          console.info('res----', res)
+          this.$message({
+            type: "success",
+            message: res.data.msg
+          });
+          this.onLoad.status = status
+        })
+      })
+
+    },
+    getItemList() {
+      getRecyclingItemList(this.onLoad.id).then(res => {
+        console.info('res----', res)
+        this.tableData = res.data.data
+      })
+    }
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.trading-form ::v-deep .el-form-item {
+  margin-bottom: 8px !important;
+}
+
+::v-deep .el-dialog__body {
+  padding: 0px 20px 15px 20px;
+}
+
+::v-deep .el-form-item__error {
+  display: none !important;
+}
+
+.img-form ::v-deep .el-form-item {
+  height: 150px;
+  line-height: 150px;
+  margin-bottom: 8px !important;
+}
+
+.img-form ::v-deep .avue-upload__icon {
+  font-size: 20px;
+  width: 150px;
+  height: 150px;
+  line-height: 150px;
+}
+
+::v-deep .el-table .cell {
+  padding: 0 2px !important;
+}
+
+::v-deep .avue-crud .el-table .el-form-item__label {
+  left: -1px;
+}
+
+.addressTabs {
+  display: flex;
+  justify-content: center;
+
+  span {
+    width: 100px;
+    font-size: 18px;
+    font-weight: 600;
+    text-align: center;
+  }
+}
+</style>

+ 252 - 0
src/views/tirePartsMall/recycling/greenrecycling.vue

@@ -0,0 +1,252 @@
+<template>
+    <div>
+        <basic-container v-show="!detailsOpen">
+            <avue-crud :option="option"
+                       :table-loading="loading"
+                       :data="data"
+                       :page.sync="page"
+                       :before-open="beforeOpen"
+                       v-model="form"
+                       ref="crud"
+                       @search-change="searchChange"
+                       @search-reset="searchReset"
+                       @selection-change="selectionChange"
+                       @current-change="currentChange"
+                       @size-change="sizeChange"
+                       @refresh-change="refreshChange"
+                       @on-load="onLoad">
+                <template slot-scope="{type,size,row,index}" slot="menu">
+                    <el-button v-if="row.status === 0" :size="size" :type="type" @click="audit(row, 2)">通过
+                    </el-button>
+                    <el-button v-if="row.status === 0" :size="size" :type="type" @click="audit(row, 1)">驳回
+                    </el-button>
+                    <el-button v-if="row.status === 0" :size="size" type="danger" @click="handleDelete(row)">删除
+                    </el-button>
+                </template>
+                <template slot-scope="{ row, index }" slot="customerName">
+                    <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row)">{{
+                            row.customerName
+                        }}</span>
+                </template>
+            </avue-crud>
+        </basic-container>
+        <detail v-if="detailsOpen" ref="detailRef" :onLoad="form" @backToList="backToList"></detail>
+    </div>
+</template>
+
+<script>
+
+import {getList, getDetail, del, greenRecyclingAudit} from "@/api/tirePartsMall/cycling/cycling";
+import detail from "@/views/tirePartsMall/recycling/detailsPage.vue";
+
+export default {
+    components: {detail},
+    data() {
+        return {
+            form: {},
+            query: {},
+            loading: true,
+            detailsOpen: false,
+            page: {
+                pageSize: 10,
+                currentPage: 1,
+                total: 0
+            },
+            selectionList: [],
+            option: {
+                height: 'auto',
+                calcHeight: 30,
+                tip: false,
+                searchShow: true,
+                searchMenuSpan: 6,
+                border: true,
+                index: true,
+                delBtn: false,
+                editBtn: false,
+                addBtn: false,
+                viewBtn: false,
+                selection: false,
+                align: "center",
+                dialogClickModal: false,
+                column: [
+                    {
+                        label: "客户名称",
+                        prop: "customerName",
+                        searchSpan: 4,
+                        search: true
+                    },
+                    {
+                        label: "总金额",
+                        prop: "amount"
+                    },
+                    {
+                        label: "总数量",
+                        search: true,
+                        searchSpan: 4,
+                        prop: "quantity"
+                    },
+
+                    {
+                        label: "创建人",
+                        prop: "createUserName"
+                    },
+                    {
+                        label: "创建时间",
+                        prop: "createTime",
+                        search: true,
+                        searchProp: "createTimeList",
+                        type: "date",
+                        unlinkPanels: true,
+                        searchRange: true,
+                        searchDefaultTime: ["00:00:00", "23:59:59"],
+                        format: "yyyy-MM-dd",
+                        valueFormat: "yyyy-MM-dd HH:mm:ss"
+                    },
+                    {
+                        label: "更新人",
+                        prop: "updateUserName"
+                    },
+                    {
+                        label: "更新时间",
+                        prop: "updateTime"
+                    },
+                    {
+                        label: "审核状态",
+                        prop: "status",
+                        type: 'select',
+                        search: true,
+                        searchSpan: 4,
+                        dicData: [
+                            {
+                                label: "待审批",
+                                value: 0
+                            },
+                            {
+                                label: "已通过",
+                                value: 2
+                            },
+                            {
+                                label: "已拒绝",
+                                value: 1
+                            }
+                        ]
+                    }
+                ]
+            },
+            data: []
+        };
+    },
+    computed: {
+        ids() {
+            let ids = [];
+            this.selectionList.forEach(ele => {
+                ids.push(ele.id);
+            });
+            return ids.join(",");
+        }
+    },
+    methods: {
+        backToList() {
+            this.form = {}
+            this.detailsOpen = false
+            this.$store.commit("OUT_FINACING_DETAIL");
+            this.onLoad(this.page, this.search)
+        },
+        editOpen(row) {
+            this.form = row
+            let rowImg = []
+            if (row.imgs && row.imgs !== "[]") {
+                let uniAppImg = JSON.parse(row.imgs)
+                rowImg = uniAppImg.map(item => {
+                    return {
+                        label: item.fileName,
+                        value: item.url
+                    }
+                })
+            }
+            this.form.imgs = rowImg
+            this.$store.commit("IN_FINACING_DETAIL");
+            this.detailsOpen = true;
+        },
+        handleDelete(row) {
+            this.$confirm("确定要删除该数据?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+            }).then(() => {
+                del(row.id).then(res => {
+                    this.$message({
+                        type: "success",
+                        message: res.data.msg
+                    });
+                })
+                this.onLoad(this.page);
+            })
+        },
+        beforeOpen(done, type) {
+            if (["edit", "view"].includes(type)) {
+                getDetail(this.form.id).then(res => {
+                    this.form = res.data.data;
+                });
+            }
+            done();
+        },
+        searchReset() {
+            this.query = {};
+            this.onLoad(this.page);
+        },
+        searchChange(params, done) {
+            this.query = params;
+            this.page.currentPage = 1;
+            this.onLoad(this.page, params);
+            done();
+        },
+        selectionChange(list) {
+            this.selectionList = list;
+        },
+        selectionClear() {
+            this.selectionList = [];
+            this.$refs.crud.toggleSelection();
+        },
+        currentChange(currentPage) {
+            this.page.currentPage = currentPage;
+        },
+        sizeChange(pageSize) {
+            this.page.pageSize = pageSize;
+        },
+        refreshChange() {
+            this.onLoad(this.page, this.query);
+        },
+        onLoad(page, params = {}) {
+            this.loading = true;
+            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+                const data = res.data.data;
+                this.page.total = data.total;
+                this.data = data.records;
+                this.loading = false;
+                this.selectionClear();
+            });
+        },
+        audit(row, status) {
+            this.$confirm("确认要审核" + (status === 2 ? '通过' : '驳回') + '吗?', {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+            }).then(() => {
+                greenRecyclingAudit({id: row.id, status: status}).then(res => {
+                    console.info('res----', res)
+                    this.$message({
+                        type: "success",
+                        message: res.data.msg
+                    });
+                    this.onLoad(this.page, this.search)
+                })
+            })
+
+        }
+    }
+};
+</script>
+
+<style>
+</style>