Browse Source

修改B2B文件下载上传问题

shenjj 7 years ago
parent
commit
840e46ab75

BIN
src/main/webapp/resources/img/user/select.png


+ 5 - 0
src/main/webapp/resources/js/common/query/material.js

@@ -122,6 +122,11 @@ define([ 'ngResource' ], function() {
                 method: 'GET',
                 isArray: true
             },
+            // 单个物料导入
+            importOneMaterail: {
+              url: 'trade/products/edit/one',
+              method: 'POST'
+            }
         });
     }]);
 });

+ 42 - 19
src/main/webapp/resources/js/vendor/controllers/forstore/single_entry.js

@@ -19,7 +19,6 @@ define(['app/app', 'jquery-uploadify'], function(app) {
         minDelivery: 1,
         maxDelivery: 10,
         dateArea: 'formMe',
-        autoPublish: false,
         minBuyQty: 1
       }
     }
@@ -264,8 +263,8 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setPriceMinPackAmount = function(num) {
-      if (num === 0) {
-        toaster.pop('warning','提示', '最小包装数必须大于等于1')
+      if (num.indexOf('.') > -1) {
+        toaster.pop('warning', '提示', '最小包装数不能存在小数点')
         $scope.Regul.minPackQty = 1
       } else {
         $scope.Regul.minPackQty = num
@@ -273,8 +272,8 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setReserve = function(num) {
-      if (num === 0) {
-        toaster.pop('warning','提示', '库存数量必须大于等于1')
+      if (num.indexOf('.') > -1) {
+        toaster.pop('warning', '提示', '库存数量不能存在小数点')
         $scope.Regul.reserve = 1
       } else {
         $scope.Regul.reserve = num
@@ -282,15 +281,10 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setOnePrice = function(num) {
-      if (num === 0) {
-        toaster.pop('warning','提示', '库存数量必须大于等于1')
-        $scope.Regul.OnePrice = 1
-      } else {
-        $scope.Regul.OnePrice = num
-      }
+      $scope.Regul.OnePrice = num
     }
     // 修改规格书
-    $scope.onUploadSuccess = function(data){
+    $scope.onUploadSuccess = function(data) {
       $scope.Regul.Regulpic = data.path;
       $scope.Regul.Ischange = true
     };
@@ -432,13 +426,6 @@ define(['app/app', 'jquery-uploadify'], function(app) {
       if (!prices || !prices[index] || !price) {
         return;
       }
-      if (index === 0) {
-        if (Number(prices[index].rMBPrice) > 0 && $scope.storeInfo.enType !== 'HK') {
-          $scope.Regul.autoPublish = true
-        } else if (Number(prices[index].uSDPrice) > 0) {
-          $scope.Regul.autoPublish = true
-        }
-      }
       if (isNaN(price)) {
         prices[index].priceInvalid = true;
         toaster.pop('warning', '提示', '单价必须是大于0的数字');
@@ -620,6 +607,42 @@ define(['app/app', 'jquery-uploadify'], function(app) {
           $scope.Regul.selfSale = 0
         }
       }
+      var jsonObject = {
+        isPcb: $rootScope.isPcbStore ? 1 : 0,
+        goods: {},
+        product: {}
+      }
+      jsonObject.product = {
+        spec: $scope.Regul.spec, // 规格
+        minPackQty: $scope.Regul.minPackQty, // 最小包装量
+        erpReserve:  $scope.Regul.reserve, //库存
+        cmpCode: $scope.Regul.pcmpcode, //型号
+        brand: $scope.Regul.pbranden,//品牌
+        prodName: $scope.Regul.kind, // 名称
+        price: $scope.Regul.OnePrice, // 成本单价
+        attachment: $scope.Regul.Ischange ? '' : $scope.Regul.Regulpic, // 规格书
+        cmpImg: $scope.Regul.RegulImg !== $scope.Regul.iniUrlImg ? $scope.Regul.RegulImg : ''// 图片
+      }
+      jsonObject.goods =  {
+        minBuyQty: $scope.Regul.minBuyQty, // 最小起订量
+        //分段报价信息
+        prices: $scope.Regul.prices,
+        breakUp: $scope.Regul.breakUp, // 是否拆卖
+        minDelivery: $scope.Regul.minDelivery, // 最短交期
+        maxDelivery: $scope.Regul.maxDelivery,//  最长交期
+        selfSale: $scope.Regul.selfSale // 销售方式
+      }
+      Material.importOneMaterail({}, jsonObject, function(data) {
+        if (data.code == 1) {
+          toaster.pop('success', '保存成功');
+          initInfo()
+          initError()
+        } else {
+          toaster.pop('error', '失败', data.message);
+        }
+      }, function(response) {
+        toaster.pop('error', '失败', response.data);
+      });
       // Goods.updateGoods(null, $scope.productUpOff.goods, function(data) {
       //   if (data.code == 1) {
       //     toaster.pop('success', '保存成功');

+ 9 - 3
src/main/webapp/resources/view/vendor/forstore/single_entry.html

@@ -284,7 +284,7 @@
             <!-- 可编辑状态 oninput="if(value.length>6)value=value.slice(0,6)" -->
             <input type="text"
                    placeholder="请输入成本单价"
-                   ng-model="Regul.reserve"
+                   ng-model="Regul.OnePrice"
                    ng-blur="setOnePrice(Regul.OnePrice)"
                    class="form-control inputText" maxlength="50" validata-price
                    oninput="if(value.length>11)value=value.slice(0,11)"
@@ -438,7 +438,7 @@
       </div>
       <div class="editRegulControll">
         <div ng-click="productSave()">确定</div>
-        <!--<div ng-click="clearCheckBox()">取消</div>-->
+        <div ng-click="clearCheckBox()">取消</div>
       </div>
     </div>
   </div>
@@ -455,7 +455,7 @@
     text-align: right;
     color: #666;
   }
-  .editRegulControll{
+  .editRegulControll {
     text-align: center;
   }
   .editRegulControll div {
@@ -475,4 +475,10 @@
   .editRegulControll div:hover {
     background: #4290f7
   }
+  .editRegulControll div:last-child:hover {
+    background: #6b6b6b
+  }
+  .editRegulControll div:last-child {
+    background: #aaaaaa;
+  }
 </style>