chenw 7 лет назад
Родитель
Сommit
427d564d38

+ 125 - 111
frontend/saas-web/app/view/purchase/b2b/quotationList/DataList.js

@@ -1,5 +1,5 @@
 /**
- * 询价信息查询
+ * 采购询价
  */
 Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
     extend: 'saas.view.core.base.BasePanel',
@@ -183,118 +183,11 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
                             text: '操作',
                             dataIndex: 'agreed',
                             renderer:function(val, meta, record,x,y,store, view){
-                                var id = record.get('id');
-                                window.sendMessage = function(id,status,refusereason){
-                                    var params = {
-                                        id:id,
-                                        status:status,
-                                        refusereason:refusereason
-                                    };
-                                    Ext.Ajax.request({  
-                                        url : '/api/purchase/purchase/inquiry/deal',
-                                        timeout: 8000,  
-                                        headers:{
-                                            'Access-Control-Allow-Origin': '*',
-                                            'Authorization':  saas.util.State.get('session').token,
-                                            "Content-Type": 'application/json;charset=UTF-8'
-                                        },
-                                        method: 'POST',
-                                        params:JSON.stringify(params),
-                                        success: function(response, o){
-                                            var res = Ext.decode(response.responseText);
-                                            if(res.success){
-                                                Ext.getCmp('main-tab-panel').getActiveTab().items.items[0].store.loadPage(1);
-                                                saas.util.BaseUtil.showSuccessToast('操作成功');
-                                            }else{
-                                                saas.util.BaseUtil.showErrorToast('操作失败:'+res.message);
-                                            }
-                                        },
-                                        failure: function (response, opts) {
-                                            saas.util.BaseUtil.showErrorToast('操作失败,请重试');
-                                        }
-                                    });
-                                };
-            
-                                window.checkPrice = function(status,id){
-                                    if(status=='0'){
-                                        var panel = view.ownerCt.ownerCmp.ownerCt;
-                                        var win = Ext.create('Ext.window.Window', {  
-                                            renderTo: panel.getEl(),
-                                            cls:'x-window-dbfind', 
-                                            height: 100,
-                                            width: 450,
-                                            modal:true,
-                                            title: '提示',
-                                            bodyPadding: 10,
-                                            constrain: true,
-                                            closable: true,
-                                            layout: {
-                                                type: 'vbox',
-                                                align: 'center'
-                                            },
-                                            items:[{
-                                                xtype:'panel',
-                                                layout:'hbox',
-                                                items:[{
-                                                    margin:'0 10 0 0',
-                                                    labelWidth:60,
-                                                    xtype : "textfield", 
-                                                    name : "refusereason",
-                                                    fieldLabel : "拒绝信息"
-                                                },{
-                                                    margin:'0 0 0 5',
-                                                    xtype:'button',
-                                                    text:'确认',
-                                                    handler:function(b){
-                                                        var refusereason = b.ownerCt.down('[name=refusereason]').value;
-                                                        window.sendMessage(id,status,refusereason);
-                                                        b.ownerCt.ownerCt.close();
-                                                    }
-                                                }]
-                                            }]
-                                        });
-                                        win.show();
-                                    }else if(status=='1'){
-                                        window.sendMessage(id,status,'');
-                                    }
-                                }
-            
-                                window.showRefuse = function(msg){
-                                    var panel = view.ownerCt.ownerCmp.ownerCt;
-                                    var win = Ext.create('Ext.window.Window', {  
-                                        renderTo: panel.getEl(),
-                                        cls:'x-window-dbfind', 
-                                        height: 100,
-                                        width: 450,
-                                        modal:true,
-                                        title: '查看',
-                                        bodyPadding: 10,
-                                        constrain: true,
-                                        closable: true,
-                                        layout: {
-                                            type: 'vbox',
-                                            align: 'center'
-                                        },
-                                        items:[{
-                                            xtype:'panel',
-                                            layout:'hbox',
-                                            items:[{
-                                                margin:'0 10 0 0',
-                                                labelWidth:60,
-                                                xtype : "displayfield", 
-                                                name : "refusereason",
-                                                fieldLabel : "拒绝信息",
-                                                value:msg
-                                            }]
-                                        }]
-                                    });
-                                    win.show();
-                                }
                                 if((!val||val=='')&&val!=0){
                                     //未采纳状态
                                     return '<div style="width:100%;vertical-align: middle;    text-align: center;">'+
-                                                "<input type='button' value='采纳' name='agree' style='border: 1px solid;color:#34baf6;cursor:pointer;background:#fff;' onClick='window.checkPrice(1,"+id+")'>"+
-                                                "<input type='button' value='拒绝' name='disagree' style='margin:0 0 0 20px;border: 1px solid;color:#ff0000;cursor:pointer;background:#fff;' onClick='window.checkPrice(0,"+id+")'>"+
+                                                "<input type='button' value='采纳' name='agree' style='border: 1px solid;color:#34baf6;cursor:pointer;background:#fff;'>"+
+                                                "<input type='button' value='拒绝' name='disagree' style='margin:0 0 0 20px;border: 1px solid;color:#ff0000;cursor:pointer;background:#fff;'>"+
                                             '</div>';
                                 }else if(val==1||val=='1'){
                                     return '<div style="color:#34baf6;width:100%;vertical-align: middle;    text-align: center;">已采纳</div>'
@@ -304,10 +197,23 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
                                         return '<div style="color:#ff6c00;width:100%;vertical-align: middle;    text-align: center;">已拒绝</div>'
                                     }else{
                                         return  '<div style="width:100%;vertical-align: middle; text-align: center;">'+
-                                                    "<input type='button' value='查看拒绝理由' name='showRefuse' style='border: 1px solid;color:#ff6c00;cursor:pointer;background:#fff;' onClick='window.showRefuse("+refusereason+")'></input>"+
+                                                    "<input type='button' value='查看拒绝理由' name='showRefuse' style='border: 1px solid;color:#ff6c00;cursor:pointer;background:#fff;'></input>"+
                                                 '</div>';
                                     }
                                 }
