Browse Source

品牌推广:可以后台操作推广

wangdy 8 years ago
parent
commit
2f1909ad96

+ 8 - 0
src/main/webapp/resources/js/admin/controllers/ads/ads_brand.js

@@ -48,6 +48,14 @@ define([ 'app/app' ], function(app) {
                 toaster.pop('error', '错误', res.data);
             })
         };
+        $scope.updateweight = function(brand){
+            BrandActive.setSimpleInfoWeight({weight: brand.inputWeight}, brand, function(data){
+                toaster.pop('success', '处理成功', '【' + data.nameCn + '】' + '已修改推广');
+                $scope.load('weight');
+            }, function(res){
+                toaster.pop('error', '错误', res.data);
+            })
+        };
 
     }]);
 });

+ 3 - 3
src/main/webapp/resources/view/admin/ads/ads_brand.html

@@ -12,10 +12,10 @@
                         <td data-title="'厂商'" filter="{nameCn: 'text'}">{{brand.nameCn}}</td>
                         <td data-title="'权重'" >{{brand.weight}}</td>
                         <td data-title="'操作'">
-                            <button ng-click="disable(brand)" class="btn btn-danger btn-sm" ng-if="!brand.weight"><i class="fa fa-check"></i> 推广</button>
-                            <input type="number" style="height: 30px" ng-if="!brand.weight" ng-model="brand.inputWeight"/>
+                            <button ng-click="updateweight(brand)" class="btn btn-danger btn-sm" ng-if="!brand.weight"><i class="fa fa-check"></i> 推广</button>
                             <button ng-click="disweight(brand)" class="btn btn-danger btn-sm" ng-if="brand.weight"><i class="fa fa-check"></i> 解除推广</button>
-                            <button ng-click="" class="btn btn-danger btn-sm" ng-if="brand.weight"><i class="fa fa-check"></i> 修改推广</button>
+                            <button ng-click="updateweight(brand)" class="btn btn-danger btn-sm" ng-if="brand.weight"><i class="fa fa-check"></i> 修改推广</button>
+                            <input type="number" style="height: 30px"  ng-model="brand.inputWeight"/>
                         </td>
                     </tr>
                 </table>