Browse Source

将公共询价地址设置成可配置

liusw 7 years ago
parent
commit
d18979db51

+ 15 - 0
src/main/java/com/uas/platform/b2c/trade/seek/controller/SeekPurchaseBomController.java

@@ -3,6 +3,7 @@ package com.uas.platform.b2c.trade.seek.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.base.model.FileUpload;
+import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
 import com.uas.platform.b2c.core.support.view.JxlsExcelView;
@@ -23,7 +24,9 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.domain.Page;
+import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -44,6 +47,9 @@ public class SeekPurchaseBomController {
     @Autowired
     private SeekPurchaseBomService seekPurchaseBomService;
 
+    @Value("#{sys.inquiryServiceUrl ?: 'http://218.17.158.219:24000'}")
+    private String inquiryServiceUrl;
+
     /**
      * 日志
      */
@@ -181,4 +187,13 @@ public class SeekPurchaseBomController {
         logger.log("求购", "下载bom求购的Excel模板");
         return modelAndView;
     }
+
+    /**
+     * 请求地址
+     * @return
+     */
+    @RequestMapping(value = "/accessUrl", method = RequestMethod.GET)
+    private ModelMap getAccessUrl() {
+        return new ModelMap("url", inquiryServiceUrl);
+    }
 }

+ 5 - 1
src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseBomServiceImpl.java

@@ -54,6 +54,7 @@ import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.dao.DataAccessException;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
@@ -107,6 +108,9 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
     @Autowired
     private SearcherService searcherService;
 
+    @Value("#{sys.inquiryServiceUrl ?: 'http://218.17.158.219:24000'}")
+    private String inquiryServiceUrl;
+
     private int mallColNum = 8;
     private int mallRowNum = 500;
     private int startRow = 3;
@@ -486,7 +490,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         inquiry.setInquiryItems(inquiryItems);
         String res = "";
         try {
-            res = HttpUtil.doPost("http://218.17.158.219:24000/inquiry/buyer/save",  FlexJsonUtils.toJsonDeep(inquiry));
+            res = HttpUtil.doPost(inquiryServiceUrl + "/inquiry/buyer/save",  FlexJsonUtils.toJsonDeep(inquiry));
         } catch (Exception e) {
             throw new IllegalOperatorException("发布失败");
         }

+ 3 - 0
src/main/resources/dev/sys.properties

@@ -44,3 +44,6 @@ productServiceIp=http://192.168.253.12:24000
 
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292
+
+#inquiry service url
+inquiryServiceUrl=http://218.17.158.219:24000

+ 3 - 0
src/main/resources/prod/sys.properties

@@ -46,3 +46,6 @@ productServiceIp=http://10.10.0.197:8080
 
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292
+
+#inquiry service url
+inquiryServiceUrl=https://api-inquiry.usoftmall.com

+ 12 - 0
src/main/webapp/resources/js/common/query/seekPurchase.js

