lhl 8 månader sedan
förälder
incheckning
555479ac59

+ 2 - 2
.env.dev

@@ -4,7 +4,7 @@ VUE_APP_ENV='dev'
 # 页面 title
 VUE_APP_TITLE=易趣水果
 # socket 系统长连接地址
-VUE_APP_WS_ADMIN_URL='ws://shop.yiqucbb.cn/ws'
+VUE_APP_WS_ADMIN_URL='ws://shop.yiqucguoyuan.com/ws'
 # 接口请求地址
-VUE_APP_API_URL='https://shop.yiqucbb.cn/adminapi'
+VUE_APP_API_URL='https://shop.yiqucguoyuan.com/adminapi'
 

+ 48 - 0
src/api/erp.js

@@ -287,6 +287,54 @@ export function getWantInfo(id) {
   });
 }
 
+
+/**
+ * @description 要货单审核
+ * @param {Object} param data {Object} 传值参数
+ */
+export function seveWant(id,data) {
+  return request({
+    url: "/erp/want/auth_save/" + id,
+    method: "post",
+	data
+  });
+}
+
+/**
+ * @description 采购单审核
+ * @param {Object} param data {Object} 传值参数
+ */
+export function sevePurchase(id,data) {
+  return request({
+    url: "/erp/purchase/auth_save/" + id,
+    method: "post",
+	data
+  });
+}
+
+/**
+ * @description 创建采购单
+ * @param {Object} param data {Object} 传值参数
+ */
+export function createPurchase(id,data) {
+  return request({
+    url: "/erp/purchase/create/" + id,
+    method: "post",
+	data
+  });
+}
+
+/**
+ * @description 获取汇总采购单商品
+ * @param {Object} param data {Object} 传值参数
+ */
+export function getPurchaseGoods(data) {
+  return request({
+    url: "/erp/purchase/goods",
+    method: "get",
+	params:data
+  });
+}
 /*
 Route::get('user/list', 'v1.erp.User/index')->option(['real_name' => '用户列表']);
 Route::get('user/info/:id', 'v1.erp.User/info')->option(['real_name' => '用户详情']);

+ 253 - 0
src/components/goodDetail.vue

@@ -0,0 +1,253 @@
+<template>
+	<div style="width: 100%">
+		<Modal v-model="modals" scrollable footer-hide closable title="商品列表" :mask-closable="false" width="700">
+			<Form ref="formValidate" :label-width="labelWidth" :label-position="labelPosition" class="tabform"
+				@submit.native.prevent>
+				<Row :gutter="24" type="flex">
+					<Col span="12">
+					<FormItem label="关键字:">
+						<Input enter-button placeholder="请输入商品名称/编码" element-id="name" v-model="formValidate.key" clearable />
+					</FormItem>
+					</Col>
+					<Col span="4">
+					<Button type="primary" icon="ios-search" @click="userSearchs">搜索</Button>
+					</Col>
+				</Row>
+			</Form>
+			<!-- <Divider dashed/> -->
+			<Table :columns="columns" :data="tabList" ref="table" :loading="loading" no-userFrom-text="暂无数据"
+				no-filtered-userFrom-text="暂无筛选结果" class="table" @on-selection-change="change">
+				<template slot-scope="{ row, index }" slot="store">
+					<span> {{ row.my.stock }}{{row.my.unit_name}}</span>
+				</template>
+				<!-- product_num -->
+				<template slot-scope="{ row, index }" slot="product_num">
+					<span> {{ row.product_num }}{{row.unit_name || row.info['unit_name' + (row.unit_type == 0 ? '':(row.unit_type == 1?"_1":"_2"))]}}</span>
+				</template>
+				</Table>
+			<div class="acea-row row-right page">
+				<Page :total="total" :current="formValidate.page" show-elevator show-total @on-change="pageChange"
+					:page-size="formValidate.limit" />
+			</div>
+			<Button type="primary"  @click="ok" style="width: 100%;margin-top:20px;">确认</Button>
+		</Modal>
+	</div>
+</template>
+
+<script>
+	import {
+		commissionDetailApi,
+		extractlistApi
+	} from '@/api/finance';
+	import {
+		getGodownList,
+		createGodown,
+		getGodownInfo,
+		getUserList,
+		getOutGoods
+	} from "@/api/erp";
+	import {
+		mapState
+	} from 'vuex';
+	export default {
+		name: 'commissionDetails',
+		data() {
+			return {
+				chooseGoods:[],
+				key: '',
+				wid: '',
+				my_store_id: '',
+				store_id: 0,
+				type: 0,
+				modals: false,
+				spinShow: false,
+				detailsData: {},
+				Ids: 0,
+				loading: false,
+				formValidate: {
+					page: 1, // 当前页
+					limit: 20 ,// 每页显示条数
+					key: '',
+					wid: '',
+					my_store_id: '',
+					store_id: 0,
+					type: 0,
+				},
+				total: 0,
+				columns: [{
+						type: 'selection',
+						width: 60,
+						align: 'center'
+					},
+					{
+						title: 'ID',
+						key: 'product_id',
+						minWidth: 50
+					},
+					{
+						title: '商品名称',
+						key: 'product_name',
+						minWidth: 200
+					},
+					{
+						title: '仓库库存',
+						slot: 'product_num',
+						minWidth: 150
+					},
+					{
+						title: '门店库存',
+						slot: 'store',
+						minWidth: 330
+					}
+				],
+				tabList: []
+
+			}
+		},
+		computed: {
+			...mapState('admin/layout', [
+				'isMobile'
+			]),
+			labelWidth() {
+				return this.isMobile ? undefined : 80;
+			},
+			labelPosition() {
+				return this.isMobile ? 'top' : 'left';
+			}
+		},
+		mounted() {
+			// if (this.Ids) {
+			//     this.getList();
+			// }
+			this.chooseGoods = []
+		},
+		methods: {
+			clearChoose() {
+				this.chooseGoods = []
+				this.$refs.table.selectAll(false);
+				
+			},
+			change(e) {
+				this.chooseGoods = e
+			},
+			ok() {
+				this.modals = false;
+				 this.$emit('setGoods',this.chooseGoods);
+			},
+			// 时间
+			onchangeTime(e) {
+				this.formValidate.start_time = e[0];
+				this.formValidate.end_time = e[1];
+			},
+			// 详情
+			getDetails(id) {
+				this.Ids = id;
+				this.spinShow = true;
+				commissionDetailApi(id).then(async res => {
+					if (res.status === 200) {
+						let data = res.data
+						this.detailsData = data.user_info;
+						this.spinShow = false;
+					} else {
+						this.spinShow = false;
+						this.$Message.error(res.msg);
+					}
+				}).catch(res => {
+					this.spinShow = false;
+					this.$Message.error(res.msg);
+				})
+			},
+			// 列表
+			getList() {
+				this.loading = true;
+				if (this.formValidate.type == 1) {
+					this.formValidate.wid = ''
+				} else {
+					this.formValidate.store_id = 0
+				}
+				getOutGoods(this.formValidate).then(async res => {
+					let data = res.data;
+					this.tabList = data;
+					this.total = data.count;
+					this.loading = false;
+				}).catch(res => {
+					this.loading = false;
+					this.$Message.error(res.msg);
+				})
+			},
+			pageChange(index) {
+				this.formValidate.page = index
+				this.getList();
+			},
+			// 搜索
+			userSearchs() {
+				this.formValidate.page = 1;
+				this.getList();
+			}
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+	.table {
+		.ivu-table-default {
+			overflow-y: auto;
+			max-height: 350px;
+		}
+	}
+
+	.dashboard-workplace {
+		&-header {
+			&-avatar {
+				width: 64px;
+				height: 64px;
+				border-radius: 50%;
+				margin-right: 16px;
+				font-weight: 600;
+			}
+
+			&-tip {
+				width: 82%;
+				display: inline-block;
+				vertical-align: middle;
+
+				&-title {
+					font-size: 13px;
+					color: #000000;
+					margin-bottom: 12px;
+				}
+
+				&-desc {
+					&-sp {
+						width: 33.33%;
+						color: #17233D;
+						font-size: 12px;
+						display: inline-block;
+					}
+				}
+			}
+
+			&-extra {
+				.ivu-col {
+					p {
+						text-align: right;
+					}
+
+					p:first-child {
+						span:first-child {
+							margin-right: 4px;
+						}
+
+						span:last-child {
+							color: #808695;
+						}
+					}
+
+					p:last-child {
+						font-size: 22px;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 1 - 1
src/pages/erp/godown/addGodown.vue

@@ -213,7 +213,7 @@
 			...mapMutations("admin/layout", ["setCopyrightShow"]),
 			getGodownInfo(id) {
 				getGodownInfo(id).then(res => {
-					this.formValidate = res.data
+					this.formValidate = res.data.info[0]
 					this.formValidate.addressSelect = this.formValidate.addressSelect.map(item => item*1)
 					console.log(this.formValidate.addressSelect);
 				})

+ 668 - 0
src/pages/erp/purchase/addPurchase.vue

@@ -0,0 +1,668 @@
+<template>
+	<div class="form-submit">
+		<div class="i-layout-page-header">
+			<PageHeader class="product_tabs" hidden-breadcrumb>
+				<div slot="title">
+					<router-link :to="{ path: `${roterPre}/erp/purchase_list` }">
+						<!-- <Button icon="ios-arrow-back" size="small" class="mr20"
+              >返回</Button
+            > -->
+						<div class="font-sm after-line">
+							<span class="iconfont iconfanhui"></span>
+							<span class="pl10">返回</span>
+						</div>
+					</router-link>
+					<span v-text="
+              $route.params.id !== '0' ? '编辑采购单' : '添加采购单'
+            " class="mr20 ml16"></span>
+				</div>
+			</PageHeader>
+		</div>
+
+		<Card :bordered="false" dis-hover class="ivu-mt">
+			<div class="new_tab" v-if="formValidate.id == 0">
+				<Tabs v-model="currentTab" @on-click="onClickTab">
+					<TabPane label="自建采购单" name="0" />
+					<TabPane label="库间流转" name="1" />
+					<TabPane label="商品在途" name="2" />
+				</Tabs>
+			</div>
+			<Form v-if="currentTab == 0" class="formValidate mt20" ref="formValidate" :rules="ruleValidate"
+				:model="formValidate" :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
+				<Row :gutter="24" type="flex">
+					<Col span="24">
+					<FormItem label="仓库:" prop="wid">
+						<el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate.wid"
+							:options="data1" :props="props" @change="userSearchss" filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="供应商:" prop="supplier_id" label-for="supplier_id">
+						<Select v-model="formValidate.supplier_id" @on-change="userSearchsss" clearable
+							class="input-add">
+							<Option v-for="item in supplierList" :value="item.id" :key="item.id">
+								{{ item.supplier_name }}
+							</Option>
+						</Select>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="商品:" prop="goods">
+						<Table :columns="formValidate.id == 0 ?columns:columnss" :data="chooseGoods" ref="table"
+							:loading="loading" no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果">
+							<template slot-scope="{ row,index }" slot="product_num">
+								<Input v-model="chooseGoods[index].product_num" placeholder="请输入要货数量" v-width="'150'"
+									type="number" />
+							</template>
+							<template slot-scope="{ row,index }" slot="unit_type">
+								<Select v-model="chooseGoods[index].unit_type" style="width:200px">
+									<Option v-for="item in row.unitList" :value="item.value" :key="item.value">
+										{{ item.label }}
+									</Option>
+								</Select>
+							</template>
+							<template slot-scope="{ row,index }" slot="unit_types">
+								{{row.unit_name}}
+							</template>
+							<template slot-scope="{ row,index }" slot="store_num">
+								<span> {{ row.my.stock }}{{row.my.unit_name}}</span>
+							</template>
+							<template slot-scope="{ row, index }" slot="action">
+								<a @click="del(index)">删除</a>
+							</template>
+							<!-- <template slot-scope="{ row }" slot="product">
+								<div class="product">
+									<div class="image" v-viewer>
+										<img v-lazy="row.image">
+									</div>
+									<div class="title">{{ row.store_name }}</div>
+								</div>
+							</template> -->
+						</Table>
+						<Button type="primary" class="submission" style="margin-top:20px;" @click="getGoods()"
+							v-if="formValidate.id == 0">选择商品</Button>
+					</FormItem>
+					</Col>
+				</Row>
+			</Form>
+			<Form v-if="currentTab == 1" class="formValidate mt20" ref="formValidate" :rules="ruleValidate"
+				:model="formValidate" :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent >
+				<Row :gutter="24" type="flex">
+					<Col span="24">
+					<FormItem label="仓库:" prop="wid">
+						<el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate.wid"
+							:options="data1" :props="props" @change="chooseWid" filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="供应商:" prop="supplier_id" label-for="supplier_id">
+						<Select v-model="formValidate.supplier_id" @on-change="userSearchsss" clearable
+							class="input-add">
+							<Option v-for="item in supplierList" :value="item.id" :key="item.id">
+								{{ item.supplier_name }}
+							</Option>
+						</Select>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="商品:" prop="goods" >
+						<Table :columns="formValidate.id == 0 ?columns_1:columnss" :data="goods" ref="table"
+							:loading="loading" no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果" @on-selection-change="change">
+							<template slot-scope="{ row,index }" slot="product_num">
+								<Input v-model="goods[index].want_product_num" placeholder="请输入要货数量" v-width="'150'"
+									type="number" />
+							</template>
+							<template slot-scope="{ row,index }" slot="unit_type">
+								<Select v-model="goods[index].unit_type" style="width:200px">
+									<Option v-for="item in row.unitList" :value="item.value" :key="item.value">
+										{{ item.label }}
+									</Option>
+								</Select>
+							</template>
+							<template slot-scope="{ row,index }" slot="unit_types">
+								{{row.unit_name}}
+							</template>
+							<template slot-scope="{ row,index }" slot="store_num">
+								<span> {{ row.my.stock }}{{row.my.unit_name}}</span>
+							</template>
+							<template slot-scope="{ row, index }" slot="action">
+								<a @click="del(index)">删除</a>
+							</template>
+							<!-- <template slot-scope="{ row }" slot="product">
+								<div class="product">
+									<div class="image" v-viewer>
+										<img v-lazy="row.image">
+									</div>
+									<div class="title">{{ row.store_name }}</div>
+								</div>
+							</template> -->
+						</Table>
+					</FormItem>
+					</Col>
+				</Row>
+			</Form>
+		</Card>
+
+		<Card :bordered="false" dis-hover class="fixed-card"
+			:style="{ left: `${!menuCollapse ? '200px' : isMobile ? '0' : '80px'}` }">
+			<Form>
+				<FormItem>
+					<Button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</Button>
+				</FormItem>
+			</Form>
+		</Card>
+		<good-detail ref="goodDetail" @setGoods="setGoods"></good-detail>
+	</div>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from "vuex";
+	import {
+		staffListInfo
+	} from "@/api/store";
+	import {
+		getGodownList,
+		createGodown,
+		getGodownInfo,
+		getUserList,
+		getOutGoods,
+		createPurchase,
+		getWantInfo,
+		getPurchaseGoods
+	} from "@/api/erp";
+	import {
+		keyApi,
+		storeGetInfoApi,
+		cityApi,
+		storeUpdateApi,
+		cascaderList
+	} from '@/api/store';
+	import {
+		productSpecs,
+		productSpecsInfo
+	} from "@/api/product";
+
+	import {
+		getSupplierList
+	} from '@/api/supplier'
+	import Setting from "@/setting";
+
+	import goodDetail from '@/components/goodDetail.vue'
+	export default {
+		name: "specsAdd",
+		components: {
+			goodDetail
+		},
+		data() {
+			return {
+				goods: [],
+				currentTab: 0,
+				supplierList: [],
+				loading: false,
+				authList: [],
+				columnss: [{
+						title: '商品名称',
+						key: 'product_name',
+						minWidth: 160
+					},
+					{
+						title: '要货数量',
+						slot: 'product_num',
+						minWidth: 90
+					},
+					{
+						title: '要货单位',
+						slot: 'unit_types',
+						minWidth: 150
+					},
+					{
+						title: '操作',
+						slot: 'action',
+						minWidth: 120
+					},
+				],
+				columns: [{
+						title: '商品名称',
+						key: 'product_name',
+						minWidth: 160
+					},
+					{
+						title: '数量',
+						slot: 'product_num',
+						minWidth: 90
+					},
+					{
+						title: '单位',
+						slot: 'unit_type',
+						minWidth: 150
+					},
+					{
+						title: '操作',
+						slot: 'action',
+						minWidth: 120
+					},
+
+				],
+				columns_1: [{
+						type: 'selection',
+						width: 60,
+						align: 'center'
+					}, {
+						title: '商品名称',
+						key: 'product_name',
+						minWidth: 160
+					},
+					{
+						title: '数量',
+						slot: 'product_num',
+						minWidth: 90
+					},
+					{
+						title: '单位',
+						slot: 'unit_types',
+						minWidth: 150
+					},
+
+				],
+				chooseGoods: [],
+				staffData: [],
+				addresData: [],
+				props: {
+					emitPath: false,
+					multiple: false,
+					checkStrictly: true,
+					value: "id",
+					label: "title"
+				},
+				propss: {
+					emitPath: false,
+					multiple: false,
+					checkStrictly: true,
+					value: "id",
+					label: "name"
+				},
+				propsss: {
+					emitPath: false,
+					multiple: false,
+					checkStrictly: true,
+					value: "id",
+					label: "staff_name"
+				},
+				roterPre: Setting.roterPre,
+				data1: [],
+				grid: {
+					xl: 7,
+					lg: 7,
+					md: 12,
+					sm: 24,
+					xs: 24,
+				},
+				formValidate: {
+					id: 0,
+					wid: 0,
+					goods: [],
+					supplier_id: 0
+				},
+				ruleValidate: {
+					supplier_id: [{
+						type: "number",
+						required: true,
+						message: "请选择供应商",
+						trigger: "blur"
+					}, ],
+					wid: [{
+						type: "number",
+						required: true,
+						message: "请选择仓库",
+						trigger: "blur"
+					}, ],
+					// create_uid: [{
+					// 	type: "number",
+					// 	required: true,
+					// 	message: "请选择创建人",
+					// 	trigger: "blur"
+					// }, ],
+					// goods: [{
+					// 	type: "array",
+					// 	required: true,
+					// 	message: "请选择商品",
+					// 	trigger: "change"
+					// }, ],
+				},
+			};
+		},
+		computed: {
+			...mapState("admin/layout", ["isMobile", "menuCollapse"]),
+			labelWidth() {
+				return this.isMobile ? undefined : 120;
+			},
+			labelPosition() {
+				return this.isMobile ? "top" : "right";
+			},
+		},
+		created() {},
+		mounted() {
+			this.getGodownList()
+			this.getSupplierList()
+		},
+		destroyed() {
+			// this.setCopyrightShow({
+			// 	value: true
+			// });
+		},
+		methods: {
+			...mapMutations("admin/layout", ["setCopyrightShow"]),
+			change(e) {
+				console.log(e);
+			},
+			chooseWid(e) {
+				this.goods = []
+				if(e) {
+					getPurchaseGoods({
+						wid: e
+					}).then(res => {
+						this.goods = res.data[0].data
+						console.log(this.goods,'params');
+					})
+				}
+				
+			},
+			onClickTab(e) {
+				console.log(e);
+				this.currentTab = e
+			},
+			//获取供应商列表;
+			getSupplierList() {
+				getSupplierList()
+					.then(async (res) => {
+						this.supplierList = res.data;
+					})
+					.catch((res) => {
+						this.$Message.error(res.msg);
+					});
+			},
+			getWantInfo(id) {
+				getWantInfo(id).then(res => {
+					let data = res.data
+					this.formValidate.id = data.id
+					this.formValidate.create_uid = data.create_uid
+					this.chooseGoods = data.info
+					this.formValidate.store_id = data.store_id
+					if (data.wid) {
+						this.formValidate.type = 0
+						this.formValidate.wid = data.wid
+						this.getUserList()
+					}
+				})
+			},
+			resetGoods(e, type) {
+				let arr = e.map(item => {
+					item.unitList = [{
+						value: 0,
+						label: item.info.unit_name
+					}]
+					if (item.info.unit_name_1) {
+						item.unitList.push({
+							value: 1,
+							label: item.info.unit_name_1
+						})
+					}
+					if (item.info.unit_name_2) {
+						item.unitList.push({
+							value: 2,
+							label: item.info.unit_name_1
+						})
+					}
+					if (type == 're') {
+						item.product_num = 0
+					}
+					return item
+				})
+				return arr
+			},
+			setGoods(e) {
+				this.chooseGoods = this.chooseGoods.concat(this.resetGoods(e, 're'))
+			},
+			getGoods() {
+				if (this.formValidate.wid == 0) {
+					return this.$Message.error('请选择仓库');
+				}
+				this.$refs.goodDetail.clearChoose()
+				this.$refs.goodDetail.modals = true;
+				this.$refs.goodDetail.formValidate.type = 0
+				this.$refs.goodDetail.formValidate.wid = this.formValidate.wid
+			},
+			getUserList() {
+				getUserList({
+					wid: this.formValidate.wid
+				}).then(res => {
+					// console.log(res);
+					this.authList = res.data.data
+					// .map(item => {
+					// 		item.id += ''
+					// 		return item
+					// 	});
+				})
+			},
+			staffList() {
+				staffListInfo()
+					.then((res) => {
+						this.staffData = res.data
+						// .map(item => {
+						// 	item.id += ''
+						// 	return item
+						// });
+					})
+					.catch((err) => {
+						this.$Message.error(err.msg);
+					});
+			},
+			getGodownInfo(id) {
+				getGodownInfo(id).then(res => {
+					this.formValidate = res.data
+					this.formValidate.addressSelect = this.formValidate.addressSelect.map(item => item * 1)
+					console.log(this.formValidate.addressSelect);
+				})
+			},
+			addchack(e, selectedData) {
+				console.log(selectedData, 'selectedData');
+				e.forEach((i, index) => {
+					if (index == 0) {
+						this.formValidate.province = i
+					} else if (index == 1) {
+						this.formValidate.city = i
+					} else if (index == 2) {
+						this.formValidate.area = i
+					} else {
+						this.formValidate.street = i
+					}
+				})
+				this.formValidate.address = (selectedData.map(o => o.label)).join('/')
+				// console.log('this.formValidate.addressSelect',this.formValidate.addressSelect);
+
+			},
+			cityInfo(data) {
+				cityApi(data).then(res => {
+					this.addresData = res.data
+				})
+			},
+			loadData(item, callback) {
+				item.loading = true;
+				cityApi({
+					pid: item.value
+				}).then(res => {
+					item.children = res.data;
+					item.loading = false;
+					callback();
+				});
+
+
+			},
+			getGodownList() {
+				getGodownList().then(res => {
+					console.log(res);
+					this.data1 = res.data.data
+					// .map(item => {
+					// 		item.id += ''
+					// 		return item
+					// 	});
+				})
+			},
+			del(index) {
+				this.chooseGoods.splice(index, 1);
+			},
+			userSearchs(e) {
+
+			},
+			userSearchsss(e) {
+
+			},
+			userSearchss(e) {
+				this.formValidate.create_uid = "";
+				this.authList = []
+				this.goods = []
+				this.getUserList()
+			},
+			// 处理goods数据
+			handleGoods(list) {
+				let arr = []
+				let arr1 = JSON.parse(JSON.stringify(list))
+				let uniqueArray = arr1.filter(function(item, index, self) {
+					return !self.slice(index + 1).some(function(otherItem) {
+						return item.product_id === otherItem.product_id && item.unit_type === otherItem
+							.unit_type;
+					});
+				});
+				arr = uniqueArray.map(item => {
+					let want = 0;
+					for (let i = 0; i < arr1.length; i++) {
+						if (item.product_id === arr1[i].product_id && item.unit_type === arr1[i].unit_type) {
+							console.log(arr1[i].product_num * 1, i, 'i');
+							want += arr1[i].product_num * 1
+						}
+					}
+					item.product_num = want
+					return item
+				})
+				return arr.map(item => {
+					item.unit_name = item.info['unit_name' + (item.unit_type == 0 ? '' : (item.unit_type == 1 ?
+						"_1" : "_2"))]
+					return item
+				})
+			},
+			handleSubmit(name) {
+				if(this.currentTab == 0) {
+					if (this.formValidate.id == 0) {
+						this.formValidate.goods = this.handleGoods(this.chooseGoods)
+					} else {
+						this.formValidate.goods = this.chooseGoods
+					}
+				}else {
+					
+				}
+				
+
+
+				this.$refs[name].validate((valid) => {
+					if (valid) {
+						this.formValidate.id = this.$route.query.id;
+
+						createPurchase(this.formValidate.id, {
+							wid: this.formValidate.wid,
+							products: this.formValidate.goods,
+							supplier_id: this.formValidate.supplier_id
+						}).then(res => {
+							this.$Message.success(res.msg);
+							this.$router.push({
+								path: this.roterPre + "/erp/purchase_list"
+							});
+						}).catch(err => {
+							this.$Message.error(err.msg);
+						})
+					} else {
+						// this.$Message.error("请输入参数模板名称");
+					}
+				});
+			},
+		},
+	};
+</script>
+
+<style scoped lang="stylus">
+	.table {
+		/deep/.ivu-table-header table {
+			border: 0 !important;
+		}
+
+		/deep/.ivu-table-header thead tr th:nth-of-type(1) {
+			padding-left: 16px;
+		}
+
+		/deep/.ivu-table td:nth-of-type(1) {
+			padding-left: 16px;
+		}
+
+		/deep/.ivu-table-cell {
+			padding: 0 !important;
+		}
+
+		/deep/.ivu-table-border th,
+		/deep/.ivu-table-border td {
+			border-right: unset;
+		}
+
+		/deep/.ivu-table td {
+			height: 59px;
+		}
+	}
+
+	.form-submit {
+		/deep/.ivu-card {
+			border-radius: 0;
+		}
+
+		margin-bottom: 79px;
+
+		.fixed-card {
+			position: fixed;
+			right: 0;
+			bottom: 0;
+			left: 200px;
+			z-index: 99;
+			box-shadow: 0 -1px 2px rgb(240, 240, 240);
+
+			/deep/ .ivu-card-body {
+				padding: 15px 16px 14px;
+			}
+
+			.ivu-form-item {
+				margin-bottom: 0;
+			}
+
+			/deep/ .ivu-form-item-content {
+				margin-right: 124px;
+				text-align: center;
+			}
+
+			.ivu-btn {
+				height: 36px;
+				padding: 0 20px;
+			}
+		}
+	}
+
+	.after-line {
+		display: inline-block;
+		position: relative;
+		margin-right: 16px;
+	}
+
+	.ml16 {
+		margin-left: 16px;
+	}
+</style>

+ 94 - 2
src/pages/erp/purchase/index.vue

@@ -133,6 +133,8 @@
 				<template slot-scope="{ row, index }" slot="action">
 					<a @click="edit(row)">编辑</a>
 					<Divider type="vertical" />
+					<a @click="pass(row)">审核</a>
+					<Divider type="vertical" />
 					<a @click="del(row, '删除仓位', index)">删除</a>
 				</template>
 			</Table>
@@ -141,6 +143,49 @@
 					:page-size="tableFrom.limit" />
 			</div>
 		</Card>
+		<Modal
+		  v-model="modalpass"
+		  scrollable
+		  title="请修改内容"
+		  class="order_box"
+		  :closable="false"
+		  :mask-closable="false"
+		>
+		  <Form
+		    ref="remarks"
+		    :model="remarks"
+		    :label-width="80"
+		    @submit.native.prevent
+		  >
+		  <FormItem label="采购人:">
+		    <Select v-model="remarks.purchasing_person_uid" clearable filterable @on-change="userSearchses"
+		    	class="input-add">
+		    	<Option v-for="item in authLists" :value="item.id" :key="item.id">{{ item.staff_name }}
+		    	</Option>
+		    </Select>
+		  </FormItem>
+		    <FormItem label="审核人:">
+			  <Select v-model="remarks.auth_uid" clearable filterable @on-change="userSearchse"
+			  	class="input-add">
+			  	<Option v-for="item in authLists" :value="item.id" :key="item.id">{{ item.staff_name }}
+			  	</Option>
+			  </Select>
+		    </FormItem>
+			<FormItem label="状态:">
+			  <Select v-model="remarks.status" clearable filterable 
+			  	class="input-add">
+			  	<Option :value="1" >通过</Option>
+				<Option :value="-1" >拒绝</Option>
+				<Option :value="2" >部分完成</Option>
+				<Option :value="3" >完成</Option>
+			  </Select>
+			</FormItem>
+		  </Form>
+		  <div slot="footer">
+		    <Button type="primary" @click="putRemark()">提交</Button>
+		    <Button @click="cancel()">取消</Button>
+		  </div>
+		</Modal>
 	</div>
 </template>
 
@@ -158,7 +203,8 @@
 		getUserInfo,
 		getPurchaselist,
 		getGodownList,
-		getUserList
+		getUserList,
+		sevePurchase
 	} from "@/api/erp";
 	import {
 		formatDate
@@ -183,6 +229,16 @@
 		},
 		data() {
 			return {
+				modalpass: false,
+				remarks: {
+					id: 0,
+					status: '',
+					auth_uid: "",
+					auth_admin_id: "",
+					purchasing_person_admin_id: "",
+					purchasing_person_uid: ""
+				},
+				authLists: [],
 				data1:[],
 				staffData: [],
 				supplierList: [],
@@ -299,6 +355,42 @@
 			this.getGodownList()
 		},
 		methods: {
+			putRemark() {
+				sevePurchase(this.remarks.id,this.remarks).then(res => {
+					this.cancel()
+					this.getList();
+				})
+			},
+			cancel() {
+				this.remarks = {
+					id:0,
+					status: '',
+					auth_uid: "",
+					auth_admin_id: "",}
+					this.modalpass = false
+			},
+			userSearchse(e) {
+				let auth = this.authLists.find(item => item.id == e)
+				this.remarks.auth_admin_id = auth.admin_id
+			},
+			userSearchses(e) {
+				let auth = this.authLists.find(item => item.id == e)
+				this.remarks.purchasing_person_admin_id = auth.admin_id
+			},
+			pass(row) {
+				let qdata = {}
+				if(row.wid) {
+					qdata.wid = row.wid
+				}else {
+					qdata.store_id = row.store_id
+				}
+				this.authLists = []
+				this.remarks.id = row.id
+				getUserList(qdata).then(res => {
+					this.authLists = res.data.data
+					this.modalpass = true;
+				})
+			},
 			getUserList() {
 				getUserList({
 					wid: this.tableFrom.wid
@@ -348,7 +440,7 @@
 			// 添加
 			add() {
 				this.$router.push({
-					path: this.roterPre + "/erp/add_position?id=0"
+					path: this.roterPre + "/erp/purchase_add?id=0"
 				});
 			},
 			addMore() {

+ 23 - 3
src/pages/erp/want/addWant.vue

@@ -69,7 +69,7 @@
 					</Col>
 					<Col span="24">
 					<FormItem label="商品:" prop="goods">
-						<Table :columns="columns" :data="chooseGoods" ref="table" :loading="loading"
+						<Table :columns="formValidate.id == 0 ?columns:columnss" :data="chooseGoods" ref="table" :loading="loading"
 							no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果">
 							<!-- <template slot-scope="{ row }" slot="coupon_price">
 								<span v-if="row.coupon_type==1">{{row.coupon_price}}元</span>
@@ -81,13 +81,13 @@
 							<template slot-scope="{ row,index }" slot="want_product_num">
 								<Input v-model="chooseGoods[index].want_product_num" placeholder="请输入要货数量" v-width="'150'" type="number"/>
 							</template>
-							<template slot-scope="{ row,index }" slot="unit_type" v-if="formValidate.id == 0">
+							<template slot-scope="{ row,index }" slot="unit_type" >
 								<Select v-model="chooseGoods[index].unit_type" style="width:200px" >
 									<Option v-for="item in row.unitList" :value="item.value" :key="item.value">
 										{{ item.label }}</Option>
 								</Select>
 							</template>
-							<template slot-scope="{ row,index }" slot="unit_type" v-if="formValidate.id != 0">
+							<template slot-scope="{ row,index }" slot="unit_types">
 								{{row.unit_name}}
 							</template>
 							<template slot-scope="{ row,index }" slot="store_num">
@@ -162,6 +162,26 @@
 			return {
 				loading: false,
 				authList: [],
+				columnss: [{
+						title: '商品名称',
+						key: 'product_name',
+						minWidth: 160
+					},
+					{
+						title: '要货数量',
+						slot: 'want_product_num',
+						minWidth: 90
+					},
+					{
+						title: '要货单位',
+						slot: 'unit_types',
+						minWidth: 150
+					},
+					{
+						title: '操作',
+						slot: 'action',
+						minWidth: 120
+					},],
 				columns: [{
 						title: '商品名称',
 						key: 'product_name',

+ 93 - 2
src/pages/erp/want/index.vue

@@ -151,6 +151,8 @@
 						<Divider type="vertical" />
 						<a @click="edit(row)">编辑</a>
 						<Divider type="vertical" />
+						<a @click="pass(row)">审核</a>
+						<Divider type="vertical" />
 						<a @click="del(row, '删除要货单', index)">删除</a>
 					</template>
 					
@@ -161,6 +163,51 @@
 					:page-size="tableFrom.limit" />
 			</div>
 		</Card>
+		<Modal
+		  v-model="modalpass"
+		  scrollable
+		  title="请修改内容"
+		  class="order_box"
+		  :closable="false"
+		  :mask-closable="false"
+		>
+		  <Form
+		    ref="remarks"
+		    :model="remarks"
+		    :label-width="80"
+		    @submit.native.prevent
+		  >
+		    <FormItem label="审核人:">
+		     <!-- <Input
+		        v-model="remarks.mark"
+		        maxlength="200"
+		        show-word-limit
+		        type="textarea"
+		        placeholder="请填写备注~"
+		        style="width: 100%"
+		      /> -->
+			  <Select v-model="remarks.auth_uid" clearable filterable @on-change="userSearchse"
+			  	class="input-add">
+			  	<Option v-for="item in authLists" :value="item.id" :key="item.id">{{ item.staff_name }}
+			  	</Option>
+			  </Select>
+		    </FormItem>
+			<FormItem label="状态:">
+			  <Select v-model="remarks.status" clearable filterable 
+			  	class="input-add">
+			  	<Option :value="1" >通过</Option>
+				<Option :value="-1" >拒绝</Option>
+				<Option :value="2" >部分完成</Option>
+				<Option :value="3" >完成</Option>
+				<Option :value="-2" >无效</Option>
+			  </Select>
+			</FormItem>
+		  </Form>
+		  <div slot="footer">
+		    <Button type="primary" @click="putRemark()">提交</Button>
+		    <Button @click="cancel()">取消</Button>
+		  </div>
+		</Modal>
 	</div>
 </template>
 
@@ -177,7 +224,8 @@
 		getWantList,
 		getUserInfo,
 		getGodownList,
-		getUserList
+		getUserList,
+		seveWant
 	} from "@/api/erp";
 	import {
 		staffListInfo
@@ -226,6 +274,13 @@
 		},
 		data() {
 			return {
+				remarks: {
+					id: 0,
+					status: '',
+					auth_uid: "",
+					auth_admin_id: "",
+				},
+				modalpass:false,
 				roterPre: Setting.roterPre,
 				loading: false,
 				options: timeOptions,
@@ -310,7 +365,8 @@
 				total: 0,
 				staffData:[],
 				data1:[],
-				authList:[]
+				authList:[],
+				authLists: []
 			};
 		},
 		computed: {
@@ -331,6 +387,21 @@
 			this.getUserList()
 		},
 		methods: {
+			putRemark() {
+				seveWant(this.remarks.id,this.remarks).then(res => {
+					this.cancel()
+					this.getList();
+				})
+				
+			},
+			cancel() {
+				this.remarks = {
+					id:0,
+					status: '',
+					auth_uid: "",
+					auth_admin_id: "",}
+					this.modalpass = false
+			},
 			getUserList() {
 				getUserList().then(res => {
 					// console.log(res);
@@ -341,6 +412,11 @@
 				this.tableFrom.page = 1;
 				this.getList();
 			},
+			userSearchse(e) {
+				let auth = this.authLists.find(item => item.id == e)
+				console.log(auth,'auth');
+				this.remarks.auth_admin_id = auth.admin_id
+			},
 			getGodownList() {
 				getGodownList().then(res => {
 					console.log(res);
@@ -426,6 +502,20 @@
 						this.$Message.error(res.msg);
 					});
 			},
+			pass(row) {
+				let qdata = {}
+				if(row.wid) {
+					qdata.wid = row.wid
+				}else {
+					qdata.store_id = row.store_id
+				}
+				this.authLists = []
+				this.remarks.id = row.id
+				getUserList(qdata).then(res => {
+					this.authLists = res.data.data
+					this.modalpass = true;
+				})
+			},
 			// 列表
 			getList() {
 				this.loading = true;
@@ -471,6 +561,7 @@
 						this.$Message.error(res.msg);
 					});
 			},
+			
 		},
 	};
 </script>

+ 9 - 0
src/router/modules/erp.js

@@ -38,6 +38,15 @@ export default {
 			},
 			component: () => import('@/pages/erp/purchase/index')
 		},
+		{
+			path:'purchase_add',
+			name: `${pre}purchase_add`,
+			meta: {
+				auth: ['admin-erp-purchase_add'],
+				title: '添加编辑采购单'
+			},
+			component: () => import('@/pages/erp/purchase/addPurchase')
+		},
 		{
 			path:'godown_list',
 			name: `${pre}godown_list`,