|
|
@@ -0,0 +1,963 @@
|
|
|
+<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/out_list` }">
|
|
|
+ <!-- <Button icon="ios-arrow-back" size="small" class="mr20"
|
|
|
+ >返回</Button
|
|
|
+ > -->
|
|
|
+ <div class="font-sm after-line">
|
|
|
+ <span class="iconfont iconfanhui"></span>
|
|
|
+ <span class="pl10">返回</span>
|
|
|
+ </div>
|
|
|
+ </router-link>
|
|
|
+ <span v-text="
|
|
|
+ $route.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="formValidate.id == 0?ruleValidate:ruleValidate1" :model="formValidate"
|
|
|
+ :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
|
|
|
+ <Row :gutter="24" type="flex">
|
|
|
+ <!-- <Col span="24">
|
|
|
+ <FormItem label="调出类型:" prop="outType">
|
|
|
+ <RadioGroup v-model="formValidate.outType" @on-change="changeOutType">
|
|
|
+ <Radio :label="0" :disabled="formValidate.id != 0">
|
|
|
+ <Icon type="social-apple"></Icon>
|
|
|
+ <span>仓库</span>
|
|
|
+ </Radio>
|
|
|
+ <Radio :label="1" :disabled="formValidate.id != 0">
|
|
|
+ <Icon type="social-android"></Icon>
|
|
|
+ <span>门店</span>
|
|
|
+ </Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </FormItem>
|
|
|
+ </Col> -->
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="调出仓库:" prop="wid" v-if="formValidate.outType == 0">
|
|
|
+ <el-cascader placeholder="请选择调出仓库" class="input-add" size="mini" v-model="formValidate.wid"
|
|
|
+ :options="data1" :props="props" @change="checkOutWare" filterable clearable v-width="'400'" :disabled="formValidate.id != 0">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="调出门店:" prop="wid" v-if="formValidate.outType == 1">
|
|
|
+ <el-cascader placeholder="请选择调出门店" class="input-add" size="mini" v-model="formValidate.store_id"
|
|
|
+ :options="staffData" :props="propss" @change="checkOutWare" filterable clearable
|
|
|
+ v-width="'400'" :disabled="formValidate.id != 0">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <!-- <Col span="24">
|
|
|
+ <FormItem label="调入类型:" prop="inType">
|
|
|
+ <RadioGroup v-model="formValidate.inType">
|
|
|
+ <Radio :label="0" :disabled="formValidate.id != 0">
|
|
|
+ <Icon type="social-apple"></Icon>
|
|
|
+ <span>仓库</span>
|
|
|
+ </Radio>
|
|
|
+ <Radio :label="1" :disabled="formValidate.id != 0">
|
|
|
+ <Icon type="social-android"></Icon>
|
|
|
+ <span>门店</span>
|
|
|
+ </Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </FormItem>
|
|
|
+ </Col> -->
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="调入仓库:" prop="to_wid" v-if="formValidate.inType == 0">
|
|
|
+ <el-cascader placeholder="请选择调入仓库" class="input-add" size="mini" v-model="formValidate.to_wid"
|
|
|
+ :options="data1" :props="props" filterable clearable v-width="'400'" :disabled="formValidate.id != 0">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="调入门店:" prop="to_store_id" v-if="formValidate.inType == 1">
|
|
|
+ <el-cascader placeholder="请选择到货门店" class="input-add" size="mini"
|
|
|
+ v-model="formValidate.to_store_id" :options="staffData" :props="propss" filterable clearable
|
|
|
+ v-width="'400'" :disabled="formValidate.id != 0">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="创建人:" prop="create_uid" v-if="formValidate.wid != 0 || formValidate.store_id != 0">
|
|
|
+ <el-cascader placeholder="请选择创建人" class="input-add" size="mini"
|
|
|
+ v-model="formValidate.create_uid" :options="authList" :props="propsss"
|
|
|
+ @change="userSearchsss" filterable clearable v-width="'400'" :disabled="formValidate.id != 0">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="商品:" prop="goods">
|
|
|
+ <!-- <Table :columns="formValidate.id == 0 ?columns:columnss" :data="chooseGoods" ref="table" :loading="loading"
|
|
|
+ no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果">
|
|
|
+ <template slot-scope="{ row,index }" slot="pur_number">
|
|
|
+ <Input v-model="chooseGoods[index].pur_number" placeholder="请输入数量" v-width="'150'" type="number" />
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="weight">
|
|
|
+ <Input v-model="chooseGoods[index].weight" placeholder="请输入重量" v-width="'150'" type="number" />
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="unit_type" >
|
|
|
+ <Select v-model="chooseGoods[index].unit_type" style="width:200px" >
|
|
|
+ <Option v-for="item in row.unitList" :value="item.value" :key="item.value">
|
|
|
+ {{ item.label }}</Option>
|
|
|
+ </Select>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="unit_types">
|
|
|
+ {{row.unit_name}}
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="store_num">
|
|
|
+ <span> {{ row.my.stock }}{{row.my.unit_name}}</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="action">
|
|
|
+ <a @click="del(index)">删除</a>
|
|
|
+ </template>
|
|
|
+ </Table> -->
|
|
|
+ <Card>
|
|
|
+ <div class="user-info" v-for="(goods,gindex) in chooseGoods">
|
|
|
+ <Button type="primary" @click="delGood(gindex)" class="del-btn">删除</Button>
|
|
|
+ <div class="section-hd">{{goods.name}}</span> </div>
|
|
|
+ <div v-if="goods.batch.length > 0" v-for="(item,index) in goods.batch" class="section">
|
|
|
+ <div class="section-bd">
|
|
|
+ <div class="item">
|
|
|
+ <div>批次编号:</div>
|
|
|
+ <div class="value">{{ item.batch_code || '/'}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div>库存:</div>
|
|
|
+ <div class="value">{{ item.product_num}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div>单位:</div>
|
|
|
+ <div class="value">{{ item.unit_name}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div>数量:</div>
|
|
|
+ <div class="value"><Input
|
|
|
+ v-model="chooseGoods[gindex].batch[index].pur_number"
|
|
|
+ placeholder="请输入数量" v-width="'150'" type="number"
|
|
|
+ @on-blur="jyNum(item.product_num,chooseGoods[gindex].batch[index].pur_number,item)" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="item" v-if="item.is_weigh == 1">
|
|
|
+ <div>总重量:</div>
|
|
|
+ <div class="value"><Input v-model="chooseGoods[gindex].batch[index].weight"
|
|
|
+ placeholder="请输入重量" v-width="'150'" type="number" /></div>
|
|
|
+ </div>
|
|
|
+ <a v-if="goods.batch.length > 1" @click="delBatch(gindex,index)" class=" del-btn-1">删除</a>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div v-if="goods.batch.length == 0" class="section">
|
|
|
+ <div class="section-bd">
|
|
|
+ <div class="item">
|
|
|
+ <div>库存:</div>
|
|
|
+ <div class="value">{{ goods.product_num}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div>单位:</div>
|
|
|
+ <div class="value">{{ goods.unit_name}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div>数量:</div>
|
|
|
+ <div class="value"><Input v-model="chooseGoods[gindex].pur_number"
|
|
|
+ placeholder="请输入数量" v-width="'150'" type="number" /></div>
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div>总重量:</div>
|
|
|
+ <div class="value"><Input v-model="chooseGoods[gindex].weight"
|
|
|
+ placeholder="请输入重量" v-width="'150'" type="number" /></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </Card>
|
|
|
+ <Button type="primary" class="submission" style="margin-top:20px;" @click="getGoods()"
|
|
|
+ >添加商品</Button>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form>
|
|
|
+ </Card>
|
|
|
+ <Card :bordered="false" dis-hover class="fixed-card"
|
|
|
+ :style="{ left: `${!menuCollapse ? '200px' : isMobile ? '0' : '80px'}` }">
|
|
|
+ <Form>
|
|
|
+ <FormItem>
|
|
|
+ <Button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</Button>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </Card>
|
|
|
+ <good-detail ref="goodDetail" @setGoods="setGoods"></good-detail>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ mapState,
|
|
|
+ mapMutations
|
|
|
+ } from "vuex";
|
|
|
+ import {
|
|
|
+ staffListInfo
|
|
|
+ } from "@/api/store";
|
|
|
+ import {
|
|
|
+ getGodownList,
|
|
|
+ createGodown,
|
|
|
+ getGodownInfo,
|
|
|
+ getUserList,
|
|
|
+ getOutGoods,
|
|
|
+ createWant,
|
|
|
+ getWantInfo,
|
|
|
+ getProductBatch,
|
|
|
+ createOut,
|
|
|
+ editOut,
|
|
|
+ getOutInfo
|
|
|
+ } from "@/api/erp";
|
|
|
+ import {
|
|
|
+ keyApi,
|
|
|
+ storeGetInfoApi,
|
|
|
+ cityApi,
|
|
|
+ storeUpdateApi,
|
|
|
+ cascaderList
|
|
|
+ } from '@/api/store';
|
|
|
+ import {
|
|
|
+ productSpecs,
|
|
|
+ productSpecsInfo
|
|
|
+ } from "@/api/product";
|
|
|
+ import Setting from "@/setting";
|
|
|
+ import goodDetail from './goodDetail.vue'
|
|
|
+ export default {
|
|
|
+ name: "specsAdd",
|
|
|
+ components: {
|
|
|
+ goodDetail
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ authList: [],
|
|
|
+ columnss: [{
|
|
|
+ title: '商品名称',
|
|
|
+ key: 'product_name',
|
|
|
+ minWidth: 160
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '要货数量',
|
|
|
+ slot: 'want_product_num',
|
|
|
+ minWidth: 90
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '要货单位',
|
|
|
+ slot: 'unit_types',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ slot: 'action',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ columns: [{
|
|
|
+ title: '商品名称',
|
|
|
+ key: 'name',
|
|
|
+ minWidth: 160
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '库存',
|
|
|
+ key: 'product_num',
|
|
|
+ minWidth: 90
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '单位',
|
|
|
+ key: 'unit_name',
|
|
|
+ minWidth: 90
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数量',
|
|
|
+ slot: 'pur_number',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '重量(kg)',
|
|
|
+ slot: 'weight',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ slot: 'action',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+
|
|
|
+ ],
|
|
|
+ chooseGoods: [],
|
|
|
+ staffData: [],
|
|
|
+ addresData: [],
|
|
|
+ props: {
|
|
|
+ emitPath: false,
|
|
|
+ multiple: false,
|
|
|
+ checkStrictly: true,
|
|
|
+ value: "id",
|
|
|
+ label: "title"
|
|
|
+ },
|
|
|
+ propss: {
|
|
|
+ emitPath: false,
|
|
|
+ multiple: false,
|
|
|
+ checkStrictly: true,
|
|
|
+ value: "id",
|
|
|
+ label: "name"
|
|
|
+ },
|
|
|
+ propsss: {
|
|
|
+ emitPath: false,
|
|
|
+ multiple: false,
|
|
|
+ checkStrictly: true,
|
|
|
+ value: "id",
|
|
|
+ label: "staff_name"
|
|
|
+ },
|
|
|
+ roterPre: Setting.roterPre,
|
|
|
+ data1: [],
|
|
|
+ grid: {
|
|
|
+ xl: 7,
|
|
|
+ lg: 7,
|
|
|
+ md: 12,
|
|
|
+ sm: 24,
|
|
|
+ xs: 24,
|
|
|
+ },
|
|
|
+ formValidate: {
|
|
|
+ inType: 1,
|
|
|
+ outType: 1,
|
|
|
+ id: 0,
|
|
|
+ wid: 0,
|
|
|
+ store_id: 0,
|
|
|
+ goods: [],
|
|
|
+ my_store_id: 0,
|
|
|
+ create_uid: 0,
|
|
|
+ create_admin_id: 0,
|
|
|
+ },
|
|
|
+ ruleValidate1: {
|
|
|
+
|
|
|
+ },
|
|
|
+ ruleValidate: {
|
|
|
+ store_id: [{
|
|
|
+ type: "number",
|
|
|
+ required: true,
|
|
|
+ message: "请选择门店",
|
|
|
+ trigger: "blur"
|
|
|
+ }, ],
|
|
|
+ to_store_id: [{
|
|
|
+ type: "number",
|
|
|
+ required: true,
|
|
|
+ message: "请选择调入门店",
|
|
|
+ trigger: "blur"
|
|
|
+ }, ],
|
|
|
+ wid: [{
|
|
|
+ type: "number",
|
|
|
+ required: true,
|
|
|
+ message: "请选择调出仓库",
|
|
|
+ trigger: "blur"
|
|
|
+ }, ],
|
|
|
+ to_wid: [{
|
|
|
+ type: "number",
|
|
|
+ required: true,
|
|
|
+ message: "请选择调入仓库",
|
|
|
+ trigger: "blur"
|
|
|
+ }, ],
|
|
|
+ create_uid: [{
|
|
|
+ type: "number",
|
|
|
+ required: true,
|
|
|
+ message: "请选择创建人",
|
|
|
+ trigger: "blur"
|
|
|
+ }, ],
|
|
|
+ // goods: [{
|
|
|
+ // type: "array",
|
|
|
+ // required: true,
|
|
|
+ // message: "请选择商品",
|
|
|
+ // trigger: "change"
|
|
|
+ // }, ],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState("admin/layout", ["isMobile", "menuCollapse"]),
|
|
|
+ labelWidth() {
|
|
|
+ return this.isMobile ? undefined : 120;
|
|
|
+ },
|
|
|
+ labelPosition() {
|
|
|
+ return this.isMobile ? "top" : "right";
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getGodownList()
|
|
|
+ let data = {
|
|
|
+ pid: 0
|
|
|
+ }
|
|
|
+ // this.cityInfo(data);
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // this.setCopyrightShow({
|
|
|
+ // value: false
|
|
|
+ // });
|
|
|
+ this.staffList()
|
|
|
+ if (this.$route.query.id != 0) {
|
|
|
+ this.formValidate.id = this.$route.query.id
|
|
|
+ this.getOutInfo(this.$route.query.id)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ destroyed() {
|
|
|
+ // this.setCopyrightShow({
|
|
|
+ // value: true
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapMutations("admin/layout", ["setCopyrightShow"]),
|
|
|
+ delGood(index) {
|
|
|
+ this.chooseGoods.splice(index, 1)
|
|
|
+ },
|
|
|
+ delBatch(in1, in2) {
|
|
|
+ console.log((in1, in2));
|
|
|
+ this.chooseGoods[in1].batch.splice(in2, 1)
|
|
|
+ },
|
|
|
+ jyNum(a = 0, b = 0, item) {
|
|
|
+ console.log(a, b, 'jiaoyan');
|
|
|
+ if (a * 1 < b * 1) {
|
|
|
+ item.pur_number = 0
|
|
|
+ return this.$Message.error('输入值大于可调出商品的库存')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getOutInfo(id) {
|
|
|
+ getOutInfo(id).then(res => {
|
|
|
+ let data = res.data
|
|
|
+ if (data.wid) {
|
|
|
+ this.formValidate.outType = 0
|
|
|
+ this.formValidate.wid = data.wid*1
|
|
|
+ } else {
|
|
|
+ this.formValidate.outType = 1
|
|
|
+ this.formValidate.store_id = data.store_id*1
|
|
|
+ }
|
|
|
+ if (data.to_wid) {
|
|
|
+ this.formValidate.to_wid = data.to_wid*1
|
|
|
+ this.formValidate.inType == 0
|
|
|
+ } else {
|
|
|
+ this.formValidate.inType == 1
|
|
|
+ this.formValidate.to_store_id = data.to_store_id*1
|
|
|
+ }
|
|
|
+ this.getUserList()
|
|
|
+ this.formValidate.create_uid = data.create_uid
|
|
|
+ this.formValidate.create_admin_id = data.create_admin_id
|
|
|
+ this.chooseGoods = data.product.map(item => {
|
|
|
+ item.name = item.store_name
|
|
|
+ item.product_id = item.id
|
|
|
+ if(item.group.length > 0) {
|
|
|
+ item.batch = item.group
|
|
|
+ }else {
|
|
|
+ item.batch = []
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ // console.log(res, 'ddddd');
|
|
|
+ // let data = res.data
|
|
|
+ // this.formValidate.id = data.id
|
|
|
+ // this.formValidate.create_uid = data.create_uid
|
|
|
+ // this.chooseGoods = data.info
|
|
|
+ // this.formValidate.store_id = data.store_id
|
|
|
+ // console.log(this.formValidate.goods, 'this.formValidate.goods');
|
|
|
+ // if (data.wid) {
|
|
|
+ // this.formValidate.inType = 0
|
|
|
+ // this.formValidate.wid = data.wid
|
|
|
+ // this.getUserList({
|
|
|
+ // wid: this.formValidate.wid
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.formValidate.inType = 1
|
|
|
+ // this.getUserList({
|
|
|
+ // store_id: this.formValidate.store_id
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setGoods(e) {
|
|
|
+ console.log(e, 'ddd');
|
|
|
+ // try {
|
|
|
+ // let arr = e.map(item => {
|
|
|
+ // item.unitList = [{
|
|
|
+ // value: 0,
|
|
|
+ // label: item.info.unit_name
|
|
|
+ // }]
|
|
|
+ // if (item.info.unit_name_1) {
|
|
|
+ // item.unitList.push({
|
|
|
+ // value: 1,
|
|
|
+ // label: item.info.unit_name_1
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // if (item.info.unit_name_2) {
|
|
|
+ // item.unitList.push({
|
|
|
+ // value: 2,
|
|
|
+ // label: item.info.unit_name_1
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // item.want_product_num = 0
|
|
|
+ // return item
|
|
|
+ // })
|
|
|
+ // this.chooseGoods = this.chooseGoods.concat(arr)
|
|
|
+ // } catch (e) {
|
|
|
+ // //TODO handle the exception
|
|
|
+ // console.log('err', e);
|
|
|
+ // }
|
|
|
+ // console.log(this.chooseGoods, 'this.chooseGoods');
|
|
|
+
|
|
|
+ // 校验商品是否重复
|
|
|
+ if (this.chooseGoods.find(item => e.product_id == item.product_id)) {
|
|
|
+ console.log('55');
|
|
|
+ this.$refs.goodDetail.clearAll()
|
|
|
+ return this.$Message.error('该商品已选择');
|
|
|
+ } else {
|
|
|
+ this.$refs.goodDetail.modals = false
|
|
|
+ let qdata;
|
|
|
+ console.log('this.formValidate.outType', this.formValidate.outType);
|
|
|
+ if (this.formValidate.outType == 1) {
|
|
|
+ try {
|
|
|
+ qdata = {
|
|
|
+ store_id: this.formValidate.store_id,
|
|
|
+ product_id: e.product_id
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ //TODO handle the exception
|
|
|
+ console.log('err', e);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ qdata = {
|
|
|
+ wid: this.formValidate.wid,
|
|
|
+ product_id: e.product_id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(qdata, 'qdata');
|
|
|
+ getProductBatch(qdata).then(res => {
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ this.chooseGoods = this.chooseGoods.concat({
|
|
|
+ bar_code: e.bar_code,
|
|
|
+ is_weigh: e.info.is_weigh,
|
|
|
+ name: e.product_name,
|
|
|
+ product_id: e.product_id,
|
|
|
+ product_num: e.product_num,
|
|
|
+ pur_number: '',
|
|
|
+ unit_name: e.unit_name,
|
|
|
+ weight: '',
|
|
|
+ batch: res.data.map(item => {
|
|
|
+ item.weight = 0
|
|
|
+ item.pur_number = 0
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.chooseGoods = this.chooseGoods.concat({
|
|
|
+ bar_code: e.bar_code,
|
|
|
+ is_weigh: e.info.is_weigh,
|
|
|
+ name: e.product_name,
|
|
|
+ product_id: e.product_id,
|
|
|
+ product_num: e.product_num,
|
|
|
+ pur_number: 0,
|
|
|
+ unit_name: e.unit_name,
|
|
|
+ weight: 0,
|
|
|
+ batch: []
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // this.chooseGoods = this.chooseGoods.concat(e)
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getGoods() {
|
|
|
+ console.log(this.formValidate.store_id, this.formValidate.wid);
|
|
|
+ if (this.formValidate.wid == 0 && this.formValidate.store_id == 0) {
|
|
|
+ return this.$Message.error('请选择调出仓库或门店');
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ this.$refs.goodDetail.formValidate.outType = this.formValidate.outType
|
|
|
+ this.$refs.goodDetail.formValidate.wid = this.formValidate.wid
|
|
|
+ this.$refs.goodDetail.formValidate.store_id = this.formValidate.store_id
|
|
|
+ this.$refs.goodDetail.modals = true
|
|
|
+ this.$refs.goodDetail.getList()
|
|
|
+
|
|
|
+ } catch (e) {
|
|
|
+ //TODO handle the exception
|
|
|
+ console.log('err', e);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ getUserList() {
|
|
|
+ let qdata = {}
|
|
|
+ if (this.formValidate.outType == 1) {
|
|
|
+ qdata.store_id = this.formValidate.store_id
|
|
|
+ } else {
|
|
|
+ qdata.wid = this.formValidate.wid
|
|
|
+ }
|
|
|
+ getUserList(qdata).then(res => {
|
|
|
+ // console.log(res);
|
|
|
+ this.authList = res.data.data
|
|
|
+ // .map(item => {
|
|
|
+ // item.id += ''
|
|
|
+ // return item
|
|
|
+ // });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ staffList() {
|
|
|
+ staffListInfo()
|
|
|
+ .then((res) => {
|
|
|
+ this.staffData = res.data
|
|
|
+ // .map(item => {
|
|
|
+ // item.id += ''
|
|
|
+ // return item
|
|
|
+ // });
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$Message.error(err.msg);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getGodownInfo(id) {
|
|
|
+ getGodownInfo(id).then(res => {
|
|
|
+ this.formValidate = res.data
|
|
|
+ this.formValidate.addressSelect = this.formValidate.addressSelect.map(item => item * 1)
|
|
|
+ console.log(this.formValidate.addressSelect);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addchack(e, selectedData) {
|
|
|
+ console.log(selectedData, 'selectedData');
|
|
|
+ e.forEach((i, index) => {
|
|
|
+ if (index == 0) {
|
|
|
+ this.formValidate.province = i
|
|
|
+ } else if (index == 1) {
|
|
|
+ this.formValidate.city = i
|
|
|
+ } else if (index == 2) {
|
|
|
+ this.formValidate.area = i
|
|
|
+ } else {
|
|
|
+ this.formValidate.street = i
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.formValidate.address = (selectedData.map(o => o.label)).join('/')
|
|
|
+ // console.log('this.formValidate.addressSelect',this.formValidate.addressSelect);
|
|
|
+
|
|
|
+ },
|
|
|
+ cityInfo(data) {
|
|
|
+ cityApi(data).then(res => {
|
|
|
+ this.addresData = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loadData(item, callback) {
|
|
|
+ item.loading = true;
|
|
|
+ cityApi({
|
|
|
+ pid: item.value
|
|
|
+ }).then(res => {
|
|
|
+ item.children = res.data;
|
|
|
+ item.loading = false;
|
|
|
+ callback();
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ getGodownList() {
|
|
|
+ getGodownList().then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.data1 = res.data.data
|
|
|
+ // .map(item => {
|
|
|
+ // item.id += ''
|
|
|
+ // return item
|
|
|
+ // });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ del(index) {
|
|
|
+ this.chooseGoods.splice(index, 1);
|
|
|
+ },
|
|
|
+ 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.getUserList()
|
|
|
+ },
|
|
|
+ checkOutWare(e) {
|
|
|
+ this.formValidate.create_uid = "";
|
|
|
+ this.authList = []
|
|
|
+ this.chooseGoods = []
|
|
|
+ if (e) {
|
|
|
+ this.getUserList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeOutType(e) {
|
|
|
+ this.formValidate.wid = 0
|
|
|
+ this.formValidate.store_id = 0
|
|
|
+ this.checkOutWare(0)
|
|
|
+ },
|
|
|
+ userSearchsss(e) {
|
|
|
+ if (e) {
|
|
|
+ let obj = this.authList.find(item => item.id == e)
|
|
|
+ this.formValidate.create_admin_id = obj.admin_id
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkWid(e) {
|
|
|
+
|
|
|
+ },
|
|
|
+ handleSubmit(name) {
|
|
|
+ let that = this
|
|
|
+ //判断调出仓库和调入仓库是否一致
|
|
|
+
|
|
|
+ // if(this.formValidate.id == 0) {
|
|
|
+ // let arr = []
|
|
|
+ // let arr1 = JSON.parse(JSON.stringify(this.chooseGoods))
|
|
|
+ // let uniqueArray = arr1.filter(function(item, index, self) {
|
|
|
+ // return !self.slice(index + 1).some(function(otherItem) {
|
|
|
+ // return item.product_id === otherItem.product_id && item.unit_type === otherItem.unit_type;
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // arr = uniqueArray.map(item => {
|
|
|
+ // let want = 0;
|
|
|
+ // for (let i = 0; i < arr1.length; i++) {
|
|
|
+ // if(item.product_id === arr1[i].product_id && item.unit_type === arr1[i].unit_type) {
|
|
|
+ // console.log(arr1[i].want_product_num*1,i,'i');
|
|
|
+ // want += arr1[i].want_product_num*1
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // item.want_product_num = want
|
|
|
+ // return item
|
|
|
+ // })
|
|
|
+ // this.formValidate.goods = arr.map(item => {
|
|
|
+ // item.unit_name = item.info['unit_name' + (item.unit_type == 0 ? '':(item.unit_type == 1?"_1":"_2"))]
|
|
|
+ // return item
|
|
|
+ // })
|
|
|
+ // }else {
|
|
|
+ // this.formValidate.goods = this.chooseGoods
|
|
|
+ // }
|
|
|
+ console.log(this.chooseGoods, '最后');
|
|
|
+ console.log(this.formValidate.to_wid,'towid');
|
|
|
+ this.$refs[name].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.formValidate.id = this.$route.query.id;
|
|
|
+ if (that.formValidate.outType == 1 && that.formValidate.inType == 1 && that.formValidate
|
|
|
+ .store_id == that.formValidate.to_store_id) {
|
|
|
+ return that.$Message.error("调出门店和调入门店不能一致");
|
|
|
+ }
|
|
|
+ if (that.formValidate.outType == 0 && that.formValidate.inType == 0 && that.formValidate
|
|
|
+ .wid == that.formValidate.to_wid) {
|
|
|
+ return that.$Message.error("调出仓库和调入仓库不能一致");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验商品数量和重量是否为0
|
|
|
+ let errIndex = 0;
|
|
|
+ that.chooseGoods.forEach(item => {
|
|
|
+ if (item.batch.length > 0) {
|
|
|
+ // let errIndexs = 0;
|
|
|
+ item.batch.forEach(e => {
|
|
|
+ if (e.pur_number == 0) {
|
|
|
+ errIndex++
|
|
|
+ }
|
|
|
+ if (e.is_weigh == 1 && e.weight == 0) {
|
|
|
+ errIndex++
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (item.pur_number == 0) {
|
|
|
+ errIndex++
|
|
|
+ }
|
|
|
+ if (item.is_weigh == 1 && e.weight == 0) {
|
|
|
+ errIndex++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (errIndex > 0) {
|
|
|
+ return that.$Message.error("商品数量或重量不能为空");
|
|
|
+ }
|
|
|
+ let pdata = {
|
|
|
+ create_uid: that.formValidate.create_uid,
|
|
|
+ create_admin_id: that.formValidate.create_admin_id,
|
|
|
+ }
|
|
|
+ if (that.formValidate.outType == 1) {
|
|
|
+ pdata.store_id = that.formValidate.store_id
|
|
|
+ if (that.formValidate.inType == 1) {
|
|
|
+ pdata.to_store_id = that.formValidate.to_store_id
|
|
|
+ } else {
|
|
|
+ pdata.to_wid = that.formValidate.to_wid
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ pdata.wid = that.formValidate.wid
|
|
|
+ if (that.formValidate.inType == 1) {
|
|
|
+ pdata.to_store_id = that.formValidate.to_store_id
|
|
|
+ } else {
|
|
|
+ pdata.to_wid = that.formValidate.to_wid
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pdata.product_list = that.chooseGoods
|
|
|
+ if(that.formValidate.id == 0) {
|
|
|
+ createOut(pdata).then(res => {
|
|
|
+ this.$Message.success(res.msg);
|
|
|
+ this.$router.push({
|
|
|
+ path: this.roterPre + "/erp/out_list"
|
|
|
+ });
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error(err.msg);
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ editOut(that.formValidate.id,pdata).then(res => {
|
|
|
+ this.$Message.success(res.msg);
|
|
|
+ this.$router.push({
|
|
|
+ path: this.roterPre + "/erp/out_list"
|
|
|
+ });
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error(err.msg);
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // this.$Message.error("请输入参数模板名称");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="stylus">
|
|
|
+ .table {
|
|
|
+ /deep/.ivu-table-header table {
|
|
|
+ border: 0 !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.ivu-table-header thead tr th:nth-of-type(1) {
|
|
|
+ padding-left: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.ivu-table td:nth-of-type(1) {
|
|
|
+ padding-left: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.ivu-table-cell {
|
|
|
+ padding: 0 !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.ivu-table-border th,
|
|
|
+ /deep/.ivu-table-border td {
|
|
|
+ border-right: unset;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.ivu-table td {
|
|
|
+ height: 59px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .form-submit {
|
|
|
+ /deep/.ivu-card {
|
|
|
+ border-radius: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ margin-bottom: 79px;
|
|
|
+
|
|
|
+ .fixed-card {
|
|
|
+ position: fixed;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ left: 200px;
|
|
|
+ z-index: 99;
|
|
|
+ box-shadow: 0 -1px 2px rgb(240, 240, 240);
|
|
|
+
|
|
|
+ /deep/ .ivu-card-body {
|
|
|
+ padding: 15px 16px 14px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ivu-form-item {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .ivu-form-item-content {
|
|
|
+ margin-right: 124px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ivu-btn {
|
|
|
+ height: 36px;
|
|
|
+ padding: 0 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .after-line {
|
|
|
+ display: inline-block;
|
|
|
+ position: relative;
|
|
|
+ margin-right: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ml16 {
|
|
|
+ margin-left: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .user-info {
|
|
|
+ position: relative;
|
|
|
+ padding: 20px;
|
|
|
+
|
|
|
+ .section {
|
|
|
+ padding: 25px 25px;
|
|
|
+ border-bottom: 1px dashed #EEEEEE;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ &-hd {
|
|
|
+ padding-left: 10px;
|
|
|
+ border-left: 3px solid #1890FF;
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 16px;
|
|
|
+ color: #303133;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-bd {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ .item {
|
|
|
+ // flex: 0 0 calc(~"(100% - 60px) / 3");
|
|
|
+ width: 25%;
|
|
|
+ min-width: 250px;
|
|
|
+ display: flex;
|
|
|
+ margin: 16px 30px 0 0;
|
|
|
+ font-size: 13px;
|
|
|
+ color: #606266;
|
|
|
+
|
|
|
+ &:nth-child(3n+3) {
|
|
|
+ margin: 16px 0 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .value {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar {
|
|
|
+ width: 60px;
|
|
|
+ height: 60px;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .del-btn {
|
|
|
+ position: absolute;
|
|
|
+ right: 20px;
|
|
|
+ top: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .del-btn-1 {
|
|
|
+ position: absolute;
|
|
|
+ right: 80px;
|
|
|
+ bottom: 20px;
|
|
|
+ }
|
|
|
+</style>
|