فهرست منبع

询价界面调整

zhuth 7 سال پیش
والد
کامیت
5e557f7e2e
2فایلهای تغییر یافته به همراه127 افزوده شده و 113 حذف شده
  1. 125 111
      frontend/saas-web/app/view/purchase/b2b/quotationList/DataList.js
  2. 2 2
      frontend/saas-web/app/view/sale/b2b/QuoteWin.js

+ 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('操作失败,请重试');
+            }
+        });
+    },
+
     /**
      * 处理部分字段值
      */

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

@@ -137,9 +137,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;
                     }