lhl 5 месяцев назад
Родитель
Сommit
e686384482

+ 73 - 1
src/api/erp.js

@@ -335,6 +335,78 @@ export function getPurchaseGoods(data) {
 	params:data
   });
 }
+
+//user/create
+/**
+ * @description 创建用户
+ * @param {Object} param data {Object} 传值参数
+ */
+export function createUser(id,data) {
+  return request({
+    url: "/erp/user/create/" + id,
+    method: "post",
+	data
+  });
+}
+
+/**
+ * @description 采购单详情
+ * @param {Object} param data {Object} 传值参数
+ */
+export function getPurchaseInfo(id) {
+  return request({
+    url: "/erp/purchase/info/" + id,
+    method: "get",
+  });
+}
+
+/**
+ * @description 完成采购单
+ * @param {Object} param data {Object} 传值参数
+ */
+export function savePurchase(id,data) {
+  return request({
+    url: "/erp/purchase/save/" + id,
+    method: "post",
+	data
+  });
+}
+
+
+/**
+ * @description 采购单详情
+ * @param {Object} param data {Object} 传值参数
+ */
+export function getPurchaseDetail(id) {
+  return request({
+    url: "/erp/purchase/get_order_id/" + id,
+    method: "get"
+  });
+}
+
+/**
+ * @description 采购单详情
+ * @param {Object} param data {Object} 传值参数
+ */
+export function getPurchaseId(id) {
+	return request({
+	  url: "/erp/purchase/get_order_id/" + id,
+	  method: "get"
+	});
+}
+
+/**
+ * @description 创建入库
+ * @param {Object} param data {Object} 传值参数
+ */
+export function createRuku(data,id) {
+	return request({
+	  url: "/erp/in/create/" + id,
+	  method: "post",
+	  data
+	});
+}
+
 /*
 Route::get('user/list', 'v1.erp.User/index')->option(['real_name' => '用户列表']);
 Route::get('user/info/:id', 'v1.erp.User/info')->option(['real_name' => '用户详情']);
@@ -351,7 +423,7 @@ Route::delete('want/del/:id', 'v1.erp.Want/del')->option(['real_name' => '删除
 Route::get('purchase/list', 'v1.erp.Purchase/index')->option(['real_name' => '采购列表']);
 Route::get('purchase/info/:id', 'v1.erp.Purchase/info')->option(['real_name' => '采购详情']);
 Route::post('purchase/create/:id', 'v1.erp.Purchase/create')->option(['real_name' => '创建采购']);
-Route::put('purchase/auth_save/:id', 'v1.erp.Purchase/auth_save')->option(['real_name' => '审核采购']);
+Route::put('purchase/auth_save/:id', 'v1.erp.Purchase/auth_save')->option(['real_name' => '审核+++++++采购']);
 Route::delete('purchase/del/:id', 'v1.erp.Purchase/del')->option(['real_name' => '删除采购']);
 Route::get('purchase/in_status/:purchase_order_id', 'v1.erp.Purchase/in_status')->option(['real_name' => '采购入库状态']);
 Route::get('purchase/get_order_id/:purchase_order_id', 'v1.erp.Purchase/get_order_id')->option(['real_name' => '采购单号']);

+ 245 - 0
src/components/adminList/index.vue

@@ -0,0 +1,245 @@
+<template>
+<!-- 选择用户 -->
+
+  <div>
+	  <Form
+	    ref="formValidate"
+	    inline
+	    :model="formValidate"
+	    :label-width="labelWidth"
+	    :label-position="labelPosition"
+	    @submit.native.prevent
+	  >
+	        <FormItem label="搜索:">
+	          <Input
+	            placeholder="请输入名称/账号"
+	            v-model="formValidate.name"
+	            class="input-add"
+	            @on-search="userSearchs"
+	          ></Input>
+	          <Button type="primary" @click="userSearchs()">查询</Button>
+	        </FormItem>
+	        <!-- <Button type="primary" @click="userSearchs()">查询</Button> -->
+	      <!-- </Col>
+	    </Row> -->
+	  </Form>
+    <Table
+      :loading="loading2"
+      highlight-row
+      no-userFrom-text="暂无数据"
+      no-filtered-userFrom-text="暂无筛选结果"
+      ref="selection"
+      :columns="columns4"
+      :data="tableList2"
+      height="500"
+    >
+      <template slot-scope="{ row, index }" slot="headimgurl">
+        <viewer>
+          <div class="tabBox_img">
+            <img v-lazy="row.headimgurl" />
+          </div>
+        </viewer>
+      </template>
+    </Table>
+    <div class="acea-row row-right page">
+      <Page
+        :current="formValidate.page"
+        :total="total2"
+        show-elevator
+        show-total
+        @on-change="pageChange2"
+        :page-size="formValidate.limit"
+      />
+    </div>
+  </div>
+</template>
+<script>
+import { kefucreateApi,kefuListApi } from "@/api/setting";
+import { adminListApi} from "@/api/systemAdmin"
+import template from "../../pages/setting/devise/template.vue";
+import timeOptions from "@/utils/timeOptions";
+import { mapState } from 'vuex';
+export default {
+  components: { template },
+  name: "index",
+  data() {
+    return {
+      formValidate: {
+        page: 1,
+        limit: 15,
+		name: ""
+      },
+      tableList2: [],
+      timeVal: [],
+      options: timeOptions,
+      fromList: {
+        title: "选择时间",
+        custom: true,
+        fromTxt: [
+          { text: "全部", val: "" },
+          { text: "今天", val: "today" },
+          { text: "昨天", val: "yesterday" },
+          { text: "最近7天", val: "lately7" },
+          { text: "最近30天", val: "lately30" },
+          { text: "本月", val: "month" },
+          { text: "本年", val: "year" },
+        ],
+      },
+      currentid: 0,
+      productRow: {},
+      columns4: [
+        {
+          title: "选择",
+          key: "chose",
+          width: 60,
+          align: "center",
+          render: (h, params) => {
+            let uid = params.row.id;
+            let flag = false;
+            if (this.currentid === uid) {
+              flag = true;
+            } else {
+              flag = false;
+            }
+            let self = this;
+            return h("div", [
+              h("Radio", {
+                props: {
+                  value: flag,
+                },
+                on: {
+                  "on-change": () => {
+                    self.currentid = uid;
+                    this.productRow = params.row;
+                    if (this.productRow.id) {
+                      this.$emit("imageObject", {
+                        id: this.productRow.id,
+                        name: this.productRow.real_name,
+						level: this.productRow.level
+                      });
+                    } else {
+                      // this.$Message.warning("请先选择商品");
+                    }
+                  },
+                },
+              }),
+            ]);
+          },
+        },
+        {
+          title: "ID",
+          key: "id",
+          width: 80,
+        },
+        {
+          title: "姓名",
+          key: "real_name",
+          minWidth: 180,
+        },
+        {
+          title: "账号",
+          key: "account",
+          minWidth: 100,
+        },
+		{
+		  title: "身份",
+		  key: "roles",
+		  minWidth: 60,
+		},
+      ],
+      loading2: false,
+      total2: 0,
+    };
+  },
+  computed: {
+    ...mapState('admin/layout', [
+        'isMobile'
+    ]),
+    labelWidth () {
+        return this.isMobile ? undefined : 96;
+    },
+    labelPosition () {
+        return this.isMobile ? 'top' : 'right';
+    }
+  },
+  created() {},
+  mounted() {
+    this.getListService();
+  },
+  methods: {
+    // 具体日期
+    onchangeTime(e) {
+      this.timeVal = e;
+      this.formValidate.data = this.timeVal[0] ? this.timeVal.join("-") : "";
+      this.getListService();
+    },
+    // 选择时间
+    selectChange(tab) {
+      this.formValidate.data = tab;
+      this.timeVal = [];
+      this.getListService();
+    },
+    // 客服列表
+    getListService() {
+      this.loading2 = true;
+      adminListApi(this.formValidate)
+        .then(async (res) => {
+          let data = res.data;
+          this.tableList2 = data.list;
+          this.total2 = data.count;
+          this.tableList2.map((item) => {
+            item._isChecked = false;
+          });
+          this.loading2 = false;
+        })
+        .catch((res) => {
+          this.loading2 = false;
+          this.$Message.error(res.msg);
+        });
+    },
+    pageChange2(pageIndex) {
+      this.formValidate.page = pageIndex;
+      this.getListService();
+    },
+    // 搜索
+    userSearchs() {
+      this.formValidate.page = 1;
+      this.getListService();
+    },
+  },
+};
+</script>
+
+<style scoped lang="stylus">
+.input-add {
+width: 250px;
+margin-right:14px
+}
+.tabBox_img
+    width 36px
+    height 36px
+    border-radius:4px;
+    cursor pointer
+    img
+        width 100%
+        height 100%
+.modelBox
+    >>>
+    .ivu-table-header
+        width 100% !important
+.trees-coadd
+    width: 100%;
+    height: 385px;
+    .scollhide
+        width: 100%;
+        height: 100%;
+        overflow-x: hidden;
+        overflow-y: scroll;
+.scollhide::-webkit-scrollbar {
+    display: none;
+}
+.footer{
+    margin: 15px 0;
+    padding-right: 20px;
+}
+</style>

+ 263 - 0
src/components/kfList/index.vue

@@ -0,0 +1,263 @@
+<template>
+<!-- 选择用户 -->
+  <div>
+    <Table
+      :loading="loading2"
+      highlight-row
+      no-userFrom-text="暂无数据"
+      no-filtered-userFrom-text="暂无筛选结果"
+      ref="selection"
+      :columns="columns4"
+      :data="tableList2"
+      height="500"
+    >
+      <template slot-scope="{ row, index }" slot="headimgurl">
+        <viewer>
+          <div class="tabBox_img">
+            <img v-lazy="row.headimgurl" />
+          </div>
+        </viewer>
+      </template>
+      <template slot-scope="{ row, index }" slot="user_type">
+        <span v-if="row.user_type === 'wechat'">公众号</span>
+        <span v-if="row.user_type === 'routine'">小程序</span>
+        <span v-if="row.user_type === 'h5'">H5</span>
+        <span v-if="row.user_type === 'pc'">PC</span>
+      </template>
+      <template slot-scope="{ row, index }" slot="sex">
+        <span v-show="row.sex === 1">男</span>
+        <span v-show="row.sex === 2">女</span>
+        <span v-show="row.sex === 0">保密</span>
+      </template>
+      <template slot-scope="{ row, index }" slot="country">
+        <span>{{ row.country + row.province + row.city }}</span>
+      </template>
+      <template slot-scope="{ row, index }" slot="subscribe">
+        <span v-text="row.subscribe === 1 ? '关注' : '未关注'"></span>
+      </template>
+    </Table>
+    <div class="acea-row row-right page">
+      <Page
+        :current="formValidate.page"
+        :total="total2"
+        show-elevator
+        show-total
+        @on-change="pageChange2"
+        :page-size="formValidate.limit"
+      />
+    </div>
+  </div>
+</template>
+<script>
+import { kefucreateApi,kefuListApi } from "@/api/setting";
+import template from "../../pages/setting/devise/template.vue";
+import timeOptions from "@/utils/timeOptions";
+import { mapState } from 'vuex';
+export default {
+  components: { template },
+  name: "index",
+  data() {
+    return {
+      formValidate: {
+        page: 1,
+        limit: 15,
+      },
+      tableList2: [],
+      timeVal: [],
+      options: timeOptions,
+      fromList: {
+        title: "选择时间",
+        custom: true,
+        fromTxt: [
+          { text: "全部", val: "" },
+          { text: "今天", val: "today" },
+          { text: "昨天", val: "yesterday" },
+          { text: "最近7天", val: "lately7" },
+          { text: "最近30天", val: "lately30" },
+          { text: "本月", val: "month" },
+          { text: "本年", val: "year" },
+        ],
+      },
+      currentid: 0,
+      productRow: {},
+      columns4: [
+        {
+          title: "选择",
+          key: "chose",
+          width: 60,
+          align: "center",
+          render: (h, params) => {
+            let uid = params.row.id;
+            let flag = false;
+            if (this.currentid === uid) {
+              flag = true;
+            } else {
+              flag = false;
+            }
+            let self = this;
+            return h("div", [
+              h("Radio", {
+                props: {
+                  value: flag,
+                },
+                on: {
+                  "on-change": () => {
+                    self.currentid = uid;
+                    this.productRow = params.row;
+                    if (this.productRow.uid) {
+                      if (this.$route.query.fodder === "image") {
+                        /* eslint-disable */
+                        let imageObject = {
+                          image: this.productRow.headimgurl,
+                          id: this.productRow.id,
+                        };
+                        form_create_helper.set("image", imageObject);
+                        form_create_helper.close("image");
+                      } else {
+                        this.$emit("imageObject", {
+                          image: this.productRow.headimgurl,
+                          id: this.productRow.id,
+						  name: this.productRow.nickname
+                        });
+                      }
+                    } else {
+                      // this.$Message.warning("请先选择商品");
+                    }
+                  },
+                },
+              }),
+            ]);
+          },
+        },
+        {
+          title: "ID",
+          key: "uid",
+          width: 80,
+        },
+        {
+          title: "微信用户名称",
+          key: "nickname",
+          minWidth: 180,
+        },
+        {
+          title: "客服头像",
+          slot: "headimgurl",
+          minWidth: 60,
+        },
+        {
+          title: "用户类型",
+          slot: "user_type",
+          minWidth: 100,
+        },
+        {
+          title: "性别",
+          slot: "sex",
+          minWidth: 60,
+        },
+        {
+          title: "地区",
+          slot: "country",
+          minWidth: 120,
+        },
+        {
+          title: "是否关注公众号",
+          slot: "subscribe",
+          width: 120,
+        },
+      ],
+      loading2: false,
+      total2: 0,
+    };
+  },
+  computed: {
+    ...mapState('admin/layout', [
+        'isMobile'
+    ]),
+    labelWidth () {
+        return this.isMobile ? undefined : 96;
+    },
+    labelPosition () {
+        return this.isMobile ? 'top' : 'right';
+    }
+  },
+  created() {},
+  mounted() {
+    this.getListService();
+  },
+  methods: {
+    // 具体日期
+    onchangeTime(e) {
+      this.timeVal = e;
+      this.formValidate.data = this.timeVal[0] ? this.timeVal.join("-") : "";
+      this.getListService();
+    },
+    // 选择时间
+    selectChange(tab) {
+      this.formValidate.data = tab;
+      this.timeVal = [];
+      this.getListService();
+    },
+    // 客服列表
+    getListService() {
+      this.loading2 = true;
+      kefuListApi(this.formValidate)
+        .then(async (res) => {
+          let data = res.data;
+          this.tableList2 = data.list;
+          this.total2 = data.count;
+          this.tableList2.map((item) => {
+            item._isChecked = false;
+          });
+          this.loading2 = false;
+        })
+        .catch((res) => {
+          this.loading2 = false;
+          this.$Message.error(res.msg);
+        });
+    },
+    pageChange2(pageIndex) {
+      this.formValidate.page = pageIndex;
+      this.getListService();
+    },
+    // 搜索
+    userSearchs() {
+      this.formValidate.page = 1;
+      this.getListService();
+    },
+  },
+};
+</script>
+
+<style scoped lang="stylus">
+.input-add {
+width: 250px;
+margin-right:14px
+}
+.tabBox_img
+    width 36px
+    height 36px
+    border-radius:4px;
+    cursor pointer
+    img
+        width 100%
+        height 100%
+.modelBox
+    >>>
+    .ivu-table-header
+        width 100% !important
+.trees-coadd
+    width: 100%;
+    height: 385px;
+    .scollhide
+        width: 100%;
+        height: 100%;
+        overflow-x: hidden;
+        overflow-y: scroll;
+.scollhide::-webkit-scrollbar {
+    display: none;
+}
+.footer{
+    margin: 15px 0;
+    padding-right: 20px;
+}
+</style>

