|
|
@@ -381,6 +381,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
|
|
|
status:status,
|
|
|
refusereason:refusereason
|
|
|
};
|
|
|
+ me.items.items[0].setLoading(true)
|
|
|
Ext.Ajax.request({
|
|
|
url : '/api/purchase/purchase/inquiry/deal',
|
|
|
timeout: 8000,
|
|
|
@@ -392,6 +393,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
|
|
|
method: 'POST',
|
|
|
params:JSON.stringify(params),
|
|
|
success: function(response, o){
|
|
|
+ me.items.items[0].setLoading(false)
|
|
|
var res = Ext.decode(response.responseText);
|
|
|
if(res.success){
|
|
|
me.down('grid').store.loadPage(1);
|
|
|
@@ -401,6 +403,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
|
|
|
}
|
|
|
},
|
|
|
failure: function (response, opts) {
|
|
|
+ me.items.items[0].setLoading(false)
|
|
|
saas.util.BaseUtil.showErrorToast('操作失败,请重试');
|
|
|
}
|
|
|
});
|
|
|
@@ -411,7 +414,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
|
|
|
var win = Ext.create('Ext.window.Window', {
|
|
|
renderTo: me.getEl(),
|
|
|
cls:'x-window-dbfind',
|
|
|
- height: 260,
|
|
|
+ height: 230,
|
|
|
width: 450,
|
|
|
modal:true,
|
|
|
title: '选择分段数量',
|
|
|
@@ -431,9 +434,13 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
|
|
|
xtype:'grid',
|
|
|
frame:true,
|
|
|
anchor: '100% 100%',
|
|
|
- width:206,
|
|
|
+ width:326,
|
|
|
+ margin:'5 0 0 0',
|
|
|
store:[],
|
|
|
- height:138,
|
|
|
+ height:146,
|
|
|
+ plugins: [{
|
|
|
+ ptype: 'menuclipboard'
|
|
|
+ }],
|
|
|
columns: [{
|
|
|
text: '分段数量',
|
|
|
dataIndex: 'lapQty',
|
|
|
@@ -446,18 +453,116 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
|
|
|
dataIndex: 'price',
|
|
|
width: 90
|
|
|
},{
|
|
|
- text: '下单数量',
|
|
|
+ text: '操作',
|
|
|
dataIndex: 'num',
|
|
|
- width: 90
|
|
|
+ width: 120,
|
|
|
+ renderer:function(v,m,r){
|
|
|
+ return '<div style="width:100%;vertical-align: middle; text-align: center;">'+
|
|
|
+ "<input type='button' value='选择' name='choose' style='border: 1px solid;color:#35baf6;cursor:pointer;background:#fff;'>"+
|
|
|
+ '</div>';
|
|
|
+ },
|
|
|
+ listeners: {
|
|
|
+ click: function (tableView, td, rowIdx, colIdx, e, model, tr) {
|
|
|
+ let name = event.target.name;
|
|
|
+ let _data = tableView.grid.store.data
|
|
|
+ if(name == 'choose') {
|
|
|
+ me.choose(_data,rowIdx,data);
|
|
|
+ tableView.grid.ownerCt.close()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
}]
|
|
|
+ }]
|
|
|
+ });
|
|
|
+ win.show();
|
|
|
+ },
|
|
|
+ choose:function(data,rowIdx,row){
|
|
|
+ var me = this,minValue,maxValue = 999999999999999;
|
|
|
+ let nowRow = data.getAt(rowIdx);
|
|
|
+ let nextRow = data.getAt(rowIdx+1);
|
|
|
+ if(nextRow){
|
|
|
+ minValue = nowRow.data.lapQty
|
|
|
+ maxValue = nextRow.data.lapQty - 1
|
|
|
+ }else{
|
|
|
+ minValue = nowRow.data.lapQty
|
|
|
+ }
|
|
|
+ //显示弹窗
|
|
|
+ var win = Ext.create('Ext.window.Window', {
|
|
|
+ renderTo: me.getEl(),
|
|
|
+ cls:'x-window-dbfind',
|
|
|
+ height: 130,
|
|
|
+ width: 450,
|
|
|
+ modal:true,
|
|
|
+ title: '填写数量',
|
|
|
+ bodyPadding: 10,
|
|
|
+ constrain: true,
|
|
|
+ closable: true,
|
|
|
+ layout: {
|
|
|
+ type: 'hbox',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ items:[{
|
|
|
+ margin:'0 10 0 40',
|
|
|
+ labelWidth:60,
|
|
|
+ width:200,
|
|
|
+ minValue:minValue,
|
|
|
+ maxValue:maxValue,
|
|
|
+ xtype : "numberfield",
|
|
|
+ decimalPrecision: 0,
|
|
|
+ name : "num",
|
|
|
+ fieldLabel : "数量"
|
|
|
},{
|
|
|
- margin:'20 0 0 0',
|
|
|
+ margin:'0 0 0 5',
|
|
|
xtype:'button',
|
|
|
- text:'确认',
|
|
|
+ text:'确认下单',
|
|
|
handler:function(b){
|
|
|
- var refusereason = b.ownerCt.down('[name=refusereason]').value;
|
|
|
- me.sendMessage(id,status,refusereason);
|
|
|
- b.ownerCt.ownerCt.close();
|
|
|
+ var num = b.ownerCt.down('[name=num]')
|
|
|
+ if(!num.isValid()){
|
|
|
+ saas.util.BaseUtil.showErrorToast('数量校验有误,请修改或重新选择分段');
|
|
|
+ }
|
|
|
+ var params = {
|
|
|
+ id : row.id ,
|
|
|
+ operate : row.agreed==1?0:1 ,
|
|
|
+ prodCode : row.prodCode,
|
|
|
+ vendName : row.vendName,
|
|
|
+ vendUU : row.vendUU,
|
|
|
+ userName : row.userName,
|
|
|
+ tel : row.tel,
|
|
|
+ taxRate : row.taxRate,
|
|
|
+ price : nowRow.data.price,
|
|
|
+ qty : num.value
|
|
|
+ }
|
|
|
+ b.ownerCt.setLoading(true)
|
|
|
+ Ext.Ajax.request({
|
|
|
+ url : 'http://10.1.80.36:8560/api/purchase/purchase/inquiry/turnPurchase',
|
|
|
+ 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){
|
|
|
+ b.ownerCt.setLoading(false)
|
|
|
+ var res = Ext.decode(response.responseText);
|
|
|
+ if(res.success){
|
|
|
+ me.down('grid').store.loadPage(1);
|
|
|
+ saas.util.BaseUtil.showSuccessToast('下单成功');
|
|
|
+ //打开采购单
|
|
|
+ var config = {};
|
|
|
+ config.initId = res.data.id;
|
|
|
+ saas.util.BaseUtil.openTab('purchase-purchase-formpanel', '采购订单('+res.data.code+')', 'purchase-purchase-formpanel-'+res.data.id, config);
|
|
|
+ b.ownerCt.close()
|
|
|
+ }else{
|
|
|
+ saas.util.BaseUtil.showErrorToast('操作失败:'+res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ failure: function (response, opts) {
|
|
|
+ b.ownerCt.setLoading(false)
|
|
|
+ saas.util.BaseUtil.showErrorToast('操作失败,请重试');
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}]
|
|
|
});
|