|
|
@@ -352,10 +352,7 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 发布求购
|
|
|
- $scope.release = function () {
|
|
|
- // 校验
|
|
|
- if ($scope.checkAll()) {
|
|
|
+ var startRelease = function (prodTitle) {
|
|
|
var inquiry = {};
|
|
|
var inquiryItem = {};
|
|
|
inquiry.recorderUU = $scope.userInfo.userUU;
|
|
|
@@ -370,10 +367,10 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
|
|
|
inquiryItem.userUU = $scope.userInfo.userUU;
|
|
|
inquiryItem.source = "MALL";
|
|
|
if ($scope.userInfo.enterprise) {
|
|
|
- inquiry.enUU = $scope.userInfo.enterprise.uu;
|
|
|
- inquiryItem.userName = $scope.userInfo.enterprise.enName;
|
|
|
+ inquiry.enUU = $scope.userInfo.enterprise.uu;
|
|
|
+ inquiryItem.userName = $scope.userInfo.enterprise.enName;
|
|
|
} else {
|
|
|
- inquiryItem.userName = $scope.userInfo.userName;
|
|
|
+ inquiryItem.userName = $scope.userInfo.userName;
|
|
|
}
|
|
|
inquiryItem.userTel = $scope.userInfo.userTel;
|
|
|
inquiryItem.needquantity = $scope.applyObj.amount;
|
|
|
@@ -386,32 +383,54 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
|
|
|
inquiryItem.endDate = $scope.applyObj.deadline;
|
|
|
inquiryItem.encapsulation = $scope.applyObj.encapsulation;
|
|
|
inquiryItem.spec = $scope.applyObj.spec;
|
|
|
- inquiryItem.prodTitle = $scope.applyObj.prodTitle;
|
|
|
+ inquiryItem.prodTitle = prodTitle || $scope.applyObj.prodTitle || '其他';
|
|
|
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);
|
|
|
- });
|
|
|
+ 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);
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
+ };
|
|
|
+ // 发布求购
|
|
|
+ $scope.release = function () {
|
|
|
+ // 校验
|
|
|
+ if ($scope.checkAll()) {
|
|
|
+ if (!$scope.applyObj.prodTitle || $scope.applyObj.prodTitle.length === 0) {
|
|
|
+ var materialUrl = seekUrl;
|
|
|
+ if (seekUrl == 'https://api-inquiry.usoftmall.com') {
|
|
|
+ materialUrl = 'https://api-product.usoftmall.com/';
|
|
|
+ }
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: materialUrl + '/productuser/match/getKind',
|
|
|
+ params: {cmpCode: $scope.applyObj.code, brand: $scope.applyObj.brand}
|
|
|
+ }).success(function (data) {
|
|
|
+ startRelease(data && data.length ? data : '其他');
|
|
|
+ }).error(function (response) {
|
|
|
+ toaster.pop('error', response || '获取关联类目失败');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ startRelease();
|
|
|
+ }
|
|
|
} else {
|
|
|
if (!$scope.validObj.deadline) {
|
|
|
toaster.pop('error', '截止日期不能为空');
|