dengzhiguo 7 years ago
parent
commit
f5fe253ce4
2 changed files with 45 additions and 16 deletions
  1. 43 14
      js/component/manageCenter/set/business/businessProject.jsx
  2. 2 2
      js/component/tools.js

+ 43 - 14
js/component/manageCenter/set/business/businessProject.jsx

@@ -173,7 +173,7 @@ const BusinessProject=Form.create()(React.createClass({
             url: globalConfig.context + '/api/admin/ProjectSize/listProjectSize',
             data: {
             	pageNo: pageNo || 1,
-                pageSize: this.state.pagination.pageSize,
+                pageSize: this.state.formatPagination.pageSize,
                 pid:this.state.editId,
             },
             success: function (data) {
@@ -191,19 +191,19 @@ const BusinessProject=Form.create()(React.createClass({
                             formatPname: thisdata.pname,//规格名称
                             formatBname: thisdata.bname,//项目品类
                             formatPrice: thisdata.price,//市场价
-                            formatOffset: thisdata.offset*10,//最低折扣
+                            formatOffset: thisdata.offset,//最低折扣
                             formatActivityPrice: thisdata.activityPrice,//活动价
                             formatActivityFlag:thisdata.activityFlag,//活动生效标识
                             formatMemberPrice:thisdata.memberPrice,//会员价
                             formatStatus:thisdata.status,//会员价
                         });
                     };
-                    this.state.pagination.current = data.data.pageNo;
-                    this.state.pagination.total = data.data.totalCount;
+                    this.state.formatPagination.current = data.data.pageNo;
+                    this.state.formatPagination.total = data.data.totalCount;
                 };
                 this.setState({
                     formatDataSource: theArr,
-                    pagination: this.state.pagination
+                    formatPagination: this.state.formatPagination
                 });
             }.bind(this),
         }).always(function () {
@@ -232,6 +232,18 @@ const BusinessProject=Form.create()(React.createClass({
                     return '共' + total + '条数据';
                 }
             },
+            formatPagination: {
+                defaultCurrent: 1,
+                defaultPageSize: 10,
+                showQuickJumper: true,
+                pageSize: 10,
+                onChange: function (page) {
+                    this.loadData(page);
+                }.bind(this),
+                showTotal: function (total) {
+                    return '共' + total + '条数据';
+                }
+            },
             ContactsLists: [{
 					title: '业务项目名称',
 					dataIndex: 'formatBname',
@@ -367,7 +379,7 @@ const BusinessProject=Form.create()(React.createClass({
     		message.warning('最低折扣请输入0到10之间的数字');
     		return false;
     		}else{
-    			offsetText=this.state.editOffset/10;
+    			offsetText=this.state.editOffset;
     		}
     	}
     	this.props.form.validateFields((err, values) => {
@@ -473,6 +485,7 @@ const BusinessProject=Form.create()(React.createClass({
     	this.selectSuperId();
         this.state.RowData = record;
         this.setState({
+        	callnub:'1',
             editvisible: true,
             selectedRowKeys:[],
         	rowId:record.businessId,
@@ -494,9 +507,14 @@ const BusinessProject=Form.create()(React.createClass({
                         message.warning(data.error[0].message);
                     };
                 } else {
-                	ProvinceCity.push(parseInt(thisdata.province));
-                	ProvinceCity.push(parseInt(thisdata.city));
-                	ProvinceCity.push(parseInt(thisdata.district));
+                	if(thisdata.country==1){
+                		ProvinceCity.push(0);
+                	}else{
+                		ProvinceCity.push(parseInt(thisdata.province));
+	                	ProvinceCity.push(parseInt(thisdata.city));
+	                	ProvinceCity.push(parseInt(thisdata.district));
+                	}
+                	
                     theArr.push({
                          editId: thisdata.id,//每一条记录的ID
                          editName:thisdata.bname,//项目名称
@@ -571,7 +589,7 @@ const BusinessProject=Form.create()(React.createClass({
     		message.warning('最低折扣请输入0到10之间的数字');
     		return false;
     		}else{
-    			offsetText=this.state.formatOffset/10;
+    			offsetText=this.state.formatOffset;
     		}
     	}
     	this.props.form.validateFields((err, values) => {                                 
@@ -618,7 +636,7 @@ const BusinessProject=Form.create()(React.createClass({
     		message.warning('最低折扣请输入0到10之间的数字');
     		return false;
     		}else{
-    			offsetText=this.state.formatOffset/10;
+    			offsetText=this.state.formatOffset;
     		}
     	}
     	this.props.form.validateFields((err, values) => {                                 
@@ -858,6 +876,7 @@ const BusinessProject=Form.create()(React.createClass({
         this.setState({
             visible: true
         });
+        this.addReset();
     },
     editClick(e) {
         this.state.RowData = {};
@@ -899,6 +918,7 @@ const BusinessProject=Form.create()(React.createClass({
     search() {
         this.loadData();
     },
+    //搜索部分的清零
     reset() {
         this.state.bname = '';//项目名称清零
         this.state.cid = undefined;//品类名称清零
@@ -907,6 +927,12 @@ const BusinessProject=Form.create()(React.createClass({
         this.state.status = undefined;//项目状态清零
         this.loadData(); 
     },
+    //新增部分的清零
+    addReset(){
+    	this.state.categoryName='';//项目名称清零
+    	this.state.ProvinceCity=undefined;
+    	this.state.addCid=undefined;
+    },
     //规格新增清零
     formatReset() {
         this.state.formatPname = '';//规格名称清零
@@ -920,6 +946,9 @@ const BusinessProject=Form.create()(React.createClass({
     },
     //详情tab切换数据处理
 	callback(e) {
+		this.setState({
+			callnub: e,
+		})
 		if(e == 1) {
 			
 		}
@@ -1280,7 +1309,7 @@ const BusinessProject=Form.create()(React.createClass({
 	                    			
 				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
 				                        <Button className="set-submit" type="primary" htmlType="submit">保存</Button>  
-				                        <Button className="set-submit" type="ghost" onClick={this.editformathandleCancel} style={{marginLeft:'50px'}}>取消</Button>
+				                        <Button className="set-submit" type="ghost" onClick={this.editformathandleCancel} style={{marginLeft:'15px'}}>取消</Button>
 				                    </FormItem> 
 				                </Spin>
 				            </Form >
@@ -1296,7 +1325,7 @@ const BusinessProject=Form.create()(React.createClass({
 			          onCancel={this.edithandleCancel}
 			          footer=''
 			        >				    
-				     <Tabs defaultActiveKey="1" onChange={this.callback}>
+				     <Tabs defaultActiveKey="1" onChange={this.callback} activeKey={this.state.callnub}>
 					    <TabPane tab="业务项目基本资料" key="1">
 					        <Form horizontal onSubmit={this.edithandleSubmit} id="demand-form">
 				                <Spin spinning={this.state.loading}>
@@ -1501,7 +1530,7 @@ const BusinessProject=Form.create()(React.createClass({
                 			  <Spin spinning={this.state.loading}>
                 			     <Form horizontal id="demand-form" onSubmit={this.contactSave} >
 							      <Table 
-					            	 pagination={this.state.pagination}
+					            	 pagination={this.state.formatPagination}
 					            	 columns={this.state.ContactsLists} 
 					            	 dataSource={this.state.formatDataSource}
 					            	 rowSelection={rowSelection}

+ 2 - 2
js/component/tools.js

@@ -851,7 +851,7 @@ module.exports = {
                 
             });
         }
-    	if(nub>34&&nub<=380){
+    	if(nub>34&&nub<380){
         	provinceList.map(function (item) {
         		item.cityList.map(function (city) {
 	                if (city.id == nub) {
@@ -861,7 +861,7 @@ module.exports = {
            });
           
         }
-        if(nub>380){
+        if(nub>=380){
         	provinceList.map(function (item) {
         		item.cityList.map(function (city) {
         			city.areaList.map(function (areas) {