+                            },
+                            listeners: {
+                                click: function (tableView, td, rowIdx, colIdx, e, model, tr) {
+                                    let name = event.target.name;
+                                    let id = model.data.id;
+                                    if(name == 'agree') {
+                                        me.checkPrice(1, id);
+                                    }else if(name == 'disagree') {
+                                        me.checkPrice(0, id);
+                                    }else if(name == 'showRefuse') {
+                                        me.showRefuse(model.data.refusereason);
+                                    }
+                                },
                             }
                         }]
                     }
@@ -373,6 +279,114 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
         this.callParent(arguments);
     },
 
+    checkPrice: function(status,id){
+        var me = this;
+        if(status=='0'){
+            var win = Ext.create('Ext.window.Window', {  
+                renderTo: me.getEl(),
+                cls:'x-window-dbfind', 
+                height: 100,
+                width: 450,
+                modal:true,
+                title: '提示',
+                bodyPadding: 10,
+                constrain: true,
+                closable: true,
+                layout: {
+                    type: 'vbox',
+                    align: 'center'
+                },
+                items:[{
+                    xtype:'panel',
+                    layout:'hbox',
+                    items:[{
+                        margin:'0 10 0 0',
+                        labelWidth:60,
+                        xtype : "textfield", 
+                        name : "refusereason",
+                        fieldLabel : "拒绝信息"
+                    },{
+                        margin:'0 0 0 5',
+                        xtype:'button',
+                        text:'确认',
+                        handler:function(b){
+                            var refusereason = b.ownerCt.down('[name=refusereason]').value;
+                            me.sendMessage(id,status,refusereason);
+                            b.ownerCt.ownerCt.close();
+                        }
+                    }]
+                }]
+            });
+            win.show();
+        }else if(status=='1'){
+            me.sendMessage(id,status,'');
+        }
+    },
+
+    showRefuse: function(msg){
+        var me = this;
+        var win = Ext.create('Ext.window.Window', {  
+            renderTo: me.getEl(),
+            cls:'x-window-dbfind', 
+            height: 100,
+            width: 450,
+            modal:true,
+            title: '查看',
+            bodyPadding: 10,
+            constrain: true,
+            closable: true,
+            layout: {
+                type: 'vbox',
+                align: 'center'
+            },
+            items:[{
+                xtype:'panel',
+                layout:'hbox',
+                items:[{
+                    margin:'0 10 0 0',
+                    labelWidth:60,
+                    xtype : "displayfield", 
+                    name : "refusereason",
+                    fieldLabel : "拒绝信息",
+                    value:msg
+                }]
+            }]
+        });
+        win.show();
+    },
+
+    sendMessage: function(id,status,refusereason){
+        var me = this;
+        var params = {
+            id:id,
+            status:status,
+            refusereason:refusereason
+        };
+        Ext.Ajax.request({  
+            url : '/api/purchase/purchase/inquiry/deal',
+            timeout: 8000,  
+            headers:{
+                'Access-Control-Allow-Origin': '*',
+                'Authorization':  saas.util.State.get('session').token,
+                "Content-Type": 'application/json;charset=UTF-8'
+            },
+            method: 'POST',
+            params:JSON.stringify(params),
+            success: function(response, o){
+                var res = Ext.decode(response.responseText);
+                if(res.success){
+                    me.down('grid').store.loadPage(1);
+                    saas.util.BaseUtil.showSuccessToast('操作成功');
+                }else{
+                    saas.util.BaseUtil.showErrorToast('操作失败:'+res.message);
+                }
+            },
+            failure: function (response, opts) {
+                saas.util.BaseUtil.showErrorToast('操作失败,请重试');
+            }
+        });
+    },
+
     /**
      * 处理部分字段值
      */

+ 4 - 0
frontend/saas-web/app/view/purchase/b2b/sendQuotation/DataList.js

