cz 2 лет назад
Родитель
Сommit
8deadc2582

+ 48 - 0
src/api/order-management/order/index.js

@@ -0,0 +1,48 @@
+import request from '@/router/axios'
+
+// customer列表 
+export function customerList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/page',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+
+// 添加customer 
+export function customerAdd(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/add',
+    method: 'post',
+    data: data,
+  })
+}
+// customer详情 
+export function customerDetails(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/details',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 编辑customer 
+export function customerEdit(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/edit',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 删除customer 
+export function customerDel(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/delete',
+    method: 'post',
+    data: data,
+  })
+}
+

+ 8 - 4
src/api/product-material/warehouse/index.js

@@ -12,10 +12,14 @@ export function warehouseList(data = {}) {
   })
 }
 
-
-
-
-
+// warehouse下拉 
+export function warehouseSelectList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/warehouse/select',
+    method: 'post',
+    data: data,
+  })
+}
 
 // 添加warehouse 
 export function warehouseAdd(data = {}) {

+ 88 - 0
src/components/select-material/index.vue

@@ -0,0 +1,88 @@
+<template>
+  <div v-loading="loading">
+    <el-table :data="tableList">
+      <el-table-column
+        :label="$t('product_material.material.materialType')"
+        align="center"
+        prop="type"
+        :formatter="(row) => dictDataEcho(row.type, materialTypeList)"
+      />
+      <el-table-column
+        :label="$t('product_material.material.materialCode')"
+        align="center"
+        prop="code"
+      />
+      <el-table-column
+        :label="$t('product_material.material.materialName')"
+        align="center"
+        prop="name"
+      />
+      <el-table-column
+        :label="$t('product_material.material.materialUnit')"
+        align="center"
+        prop="unit"
+      />
+      <el-table-column
+        :label="$t('product_material.product.deptId')"
+        align="center"
+        prop="deptName"
+      />
+
+      <el-table-column :label="$t('operation')" align="center" width="80">
+        <template slot-scope="scope">
+          <el-button type="text" @click="handleSelect(scope.row)"
+            >{{ $t("select") }}
+          </el-button>
+          <!-- <el-button type="text" @click="handleDelete(scope.row)"
+            >{{ $t("delete") }}
+          </el-button> -->
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import { materialList } from "@/api/product-material/material/index.js";
+
+export default {
+  data() {
+    return {
+      loading: false,
+      tableList: [],
+      materialTypeList: [],
+    };
+  },
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.materialTypeList = businessDictData.find(
+      (item) => item.code === "materialType"
+    ).children;
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.loading = true;
+      materialList({ pageNum: 1, pageSize: 999 }).then(
+        (res) => {
+          this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
+          this.loading = false;
+        },
+        (err) => {
+          console.log("productList: " + err);
+          this.loading = false;
+        }
+      );
+    },
+    handleSelect(row) {
+      this.$emit("select", row);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 35 - 0
src/lang/zh.js

@@ -29,6 +29,8 @@ export default {
   reset: "重置",
   select: "选择",
   productSelect: "产品选择",
+  goodsSelect: "物品选择",
+  remark: "备注",
   wel: {
     info: '早安,Smallwei,Avuex一款超乎你想象的框架!',
     dept: '我是avue团队下的一个部门-哈皮部门-哈皮职位',
@@ -363,6 +365,7 @@ export default {
     customer: {
       customerAdd: '添加客户',
       customerEdit: "编辑客户",
+      customerType: "客户类型",
       customerCode: "客户编码",
       customerName: "客户名称",
       country: "国家",
@@ -437,6 +440,38 @@ export default {
       address: "详细地址",
     }
   },
+  order_management: {
+    order: {
+      order: "订单",
+      orderAdd: '添加订单',
+      orderEdit: '编辑订单',
+      customerType: "客户类型",
+      orderType: "订单类型",
+      orderCode: "订单编号",
+      customerName: "客户名称",
+      orderAmount: "订单金额",
+      recipientCity: "收件城市",
+      orderTime: "下单时间",
+      orderStatus: "订单状态",
+      orderDetails: "订单明细",
+      harvestInfo: "收获信息",
+      contactInfo: "收件人",
+      contacts: '联系人',
+      contactNumber: '联系电话',
+      address: "收件地址",
+      country: "国家",
+      province: "省/洲",
+      city: '城市',
+      productCode: "产品编码",
+      productName: "产品名称",
+      specs: "规格",
+      price: "单价",
+      quantity: "数量",
+      Subtotal: "小计",
+
+
+    }
+  },
   inbound_outbound: {
     outbound: {
       outboun: "出库",

+ 13 - 0
src/router/page/index.js

@@ -281,6 +281,19 @@ export default [
     ],
   },
   {
+    path: '/order-management/order',
+    component: Layout,
+    redirect: '/order-management/order/index',
+    children: [
+      {
+        path: 'index',
+        name: '销售订单',
+        component: () => import(/* webpackChunkName: "page" */ '@/views/order-management/order/index'),
+        props: true,
+      },
+    ],
+  },
+  {
     path: '/inbound-outbound/outbound',
     component: Layout,
     redirect: '/inbound-outbound/outbound/index',

+ 180 - 88
src/views/order-management/addCustomer.vue → src/views/order-management/order/addOrder.vue

@@ -8,43 +8,161 @@
         :rules="formRules"
         label-width="100px"
       >
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item
+              :label="$t('order_management.order.customerName')"
+              prop="orderInfoId"
+            >
+              <el-select
+                v-model="form.orderInfoId"
+                :placeholder="$t('pleaseSelect')"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in orderSelectList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="4">
+            <el-form-item
+              :label="$t('order_management.order.orderType')"
+              prop="type"
+            >
+              <el-select
+                v-model="form.type"
+                :placeholder="$t('pleaseSelect')"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in orderTypeList"
+                  :key="item.id"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <div style="margin-bottom: 20px">
+          <labelTitle
+            :content="$t('order_management.order.orderDetails')"
+          ></labelTitle>
+        </div>
+        <el-form-item label-width="0px">
+          <el-button @click="selectDialog = true">
+            {{ $t("select") }}</el-button
+          >
+        </el-form-item>
+        <el-form-item>
+          <el-table :data="form.orderSalesDetailsList">
+            <el-table-column
+              :label="$t('order_management.order.productCode')"
+              prop="code"
+            >
+            </el-table-column>
+            <el-table-column
+              :label="$t('order_management.order.productName')"
+              prop="name"
+            >
+            </el-table-column>
+            <el-table-column
+              :label="$t('order_management.order.specs')"
+              prop="name"
+            >
+            </el-table-column>
+            <el-table-column
+              :label="$t('order_management.order.price')"
+              prop="name"
+            >
+            </el-table-column>
+            <el-table-column
+              :label="$t('order_management.order.quantity')"
+              prop="name"
+            >
+            </el-table-column>
+            <el-table-column
+              :label="$t('order_management.order.Subtotal')"
+              prop="name"
+            >
+            </el-table-column>
+            <el-table-column
+              :label="$t('operation')"
+              width="100"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-button type="text" @click="deleteRow(scope.$index)">{{
+                  $t("delete")
+                }}</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+
         <el-row>
-          <el-col :span="8">
+          <el-col :span="4">
             <el-form-item
-              :label="$t('product_material.customer.customerCode')"
+              :label="$t('order_management.order.orderAmount')"
               prop="code"
             >
               <el-input
-                v-model="form.code"
+                v-model="form.money"
                 :placeholder="$t('pleaseInput')"
+                disabled
               ></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="1"></el-col>
-          <el-col :span="15">
-            <el-form-item label=".">
-              <span>不输入则自动生成,自动编码规则示例:C00001</span>
-            </el-form-item>
-          </el-col>
         </el-row>
 
+        <div style="margin-bottom: 20px">
+          <labelTitle
+            :content="$t('order_management.order.harvestInfo')"
+          ></labelTitle>
+        </div>
+
         <el-form-item
-          :label="$t('product_material.customer.customerName')"
-          prop="name"
+          :label="$t('order_management.order.contactInfo')"
+          required
         >
-          <el-input
-            v-model="form.name"
-            :placeholder="$t('pleaseInput')"
-          ></el-input>
+          <el-row :gutter="10">
+            <el-col :span="4">
+              <el-form-item label-width="0" prop="contacts">
+                <el-input
+                  v-model="form.contacts"
+                  :placeholder="$t('order_management.order.contacts')"
+                >
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label-width="0" prop="phone">
+                <el-input
+                  v-model="form.phone"
+                  :placeholder="$t('order_management.order.contactNumber')"
+                >
+                  <template>
+                    <div slot="prepend">+ 86</div>
+                  </template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
         </el-form-item>
 
-        <el-form-item :label="$t('product_material.customer.address')" required>
+        <el-form-item :label="$t('order_management.order.address')" required>
           <el-row :gutter="10">
-            <el-col :span="8">
+            <el-col :span="4">
               <el-form-item label-width="0" prop="countryId">
                 <el-select
                   v-model="form.countryId"
-                  :placeholder="$t('product_material.customer.country')"
+                  :placeholder="$t('order_management.order.country')"
                   style="width: 100%"
                   @change="countryChange"
                 >
@@ -58,11 +176,11 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="4">
               <el-form-item label-width="0" prop="provinceId">
                 <el-select
                   v-model="form.provinceId"
-                  :placeholder="$t('product_material.customer.province')"
+                  :placeholder="$t('order_management.order.province')"
                   style="width: 100%"
                   @change="provinceChange"
                   :disabled="!provinceData.length > 0"
@@ -77,11 +195,11 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="4">
               <el-form-item label-width="0" prop="cityId">
                 <el-select
                   v-model="form.cityId"
-                  :placeholder="$t('product_material.customer.city')"
+                  :placeholder="$t('order_management.order.city')"
                   style="width: 100%"
                   :disabled="!provinceData.length > 0 && !cityData.length > 0"
                 >
@@ -95,67 +213,27 @@
                 </el-select>
               </el-form-item>
             </el-col>
-          </el-row>
-        </el-form-item>
-
-        <el-form-item label="" prop="detailedAddress">
-          <el-input
-            v-model="form.detailedAddress"
-            :placeholder="$t('pleaseInput')"
-            type="textarea"
-            rows="4"
-          ></el-input>
-        </el-form-item>
-
-        <el-form-item
-          :label="$t('product_material.customer.contactInfo')"
-          required
-        >
-          <el-row :gutter="10">
-            <el-col :span="8">
-              <el-form-item label-width="0" prop="contacts">
-                <el-input
-                  v-model="form.contacts"
-                  :placeholder="$t('pleaseInput')"
-                >
-                </el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="16">
-              <el-form-item label-width="0" prop="phone">
-                <el-input v-model="form.phone" :placeholder="$t('pleaseInput')">
-                  <template>
-                    <div slot="prepend">+ 86</div>
-                  </template>
-                </el-input>
-              </el-form-item>
+            <el-col :span="12">
+              <el-input
+                v-model="form.detailedAddress"
+                :placeholder="$t('pleaseInput')"
+              ></el-input>
             </el-col>
           </el-row>
         </el-form-item>
 
-        <el-form-item :label="$t('product_material.customer.enclosure')">
-          <el-upload
-            class="upload-demo"
-            action="/api/service-file/uploadFile"
-            :headers="uploadHeader"
-            :on-preview="handlePreview"
-            :on-remove="handleRemove"
-            :on-success="handleSuccess"
-            multiple
-            :file-list="fileList"
-          >
-            <el-button size="small" type="primary">点击上传</el-button>
-          </el-upload>
-        </el-form-item>
-
-        <el-form-item label="备注" prop="remark">
-          <el-input
-            v-model="form.remark"
-            :placeholder="$t('pleaseInput')"
-            type="textarea"
-            rows="4"
-          ></el-input>
-        </el-form-item>
+        <!-- <el-row>
+          <el-col span="18">
+            <el-form-item :label="$t('remark')" prop="remark">
+              <el-input
+                v-model="form.remark"
+                :placeholder="$t('pleaseInput')"
+                type="textarea"
+                rows="4"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row> -->
       </el-form>
     </div>
     <div style="text-align: center; margin-top: 15px">
@@ -166,6 +244,15 @@
         {{ $t("submit") }}</el-button
       >
     </div>
+    <el-dialog
+      :title="$t('orderSelect')"
+      v-if="selectDialog"
+      :visible.sync="selectDialog"
+      width="80%"
+      top="60px"
+    >
+      <selectProduct @select="handleSelect"></selectProduct>
+    </el-dialog>
   </div>
 </template>
 
@@ -173,9 +260,15 @@
 import { getToken } from "@/util/auth";
 import { getRegionData } from "@/api/system/common.js";
 
+import labelTitle from "@/components/label-title/index.vue";
+import selectProduct from "@/components/select-product/index.vue";
+
 export default {
   name: "addCustomer",
-  components: {},
+  components: {
+    labelTitle,
+    selectProduct,
+  },
   props: {
     form: {
       type: Object,
@@ -198,7 +291,7 @@ export default {
             required: true,
             message:
               this.$t("pleaseSelect") +
-              this.$t("product_material.customer.country"),
+              this.$t("order_management.order.country"),
             trigger: "change",
           },
         ],
@@ -207,7 +300,7 @@ export default {
             required: true,
             message:
               this.$t("pleaseSelect") +
-              this.$t("product_material.customer.province"),
+              this.$t("order_management.order.province"),
             trigger: "change",
           },
         ],
@@ -215,8 +308,7 @@ export default {
           {
             required: true,
             message:
-              this.$t("pleaseSelect") +
-              this.$t("product_material.customer.city"),
+              this.$t("pleaseSelect") + this.$t("order_management.order.city"),
             trigger: "change",
           },
         ],
@@ -225,7 +317,7 @@ export default {
             required: true,
             message:
               this.$t("pleaseSelect") +
-              this.$t("product_material.customer.customerType"),
+              this.$t("order_management.order.orderType"),
             trigger: "change",
           },
         ],
@@ -234,7 +326,7 @@ export default {
             required: true,
             message:
               this.$t("pleaseInput") +
-              this.$t("product_material.customer.customerName"),
+              this.$t("order_management.order.orderName"),
             trigger: "blur",
           },
         ],
@@ -243,7 +335,7 @@ export default {
             required: true,
             message:
               this.$t("pleaseInput") +
-              this.$t("product_material.customer.contacts"),
+              this.$t("order_management.order.contacts"),
             trigger: "blur",
           },
         ],
@@ -252,7 +344,7 @@ export default {
             required: true,
             message:
               this.$t("pleaseInput") +
-              this.$t("product_material.customer.contactNumber"),
+              this.$t("order_management.order.contactNumber"),
             trigger: "blur",
           },
         ],

+ 60 - 40
src/views/order-management/index.vue → src/views/order-management/order/index.vue

@@ -5,38 +5,33 @@ import test from "@/components/form-test/index.vue";
 import query from "@/components/query/index.vue";
 
 import byTable from "@/components/by-table/index.js";
-import addCustomer from "./addCustomer.vue";
+import addOrder from "./addOrder.vue";
 
-import * as API from "@/api/product-material/customer/index.js";
+import * as API from "@/api/order-management/order/index.js";
+import { customerList } from "@/api/product-material/customer/index.js";
 
 export default {
   components: {
     test,
     byTable,
     query,
-    addCustomer,
+    addOrder,
   },
   data() {
     return {
+      orderTypeList: [],
+      customerSelectList: [],
       btnForm: {
         otherButton: {
           list: [
             {
-              name: this.$t("product_material.customer.customerAdd"),
+              name: this.$t("order_management.order.orderAdd"),
               methodsText: "add",
               type: "primary",
               add: () => {
                 this.handleAdd();
               },
             },
-            {
-              name: this.$t("excelImport"),
-              methodsText: "excelImport",
-              type: "defualt",
-              excelImport: () => {
-                this.excelImport();
-              },
-            },
           ],
         },
       },
@@ -52,7 +47,7 @@ export default {
       },
       selectConfig: [
         {
-          label: this.$t("product_material.supply.supplyType"),
+          label: this.$t("order_management.order.orderType"),
           prop: "type",
           data: [],
         },
@@ -78,12 +73,25 @@ export default {
     };
   },
   created() {
-    this.getList();
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.orderTypeList = businessDictData.find(
+      (item) => item.code === "orderType"
+    ).children;
+    this.selectConfig[0].data = this.orderTypeList.map((item) => ({
+      label: item.dictValue,
+      value: item.dictKey,
+    }));
+    customerList({ pageNum: 1, pageSize: 999 }).then((res) => {
+      this.customerSelectList = res.data.data.records;
+    });
+    // this.getList();
   },
   methods: {
     getList() {
       this.loading = true;
-      API.customerList(this.queryParams).then(
+      API.orderList(this.queryParams).then(
         (res) => {
           console.log(res, "qq");
           this.tableList = res.data.data.records;
@@ -91,7 +99,7 @@ export default {
           this.loading = false;
         },
         (err) => {
-          console.log("customerList: " + err);
+          console.log("orderList: " + err);
           this.loading = false;
         }
       );
@@ -142,37 +150,37 @@ export default {
         this.form.fileInfoList = [];
       }
       this.$nextTick(() => {
-        this.$refs.addCustomer.loading = true;
-        this.$refs.addCustomer.countryChange(this.form.countryId);
-        this.$refs.addCustomer.provinceChange(this.form.provinceId);
-        this.$refs.addCustomer.loading = false;
+        this.$refs.addOrder.loading = true;
+        this.$refs.addOrder.countryChange(this.form.countryId);
+        this.$refs.addOrder.provinceChange(this.form.provinceId);
+        this.$refs.addOrder.loading = false;
       });
     },
     handleSubmit() {
       if (!this.form.id) {
-        API.customerAdd(this.form).then(
+        API.orderAdd(this.form).then(
           () => {
             this.msgSuccess(this.$t("addSuccess"));
-            this.$refs.addCustomer.loading = false;
+            this.$refs.addOrder.loading = false;
             this.open = false;
             this.getList();
           },
           (err) => {
-            console.log("customerAdd: " + err);
-            this.$refs.addCustomer.loading = false;
+            console.log("orderAdd: " + err);
+            this.$refs.addOrder.loading = false;
           }
         );
       } else {
-        API.customerEdit(this.form).then(
+        API.orderEdit(this.form).then(
           () => {
             this.msgSuccess(this.$t("editSuccess"));
             this.open = false;
-            this.$refs.addCustomer.loading = false;
+            this.$refs.addOrder.loading = false;
             this.getList();
           },
           (err) => {
-            console.log("customerEdit: " + err);
-            this.$refs.addCustomer.loading = false;
+            console.log("orderEdit: " + err);
+            this.$refs.addOrder.loading = false;
           }
         );
       }
@@ -184,7 +192,7 @@ export default {
         cancelButtonText: this.$t("cancelText"),
         type: "warning",
       }).then(() => {
-        API.customerDel({ id: row.id }).then(() => {
+        API.orderDel({ id: row.id }).then(() => {
           this.msgSuccess(this.$t("deleteSuccess"));
           this.getList();
         });
@@ -222,27 +230,37 @@ export default {
       <el-table :data="tableList" v-loading="loading">
       
         <el-table-column
-          :label="$t('product_material.customer.customerCode')"
+          :label="$t('order_management.order.orderType')"
           align="center"
           prop="code"
         />
         <el-table-column
-          :label="$t('product_material.customer.customerName')"
+          :label="$t('order_management.order.orderCode')"
           align="center"
           prop="name"
         />
         <el-table-column
-          :label="$t('product_material.customer.whereCity')"
+          :label="$t('order_management.order.customerName')"
           align="center"
           :formatter="showAddress"
         />
         <el-table-column
-          :label="$t('product_material.customer.contacts')"
+          :label="$t('order_management.order.orderAmount')"
           align="center"
           prop="contacts"
         />
         <el-table-column
-          :label="$t('product_material.customer.contactNumber')"
+          :label="$t('order_management.order.recipientCity')"
+          align="center"
+          prop="phone"
+        />
+          <el-table-column
+          :label="$t('order_management.order.orderTime')"
+          align="center"
+          prop="phone"
+        />
+          <el-table-column
+          :label="$t('order_management.order.orderStatus')"
           align="center"
           prop="phone"
         />
@@ -264,20 +282,22 @@ export default {
     <el-dialog
       :title="
         titleText === 'add'
-          ? $t('product_material.customer.customerAdd')
-          : $t('product_material.customer.customerEdit')
+          ? $t('order_management.order.orderAdd')
+          : $t('order_management.order.orderEdit')
       "
       :visible.sync="open"
       v-if="open"
-      width="50%"
+      width="80%"
       top="60px"
     >
-      <add-customer
+      <add-order
         :form="form"
+        :customerSelectList="customerSelectList"
+        :orderTypeList="orderTypeList"
         @submit="handleSubmit"
         @cancel="handleCancel"
         ref="addMaterial"
-      ></add-customer>
+      ></add-order>
     </el-dialog>
   </div>
 </template>
@@ -292,7 +312,7 @@ export default {
   .header {
     // height: 100px;
     margin-bottom: 10px;
-    box-sizing: border-box;
+    box-sizing: border_management-box;
   }
   .body-main {
     flex: 1;

+ 16 - 5
src/views/product-material/customer/index.vue

@@ -52,6 +52,7 @@ export default {
       },
       selectConfig: [],
       tableList: [],
+      total: null,
       loading: false,
       titleText: "",
       open: false,
@@ -59,7 +60,7 @@ export default {
         id: "",
         code: "",
         name: "",
-        countryId: "",
+        countryId: "China",
         provinceId: "",
         cityId: "",
         detailedAddress: "",
@@ -79,7 +80,6 @@ export default {
       this.loading = true;
       API.customerList(this.queryParams).then(
         (res) => {
-          console.log(res, "qq");
           this.tableList = res.data.data.records;
           this.total = res.data.data.total;
           this.loading = false;
@@ -98,7 +98,7 @@ export default {
         id: "",
         code: "",
         name: "",
-        countryId: "",
+        countryId: "China",
         provinceId: "",
         cityId: "",
         detailedAddress: "",
@@ -110,13 +110,16 @@ export default {
       };
       this.titleText = "add";
       this.open = true;
+      this.$nextTick(() => {
+        this.$refs.addCustomer.countryChange(this.form.countryId);
+      });
     },
     handleCancel() {
       this.form = {
         id: "",
         code: "",
         name: "",
-        countryId: "",
+        countryId: "China",
         provinceId: "",
         cityId: "",
         detailedAddress: "",
@@ -251,6 +254,14 @@ export default {
           </template>
         </el-table-column>
       </el-table>
+
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
     </el-card>
 
     <el-dialog
@@ -268,7 +279,7 @@ export default {
         :form="form"
         @submit="handleSubmit"
         @cancel="handleCancel"
-        ref="addMaterial"
+        ref="addCustomer"
       ></add-customer>
     </el-dialog>
   </div>

+ 1 - 1
src/views/product-material/supply/addSupply.vue

@@ -192,7 +192,7 @@
         <el-form-item :label="$t('product_material.supply.enclosure')">
           <el-upload
             class="upload-demo"
-            action="/api/service-file/uploadFile"
+            action="http://36.134.91.96:10001/api/service-file/uploadFile"
             :headers="uploadHeader"
             :on-preview="handlePreview"
             :on-remove="handleRemove"

+ 17 - 13
src/views/product-material/warehouse/addWarehouse.vue

@@ -53,10 +53,10 @@
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+                  v-for="item in customerSelectList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
                 >
                 </el-option>
               </el-select>
@@ -98,6 +98,10 @@ export default {
       type: Array,
       default: () => [],
     },
+    customerSelectList: {
+      type: Array,
+      default: () => [],
+    },
   },
   data() {
     return {
@@ -117,15 +121,15 @@ export default {
             trigger: "change",
           },
         ],
-        // warehouseKeeperId: [
-        //   {
-        //     required: true,
-        //     message: this.$t(
-        //       "product_material.warehouse.warehouseKeeperIdRules"
-        //     ),
-        //     trigger: "change",
-        //   },
-        // ],
+        warehouseKeeperId: [
+          {
+            required: true,
+            message: this.$t(
+              "product_material.warehouse.warehouseKeeperIdRules"
+            ),
+            trigger: "change",
+          },
+        ],
 
         name: [
           {

+ 17 - 0
src/views/product-material/warehouse/index.vue

@@ -30,6 +30,7 @@
         :label="$t('product_material.warehouse.storekeeper')"
         align="center"
         prop="warehouseKeeperId"
+        :formatter="showWarehouseKeeperId"
       />
       <el-table-column
         :label="$t('product_material.warehouse.warehouseDescription')"
@@ -71,6 +72,7 @@
       <add-warehouse
         :form="form"
         :warehouseTypeList="warehouseTypeList"
+        :customerSelectList="customerSelectList"
         @submit="handleSubmit"
         @cancel="handleCancel"
         ref="addWarehouse"
@@ -85,6 +87,8 @@ import query from "@/components/query/index.vue";
 import addWarehouse from "./addWarehouse.vue";
 
 import * as API from "@/api/product-material/warehouse/index.js";
+import { customerList } from "@/api/product-material/customer/index.js";
+
 export default {
   components: {
     test,
@@ -94,6 +98,7 @@ export default {
   data() {
     return {
       warehouseTypeList: [],
+      customerSelectList: [],
       selectConfig: [
         {
           label: this.$t("product_material.warehouse.warehouseType"),
@@ -145,6 +150,10 @@ export default {
       label: item.dictValue,
       value: item.dictKey,
     }));
+
+    customerList({ pageNum: 1, pageSize: 999 }).then((res) => {
+      this.customerSelectList = res.data.data.records;
+    });
     this.getList();
   },
   methods: {
@@ -243,6 +252,14 @@ export default {
         });
       });
     },
+    showWarehouseKeeperId(row) {
+      const current = this.customerSelectList.find(
+        (x) => x.id === row.warehouseKeeperId
+      );
+      if (current) {
+        return current.name;
+      }
+    },
   },
 };
 </script>

+ 39 - 17
src/views/purchase-management/purchase/addPurchase.vue

@@ -20,11 +20,14 @@
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in purchaseTypeList"
+                  v-for="item in supplySelectList"
                   :key="item.id"
-                  :label="item.dictValue"
-                  :value="item.dictKey"
+                  :label="item.name"
+                  :value="item.id"
                 >
+                  <span style="float: left">{{
+                    `${item.name}(${dictDataEcho(item.type, supplyTypeList)})`
+                  }}</span>
                 </el-option>
               </el-select>
             </el-form-item>
@@ -70,50 +73,57 @@
             :content="$t('purchase_management.purchase.subscribeDetails')"
           ></labelTitle>
         </div>
-        <!-- <el-form-item label-width="0px">
-          <el-button @click="selectDialog = true">
-            {{ $t("select") }}</el-button
-          >
-        </el-form-item> -->
+
         <el-form-item>
           <el-table :data="form.goodsList">
             <el-table-column
               :label="$t('purchase_management.purchase.goodCode')"
-              prop="code"
+              prop="goodsCode"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.purchase.goodName')"
-              prop="name"
+              prop="goodsName"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.purchase.goodType')"
-              prop="name"
+              prop="goodType"
+              :formatter="(row) => dictDataEcho(row.goodsType, productTypeList)"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.purchase.unit')"
-              prop="name"
+              prop="goodsUnit"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.purchase.subscribeQuantity')"
-              prop="name"
+              prop="quantity"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.purchase.stock')"
-              prop="name"
+              prop="stockQuantity"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.purchase.price')"
-              prop="name"
+              prop="price"
             >
               <template slot-scope="scope">
-                <el-form-item label-width="0px" prop="aa">
-                  <el-input> </el-input>
+                <el-form-item
+                  :prop="'goodsList.' + scope.$index + '.price'"
+                  :rules="formRules.price"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input
+                    v-model="scope.row.unitPrice"
+                    :placeholder="$t('pleaseInput')"
+                    size="mini"
+                  >
+                  </el-input>
                 </el-form-item>
               </template>
             </el-table-column>
@@ -157,6 +167,18 @@ export default {
       type: Object,
       default: () => {},
     },
+    supplySelectList: {
+      type: Array,
+      default: () => [],
+    },
+    supplyTypeList: {
+      type: Array,
+      default: () => [],
+    },
+    productTypeList: {
+      type: Array,
+      default: () => [],
+    },
   },
   data() {
     return {

+ 102 - 36
src/views/purchase-management/purchase/index.vue

@@ -8,6 +8,7 @@ import byTable from "@/components/by-table/index.js";
 import addPurchase from "./addPurchase.vue";
 
 import * as API from "@/api/purchase-management/purchase/index.js";
+import { supplySelect } from "@/api/product-material/supply/index.js";
 
 export default {
   components: {
@@ -18,6 +19,10 @@ export default {
   },
   data() {
     return {
+      purchaseStatusList: [],
+      productTypeList: [],
+      supplySelectList: [],
+      supplyTypeList: [],
       btnForm: {
         otherButton: {
           list: [
@@ -26,7 +31,7 @@ export default {
               methodsText: "add",
               type: "primary",
               add: () => {
-                this.handleAdd();
+                this.handlePurchases();
               },
             },
             {
@@ -76,28 +81,44 @@ export default {
         cause: "",
         goodsId: [],
       },
+      selectData: [],
     };
   },
   created() {
     const businessDictData = JSON.parse(
       window.localStorage.getItem("businessDict")
     );
-    const list = businessDictData.find(
+
+    this.productTypeList = businessDictData.find(
       (item) => item.code === "productType"
     ).children;
-    this.selectConfig[0].data = list.map((item) => ({
+    this.selectConfig[1].data = this.productTypeList.map((item) => ({
       label: item.dictValue,
       value: item.dictKey,
     }));
-    this.productTypeList = list;
-    // this.getList();
+
+    this.purchaseStatusList = businessDictData.find(
+      (item) => item.code === "purchaseStatus"
+    ).children;
+    this.selectConfig[0].data = this.purchaseStatusList.map((item) => ({
+      label: item.dictValue,
+      value: item.dictKey,
+    }));
+
+    this.supplyTypeList = businessDictData.find(
+      (item) => item.code === "supplyType"
+    ).children;
+
+    supplySelect({ name: "", code: "", type: "" }).then((res) => {
+      this.supplySelectList = res.data.data;
+    });
+    this.getList();
   },
   methods: {
     getList() {
       this.loading = true;
       API.purchaseList(this.queryParams).then(
         (res) => {
-          console.log(res, "qq");
           this.tableList = res.data.data.records;
           this.total = res.data.data.total;
           this.loading = false;
@@ -111,13 +132,33 @@ export default {
     handleQuery() {
       this.getList();
     },
-    handleAdd() {
+    handleSelectionChange(arr) {
+      this.selectData = arr;
+    },
+    handlePurchase(row) {
+      const goodsList = [{ ...row, unitPrice: "" }];
       this.form = {
+        flowId: "",
+        flowRemark: "",
         id: "",
-        receiptWarehouseId: "",
-        planArrivalTime: "",
-        cause: "",
-        goodsId: [],
+        code: "",
+        supplieId: "",
+        goodsList: goodsList,
+      };
+      this.titleText = "add";
+      this.open = true;
+    },
+    handlePurchases() {
+      if (!this.selectData.length > 0)
+        return this.msgInfo("请先选择要采购的数据");
+      const goodsList = this.selectData.map((x) => ({ ...x, unitPrice: "" }));
+      this.form = {
+        flowId: "",
+        flowRemark: "",
+        id: "",
+        code: "",
+        supplieId: "",
+        goodsList: goodsList,
       };
       this.titleText = "add";
       this.open = true;
@@ -140,24 +181,28 @@ export default {
         this.form.fileInfoList = [];
       }
       this.$nextTick(() => {
-        this.$refs.addCustomer.loading = true;
-        this.$refs.addCustomer.countryChange(this.form.countryId);
-        this.$refs.addCustomer.provinceChange(this.form.provinceId);
-        this.$refs.addCustomer.loading = false;
+        this.$refs.sendSubscribe.loading = true;
+        this.$refs.sendSubscribe.loading = false;
       });
     },
     handleSubmit() {
+      const goodsList = this.form.goodsList.map((x) => ({
+        id: x.id,
+        unitPrice: x.unitPrice,
+        quantity: x.quantity,
+      }));
+      this.form.goodsList = goodsList;
       if (!this.form.id) {
-        API.purchaseAdd(this.form).then(
+        API.sendPurchase(this.form).then(
           () => {
             this.msgSuccess(this.$t("addSuccess"));
-            this.$refs.addCustomer.loading = false;
+            this.$refs.sendSubscribe.loading = false;
             this.open = false;
             this.getList();
           },
           (err) => {
-            console.log("purchaseAdd: " + err);
-            this.$refs.addCustomer.loading = false;
+            console.log("sendPurchase: " + err);
+            this.$refs.sendSubscribe.loading = false;
           }
         );
       } else {
@@ -165,12 +210,12 @@ export default {
           () => {
             this.msgSuccess(this.$t("editSuccess"));
             this.open = false;
-            this.$refs.addCustomer.loading = false;
+            this.$refs.sendSubscribe.loading = false;
             this.getList();
           },
           (err) => {
             console.log("purchaseEdit: " + err);
-            this.$refs.addCustomer.loading = false;
+            this.$refs.sendSubscribe.loading = false;
           }
         );
       }
@@ -188,6 +233,13 @@ export default {
         });
       });
     },
+    isSelectable(row) {
+      if (row.status != 10) {
+        return false;
+      } else {
+        return true;
+      }
+    },
     showAddress(row) {
       return (
         <div>
@@ -217,41 +269,48 @@ export default {
           }
         "
       ></query>
-      <el-table :data="tableList" v-loading="loading">
+      <el-table
+        :data="tableList"
+        v-loading="loading"
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" :selectable="isSelectable">
+        </el-table-column>
         <el-table-column
           :label="$t('purchase_management.purchase.subscribeOddNumbers')"
           align="center"
           prop="code"
+          width="150"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.goodCode')"
           align="center"
-          prop="name"
+          prop="goodsCode"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.goodName')"
           align="center"
-          :formatter="showAddress"
+          prop="goodsName"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.goodType')"
           align="center"
-          prop="contacts"
+          :formatter="(row) => dictDataEcho(row.goodsType, productTypeList)"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.unit')"
           align="center"
-          prop="phone"
+          prop="goodsUnit"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.subscribeNums')"
           align="center"
-          prop="phone"
+          prop="quantity"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.price')"
           align="center"
-          prop="phone"
+          prop="price"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.totalAmount')"
@@ -261,34 +320,38 @@ export default {
         <el-table-column
           :label="$t('purchase_management.purchase.askArrivalTime')"
           align="center"
-          prop="phone"
+          prop="planArrivalTime"
+          width="160"
         />
         <el-table-column
           :label="$t('purchase_management.purchase.subscribeReason')"
           align="center"
-          prop="phone"
+          prop="cause"
         />
 
         <el-table-column
           :label="$t('purchase_management.purchase.purchaseStatus')"
           align="center"
-          prop="phone"
+          :formatter="(row) => dictDataEcho(row.status, purchaseStatusList)"
         />
 
         <el-table-column
           :label="$t('purchase_management.purchase.subscribePeople')"
           align="center"
-          prop="phone"
+          prop="createName"
         />
 
         <el-table-column :label="$t('operation')" align="center" width="120">
           <template slot-scope="scope">
-            <el-button type="text" @click="handleEdit(scope.row)"
-              >{{ $t("edit") }}
+            <el-button
+              type="text"
+              v-if="scope.row.status === 10"
+              @click="handlePurchase(scope.row)"
+              >{{ $t("purchase_management.purchase.purchase") }}
             </el-button>
-            <el-button type="text" @click="handleDelete(scope.row)"
+            <!-- <el-button type="text" @click="handleDelete(scope.row)"
               >{{ $t("delete") }}
-            </el-button>
+            </el-button> -->
           </template>
         </el-table-column>
       </el-table>
@@ -307,6 +370,9 @@ export default {
     >
       <add-purchase
         :form="form"
+        :supplyTypeList="supplyTypeList"
+        :supplySelectList="supplySelectList"
+        :productTypeList="productTypeList"
         @submit="handleSubmit"
         @cancel="handleCancel"
         ref="sendSubscribe"

+ 95 - 32
src/views/purchase-management/subscribe/index.vue

@@ -8,6 +8,7 @@ import byTable from "@/components/by-table/index.js";
 import sendSubscribe from "./sendSubscribe.vue";
 
 import * as API from "@/api/purchase-management/subscribe/index.js";
+import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
 
 export default {
   components: {
@@ -18,7 +19,11 @@ export default {
   },
   data() {
     return {
+      subscribeStatusList: [],
       productTypeList: [],
+      materialTypeList: [],
+      warehouseSelectList: [],
+      warehouseTypeList: [],
       btnForm: {
         otherButton: {
           list: [
@@ -38,7 +43,7 @@ export default {
         pageSize: 10,
         keyword: "",
         warehouseId: "",
-        status: "",
+        status: null,
         code: "",
         goodsCode: "",
         goodsName: "",
@@ -62,7 +67,7 @@ export default {
         receiptWarehouseId: "",
         planArrivalTime: "",
         cause: "",
-        goodsId: [{}],
+        goodsId: [],
       },
     };
   },
@@ -70,22 +75,33 @@ export default {
     const businessDictData = JSON.parse(
       window.localStorage.getItem("businessDict")
     );
-    const list = businessDictData.find(
+    this.productTypeList = businessDictData.find(
       (item) => item.code === "productType"
     ).children;
-    this.selectConfig[0].data = list.map((item) => ({
+    this.subscribeStatusList = businessDictData.find(
+      (item) => item.code === "subscribeStatus"
+    ).children;
+    this.warehouseTypeList = businessDictData.find(
+      (item) => item.code === "warehouseType"
+    ).children;
+    this.materialTypeList = businessDictData.find(
+      (item) => item.code === "materialType"
+    ).children;
+
+    this.selectConfig[0].data = this.subscribeStatusList.map((item) => ({
       label: item.dictValue,
       value: item.dictKey,
     }));
-    this.productTypeList = list;
-    // this.getList();
+    warehouseSelectList().then((res) => {
+      this.warehouseSelectList = res.data.data;
+    });
+    this.getList();
   },
   methods: {
     getList() {
       this.loading = true;
       API.subscribeList(this.queryParams).then(
         (res) => {
-          console.log(res, "qq");
           this.tableList = res.data.data.records;
           this.total = res.data.data.total;
           this.loading = false;
@@ -122,43 +138,72 @@ export default {
     },
     handleEdit(row) {
       this.titleText = "edit";
-      this.form = row;
       this.open = true;
-      if (this.form.fileInfoList === "") {
-        this.form.fileInfoList = [];
-      }
       this.$nextTick(() => {
-        this.$refs.addCustomer.loading = true;
-        this.$refs.addCustomer.countryChange(this.form.countryId);
-        this.$refs.addCustomer.provinceChange(this.form.provinceId);
-        this.$refs.addCustomer.loading = false;
+        this.$refs.sendSubscribe.loading = true;
+        API.subscribeDetails({ id: row.id }).then(
+          (res) => {
+            const data = res.data.data;
+            const goodsItem = {
+              goodsId: data.goodsId,
+              quantity: data.quantity,
+              code: data.goodsCode,
+              name: data.goodsName,
+              type: data.goodsType,
+              unit: data.goodsUnit,
+              stock: data.stockQuantity,
+            };
+            this.form = {
+              id: data.id,
+              receiptWarehouseId: data.receiptWarehouseId,
+              planArrivalTime: data.planArrivalTime,
+              cause: data.cause,
+              goodsId: [goodsItem],
+            };
+            this.$refs.sendSubscribe.loading = false;
+          },
+          (err) => {
+            console.log("subscribeDetails: ", err);
+            this.$refs.sendSubscribe.loading = false;
+          }
+        );
       });
     },
     handleSubmit() {
       if (!this.form.id) {
-        API.subscribeAdd(this.form).then(
+        const productList = this.form.goodsId.map((x) => {
+          return {
+            ...x,
+            planArrivalTime: this.form.planArrivalTime,
+            receiptWarehouseId: this.form.receiptWarehouseId,
+            cause: this.form.cause,
+          };
+        });
+        API.subscribeAdd(productList).then(
           () => {
             this.msgSuccess(this.$t("addSuccess"));
-            this.$refs.addCustomer.loading = false;
+            this.$refs.sendSubscribe.loading = false;
             this.open = false;
             this.getList();
           },
           (err) => {
             console.log("subscribeAdd: " + err);
-            this.$refs.addCustomer.loading = false;
+            this.$refs.sendSubscribe.loading = false;
           }
         );
       } else {
+        this.form.quantity = this.form.goodsId[0].quantity;
+        this.form.goodsId = this.form.goodsId[0].goodsId;
         API.subscribeEdit(this.form).then(
           () => {
             this.msgSuccess(this.$t("editSuccess"));
             this.open = false;
-            this.$refs.addCustomer.loading = false;
+            this.$refs.sendSubscribe.loading = false;
             this.getList();
           },
           (err) => {
             console.log("subscribeEdit: " + err);
-            this.$refs.addCustomer.loading = false;
+            this.$refs.sendSubscribe.loading = false;
           }
         );
       }
@@ -210,67 +255,81 @@ export default {
           :label="$t('purchase_management.subscribe.subscribeOddNumbers')"
           align="center"
           prop="code"
+          width="140"
         />
         <el-table-column
           :label="$t('purchase_management.subscribe.goodCode')"
           align="center"
-          prop="name"
+          prop="goodsCode"
         />
         <el-table-column
           :label="$t('purchase_management.subscribe.goodName')"
           align="center"
-          :formatter="showAddress"
+          prop="goodsName"
         />
         <el-table-column
           :label="$t('purchase_management.subscribe.goodType')"
           align="center"
-          prop="contacts"
+          :formatter="(row) => dictDataEcho(row.goodsType, productTypeList)"
         />
         <el-table-column
           :label="$t('purchase_management.subscribe.unit')"
           align="center"
-          prop="phone"
+          prop="goodsUnit"
         />
         <el-table-column
           :label="$t('purchase_management.subscribe.subscribeNums')"
           align="center"
-          prop="phone"
+          prop="quantity"
         />
         <el-table-column
           :label="$t('purchase_management.subscribe.askArrivalTime')"
           align="center"
-          prop="phone"
+          prop="planArrivalTime"
+          width="160"
         />
 
         <el-table-column
           :label="$t('purchase_management.subscribe.harvestWarehouse')"
           align="center"
-          prop="phone"
+          prop="warehouseName"
         />
 
         <el-table-column
           :label="$t('purchase_management.subscribe.subscribeDate')"
           align="center"
-          prop="phone"
+          prop="createTime"
+          width="160"
+        />
+        <el-table-column
+          :label="$t('purchase_management.subscribe.subscribeReason')"
+          align="center"
+          prop="cause"
         />
         <el-table-column
           :label="$t('purchase_management.subscribe.subscribeReason')"
           align="center"
-          prop="phone"
+          :formatter="(row) => dictDataEcho(row.status, subscribeStatusList)"
         />
 
         <el-table-column
           :label="$t('purchase_management.subscribe.subscribePeople')"
           align="center"
-          prop="phone"
+          prop="createName"
         />
 
         <el-table-column :label="$t('operation')" align="center" width="120">
           <template slot-scope="scope">
-            <el-button type="text" @click="handleEdit(scope.row)"
+            <el-button
+              type="text"
+              v-if="scope.row.status === 10"
+              @click="handleEdit(scope.row)"
               >{{ $t("edit") }}
             </el-button>
-            <el-button type="text" @click="handleDelete(scope.row)"
+            <el-button
+              type="text"
+              v-if="scope.row.status === 10"
+              @click="handleDelete(scope.row)"
               >{{ $t("delete") }}
             </el-button>
           </template>
@@ -291,6 +350,10 @@ export default {
     >
       <send-subscribe
         :form="form"
+        :productTypeList="productTypeList"
+        :materialTypeList="materialTypeList"
+        :warehouseSelectList="warehouseSelectList"
+        :warehouseTypeList="warehouseTypeList"
         @submit="handleSubmit"
         @cancel="handleCancel"
         ref="sendSubscribe"

+ 88 - 12
src/views/purchase-management/subscribe/sendSubscribe.vue

@@ -8,6 +8,9 @@
         :rules="formRules"
         label-width="100px"
       >
+        <!-- <el-row>
+          <el-button type="primary">{{ $t("select") }}</el-button>
+        </el-row> -->
         <el-row>
           <el-col :span="8">
             <el-form-item
@@ -20,11 +23,17 @@
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in subscribeTypeList"
+                  v-for="item in warehouseSelectList"
                   :key="item.id"
-                  :label="item.dictValue"
-                  :value="item.dictKey"
+                  :label="item.name"
+                  :value="item.id"
                 >
+                  <span style="float: left">{{
+                    `${item.name}(${dictDataEcho(
+                      item.type,
+                      warehouseTypeList
+                    )})`
+                  }}</span>
                 </el-option>
               </el-select>
             </el-form-item>
@@ -89,26 +98,37 @@
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.subscribe.goodType')"
-              prop="name"
+              prop="type"
+              :formatter="(row) => dictDataEcho(row.type, productTypeList)"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.subscribe.unit')"
-              prop="name"
+              prop="unit"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.subscribe.stock')"
-              prop="name"
+              prop="stock"
             >
             </el-table-column>
             <el-table-column
               :label="$t('purchase_management.subscribe.subscribeQuantity')"
-              prop="name"
+              width="120"
             >
               <template slot-scope="scope">
-                <el-form-item label-width="0px" prop="aa">
-                  <el-input> </el-input>
+                <el-form-item
+                  :prop="'goodsId.' + scope.$index + '.quantity'"
+                  :rules="formRules.quantity"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input
+                    v-model="scope.row.quantity"
+                    :placeholder="$t('pleaseInput')"
+                    size="mini"
+                  >
+                  </el-input>
                 </el-form-item>
               </template>
             </el-table-column>
@@ -136,22 +156,60 @@
         {{ $t("submit") }}</el-button
       >
     </div>
+
+    <el-dialog
+      :title="$t('goodsSelect')"
+      v-if="selectDialog"
+      :visible.sync="selectDialog"
+      width="80%"
+      top="60px"
+    >
+      <selectProduct @select="handleSelect"></selectProduct>
+    </el-dialog>
+
+    <!-- <el-dialog
+      :title="$t('goodsSelect')"
+      v-if="selectDialog"
+      :visible.sync="selectDialog"
+      width="80%"
+      top="60px"
+    >
+      <selectMaterial @select="handleSelect"></selectMaterial>
+    </el-dialog> -->
   </div>
 </template>
 
 <script>
 import labelTitle from "@/components/label-title/index.vue";
+import selectProduct from "@/components/select-product/index.vue";
+import selectMaterial from "@/components/select-material/index.vue";
 
 import { getToken } from "@/util/auth";
 
 export default {
   name: "addCustomer",
-  components: { labelTitle },
+  components: { labelTitle, selectProduct, selectMaterial },
   props: {
     form: {
       type: Object,
       default: () => {},
     },
+    productTypeList: {
+      type: Array,
+      default: () => [],
+    },
+    materialTypeList: {
+      type: Array,
+      default: () => [],
+    },
+    warehouseSelectList: {
+      type: Array,
+      default: () => [],
+    },
+    warehouseTypeList: {
+      type: Array,
+      default: () => [],
+    },
   },
   data() {
     return {
@@ -234,16 +292,17 @@ export default {
             trigger: "blur",
           },
         ],
-        phone: [
+        quantity: [
           {
             required: true,
             message:
               this.$t("pleaseInput") +
-              this.$t("purchase_management.subscribe.contactNumber"),
+              this.$t("purchase_management.subscribe.subscribeNums"),
             trigger: "blur",
           },
         ],
       },
+      selectDialog: false,
     };
   },
   created() {},
@@ -251,6 +310,7 @@ export default {
     handleSubmit() {
       this.$refs.form.validate((valid) => {
         if (valid) {
+          if (!this.form.goodsId.length > 0) return this.msgInfo("请选择物品");
           this.loading = true;
           this.$emit("submit");
         }
@@ -259,6 +319,22 @@ export default {
     handleCancel() {
       this.$emit("cancel");
     },
+    handleSelect(row) {
+      this.form.goodsId.push({
+        goodsId: row.id,
+        quantity: "",
+        code: row.code,
+        name: row.name,
+        type: row.type,
+        unit: row.unit,
+        stock: row.stockQuantity,
+      });
+      this.msgSuccess(this.$t("addSuccess"));
+    },
+    deleteRow(index) {
+      this.form.goodsId.splice(index, 1);
+      this.msgSuccess(this.$t("deleteSuccess"));
+    },
   },
 };
 </script>