|
@@ -0,0 +1,222 @@
|
|
|
|
+<template>
|
|
|
|
+ <div id="detail">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24" class="main">
|
|
|
|
+ <el-col :span="24" class="one">
|
|
|
|
+ <el-button type="primary" size="small" @click="back">返回</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" class="two">
|
|
|
|
+ <el-form :model="form" :rules="rules" ref="form" label-width="100px">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="采购人" prop="buy_personal">
|
|
|
|
+ <el-input v-model="form.buy_personal" placeholder="请输入采购人"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="采购电话" prop="buy_phone">
|
|
|
|
+ <el-input v-model="form.buy_phone" placeholder="请输入采购电话"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="收货人" prop="receive_personal">
|
|
|
|
+ <el-input v-model="form.receive_personal" placeholder="请输入收货人"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="收货电话" prop="receive_phone">
|
|
|
|
+ <el-input v-model="form.receive_phone" placeholder="请输入收货电话"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="收货类型" prop="type">
|
|
|
|
+ <el-select v-model="form.type" placeholder="请选择收货类型" style="width: 100%">
|
|
|
|
+ <el-option label="统一收" value="0"></el-option>
|
|
|
|
+ <el-option label="申请人" value="1"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="收货地址" prop="receive_address">
|
|
|
|
+ <el-input v-model="form.receive_address" placeholder="请输入收货地址"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" class="order">
|
|
|
|
+ <el-col :span="24" class="btn"><el-button type="primary" size="small" @click="toAddmarket()">添加商品</el-button></el-col>
|
|
|
|
+ <el-col :span="24" class="list">
|
|
|
|
+ <el-table :data="form.order" border style="width: 100%">
|
|
|
|
+ <el-table-column prop="name" label="商品名称" align="center" show-overflow-tooltip> </el-table-column>
|
|
|
|
+ <el-table-column prop="num" label="商品数量" align="center" show-overflow-tooltip> </el-table-column>
|
|
|
|
+ <el-table-column prop="desc" label="特殊说明" align="center" show-overflow-tooltip> </el-table-column>
|
|
|
|
+ <el-table-column fixed="right" label="操作" align="center">
|
|
|
|
+ <template slot-scope="scope"><el-button @click="orderDel(scope.$index, scope.row)" type="danger" size="small">删除</el-button></template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" style="text-align: center">
|
|
|
|
+ <el-button type="danger" size="small" @click="resetForm('form')">重置信息</el-button>
|
|
|
|
+ <el-button type="primary" size="small" @click="onSubmit('form')">提交采购</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-dialog :title="dialog.title" :visible.sync="dialog.show" :width="dialog.width" :before-close="toClose" :close-on-click-modal="false">
|
|
|
|
+ <el-form :model="orderForm" :rules="orderRules" ref="orderForm" label-width="100px">
|
|
|
|
+ <el-form-item label="商品名称" prop="name">
|
|
|
|
+ <el-input v-model="orderForm.name" placeholder="请输入商品名称"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="商品数量" prop="num">
|
|
|
|
+ <el-input v-model="orderForm.num" placeholder="请输入商品数量"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="特殊说明" prop="desc">
|
|
|
|
+ <el-input v-model="orderForm.desc" placeholder="请输入特殊说明"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" size="small" @click="onOrderSubmit('orderForm')">保存信息</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions: mapBuy } = createNamespacedHelpers('buy');
|
|
|
|
+export default {
|
|
|
|
+ name: 'detail',
|
|
|
|
+ props: {},
|
|
|
|
+ components: {},
|
|
|
|
+ data: function () {
|
|
|
|
+ return {
|
|
|
|
+ form: { order: [] },
|
|
|
|
+ rules: {
|
|
|
|
+ buy_personal: [{ required: true, message: '请输入采购人', trigger: 'blur' }],
|
|
|
|
+ buy_phone: [{ required: true, message: '请输入采购电话', trigger: 'blur' }],
|
|
|
|
+ type: [{ required: true, message: '请选择收货类型', trigger: 'blur' }],
|
|
|
|
+ receive_personal: [{ required: true, message: '请输入收货人', trigger: 'blur' }],
|
|
|
|
+ receive_phone: [{ required: true, message: '请输入收货电话', trigger: 'blur' }],
|
|
|
|
+ receive_address: [{ required: true, message: '请输入收货地址', trigger: 'blur' }],
|
|
|
|
+ },
|
|
|
|
+ data: [],
|
|
|
|
+ // 弹框
|
|
|
|
+ dialog: { title: '申报审核', show: false, type: '1', width: '50%' },
|
|
|
|
+ // 审核
|
|
|
|
+ orderForm: {},
|
|
|
|
+ orderRules: {
|
|
|
|
+ name: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
|
|
|
|
+ num: [{ required: true, message: '请输入商品数量', trigger: 'blur' }],
|
|
|
|
+ desc: [{ required: true, message: '请输入特殊说明', trigger: 'blur' }],
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ async created() {
|
|
|
|
+ await this.searchOther();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ ...mapBuy(['fetch', 'create', 'update']),
|
|
|
|
+ // 提交采购
|
|
|
|
+ onSubmit(formName) {
|
|
|
|
+ this.$refs[formName].validate(async (valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ let data = this.form;
|
|
|
|
+ let res = await this.create(data);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({ type: `success`, message: `操作完成` });
|
|
|
|
+ this.back();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({ type: `error`, message: `${res.errmsg}` });
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ console.log('error submit!!');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 取消采购
|
|
|
|
+ resetForm(formName) {
|
|
|
|
+ this.$refs[formName].resetFields();
|
|
|
|
+ this.searchOther();
|
|
|
|
+ },
|
|
|
|
+ // 商品添加
|
|
|
|
+ toAddmarket() {
|
|
|
|
+ this.dialog = { title: '采购商品', show: true, type: '1', width: '30%' };
|
|
|
|
+ },
|
|
|
|
+ // 提交保存
|
|
|
|
+ onOrderSubmit(formName) {
|
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ let data = this.orderForm;
|
|
|
|
+ this.form.order.push(data);
|
|
|
|
+ this.orderForm = {};
|
|
|
|
+ this.dialog = { title: '采购商品', show: false, type: '1', width: '30%' };
|
|
|
|
+ } else {
|
|
|
|
+ console.log('error submit!!');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 取消添加
|
|
|
|
+ toClose() {
|
|
|
|
+ this.dialog = { title: '采购商品', show: false, type: '1', width: '30%' };
|
|
|
|
+ },
|
|
|
|
+ // 删除商品
|
|
|
|
+ orderDel(dataindex) {
|
|
|
|
+ this.form.order.splice(dataindex, 1);
|
|
|
|
+ },
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ searchOther() {
|
|
|
|
+ let data = {
|
|
|
|
+ apply_id: this.apply_id ? this.apply_id : '',
|
|
|
|
+ buy_personal_id: this.user.id,
|
|
|
|
+ buy_personal: this.user.name,
|
|
|
|
+ buy_phone: this.user.phone,
|
|
|
|
+ status: '0',
|
|
|
|
+ order: [],
|
|
|
|
+ };
|
|
|
|
+ this.$set(this, `form`, data);
|
|
|
|
+ },
|
|
|
|
+ // 返回
|
|
|
|
+ back() {
|
|
|
|
+ this.$router.push({ path: '/adminCenter/purchase/index' });
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState(['user']),
|
|
|
|
+ apply_id() {
|
|
|
|
+ return this.$route.query.apply_id;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ metaInfo() {
|
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ test: {
|
|
|
|
+ deep: true,
|
|
|
|
+ immediate: true,
|
|
|
|
+ handler(val) {},
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
+.main {
|
|
|
|
+ .one {
|
|
|
|
+ text-align: right;
|
|
|
|
+ margin: 0 0 10px 0;
|
|
|
|
+ }
|
|
|
|
+ .two {
|
|
|
|
+ .order {
|
|
|
|
+ margin: 0 0 10px 0;
|
|
|
|
+ .btn {
|
|
|
|
+ text-align: right;
|
|
|
|
+ margin: 0 0 10px 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+/deep/.el-dialog__body {
|
|
|
|
+ padding: 10px;
|
|
|
|
+}
|
|
|
|
+</style>
|