Sfoglia il codice sorgente

添加分类页面及订单选择分组,首页部分调整接口,添加设置库存预警

yangg 1 anno fa
parent
commit
28b53cecc9

+ 20 - 0
manager-admin/src/api/goodsTransfer.js

@@ -175,3 +175,23 @@ export function get_withdraw(id) {
 
   })
 }
+/* /admin/erp/product/updateWarnStock/{stockId}/{warnNum} */
+
+export function updateWarnStock(stockId,warnNum) {
+  return request({
+    url: `/admin/erp/product/updateWarnStock/${stockId}/${warnNum}`,
+    method: 'post',
+    headers: { 'Content-Type': 'application/json' },
+
+  })
+}
+
+
+/* 库存预警列表接口 /admin/erp/product/getWarnStock/{warehouseId}*/
+export function getWarnStock(warehouseId) {
+  return request({
+    url: `/admin/erp/product/getWarnStock/${warehouseId}`,
+    method: 'get',
+   
+  })
+}

+ 77 - 0
manager-admin/src/api/productClass.js

@@ -0,0 +1,77 @@
+import request from '@/utils/request'
+
+
+/* 添加商品列表 */
+export function productGroup(store) {
+    return request({
+      url: '/admin/erp/product/productGroup',
+      method: 'post',
+      headers: { 'Content-Type': 'application/json' },
+      data: store
+    })
+  }
+  
+  /**
+   * 编辑商品分类
+   * @param store
+   */
+  export function editProduct(id, store) {
+    return request({
+      url: `/admin/erp/product/update/${id}`,
+      method: 'post',
+      headers: { 'Content-Type': 'application/json' },
+      data: store
+    })
+  }
+  
+  /**
+   * 删除商品分类
+   * @param id
+   */
+  export function removeProduct(id) {
+    return request({
+      url: `/admin/erp/product/remove/${id}`,
+      method: 'post'
+    })
+  }
+  
+  /**
+   * 获取商品分类列表
+   * @param params
+   */
+  export function getProductList(params) {
+    return request({
+      url: '/admin/erp/product/list',
+      method: 'get',
+      loading: false,
+      params
+    })
+  }
+
+  /* 获取商品列表 */
+  export function getProduct(params) {
+    return request({
+      url: '/admin/erp/product',
+      method: 'get',
+      loading: false,
+      params
+    })
+  }
+
+  /* 查询商品分类详细信息 /admin/erp/product/getById/{id} */
+
+  export function getById(id) {
+    return request({
+      url: `/admin/erp/product/getById/${id}`,
+      method: 'get',
+      loading: false,
+    })
+  }
+  /*  /admin/erp/product/getProductByGroup/{warehouseId}/{groupId} */
+  export function getProductByGroup(warehouseId,groupId) {
+    return request({
+      url: `/admin/erp/product/getProductByGroup/${warehouseId}/${groupId}`,
+      method: 'get',
+      loading: false,
+    })
+  }

+ 3 - 1
manager-admin/src/lang/zh.js

@@ -25,7 +25,9 @@ export default {
     returnOrderAudit: '退货单审核',
     supplierSettlement: '供应商结算',
     settlementDeatil: '结算单详情',
-
+    productClass:'商品分类',
+    productClassAdd:"新增分类",
+    productClassEdit:'编辑分类',
     stock: '仓库管理',
     goodsTransfer: '库存列表',//商品调拨
     goodsTransferAdd: '库存添加',

+ 3 - 1
manager-admin/src/router/index.js

@@ -187,7 +187,9 @@ const asyncRouters = [
       //{ path: 'tag-manage', component: () => import('@/views/basicSetting/goodsTag/tagManage'), name: 'tagManage', meta: { title: 'tagManage' }},
       { path: 'tag-add/:tag_id', component: () => import('@/views/basicSetting/goodsTag/tagAdd'), name: 'tagAdd', meta: { title: 'tagAdd' }, hidden: true },
       { path: 'serial-list', component: () => import('@/views/setting/serialList'), name: 'serialLists', meta: { title: 'serialLists' } },
-
+      { path: 'product-class', component: () => import('@/views/basicSetting/productClass.vue'), name: 'productClass', meta: { title: 'productClass' } },
+      { path: 'product-class-add', component: () => import('@/views/basicSetting/productClassAdd.vue'), name: 'productClassAdd', meta: { title: 'productClassAdd' }, hidden: true },
+      { path: 'product-class-edit/:id?', component: () => import('@/views/basicSetting/productClassAdd.vue'), name: 'productClassEdit', meta: { title: 'productClassEdit', noCache: true }, hidden: true },
     ]
   },
   // 客户管理

+ 2 - 2
manager-admin/src/styles/index.scss