@@ -29,12 +29,16 @@ Ext.define('saas.view.purchase.b2b.sendQuotation.DataList', {
                 xtype: 'numberfield',
                 decimalPrecision:0,
                 minValue:0,
+                maxValue: 999,
+                vtype: 'positiveNumber',
                 ignore: true,
+                allowBlank: false,
                 fieldLabel : '报价截至天数'
             },{
                 cls:'x-formpanel-btn-blue',
                 xtype:'button',
                 text:'发起询价',
+                formBind: true,
                 listeners: {
                     click: function(){
                         var p = this.ownerCt.ownerCt;

+ 1 - 1
frontend/saas-web/app/view/sale/b2b/Business.js

@@ -110,7 +110,7 @@ Ext.define('saas.view.sale.b2b.Business', {
                     dataIndex: 'prodSpec',
                     width: 200
                 }, {
-                    text: '物料单位',
+                    text: '单位',
                     dataIndex: 'prodUnit',
                     width: 65
                 }, {

+ 45 - 13
frontend/saas-web/app/view/sale/b2b/QuoteWin.js

@@ -23,26 +23,54 @@ Ext.define('saas.view.sale.b2b.QuoteWin', {
                     margin: '0 0 10 0',
                     labelAlign: 'right',
                     labelWidth: 90,
-                    columnWidth: 0.25,
+                    columnWidth: 0.5,
                 },
                 isValid: function (values) {
                     var leadtimeField = this.getForm().findField('leadtime');
                     var taxrateField = this.getForm().findField('taxrate');
                     var grid = this.down('grid');
                     var gridData = grid.store.getData().items;
-                    var flag = gridData.length > 0;
+                    var count = gridData.length > 0;
+
+                    if(leadtimeField.getValue() == undefined) {
+                        saas.util.BaseUtil.showErrorToast('交期不可为空');
+                        return false;
+                    }
+
+                    if(leadtimeField.getValue() <= 0) {
+                        saas.util.BaseUtil.showErrorToast('交期必须大于零');
+                        return false;
+                    }
+
+                    if(taxrateField.getValue() == undefined) {
+                        saas.util.BaseUtil.showErrorToast('税率不可为空');
+                        return false;
+                    }
+
+                    if(taxrateField.getValue() <= 0) {
+                        saas.util.BaseUtil.showErrorToast('税率必须大于零');
+                        return false;
+                    }
+
+                    if(!count) {
+                        saas.util.BaseUtil.showErrorToast('梯度单价不可为空');
+                        return false;
+                    }
 
                     for (var x = 0; x < gridData.length; x++) {
                         var d = gridData[x];
-                        if (!d.get('lapQty') || !d.get('price')) {
-                            flag = false
+                        var idx = d.get('no');
+                        if (!d.get('lapQty')) {
+                            saas.util.BaseUtil.showErrorToast('序号为' + idx + '的行梯度有误');
+                            return false;
+                        }
+                        if(!d.get('price')) {
+                            saas.util.BaseUtil.showErrorToast('序号为' + idx + '的行单价有误');
+                            return false;
                         }
                     }
 
-                    if(flag) {
-                        flag = leadtimeField.getValue() && taxrateField.getValue();
-                    }
-                    return flag;
+                    return true;
                 },
                 items: [{
                     xtype: 'textfield',
@@ -73,14 +101,15 @@ Ext.define('saas.view.sale.b2b.QuoteWin', {
                     fieldLabel: '交期(天)',
                     name: 'leadtime',
                     allowBlank: false,
+                    vtype: 'positiveNumber',
                     beforeLabelTextTpl: "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>"
                 }, {
                     xtype: 'numberfield',
                     fieldLabel: '税率',
                     name: 'taxrate',
-                    minValue: 0,
                     maxValue: 100,
                     allowBlank: false,
+                    vtype: 'positiveNumber',
                     beforeLabelTextTpl: "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>"
                 }, {
                     xtype: 'detailGridField',
@@ -137,9 +166,9 @@ Ext.define('saas.view.sale.b2b.QuoteWin', {
             }],
             buttonAlign: 'center',
             buttons: [{
-                text: quoted && record.get('qutations') && record.get('qutations').agreed == 0 ? '重新发起报价' : '确定',
+                text: '确定',
                 handler: function () {
-                    if(quoted && record.get('qutations') && record.get('qutations').agreed != 0) {
+                    if(quoted && record.get('qutations')) {
                         me.close();
                         return;
                     }
@@ -154,8 +183,6 @@ Ext.define('saas.view.sale.b2b.QuoteWin', {
                             return r.data;
                         })
                         me.onQuote(values);
-                    } else {
-                        saas.util.BaseUtil.showErrorToast('表单校验失败,请检查字段是否合法');
                     }
                 }
             }, {
@@ -183,6 +210,11 @@ Ext.define('saas.view.sale.b2b.QuoteWin', {
             storeData = [];
 
             if(quoted) {
+                leadtimeField.setReadOnly(true);
+                taxrateField.setReadOnly(true);
+
+                grid.setGridDisabled();
+
                 leadtimeField.setValue(qutations.leadTime);
                 taxrateField.setValue(qutations.taxRate);
                 storeData = qutations.replies.map(function(r, i) {