Browse Source

测试的相关问题解决

cz 2 years ago
parent
commit
a1dd69b440

+ 1 - 1
src/router/page/index.js

@@ -274,7 +274,7 @@ export default [
     children: [
       {
         path: 'index',
-        name: '采购',
+        name: '采购',
         component: () => import(/* webpackChunkName: "page" */ '@/views/purchase-management/purchase/index'),
         props: true,
       },

+ 52 - 6
src/views/order-management/order/addOrder.vue

@@ -73,7 +73,25 @@
           <el-table :data="form.orderDetailsList" v-if="JDorder">
             <el-table-column label="产品编码" prop="code"> </el-table-column>
             <el-table-column label="产品名称" prop="name"> </el-table-column>
-            <el-table-column label="单价" prop="price"> </el-table-column>
+            <el-table-column label="单价" prop="price">
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'orderDetailsList.' + scope.$index + '.price'"
+                  :rules="formRules.price"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input
+                    v-model="scope.row.price"
+                    placeholder="请输入"
+                    style="width: 100%"
+                    size="mini"
+                    @change="totalAmount"
+                  >
+                  </el-input>
+                </el-form-item>
+              </template>
+            </el-table-column>
             <el-table-column label="数量" prop="quantity">
               <template slot-scope="scope">
                 <el-form-item
@@ -126,7 +144,25 @@
           <el-table :data="form.orderDetailsList" v-else>
             <el-table-column label="产品编码" prop="code"> </el-table-column>
             <el-table-column label="产品名称" prop="name"> </el-table-column>
-            <el-table-column label="单价" prop="price"> </el-table-column>
+            <el-table-column label="单价" prop="price">
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'orderDetailsList.' + scope.$index + '.price'"
+                  :rules="formRules.price"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input
+                    v-model="scope.row.price"
+                    placeholder="请输入"
+                    style="width: 100%"
+                    size="mini"
+                    @change="totalAmount"
+                  >
+                  </el-input>
+                </el-form-item>
+              </template>
+            </el-table-column>
             <el-table-column label="数量" prop="quantity">
               <template slot-scope="scope">
                 <el-form-item
@@ -401,6 +437,13 @@ export default {
             trigger: "blur",
           },
         ],
+        price: [
+          {
+            required: true,
+            message: "请输入单价",
+            trigger: "blur",
+          },
+        ],
         quantity: [
           {
             required: true,
@@ -452,13 +495,14 @@ export default {
           (x) => x.productId === row.id
         );
         if (flag) return this.msgInfo("该产品您已选择");
+        let price = row.purchasePrice ? row.purchasePrice : "0";
         this.form.orderDetailsList.push({
           code: row.code,
           name: row.name,
           subtotal: "",
           productId: row.id,
           quantity: undefined,
-          price: row.purchasePrice,
+          price: price,
           remark: "",
         });
       } else {
@@ -466,13 +510,14 @@ export default {
           (x) => x.productId === row.id
         );
         if (flag) return this.msgInfo("该产品您已选择");
+        let price = row.purchasePrice ? row.purchasePrice : "0";
         this.form.orderDetailsList.push({
           code: row.code,
           name: row.name,
           subtotal: "",
           productId: row.id,
           quantity: undefined,
-          price: row.purchasePrice,
+          price: price,
           remark: "",
         });
       }
@@ -490,18 +535,19 @@ export default {
     totalAmount() {
       if (this.JDorder) {
         this.form.orderDetailsList.forEach((x) => {
-          x.subtotal = Number(x.quantity) * Number(x.price);
+          x.subtotal = (x.quantity * (Number(x.price) * 100)) / 100;
         });
         this.form.money = this.form.orderDetailsList.reduce((sum, x) => {
           return sum + Number(x.subtotal);
         }, 0);
       } else {
         this.form.orderDetailsList.forEach((x) => {
-          x.subtotal = Number(x.quantity) * Number(x.price);
+          x.subtotal = (x.quantity * (Number(x.price) * 100)) / 100;
         });
         this.form.money = this.form.orderDetailsList.reduce((sum, x) => {
           return sum + Number(x.subtotal);
         }, 0);
+        console.log(this.form.orderDetailsList, "sss");
       }
     },
     handleSuccess(response, file, fileList) {

+ 29 - 7
src/views/product-material/product/addProduct.vue

@@ -34,8 +34,8 @@
               <el-input v-model="form.code" placeholder="请输入"></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="18">
-            <el-form-item label=".">
+          <el-col :span="18" style="margin-top: 30px">
+            <el-form-item label=" ">
               <span>不输入则自动生成,自动编码规则示例:P00001</span>
             </el-form-item>
           </el-col>
@@ -98,9 +98,9 @@
             <el-form-item label="库存清空期限" prop="clearancePeriod">
               <el-date-picker
                 v-model="form.clearancePeriod"
-                type="datetime"
+                type="date"
                 placeholder="请选择"
-                value-format="yyyy-MM-dd HH:mm:ss"
+                value-format="yyyy-MM-dd"
               >
               </el-date-picker>
             </el-form-item>
@@ -176,6 +176,7 @@
               <el-input
                 v-model="form.newProductsDay"
                 placeholder="请输入"
+                @change="handleChange"
               ></el-input>
             </el-col>
             <el-col :span="1" style="text-align: center"> : </el-col>
@@ -190,12 +191,13 @@
         <el-row :gutter="10">
           <el-form-item label="成长期" prop="growUpExpectedSales">
             <el-col :span="2" style="text-align: center">
-              61 &nbsp;&nbsp;~
+              {{ form.newProductsDay1 }} &nbsp;&nbsp;~
             </el-col>
             <el-col :span="3">
               <el-input
                 v-model="form.growUpDay"
                 placeholder="请输入"
+                @change="handleChange1"
               ></el-input>
             </el-col>
             <el-col :span="1" style="text-align: center"> : </el-col>
@@ -209,7 +211,7 @@
         </el-row>
         <el-row>
           <el-form-item label="成熟期" prop="matureExpectedSales">
-            <el-col :span="3"> 大于120天 : </el-col>
+            <el-col :span="3"> 大于{{ form.growUpDay1 }}天 : </el-col>
             <el-col :span="6">
               <el-input
                 v-model="form.matureExpectedSales"
@@ -267,7 +269,7 @@ export default {
       selectList: [],
       productTypeList: [],
       productUnitList: [],
-
+      fileList: [],
       formRules: {
         classifyId: [
           {
@@ -355,6 +357,11 @@ export default {
           this.loading = true;
           this.form.classifyId =
             this.form.classifyId[this.form.classifyId.length - 1];
+          this.form.fileInfoList = this.fileList.map((x) => {
+            return {
+              ...x.response.data,
+            };
+          });
           this.$emit("submit");
         }
       });
@@ -375,6 +382,21 @@ export default {
       this.form.productCombinationList.splice(index, 1);
       this.msgSuccess("删除成功");
     },
+    handleChange(val) {
+      this.$set(this.form, "newProductsDay1", Number(val) + 1);
+      this.$forceUpdate();
+    },
+    handleChange1(val) {
+      this.$set(this.form, "growUpDay1", val);
+      this.$forceUpdate();
+    },
+    handleSuccess(response, file, fileList) {
+      this.fileList = fileList;
+    },
+    handleRemove(file, fileList) {
+      this.fileList = fileList;
+    },
+    handlePreview() {},
   },
 };
 </script>

+ 13 - 24
src/views/product-material/product/index.vue

@@ -503,7 +503,6 @@ export default {
       this.loading = true;
       API.productList(this.req).then(
         (res) => {
-          console.log(res, "ss");
           this.tableList = res.data.data.records;
           this.total = res.data.data.total;
           this.loading = false;
@@ -524,25 +523,6 @@ export default {
     },
 
     handleCancel() {
-      this.form = {
-        classifyId: "",
-        deptId: "",
-        type: "",
-        code: "",
-        name: "",
-        unit: "",
-        combination: "",
-        purchasePrice: "",
-        sellingPrice: "",
-        jdPurchasePrice: "",
-        newProductsDay: "60",
-        growUpDay: "120",
-        newProductsExpectedSales: "",
-        growUpExpectedSales: "",
-        matureExpectedSales: "",
-        clearancePeriod: "",
-        productCombinationList: [],
-      };
       this.open = false;
     },
     productAdd() {
@@ -550,16 +530,18 @@ export default {
       this.form = {
         classifyId: "",
         deptId: "",
-        type: "",
+        type: "1",
         code: "",
         name: "",
         unit: "",
-        combination: "",
+        combination: "0",
         purchasePrice: "",
         sellingPrice: "",
         jdPurchasePrice: "",
         newProductsDay: "60",
         growUpDay: "120",
+        newProductsDay1: "61",
+        growUpDay1: "120",
         newProductsExpectedSales: "",
         growUpExpectedSales: "",
         matureExpectedSales: "",
@@ -569,20 +551,27 @@ export default {
       this.open = true;
     },
     handleEdit(row) {
+      // console.log(row, "ss");
       this.titleText = "edit";
       this.open = true;
+      const data = { ...row };
       if (row.combination === 1) {
         this.$nextTick(() => {
           this.$refs.addProduct.loading = true;
           API.getCombination({ id: row.id }).then((res) => {
-            this.form = row;
+            this.form = data;
+            this.form.newProductsDay1 = Number(this.form.newProductsDay) + 1;
+            this.form.growUpDay1 = this.form.growUpDay;
             this.form.combination = this.form.combination + "";
             this.form.productCombinationList = [...res.data.data.records];
+            console.log(this.form, "ss");
             this.$refs.addProduct.loading = false;
           });
         });
       } else {
-        this.form = row;
+        this.form = data;
+        this.form.newProductsDay1 = Number(this.form.newProductsDay) + 1;
+        this.form.growUpDay1 = this.form.growUpDay;
       }
     },
     handleDelete(row) {

+ 2 - 2
src/views/product-material/spu/addSpu.vue

@@ -14,8 +14,8 @@
               <el-input v-model="form.code" placeholder="请输入"></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="18">
-            <el-form-item label=".">
+          <el-col :span="18" style="margin-top: 30px">
+            <el-form-item label=" ">
               <span>不输入则自动生成,自动编码规则示例:spu00001</span>
             </el-form-item>
           </el-col>

+ 2 - 1
src/views/product-material/spu/index.vue

@@ -120,7 +120,8 @@ export default {
               productName: x.name,
               productId: x.id,
             }));
-            this.form = row;
+
+            this.form = JSON.parse(JSON.stringify(row));
             this.form.productIdList = list;
             this.$refs.addSpu.loading = false;
           },

+ 9 - 2
src/views/purchase-management/deliver-goods/index.vue

@@ -37,7 +37,7 @@ export default {
           data: [],
         },
       ],
-      tableList: [{}],
+      tableList: [],
       total: 0,
       loading: false,
       titleText: "",
@@ -83,7 +83,7 @@ export default {
         value: item.dictKey,
       }));
 
-    // this.getList();
+    this.getList();
   },
   methods: {
     deliverGoods() {
@@ -309,6 +309,13 @@ 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

+ 5 - 5
src/views/purchase-management/purchase/addPurchase.vue

@@ -56,7 +56,7 @@
             </el-table-column>
             <el-table-column
               label="物品类型"
-              prop="goodType"
+              prop="goodsType"
               :formatter="(row) => dictDataEcho(row.goodsType, productTypeList)"
             >
             </el-table-column>
@@ -65,11 +65,11 @@
             <el-table-column label="采购数量" prop="quantity">
             </el-table-column>
 
-            <el-table-column label="单价" prop="price">
+            <el-table-column label="单价" prop="unitPrice">
               <template slot-scope="scope">
                 <el-form-item
-                  :prop="'goodsList.' + scope.$index + '.price'"
-                  :rules="formRules.price"
+                  :prop="'goodsList.' + scope.$index + '.unitPrice'"
+                  :rules="formRules.unitPrice"
                   :inline-message="true"
                   label-width="0"
                 >
@@ -147,7 +147,7 @@ export default {
             trigger: "change",
           },
         ],
-        price: [
+        unitPrice: [
           {
             required: true,
             message: "请输入单价",

+ 14 - 1
src/views/purchase-management/purchase/index.vue

@@ -44,6 +44,7 @@ export default {
         warehouseId: "",
         status: "",
         code: "",
+        goodsType: "",
         goodsCode: "",
         goodsName: "",
         applyUserId: "",
@@ -58,11 +59,12 @@ export default {
         },
         {
           label: "物品类型",
-          prop: "type",
+          prop: "goodsType",
           data: [],
         },
       ],
       tableList: [],
+      total: 0,
       loading: false,
       titleText: "",
       open: false,
@@ -129,6 +131,9 @@ export default {
       );
     },
     handleQuery() {
+      // if (this.queryParams.goodsType) {
+      //   this.queryParams.goodsType = Number(this.queryParams.goodsType);
+      // }
       this.getList();
     },
     handleSelectionChange(arr) {
@@ -354,6 +359,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