@@ -86,14 +86,14 @@ div:focus{
 }
 
 .clearfix {
-  &:after {
+ /*  &:after {
     visibility: hidden;
     display: block;
     font-size: 0;
     content: " ";
     clear: both;
     height: 0;
-  }
+  } */
 }
 
 code {

+ 179 - 0
manager-admin/src/views/basicSetting/productClass.vue

@@ -0,0 +1,179 @@
+<template>
+    <div>
+        <en-table-layout :tableData="tableData.records" :loading="loading" :selection-change="handleSelectionChange">
+            <div slot="toolbar" class="inner-toolbar">
+                <div class="toolbar-btns">
+                    <el-button size="mini" type="primary" icon="el-icon-circle-plus-outline" @click="handleAddBrand"
+                        v-if="checkPermission(['brand:add'])">添加</el-button>
+                </div>
+                <div class="toolbar-search">
+                    <en-table-search @search="searchEvent" placeholder="请输入品牌名称" />
+                </div>
+            </div>
+            <template slot="table-columns">
+                <el-table-column type="selection" width="100" />
+                <!--品牌名称-->
+                <el-table-column prop="name" label="组合名称" />
+                <!--品牌图片-->
+                <el-table-column label="组合说明" prop="remark">
+                </el-table-column>
+                <!--操作-->
+                <el-table-column label="操作" >
+                    <template slot-scope="scope">
+                        <el-button size="mini" 
+                            @click="handleEditBrand('check', scope.row)">查看</el-button>
+                        <el-button size="mini" type="primary"
+                            @click="handleEditBrand('edit', scope.row)">编辑</el-button>
+                        <el-button size="mini" type="danger"
+                            @click="handleDeleteBrand(scope.$index, scope.row)">删除</el-button>
+                    </template>
+                </el-table-column>
+            </template>
+            <el-pagination v-if="tableData" slot="pagination" @size-change="handlePageSizeChange"
+                @current-change="handlePageCurrentChange" :current-page="tableData.pages"
+                :page-sizes="[10, 20, 50, 100]" :page-size="tableData.size"
+                layout="total, sizes, prev, pager, next, jumper" :total="tableData.total">
+            </el-pagination>
+        </en-table-layout>
+    </div>
+</template>
+
+<script>
+import * as API_productClass from "@/api/productClass.js"
+export default {
+    name: 'brandList',
+    data() {
+        return {
+            /** 列表loading状态 */
+            loading: false,
+            /** 列表参数 */
+            params: {
+                pages: 1,
+                size: 10
+            },
+            /** 列表数据 */
+            tableData: '',
+            /** 被选数据 */
+            selectedData: [],
+
+            // 添加、修改品牌 dialog
+            dialogBrandVisible: false,
+
+            /** 添加、修改品牌 表单 */
+            brandForm: {
+                logo: ".."
+            },
+
+        }
+    },
+    mounted() {
+        this.GET_BrandList()
+    },
+    methods: {
+        /** 当选择项发生变化 */
+        handleSelectionChange(val) {
+            this.selectedData = val.map(item => item.brand_id)
+        },
+        uploadSuccess(res) {
+            this.$set(this.brandForm, 'logo', res.url)
+            this.$refs['brandForm'].validateField('logo')
+        },
+        /** 图片移除之后 */
+        delGiftImg() {
+            this.fileList = []
+            this.brandForm.logo = ''
+        },
+        /** 分页大小发生改变 */
+        handlePageSizeChange(size) {
+            this.params.size = size
+            this.GET_BrandList()
+        },
+
+        /** 分页页数发生改变 */
+        handlePageCurrentChange(page) {
+            this.params.page = page
+            this.GET_BrandList()
+        },
+
+        /** 搜索事件触发 */
+        searchEvent(data) {
+            this.params.page = 1
+            this.params.name = data
+            if (!data) delete this.params.name
+            this.GET_BrandList()
+        },
+
+        /** 获取品牌列表 */
+        GET_BrandList() {
+            this.loading = true
+            API_productClass.getProductList(this.params).then(response => {
+                this.loading = false
+                this.tableData = response
+            }).catch(() => { this.loading = false })
+        },
+        /** 添加品牌触发事件 */
+        handleAddBrand() {
+            this.$router.push({
+                name: "productClassAdd",
+            });
+        },
+        /** 添加、修改品牌 表单提交 */
+        submitBrandForm(formName) {
+           
+        },
+        /** 修改品牌操作 */
+        handleEditBrand(index, row) {
+            this.$router.push({
+                name: "productClassEdit",
+                params: { id:row.id, type:index },
+            });
+           /*  this.brandForm = this.MixinClone(row)
+            this.fileList = this.brandForm.logo ? [{ name: 'brand_image', url: this.brandForm.logo }] : []
+            this.dialogBrandVisible = true */
+        },
+        /** 删除品牌操作 */
+        handleDeleteBrand(index, row) {
+            this.$confirm('确定要删除这个品牌吗?', '提示', { type: 'warning' }).then(() => {
+                this.DELETE_Brand(row.id)
+            }).catch(() => { })
+        },
+        /** 删除商品组合 */
+        DELETE_Brand(ids) {
+            API_productClass.removeProduct(ids).then(() => {
+                this.$message.success('删除成功!')
+                this.GET_BrandList()
+            })
+        }
+    }
+}
+</script>
+
+<style type="text/scss" lang="scss" scoped>
+/deep/ .el-table td:not(.is-left) {
+    text-align: center;
+}
+
+.inner-toolbar {
+    display: flex;
+    width: 100%;
+    justify-content: space-between;
+    padding: 0 20px;
+}
+
+.goods-image {
+    max-width: 120px;
+    height: 75px;
+}
+
+/deep/ .el-select .el-input {
+    width: 100px;
+}
+
+/deep/ .input-with-select .el-input-group__prepend {
+    background-color: #fff;
+}
+
+/deep/ .el-form-item__content .edui-editor {
+    line-height: normal;
+}
+</style>

+ 456 - 0
manager-admin/src/views/basicSetting/productClassAdd.vue

@@ -0,0 +1,456 @@
+<template>
+    <div class="bg-in-stock">
+        <el-form ref="productListAddForm" :model="productListAddForm" :rules="productListAddFormRule"
+            :disabled="isDetail" label-width="160px" inline class="change-form">
+            <div class="mx">
+                <el-form-item label="分类类型" prop="hire_or_sail" class="change-form-item">
+                    <el-select v-model="productListAddForm.hire_or_sail" clearable @change="selhire_or_sail">
+                        <el-option label="售卖商品" value="sail" />
+                        <el-option label="出租商品" value="hire" />
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="分类名称" prop="name" class="change-form-item">
+                    <el-input v-model="productListAddForm.name" placeholder="请输入"></el-input>
+                </el-form-item>
+                <el-form-item label="备注" prop="remark" class="change-form-item" style="width: 61%">
+                    <el-input style="flex: 1" v-model="productListAddForm.remark" type="textarea"
+                        :disabled="type === 'detail' || type === 'audit'" :autosize="{ minRows: 3, maxRows: 4 }"
+                        placeholder="请输入"></el-input>
+                </el-form-item>
+            </div>
+            <div class="mx">
+                <h3>分类商品</h3>
+                <el-button class="button" size="mini" type="primary" :disabled="type === 'check'"
+                    v-if="type !== 'detail' && type !== 'audit'" @click="handleSelectWarehouseEntryBatch">选择</el-button>
+            </div>
+            <div style="width: 100%; display: block">
+                <el-form-item style="width: 100%">
+                    <el-table :data="productListAddForm.item_do_list" border :cell-style="{ textAlign: 'center' }"
+                        :header-cell-style="{ textAlign: 'center' }" style="width: 100%; margin-top: 20px">
+                        <el-table-column label="商品编号">
+                            <template slot-scope="scope">
+                                {{ scope.row.goods_vo.sn }}
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="商品名称">
+                            <template slot-scope="scope">
+                                {{ scope.row.goods_vo.name }}
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="条码">
+                            <template slot-scope="scope">
+                                {{ scope.row.bar_code }}
+                            </template>
+                        </el-table-column>
+                        <!--      <el-table-column label="序列号">
+                            <template slot-scope="scope">
+                                {{ scope.row.sn_code }}
+                            </template>
+                        </el-table-column> -->
+                        <el-table-column prop="spec_name" label="规格型号">
+                        </el-table-column>
+                        <el-table-column label="单位">
+                            <template slot-scope="scope">
+                                {{ scope.row.unit }}
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="操作" v-if="type !== 'detail' && type !== 'audit'">
+                            <template slot-scope="scope">
+                                <el-button size="mini" type="danger" @click="
+                                    productListAddForm.item_do_list.splice(scope.$index, 1)
+                                    ">删除</el-button>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </el-form-item>
+            </div>
+        </el-form>
+        <div class="footer">
+            <el-button v-if="type !== 'audit' && type !== 'detail'" type="primary" :disabled="type === 'check'"
+                @click="saveproductListAddForm">添加
+            </el-button>
+            <el-button @click="$router.back()">返回</el-button>
+        </div>
+
+        <el-dialog title="商品列表" :visible.sync="goodsVisible" width="1000px" @close="closeGoosData">
+            <el-table ref="table" :data="goodsData" border style="width: 100%"
+                @selection-change="handleSelectionChange">
+                <el-table-column type="selection" width="55" />
+                <el-table-column prop="goods_vo.sn" label="商品编号"> </el-table-column>
+                <el-table-column prop="bar_code" label="商品条码"> </el-table-column>
+                <el-table-column prop="sn_code" label="序列号"> </el-table-column>
+                <el-table-column prop="goods_vo.name" label="商品名称"> </el-table-column>
+                <el-table-column prop="spec_name" label="规格型号">
+                </el-table-column>
+                <el-table-column prop="unit" label="单位"> </el-table-column>
+            </el-table>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="closeGoosData">取 消</el-button>
+                <el-button type="primary" @click="submitGoosData()">确 定</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+import { Foundation, RegExp } from "~/ui-utils";
+import * as API_GoodsExchange from "@/api/goodsExchange";
+import * as API_GoodsLend from "@/api/goodsLend"
+import * as API_Setting from "@/api/setting";
+import * as API_BasicSetting from "@/api/basicSetting";
+import * as API_Erp from "@/api/erp";
+import * as API_Auth from "@/api/auth";
+import * as API_productClass from "@/api/productClass.js"
+export default {
+    name: "goodsExchangeAdd",
+    data() {
+        return {
+            typeList: [],
+            adminList: [],
+            dialogVisible: false,
+            warehouseList: [],
+            deptList: [],
+            deptListAll: [],
+            orderList: [],
+            params:{
+                pages: 1,
+                size: 10
+            },
+            id: "",
+            type: "",
+            /** 出库单表单*/
+            productListAddForm: {
+                item_do_list: [],
+                type: "",
+                hire_or_sail:''
+            },
+            /** 校验规则 */
+            productListAddFormRule: {
+                name: [this.MixinRequired("请填写组合名称", "blur")],
+                hire_or_sail: [this.MixinRequired("请选择商品类型", "change")],
+            },
+            warehouseProduct: null,
+            scanDialogVisible: false,
+            scanGoodsForm: {},
+            //出入库
+            sttorageType: "",
+            // 出库商品明细
+            goodsVisible: false,
+            goodsData: [],
+            // 暂存已勾选商品
+            goodsList: [],
+            item_do_list: [],
+            code: "", //当前库位号
+            warehouse_id: "",//当前仓库id
+            activeList: [],//选中的商品
+            isDetail: undefined,
+        };
+    },
+    mounted() {
+        this.id = this.$route.params.id
+        this.type = this.$route.params.type
+        if (this.type === 'check') {
+            this.isDetail = true
+            this.GET_goodsExchangeAddDetail();
+        }
+        this.GET_WarehouseList();
+        this.GET_DeptList();
+        this.outType();
+    },
+    watch: {
+        $route: {
+            immediate: true,
+            handler(newVal) {
+                if (newVal.name === "productClassEdit") {
+                    this.GET_goodsExchangeAddDetail();
+                }
+            },
+        },
+    },
+    computed: {
+        ...mapGetters(["user"]),
+    },
+    methods: {
+        selhire_or_sail(){
+            this.productListAddForm.item_do_list=[]
+        },
+        // 保存已选商品
+        submitGoosData() {
+            if (this.goodsList.length >= 1) {
+                this.productListAddForm.item_do_list = this.goodsList
+                this.goodsVisible = false;
+            } else {
+                this.$message.error("请选择商品信息");
+            }
+        },
+        //选择商品
+        handleSelectionChange(val) {
+            this.goodsList = val
+        },
+        // 关闭商品明细
+        closeGoosData() {
+            this.goodsVisible = false;
+        },
+        //获取出库类型字典
+        outType() {
+            API_Setting.getPage({ dictType: "out_warehouse_type" }).then((res) => {
+                this.typeList = res.data.filter((el) => {
+                    if (el.value !== "SALE_OUT" && el.value !== "HAIL_OUT") {
+                        return el;
+                    }
+                });
+            });
+        },
+        // 打印功能
+        printIng() { },
+        toSearch() {
+            API_GoodsExchange.getGoodsInfo({
+                barcode: this.scanGoodsForm.bar_code,
+            }).then((res) => { });
+        },
+        // 扫码入库
+        scanCode() {
+            this.scanDialogVisible = true;
+            this.$nextTick(() => {
+                this.$refs.input.focus();
+            });
+        },
+        /** 获取人员列表 */
+        GET_AdministratorList() {
+            API_Auth.getAdministratorList({
+                page_no: 1,
+                page_size: 9999,
+                user_state: 0,
+            }).then((response) => {
+                this.adminList = response.data;
+            });
+        },
+        /** 获取仓库 */
+        GET_WarehouseList(e) {
+            API_BasicSetting.getWarehouseListAll().then((response) => {
+                this.warehouseList = response;
+            });
+        },
+        //保存
+        saveproductListAddForm() {
+            this.$refs["productListAddForm"].validate((valid) => {
+                if (valid) {
+                    const { id } = this.productListAddForm;
+                    const params = this.MixinClone(this.productListAddForm);
+                    const query = []
+                    if (!this.productListAddForm.item_do_list.length) {
+                        this.$message.error("请选择商品!");
+                        return;
+                    }
+                    params.item_do_list.map(el => {
+                            el.product_id = el.id
+                            el.id = ''
+                        })
+                    if (id) {
+                       /*  params.item_do_list.map(el => {
+                            el.id = ''
+                        }) */
+                        API_productClass.editProduct(id, params).then(() => {
+                            this.$message.success("修改成功!");
+                            const { callback } = this.$route.params;
+                            if (typeof callback === "function") callback();
+                            this.$store.dispatch("delCurrentViews", {
+                                view: this.$route,
+                                $router: this.$router,
+                            });
+                            this.$router.push({ name: "productClass" });
+                        });
+                    } else {
+                        API_productClass.productGroup(params).then(() => {
+                            this.$message.success("添加成功!");
+                            const { callback } = this.$route.params;
+                            if (typeof callback === "function") callback();
+                            this.$store.dispatch("delCurrentViews", {
+                                view: this.$route,
+                                $router: this.$router,
+                            });
+                            this.$router.push({ name: "productClass" });
+                        });
+                    }
+
+                }
+            });
+        },
+        reverseSelect(rows) {
+            this.$refs.table.toggleRowSelection(rows);
+        },
+        // 商品列表
+        async handleSelectWarehouseEntryBatch() {
+            if (this.productListAddForm.hire_or_sail !== '') {
+                this.params.hire_or_sail=this.productListAddForm.hire_or_sail
+                API_productClass.getProduct(this.params).then((res) => {
+                    this.goodsData = res.data;
+                    this.goodsVisible = true;
+                    console.log(res);
+                    /* API_GoodsLend.getInfo({ id: this.id }).then(response => {
+                        this.activeList = response.area_stock_vo
+                        res.records.map(item => {
+                            response.area_stock_vo.map(el => {
+                                if (item.id === el.product_stock_id) {
+                                    this.reverseSelect(item)
+                                }
+                            })
+                        })
+                    }) */
+                });
+            }else{
+                this.$message.error("请先选择商品分类类型")
+            }
+
+        },
+        /** 选择订单编号 */
+        async handleSelectOrderSn() {
+            const orders = await this.$EnPickerOrder({
+                orderApi: "admin/erp/order",
+                selectedIds: [this.productListAddForm.order_sn],
+                limit: 1,
+            });
+            this.$set(
+                this.productListAddForm,
+                "distribution_name",
+                orders[0].distribution_name
+            );
+            const orderIds = orders.map((v) => v.sn);
+            this.$set(this.productListAddForm, "order_sn", orderIds.join(","));
+            this.GET_WarehouseOutProduct();
+        },
+        /** 获取出库单商品明细 */
+        async GET_WarehouseOutProduct() {
+            const res = await API_Erp.getWarehouseOutProduct({
+                order_sn: this.productListAddForm.order_sn,
+            });
+            this.productListAddForm.return_list = res.data.map((item) => {
+                item.amount = item.product_price;
+                item.product_sn = item.product_sn;
+                item.product_name = item.product_name;
+                item.specification = item.product_specification;
+                item.product_id = item.product_id;
+                item.unit = item.product_unit;
+                item.out_num = item.return_num;
+                item.stock_sn = item.warehouse_entry_sn;
+                item.cost_price = item.product_cost_price;
+                return item;
+            });
+        },
+        /** 获取仓库 */
+        GET_DeptList() {
+            API_GoodsExchange.getInfo().then((response) => {
+                this.deptListAll = response;
+                this.deptListAll.password = "";
+            });
+        },
+        /** 切换仓库 */
+        handleChangeWareHouse(val) {
+            //this.productListAddForm.item_do_list = []change_list
+        },
+        /** 获取详情页面数据 */
+        GET_goodsExchangeAddDetail() {
+            this.$nextTick(() => {
+                API_productClass.getById(this.id).then(res => {
+                    res.item_do_list.map(el => {
+                        el.bar_code = el.product_vo.bar_code
+                        el.spec_name = el.product_vo.spec_name
+                        el.unit = el.product_vo.unit
+                    })
+                    this.productListAddForm = res
+                })
+            });
+        },
+    },
+};
+</script>
+
+<style type="text/scss" lang="scss" scoped>
+/** 底部步骤 */
+.footer {
+    width: 100%;
+    padding: 10px;
+    bottom: 0px;
+    text-align: center;
+    z-index: 999;
+}
+
+.mx {
+    display: flex;
+    align-items: center;
+    width: 100%;
+
+    .button {
+        margin-left: 10px;
+    }
+}
+
+.change-form {
+    display: flex;
+    justify-content: flex-start;
+    align-items: flex-start;
+    flex-wrap: wrap;
+    min-width: 900px;
+
+    .change-form-item {
+        width: 30%;
+        margin: 0 10px 20px 0;
+        display: flex;
+        flex-direction: row;
+        flex-wrap: nowrap;
+    }
+
+    /deep/ {
+        .el-form-item__content {
+            flex: 1;
+            width: 100%;
+        }
+
+        .el-date-editor,
+        .el-cascader,
+        .el-select {
+            width: 100%;
+        }
+    }
+}
+
+.bg-in-stock {
+    background-color: #fff;
+    margin: 10px;
+    padding: 25px;
+}
+
+.goods-info {
+    display: flex;
+
+    .goods-name-box {
+        text-align: left;
+
+        .goods-name {
+            text-overflow: ellipsis;
+            display: -webkit-box;
+            -webkit-line-clamp: 2;
+            -webkit-box-orient: vertical;
+            overflow: hidden;
+            line-height: 16px;
+        }
+
+        .specs {
+            color: #999999;
+        }
+    }
+}
+
+/deep/ {
+    .el-input--suffix .el-input__inner {
+        padding-right: 10px;
+    }
+
+    .error-input {
+        .el-input__inner {
+            border: 1px solid red;
+        }
+    }
+}
+</style>

+ 95 - 44
manager-admin/src/views/dashboard/index.vue

@@ -8,12 +8,12 @@
             <span>快捷起草</span>
           </div>
           <div class="menus">
-            <div class="ments-item" v-for="(item,index) in menuList" :key="index" >
+            <div class="ments-item" v-for="(item, index) in menuList" :key="index">
               <div @click="goList(item)" style="display: flex;flex-direction: column;align-items: center;">
-                  <div>
-                    <img :src="item.icon">
-                  </div>
-                  <div>{{generateTitle(item.identifier)}}</div>
+                <div>
+                  <img :src="item.icon">
+                </div>
+                <div>{{ generateTitle(item.identifier) }}</div>
               </div>
             </div>
             <!-- <div class="ments-item" v-if="checkIsauth('purchase-contract-add') && checkIsauth('purchase-contract')"v-if="checkIsauth('purchase-plan-add') && checkIsauth('purchase-plan')">
@@ -129,7 +129,7 @@
       <el-col :span="16" v-if="checkPermission(['order'])">
         <el-card style="height: 350px;" shadow="never">
           <div slot="header" class="clearfix">
-            <span>待出库订单列表</span>
+            <span>待发货订单列表</span>
             <router-link to="/sales/order">
               <el-button style="float: right; padding: 3px 0" type="text">查看更多</el-button>
             </router-link>
@@ -139,6 +139,7 @@
               <el-table-column prop="sn" label="订单编号">
               </el-table-column>
               <el-table-column prop="warehouse_name" label="仓库名称">
+                <template slot-scope="scope">{{ warehouseName(scope.row.warehouse_id) }}</template>
               </el-table-column>
               <el-table-column prop="create_time" label="下单时间">
                 <template slot-scope="scope">{{ scope.row.create_time | unixToDate }}</template>
@@ -149,21 +150,28 @@
       </el-col>
       <el-col :span="8" v-if="checkIsauth('goods-understock')">
         <el-card class="box-card" style="height:350px;" shadow="never">
-          <div slot="header" class="clearfix">
+          <div slot="header" class="clearfix" style="    display: flex;justify-content: space-between;align-items: center;">
             <span>库存预警</span>
-            <router-link to="/stock/goods-understock">
+            <!--  <router-link to="/stock/goods-understock">
               <el-button style="float: right; padding: 3px 0" type="text">查看更多</el-button>
-            </router-link>
+            </router-link> -->
+            <el-select @change="cleanGoodsList" v-model="warehouse_id"  clearable style="width: 100px;">
+              <el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id" />
+            </el-select>
           </div>
           <div class="yu-statistics">
-            <el-table :data="tableData" height="280"  :loading="loading" :header-cell-style="{ textAlign: 'center' }">
+            <el-table :data="tableData" height="280" :loading="loading" :header-cell-style="{ textAlign: 'center' }">
               <el-table-column prop="sn" label="商品编号">
+                <template slot-scope="scope">{{ scope.row.goods_vo.sn }}</template>
               </el-table-column>
               <el-table-column prop="name" label="商品名称">
+                <template slot-scope="scope">{{ scope.row.goods_vo.name }}</template>
               </el-table-column>
               <el-table-column prop="stock_num" label="库存数量">
+                <template slot-scope="scope">{{ scope.row.usable_stock }}</template>
               </el-table-column>
-              <el-table-column prop="warehouse_id" label="库位号">
+              <el-table-column prop="warehouse_id" label="仓库名称">
+                <template slot-scope="scope">{{ wareName(scope.row.warehouse_id) }}</template>
               </el-table-column>
             </el-table>
           </div>
@@ -188,12 +196,13 @@
         </el-card>
       </el-col>
     </el-row>
-    <el-row :gutter="12" style="margin-top: 20px;padding-bottom:40px" v-if="checkIsauth('goods-lend-add') && checkIsauth('goods-lend')">
+    <el-row :gutter="12" style="margin-top: 20px;padding-bottom:40px"
+      v-if="checkIsauth('goods-lend-add') && checkIsauth('goods-lend')">
       <el-col :span="16">
         <el-card class="box-card" style="height:350px;" shadow="never">
           <div slot="header" class="clearfix">
             <span>待入库订单</span>
-            <router-link to="/stock/goods-lend?status=CONFIRMED">
+            <router-link to="/sales/order">
               <el-button style="float: right; padding: 3px 0" type="text">查看更多</el-button>
             </router-link>
           </div>
@@ -222,6 +231,8 @@ import * as API_order from '@/api/order'
 import { generateTitle } from '@/utils/i18n'
 import * as API_GoodsLend from '@/api/goodsLend'
 import * as API_Menus from '@/api/menus'
+import * as API_BasicSetting from "@/api/basicSetting";
+import * as API_GoodsTransfer from "@/api/goodsTransfer";
 import store from '@/store'
 export default {
   name: 'dashboard_images',
@@ -251,8 +262,10 @@ export default {
       revenueChart: {
 
       },
-      menuList:[],
-      routerLIst:[]
+      menuList: [],
+      routerLIst: [],
+      warehouseList:[],
+      warehouse_id:''
     }
   },
   filters: {
@@ -268,16 +281,16 @@ export default {
     window.onresize = this.countTableHeight
   },
   mounted() {
-    this.permission_routers.map(el=>{
-        if(el.name!==undefined && el.name!=="dashboard" && this.menuList){
-            this.routerLIst.push(el)
-        }
-     })
+    this.permission_routers.map(el => {
+      if (el.name !== undefined && el.name !== "dashboard" && this.menuList) {
+        this.routerLIst.push(el)
+      }
+    })
     if (this.permission_routers.some(v => v.name === 'stock')) {
-      this.stockList = this.permission_routers.find(function(sc) { return sc.name === 'stock' })
+      this.stockList = this.permission_routers.find(function (sc) { return sc.name === 'stock' })
     }
     if (this.permission_routers.some(v => v.name === 'purchase')) {
-      this.purchaseList = this.permission_routers.find(function(sc) { return sc.name === 'purchase' })
+      this.purchaseList = this.permission_routers.find(function (sc) { return sc.name === 'purchase' })
 
     }
     this.listAll = []
@@ -288,17 +301,43 @@ export default {
     } else if (this.stockList.children) {
       this.listAll = this.stockList.children
     }
-    this.GET_WarningGoodsList()
+    this.GET_WarehouseList()
     this.GET_OrderList()
     this.GET_GoodsLendList()
     this.GET_menus()
+   
   },
   methods: {
+    warehouseName(val) {
+      let name = [];
+      this.warehouseList.map((el) => {
+        val.map((e) => {
+          if (el.id == e) {
+            return name.push(el.name)
+          }
+        });
+      });
+      return name.join('/')
+    },
+    wareName(val) {
+      let name = ''
+      this.warehouseList.map((el) => {
+          if (el.id == val) {
+            return name=el.name
+          }
+      });
+      return name
+    },
+    /* 切换仓库 */
+    cleanGoodsList(val){
+      this.warehouse_id=val
+      this.GET_WarningGoodsList()
+    },
     generateTitle,
     /** 获取调整单列表 */
     GET_GoodsLendList() {
       this.loading = true
-      API_GoodsLend.warehouseEntry(this.params).then(response => {
+      API_GoodsLend.warehouseEntry(this.warehouse_id).then(response => {
         this.loading = false
         this.goodsLendListWaitReturnData = response
       })
@@ -307,17 +346,17 @@ export default {
       API_order.getOrderList({
         page_no: 1,
         page_size: 9,
-        status: 'WAIT_WAREHOUSE_OUT'
+        status: 'TO_BE_SEND'
       }).then(response => {
         this.OrderList = response
       })
     },
     checkIsauth(e) {
-      return this.listAll.some(function(v) { return v.path === e })
+      return this.listAll.some(function (v) { return v.path === e })
     },
     GET_WarningGoodsList() {
-      API_goods.getWarningGoodsList(this.params).then(response => {
-        this.tableData = response.data
+      API_GoodsTransfer.getWarnStock(this.warehouse_id).then(response => {
+        this.tableData = response
       })
     },
     /** 窗口缩放时计算table高度 */
@@ -327,30 +366,37 @@ export default {
       setTimeout(this.sesalChart.resize)
     },
     /**获取菜单列表*/
-    GET_menus(){
+    GET_menus() {
       API_Menus.getMenusChildren(0).then(response => {
-        response.map(el=>{
-          el.children.map(e=>{
-            if(e.show_home==1){
+        response.map(el => {
+          el.children.map(e => {
+            if (e.show_home == 1) {
               this.menuList.push(e)
             }
           })
         })
       })
-      API_Menus.getMenuList(this.params).then(res=>{
+      API_Menus.getMenuList(this.params).then(res => {
         console.log(res);
       })
     },
     // 前往目标页面identifier
-    goList(item){
-      this.routerLIst.map(el=>{
-        el.children.map(e=>{
-           if(e.name==item.identifier){
+    goList(item) {
+      this.routerLIst.map(el => {
+        el.children.map(e => {
+          if (e.name == item.identifier) {
             console.log(el);
             this.$router.push(`${el.name}/${e.path}`)
           }
         })
       })
+    },
+    GET_WarehouseList() {
+      API_BasicSetting.getWarehouseListAll().then((response) => {
+        this.warehouse_id=response[0].id
+        this.warehouseList = response;
+        this.GET_WarningGoodsList()
+      });
     }
   }
 }
@@ -373,7 +419,8 @@ export default {
     text-overflow: ellipsis; //溢出用省略号显示
     white-space: nowrap; // 默认不换行;
   }
-  .lis{
+
+  .lis {
     display: flex;
     justify-content: space-around;
   }
@@ -472,9 +519,11 @@ export default {
       }
     }
   }
+
   /deep/ .el-card .el-card__header {
-  border-bottom: none !important; /* 去除底部边框 */
-}
+    border-bottom: none !important;
+    /* 去除底部边框 */
+  }
 
   /deep/ .el-card__body {
     padding: 10px;
@@ -498,10 +547,12 @@ export default {
       }
     }
   }
-  .yu-statistics /deep/.el-table__row>td{
-  /* 去除表格线 */
-  border: none;
-}
+
+  .yu-statistics /deep/.el-table__row>td {
+    /* 去除表格线 */
+    border: none;
+  }
+
   .goods-image {
     width: 50px;
     height: 50px;

+ 91 - 65
manager-admin/src/views/stock/goodsTransfer.vue

@@ -6,33 +6,20 @@
           <el-col :span="12">
             <el-form-item label="仓库">
               <el-select v-model="advancedForm.out_warehouse_id">
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.id"
-                />
+                <el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="商品编号/条码/序列号">
-              <el-input
-                v-model="advancedForm.input"
-                placeholder="请输入内容"
-                width="200px"
-              ></el-input>
+              <el-input v-model="advancedForm.input" placeholder="请输入内容" width="200px"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
       <el-button @click="advancedSearchEvent"> 搜索 </el-button>
     </div>
-    <en-table-layout
-      :tableData="tableData.data"
-      :loading="loading"
-      @selection-change="handleSelectionChange"
-    >
+    <en-table-layout :tableData="tableData.data" :loading="loading" @selection-change="handleSelectionChange">
       <div slot="toolbar" class="inner-toolbar">
         <div class="toolbar-btns">
           <!-- <el-button
@@ -50,12 +37,8 @@
             :disabled="multipleSelection.length === 0"
             >删除</el-button
           > -->
-          <el-button size="mini" type="primary" @click="lookTransit"
-            >查看在途</el-button
-          >
-          <el-button size="mini" type="primary" @click="checkExport"
-            >导出</el-button
-          >
+          <el-button size="mini" type="primary" @click="lookTransit">查看在途</el-button>
+          <el-button size="mini" type="primary" @click="checkExport">导出</el-button>
         </div>
       </div>
 
@@ -76,21 +59,22 @@
             <span v-else>{{ scope.row.sn }}</span>
           </template> -->
         </el-table-column>
-        <el-table-column label="商品编号" prop="goods_sn">
+        <el-table-column label="商品编号" prop="sn">
           <!-- <template slot-scope="scope">{{
             scope.row.transfer_time | unixToDate
           }}</template> -->
         </el-table-column>
-        <el-table-column prop="area_name" label="库位号" />
-        <el-table-column prop="goods_bar_code" label="商品条码" />
-        <el-table-column prop="goods_sn_code" label="序列号" />
+
         <el-table-column prop="goods_name" label="商品名称" />
         <!-- <el-table-column prop="type" label="调拨类型">
+            <el-table-column prop="area_name" label="库位号" />
+        <el-table-column prop="goods_bar_code" label="商品条码" />
+        <el-table-column prop="goods_sn_code" label="序列号" />
           <template slot-scope="scope">{{ typeFilter(scope.row.type) }}</template>
-        </el-table-column> -->
-        <el-table-column prop="goods_style" label="规格型号" />
+        </el-table-column> 
+        <el-table-column prop="goods_style" label="规格型号" />-->
         <el-table-column prop="goods_unit" label="单位" />
-      <!--   <el-table-column prop="warehouse_area.status" label="状态">
+        <!--   <el-table-column prop="warehouse_area.status" label="状态">
           <template slot-scope="scope">{{
             statusFilter(scope.row.status)
           }}</template>
@@ -99,48 +83,37 @@
         <el-table-column prop="usable_stock" label="可用库存" />
         <el-table-column prop="transit_stock" label="在途库存" />
         <el-table-column prop="warning_stock" label="预警库存" />
-          <!--<el-table-column label="操作" width="250">
+        <el-table-column label="操作" width="250">
           <template slot-scope="scope">
-           <el-button type="success1" size="mini"
+            <el-button type="success1" size="mini" v-if="checkPermission(['goodsTransfer:submit'])"
+              @click="handleSubmitGoodsTransfer(scope.row)">设置预警库存</el-button>
+            <!-- <el-button type="success1" size="mini"
               v-if="scope.row.allowable.submit && checkPermission(['goodsTransfer:submit'])"
               @click="handleSubmitGoodsTransfer(scope.row)">提交</el-button>
             <el-button type="danger" size="mini"
               v-else-if="scope.row.allowable.withdraw && checkPermission(['goodsTransfer:withdraw'])"
-              @click="handleWithdrawGoodsTransfer(scope.row)">撤回</el-button> -->
+              @click="handleWithdrawGoodsTransfer(scope.row)">撤回</el-button> 
             <el-button size="mini" @click="handleEditGoodsTransfer(scope.row)"
               >查看</el-button
             >
-            <!-- <el-button size="mini" @click="handleDelGoodsTransfer(scope.row)"
+            <el-button size="mini" @click="handleDelGoodsTransfer(scope.row)"
               >删除</el-button
-            > -->
-            <!-- <el-button size="mini" v-if="scope.row.allowable.confirm && checkPermission(['goodsTransfer:confirm'])"
+            >
+            <el-button size="mini" v-if="scope.row.allowable.confirm && checkPermission(['goodsTransfer:confirm'])"
               @click="handleSuccessGoodsTransfer(scope.row)" type="success">确认</el-button>
             <el-button size="mini" v-if="scope.row.allowable.confirm && checkPermission(['goodsTransfer:return'])"
-              @click="handleRejectGoodsTransfer(scope.row)" type="danger">退回</el-button>
+              @click="handleRejectGoodsTransfer(scope.row)" type="danger">退回</el-button> -->
           </template>
-        </el-table-column>1 -->
+        </el-table-column>
       </template>
 
-      <el-pagination
-        v-if="tableData"
-        slot="pagination"
-        @size-change="handlePageSizeChange"
-        @current-change="handlePageCurrentChange"
-        :current-page="tableData.page_no"
-        :page-sizes="[10, 20, 50, 100]"
-        :page-size="tableData.page_size"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="tableData.data_total"
-      >
+      <el-pagination v-if="tableData" slot="pagination" @size-change="handlePageSizeChange"
+        @current-change="handlePageCurrentChange" :current-page="tableData.page_no" :page-sizes="[10, 20, 50, 100]"
+        :page-size="tableData.page_size" layout="total, sizes, prev, pager, next, jumper" :total="tableData.data_total">
       </el-pagination>
     </en-table-layout>
-    <el-dialog
-      title="在途明细"
-      :visible.sync="dialogVisible"
-      append-to-body
-      :close-on-click-modal="false"
-      :close-on-press-escape="false"
-    >
+    <el-dialog title="在途明细" :visible.sync="dialogVisible" append-to-body :close-on-click-modal="false"
+      :close-on-press-escape="false">
       <el-table :data="transitDetails" border class="sku-table">
         <el-table-column prop="goods_sn" label="商品编号" />
         <el-table-column prop="transit_stock" label="在途数量" />
@@ -151,6 +124,19 @@
             <el-button type="primary" >确 定</el-button>
           </span> -->
     </el-dialog>
+    <el-dialog title="设置预警数量" :visible.sync="numDialogVisible" append-to-body :close-on-click-modal="false"
+      :close-on-press-escape="false" width="30%">
+      <el-form ref="numAddForm" :model="numAddForm" :rules="numAddFormRule" label-width="160px" inline
+        class="change-form">
+        <el-form-item label="分类名称" prop="num" class="change-form-item">
+          <el-input v-model="numAddForm.num" placeholder="请输入"></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="numDialogVisible = false">取 消</el-button>
+        <el-button @click="submitNum" type="primary">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -182,6 +168,27 @@ export default {
       dialogVisible: false,
       // 在途明细
       transitDetails: [],
+      numDialogVisible: false,
+      numAddForm: {},
+      stockId: '',//选择的id
+      numAddFormRule: {
+        num: [{
+          required: true,
+          message: '请输入预警库存数量',
+          trigger: 'blur'
+        },
+        {
+            validator: (rule, value, callback) => {
+              if (/^(?:[1-9]\d*)$/.test(value) == false) {
+                callback(new Error("请输入正整数"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur",
+          },
+        ],
+      }
     };
   },
   mounted() {
@@ -199,6 +206,20 @@ export default {
     ...mapGetters(["user"]),
   },
   methods: {
+    /* 提交预警数量 */
+    submitNum() {
+      console.log(this.$refs["numAddForm"]);
+      this.$refs["numAddForm"].validate((valid) => {
+        if (valid) {
+          API_GoodsTransfer.updateWarnStock(this.stockId, this.numAddForm.num).then(res => {
+            this.numDialogVisible = false
+            this.numAddForm = {}
+            this.$message.success('预警库存设置成功!')
+            this.GET_GoodsTransferList();
+          })
+        }
+      })
+    },
     // 删除
     handleDelGoodsTransfer(row) {
       this.$confirm("确定要删除这些库存吗?", "提示", { type: "warning" })
@@ -207,21 +228,21 @@ export default {
           ids.push(row.id)
           API_GoodsTransfer.deleteGoodsTransfer({ ids: ids }).then((res) => {
             this.$message.success("删除成功!");
-            this.ids=[]
+            this.ids = []
             this.GET_GoodsTransferList();
           });
         })
-        .catch(() => {});
+        .catch(() => { });
     },
     // 导出
-    checkExport() {},
+    checkExport() { },
     // 查看在途
     lookTransit() {
       if (!this.multipleSelection || !this.multipleSelection.length) return this.$message.error('请先选择!')
-      this.params.warehouse_id=this.multipleSelection.map(el=>{ return el.id})
-      API_GoodsTransfer.productStock(this.params).then(res=>{
+      this.params.warehouse_id = this.multipleSelection.map(el => { return el.id })
+      API_GoodsTransfer.productStock(this.params).then(res => {
         this.dialogVisible = true;
-        this.transitDetails=res.data
+        this.transitDetails = res.data
       })
     },
     handleSuccessGoodsTransfer(row) {
@@ -257,10 +278,12 @@ export default {
       });
     },
     handleSubmitGoodsTransfer(row) {
-      API_GoodsTransfer.submitGoodsTransfer(row.id).then(() => {
+      this.stockId = row.id
+      this.numDialogVisible = true
+      /* API_GoodsTransfer.submitGoodsTransfer(row.id).then(() => {
         this.$message.success("提交成功!");
         this.GET_GoodsTransferList();
-      });
+      }); */
     },
     handleWithdrawGoodsTransfer(row) {
       API_GoodsTransfer.withdrawGoodsTransfer(row.id).then(() => {
@@ -289,12 +312,12 @@ export default {
       this.$confirm("确定要删除这些库存吗?", "提示", { type: "warning" })
         .then(() => {
           const ids = this.multipleSelection.map((item) => item.id);
-          API_GoodsTransfer.deleteGoodsTransfer({ids:ids}).then(() => {
+          API_GoodsTransfer.deleteGoodsTransfer({ ids: ids }).then(() => {
             this.$message.success("删除成功!");
             this.GET_GoodsTransferList();
           });
         })
-        .catch(() => {});
+        .catch(() => { });
     },
     /** 多选改变 */
     handleSelectionChange(val) {
@@ -379,6 +402,7 @@ export default {
   background: #fff;
   overflow: hidden;
   padding: 30px 10px 10px 10px;
+
   /deep/ .el-form-item {
     .el-form-item__content {
       .el-input {
@@ -386,11 +410,13 @@ export default {
       }
     }
   }
+
   .el-button {
     margin-top: -19px;
     margin-left: 20px;
   }
 }
+
 .tips-t {
   display: flex;
   padding: 10px 0;

+ 2 - 2
manager-admin/src/views/stock/order.vue

@@ -459,11 +459,11 @@ export default {
         params: { id: order.id, callback: this.GET_OrderList },
       });
     },
-    /** 审核订单 */
+    /** 查看订单 */
     handleAudit(order) {
       this.$router.push({
         name: "orderDetail",
-        params: { id: order.id, callback: this.GET_OrderList },
+        params: { id: order.id, callback: this.GET_OrderList,type:'check' },
       });
     },
     /** 订单设为已支付 */

+ 225 - 124
manager-admin/src/views/stock/orderAdd.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="bg-in-stock" ref="printId">
     <!--  <h2 v-if="barcodeValue">订单编号</h2> -->
-    <div class="numOrder" v-if="barcodeValue &&type !=='pone'">
+    <div class="numOrder" v-if="(barcodeValue && type !== 'pone') && orderType == 'check'">
       <barcode :value="barcodeValue"></barcode>
     </div>
     <el-form ref="orderFormRef" :rules="rules" :model="OrderForm" label-width="120px" inline :disabled="isDetail">
@@ -9,59 +9,29 @@
       <el-row>
         <el-col :span="10">
           <el-form-item label="订单类型" prop="type" :rules="rules.type">
-            <!-- @change="cleanGoodsList" -->
-            <el-select v-model="OrderForm.type" clearable :disabled="type=='pone'">
+            <el-select v-model="OrderForm.type" clearable :disabled="type == 'pone'">
               <el-option v-for="(item, index) in orderTypeList" :key="index" :label="item.label" :value="item.value" />
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="起始时间" prop="time" :rules="rules.start_time" v-if="OrderForm.type == 'TO_C'" >
-            <el-date-picker v-model="OrderForm.start_time" type="datetime" placeholder="选择日期时间" :disabled="type=='pone'"
-              :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss">
-            </el-date-picker>
-            <!--  
-            <el-date-picker
-              v-model="time"
-              type="daterange"
-              align="center"
-              :editable="false"
-              unlink-panels
-              :clearable="false"
-              :default-time="['00:00:00', '23:59:59']"
-              range-separator="-"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              value-format="yyyy-MM-dd hh:mm:ss"
-              :picker-options="{
-                disabledDate(time) {
-                  return (
-                    time.getTime() <=
-                    new Date(
-                      new Date().getFullYear(),
-                      new Date().getMonth(),
-                      new Date().getDate()
-                    ).getTime() -
-                      86400000
-                  );
-                },
-                shortcuts: MixinPickerShortcuts,
-              }"
-            >
-            </el-date-picker>-->
+          <el-form-item label="下单客户" prop="member_id" :rules="rules.member_id">
+            <el-select v-model="OrderForm.member_id" clearable :disabled="type == 'pone'">
+              <el-option v-for="item in customerList" :key="item.id" :label="item.name" :value="item.id" />
+            </el-select>
+            <el-button type="primary" v-if="type !== 'pone'" @click="addCust">新增客户</el-button>
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="下单客户" prop="member_id" :rules="rules.member_id" >
-            <el-select v-model="OrderForm.member_id" clearable :disabled="type=='pone'">
-              <el-option v-for="item in customerList" :key="item.id" :label="item.name" :value="item.id" />
-            </el-select>
-            <el-button type="primary" v-if="type!=='pone'" @click="addCust">新增客户</el-button>
+          <el-form-item label="起始时间" prop="time" :rules="rules.start_time" v-if="OrderForm.type == 'TO_C'">
+            <el-date-picker v-model="OrderForm.start_time" type="datetime" placeholder="选择日期时间"
+              :disabled="type == 'pone'" :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss">
+            </el-date-picker>
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="付款方式" prop="pay_type" :rules="rules.pay_type" >
-            <el-select v-model="OrderForm.pay_type" clearable :disabled="type=='pone'">
+          <el-form-item label="付款方式" prop="pay_type" :rules="rules.pay_type">
+            <el-select v-model="OrderForm.pay_type" clearable :disabled="type == 'pone'">
               <el-option v-for="item in collectingAccountList" :key="item.id" :label="item.name" :value="item.id" />
             </el-select>
           </el-form-item>
@@ -72,68 +42,68 @@
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="实付金额:" prop="pay_price" :rules="rules.pay_price">
-            <!-- @input="validateNumber" -->
-            <span>折扣:<el-input placeholder="请输入" v-model="discount" @blur="handleBlur" style="width: 70px" :disabled="type=='pone'"></el-input>
+          <el-form-item label="折扣:" prop="">
+            <el-input placeholder="请输入" v-model="discount" @blur="handleBlur" :disabled="type == 'pone'"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="10">
+          <el-form-item label="实付金额:" prop="real_price" :rules="rules.pay_price">
+            <!-- @input="validateNumber" 
+            <span>折扣:
             </span>
-            <span>折后金额:</span>
-            <el-input v-model="OrderForm.real_price" placeholder="请输入" :disabled="type=='pone'"></el-input>
+            <span>折后金额:</span>-->
+            <el-input v-model="OrderForm.real_price" placeholder="请输入" :disabled="type == 'pone'"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="销售人员" :rules="rules.marketing_id">
-            <el-select v-model="OrderForm.marketing_id" clearable :disabled="type=='pone'">
+          <el-form-item label="销售人员" prop="marketing_id" :rules="rules.marketing_id">
+            <el-select v-model="OrderForm.marketing_id" clearable :disabled="type == 'pone'">
               <el-option v-for="item in marketingList" :key="item.id" :label="item.real_name" :value="item.id" />
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="配送方式" prop="send_type" :rules="rules.send_type" >
-            <el-select v-model="OrderForm.send_type" clearable :disabled="type=='pone'">
+          <el-form-item label="配送方式" prop="send_type" :rules="rules.send_type">
+            <el-select v-model="OrderForm.send_type" clearable :disabled="type == 'pone'">
               <el-option v-for="item in deliveryTypeList" :key="item.code" :label="item.name" :value="item.code" />
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="配送仓库" prop="warehouse_id" :rules="rules.warehouse_id" >
+          <el-form-item label="配送仓库" prop="warehouse_id" :rules="rules.warehouse_id">
             <!-- <el-cascader v-model="OrderForm.dept_id" :options="deptList" :props="{
             label: 'name',
             value: 'id',
             emitPath: false,
             checkStrictly: true
           }" clearable></el-cascader> -->
-            <el-select @change="cleanGoodsList" v-model="OrderForm.warehouse_id" multiple clearable :disabled="type=='pone'">
+            <el-select @change="cleanGoodsList" v-model="OrderForm.warehouse_id" multiple clearable
+              :disabled="type == 'pone'">
               <el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id" />
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="10">
           <el-form-item label="配送地址" prop="province_city_area_address">
-            <!--  <el-select v-model="OrderForm.addres">
-              <el-option
-                v-for="item in marketingList"
-                :key="item.id"
-                :label="item.real_name"
-                :value="item.id"
-              />
-            </el-select> -->
-            <el-cascader size="large" :options="options" clearable v-model="selectedOptions" @change="handleChange" :disabled="type=='pone'">
+            <el-cascader size="large" :options="options" clearable v-model="selectedOptions" @change="handleChange"
+              :disabled="type == 'pone'">
             </el-cascader>
-            <el-input v-model="OrderForm.address" placeholder="请输入" :disabled="type=='pone'"></el-input>
+            <el-input v-model="OrderForm.address" placeholder="请输入" :disabled="type == 'pone'"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="10">
           <el-form-item label="允许负库存">
-            <el-radio-group v-model="OrderForm.subtract_stock" :disabled="type=='pone'">
+            <el-radio-group v-model="OrderForm.subtract_stock" :disabled="type == 'pone'">
               <el-radio :label="false">禁止</el-radio>
               <el-radio :label="true">允许</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-col>
-        <el-col :span="10">
+        <el-col :span="24">
           <div class="redClass">
-            <el-form-item label="备注" prop="remark" >
-              <el-input v-model="OrderForm.remark" type="textarea" :autosize="{ minRows: 2 }" :disabled="type=='pone'"></el-input>
+            <el-form-item label="备注" prop="remark">
+              <el-input v-model="OrderForm.remark" type="textarea" :autosize="{ minRows: 2 }"
+                :disabled="type == 'pone'"></el-input>
             </el-form-item>
           </div>
         </el-col>
@@ -142,6 +112,7 @@
         <h3>商品明细</h3>
         <div v-if="!isDetail">
           <el-button class="button" size="mini" type="primary" @click="handleSelectGoods">手动选择</el-button>
+          <el-button class="button" size="mini" type="primary" @click="handleSelectGrou">选择分组商品</el-button>
         </div>
       </div>
       <div style="display: block">
@@ -150,7 +121,8 @@
           <el-table-column type="selection" width="40" align="center" />
           <el-table-column label="图标">
             <template slot-scope="scope">
-             <img :src="scope.row.goods_vo.image_small_list[0].original" alt="" width="50px">
+              <img :src="scope.row.goods_vo.image_small_list[0].original" alt="" width="50px"
+                v-if="scope.row.goods_vo.image_small_list.length !== 0">
             </template>
           </el-table-column>
           <el-table-column label="仓库名称">
@@ -267,7 +239,7 @@
             <span v-else>{{ scope.row.remark }}</span>
           </template>
         </el-table-column> -->
-          <el-table-column label="操作" v-if="!isDetail&& type!=='pone'">
+          <el-table-column label="操作" v-if="!isDetail && type !== 'pone'">
             <template slot-scope="scope">
               <el-button size="mini" type="danger" @click="OrderForm.product_list.splice(scope.$index, 1)">删除
               </el-button>
@@ -320,9 +292,12 @@
       </el-table>
     </div> -->
       <div class="footer">
-        <el-button type="primary" @click="submit" v-if="!isDetail&&type=='pone'" :loading="formLoading">确认</el-button>
-        <el-button type="primary" @click="submitOrderForm" v-if="!isDetail&&type!=='pone'" :loading="formLoading">保存</el-button>
-        <el-button type="primary" @click="saveSubmitOrderForm" v-if="!isDetail&&type!=='pone'" :loading="formLoading">确认并保存</el-button>
+        <el-button type="primary" @click="submit" v-if="!isDetail && type == 'pone'"
+          :loading="formLoading">确认</el-button>
+        <el-button type="primary" @click="submitOrderForm" v-if="!isDetail && type !== 'pone'"
+          :loading="formLoading">保存</el-button>
+        <el-button type="primary" @click="saveSubmitOrderForm" v-if="!isDetail && type !== 'pone'"
+          :loading="formLoading">确认并保存</el-button>
         <el-button @click="printIng" :disabled="false" v-if="isDetail">打印</el-button>
         <!-- <el-button type="primary" :disabled="false" @click="handleAudit(true)" v-if="isDetail && checkPermission(['order:audit']) && OrderForm.allowable.audit">审核通过</el-button>
       <el-button type="danger" :disabled="false" @click="handleAudit(false)" v-if="isDetail && checkPermission(['order:audit']) && OrderForm.allowable.audit">审核驳回</el-button> -->
@@ -369,6 +344,20 @@
         <el-button type="primary" @click="submitSupplierForm">确 定</el-button>
       </span>
     </el-dialog>
+    <el-dialog title="商品列表" :visible.sync="goodsVisible" width="1000px" @close="closeGoosData">
+      <el-table ref="table" :data="goodsData.records" border style="width: 100%" @selection-change="handleSelChange">
+        <el-table-column type="selection" width="55" />
+        <el-table-column prop="name" label="分组名称"> </el-table-column>
+        <el-table-column prop="remark" label="描述"> </el-table-column>
+      </el-table>
+      <el-pagination @size-change="handlePageSizeChange" @current-change="handlePageCurrentChange"
+        :current-page="goodsData.page" :page-sizes="[10, 20, 50, 100]" :page-size="goodsData.size"
+        layout="total, sizes, prev, pager, next, jumper" :total="goodsData.total"></el-pagination>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeGoosData">取 消</el-button>
+        <el-button type="primary" @click="submitGoosData()">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -379,6 +368,7 @@ import * as API_BasicSetting from "@/api/basicSetting";
 import * as API_Member from "@/api/member";
 import * as API_Setting from "@/api/setting";
 import * as API_CollectingAccount from "@/api/collectingAccount";
+import * as API_productClass from "@/api/productClass.js"
 import { RegExp } from "~/ui-utils";
 import {
   provinceAndCityData,
@@ -434,6 +424,7 @@ export default {
         province_city_area: "",
         //详细信息
         address: "",
+        real_price: '',
         province_city_area_address: "",
         subtract_stock: false,
         warehouse_id: [],
@@ -456,10 +447,11 @@ export default {
         marketing_id: [this.MixinRequired("请选择销售人员", "change")],
         send_type: [this.MixinRequired("请选择配送方式", "change")],
         warehouse_id: [this.MixinRequired("请选择仓库", "change")],
-        member_id: [this.MixinRequired("请选择会员", "change")],
+        member_id: [this.MixinRequired("请选择下单客户", "change")],
         order_time: [this.MixinRequired("下单时间不能为空", "change")],
         payment_status: [this.MixinRequired("支付状态不能为空", "change")],
         payment_time: [this.MixinRequired("支付时间不能为空", "change")],
+        real_price: [this.MixinRequired("请输入实付金额", "blur")],
         // delivery_type: [this.MixinRequired("请选择配送方式", "change")],
         product_list: {
           num: [
@@ -618,20 +610,29 @@ export default {
           return v.getTime() < new Date().getTime() - 86400000;//  - 86400000是否包括当天
         }
       },
-      pickerOptionsEnd:{
-        disabledDate(time){
+      pickerOptionsEnd: {
+        disabledDate(time) {
           // 禁用所有在 start_time 之前的时间
-          return time.getTime() < new Date().getTime() ;
+          return time.getTime() < new Date().getTime();
         }
       },
-      type:'',
+      type: '',
+      goodsData: [],
+      goodsVisible: false,
+      goodsList: [],//暂存勾选的分类
+      params: {
+        pages: 1,
+        size: 10
+      },//商品分页
+      orderType: '',//条形码查看类型
     };
   },
   computed: {
     ...mapGetters(["user"])
   },
   mounted() {
-    this.type=this.$route.params.type
+    this.type = this.$route.params.type
+    this.orderType = this.$route.params.type
     this.GET_WarehouseList();
     this.GET_MemberList();
     this.GET_MarketingList();
@@ -641,6 +642,34 @@ export default {
     this.GET_CustomerList();
   },
   methods: {
+    //选择商品
+    handleSelChange(val) {
+      if (val.length > 1) {
+        // 如果当前选中数量超过1,移除先前选中的,保留最后选中的
+        const lastSelected = val[val.length - 1];
+        this.$refs.table.clearSelection(); // 清除所有选中
+        this.$refs.table.toggleRowSelection(lastSelected, true); // 重新选中最后一个
+      }
+      this.goodsList = val // 更新当前选中的行
+    },
+    // 保存已选商品
+    submitGoosData() {
+      if (this.goodsList.length >= 1) {
+        API_productClass.getProductByGroup(this.OrderForm.warehouse_id, this.goodsList[0].id).then(res => {
+          res.map(el => {
+            this.OrderForm.product_list.push(el)
+          })
+          this.goodsVisible = false;
+        })
+
+      } else {
+        this.$message.error("请选择商品信息");
+      }
+    },
+    // 关闭商品明细
+    closeGoosData() {
+      this.goodsVisible = false;
+    },
     handleBlur() {
       const value = this.discount;
       const regex = /^(10|([1-9](\.\d{0,1})?))$/;
@@ -859,6 +888,38 @@ export default {
 
       this.OrderForm.product_list = goodsData;
     },
+    /** 分页大小发生改变 */
+    handlePageSizeChange(size) {
+      this.params.size = size;
+      API_productClass.getProductList(this.params).then(res => {
+        this.goodsData = res
+        this.goodsVisible = true
+      })
+    },
+    /** 分页页数发生改变 */
+    handlePageCurrentChange(page) {
+      this.params.page = page;
+      API_productClass.getProductList(this.params).then(res => {
+        this.goodsData = res
+        this.goodsVisible = true
+      })
+    },
+    /* 选择分组商品 */
+    handleSelectGrou() {
+      if (!this.OrderForm.type) {
+        this.$message.error("请选择订单类型!");
+        return
+      }
+      if (this.OrderForm.warehouse_id.length == 0) {
+        this.$message.error("请选择仓库!");
+        return;
+      }
+      this.params.order_choose_type = this.OrderForm.type
+      API_productClass.getProductList(this.params).then(res => {
+        this.goodsData = res
+        this.goodsVisible = true
+      })
+    },
     /** 添加支付方式 */
     handleInsertPayment() {
       const defaultCollectingAccount = this.collectingAccountList.findLast(
@@ -1077,7 +1138,7 @@ export default {
       }
     },
     //延期确定
-   async submit(){
+    async submit() {
       // 校验商品明细数据
       const valid = await this.$refs.orderFormRef
         .validate()
@@ -1093,18 +1154,18 @@ export default {
       }
       this.OrderForm.province_city_area_address = loc + this.OrderForm.address; */
       const params = this.MixinClone(this.OrderForm);
-    /*   params.pay_price = this.price;
-      params.real_price = Number(params.real_price); */
+      /*   params.pay_price = this.price;
+        params.real_price = Number(params.real_price); */
       params.item_list = params.product_list;
       this.formLoading = true;
       API_Order.extension(id, params)
-          .then((response) => {
-            this.$message.success("调整成功!");
-            this.backOrderList();
-          })
-          .finally(() => {
-            this.formLoading = false;
-          });
+        .then((response) => {
+          this.$message.success("调整成功!");
+          this.backOrderList();
+        })
+        .finally(() => {
+          this.formLoading = false;
+        });
     },
     /** 获取仓库 */
     GET_WarehouseList() {
@@ -1146,7 +1207,7 @@ export default {
         response.product_list = response.item_list.map(el => {
           el.good_vo = el.goods_vo
           return el
-        }); 
+        });
         this.selectedOptions = response.province_city_area.split(",");
         this.OrderForm = response;
         console.log(this.OrderForm.product_list);
@@ -1169,41 +1230,81 @@ export default {
     },
   },
   computed: {
-    price() {
-      let total = 0;
-      if (!this.OrderForm.product_list) return
-      if (!this.id) {
-        if (this.OrderForm.type == "TO_C") {
-          var start = new Date(this.OrderForm.start_time); // 将起始日期字符串转换为Date对象
-          this.OrderForm.product_list.map((item) => {
-          var end = new Date(item.end_time); // 将结束日期字符串转换为Date对象
-          var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
-          var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
-            total += item.product_vo.day_price * item.num * monthDiff;
-          });
-         
-          return total;
+    price: {
+      get() {
+        let total = 0;
+        if (!this.OrderForm.product_list) return
+        if (!this.id) {
+          if (this.OrderForm.type == "TO_C") {
+            var start = new Date(this.OrderForm.start_time); // 将起始日期字符串转换为Date对象
+            this.OrderForm.product_list.map((item) => {
+              var end = new Date(item.end_time); // 将结束日期字符串转换为Date对象
+              var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
+              var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
+              total += item.product_vo.day_price * item.num * monthDiff;
+            });
+
+            return total;
+          } else {
+            this.OrderForm.product_list.map((item) => {
+              total += item.product_vo.price * item.num;
+            });
+            return total;
+          }
         } else {
-          this.OrderForm.product_list.map((item) => {
-            total += item.product_vo.price * item.num;
-          });
-          return total;
+          if (this.OrderForm.type == "TO_C") {
+            var start = new Date(this.time[1]); // 将起始日期字符串转换为Date对象
+            var end = new Date(this.time[0]); // 将结束日期字符串转换为Date对象
+            var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
+            var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
+            this.OrderForm.product_list.map((item) => {
+              total += item.product_vo.day_price * item.num * monthDiff;
+            });
+            return total;
+          } else {
+            this.OrderForm.product_list.map((item) => {
+              total += item.product_vo.price * item.num;
+            });
+            return total;
+          }
         }
-      } else {
-        if (this.OrderForm.type == "TO_C") {
-          var start = new Date(this.time[1]); // 将起始日期字符串转换为Date对象
-          var end = new Date(this.time[0]); // 将结束日期字符串转换为Date对象
-          var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
-          var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
-          this.OrderForm.product_list.map((item) => {
-            total += item.product_vo.day_price * item.num * monthDiff;
-          });
-          return total;
+      },
+      set(newValue) {
+        let total = 0;
+        if (!this.OrderForm.product_list) return
+        if (!this.id) {
+          if (this.OrderForm.type == "TO_C") {
+            var start = new Date(this.OrderForm.start_time); // 将起始日期字符串转换为Date对象
+            this.OrderForm.product_list.map((item) => {
+              var end = new Date(item.end_time); // 将结束日期字符串转换为Date对象
+              var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
+              var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
+              total += item.product_vo.day_price * item.num * monthDiff;
+            });
+
+            return total;
+          } else {
+            this.OrderForm.product_list.map((item) => {
+              total += item.product_vo.price * item.num;
+            });
+            return total;
+          }
         } else {
-          this.OrderForm.product_list.map((item) => {
-            total += item.product_vo.price * item.num;
-          });
-          return total;
+          if (this.OrderForm.type == "TO_C") {
+            var start = new Date(this.time[1]); // 将起始日期字符串转换为Date对象
+            var end = new Date(this.time[0]); // 将结束日期字符串转换为Date对象
+            var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
+            var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
+            this.OrderForm.product_list.map((item) => {
+              total += item.product_vo.day_price * item.num * monthDiff;
+            });
+            return total;
+          } else {
+            this.OrderForm.product_list.map((item) => {
+              total += item.product_vo.price * item.num;
+            });
+            return total;
+          }
         }
       }
     },
@@ -1338,10 +1439,10 @@ export default {
   }
 }
 
-.redClass /deep/ .el-form-item__label {
+.redClass /deep/ .el-form-item__content {
   //color: red !important;
   font-weight: 700;
-  width: 500px;
+  width: 500px !important;
 }
 
 /deep/ .el-form-item {