+ 2 - 1
src/main.js

@@ -33,7 +33,7 @@ import ViewUI from 'view-design';
 import iViewPro from '@/libs/iview-pro/iview-pro.min.js';
 
 
-import { Tag, Tooltip, Popover, Input, Cascader, CascaderPanel,Tree } from 'element-ui'
+import { Tag, Tooltip, Popover, Input, Cascader, CascaderPanel,Tree ,DatePicker} from 'element-ui'
 Vue.use(Cascader)
 Vue.use(Tag)
 Vue.use(Tooltip)
@@ -41,6 +41,7 @@ Vue.use(Popover)
 Vue.use(Input)
 Vue.use(CascaderPanel)
 Vue.use(Tree)
+Vue.use(DatePicker)
 // 菜单和路由
 import router from './router';
 // import menuHeader from '@/menu/header';

+ 3 - 2
src/pages/erp/in/addInList.vue

@@ -83,7 +83,7 @@
 <script>
 	import { mapState,mapMutations } from "vuex";
 	import Setting from "@/setting";
-	import { getPurchaseId,batch_save,position,createRuku } from "@/api/erp";
+	import { getPurchaseId,batch_save,getPositionList,createRuku } from "@/api/erp";
 	import { formatDate } from "@/utils/validate";
 	export default {
 		name: "addInList",
@@ -233,6 +233,7 @@
 			},
 			//根据采购单号获取商品
 			getGoods() {
+				console.log('zhix');
 				getPurchaseId(this.formValidate.orderNumber).then(res => {
 					if(res.status == 200){
 						this.info = res.data
@@ -271,7 +272,7 @@
 			},
 			//获取仓位列表
 			getBin(){
-				position({
+				getPositionList({
 					page:1,
 					limit:10000,
 					wid:this.info.wid,

+ 321 - 91
src/pages/erp/purchase/addPurchase.vue

@@ -20,26 +20,26 @@
 		</div>
 
 		<Card :bordered="false" dis-hover class="ivu-mt">
-			<div class="new_tab" v-if="formValidate.id == 0">
+			<div class="new_tab" v-if="formValidate_0.id == 0">
 				<Tabs v-model="currentTab" @on-click="onClickTab">
 					<TabPane label="自建采购单" name="0" />
-					<TabPane label="库间流转" name="1" />
-					<TabPane label="商品在途" name="2" />
+					<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>
+			<Form v-if="currentTab == 0" class="formValidate mt20" ref="formValidate_0" :rules="ruleValidate"
+				:model="formValidate_0" :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"
+						<el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate_0.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
+						<Select v-model="formValidate_0.supplier_id" @on-change="userSearchsss" clearable
 							class="input-add">
 							<Option v-for="item in supplierList" :value="item.id" :key="item.id">
 								{{ item.supplier_name }}
@@ -48,8 +48,16 @@
 					</FormItem>
 					</Col>
 					<Col span="24">
+					<FormItem label="创建人:" prop="create_uid" v-if="formValidate_0.wid != 0 ">
+						<el-cascader placeholder="请选择创建人" class="input-add" size="mini"
+							v-model="formValidate_0.create_uid" :options="authList" :props="propsss" @change="checkAuth"
+							filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
 					<FormItem label="商品:" prop="goods">
-						<Table :columns="formValidate.id == 0 ?columns:columnss" :data="chooseGoods" ref="table"
+						<Table :columns="formValidate_0.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'"
@@ -81,24 +89,25 @@
 							</template> -->
 						</Table>
 						<Button type="primary" class="submission" style="margin-top:20px;" @click="getGoods()"
-							v-if="formValidate.id == 0">选择商品</Button>
+							v-if="formValidate_0.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 >
+			<Form v-if="currentTab == 1" class="formValidate mt20" ref="formValidate_1" :rules="ruleValidate"
+				:model="formValidate_1" :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"
+						<el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate_1.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
+						<Select v-model="formValidate_1.supplier_id" @on-change="userSearchsss" clearable
 							class="input-add">
 							<Option v-for="item in supplierList" :value="item.id" :key="item.id">
 								{{ item.supplier_name }}
@@ -107,12 +116,105 @@
 					</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">
+					<FormItem label="创建人:" prop="create_uid" v-if="formValidate_1.wid != 0 ">
+						<el-cascader placeholder="请选择创建人" class="input-add" size="mini"
+							v-model="formValidate_1.create_uid" :options="authList" :props="propsss" @change="checkAuth"
+							filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="审核人:" prop="purchasing_person_uid" v-if="formValidate_1.wid != 0 ">
+						<el-cascader placeholder="请选择审核人" class="input-add" size="mini"
+							v-model="formValidate_1.purchasing_person_uid" :options="authList" :props="propsss"
+							filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="商品:" prop="goods">
+						<Table :columns="formValidate_1.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" />
+								<!-- <Input v-model="goods[index].want_product_num" placeholder="请输入要货数量" v-width="'150'"
+									type="number" /> -->
+									{{row.want_product_num}}
+							</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>
+			<Form v-if="currentTab == 2" class="formValidate mt20" ref="formValidate_2" :rules="ruleValidate"
+				:model="formValidate_2" :label-width="labelWidth" :label-position="labelPosition"
+				@submit.native.prevent>
+				<Row :gutter="24" type="flex">
+					<Col span="24">
+					<FormItem label="要货单号:" prop="want_order_id" label-for="want_order_id">
+						<Input v-model="formValidate_2.want_order_id" placeholder="请输入要货单号" v-width="'250'"/>
+						<span class="addClass" @click="addClass" >确认</span>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="供应商:" prop="supplier_id" label-for="supplier_id">
+						<Select v-model="formValidate_2.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="create_uid" v-if="formValidate_2.wid != 0 ">
+						<el-cascader placeholder="请选择创建人" class="input-add" size="mini"
+							v-model="formValidate_2.create_uid" :options="authList" :props="propsss" @change="checkAuth"
+							filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="审核人:" prop="purchasing_person_uid" v-if="formValidate_2.wid != 0 ">
+						<el-cascader placeholder="请选择审核人" class="input-add" size="mini"
+							v-model="formValidate_2.purchasing_person_uid" :options="authList" :props="propsss"
+							filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="商品:" prop="goods">
+						<Table :columns="formValidate_2.id == 0 ?columns_2:columnss" :data="goodss" 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" /> -->
+									{{row.want_product_num}}
 							</template>
 							<template slot-scope="{ row,index }" slot="unit_type">
 								<Select v-model="goods[index].unit_type" style="width:200px">
@@ -149,7 +251,7 @@
 			:style="{ left: `${!menuCollapse ? '200px' : isMobile ? '0' : '80px'}` }">
 			<Form>
 				<FormItem>
-					<Button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</Button>
+					<Button type="primary" class="submission" @click="handleSubmit('formValidate_' + currentTab)">保存</Button>
 				</FormItem>
 			</Form>
 		</Card>
@@ -173,7 +275,8 @@
 		getOutGoods,
 		createPurchase,
 		getWantInfo,
-		getPurchaseGoods
+		getPurchaseGoods,
+		getWantList
 	} from "@/api/erp";
 	import {
 		keyApi,
@@ -200,7 +303,9 @@
 		},
 		data() {
 			return {
-				goods: [],
+				goodss: [],
+				chooseGoods_1: [], //汇总采购选中商品
+				goods: [], //汇总采购的商品列表
 				currentTab: 0,
 				supplierList: [],
 				loading: false,
@@ -268,6 +373,27 @@
 						minWidth: 150
 					},
 
+				],
+				columns_2: [ {
+					title: "ID",
+					key: "product_id",
+					minWidth: 90
+				},{
+						title: '商品名称',
+						key: 'product_name',
+						minWidth: 160
+					},
+					{
+						title: '数量',
+						slot: 'product_num',
+						minWidth: 90
+					},
+					{
+						title: '单位',
+						slot: 'unit_types',
+						minWidth: 150
+					},
+				
 				],
 				chooseGoods: [],
 				staffData: [],
@@ -302,11 +428,31 @@
 					sm: 24,
 					xs: 24,
 				},
-				formValidate: {
+				formValidate_0: {
+					id: 0,
+					wid: 0,
+					goods: [],
+					supplier_id: 0,
+					create_admin_id: 0,
+					create_uid: 0
+				},
+				formValidate_1: {
 					id: 0,
 					wid: 0,
 					goods: [],
-					supplier_id: 0
+					supplier_id: 0,
+					create_admin_id:0,
+					create_uid: 0,
+					purchasing_person_uid: 0
+				},
+				formValidate_2: {
+					id: 0,
+					wid: 0,
+					supplier_id: 0,
+					create_admin_id:0,
+					create_uid: 0,
+					purchasing_person_uid: 0,
+					want_order_id: '',
 				},
 				ruleValidate: {
 					supplier_id: [{
@@ -321,12 +467,17 @@
 						message: "请选择仓库",
 						trigger: "blur"
 					}, ],
-					// create_uid: [{
-					// 	type: "number",
-					// 	required: true,
-					// 	message: "请选择创建人",
-					// 	trigger: "blur"
-					// }, ],
+					create_uid: [{
+						type: "number",
+						required: true,
+						message: "请选择创建人",
+						trigger: "blur"
+					}, ],
+					want_order_id: [{
+						required: true,
+						message: "请选择要货单号",
+						trigger: "blur"
+					}, ],
 					// goods: [{
 					// 	type: "array",
 					// 	required: true,
@@ -357,20 +508,54 @@
 		},
 		methods: {
 			...mapMutations("admin/layout", ["setCopyrightShow"]),
+			addClass() {
+				if(this.formValidate_2.want_order_id) {
+					getWantInfo(this.formValidate_2.want_order_id).then(res => {
+						if(res.data && res.data.id) {
+							let data = res.data
+							this.formValidate_2.wid = data.wid
+							this.goodss = data.info
+							this.getUserList(data.wid)
+						}else {
+							return this.$Message.error(res.msg);
+						}
+						// console.log(res);
+						// if(res.data.data.length > 0) {
+						// 	this.goodss = res.data.data[0].info
+						// }else {
+						// 	 return this.$Message.error('请输入正确的要货单号');
+						// }
+					})
+				}else {
+					 return this.$Message.error('请输入要货单号');
+				}
+				
+			},
 			change(e) {
 				console.log(e);
+				this.chooseGoods_1 = e
+			},
+			checkAuth(e) {
+				if (e) {
+					let obj = this.authList.find(item => item.id == e)
+					console.log(e,'check',obj);
+					this['formValidate_' +this.currentTab].create_admin_id = obj.admin_id
+				}
+
 			},
 			chooseWid(e) {
 				this.goods = []
-				if(e) {
+				this.chooseGoods_1 = []
+				if (e) {
 					getPurchaseGoods({
 						wid: e
 					}).then(res => {
 						this.goods = res.data[0].data
-						console.log(this.goods,'params');
+						console.log(this.goods, 'params');
 					})
+					this.getUserList(this.formValidate_1.wid)
 				}
-				
+
 			},
 			onClickTab(e) {
 				console.log(e);
@@ -389,14 +574,14 @@
 			getWantInfo(id) {
 				getWantInfo(id).then(res => {
 					let data = res.data
-					this.formValidate.id = data.id
-					this.formValidate.create_uid = data.create_uid
+					this.formValidate_0.id = data.id
+					this.formValidate_0.create_uid = data.create_uid
 					this.chooseGoods = data.info
-					this.formValidate.store_id = data.store_id
+					this.formValidate_0.store_id = data.store_id
 					if (data.wid) {
-						this.formValidate.type = 0
-						this.formValidate.wid = data.wid
-						this.getUserList()
+						this.formValidate_0.type = 0
+						this.formValidate_0.wid = data.wid
+						this.getUserList(this.formValidate_0.wid)
 					}
 				})
 			},
@@ -429,7 +614,7 @@
 				this.chooseGoods = this.chooseGoods.concat(this.resetGoods(e, 're'))
 			},
 			getGoods() {
-				if (this.formValidate.wid == 0) {
+				if (this.formValidate_0.wid == 0) {
 					return this.$Message.error('请选择仓库');
 				}
 				this.$refs.goodDetail.clearChoose()
@@ -437,9 +622,9 @@
 				this.$refs.goodDetail.formValidate.type = 0
 				this.$refs.goodDetail.formValidate.wid = this.formValidate.wid
 			},
-			getUserList() {
+			getUserList(id) {
 				getUserList({
-					wid: this.formValidate.wid
+					wid: id
 				}).then(res => {
 					// console.log(res);
 					this.authList = res.data.data
@@ -464,27 +649,10 @@
 			},
 			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_0 = res.data
+					this.formValidate_0.addressSelect = this.formValidate_0.addressSelect.map(item => item * 1)
+					console.log(this.formValidate_0.addressSelect);
 				})
-				this.formValidate.address = (selectedData.map(o => o.label)).join('/')
-				// console.log('this.formValidate.addressSelect',this.formValidate.addressSelect);
-
 			},
 			cityInfo(data) {
 				cityApi(data).then(res => {
@@ -523,10 +691,10 @@
 
 			},
 			userSearchss(e) {
-				this.formValidate.create_uid = "";
+				this.formValidate_0.create_uid = "";
 				this.authList = []
 				this.goods = []
-				this.getUserList()
+				this.getUserList(this.formValidate_0.wid)
 			},
 			// 处理goods数据
 			handleGoods(list) {
@@ -553,41 +721,97 @@
 					item.unit_name = item.info['unit_name' + (item.unit_type == 0 ? '' : (item.unit_type == 1 ?
 						"_1" : "_2"))]
 					return item
+				}).filter(item => {
+					return item.product_num != 0
 				})
 			},
 			handleSubmit(name) {
-				if(this.currentTab == 0) {
-					if (this.formValidate.id == 0) {
-						this.formValidate.goods = this.handleGoods(this.chooseGoods)
+				console.log('开始');
+				if (this.currentTab == 0) {
+					if (this.formValidate_0.id == 0) {
+						this.formValidate_0.goods = this.handleGoods(this.chooseGoods)
+						if(this.formValidate_0.goods.length == 0) {
+							return this.$Message.error('请选择商品并填写采购数量');
+						}
 					} else {
-						this.formValidate.goods = this.chooseGoods
+						this.formValidate_0.goods = this.chooseGoods
+					}
+				} else if(this.currentTab == 1) {
+					console.log('汇总采购商品');
+					this.formValidate_1.goods = this.chooseGoods_1.filter(item => item.want_product_num != 0).map(item=>{
+						item.product_num = item.want_product_num
+						return item
+					})
+					if(this.formValidate_1.goods.length == 0) {
+						return this.$Message.error('请选择商品并填写采购数量');
 					}
-				}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("请输入参数模板名称");
-					}
-				});
+				try{
+					this.$refs[name].validate((valid) => {
+						if (valid) {
+							console.log('校验结束');
+							// this.formValidate.id = this.$route.query.id;
+							let pdata = {}
+							if (this.currentTab == 0) {
+								console.log('自建采购');
+								try {
+									pdata = {
+										id: this.$route.query.id,
+										wid: this.formValidate_0.wid,
+										products: this.formValidate_0.goods,
+										supplier_id: this.formValidate_0.supplier_id,
+										create_uid: this.formValidate_0.create_uid,
+										create_admin_id: this.formValidate_0.create_admin_id
+									}
+								} catch (e) {
+									//TODO handle the exception
+									console.log(e, '错误');
+								}
+							}else if(this.currentTab == 1) {
+								console.log('汇总采购');
+								pdata = {
+									id: this.$route.query.id,
+									wid: this.formValidate_1.wid,
+									goods_ids: this.formValidate_1.goods.map(item => item.product_id).join(','),
+									supplier_id: this.formValidate_1.supplier_id,
+									create_uid: this.formValidate_1.create_uid,
+									create_admin_id: this.formValidate_1.create_admin_id,
+									purchasing_person_uid: this.formValidate_1.purchasing_person_uid,
+								}
+								console.log('pdata',pdata);
+							}else if(this.currentTab == 2) {
+								console.log('要货单审核');
+								if(this.formValidate_2.wid == 0) {
+									return this.$Message.error('请确认要货单');
+								}
+								pdata = {
+									id: this.$route.query.id, 
+									supplier_id: this.formValidate_2.supplier_id,
+									create_uid: this.formValidate_2.create_uid,
+									create_admin_id: this.formValidate_2.create_admin_id,
+									purchasing_person_uid: this.formValidate_2.purchasing_person_uid,
+									want_order_id: this.formValidate_2.want_order_id,
+									wid: this.formValidate_2.wid
+								}
+							}
+							createPurchase(pdata.id, pdata).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("请输入参数模板名称");
+						}
+					});
+				}catch(e){
+					console.log('err',e);
+					//TODO handle the exception
+				}
+				
 			},
 		},
 	};
@@ -665,4 +889,10 @@
 	.ml16 {
 		margin-left: 16px;
 	}
+	.addClass {
+		color: #1890FF;
+		margin-left 14px;
+		padding 9px 0;
+		cursor pointer;
+	}
 </style>

+ 210 - 57
src/pages/erp/purchase/index.vue

@@ -131,11 +131,15 @@
 					<Tag color="warning" v-if="row.status == 2">部分完成</Tag>
 				</template>
 				<template slot-scope="{ row, index }" slot="action">
-					<a @click="edit(row)">编辑</a>
+					<a @click="look(row)">详情</a>
+	<!-- 				<Divider type="vertical" v-if="row.status == 0" />
+					<a @click="edit(row)" v-if="row.status == 0">编辑</a> -->
+					<Divider type="vertical" v-if="row.status == 0" />
+					<a @click="pass(row)" v-if="row.status == 0">审核</a>
+					<Divider type="vertical" v-if="row.status == 1" />
+					<a @click="end(row)" v-if="row.status == 1">完成</a>
 					<Divider type="vertical" />
-					<a @click="pass(row)">审核</a>
-					<Divider type="vertical" />
-					<a @click="del(row, '删除仓位', index)">删除</a>
+					<a @click="del(row, '删除采购单', index)">删除</a>
 				</template>
 			</Table>
 			<div class="acea-row row-right page">
@@ -143,53 +147,72 @@
 					: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 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>
+		<purchaseDetail ref="purchaseDetail"></purchaseDetail>
+		<Modal v-model="modalend" scrollable title="完成采购单" class="order_box" :closable="false" :mask-closable="false"
+			width="1090">
+			<Form ref="endobj" :model="endobj" :label-width="80" @submit.native.prevent>
+				<FormItem label="审核人:">
+					<Select v-model="endobj.purchasing_person_uid" clearable filterable @on-change="userSearchsess" class="input-add">
+						<Option v-for="item in authLists" :value="item.id" :key="item.id">{{ item.staff_name }}
+						</Option>
+					</Select>
+				</FormItem>
+			</Form>
+			<Table :columns="endobj.columns" :data="list" :loading="endobj.loading" highlight-row
+				no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果" class="ivu-mt">
+				<template slot-scope="{ row, index }" slot="pur_num">
+					<Input v-model="list[index].pur_num" placeholder="请输入采购数量" v-width="'120'" type="number" />
+				</template>
+				<template slot-scope="{ row, index }" slot="total_price">
+					<Input v-model="list[index].total_price" placeholder="请输入净重" v-width="'120'" type="number" />
+				</template>
+				<template slot-scope="{ row, index }" slot="net_weight">
+					<Input v-model="list[index].net_weight" placeholder="请输入净重" v-width="'120'" type="number" />
+				</template>
+				<template slot-scope="{ row, index }" slot="tare_weight">
+					<Input v-model="list[index].tare_weight" placeholder="请输入净重" v-width="'120'" type="number" />
+				</template>
+				
+			</Table>
+			<div slot="footer">
+				<Button type="primary" @click="putRemark1()">提交</Button>
+				<Button @click="cancel1()">取消</Button>
+			</div>
 		</Modal>
 	</div>
 </template>
 
 <script>
+	import purchaseDetail from './purchaseDetail.vue'
 	import {
 		mapState
 	} from "vuex";
@@ -204,7 +227,9 @@
 		getPurchaselist,
 		getGodownList,
 		getUserList,
-		sevePurchase
+		sevePurchase,
+		savePurchase,
+		getPurchaseDetail
 	} from "@/api/erp";
 	import {
 		formatDate
@@ -217,8 +242,14 @@
 	import {
 		staffListInfo
 	} from "@/api/store";
+	import {
+		toJSONSchema
+	} from 'mockjs';
 	export default {
 		name: "purchaseList",
+		components: {
+			purchaseDetail
+		},
 		filters: {
 			formatDate(time) {
 				if (time !== 0) {
@@ -229,6 +260,56 @@
 		},
 		data() {
 			return {
+				list: [],
+				endobj: {
+					id:0,
+					purchasing_person_admin_id: "",
+					purchasing_person_uid: "",
+					loading: false,
+					columns: [{
+							title: "ID",
+							key: "id",
+							width: 80,
+						},
+						{
+							title: "商品名称",
+							key: "product_name",
+							width: 200,
+						},
+						{
+							title: "预采购数量",
+							key: "product_num",
+							width: 90,
+						},
+						{
+							title: "单位",
+							key: "unit_name",
+							width: 80,
+						},
+						{
+							title: "实际采购数量",
+							slot: "pur_num",
+							width: 150,
+						},
+						{
+							title: "总价格",
+							slot: "total_price",
+							width: 150,
+						},
+
+						{
+							title: "净重",
+							slot: "net_weight",
+							width: 150,
+						},
+						{
+							title: "皮重",
+							slot: "tare_weight",
+							width: 150,
+						},
+					]
+				},
+				modalend: false,
 				modalpass: false,
 				remarks: {
 					id: 0,
@@ -239,7 +320,7 @@
 					purchasing_person_uid: ""
 				},
 				authLists: [],
-				data1:[],
+				data1: [],
 				staffData: [],
 				supplierList: [],
 				roterPre: Setting.roterPre,
@@ -298,7 +379,7 @@
 					},
 					{
 						title: "创建人消息",
-						slot: "auser",
+						slot: "cuser",
 						minWidth: 200,
 					},
 					{
@@ -355,19 +436,87 @@
 			this.getGodownList()
 		},
 		methods: {
+			end(row) {
+				// console.log(row);
+				this.endobj.id = row.id
+				this.endobj.purchase_order_id = row.purchase_order_id
+				getPurchaseDetail(row.purchase_order_id).then(res => {
+					this.list = res.data.info.map(item => {
+						let obj = {}
+						obj.is_weigh = item.is_weigh
+						obj.net_weight = item.net_weight
+						obj.product_id = item.product_id;
+						obj.pur_num = item.pur_num ? item.pur_num*1: 0
+						obj.rate = item.unit_type == 1?item.p_unit_rate_1:item.unit_type == 2?item.p_unit_rate_2:1
+						obj.shelf_life = item.shelf_list
+						obj.tare_weight = item.tare_weight
+						obj.total_price = item.total_price
+						obj.id = item.id
+						obj.product_name = item.product_name
+						obj.product_num = item.product_num
+						obj.unit_name = item.unit_name
+						obj.shelf_life = item.shelf_life
+						console.log(obj);
+						return obj
+					})
+					getUserList({
+						wid: row.wid
+					}).then(res => {
+						this.authLists = res.data.data
+					})
+					this.modalend = true
+				})
+				
+			},
 			putRemark() {
-				sevePurchase(this.remarks.id,this.remarks).then(res => {
+				sevePurchase(this.remarks.id, this.remarks).then(res => {
 					this.cancel()
 					this.getList();
 				})
 			},
+			putRemark1() {
+				// console.log(this.list);
+				let arr = this.list.map(item => {
+					if(item.is_weigh == 0) {
+						item.pur_weigh = item.pur_num * 1 * item.rate
+					}else {
+						item.pur_weigh = item.tare_weight * 1 + item.net_weight * 1
+					}
+					return item
+				})
+				console.log('arr',arr);
+				savePurchase(this.endobj.id,{
+					info: arr,
+					purchasing_person_admin_id: this.endobj.purchasing_person_admin_id,
+					purchasing_person_uid: this.endobj.purchasing_person_uid,
+					is_system: 0,
+				}).then(res => {
+					this.modalend = false
+					this.getList()
+					this.cancel1()
+					this.$Message.success(res.msg);
+				}).catch(err => {
+					this.$Message.error(err.msg);
+				})
+			},
+			look(row) {
+				this.$refs.purchaseDetail.getInfo(row.id);
+			},
 			cancel() {
 				this.remarks = {
-					id:0,
+					id: 0,
 					status: '',
 					auth_uid: "",
-					auth_admin_id: "",}
-					this.modalpass = false
+					auth_admin_id: "",
+				}
+				this.modalpass = false
+			},
+			cancel1() {
+				this.modalend = false
+				this.endobj.id=0
+				this.endobj.purchasing_person_admin_id= ""
+				this.endobj.purchasing_person_uid=""
+				this.list = []
 			},
 			userSearchse(e) {
 				let auth = this.authLists.find(item => item.id == e)
@@ -377,11 +526,15 @@
 				let auth = this.authLists.find(item => item.id == e)
 				this.remarks.purchasing_person_admin_id = auth.admin_id
 			},
+			userSearchsess(e) {
+				let auth = this.authLists.find(item => item.id == e)
+				this.endobj.purchasing_person_admin_id = auth.admin_id
+			},
 			pass(row) {
 				let qdata = {}
-				if(row.wid) {
+				if (row.wid) {
 					qdata.wid = row.wid
-				}else {
+				} else {
 					qdata.store_id = row.store_id
 				}
 				this.authLists = []
@@ -408,7 +561,7 @@
 			userSearchs(e) {
 				console.log('zhix');
 				this.tableFrom.page = 1;
-				
+
 				this.getList();
 			},
 			userSearchss(e) {
@@ -489,7 +642,7 @@
 				let delfromData = {
 					title: tit,
 					num: num,
-					url: `/erp/Warehouse/position_del/${row.id}`,
+					url: `/erp/purchase/del/${row.id}`,
 					method: "DELETE",
 					ids: "",
 				};

+ 454 - 0
src/pages/erp/purchase/purchaseDetail.vue

@@ -0,0 +1,454 @@
+<template>
+	<Drawer :closable="false" width="1000" class-name="order_box" v-model="modals" :styles="{ padding: 0 }">
+
+		<Card :bordered="false" dis-hover class="ivu-mt">
+			<Tabs v-model="activeName">
+				<TabPane v-for="(item, index) in list" :key="index" :label="item.label" :name="item.val">
+					<template v-if="item.val === 'info'">
+						<Table :columns="columns" :data="info.info" ref="table" 
+							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>
+								<span
+									v-if="row.coupon_type==2">{{parseFloat(row.coupon_price)/10}}折({{row.coupon_price.toString().split(".")[0]}}%)</span>
+							</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>
+					</template>
+					<template v-if="item.val === 'base'">
+						<Row :gutter="24" type="flex">
+							<Col span="24" v-if="info.ware && info.ware.id">
+							<div class="tit">仓库:</div>
+							<div class="info-list">
+								<div>ID:<span>{{info.ware.id}}</span></div>
+								<div>名称:<span>{{info.ware.title}}</span></div>
+								<div>手机号码:<span>{{info.ware.phone}}</span></div>
+								<div>地址:{{info.ware.detailed_address}}</div>
+							</div>
+							</Col>
+							<Col span="24">
+							<div class="tit">供应商:</div>
+							<div class="info-list">
+								<div>ID:<span>{{info.supplier.id}}</span></div>
+								<div>名称:<span>{{info.supplier.supplier_name}}</span></div>
+								<div>手机号码:<span>{{info.supplier.phone}}</span></div>
+							</div>
+							</Col>
+							<Col span="24">
+							<div class="tit">创建人:</div>
+							<div class="info-list">
+								<div>ID:<span>{{info.cuser.id}}</span></div>
+								<div>名称:<span>{{info.cuser.staff_name}}</span></div>
+								<div>手机号码:<span>{{info.cuser.phone}}</span></div>
+							</div>
+							</Col>
+						</Row>
+					</template>
+				</TabPane>
+			</Tabs>
+		</Card>
+	</Drawer>
+
+</template>
+
+<script>
+	import {
+		getGodownList,
+		createUser,
+		getUserInfo,
+		getPurchaseInfo
+	} from "@/api/erp";
+	import Setting from "@/setting";
+
+	export default {
+		name: 'purchaseDetail',
+		data() {
+			return {
+				info: {},
+				roterPre: Setting.roterPre,
+				psInfo: {},
+				modals: false,
+				activeName: 'base',
+				list: [{
+						val: 'base',
+						label: '基础信息'
+					},{
+						val: 'info',
+						label: '商品信息'
+					},
+					
+				],
+				ckColumns: [
+					{
+						title: "ID",
+						key: "id",
+						width: 80,
+					},
+					{
+						title: "title",
+						key: "title",
+						width: 200,
+					},
+				],
+				columns: [{
+					title: "ID",
+					key: "id",
+					width: 80,
+				},
+				{
+					title: "商品名称",
+					key: "product_name",
+					width: 200,
+				},
+				{
+					title: "采购数量0",
+					key: "product_num",
+					width: 150,
+				},
+				{
+					title: "采购数量1",
+					key: "pur_num",
+					width: 150,
+				},
+				{
+					title: "单位",
+					key: "unit_name",
+					width: 150,
+				},
+				{
+					title: "净重",
+					key: "net_weight",
+					width: 80,
+				},
+				{
+					title: "皮重",
+					key: "tare_weight",
+					width: 80,
+				},
+				{
+					title: "总重",
+					key: "pur_weight",
+					width: 80,
+				},
+				 ]
+			}
+		},
+		watch: {
+
+		},
+		created() {},
+		methods: {
+			deit() {
+				this.$router.push({
+					path: this.roterPre + "/erp/user_add?id=" + this.formValidate.id
+				});
+			},
+			getInfo(id) {
+				getPurchaseInfo(id).then(res => {
+					console.log(res, 'res');
+					this.modals = true
+					this.info = res.data
+				}).catch(err => {
+					this.modals = false
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+	/deep/.ivu-modal-body {
+		padding: 0;
+	}
+
+	.user-info {
+		// padding: 15px;
+	}
+
+	.user-row {
+		padding: 30px 35px 0;
+
+		&-text {
+			flex: 1;
+			align-self: center;
+		}
+
+		&-action {
+
+			.ivu-btn {
+				margin-left: 12px;
+				font-size: 13px !important;
+				color: rgba(0, 0, 0, 0.85);
+
+				&:first-child {
+					margin-left: 0;
+				}
+
+				&.ivu-btn-primary {
+					border-color: #1890FF;
+					background-color: #1890FF;
+					color: #FFFFFF;
+				}
+
+				&.ivu-btn-success {
+					border-color: #00C050;
+					background-color: #00C050;
+					color: #FFFFFF;
+				}
+			}
+		}
+
+		.nickname {
+			font-weight: 500;
+			font-size: 16px;
+			line-height: 16px;
+			color: rgba(0, 0, 0, 0.85);
+		}
+
+		.iconfont {
+			margin-left: 7px;
+			font-size: 18px;
+
+			&:nth-child(2) {
+				margin-left: 9px;
+			}
+
+			&.iconxiaochengxu {
+				color: #007DFF;
+			}
+
+			&.icongongzhonghao {
+				color: #00BF00;
+			}
+
+			&.iconPC {
+				color: #F69B00;
+			}
+
+			&.iconh5 {
+				color: #9F5CE3;
+			}
+
+			&.iconapp {
+				color: #E36734;
+			}
+		}
+
+		.level {
+			margin-top: 5px;
+
+			img {
+				width: 42px;
+				height: 20px;
+				vertical-align: middle;
+
+				+span {
+					margin-left: 7px;
+				}
+			}
+
+			.vip {
+				display: inline-block;
+				width: 56px;
+				height: 26px;
+				padding-left: 30px;
+				// background: url("../../../../assets/images/vip-bg.png") left top/100% 100% no-repeat;
+				font-weight: bold;
+				font-size: 9px;
+				line-height: 26px;
+				color: #5F7DB5;
+				transform-origin: left;
+				transform: scale(0.75, 0.75);
+				vertical-align: middle;
+			}
+		}
+	}
+
+	.info-row {
+		flex-wrap: nowrap;
+		padding: 20px 35px 24px;
+
+		&-item {
+			flex: none;
+			width: 155px;
+			font-size: 14px;
+			line-height: 14px;
+			color: rgba(0, 0, 0, 0.85);
+
+			&-title {
+				margin-bottom: 12px;
+				font-size: 13px;
+				line-height: 13px;
+				color: #666666;
+			}
+		}
+	}
+
+	.ivu-tabs {
+		color: rgba(0, 0, 0, 0.85);
+
+		/deep/ .ivu-tabs-bar {
+			border-bottom: 0;
+			margin-bottom: 0;
+			background-color: #F5F7FA;
+
+			.ivu-tabs-nav-container {
+				font-size: 13px;
+			}
+
+			.ivu-tabs-ink-bar {
+				display: none;
+			}
+
+			.ivu-tabs-tab {
+				padding: 7px 19px !important;
+				margin-right: 0;
+				line-height: 26px;
+			}
+
+			.ivu-tabs-tab-active {
+				background-color: #FFFFFF;
+				color: rgba(0, 0, 0, 0.85);
+
+				&:before {
+					content: "";
+					position: absolute;
+					top: 0;
+					left: 0;
+					width: 100%;
+					height: 2px;
+					background-color: #1890FF;
+				}
+			}
+		}
+
+		/deep/ .ivu-tabs-content {
+			.ivu-tabs-tabpane {
+				padding: 15px 15px !important;
+
+				&:first-child {
+					padding: 0 25px !important;
+				}
+			}
+		}
+
+		.product {
+			display: flex;
+
+			.image {
+				width: 50px;
+				height: 50px;
+			}
+
+			img {
+				width: 100%;
+				height: 100%;
+				border-radius: 4px;
+			}
+
+			.title {
+				flex: 1;
+				padding-left: 13px;
+				text-align: left;
+			}
+		}
+	}
+
+	.avatar {
+		width: 60px;
+		height: 60px;
+		border-radius: 50%;
+		overflow: hidden;
+
+		img {
+			width: 100%;
+			height: 100%;
+		}
+	}
+
+	.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: 13px;
+						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>
+<style scoped lang="stylus">
+	.user_menu>>>.ivu-menu {
+		width 100% !important;
+	}
+
+	/deep/ .ivu-form-item {
+		margin: 20px 0 0 0 !important;
+	}
+
+	.info-list {
+		display: flex;
+		flex-wrap: wrap;
+		padding: 0 0 0 20px;
+
+		div {
+			width: 50%
+		}
+	}
+
+	.tit {
+		font-weight: bold;
+		padding: 20px 0 10px 0;
+	}
+</style>

+ 620 - 0
src/pages/erp/user/addUser.vue

@@ -0,0 +1,620 @@
+<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/user` }">
+						<!-- <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.query.id !== '0' ? '编辑用户' : '添加用户'
+            " class="mr20 ml16"></span>
+				</div>
+			</PageHeader>
+		</div>
+		<Card :bordered="false" dis-hover class="ivu-mt">
+			<Form class="formValidate mt20" ref="formValidate" :rules="ruleValidate" :model="formValidate"
+				:label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
+				<Row :gutter="24" type="flex">
+					<FormItem label="用户头像:" prop="avatar" v-if="avshow">
+						<Row>
+							<Col span="24">
+							<div v-if="formValidate.avatar" class="upload-list">
+								<div class="upload-item">
+									<img v-lazy="formValidate.avatar" />
+									<Button shape="circle" icon="ios-close" @click="delImage"></Button>
+								</div>
+							</div>
+							<Button v-else class="upload-select" type="dashed" icon="ios-add"
+								@click="modalPicTap('dan', 'avatar', 1)"></Button>
+							</Col>
+						</Row>
+						<Row>
+							<Col class="tips">
+							建议上传大小:宽200px,高200px
+							</Col>
+						</Row>
+					</FormItem>
+					<Col span="24">
+					<FormItem label="用户名称:" prop="staff_name">
+						<Input v-model="formValidate.staff_name" placeholder="请输入用户名称" v-width="'400'" />
+					</FormItem>
+					</Col>
+					<!-- is_manager -->
+					<Col span="24">
+					<FormItem label="是否管理:">
+						<i-switch v-model="formValidate.is_manager" :true-value="1" :false-value="0" size="large">
+							<span slot="open">是</span>
+							<span slot="close">否</span>
+						</i-switch>
+					</FormItem>
+					</Col>
+					<!-- is_system -->
+					<Col span="24">
+					<FormItem label="是否系统用户:">
+						<i-switch v-model="formValidate.is_system" :true-value="1" :false-value="0" size="large">
+							<span slot="open">是</span>
+							<span slot="close">否</span>
+						</i-switch>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="登录账号:" prop="account" v-if="formValidate.id == 0">
+						<Input v-model="formValidate.account" placeholder="请输入账号" v-width="'400'" />
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="登录密码:" prop="pwd" label-for="pwd" v-if="formValidate.id == 0">
+						<Input v-model="formValidate.pwd" placeholder="请输入登录密码" v-width="'400'" type="password" />
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="绑定用户:" prop="nickname" label-for="nickname" v-if="ushow">
+						<Input v-model="formValidate.nickname" @on-clear="clearSpread" clearable placeholder="请选择商城用户"
+							icon="ios-arrow-down" @on-focus="editSpread" v-width="'400'" @on-blur="showUser"></Input>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="绑定客服:" prop="kefu" label-for="kefu" v-if="kshow">
+						<Input v-model="formValidate.kefu" @on-clear="clearSpreadKefu" clearable placeholder="请选择客服"
+							icon="ios-arrow-down" @on-focus="editSpreadKefu" v-width="'400'"
+							@on-blur="showKefu"></Input>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="绑定后台:" prop="admin_name" label-for="admin_name" v-if="ashow">
+						<Input v-model="formValidate.admin_name" @on-clear="clearSpreadAdmin" clearable
+							placeholder="请选择后台账号" icon="ios-arrow-down" @on-focus="editSpreadAdmin" v-width="'400'"
+							@on-blur="showAdmin"></Input>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="所属仓库:" prop="wid">
+						<el-cascader placeholder="请选择所属仓库" class="input-add" size="mini" v-model="formValidate.wid"
+							:options="data1" :props="props" @change="userSearchs" filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="所属门店:" prop="store_id">
+						<el-cascader placeholder="请选择所属门店" class="input-add" size="mini" v-model="formValidate.store_id"
+							:options="staffData" :props="propss" @change="userSearchs" filterable clearable
+							v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
+					<Col span="24">
+					<FormItem label="手机号码:" prop="phone">
+						<Input v-model="formValidate.phone" placeholder="请输入手机号码" v-width="'400'" />
+					</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>
+		<Modal v-model="customerShow" scrollable title="请选择商城用户" :closable="false" width="900">
+			<customerInfo v-if="customerShow" @imageObject="imageObject"></customerInfo>
+		</Modal>
+		<Modal v-model="adminShow" scrollable title="请选择商城用户" :closable="false" width="900">
+			<adminList v-if="adminShow" @imageObject="imageObjectAdmin"></adminList>
+		</Modal>
+		<Modal v-model="kefuShow" scrollable title="请选择绑定客服" :closable="false" width="900">
+			<kefuList v-if="kefuShow" @imageObject="imageObjectKefu"></kefuList>
+		</Modal>
+		<Modal v-model="modalPic" width="960px" scrollable footer-hide closable title="上传用户头像" :mask-closable="false"
+			:z-index="500">
+			<uploadPictures isChoice="单选" @getPic="getPic" :gridBtn="gridBtn" :gridPic="gridPic" v-if="modalPic">
+			</uploadPictures>
+		</Modal>
+	</div>
+</template>
+
+<script>
+	import customerInfo from "@/components/customerInfo";
+	import kefuList from "@/components/kfList";
+	import adminList from "@/components/adminList";
+	import uploadPictures from "@/components/uploadPictures";
+	import {
+		mapState,
+		mapMutations
+	} from "vuex";
+	import {
+		getGodownList,
+		createUser,
+		getUserInfo
+	} from "@/api/erp";
+	import {
+		keyApi,
+		storeGetInfoApi,
+		cityApi,
+		storeUpdateApi,
+		cascaderList,
+		staffListInfo
+	} from '@/api/store';
+	import {
+		productSpecs,
+		productSpecsInfo
+	} from "@/api/product";
+	import Setting from "@/setting";
+	export default {
+		name: "userAdd",
+		components: {
+			uploadPictures,
+			customerInfo,
+			kefuList,
+			adminList
+		},
+		data() {
+			return {
+				avshow: true,
+				ushow: true,
+				customerShow: false,
+				kshow: true,
+				kefuShow: false,
+				ashow: true,
+				adminShow: false,
+				modalPic: false,
+				propss: {
+					emitPath: false,
+					multiple: false,
+					checkStrictly: true,
+					value: "id",
+					label: "name"
+				},
+				addresData: [],
+				props: {
+					emitPath: false,
+					multiple: false,
+					checkStrictly: true,
+					value: "id",
+					label: "title"
+				},
+				roterPre: Setting.roterPre,
+				data1: [],
+				grid: {
+					xl: 7,
+					lg: 7,
+					md: 12,
+					sm: 24,
+					xs: 24,
+				},
+				formValidate: {
+					avatar: "",
+					uid: 0,
+					nickname: "",
+					id: 0,
+					account: "",
+					wid: 0,
+					staff_name: "",
+					store_id: 0,
+					is_manager: 0,
+					pwd: "",
+					phone: "",
+					kefu: "",
+					staff_id: 0,
+					admin_name: "",
+					is_system: 0,
+					admin_id: 0
+				},
+				gridBtn: {
+					xl: 4,
+					lg: 8,
+					md: 8,
+					sm: 8,
+					xs: 8,
+				},
+				gridPic: {
+					xl: 6,
+					lg: 8,
+					md: 12,
+					sm: 12,
+					xs: 12,
+				},
+				staffData: [],
+				ruleValidate: {
+					nickname: [{
+						required: true,
+						message: "请选择绑定用户",
+						trigger: "blur"
+					}],
+					kefu: [{
+						required: true,
+						message: "请选择绑定客服",
+						trigger: "blur"
+					}],
+					admin_name: [{
+						required: true,
+						message: "请选择绑定后台账号",
+						trigger: "blur"
+					}],
+					avatar: [{
+						required: true,
+						message: "请上传用户头像",
+						trigger: "blur"
+					}],
+					staff_name: [{
+						required: true,
+						message: "请输入用户名称",
+						trigger: "blur"
+					}],
+					account: [{
+						required: true,
+						message: "请输入登录账号",
+						trigger: "blur"
+					}, ],
+					store_id: [{
+						type: "number",
+						required: true,
+						message: "请选择门店",
+						trigger: "blur"
+					}],
+					wid: [{
+						type: "number",
+						required: true,
+						message: "请选择仓库",
+						trigger: "blur"
+					}],
+					pwd: [{
+						required: true,
+						message: '请输入登录密码',
+						trigger: 'blur'
+					}],
+					phone: [{
+						required: true,
+						message: '请输入手机号码',
+						trigger: 'blur',
+					}, ],
+				},
+			};
+		},
+		computed: {
+			...mapState("admin/layout", ["isMobile", "menuCollapse"]),
+			labelWidth() {
+				return this.isMobile ? undefined : 120;
+			},
+			labelPosition() {
+				return this.isMobile ? "top" : "right";
+			},
+		},
+		created() {
+			// let data = {
+			// 	pid: 0
+			// }
+			// this.cityInfo(data);
+		},
+		mounted() {
+			// this.setCopyrightShow({
+			// 	value: false
+			// });
+			this.getGodownList()
+			this.staffList()
+			console.log('this.$route.query.id != 0', this.$route.query.id != 0);
+			if (this.$route.query.id != 0) {
+				this.getUserInfo(this.$route.query.id)
+			}
+		},
+		destroyed() {
+			// this.setCopyrightShow({
+			// 	value: true
+			// });
+		},
+		methods: {
+			...mapMutations("admin/layout", ["setCopyrightShow"]),
+			getUserInfo(id) {
+				console.log('hhh');
+				getUserInfo(id).then(res => {
+					console.log('zje', res);
+					let data = res.data
+					this.formValidate = {
+						uid: data.user.uid,
+						nickname: data.user.nickname,
+						id: id,
+						account: data.account,
+						wid: data.ware.id,
+						staff_name: data.staff_name,
+						store_id: data.store.id,
+						is_manager: data.is_manager,
+						pwd: "",
+						phone: data.phone,
+						kefu: data.staff.nickname,
+						staff_id: data.staff.id,
+						admin_name: data.admin.real_name,
+						is_system: data.is_system + '',
+						admin_id: data.admin.id,
+						avatar: data.avatar
+					}
+
+				})
+			},
+			imageObject(e) {
+				this.customerShow = false;
+				this.formValidate.uid = e.uid;
+				this.formValidate.nickname = e.name
+			},
+			imageObjectKefu(e) {
+				this.kefuShow = false;
+				this.formValidate.staff_id = e.id;
+				this.formValidate.kefu = e.name
+			},
+			imageObjectAdmin(e) {
+				this.adminShow = false;
+				console.log(e);
+				this.formValidate.admin_id = e.id;
+				this.formValidate.level = e.level;
+				this.formValidate.admin_name = e.name
+			},
+			showUser() {
+				this.ushow = true
+			},
+			showKefu() {
+				this.kshow = true
+			},
+			showAdmin() {
+				this.ashow = true
+			},
+			clearSpread() {
+				this.formValidate.uid = 0;
+				this.formValidate.nickname = '';
+				this.ushow = true
+			},
+			clearSpreadKefu() {
+				this.formValidate.staff_id = 0;
+				this.formValidate.kefu = '';
+				this.kshow = true
+			},
+			clearSpreadAdmin() {
+				this.formValidate.admin_id = 0;
+				this.formValidate.admin_name = '';
+				this.formValidate.level = 0
+				this.ashow = true
+			},
+			editSpread() {
+				this.customerShow = true;
+				this.ushow = false
+			},
+			editSpreadKefu() {
+				this.kefuShow = true;
+				this.kshow = false
+			},
+			editSpreadAdmin() {
+				this.adminShow = true;
+				this.ashow = false
+			},
+			getPic(pic) {
+				this.modalPic = false;
+				this.formValidate.avatar = pic.att_dir;
+				this.avshow = true
+				this.$refs.formValidate.validateField('image');
+			},
+			delImage() {
+				this.formValidate.avatar = "";
+				this.$refs.formValidate.validateField('image');
+				this.avshow = true
+			},
+			modalPicTap() {
+				this.modalPic = true;
+				this.avshow = false
+			},
+			staffList() {
+				staffListInfo()
+					.then((res) => {
+						this.staffData = res.data
+					})
+					.catch((err) => {
+						this.$Message.error(err.msg);
+					});
+			},
+			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
+				})
+			},
+			del(index) {
+				this.data.splice(index, 1);
+			},
+			userSearchs(e) {
+
+			},
+			handleSubmit(name) {
+				this.$refs[name].validate((valid) => {
+					if (valid) {
+						this.formValidate.id = this.$route.query.id;
+						let qdata = {}
+						createUser(this.formValidate.id, this.formValidate).then(res => {
+							this.$Message.success(res.msg);
+							this.$router.push({
+								path: this.roterPre + "/erp/user"
+							});
+						}).catch(err => {
+							this.$Message.error(err.msg);
+						})
+						console.log('this.formValidate:', this.formValidate);
+					} 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;
+	}
+
+	.upload-list {
+		display: inline-block;
+		margin: 0 0 -10px 0;
+
+		.upload-item {
+			position: relative;
+			display: inline-block;
+			width: 64px;
+			height: 64px;
+			border: 1px dashed #DDDDDD;
+			border-radius: 4px;
+			margin: 0 15px 10px 0;
+		}
+
+		img {
+			width: 64px;
+			height: 64px;
+			border-radius: 4px;
+			vertical-align: middle;
+		}
+
+		.ivu-btn {
+			position: absolute;
+			top: 0;
+			right: 0;
+			width: 20px;
+			height: 20px;
+			margin: -10px -10px 0 0;
+		}
+	}
+
+	.upload-select {
+		width: 64px;
+		height: 64px;
+		font-size: 35px !important;
+		background #f5f5f5;
+		color #ccc;
+	}
+</style>

+ 48 - 78
src/pages/erp/user/index.vue

@@ -6,49 +6,16 @@
 				<!-- 查询条件 -->
 				<Form ref="tableFrom" inline :model="tableFrom" :label-width="labelWidth"
 					:label-position="labelPosition" @submit.native.prevent>
-					<!-- <FormItem label="创建时间:" label-for="user_time">
-            <DatePicker
-                :editable="false"
-                @on-change="onchangeTime"
-                :value="timeVal"
-                format="yyyy/MM/dd"
-                type="datetimerange"
-                placement="bottom-start"
-                placeholder="自定义时间"
-                class="mr20 input-add"
-                :options="options"
-            ></DatePicker>
-          </FormItem> -->
-					<!-- <FormItem label="上架状态:">
-            <Select
-                placeholder="请选择"
-                clearable
-                class="input-add"
-                v-model="tableFrom.is_show"
-            >
-              <Option value="1">上架</Option>
-              <Option value="0">下架</Option>
-            </Select>
-          </FormItem> -->
 					<FormItem label="用户搜索:" label-for="store_name">
 						<Input class="input-add mr14" placeholder="请输入用户昵称/手机号" v-model="tableFrom.key" />
 						<Button type="primary" @click="tableSearchs()">查询</Button>
 					</FormItem>
-					<!-- <Button
-            v-auth="['marketing-store_seckill-create']"
-            type="primary"
-            icon="md-add"
-            @click="addMore"
-            class="mr10"
-            >批量添加积分商品</Button
-          > -->
-					<!--<Button v-auth="['export-storeSeckill']" class="export" icon="ios-share-outline" @click="exports">导出</Button>-->
 				</Form>
 			</div>
 		</Card>
 		<Card :bordered="false" dis-hover class="ivu-mt">
 			<!-- 操作 -->
-			<Button v-auth="['marketing-store_seckill-create']" type="primary" @click="add" class="mr10">添加用户</Button>
+			<Button v-auth="['admin-erp-user_add']" type="primary" @click="add" class="mr10">添加用户</Button>
 			<!-- 积分商品-表格 -->
 			<Table :columns="columns1" :data="tableList" :loading="loading" highlight-row no-userFrom-text="暂无数据"
 				no-filtered-userFrom-text="暂无筛选结果" class="ivu-mt">
@@ -65,6 +32,9 @@
 				<template slot-scope="{ row, index }" slot="is_system">
 					<span> {{ row.is_system ? '是': '否'}}</span>
 				</template>
+				<template slot-scope="{ row, index }" slot="is_manager">
+					<span> {{ row.is_manager ? '是': '否'}}</span>
+				</template>
 				<template slot-scope="{ row, index }" slot="is_show">
 					<i-switch v-model="row.is_show" :value="row.is_show" :true-value="1" :false-value="0"
 						@on-change="onchangeIsShow(row)" size="large">
@@ -73,9 +43,9 @@
 					</i-switch>
 				</template>
 				<template slot-scope="{ row, index }" slot="action">
-					<a @click="edit(row)">详情</a>
-					<!-- <Divider type="vertical" />
-					<a @click="del(row, '删除积分商品', index)">删除</a> -->
+					<a @click="look(row)">详情</a>
+					<Divider type="vertical" />
+					<a @click="edit(row)">编辑</a>
 				</template>
 			</Table>
 			<div class="acea-row row-right page">
@@ -83,10 +53,12 @@
 					:page-size="tableFrom.limit" />
 			</div>
 		</Card>
+		<userDetails ref="userDetails"></userDetails>
 	</div>
 </template>
 
 <script>
+	import userDetails from './userDetails.vue'
 	import {
 		mapState
 	} from "vuex";
@@ -105,7 +77,10 @@
 	import timeOptions from "@/utils/timeOptions";
 	import Setting from "@/setting";
 	export default {
-		name: "storeIntegral",
+		name: "erpUser",
+		components: {
+			userDetails
+		},
 		filters: {
 			formatDate(time) {
 				if (time !== 0) {
@@ -144,41 +119,46 @@
 						key: "phone",
 						minWidth: 90,
 					},
-					{
-						title: "级别",
-						key: "level",
-						minWidth: 80,
-					},
-					{
-						title: "管理员id",
-						key: "admin_id",
-						minWidth: 80,
-					},
+					// {
+					// 	title: "级别",
+					// 	key: "level",
+					// 	minWidth: 80,
+					// },
+					// {
+					// 	title: "管理员id",
+					// 	key: "admin_id",
+					// 	minWidth: 80,
+					// },
 					{
 						title: "是否系统用户",
 						slot: "is_system",
 						minWidth: 80,
 					},
 					{
-						title: '仓库id',
-						key: 'wid',
-						minWidth: 80,
-					},
-					{
-						title: '客户id',
-						key: 'staff_id',
+						title: "是否管理",
+						slot: "is_manager",
 						minWidth: 80,
 					},
+					// {
+					// 	title: '仓库id',
+					// 	key: 'wid',
+					// 	minWidth: 80,
+					// },
+					// {
+					// 	title: '客户id',
+					// 	key: 'staff_id',
+					// 	minWidth: 80,
+					// },
 					{
 						title: "创建时间",
 						slot: "add_time",
 						minWidth: 130,
 					},
-					{
-						title: "状态",
-						key: "status",
-						minWidth: 100,
-					},
+					// {
+					// 	title: "状态",
+					// 	key: "status",
+					// 	minWidth: 100,
+					// },
 					{
 						title: "操作",
 						slot: "action",
@@ -219,15 +199,14 @@
 			this.getList();
 		},
 		methods: {
+			look(row) {
+				// this.$refs.userDetails.modals = true;
+				this.$refs.userDetails.getUserInfo(row.id);
+			},
 			// 添加
 			add() {
 				this.$router.push({
-					path: this.roterPre + "/marketing/store_integral/create"
-				});
-			},
-			addMore() {
-				this.$router.push({
-					path: this.roterPre + "/marketing/store_integral/add_store_integral",
+					path: this.roterPre + "/erp/user_add?id=0"
 				});
 			},
 			orderList(row) {
@@ -256,18 +235,9 @@
 			},
 			// 编辑
 			edit(row) {
-				try{
-					getUserInfo(row.id).then(res=> {
-						console.log(res)
-					})
-				}catch(e){
-					//TODO handle the exception
-					console.log('zhje',e);
-				}
-				
-				// this.$router.push({
-				// 	path: this.roterPre + "/marketing/store_integral/create/" + row.id + "/0",
-				// });
+				this.$router.push({
+					path: this.roterPre + "/erp/user_add?id=" + row.id,
+				});
 			},
 			// 一键复制
 			copy(row) {

+ 406 - 0
src/pages/erp/user/userDetails.vue

@@ -0,0 +1,406 @@
+<template>
+	<Drawer :closable="false" width="1000" class-name="order_box" v-model="modals" :styles="{ padding: 0 }">
+		<div class="acea-row user-row">
+			<div class="avatar mr15">
+				<img :src="psInfo.avatar">
+			</div>
+			<div class="user-row-text">
+				<div>
+					<span class="nickname">账号:{{ psInfo.account || '-' }} ( {{psInfo.staff_name || '-'}} ) </span>
+				</div>
+				<span class="nickname">手机号码:{{ psInfo.phone || '-' }}</span>
+			</div>
+			<div class="user-row-action">
+				<Button type="primary" v-auth="['admin-erp-user_add']" @click="deit">编辑</Button>
+			</div>
+		</div>
+		<Card :bordered="false" dis-hover class="ivu-mt">
+			<Form class="formValidate mt20" ref="formValidate" :model="formValidate" @submit.native.prevent>
+				<Row :gutter="24" type="flex">
+					<Col span="24">
+					<div class="tit">绑定用户:</div>
+					<div class="info-list">
+						<div>ID:<span>{{psInfo.user.uid}}</span></div>
+						<div>昵称:<span>{{psInfo.user.nickname}}</span></div>
+						<div>用户类型:<span>{{psInfo.user.user_type}}</span></div>
+					</div>
+					</Col>
+					<Col span="24">
+					<div class="tit">绑定客服:</div>
+					<div class="info-list">
+						<div>ID:<span>{{psInfo.staff.id}}</span></div>
+						<div>名称:<span>{{psInfo.staff.nickname}}</span></div>
+						<div>手机号码:<span>{{psInfo.staff.phone}}</span></div>
+					</div>
+					
+					</Col>
+					<Col span="24">
+					<div class="tit">绑定后台:</div>
+					<div class="info-list">
+						<div>ID:<span>{{psInfo.admin.id}}</span></div>
+						<div>账号:{{psInfo.admin.account}}</div>
+						<div>名称:<span>{{psInfo.admin.real_name}}</span></div>
+						<div>手机号码:<span>{{psInfo.admin.phone}}</span></div>
+					</div>
+					</Col>
+					<Col span="24">
+					<div class="tit">所属仓库:</div>
+					<div class="info-list">
+						<div>ID:<span>{{psInfo.ware.id}}</span></div>
+						<div>名称:<span>{{psInfo.ware.title}}</span></div>
+						<div>手机号码:<span>{{psInfo.ware.phone}}</span></div>
+						<div>地址:{{psInfo.ware.detailed_address}}</div>
+					</div>
+					</Col>
+				</Row>
+			</Form>
+		</Card>
+	</Drawer>
+
+</template>
+
+<script>
+	import {
+		getGodownList,
+		createUser,
+		getUserInfo
+	} from "@/api/erp";
+	import Setting from "@/setting";
+
+	export default {
+		name: 'erpUserDetails',
+		data() {
+			return {
+				roterPre: Setting.roterPre,
+				psInfo: {},
+				modals: false,
+				formValidate: {
+					avatar: "",
+					uid: 0,
+					nickname: "",
+					id: 0,
+					account: "",
+					wid: 0,
+					staff_name: "",
+					store_id: 0,
+					is_manager: 0,
+					pwd: "",
+					phone: "",
+					kefu: "",
+					staff_id: 0,
+					admin_name: "",
+					is_system: 0,
+					admin_id: 0
+				},
+			}
+		},
+		watch: {
+
+		},
+		created() {},
+		methods: {
+			deit() {
+				this.$router.push({
+					path: this.roterPre + "/erp/user_add?id=" + this.formValidate.id
+				});
+			},
+			getUserInfo(id) {
+				getUserInfo(id).then(res => {
+					let data = res.data
+					this.psInfo = data
+						
+						this.modals = true;
+					
+
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+	/deep/.ivu-modal-body {
+		padding: 0;
+	}
+
+	.user-info {
+		// padding: 15px;
+	}
+
+	.user-row {
+		padding: 30px 35px 0;
+
+		&-text {
+			flex: 1;
+			align-self: center;
+		}
+
+		&-action {
+
+			.ivu-btn {
+				margin-left: 12px;
+				font-size: 13px !important;
+				color: rgba(0, 0, 0, 0.85);
+
+				&:first-child {
+					margin-left: 0;
+				}
+
+				&.ivu-btn-primary {
+					border-color: #1890FF;
+					background-color: #1890FF;
+					color: #FFFFFF;
+				}
+
+				&.ivu-btn-success {
+					border-color: #00C050;
+					background-color: #00C050;
+					color: #FFFFFF;
+				}
+			}
+		}
+
+		.nickname {
+			font-weight: 500;
+			font-size: 16px;
+			line-height: 16px;
+			color: rgba(0, 0, 0, 0.85);
+		}
+
+		.iconfont {
+			margin-left: 7px;
+			font-size: 18px;
+
+			&:nth-child(2) {
+				margin-left: 9px;
+			}
+
+			&.iconxiaochengxu {
+				color: #007DFF;
+			}
+
+			&.icongongzhonghao {
+				color: #00BF00;
+			}
+
+			&.iconPC {
+				color: #F69B00;
+			}
+
+			&.iconh5 {
+				color: #9F5CE3;
+			}
+
+			&.iconapp {
+				color: #E36734;
+			}
+		}
+
+		.level {
+			margin-top: 5px;
+
+			img {
+				width: 42px;
+				height: 20px;
+				vertical-align: middle;
+
+				+span {
+					margin-left: 7px;
+				}
+			}
+
+			.vip {
+				display: inline-block;
+				width: 56px;
+				height: 26px;
+				padding-left: 30px;
+				// background: url("../../../../assets/images/vip-bg.png") left top/100% 100% no-repeat;
+				font-weight: bold;
+				font-size: 9px;
+				line-height: 26px;
+				color: #5F7DB5;
+				transform-origin: left;
+				transform: scale(0.75, 0.75);
+				vertical-align: middle;
+			}
+		}
+	}
+
+	.info-row {
+		flex-wrap: nowrap;
+		padding: 20px 35px 24px;
+
+		&-item {
+			flex: none;
+			width: 155px;
+			font-size: 14px;
+			line-height: 14px;
+			color: rgba(0, 0, 0, 0.85);
+
+			&-title {
+				margin-bottom: 12px;
+				font-size: 13px;
+				line-height: 13px;
+				color: #666666;
+			}
+		}
+	}
+
+	.ivu-tabs {
+		color: rgba(0, 0, 0, 0.85);
+
+		/deep/ .ivu-tabs-bar {
+			border-bottom: 0;
+			margin-bottom: 0;
+			background-color: #F5F7FA;
+
+			.ivu-tabs-nav-container {
+				font-size: 13px;
+			}
+
+			.ivu-tabs-ink-bar {
+				display: none;
+			}
+
+			.ivu-tabs-tab {
+				padding: 7px 19px !important;
+				margin-right: 0;
+				line-height: 26px;
+			}
+
+			.ivu-tabs-tab-active {
+				background-color: #FFFFFF;
+				color: rgba(0, 0, 0, 0.85);
+
+				&:before {
+					content: "";
+					position: absolute;
+					top: 0;
+					left: 0;
+					width: 100%;
+					height: 2px;
+					background-color: #1890FF;
+				}
+			}
+		}
+
+		/deep/ .ivu-tabs-content {
+			.ivu-tabs-tabpane {
+				padding: 15px 15px !important;
+
+				&:first-child {
+					padding: 0 25px !important;
+				}
+			}
+		}
+
+		.product {
+			display: flex;
+
+			.image {
+				width: 50px;
+				height: 50px;
+			}
+
+			img {
+				width: 100%;
+				height: 100%;
+				border-radius: 4px;
+			}
+
+			.title {
+				flex: 1;
+				padding-left: 13px;
+				text-align: left;
+			}
+		}
+	}
+
+	.avatar {
+		width: 60px;
+		height: 60px;
+		border-radius: 50%;
+		overflow: hidden;
+
+		img {
+			width: 100%;
+			height: 100%;
+		}
+	}
+
+	.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: 13px;
+						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>
+<style scoped lang="stylus">
+	.user_menu>>>.ivu-menu {
+		width 100% !important;
+	}
+
+	/deep/ .ivu-form-item {
+		margin: 20px 0 0 0 !important;
+	}
+	.info-list {
+		display: flex;
+		flex-wrap: wrap;
+		padding:0 0 0 20px;
+		div {
+			width: 50%
+		}
+	}
+	.tit {
+		font-weight: bold;
+		padding: 20px 0 10px 0;
+	}
+</style>

+ 70 - 38
src/pages/erp/want/addWant.vue

@@ -13,7 +13,7 @@
 						</div>
 					</router-link>
 					<span v-text="
-              $route.params.id !== '0' ? '编辑要货单' : '添加要货单'
+              $route.query.id !== '0' ? '编辑要货单' : '添加要货单'
             " class="mr20 ml16"></span>
 				</div>
 			</PageHeader>
@@ -22,6 +22,14 @@
 			<Form 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="my_store_id">
+						<el-cascader placeholder="请选择到货门店" class="input-add" size="mini"
+							v-model="formValidate.my_store_id" :options="staffData" :props="propss"
+							@change="userSearchse" filterable clearable v-width="'400'">
+						</el-cascader>
+					</FormItem>
+					</Col>
 					<Col span="24">
 					<FormItem label="要货途径:" prop="control">
 						<RadioGroup v-model="formValidate.type">
@@ -51,18 +59,11 @@
 						</el-cascader>
 					</FormItem>
 					</Col>
+					
 					<Col span="24">
-					<FormItem label="到货门店:" prop="my_store_id">
-						<el-cascader placeholder="请选择到货门店" class="input-add" size="mini"
-							v-model="formValidate.my_store_id" :options="staffData" :props="propss"
-							@change="userSearchs" filterable clearable v-width="'400'">
-						</el-cascader>
-					</FormItem>
-					</Col>
-					<Col span="24">
-					<FormItem label="创建人:" prop="create_uid" v-if="formValidate.wid != 0">
+					<FormItem label="创建人:" prop="create_uid" v-if="formValidate.my_store_id != 0 ">
 						<el-cascader placeholder="请选择创建人" class="input-add" size="mini"
-							v-model="formValidate.create_uid" :options="authList" :props="propsss" @change="userSearchs"
+							v-model="formValidate.create_uid" :options="authList" :props="propsss" @change="userSearchsss"
 							filterable clearable v-width="'400'">
 						</el-cascader>
 					</FormItem>
@@ -250,6 +251,7 @@
 					goods: [],
 					my_store_id: 0,
 					create_uid: 0,
+					create_admin_id: 0,
 				},
 				ruleValidate: {
 					store_id: [{
@@ -329,7 +331,14 @@
 					if(data.wid) {
 						this.formValidate.type = 0
 						this.formValidate.wid = data.wid
-						this.getUserList()
+						this.getUserList({
+							wid: this.formValidate.wid
+						})
+					}else {
+						this.formValidate.type = 1
+						this.getUserList({
+							store_id: this.formValidate.store_id
+						})
 					}
 				})
 			},
@@ -366,39 +375,47 @@
 				console.log(this.chooseGoods, 'this.chooseGoods');
 			},
 			getGoods() {
-				console.log(this.chooseGoods, 'this.chooseGoods555');
-				if ((this.formValidate.wid || this.formValidate.store_id) && this.formValidate.my_store_id) {
-					this.$refs.goodDetail.clearChoose()
-					this.$refs.goodDetail.modals = true;
+				try{
 					this.$refs.goodDetail.formValidate.type = this.formValidate.type
-					this.$refs.goodDetail.formValidate.wid = this.formValidate.wid
 					this.$refs.goodDetail.formValidate.my_store_id = this.formValidate.my_store_id
-					this.$refs.goodDetail.formValidate.store_id = this.formValidate.store_id
-				} else {
-					console.log('this.formValidate.my_store_id', this.formValidate.my_store_id);
-					try {
-						if (this.formValidate.wid == 0 && this.formValidate.type == 0) {
-							return this.$Message.error('请选择要货仓库');
-						}
-						if (this.formValidate.store_id == 0 && this.formValidate.type == 1) {
-							return this.$Message.error('请选择要货门店');
+					if(this.formValidate.my_store_id == 0) {
+						return this.$Message.error('请选择到货门店');
+					}
+					if(this.formValidate.type == 1) {
+						if(this.formValidate.store_id == 0) {
+							return this.$Message.error('请选择出货门店');
+						}else {
+							if(this.formValidate.store_id == this.formValidate.my_store_id) {
+								return this.$Message.error('请选择出货门店和到货门店不能一致');
+							}
+							this.$refs.goodDetail.clearChoose()
+							this.$refs.goodDetail.formValidate.wid = 0
+							this.$refs.goodDetail.modals = true
+							this.$refs.goodDetail.formValidate.my_store_id = this.formValidate.my_store_id
+							this.$refs.goodDetail.formValidate.store_id = this.formValidate.store_id
+							this.$refs.goodDetail.getList()
 						}
-						if (!this.formValidate.my_store_id) {
-							console.log('ddd');
-							return this.$Message.error('请选择到货门店');
+					}else {
+						if(this.formValidate.wid == 0) {
+							return this.$Message.error('请选择出货仓库');
+						}else {
+							this.$refs.goodDetail.clearChoose()
+							this.$refs.goodDetail.formValidate.wid = this.formValidate.wid
+							this.$refs.goodDetail.formValidate.my_store_id = this.formValidate.my_store_id
+							this.$refs.goodDetail.formValidate.store_id = 0
+							this.$refs.goodDetail.modals = true
+							this.$refs.goodDetail.getList()
 						}
-					} catch (e) {
-						console.log(e);
-						//TODO handle the exception
 					}
-
+				}catch(e){
+					//TODO handle the exception
+					console.log('err',e);
 				}
-
-				// this.$refs.goodDetail.getList();
+				
 			},
 			getUserList() {
 				getUserList({
-					wid: this.formValidate.wid
+					store_id: this.formValidate.my_store_id
 				}).then(res => {
 					// console.log(res);
 					this.authList = res.data.data
@@ -475,15 +492,29 @@
 			del(index) {
 				this.chooseGoods.splice(index, 1);
 			},
+			userSearchse(e) {
+				this.formValidate.create_uid = "";
+				this.authList = []
+				this.getUserList()
+			},
 			userSearchs(e) {
-
+				this.formValidate.wid = 0
+				this.goods = []
 			},
 			userSearchss(e) {
 				this.formValidate.create_uid = "";
+				this.formValidate.store_id = 0
 				this.authList = []
 				this.goods = []
 				this.getUserList()
 			},
+			userSearchsss(e) {
+				if(e) {
+					let obj = this.authList.find(item => item.id == e)
+					this.formValidate.create_admin_id = obj.admin_id
+				}
+				
+			},
 			handleSubmit(name) {
 				if(this.formValidate.id == 0) {
 					let arr = []
@@ -522,7 +553,8 @@
 							store_id: this.formValidate.store_id,
 							my_store_id: this.formValidate.my_store_id,
 							goods: this.formValidate.goods,
-							create_uid: this.formValidate.create_uid
+							create_uid: this.formValidate.create_uid,
+							create_admin_id: this.formValidate.create_admin_id
 						}).then(res => {
 							this.$Message.success(res.msg);
 							this.$router.push({

+ 2 - 2
src/pages/erp/want/goodDetail.vue

@@ -90,7 +90,7 @@
 						minWidth: 200
 					},
 					{
-						title: '仓库库存',
+						title: '出货门店/仓库库存',
 						slot: 'product_num',
 						minWidth: 150
 					},
@@ -124,8 +124,8 @@
 		methods: {
 			clearChoose() {
 				this.chooseGoods = []
+				this.tabList = []
 				this.$refs.table.selectAll(false);
-				
 			},
 			change(e) {
 				this.chooseGoods = e

+ 19 - 5
src/pages/erp/want/index.vue

@@ -118,6 +118,15 @@
 						</div>
 					</div>
 				</template>
+				<template slot-scope="{ row, index }" slot="mystore">
+					<viewer style="display: flex;">
+						<div class="tabBox_img">
+							<img v-lazy="row.mystore.image" />
+						</div>
+						<div>门店:{{row.mystore.name}}<br>ID:{{row.mystore.id}}</div>
+					</viewer>
+
+				</template>
 				<template slot-scope="{ row, index }" slot="store">
 					<viewer style="display: flex;">
 						<div class="tabBox_img">
@@ -125,7 +134,7 @@
 						</div>
 						<div>门店:{{row.store.name}}<br>ID:{{row.store.id}}</div>
 					</viewer>
-
+				
 				</template>
 				<template slot-scope="{ row, index }" slot="is_system">
 					<span> {{ row.is_system ? '是': '否'}}</span>
@@ -197,9 +206,9 @@
 			  	class="input-add">
 			  	<Option :value="1" >通过</Option>
 				<Option :value="-1" >拒绝</Option>
-				<Option :value="2" >部分完成</Option>
+				<!-- <Option :value="2" >部分完成</Option>
 				<Option :value="3" >完成</Option>
-				<Option :value="-2" >无效</Option>
+				<Option :value="-2" >无效</Option> -->
 			  </Select>
 			</FormItem>
 		  </Form>
@@ -300,10 +309,15 @@
 						minWidth: 300,
 					},
 					{
-						title: "门店信息",
+						title: "出货门店",
 						slot: "store",
 						minWidth: 200,
 					},
+					{
+						title: "要货门店",
+						slot: "mystore",
+						minWidth: 200,
+					},
 					{
 						title: "创建人",
 						slot: "cuser",
@@ -572,7 +586,7 @@
 		height: 36px;
 		border-radius: 4px;
 		cursor: pointer;
-
+		margin-right: 10px;
 		img {
 			width: 100%;
 			height: 100%;

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

@@ -29,6 +29,15 @@ export default {
 			},
 			component: () => import('@/pages/erp/user/index')
 		},
+		{
+			path:'user_add',
+			name: `${pre}user_add`,
+			meta: {
+				auth: ['admin-erp-user_add'],
+				title: '添加编辑用户'
+			},
+			component: () => import('@/pages/erp/user/addUser')
+		},
 		{
 			path:'purchase_list',
 			name: `${pre}purchase_list`,