@@ -2,6 +2,10 @@ define([ 'ngResource' ], function() {
 	angular.module('seekPurchaseServices', [ 'ngResource' ]).factory('seekPurchase', ['$resource', 'BaseService', function($resource, BaseService) {
 		const rootPath = BaseService.getRootPath();
 		return $resource('seek', {}, {
+		  getSeekUrl: {
+		    url: 'seek/accessUrl',
+        method: 'GET'
+      },
       getSeekPurchaseRate: {
         url: 'seek/offer/getSeekPurchaseRate',
         method: 'GET'
@@ -14,10 +18,18 @@ define([ 'ngResource' ], function() {
         url: 'http://218.17.158.219:24000/inquiry/buyer/save',
         method: 'POST'
       },
+      saveOneSeekPurchaseProd: {
+        url: 'https://api-inquiry.usoftmall.com/inquiry/buyer/save',
+        method: 'POST'
+      },
       saveOffer: {
         url: 'http://218.17.158.219:24000/inquiry/sale/item/save',
         method: 'POST'
       },
+      saveOfferProd: {
+        url: 'https://api-inquiry.usoftmall.com/inquiry/sale/item/save',
+        method: 'POST'
+      },
       getUserSeekPageInfo: {
         url: 'http://218.17.158.219:24000/inquiry/buyer/list',
         method: 'GET'

+ 523 - 479
src/main/webapp/resources/js/usercenter/controllers/forstore/bom_detail_ctrl.js

@@ -6,102 +6,111 @@ define(['app/app'], function (app) {
     'use strict';
     app.register.controller('bomDetailCtrl',
         ['$scope', '$rootScope', 'seekPurchase', 'toaster', 'BaseService',
-            'ngTableParams', 'Order', 'SessionService', '$filter', '$upload', '$stateParams',
+            'ngTableParams', 'Order', 'SessionService', '$filter', '$upload', '$stateParams', '$http',
             function ($scope, $rootScope, seekPurchase, toaster, BaseService,
-                      ngTableParams, Order, SessionService, $filter, $upload, $stateParams) {
+                      ngTableParams, Order, SessionService, $filter, $upload, $stateParams, $http) {
                 $rootScope.active = 'seek_purchase';
                 document.title = '我的求购-优软商城';
                 $scope.isEditName = false;
 
                 // BOM名称
                 $scope.bomName = '';
-
+              seekPurchase.getSeekUrl({}, function(data) {
+                var seekUrl = data.url;
                 var getBomInfo = function () {
-                    if ($stateParams.id) {
-                      seekPurchase.findOneBom({id: $stateParams.id}, function (data) {
-                        $scope.bomInfo = data;
-                      }, function (response) {
-                        toaster.pop('error', response.data);
-                      });
-                    }
+                  if ($stateParams.id) {
+                    $http({
+                      method: 'get',
+                      dataType: 'json',
+                      url: seekUrl + '/inquiry/public/findInquiryById',
+                      params: {id: $stateParams.id}
+                    }).success(function (data) {
+                      $scope.bomInfo = data;
+                    }).error(function (response) {
+                      toaster.pop('error', response);
+                    });
+                  }
                 }
                 getBomInfo();
 
                 $scope.setIsEditName = function (flag) {
-                    if (flag) {
-                        $scope.bomName = $scope.bomInfo.name;
-                    }
-                    $scope.isEditName = flag;
+                  if (flag) {
+                    $scope.bomName = $scope.bomInfo.name;
+                  }
+                  $scope.isEditName = flag;
                 }
 
                 var getRealLen = function (str) {
-                    var len = 0;
-                    for (var i = 0; i < str.length; i++) {
-                        if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
-                            len += 2;
-                        } else {
-                            len++;
-                        }
+                  var len = 0;
+                  for (var i = 0; i < str.length; i++) {
+                    if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
+                      len += 2;
+                    } else {
+                      len++;
                     }
-                    return len;
+                  }
+                  return len;
                 }
 
                 $scope.onBomNameChange = function () {
-                    if (getRealLen($scope.bomName) > 40) {
-                        $scope.bomName = $scope.bomName.substring(0, $scope.bomName.length - 1);
-                    }
+                  if (getRealLen($scope.bomName) > 40) {
+                    $scope.bomName = $scope.bomName.substring(
+                        0, $scope.bomName.length - 1);
+                  }
                 }
 
                 $scope.saveBomName = function () {
-                    if (!$scope.bomName.length) {
-                        toaster.pop('info', 'bom名称不能为空');
-                    } else if (getRealLen($scope.bomName) > 40) {
-                        toaster.pop('info', 'bom名称不能超过40个字符');
-                    } else {
-                        seekPurchase.saveBomName({id: $scope.bomInfo.bomId, name: $scope.bomName}, function (data) {
-                            if (data.success) {
-                                toaster.pop('success', '修改成功');
-                                $scope.bomInfo.name = $scope.bomName;
-                                $scope.setIsEditName(false);
-                            } else {
-                                toaster.pop('error', data.message);
-                            }
+                  if (!$scope.bomName.length) {
+                    toaster.pop('info', 'bom名称不能为空');
+                  } else if (getRealLen($scope.bomName) > 40) {
+                    toaster.pop('info', 'bom名称不能超过40个字符');
+                  } else {
+                    seekPurchase.saveBomName(
+                        {id: $scope.bomInfo.bomId, name: $scope.bomName},
+                        function (data) {
+                          if (data.success) {
+                            toaster.pop('success', '修改成功');
+                            $scope.bomInfo.name = $scope.bomName;
+                            $scope.setIsEditName(false);
+                          } else {
+                            toaster.pop('error', data.message);
+                          }
                         }, function (response) {
-                            toaster.pop('error', response.data);
+                          toaster.pop('error', response.data);
                         })
-                    }
+                  }
                 }
 
                 var enIdFilter = $filter('EncryptionFilter');
 
                 $scope.applyObj = {
-                    code: '',
-                    brand: '',
-                    unitPrice: '',
-                    currency: 'RMB',
-                    encapsulation: '',
-                    produceDate: '',
-                    amount: '',
-                    deadline: ''
+                  code: '',
+                  brand: '',
+                  unitPrice: '',
+                  currency: 'RMB',
+                  encapsulation: '',
+                  produceDate: '',
+                  amount: '',
+                  deadline: ''
                 };
                 $scope.validObj = {
-                    code: true,
-                    brand: true,
-                    unitPrice: true,
-                    amount: true,
-                    deadline: true
+                  code: true,
+                  brand: true,
+                  unitPrice: true,
+                  amount: true,
+                  deadline: true
                 };
 
                 var getRealLen = function (str) {
-                    var len = 0;
-                    for (var i = 0; i < str.length; i++) {
-                        if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
-                            len += 2;
-                        } else {
-                            len++;
-                        }
+                  var len = 0;
+                  for (var i = 0; i < str.length; i++) {
+                    if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
+                      len += 2;
+                    } else {
+                      len++;
                     }
-                    return len;
+                  }
+                  return len;
                 }
 
                 $scope.nowDate = new Date();
@@ -110,287 +119,313 @@ define(['app/app'], function (app) {
                 $scope.deadDate.setMonth($scope.deadDate.getMonth() + 3);
 
                 $scope.checkCode = function () {
-                    $scope.validObj.code = $scope.applyObj.code && $scope.applyObj.code
-                        !== '';
-                    return this.validObj.code;
+                  $scope.validObj.code = $scope.applyObj.code
+                      && $scope.applyObj.code
+                      !== '';
+                  return this.validObj.code;
                 }
                 $scope.checkBrand = function () {
-                    $scope.validObj.brand = $scope.applyObj.brand
-                        && $scope.applyObj.brand !== '';
-                    return $scope.validObj.brand;
+                  $scope.validObj.brand = $scope.applyObj.brand
+                      && $scope.applyObj.brand !== '';
+                  return $scope.validObj.brand;
                 }
                 $scope.checkUnitPrice = function () {
-                    $scope.validObj.unitPrice = ($scope.applyObj.unitPrice === '' || !$scope.applyObj.unitPrice ) ? true
-                        : $scope.applyObj.unitPrice > 0 && $scope.applyObj.unitPrice
-                    < 100000000;
-                    return $scope.validObj.unitPrice;
+                  $scope.validObj.unitPrice = ($scope.applyObj.unitPrice === ''
+                      || !$scope.applyObj.unitPrice ) ? true
+                      : $scope.applyObj.unitPrice > 0
+                      && $scope.applyObj.unitPrice
+                      < 100000000;
+                  return $scope.validObj.unitPrice;
                 }
                 $scope.onUnitPriceInput = function () {
-                    var price = $scope.applyObj.unitPrice;
-                    if (angular.isNumber(price)) {
-                        if (price >= 10000) {
-                            $scope.applyObj.unitPrice = Number(price.toString().substring(0, 4));
-                        } else if (price.toString().indexOf('.') > -1) {
-                            var arr = price.toString().split(".");
-                            if (arr[0].length > 4) {
-                                $scope.applyObj.unitPrice = Number(arr[0].substring(0, 4) + '.' + arr[1]);
-                            } else if (arr[1].length > 6) {
-                                $scope.applyObj.unitPrice = Number(arr[0] + '.' + arr[1].substring(0, 6));
-                            }
-                        }
+                  var price = $scope.applyObj.unitPrice;
+                  if (angular.isNumber(price)) {
+                    if (price >= 10000) {
+                      $scope.applyObj.unitPrice = Number(
+                          price.toString().substring(0, 4));
+                    } else if (price.toString().indexOf('.') > -1) {
+                      var arr = price.toString().split(".");
+                      if (arr[0].length > 4) {
+                        $scope.applyObj.unitPrice = Number(arr[0].substring(0,
+                            4) + '.' + arr[1]);
+                      } else if (arr[1].length > 6) {
+                        $scope.applyObj.unitPrice = Number(arr[0] + '.'
+                            + arr[1].substring(0, 6));
+                      }
                     }
+                  }
                 }
                 $scope.onEncapsulationChange = function () {
-                    if ($scope.applyObj.encapsulation && getRealLen($scope.applyObj.encapsulation) > 20) {
-                        $scope.applyObj.encapsulation = $scope.applyObj.encapsulation.substring(0, $scope.applyObj.encapsulation.length - 1)
-                    }
+                  if ($scope.applyObj.encapsulation && getRealLen(
+                          $scope.applyObj.encapsulation) > 20) {
+                    $scope.applyObj.encapsulation = $scope.applyObj.encapsulation.substring(
+                        0, $scope.applyObj.encapsulation.length - 1)
+                  }
                 }
                 $scope.onCodeChange = function () {
-                    if ($scope.applyObj.code && getRealLen($scope.applyObj.code) > 30) {
-                        $scope.applyObj.code = $scope.applyObj.code.substring(0, $scope.applyObj.code.length - 1)
-                    }
+                  if ($scope.applyObj.code && getRealLen($scope.applyObj.code)
+                      > 30) {
+                    $scope.applyObj.code = $scope.applyObj.code.substring(
+                        0, $scope.applyObj.code.length - 1)
+                  }
                 }
                 $scope.onBrandChange = function () {
-                    if ($scope.applyObj.brand && getRealLen($scope.applyObj.brand) > 20) {
-                        $scope.applyObj.brand = $scope.applyObj.brand.substring(0, $scope.applyObj.brand.length - 1)
-                    }
+                  if ($scope.applyObj.brand && getRealLen($scope.applyObj.brand)
+                      > 20) {
+                    $scope.applyObj.brand = $scope.applyObj.brand.substring(
+                        0, $scope.applyObj.brand.length - 1)
+                  }
                 }
                 $scope.onProduceDateChange = function () {
-                    if ($scope.applyObj.produceDate && getRealLen($scope.applyObj.produceDate) > 12) {
-                        $scope.applyObj.produceDate = $scope.applyObj.produceDate.substring(0, $scope.applyObj.produceDate.length - 1)
-                    }
+                  if ($scope.applyObj.produceDate && getRealLen(
+                          $scope.applyObj.produceDate) > 12) {
+                    $scope.applyObj.produceDate = $scope.applyObj.produceDate.substring(
+                        0, $scope.applyObj.produceDate.length - 1)
+                  }
                 }
                 $scope.checkAmount = function () {
-                    $scope.validObj.amount = $scope.applyObj.amount === '' ? true
-                        : $scope.applyObj.amount > 0 && $scope.applyObj.amount
-                    < 100000000;
-                    return $scope.validObj.amount;
+                  $scope.validObj.amount = $scope.applyObj.amount === '' ? true
+                      : $scope.applyObj.amount > 0 && $scope.applyObj.amount
+                      < 100000000;
+                  return $scope.validObj.amount;
                 }
                 $scope.checkAll = function () {
-                    return $scope.checkCode() && $scope.checkBrand()
-                        && $scope.checkUnitPrice() && $scope.checkAmount()
-                        && $scope.checkDeadline();
+                  return $scope.checkCode() && $scope.checkBrand()
+                      && $scope.checkUnitPrice() && $scope.checkAmount()
+                      && $scope.checkDeadline();
                 }
                 $scope.checkDeadline = function () {
-                    $scope.validObj.deadline = $scope.applyObj.deadline
-                        && $scope.applyObj.deadline !== '';
-                    return $scope.validObj.deadline;
+                  $scope.validObj.deadline = $scope.applyObj.deadline
+                      && $scope.applyObj.deadline !== '';
+                  return $scope.validObj.deadline;
                 }
                 $scope.emptyForm = function () {
-                    for (var attr in $scope.applyObj) {
-                        $scope.applyObj[attr] = attr === 'currency' ? 'RMB' : '';
-                    }
+                  for (var attr in $scope.applyObj) {
+                    $scope.applyObj[attr] = attr === 'currency' ? 'RMB' : '';
+                  }
                 }
 
                 // 立即购买
                 $scope.purchase = function (go, index) {
-                    var goodsObj = {};
-                    goodsObj.batchCode = go.batchCode;
-                    goodsObj.currencyName = go.currencyName;
-                    goodsObj.minPackQty = go.minPackQty;
-                    goodsObj.number = $scope.fragments[index].num;
-                    goodsObj.storeUuid = go.storeid;
-                    goodsObj.storeid = go.storeid;
-                    var goodsList = [];
-                    goodsList.push(goodsObj);
-                    var rootPath = BaseService.getRootPath();
-                    if(go.minBuyQty > 0) {
-                        // 1、生成订单
-                        Order.buyNowInStore({spId: $scope.currentSeek.spId}, goodsList, function(data){
-                            if(data.message) {
-                                toaster.pop('info', data.message);
-                            }
-                            // 控制订单确认页,直接购买不显示进度条
-                            SessionService.set("buyNow", true);
-                            // 2、跳转到订单确认页面,进行付款操作
-                            window.open(rootPath + '/user#/order/pay/'+ enIdFilter(data.data.orderid));
-                        }, function(res){
-                            toaster.pop('error', '警告', res.data);
+                  var goodsObj = {};
+                  goodsObj.batchCode = go.batchCode;
+                  goodsObj.currencyName = go.currencyName;
+                  goodsObj.minPackQty = go.minPackQty;
+                  goodsObj.number = $scope.fragments[index].num;
+                  goodsObj.storeUuid = go.storeid;
+                  goodsObj.storeid = go.storeid;
+                  var goodsList = [];
+                  goodsList.push(goodsObj);
+                  var rootPath = BaseService.getRootPath();
+                  if (go.minBuyQty > 0) {
+                    // 1、生成订单
+                    Order.buyNowInStore({spId: $scope.currentSeek.spId},
+                        goodsList, function (data) {
+                          if (data.message) {
+                            toaster.pop('info', data.message);
+                          }
+                          // 控制订单确认页,直接购买不显示进度条
+                          SessionService.set("buyNow", true);
+                          // 2、跳转到订单确认页面,进行付款操作
+                          window.open(rootPath + '/user#/order/pay/'
+                              + enIdFilter(data.data.orderid));
+                        }, function (res) {
+                          toaster.pop('error', '警告', res.data);
                         });
-                    }else {
-                        toaster.pop('warning', '提示', '该商品库存为0,请等待上货或咨询客服');
-                    }
+                  } else {
+                    toaster.pop('warning', '提示', '该商品库存为0,请等待上货或咨询客服');
+                  }
                 }
 
                 // 买家求购列表
                 $scope.searchStatus = 0;
                 $scope.seekPurchaseTableParams = new ngTableParams({
-                    page: 1,
-                    count: 10
+                  page: 1,
+                  count: 10
                 }, {
-                    total: 0,
-                    getData: function ($defer, params) {
-                        const param = BaseService.parseParams(params.url());
-                        // param.isMallGoods = $scope.isMallGoods;
-                        // param.deadline = $scope.deadline;
-                        // param.keyWord = $scope.keyWord;
-                        // param.status = $scope.searchStatus;
-                        param.id = $stateParams.id;
-                        // param.minReleaseDate = $scope.startDate
-                        //     ? $scope.startDate.getTime() : null;
-                        // param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime()
-                        //     : null;
-                      if ($scope.isSearch) {
-                        param.page = 1;
-                        params.page(1);
-                        $scope.isSearch = false;
-                      }
-                        seekPurchase.getBomDetail(param, function (data) {
-                            params.total(data.totalElements);
-                            $defer.resolve(data.content);
-                            $scope.seekListData = data;
-                        }, function (response) {
-                            toaster.pop('error', response.data);
-                        });
-                    }
+                  total: 0,
+                  getData: function ($defer, params) {
+                    const param = BaseService.parseParams(params.url());
+                    // param.isMallGoods = $scope.isMallGoods;
+                    // param.deadline = $scope.deadline;
+                    // param.keyWord = $scope.keyWord;
+                    // param.status = $scope.searchStatus;
+                    param.id = $stateParams.id;
+                    // param.minReleaseDate = $scope.startDate
+                    //     ? $scope.startDate.getTime() : null;
+                    // param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime()
+                    //     : null;
+                    if ($scope.isSearch) {
+                      param.page = 1;
+                      params.page(1);
+                      $scope.isSearch = false;
+                    }
+                    $http({
+                      method: 'get',
+                      dataType: 'json',
+                      url: seekUrl + '/inquiry/sale/publicInquiry/detail',
+                      params: param
+                    }).success(function (data) {
+                      params.total(data.totalElements);
+                      $defer.resolve(data.content);
+                      $scope.seekListData = data;
+                    }).error(function (response) {
+                      toaster.pop('error', response);
+                    });
+                  }
                 });
 
                 // 搜索
                 $scope.onSearch = function (searchStatus) {
                   $scope.isSearch = true;
-                    if (searchStatus) {
-                        $scope.searchStatus = searchStatus;
-                    }
-                    $scope.seekPurchaseTableParams.reload();
+                  if (searchStatus) {
+                    $scope.searchStatus = searchStatus;
+                  }
+                  $scope.seekPurchaseTableParams.reload();
                 }
 
                 // 采纳报价
                 $scope.adopt = function () {
-                    if (!$scope.purchaseQuantity) {
-                        toaster.pop('error', "请输入正确的采购数量");
-                        return;
+                  if (!$scope.purchaseQuantity) {
+                    toaster.pop('error', "请输入正确的采购数量");
+                    return;
+                  }
+                  seekPurchase.updateSeekPurchaseStatus({
+                    spId: $scope.currentOffer.spId,
+                    ofId: $scope.currentOffer.id,
+                    purchaseQuantity: $scope.purchaseQuantity
+                  }, {}, function (data) {
+                    if (data.success) {
+                      $scope.currentOffer = null;
+                      $scope.seekPurchaseTableParams.reload();
+                      $scope.showUseFlag = false;
+                      toaster.pop('success', '采纳报价成功');
+                    } else {
+                      toaster.pop('error', data.message);
                     }
-                    seekPurchase.updateSeekPurchaseStatus({
-                        spId: $scope.currentOffer.spId,
-                        ofId: $scope.currentOffer.id,
-                        purchaseQuantity: $scope.purchaseQuantity
-                    }, {}, function (data) {
-                        if (data.success) {
-                            $scope.currentOffer = null;
-                            $scope.seekPurchaseTableParams.reload();
-                            $scope.showUseFlag = false;
-                            toaster.pop('success', '采纳报价成功');
-                        } else {
-                            toaster.pop('error', data.message);
-                        }
-                    }, function (response) {
-                        toaster.pop('error', response.data);
-                    });
+                  }, function (response) {
+                    toaster.pop('error', response.data);
+                  });
                 }
 
                 $scope.offerCount = 0;
                 $scope.goodsCount = 0;
                 $scope.currentSeek = {};
                 $scope.setSeekStatus = function (seek, status) {
-                    $scope.offerCount = seek.offerAmount || 0;
-                    $scope.goodsCount = seek.goodsAmount || 0;
-                    $scope.currentSeek = seek;
-                    // 查看报价
-                    if (status == 2 && $scope.offerCount != 0) {
-                        seekPurchase.getSeekPurchaseOfferPageInfo(
-                            {count: 100, page: 1, spId: seek.spId}, function (data) {
-                                $scope.offer = data.content;
-                                clearSeekStatus();
-                                seek.$status = status;
-                            });
-                    } else if (status == 1 && $scope.goodsCount != 0) {// 查看现货
-                        seekPurchase.getMallGoodsList({spId: seek.spId}, function (data) {
-                            $scope.goods = data;
-                            clearSeekStatus();
-                            initFragments();
-                            seek.$status = status;
+                  $scope.offerCount = seek.offerAmount || 0;
+                  $scope.goodsCount = seek.goodsAmount || 0;
+                  $scope.currentSeek = seek;
+                  // 查看报价
+                  if (status == 2 && $scope.offerCount != 0) {
+                    seekPurchase.getSeekPurchaseOfferPageInfo(
+                        {count: 100, page: 1, spId: seek.spId},
+                        function (data) {
+                          $scope.offer = data.content;
+                          clearSeekStatus();
+                          seek.$status = status;
                         });
-                    } else if (status == 0) { // 收起
-                        seek.$status = status;
-                    }
-                    $scope.selectAmount = 0;
-                    $scope.selectPrice = 0;
+                  } else if (status == 1 && $scope.goodsCount != 0) {// 查看现货
+                    seekPurchase.getMallGoodsList({spId: seek.spId},
+                        function (data) {
+                          $scope.goods = data;
+                          clearSeekStatus();
+                          initFragments();
+                          seek.$status = status;
+                        });
+                  } else if (status == 0) { // 收起
+                    seek.$status = status;
+                  }
+                  $scope.selectAmount = 0;
+                  $scope.selectPrice = 0;
                 }
 
                 var clearSeekStatus = function () {
-                    angular.forEach($scope.seekListData.content, function (item) {
-                        item.$status = 0;
-                    })
+                  angular.forEach($scope.seekListData.content, function (item) {
+                    item.$status = 0;
+                  })
                 }
 
                 $scope.condition = {
-                    endDateOpen: false,
-                    startDateOpen: false,
-                    deadlineOpen: false
+                  endDateOpen: false,
+                  startDateOpen: false,
+                  deadlineOpen: false
                 };
                 // 打开日期选择框
-                $scope.openDatePicker = function ($event, item, openParam, status) {
-                    if (status != null) {
-                        if (status == 1) {
-                            if ($scope.startDate != null) {
-                                return;
-                            }
-                        }
-                        if (status == 2) {
-                            if ($scope.endDate != null) {
-                                return;
-                            }
-                        }
+                $scope.openDatePicker = function ($event, item, openParam,
+                    status) {
+                  if (status != null) {
+                    if (status == 1) {
+                      if ($scope.startDate != null) {
+                        return;
+                      }
                     }
-                    $event.preventDefault();
-                    $event.stopPropagation();
-                    item[openParam] = !item[openParam];
-                    if (openParam == 'startDateOpen') {
-                        if (item['endDateOpen']) {
-                            item['endDateOpen'] = !item['endDateOpen'];
-                        }
-                    } else if (openParam == 'endDateOpen') {
-                        if (item['startDateOpen']) {
-                            item['startDateOpen'] = !item['startDateOpen'];
-                        }
+                    if (status == 2) {
+                      if ($scope.endDate != null) {
+                        return;
+                      }
+                    }
+                  }
+                  $event.preventDefault();
+                  $event.stopPropagation();
+                  item[openParam] = !item[openParam];
+                  if (openParam == 'startDateOpen') {
+                    if (item['endDateOpen']) {
+                      item['endDateOpen'] = !item['endDateOpen'];
                     }
+                  } else if (openParam == 'endDateOpen') {
+                    if (item['startDateOpen']) {
+                      item['startDateOpen'] = !item['startDateOpen'];
+                    }
+                  }
                 };
                 $scope.changeEndDate = function () {
-                    if ($scope.condition.endDateOpen) {
-                        $scope.endDate = $scope.endDate.toString().replace(
-                            /[0-9]{2}:[0-9]{2}:[0-9]{2}/g, '23:59:59');//;'23.59';//DateUtil.yyyyMmDd($scope.endDate.getTime() + 86399000);
-                        $scope.endDate = new Date(
-                            formatDateTime(new Date($scope.endDate.toString())));
-                    }
-                    $scope.vaildDate(false);
+                  if ($scope.condition.endDateOpen) {
+                    $scope.endDate = $scope.endDate.toString().replace(
+                        /[0-9]{2}:[0-9]{2}:[0-9]{2}/g, '23:59:59');//;'23.59';//DateUtil.yyyyMmDd($scope.endDate.getTime() + 86399000);
+                    $scope.endDate = new Date(
+                        formatDateTime(new Date($scope.endDate.toString())));
+                  }
+                  $scope.vaildDate(false);
                 };
                 $scope.vaildDate = function (isStart) {
-                    if ($scope.endDate !== null && $scope.startDate > $scope.endDate) {
-                        if (isStart) {
-                            alert("开始日期大于结束日期,请重新输入!");
-                            $scope.startDate = null;
-                        } else {
-                            alert("开始日期大于结束日期,请重新输入!");
-                            $scope.endDate = null;
-                        }
+                  if ($scope.endDate !== null && $scope.startDate
+                      > $scope.endDate) {
+                    if (isStart) {
+                      alert("开始日期大于结束日期,请重新输入!");
+                      $scope.startDate = null;
+                    } else {
+                      alert("开始日期大于结束日期,请重新输入!");
+                      $scope.endDate = null;
                     }
+                  }
                 };
                 var formatDateTime = function (date) {
-                    var y = date.getFullYear();
-                    var m = date.getMonth() + 1;
-                    m = m < 10 ? ('0' + m) : m;
-                    var d = date.getDate();
-                    d = d < 10 ? ('0' + d) : d;
-                    var h = date.getHours();
-                    var minute = date.getMinutes();
-                    var sec = date.getSeconds();
-                    minute = minute < 10 ? ('0' + minute) : minute;
-                    return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + sec;
+                  var y = date.getFullYear();
+                  var m = date.getMonth() + 1;
+                  m = m < 10 ? ('0' + m) : m;
+                  var d = date.getDate();
+                  d = d < 10 ? ('0' + d) : d;
+                  var h = date.getHours();
+                  var minute = date.getMinutes();
+                  var sec = date.getSeconds();
+                  minute = minute < 10 ? ('0' + minute) : minute;
+                  return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':'
+                      + sec;
                 };
                 // 选择查找日期
                 $scope.onDateCondition = function () {
-                    $scope.param.page = 1;
-                    $scope.orderTableParams.page(1);
-                    $scope.orderTableParams.reload();
+                  $scope.param.page = 1;
+                  $scope.orderTableParams.page(1);
+                  $scope.orderTableParams.reload();
                 };
 
                 /*获取时间戳代表的天数*/
                 $scope.getDay = function (timeStamp) {
-                    return Math.floor(timeStamp / (1000 * 60 * 60 * 24));
+                  return Math.floor(timeStamp / (1000 * 60 * 60 * 24));
                 }
                 /*获取时间戳代表的小时*/
                 $scope.getHours = function (timeStamp) {
-                    return Math.floor((timeStamp / (1000 * 60 * 60)) % 24);
+                  return Math.floor((timeStamp / (1000 * 60 * 60)) % 24);
                 }
 
                 /*
@@ -399,272 +434,281 @@ define(['app/app'], function (app) {
                 $scope.fragments = [];
 
                 function initFragment(commodity) {
-                    if (!commodity) {
-                        return {};
-                    }
-                    var fragment = {};
-                    var prices = commodity.prices[0];
-                    fragment.num = commodity.minBuyQty;
-                    fragment.prices = prices;
+                  if (!commodity) {
+                    return {};
+                  }
+                  var fragment = {};
+                  var prices = commodity.prices[0];
+                  fragment.num = commodity.minBuyQty;
+                  fragment.prices = prices;
 
-                    if (commodity.currencyName !== 'USD') {
-                        fragment.currency = 'RMB';
-                    } else {
-                        fragment.currency = 'USD';
-                    }
+                  if (commodity.currencyName !== 'USD') {
+                    fragment.currency = 'RMB';
+                  } else {
+                    fragment.currency = 'USD';
+                  }
 
-                    if (fragment.currency !== 'USD') {
-                        fragment.price = prices.rMBPrice;
-                    } else {
-                        fragment.price = prices.uSDPrice;
-                    }
-                    fragment.canAdd = true;
-                    fragment.canSub = false;
-                    return fragment;
+                  if (fragment.currency !== 'USD') {
+                    fragment.price = prices.rMBPrice;
+                  } else {
+                    fragment.price = prices.uSDPrice;
+                  }
+                  fragment.canAdd = true;
+                  fragment.canSub = false;
+                  return fragment;
                 }
 
                 function initFragments() {
-                    angular.forEach($scope.goods, function (item) {
-                        $scope.fragments.push(initFragment(item));
-                    })
+                  angular.forEach($scope.goods, function (item) {
+                    $scope.fragments.push(initFragment(item));
+                  })
                 }
 
                 function getFragment(commodity, fragment) {
-                    // 判断是否小于第一分段的起订量
-                    if (commodity.prices[0].start > fragment.num) {
-                        fragment.num = commodity.prices[0].start;
-                    }
-                    // 获取分段的信息
-                    var prices = commodity.prices;
-                    for (var i = 0; i < prices.length; i++) {
-                        if (fragment.num <= prices[i].end) {
-                            fragment.prices = prices[i];
-                            break;
-                        }
-                    }
+                  // 判断是否小于第一分段的起订量
+                  if (commodity.prices[0].start > fragment.num) {
+                    fragment.num = commodity.prices[0].start;
+                  }
+                  // 获取分段的信息
+                  var prices = commodity.prices;
+                  for (var i = 0; i < prices.length; i++) {
+                    if (fragment.num <= prices[i].end) {
+                      fragment.prices = prices[i];
+                      break;
+                    }
+                  }
                 }
 
                 $scope.onInput = function (index) {
-                    var prices = $scope.goods[index].prices;
-                    if (prices && prices.length) {
-                        for (var i = 0; i < prices.length; i++) {
-                            if ($scope.fragments[index].num >= prices[i].start
-                                && $scope.fragments[index].num <= prices[i].end) {
-                                $scope.fragments[index].price = $scope.fragments[index].currency
-                                === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice;
-                                break;
-                            }
-                        }
+                  var prices = $scope.goods[index].prices;
+                  if (prices && prices.length) {
+                    for (var i = 0; i < prices.length; i++) {
+                      if ($scope.fragments[index].num >= prices[i].start
+                          && $scope.fragments[index].num <= prices[i].end) {
+                        $scope.fragments[index].price = $scope.fragments[index].currency
+                        === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice;
+                        break;
+                      }
                     }
-                    if ($scope.goods[index].$checked) {
-                        var amount = 0;
-                        angular.forEach($scope.seekListData.content, function (item) {
-                            if (item.$status == 1) {
-                                amount = item.amount;
-                            }
+                  }
+                  if ($scope.goods[index].$checked) {
+                    var amount = 0;
+                    angular.forEach($scope.seekListData.content,
+                        function (item) {
+                          if (item.$status == 1) {
+                            amount = item.amount;
+                          }
                         })
+                    if (amount > 0) {
+                      $scope.selectAmount = 0;
+                    }
+                    $scope.selectPrice = 0;
+                    angular.forEach($scope.goods, function (item, index) {
+                      if (item.$checked) {
                         if (amount > 0) {
-                            $scope.selectAmount = 0;
+                          if (amount < $scope.selectAmount
+                              + $scope.fragments[index].num) {
+                            $scope.fragments[index].num = amount
+                                - $scope.selectAmount;
+                          } else {
+                            $scope.selectAmount += $scope.fragments[index].num;
+                          }
                         }
-                        $scope.selectPrice = 0;
-                        angular.forEach($scope.goods, function (item, index) {
-                            if (item.$checked) {
-                                if (amount > 0) {
-                                    if (amount < $scope.selectAmount
-                                        + $scope.fragments[index].num) {
-                                        $scope.fragments[index].num = amount
-                                            - $scope.selectAmount;
-                                    } else {
-                                        $scope.selectAmount += $scope.fragments[index].num;
-                                    }
-                                }
-                                $scope.selectPrice += $scope.fragments[index].num
-                                    * $scope.fragments[index].price;
-                            }
-                        })
-                    }
+                        $scope.selectPrice += $scope.fragments[index].num
+                            * $scope.fragments[index].price;
+                      }
+                    })
+                  }
                 }
                 $scope.changeNum = function (newNum, index) {
-                    var pack = $scope.goods[index].perQty
-                        || $scope.goods[index].minPackQty;
-                    var buy = $scope.goods[index].minBuyQty;
-                    var reserve = $scope.goods[index].reserve;
-                    var breakUp = $scope.goods[index].breakUp;
-                    if (!newNum) {
+                  var pack = $scope.goods[index].perQty
+                      || $scope.goods[index].minPackQty;
+                  var buy = $scope.goods[index].minBuyQty;
+                  var reserve = $scope.goods[index].reserve;
+                  var breakUp = $scope.goods[index].breakUp;
+                  if (!newNum) {
+                    $scope.fragments[index].num = buy;
+                  } else {
+                    newNum = parseInt(newNum);
+                    if (breakUp) {
+                      if (newNum < buy) {
+                        toaster.pop('info', '提示', '最小起订量为' + buy);
                         $scope.fragments[index].num = buy;
+                        $scope.fragments[index].canSub = false;
+                        $scope.fragments[index].canAdd = true;
+                      } else if (newNum > reserve) {
+                        toaster.pop('info', '提示', '库存不足');
+                        $scope.fragments[index].num = reserve;
+                        $scope.fragments[index].canAdd = false;
+                        $scope.fragments[index].canSub = true;
+                      } else {
+                        $scope.fragments[index].canSub = true;
+                        $scope.fragments[index].canAdd = true;
+                        $scope.fragments[index].num = newNum;
+                        newNum === buy
+                        && ($scope.fragments[index].canSub = false);
+                        newNum === reserve
+                        && ($scope.fragments[index].canAdd = false);
+                      }
                     } else {
-                        newNum = parseInt(newNum);
-                        if (breakUp) {
-                            if (newNum < buy) {
-                                toaster.pop('info', '提示', '最小起订量为' + buy);
-                                $scope.fragments[index].num = buy;
-                                $scope.fragments[index].canSub = false;
-                                $scope.fragments[index].canAdd = true;
-                            } else if (newNum > reserve) {
-                                toaster.pop('info', '提示', '库存不足');
-                                $scope.fragments[index].num = reserve;
-                                $scope.fragments[index].canAdd = false;
-                                $scope.fragments[index].canSub = true;
-                            } else {
-                                $scope.fragments[index].canSub = true;
-                                $scope.fragments[index].canAdd = true;
-                                $scope.fragments[index].num = newNum;
-                                newNum === buy && ($scope.fragments[index].canSub = false);
-                                newNum === reserve
-                                && ($scope.fragments[index].canAdd = false);
-                            }
+                      if (newNum < buy) {
+                        toaster.pop('info', '提示', '最小起订量为' + buy);
+                        $scope.fragments[index].num = buy;
+                        $scope.fragments[index].canSub = false;
+                        if (newNum > reserve) {
+                          toaster.pop('info', '提示', '库存不足');
+                          $scope.fragments[index].num = reserve - (reserve
+                              % pack);
+                          $scope.fragments[index].canAdd = false;
+                        }
+                      } else if (newNum > reserve) {
+                        $scope.fragments[index].canSub = true;
+                        $scope.fragments[index].canAdd = false;
+                        toaster.pop('info', '提示', '库存不足');
+                        $scope.fragments[index].num = reserve - (reserve
+                            % pack);
+                      } else {
+                        $scope.fragments[index].canSub = true;
+                        $scope.fragments[index].canAdd = true;
+                        var remainder = newNum % pack;
+                        if (remainder !== 0) {
+                          toaster.pop('info', '提示', '不支持拆包且包装量为' + pack);
+                          var res = (Math.floor(newNum / pack) + 1) * pack;
+                          $scope.fragments[index].num = res > reserve
+                              ? Math.floor(newNum / pack) * pack : res;
                         } else {
-                            if (newNum < buy) {
-                                toaster.pop('info', '提示', '最小起订量为' + buy);
-                                $scope.fragments[index].num = buy;
-                                $scope.fragments[index].canSub = false;
-                                if (newNum > reserve) {
-                                    toaster.pop('info', '提示', '库存不足');
-                                    $scope.fragments[index].num = reserve - (reserve % pack);
-                                    $scope.fragments[index].canAdd = false;
-                                }
-                            } else if (newNum > reserve) {
-                                $scope.fragments[index].canSub = true;
-                                $scope.fragments[index].canAdd = false;
-                                toaster.pop('info', '提示', '库存不足');
-                                $scope.fragments[index].num = reserve - (reserve % pack);
-                            } else {
-                                $scope.fragments[index].canSub = true;
-                                $scope.fragments[index].canAdd = true;
-                                var remainder = newNum % pack;
-                                if (remainder !== 0) {
-                                    toaster.pop('info', '提示', '不支持拆包且包装量为' + pack);
-                                    var res = (Math.floor(newNum / pack) + 1) * pack;
-                                    $scope.fragments[index].num = res > reserve
-                                        ? Math.floor(newNum / pack) * pack : res;
-                                } else {
-                                    $scope.fragments[index].num = newNum;
-                                }
-                                newNum === buy && ($scope.fragments[index].canSub = false);
-                                newNum === reserve
-                                && ($scope.fragments[index].canAdd = false);
-                            }
+                          $scope.fragments[index].num = newNum;
                         }
+                        newNum === buy
+                        && ($scope.fragments[index].canSub = false);
+                        newNum === reserve
+                        && ($scope.fragments[index].canAdd = false);
+                      }
                     }
+                  }
                 }
                 $scope.subNum = function (index) {
-                    if ($scope.fragments[index].canSub) {
-                        var pack = $scope.goods[index].perQty
-                            || $scope.goods[index].minPackQty;
-                        var newNum = 0;
-                        if ($scope.goods[index].breakUp) {
-                            newNum = $scope.fragments[index].num - 1;
-                        } else {
-                            newNum = $scope.fragments[index].num - pack;
-                        }
-                        $scope.changeNum(newNum, index)
-                        getFragment($scope.goods[index], $scope.fragments[index]);
-                        $scope.onInput(index);
+                  if ($scope.fragments[index].canSub) {
+                    var pack = $scope.goods[index].perQty
+                        || $scope.goods[index].minPackQty;
+                    var newNum = 0;
+                    if ($scope.goods[index].breakUp) {
+                      newNum = $scope.fragments[index].num - 1;
                     } else {
-                        toaster.pop('info', '提示', '该商品最少购买' + $scope.goods[index].minBuyQty + '件');
+                      newNum = $scope.fragments[index].num - pack;
                     }
+                    $scope.changeNum(newNum, index)
+                    getFragment($scope.goods[index], $scope.fragments[index]);
+                    $scope.onInput(index);
+                  } else {
+                    toaster.pop('info', '提示', '该商品最少购买'
+                        + $scope.goods[index].minBuyQty + '件');
+                  }
                 }
                 $scope.addNum = function (index) {
-                    if ($scope.fragments[index].canAdd) {
-                        var pack = $scope.goods[index].perQty
-                            || $scope.goods[index].minPackQty;
-                        var newNum = 0;
-                        if ($scope.goods[index].breakUp) {
-                            newNum = $scope.fragments[index].num + 1;
-                        } else {
-                            newNum = $scope.fragments[index].num + pack;
-                        }
-                        $scope.changeNum(newNum, index)
-                        getFragment($scope.goods[index], $scope.fragments[index]);
-                        $scope.onInput(index);
+                  if ($scope.fragments[index].canAdd) {
+                    var pack = $scope.goods[index].perQty
+                        || $scope.goods[index].minPackQty;
+                    var newNum = 0;
+                    if ($scope.goods[index].breakUp) {
+                      newNum = $scope.fragments[index].num + 1;
                     } else {
-                        toaster.pop('info', '提示', '库存不足');
+                      newNum = $scope.fragments[index].num + pack;
                     }
+                    $scope.changeNum(newNum, index)
+                    getFragment($scope.goods[index], $scope.fragments[index]);
+                    $scope.onInput(index);
+                  } else {
+                    toaster.pop('info', '提示', '库存不足');
+                  }
                 }
                 $scope.inputNum = function (index) {
-                    if ((/^[\d]*$/).test($scope.fragments[index].num)) {
-                        $scope.changeNum($scope.fragments[index].num, index);
-                        getFragment($scope.goods[index], $scope.fragments[index]);
-                    } else {
-                        toaster.pop('info', '提示', '请输入整数');
-                        $scope.fragments[index].num = $scope.goods[index].minBuyQty;
-                    }
-                    $scope.onInput(index);
+                  if ((/^[\d]*$/).test($scope.fragments[index].num)) {
+                    $scope.changeNum($scope.fragments[index].num, index);
+                    getFragment($scope.goods[index], $scope.fragments[index]);
+                  } else {
+                    toaster.pop('info', '提示', '请输入整数');
+                    $scope.fragments[index].num = $scope.goods[index].minBuyQty;
+                  }
+                  $scope.onInput(index);
                 }
 
                 $scope.showUseFlag = false;
                 $scope.setShowUseFlag = function (flag, offer) {
-                    if (flag) {
-                        $scope.currentOffer = offer;
-                    }
-                    // 如果当前求购数量不为空
-                    if ($scope.currentSeek.amount) {
-                        $scope.purchaseQuantity = $scope.currentSeek.amount;
-                        flag = false;
-                        $scope.adopt();
-                    }
-                    $scope.showUseFlag = flag;
+                  if (flag) {
+                    $scope.currentOffer = offer;
+                  }
+                  // 如果当前求购数量不为空
+                  if ($scope.currentSeek.amount) {
+                    $scope.purchaseQuantity = $scope.currentSeek.amount;
+                    flag = false;
+                    $scope.adopt();
+                  }
+                  $scope.showUseFlag = flag;
                 }
 
                 $scope.selectAmount = 0;
                 $scope.selectPrice = 0;
                 $scope.onSelectGoods = function (goods, seek, goodsIndex) {
-                    if (goods.$checked) {
-                        if (seek.amount) {
-                            if (seek.amount < $scope.selectAmount
-                                + $scope.fragments[goodsIndex].num) {
-                                goods.$checked = false;
-                                return;
-                            }
-                            $scope.selectAmount += $scope.fragments[goodsIndex].num;
-                        }
-                        $scope.selectPrice += $scope.fragments[goodsIndex].num
-                            * $scope.fragments[goodsIndex].price;
-                    } else {
-                        if (seek.amount) {
-                            $scope.selectAmount -= $scope.fragments[goodsIndex].num;
-                        }
-                        $scope.selectPrice -= $scope.fragments[goodsIndex].num
-                            * $scope.fragments[goodsIndex].price;
+                  if (goods.$checked) {
+                    if (seek.amount) {
+                      if (seek.amount < $scope.selectAmount
+                          + $scope.fragments[goodsIndex].num) {
+                        goods.$checked = false;
+                        return;
+                      }
+                      $scope.selectAmount += $scope.fragments[goodsIndex].num;
+                    }
+                    $scope.selectPrice += $scope.fragments[goodsIndex].num
+                        * $scope.fragments[goodsIndex].price;
+                  } else {
+                    if (seek.amount) {
+                      $scope.selectAmount -= $scope.fragments[goodsIndex].num;
                     }
+                    $scope.selectPrice -= $scope.fragments[goodsIndex].num
+                        * $scope.fragments[goodsIndex].price;
+                  }
                 }
 
                 // 上传Excel批量发布(大量)
-                $scope.upload = function() {
-                    // if(($scope.bomFiles == null) || ($scope.bomFiles.length == 0)) {
-                    //   return ;
-                    // }
-                    var file = angular.element('#uploadCommodity')[0].files[0];
-                    console.info(file);
-                    if(!file) {
-                        toaster.pop('info', '请选择需要上传的文件');
-                        return;
-                    }
-                    $upload.upload({
-                        url: 'seek/importBom',
-                        file: file,
-                        method: 'POST'
-                    }).success(function(data) {
-                        window.open("http://10.1.51.90:3000/applyPurchase/" + data.data);
-                    }).error(function(response) {
-                    });
+                $scope.upload = function () {
+                  // if(($scope.bomFiles == null) || ($scope.bomFiles.length == 0)) {
+                  //   return ;
+                  // }
+                  var file = angular.element('#uploadCommodity')[0].files[0];
+                  console.info(file);
+                  if (!file) {
+                    toaster.pop('info', '请选择需要上传的文件');
+                    return;
+                  }
+                  $upload.upload({
+                    url: 'seek/importBom',
+                    file: file,
+                    method: 'POST'
+                  }).success(function (data) {
+                    window.open("http://10.1.51.90:3000/applyPurchase/"
+                        + data.data);
+                  }).error(function (response) {
+                  });
                 };
 
                 $scope.bomTableParams = new ngTableParams({
-                    page: 1,
-                    count: 10
+                  page: 1,
+                  count: 10
                 }, {
-                    total: 0,
-                    getData: function ($defer, params) {
-                        const param = BaseService.parseParams(params.url());
-                        seekPurchase.getSeekPurchaseBomListPage(param, function (data) {
-                            params.total(data.totalElements);
-                            $scope.bomTotal = data.totalElements;
-                            $defer.resolve(data.content);
+                  total: 0,
+                  getData: function ($defer, params) {
+                    const param = BaseService.parseParams(params.url());
+                    seekPurchase.getSeekPurchaseBomListPage(param,
+                        function (data) {
+                          params.total(data.totalElements);
+                          $scope.bomTotal = data.totalElements;
+                          $defer.resolve(data.content);
                         }, function (response) {
-                            toaster.pop('error', response.data);
+                          toaster.pop('error', response.data);
                         });
-                    }
+                  }
                 });
+              });
             }]);
 });

+ 65 - 51
src/main/webapp/resources/js/usercenter/controllers/forstore/seek_purchase_ctrl.js

@@ -6,9 +6,9 @@ define(['app/app'], function (app) {
   'use strict';
   app.register.controller('seekPurchaseCtrl',
       ['$scope', '$rootScope', 'seekPurchase', 'toaster', 'BaseService',
-        'ngTableParams', 'Order', 'SessionService', '$filter', '$upload', '$stateParams', 'Search',
+        'ngTableParams', 'Order', 'SessionService', '$filter', '$upload', '$stateParams', 'Search', '$http',
         function ($scope, $rootScope, seekPurchase, toaster, BaseService,
-            ngTableParams, Order, SessionService, $filter, $upload, $stateParams, Search) {
+            ngTableParams, Order, SessionService, $filter, $upload, $stateParams, Search, $http) {
           $rootScope.active = 'seek_purchase';
           document.title = '我的求购-优软商城';
           $scope.activeType = $stateParams.type ? $stateParams.type :'seekManage';
@@ -16,8 +16,15 @@ define(['app/app'], function (app) {
             clearSeekStatus();
             $scope.activeType = type;
           }
-          var enIdFilter = $filter('EncryptionFilter');
 
+          var clearSeekStatus = function () {
+            angular.forEach($scope.seekListData.content, function (item) {
+              item.$status = 0;
+            })
+          }
+          var enIdFilter = $filter('EncryptionFilter');
+          seekPurchase.getSeekUrl({}, function(data) {
+            var seekUrl = data.url;
             $scope.tab = 'waitOffer';
             $scope.toogleTab = function (tab) {
                 $scope.tab = tab;
@@ -48,12 +55,17 @@ define(['app/app'], function (app) {
                         ? $scope.startDate.getTime() : null;
                     param.endDate = $scope.endDate ? $scope.endDate.getTime()
                         : null;
-                    seekPurchase.getUserSeekPageInfo(param, function (data) {
+                    $http({
+                      method: 'get',
+                      dataType: 'json',
+                      url: seekUrl + '/inquiry/buyer/list',
+                      params: param
+                    }).success(function (data) {
                       params.total(data.totalElements);
                       $defer.resolve(data.content);
                       $scope.seekListData = data;
-                    }, function (response) {
-                      toaster.pop('error', response.data);
+                    }).error(function (response) {
+                      toaster.pop('error', response);
                     });
                   } else if($scope.tab == 'offered') {
                     param._state = "done";
@@ -62,19 +74,22 @@ define(['app/app'], function (app) {
                     } else {
                       param.userUU = $scope.userInfo.userUU;
                     }
-                    // param.isMallGoods = $scope.isMallGoods;
-                    // param.deadline = $scope.deadline;
                     param.keyword = $scope.keyWord;
                     param.fromDate = $scope.startDate
                         ? $scope.startDate.getTime() : null;
                     param.endDate = $scope.endDate ? $scope.endDate.getTime()
                         : null;
-                    seekPurchase.getUserSeekPageInfoByStatus(param, function (data) {
+                    $http({
+                      method: 'get',
+                      dataType: 'json',
+                      url: seekUrl + '/inquiry/buyer/quotations',
+                      params: param
+                    }).success(function (data) {
                       params.total(data.totalElements);
                       $defer.resolve(data.content);
                       $scope.seekListData = data;
-                    }, function (response) {
-                      toaster.pop('error', response.data);
+                    }).error(function (response) {
+                      toaster.pop('error', response);
                     });
                   }
                 }
@@ -116,23 +131,23 @@ define(['app/app'], function (app) {
               } else {
                 param.userUU = $scope.userInfo.userUU;
               }
-              // param.minReleaseDate = $scope.bomSearch.startDate
-              //     ? $scope.bomSearch.startDate.getTime() : null;
-              // param.maxReleaseDate = $scope.bomSearch.endDate ? $scope.bomSearch.endDate.getTime()
-              //     : null;
-              // param.name = $scope.bomSearch.name;
               // 返回首页
               if ($scope.isSearch) {
                 param.page = 1;
                 params.page(1);
                 $scope.isSearch = false;
               }
-              seekPurchase.getSeekPurchaseBomListPage(param, function (data) {
+              $http({
+                method: 'get',
+                dataType: 'json',
+                url: seekUrl + '/inquiry/buyer/inquiryList',
+                params: param
+              }).success(function (data) {
                 params.total(data.totalElements);
                 $scope.bomTotal = data.totalElements;
                 $defer.resolve(data.content);
-              }, function (response) {
-                toaster.pop('error', response.data);
+              }).error(function (response) {
+                toaster.pop('error', response);
               });
             }
           });
@@ -162,6 +177,7 @@ define(['app/app'], function (app) {
 
           $scope.deadDate = new Date();
           $scope.deadDate.setMonth($scope.deadDate.getMonth() + 3);
+          $scope.deadDate.setDate($scope.deadDate.getDate() + 1);
 
           $scope.checkCode = function () {
             $scope.setShowSimilarCodeList($scope.isInCodeList);
@@ -299,8 +315,6 @@ define(['app/app'], function (app) {
             if ($scope.checkAll()) {
               var inquiry = {};
               var inquiryItem = {};
-
-
               inquiry.recorderUU = $scope.userInfo.userUU;
               inquiry.code = "MALL" + $filter('date')(new Date, 'yyyyMMddsss');
               inquiry.date = new Date();
@@ -332,21 +346,29 @@ define(['app/app'], function (app) {
               var inquiryItems = [];
               inquiryItems.push(inquiryItem);
               inquiry.inquiryItems = inquiryItems;
+              if (seekUrl == 'https://api-inquiry.usoftmall.com') {
+                seekPurchase.saveOneSeekPurchaseProd(inquiry,
+                    function (data) {
+                      $scope.showUseFlag = false;
+                      $scope.seekPurchaseTableParams.reload();
+                      $scope.emptyForm();
+                      toaster.pop('success', '求购发布成功');
+                    }, function (res) {
+                      toaster.pop('error', res.data);
+                    });
+              } else {
+                seekPurchase.saveOneSeekPurchase(inquiry,
+                    function (data) {
+                      $scope.showUseFlag = false;
+                      $scope.seekPurchaseTableParams.reload();
+                      $scope.emptyForm();
+                      toaster.pop('success', '求购发布成功');
+                    }, function (res) {
+                      toaster.pop('error', res.data);
+                    });
+              }
 
-              seekPurchase.saveOneSeekPurchase(inquiry,
-                  function (data) {
-                    $scope.showUseFlag = false;
-                    $scope.seekPurchaseTableParams.reload();
-                    $scope.emptyForm();
-                    toaster.pop('success', '求购发布成功');
-                  }, function (res) {
-                    toaster.pop('error', res.data);
-                  });
             } else {
-              // if (!$scope.validObj.code) {
-              //   // toaster.pop('error', '型号不能为空');
-              // } else if (!$scope.validObj.brand) {
-              //   // toaster.pop('error', '品牌不能为空');
               if (!$scope.validObj.deadline) {
                 toaster.pop('error', '截止日期不能为空');
               } else if (!$scope.validObj.unitPrice) {
@@ -404,11 +426,16 @@ define(['app/app'], function (app) {
           }
           // 采纳报价
           $scope.adopt = function (id) {
-            seekPurchase.updateSeekPurchaseStatus({id: id, status: 1},{},function(){
+            $http({
+              method: 'POST',
+              dataType: 'json',
+              url: seekUrl + '/inquiry/buyer/decide',
+              params: {id: id, status: 1}
+            }).success(function (data) {
               toaster.pop('success', '采纳报价成功');
               $scope.seekPurchaseTableParams.reload();
-            }, function(response){
-              toaster.pop('error', response.data);
+            }).error(function (response) {
+              toaster.pop('error', response);
             });
           }
 
@@ -424,13 +451,6 @@ define(['app/app'], function (app) {
             });
             // 查看报价
             if (status == 2 && $scope.offerCount != 0) {
-              // seekPurchase.getSeekPurchaseOfferPageInfo(
-              //
-              //     {id: seek.sourceId, enUU:$scope.userInfo.enterprise.uu}, function (data) {
-              //       $scope.offer = data.inquiryItems;
-              //       clearSeekStatus();
-              //       seek.$status = status;
-              //     });
               $scope.offer = seek.qutations;
               clearSeekStatus();
               seek.$status = status;
@@ -445,12 +465,6 @@ define(['app/app'], function (app) {
             $scope.selectPrice = 0;
           }
 
-          var clearSeekStatus = function () {
-            angular.forEach($scope.seekListData.content, function (item) {
-              item.$status = 0;
-            })
-          }
-
           $scope.condition = {
             endDateOpen: false,
             startDateOpen: false,
@@ -844,6 +858,6 @@ define(['app/app'], function (app) {
           $scope.setLinkBoxIndex = function (index) {
             $scope.linkBoxIndex = index;
           }
-          
+          });
         }]);
 });

+ 84 - 74
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_offer_ctrl.js

@@ -1,17 +1,11 @@
 define(['app/app'], function(app) {
-    app.register.controller('purchaseOfferCtrl', ['$scope', '$rootScope', '$stateParams', '$state', 'toaster', 'seekPurchase', 'BaseService', 'ngTableParams', '$modal', function ($scope, $rootScope, $stateParams, $state, toaster, seekPurchase, BaseService, ngTableParams, $modal) {
+    app.register.controller('purchaseOfferCtrl', ['$scope', '$rootScope', '$stateParams', '$state', 'toaster', 'seekPurchase', 'BaseService', 'ngTableParams', '$modal', '$http', function ($scope, $rootScope, $stateParams, $state, toaster, seekPurchase, BaseService, ngTableParams, $modal, $http) {
         document.title = '我的报价-优软商城';
         $rootScope.active = 'vendor_seek_purchase';
         $scope.seekPurchaseRate = {};
         $scope.offer = {};
-
-        // 获取当前卖家求购成交率
-        seekPurchase.getSeekPurchaseRate(function(data) {
-            $scope.seekPurchaseRate = data;
-        }, function(response) {
-            toaster.pop('error', '错误', response.data);
-        });
-
+      seekPurchase.getSeekUrl({}, function(data) {
+        var seekUrl = data.url;
         // 获取我的报价列表
         $scope.seekPurchaseTableParams = new ngTableParams({
           pageNumber: 1,
@@ -39,13 +33,18 @@ define(['app/app'], function(app) {
                 params.page(1);
                 $scope.isSearch = false;
               }
-                seekPurchase.getMyOfferPageInfo(param, function (data) {
-                    params.total(data.totalElements);
-                    $defer.resolve(data.content);
-                    $scope.seekListData = data.content;
-                }, function (response) {
-                    toaster.pop('error', '获取求购列表失败');
-                });
+              $http({
+                method: 'get',
+                dataType: 'json',
+                url: seekUrl + '/inquiry/public/quotation/list',
+                params: param
+              }).success(function (data) {
+                params.total(data.totalElements);
+                $defer.resolve(data.content);
+                $scope.seekListData = data;
+              }).error(function (response) {
+                toaster.pop('error', response);
+              });
             }
         });
 
@@ -158,75 +157,86 @@ define(['app/app'], function(app) {
         $scope.setLinkBoxIndex = function (index) {
             $scope.linkBoxIndex = index;
         }
-
+      });
     }]);
     app.register.controller('groundingSeekCtrl', ['$scope', 'toaster', 'seek', '$modalInstance', function ($scope, toaster, seek, $modalInstance) {
-        $scope.seek = angular.copy(seek);
-        $scope.cancel = function () {
-            $modalInstance.dismiss();
+      $scope.seek = angular.copy(seek);
+      $scope.cancel = function () {
+        $modalInstance.dismiss();
+      }
+
+      $scope.formData = {
+        minPackQty: 1,
+        breakUp: true
+      };
+
+      $scope.prices = [{}];
+
+      // 库存校验
+      $scope.checkReserve = function () {
+        if ($scope.formData.reserve) {
+          $scope.formData.reserve = $scope.formData.reserve < 1 ? 1
+              : $scope.formData.reserve > 99999999 ? 99999999
+                  : $scope.formData.reserve;
         }
-
-        $scope.formData = {
-            minPackQty: 1,
-            breakUp: true
-        };
-
-        $scope.prices = [{}];
-        
-        // 库存校验
-        $scope.checkReserve = function () {
-            if ($scope.formData.reserve) {
-                $scope.formData.reserve = $scope.formData.reserve < 1 ? 1 : $scope.formData.reserve > 99999999 ? 99999999 : $scope.formData.reserve;
-            }
+      }
+
+      // 起订量校验
+      $scope.checkMinBuyQty = function () {
+        if ($scope.formData.minBuyQty < 1) {
+          $scope.formData.minBuyQty = 1
+        } else if ($scope.formData.reserve && $scope.formData.minBuyQty
+            > $scope.formData.reserve) {
+          $scope.formData.minBuyQty = $scope.formData.reserve
+        } else if (!$scope.formData.breakUp) {
+          if ($scope.formData.minBuyQty < $scope.formData.minPackQty) {
+            $scope.formData.minBuyQty = $scope.formData.minPackQty;
+          } else if ($scope.formData.minBuyQty % $scope.formData.minPackQty
+              != 0) {
+            $scope.formData.minBuyQty = $scope.formData.minBuyQty
+                - $scope.formData.minBuyQty % $scope.formData.minPackQty;
+          }
         }
-
-        // 起订量校验
-        $scope.checkMinBuyQty = function () {
-            if ($scope.formData.minBuyQty < 1) {
-                $scope.formData.minBuyQty = 1
-            } else if ($scope.formData.reserve && $scope.formData.minBuyQty > $scope.formData.reserve) {
-                $scope.formData.minBuyQty = $scope.formData.reserve
-            } else if (!$scope.formData.breakUp) {
-                if ($scope.formData.minBuyQty < $scope.formData.minPackQty) {
-                    $scope.formData.minBuyQty = $scope.formData.minPackQty;
-                } else if ($scope.formData.minBuyQty % $scope.formData.minPackQty != 0) {
-                    $scope.formData.minBuyQty = $scope.formData.minBuyQty - $scope.formData.minBuyQty % $scope.formData.minPackQty;
-                }
-            }
+      }
+
+      // 最小包装数量校验
+      $scope.checkMinPacyQty = function () {
+        if ($scope.formData.minPackQty) {
+          $scope.formData.minPackQty = $scope.formData.minPackQty < 1 ? 1
+              : $scope.formData.minPackQty > 99999 ? 99999
+                  : $scope.formData.minPackQty;
         }
-        
-        // 最小包装数量校验
-        $scope.checkMinPacyQty = function () {
-            if ($scope.formData.minPackQty) {
-                $scope.formData.minPackQty = $scope.formData.minPackQty < 1 ? 1 : $scope.formData.minPackQty > 99999 ? 99999 : $scope.formData.minPackQty;
-            }
+      }
+
+      $scope.checkMinDate = function () {
+        $scope.formData.minDate = $scope.formData.minDate < 1 ? 1
+            : $scope.formData.minDate > 31 ? 31 : $scope.formData.minDate;
+        if ($scope.formData.maxDate && $scope.formData.minDate
+            > $scope.formData.maxDate) {
+          $scope.formData.minDate = $scope.formData.maxDate;
         }
-
-        $scope.checkMinDate = function () {
-            $scope.formData.minDate = $scope.formData.minDate < 1 ? 1 : $scope.formData.minDate > 31 ? 31 : $scope.formData.minDate;
-            if ($scope.formData.maxDate && $scope.formData.minDate > $scope.formData.maxDate) {
-                $scope.formData.minDate = $scope.formData.maxDate;
-            }
+      }
+
+      $scope.checkMaxDate = function () {
+        $scope.formData.maxDate = $scope.formData.maxDate < 1 ? 1
+            : $scope.formData.maxDate > 31 ? 31 : $scope.formData.maxDate;
+        if ($scope.formData.minDate && $scope.formData.minDate
+            > $scope.formData.maxDate) {
+          $scope.formData.maxDate = $scope.formData.minDate;
         }
+      }
 
-        $scope.checkMaxDate = function () {
-            $scope.formData.maxDate = $scope.formData.maxDate < 1 ? 1 : $scope.formData.maxDate > 31 ? 31 : $scope.formData.maxDate;
-            if ($scope.formData.minDate && $scope.formData.minDate > $scope.formData.maxDate) {
-                $scope.formData.maxDate = $scope.formData.minDate;
-            }
+      $scope.addPrices = function () {
+        if ($scope.prices.length < 3) {
+          $scope.prices.push({});
         }
+      }
 
-        $scope.addPrices = function () {
-            if ($scope.prices.length < 3) {
-                $scope.prices.push({});
-            }
-        }
-
-        $scope.subPrices = function (index) {
-            if ($scope.prices.length > 1) {
-                $scope.prices.splice(index, 1);
-            }
+      $scope.subPrices = function (index) {
+        if ($scope.prices.length > 1) {
+          $scope.prices.splice(index, 1);
         }
+      }
 
     }]);
 });

+ 30 - 14
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -1,13 +1,14 @@
 define(['app/app'], function (app) {
   app.register.controller('seekPurchaseCtrl',
       ['$scope', '$rootScope', '$stateParams', '$state', 'toaster',
-        'seekPurchase', 'BaseService', 'ngTableParams', '$modal', '$upload',
+        'seekPurchase', 'BaseService', 'ngTableParams', '$modal', '$upload', '$http',
         function ($scope, $rootScope, $stateParams, $state, toaster,
-            seekPurchase, BaseService, ngTableParams, $modal, $upload) {
+            seekPurchase, BaseService, ngTableParams, $modal, $upload, $http) {
           document.title = '求购询价-优软商城';
           $rootScope.active = 'vendor_seek_purchase';
           $scope.seekPurchaseRate = {};
-
+          seekPurchase.getSeekUrl({}, function(data) {
+            var seekUrl = data.url;
           $scope.initInquiryItem = function () {
             $scope.validSayPrice = {
               leadtime: false,
@@ -40,12 +41,17 @@ define(['app/app'], function (app) {
                 params.page(1);
                 $scope.isSearch = false;
               }
-              seekPurchase.getSeekPushGoodsPageInfo(param, function (data) {
+              $http({
+                method: 'get',
+                dataType: 'json',
+                url: seekUrl + '/inquiry/public',
+                params: param
+              }).success(function (data) {
                 params.total(data.totalElements);
                 $defer.resolve(data.content);
                 $scope.seekListData = data.content;
-              }, function (response) {
-                toaster.pop('error', response.data);
+              }).error(function (response) {
+                toaster.pop('error', response);
               });
             }
           });
@@ -170,13 +176,23 @@ define(['app/app'], function (app) {
               if (!$scope.inquiryItem.currency) {
                 $scope.inquiryItem.currency = $scope.seekCurrency[0];
               }
-              seekPurchase.saveOffer($scope.inquiryItem, function (data) {
-                toaster.pop('success', '报价成功');
-                $scope.isShowSayPriceBox = false;
-                $scope.seekPurchaseTableParams.reload();
-              }, function (response) {
-                toaster.pop('error', '请勿重复报价或报价自己的求购');
-              });
+              if (seekUrl == 'https://api-inquiry.usoftmall.com') {
+                seekPurchase.saveOfferProd($scope.inquiryItem, function (data) {
+                  toaster.pop('success', '报价成功');
+                  $scope.isShowSayPriceBox = false;
+                  $scope.seekPurchaseTableParams.reload();
+                }, function (response) {
+                  toaster.pop('error', '请勿重复报价或报价自己的求购');
+                });
+              } else {
+                seekPurchase.saveOffer($scope.inquiryItem, function (data) {
+                  toaster.pop('success', '报价成功');
+                  $scope.isShowSayPriceBox = false;
+                  $scope.seekPurchaseTableParams.reload();
+                }, function (response) {
+                  toaster.pop('error', '请勿重复报价或报价自己的求购');
+                });
+              }
             } else {
               toaster.pop('error', '请输入正确的报价信息');
             }
@@ -406,6 +422,6 @@ define(['app/app'], function (app) {
           $scope.setLinkBoxIndex = function (index) {
             $scope.linkBoxIndex = index;
           }
-
+          });
         }]);
 });