Browse Source

抵用卷完成

liting2017 6 years ago
parent
commit
c473bc0e05

+ 111 - 210
js/component/account/ticket/coupon.jsx

@@ -1,32 +1,50 @@
-import React from 'react';
-import { Icon, Button, Input, Select, Spin, Table, message, DatePicker } from 'antd';
+import React ,{Component}from 'react';
+import { Radio,Card,Row,Col,Icon,Pagination,  message } from 'antd';
 import $ from 'jquery/src/ajax';
-import moment from 'moment';
-import NewDesc from '@/administration/messagePush/messageIn/messageDesc';
 import '@/account/demand/techDemand.less';
 import '@/administration/news/news.less';
-import {getCouponCome,getCouponAuthStates} from '@/tools.js';
-import {couponCome} from '@/dataDic.js';
-const DemandList = React.createClass({
-    loadData(pageNo) {
+import "./coupon.less";
+class DemandList extends Component {
+    constructor(props) {
+        super(props);
+        this.state = { 
+            loading: false,
+            code:'',
+            timeV:'0',
+            dataSource:[],
+            nubJu:0,
+            pagination: {
+                defaultCurrent: 1,
+                defaultPageSize: 10,
+                showQuickJumper: true,
+                pageSize: 6,
+                onChange: function (page) {
+                    this.loadData(page);
+                }.bind(this),
+                showTotal: function (total) {
+                    return '共' + total + '条数据';
+                }
+            },
+         }
+    }
+    loadData(pageNo,state,type,time) {
         this.state.data = [];
         this.setState({
-            selectedRowKeys:[],
+            state:state,
             page:pageNo,
-            loading: true
+            loading: true,
         });
         $.ajax({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/api/admin/voucherDetail/selectList",
+            url: globalConfig.context + "/api/user/voucher/selectDetailList",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
-                name: this.state.name, //名称
-                source: this.state.source, //来源
-                status: this.state.status, //状态
-                userMobile: this.state.userMobile, //用户手机号
+                status: state|| 0, //状态
+                sort:type,
+                sortType:time
             },
             success: function (data) {
                 let theArr = [];
@@ -54,11 +72,17 @@ const DemandList = React.createClass({
                 };
                 this.state.pagination.current = data.data.pageNo;
                 this.state.pagination.total = data.data.totalCount;
+                if(!state){
+                    this.setState({
+                        nubJu:data.data.totalCount   
+                    })
+                }
                 if(data.data&&data.data.list&&!data.data.list.length){
 					this.state.pagination.current=0;
 					this.state.pagination.total=0;
 				};
                 this.setState({
+                    total:data.data.totalCount,
                     dataSource: theArr,
                     pagination: this.state.pagination
                 });
@@ -68,226 +92,103 @@ const DemandList = React.createClass({
                 loading: false
             });
         }.bind(this));
-    },
-    getInitialState() {
-        return {
-            searchMore: true,
-            validityPeriodDate: [],
-            releaseDate: [],
-            selectedRowKeys: [],
-            selectedRows: [],
-            loading: false,
-            pagination: {
-                defaultCurrent: 1,
-                defaultPageSize: 10,
-                showQuickJumper: true,
-                pageSize: 10,
-                onChange: function (page) {
-                    this.loadData(page);
-                }.bind(this),
-                showTotal: function (total) {
-                    return '共' + total + '条数据';
-                }
-            },
-            columns: [
-                 {
-                    title: '劵面名称',
-                    dataIndex: 'name',
-                    key: 'name',
-                },
-                {
-                    title: '面额',
-                    dataIndex: 'money',
-                    key: 'money',
-                },
-                {
-                    title: '领用时间',
-                    dataIndex: 'starTime',
-                    key: 'starTime'
-                },
-                {
-                    title: '截止时间',
-                    dataIndex: 'endTime',
-                    key: 'endTime'
-                },
-                {
-                    title: '来源',
-                    dataIndex: 'source',
-                    key: 'source',
-                    render: text => { return getCouponCome(text); }
-                },
-                {
-                    title: '状态',
-                    dataIndex: 'status',
-                    key: 'status',
-                    render: text => { return getCouponAuthStates(text); }
-                },
-                {
-                    title: '所属用户',
-                    dataIndex: 'userMobile',
-                    key: 'userMobile'
-                },
-                {
-                    title: '有效期限',
-                    dataIndex: 'durationDay',
-                    key: 'durationDay'
-                }
-            ],
-            dataSource: [],
-            searchTime: [,]
-        };
-    },
-    //发布
-    submission(record){
-        this.setState({
-            loading:true
-        });
+    }
+    codeData(){
         $.ajax({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/admin/message/sendMessage",
+            url: globalConfig.context + "/api/user/InvitationCode",
             data: {
-                messageId:record.id,
+              
             }
         }).done(function (data) {
             if (!data.error.length) {
-                message.success('推送成功.');
                 this.setState({
-                    loading: false,
-                });
-                this.loadData(this.state.page)
+                    code:data.data
+                })
             } else {
                 message.warning(data.error[0].message);
             };
         }.bind(this));
-    },
-    componentWillMount() {
-        this.loadData();
-    },
-    tableRowClick(record, index) {
-        this.state.RowData = record;
-        this.setState({
-            showDesc: true
-        });
-    },
-    del(recard) {
+    }
+    handleSizeChange(e){
         this.setState({
-            loading:true
+            timeV:e.target.value
         })
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + "/api/admin/message/updMessageById",
-            data: {
-                id: recard.id,
-                title: recard.title,
-                subject:0,					//消息类别 0-系统消息
-                isDraft:1, 	//是否草稿 0-否 1-是
-                deleteSign:1,	  			//删除标识 0-否 ,1-是
-                isSend:0,  	        //是否发送0-否 1-是
-                body:recard.body
-            }
-        }).done(function (data) {
-            if (!data.error.length) {
-                message.success('删除成功!');
-                this.setState({
-                    loading: false
-                });
-                if(this.state.pagination.total%10==1){
-                    this.loadData((this.state.page)-1);
-                }else{
-                    this.loadData(this.state.page);
-                }
-            } else {
-                message.warning(data.error[0].message);
-            };
-        }.bind(this));
-    },
-    addClick() {
-        this.state.RowData = {};
-        this.setState({
-            showDesc: true
-        });
-    },
-    closeDesc(e, s) {
-        this.state.showDesc = e;
-        if (s) {
-            this.loadData(this.state.page);
-        };
-    },
-    search() {
-        this.loadData();
-    },
-    reset() {
-        this.state.name = undefined;
-        this.state.userMobile = undefined;
-        this.state.status = undefined;
-        this.state.source = undefined;
+        this.loadData(0,e.target.value);
+    }
+    componentWillMount() {
         this.loadData();
-    },
-    searchSwitch() {
-        this.setState({
-            searchMore: !this.state.searchMore
-        });
-    },
+        this.codeData();
+    }
+    moneyFun(state,item){
+        this.loadData(1,this.state.state,state,item)
+    }
     render() {
-        const rowSelection = {
-            selectedRowKeys: this.state.selectedRowKeys,
-            onChange: (selectedRowKeys, selectedRows) => {
-                this.setState({
-                    selectedRows: selectedRows.slice(-1),
-                    selectedRowKeys: selectedRowKeys.slice(-1)
-                });
-            }
-        };
-        const { RangePicker } = DatePicker;
-        const hasSelect = this.state.selectedRowKeys.length;
         return (
             <div className="user-content" >
                 <div className="content-title">
-                    <span>抵用券管理</span>
+                    <span>我的抵用券</span>
                 </div>
                 <div className="user-search">
-                    <Input placeholder="券面名称"
-                        value={this.state.name}
-                        onChange={(e) => { this.setState({ name: e.target.value }); }} />
-                    <Input placeholder="用户手机号"
-                        value={this.state.userMobile}
-                        onChange={(e) => { this.setState({ userMobile: e.target.value }); }} />
-                    <Select placeholder="抵用券状态" style={{ width: 120 }}
-                        value={this.state.status}
-                        onChange={(e) => { this.setState({ status: e }) }}>
-                        <Select.Option value="0" >未使用</Select.Option>
-                        <Select.Option value="1" >已使用</Select.Option>
-                    </Select>
-                    <Select placeholder="抵用券来源" value={this.state.source} style={{ width: 120 }}
-				    		onChange={(e)=>{this.setState({source:e})}}> 
-                         {
-                            couponCome.map(function (item) {
-                                return <Select.Option key={item.value} >{item.key}</Select.Option>
-                            })
-                        }
-                    </Select> 
-                    <Button type="primary" onClick={this.search}>搜索</Button>
-                    <Button onClick={this.reset}>重置</Button>
-                </div>
-                <div className="patent-table">
-                    <Spin spinning={this.state.loading}>
-                        <Table columns={this.state.columns}
-                            dataSource={this.state.dataSource}
-                            rowSelection={rowSelection}
-                            pagination={this.state.pagination}/>
-                    </Spin>
+                    <Card >
+                        <Row>
+                            <Col span={6}>
+                                <p>{this.state.nubJu} 张</p>
+                                <p>抵用券</p>
+                            </Col>
+                            <Col span={6}>
+                                <p>{this.state.code}</p>
+                                <p>我的邀请码</p>
+                            </Col>
+                            <Col span={12}>
+                                <div className="discount">
+                                    <p>优惠金额</p>
+                                    <div className="discountMoney">
+                                        <Icon type="caret-up" className="up" onClick={()=>{this.moneyFun(0,0)}}/>
+                                        <Icon type="caret-down" className="down" onClick={()=>{this.moneyFun(0,1)}} />
+                                    </div>
+                                </div>
+                                <div className="effective">
+                                    <p>生效时间</p>
+                                    <div className="time">
+                                        <Icon type="caret-up" className="up" onClick={()=>{this.moneyFun(1,0)}}/>
+                                        <Icon type="caret-down" className="down" onClick={()=>{this.moneyFun(1,1)}}/>
+                                    </div>
+                                </div>
+                            </Col>
+                        </Row>
+                    </Card>
+                    <Card title={<Radio.Group value={this.state.timeV} onChange={this.handleSizeChange.bind(this)}>
+                                    <Radio.Button value="0">可使用</Radio.Button>
+                                    <Radio.Button value="1">已使用</Radio.Button>
+                                    <Radio.Button value="2">已失效</Radio.Button>
+                                    </Radio.Group>} style={{marginTop:10}}
+                                >
+                        <div className="cardCode">
+                            <Row gutter={20}>
+                               {
+                                   this.state.dataSource.map(item=>{
+                                     return <Col span={8} style={{marginBottom:10}}>
+                                            <Card>
+                                                <p>优惠额 : ¥{item.money} 元</p>
+                                                <p>名称 : {item.name}</p>
+                                                <p>生效日期 : {item.starTime}</p>
+                                                <p>截止日期 : {item.endTime}</p>
+                                                <p>有效天数 : {item.durationDay}</p>
+                                            </Card>
+                                        </Col>
+                                    })
+                                }
+                            </Row>
+                        </div>
+                        {this.state.total?<Pagination className="page" {...this.state.pagination}/>:''}
+                    </Card>
                 </div>
-                <NewDesc
-                    data={this.state.RowData}
-                    showDesc={this.state.showDesc}
-                    closeDesc={this.closeDesc} />
             </div >
         );
     }
-});
+};
 
 export default DemandList;

+ 39 - 0
js/component/account/ticket/coupon.less

@@ -0,0 +1,39 @@
+
+.effective,.discount{
+    float: right;
+    margin-left: 20px;
+    margin-top: 10px;
+    p{
+        float: left;
+    }
+    div{
+        width: 15px;
+        height: 20px;
+        float: left;
+        position: relative;
+        .up{
+            cursor: pointer;
+            position: absolute;
+            top: 0;
+            right: 0
+        }
+        .up:hover{
+            color: #1890ff
+        }
+        .down{
+            cursor: pointer;
+            position: absolute;
+            bottom: 0;
+            right: 0
+        }
+        .down:hover{
+            color: #1890ff
+        }
+    }
+}
+.cardCode{
+    text-align: center;
+    p{
+        line-height: 30px;
+    }
+}

+ 129 - 107
js/component/account/ticket/vouchers.jsx

@@ -1,29 +1,30 @@
 import React from 'react';
-import { Icon, Button, Input, Select, Spin, Table, message, DatePicker ,Modal,Form} from 'antd';
+import { Icon, Button, Input, InputNumber,Select, Spin, Table, message, DatePicker ,Modal,Form} from 'antd';
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
-import NewDesc from '@/administration/messagePush/messageIn/messageDesc';
+import NewDesc from '@/administration/messagePush/messageOut/selectContent';
 import '@/account/demand/techDemand.less';
 import '@/administration/news/news.less';
 import {getCouponCome,getCouponAuthState} from '@/tools.js';
-import {couponCome} from '@/dataDic.js';
+
 const DemandList = React.createClass({
     loadData(pageNo) {
-        this.state.data = [];
         this.setState({
             selectedRowKeys:[],
             page:pageNo,
-            loading: true
+            loading: true,
+            visibleSel:false,
+            selData:{}
         });
         $.ajax({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/api/user/voucher/selectList",
+            url: globalConfig.context + "/api/user/voucher/selectList",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
-                name: this.state.name, //券面名称
+                name: this.state.nameSearch, //券面名称
             },
             success: function (data) {
                 let theArr = [];
@@ -68,6 +69,7 @@ const DemandList = React.createClass({
             validityPeriodDate: [],
             releaseDate: [],
             visitModul:false,
+            data:{},
             selectedRowKeys: [],
             selectedRows: [],
             loading: false,
@@ -88,12 +90,12 @@ const DemandList = React.createClass({
                     title: '劵面名称',
                     dataIndex: 'name',
                     key: 'name',
+                    render: text => { return text&&text.length>16?text.substr(0,16)+'...':text}
                 },
                 {
                     title: '面额(元)',
                     dataIndex: 'money',
                     key: 'money',
-                    //render: text => { return text&&text.length>16?text.substr(0,16)+'...':text}
                 },
                 {
                     title: '抵用券有效期(天)',
@@ -134,7 +136,7 @@ const DemandList = React.createClass({
             method: "post",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/api/user/voucher/update",
+            url: globalConfig.context + "/api/user/voucher/update",
             data: {
                 id:id,
                 activeState:"0"
@@ -155,65 +157,70 @@ const DemandList = React.createClass({
     componentWillMount() {
         this.loadData();
     },
+    selContent(){
+		this.setState({
+            visibleSel:true,
+            selData:{
+                url:'/portal/service/jtProject/list',
+                privateProject:0,
+                auditStatus:2
+            }
+        })
+        
+	},
    //新增抵用券
     newSubmit(e) {
         e.preventDefault();
-        if(!this.state.newName) {
-			message.warning('请填写券面名称');
-			return false;
-		};
-		if(!this.state.source) {
-			message.warning('请确认券的来源');
-			return false;
-		};
-		if(!this.state.money) {
-			message.warning('请填写券面金额');
-			return false;
-		};
-		if(!this.state.durationDay) {
-			message.warning('请填写使用期限');
-			return false;
-		};
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + "/open/api/user/voucher/save",
-            data: {
-                name:this.state.newName,//抵用券名称
-                source:this.state.source,//抵用券来源
-                money:this.state.money,//抵用券面额
-                durationDay:this.state.durationDay,//抵用券使用期限
-                limitUse:0,//是否限定,在这里固定传0
+        this.props.form.validateFields((err, values) => {
+            if(!err){
+                if(!this.state.objTitle){
+                    message.warning('请选择关联项目!');
+                    return;
+                }
+                if(!this.state.money){
+                    message.warning('请输入金额!');
+                    return;
+                }
+                if(!this.state.durationDay){
+                    message.warning('请输入使用期限!');
+                    return;
+                }
+                $.ajax({
+                    method: "POST",
+                    dataType: "json",
+                    crossDomain: false,
+                    url: globalConfig.context + "/api/user/voucher/save",
+                    data: {
+                        name:values.name,//抵用券名称
+                        source:4,//抵用券来源
+                        money:this.state.money,//抵用券面额
+                        durationDay:this.state.durationDay,//抵用券使用期限
+                        limitUse:1,//是否限定,在这里固定传0
+                        limitProjectId:this.state.objData.id
+                    }
+                }).done(function (data) {
+                    if (!data.error.length) {
+                        message.success('新增成功!');
+                        this.setState({
+                            loading: false,
+                            visitModul:false
+                        });
+                            this.loadData(this.state.page);
+                    } else {
+                        message.warning(data.error[0].message);
+                    };
+                }.bind(this));
             }
-        }).done(function (data) {
-            if (!data.error.length) {
-                message.success('新增成功!');
-                this.setState({
-                    loading: false,
-                    visitModul:false
-                });
-//              if(this.state.pagination.total%10==1){
-//                  this.loadData((this.state.page)-1);
-//              }else{
-                    this.loadData(this.state.page);
-//              }
-            } else {
-                message.warning(data.error[0].message);
-            };
-        }.bind(this));
+        })
     },
-    //点击整行
-//  tableRowClick(record, index) {
-//      this.state.RowData = record;
-//      this.setState({
-//          visitModul: true
-//      });
-//  },
     addClick() {
-        this.state.RowData = {};
+        this.props.form.resetFields();
         this.setState({
-            visitModul: true
+            money:'',
+            durationDay:'',
+            visitModul: true,
+            limitProjectId:'',
+            objTitle:'',
         });
     },
     closeDesc(e, s) {
@@ -226,20 +233,19 @@ const DemandList = React.createClass({
 	visitOk(e) {
 		this.setState({
 			visitModul: false
-		});
+        });
 	},
 	//详情关闭
 	visitCancel(e) {
-		this.state.fileList = [];
 		this.setState({
 			visitModul: false,
-		});
+        });
 	},
     search() {
         this.loadData();
     },
     reset() {
-        this.state.name = '';
+        this.state.nameSearch = '';
         this.loadData();
     },
     searchSwitch() {
@@ -247,6 +253,20 @@ const DemandList = React.createClass({
             searchMore: !this.state.searchMore
         });
     },
+    //搜索渲染值
+    visFun(state,data){
+		if(state){
+			this.setState({
+				visibleSel:false,
+				objData:data,
+				objTitle:data.name
+			});
+		}else{
+			this.setState({
+				visibleSel:false,
+			})
+		}
+	},
     render() {
         const rowSelection = {
             selectedRowKeys: this.state.selectedRowKeys,
@@ -257,24 +277,25 @@ const DemandList = React.createClass({
                 });
             }
         };
+        const { getFieldDecorator } = this.props.form;
         const FormItem = Form.Item;
-        const { RangePicker } = DatePicker;
-        const hasSelect = this.state.selectedRowKeys.length;
         const formItemLayout = {
 			labelCol: { span: 6 },
-			wrapperCol: { span: 14 },
-		};
-		const hasSelected = this.state.selectedRowKeys.length > 0;
+			wrapperCol: { span: 12 },
+        };
+        
+        let theData = this.state.data||{};
+        const hasSelected = this.state.selectedRowKeys.length > 0;
         return (
             <div className="user-content" >
                 <div className="content-title">
-                    <span>用券管理</span>
+                    <span>用券管理</span>
                 </div>
                 <div className="user-search">
               	  	<Button type="primary" onClick={this.addClick} style={{float:'right'}}>新增通用劵<Icon type="plus" /></Button>
                     <Input placeholder="劵面名称"
-                        value={this.state.name}
-                        onChange={(e) => { this.setState({ name: e.target.value }); }} />
+                        value={this.state.nameSearch}
+                        onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>
                     <Button type="primary" onClick={this.block} disabled={!hasSelected}>停用<Icon type="plus" /></Button>
@@ -289,9 +310,9 @@ const DemandList = React.createClass({
                     </Spin>
                 </div>
                 <NewDesc
-                    data={this.state.RowData}
-                    showDesc={this.state.showDesc}
-                    closeDesc={this.closeDesc} />
+                    data={this.state.selData}
+                    visible={this.state.visibleSel}
+				    visFun={this.visFun.bind(this)} />
                 <Modal	
 				      className="customeDetails"
 				      footer=''
@@ -304,39 +325,40 @@ const DemandList = React.createClass({
 			    	<Form layout="horizontal" onSubmit={this.newSubmit} id="demand-form">
 	                	<Spin spinning={this.state.loading}>
 	                		<div className="clearfix" >
-		                		<FormItem 
-				                     {...formItemLayout}
-				                    label="劵面名称"
-			                        >
-		                    	 	<Input placeholder="券面名称"  value={this.state.newName} onChange={(e) => {
-			                        this.setState({ newName:  e.target.value }) }} />
-		                    	 </FormItem>
-		                    	 <FormItem 
-				                     {...formItemLayout}
-				                    label="关联项目"
-			                        >
-		                    	 	
-	                                <Input placeholder="请输入关联项目关键字"  value={this.state.source} style={{width:'80%'}} onChange={(e) => {
-			                        this.setState({ source:  e.target.value }) }} />
-			                        <span>搜索</span>
-		                    	 </FormItem>
-		                    	 <FormItem 
-				                     {...formItemLayout}
-				                    label="面额"
-			                        >
-		                    	 	<Input placeholder="面额" style={{width:'95%'}} value={this.state.money} onChange={(e) => {
-			                        this.setState({ money:  e.target.value }) }} /> 元
-		                    	 </FormItem>
-		                    	 <FormItem 
+                                <FormItem {...formItemLayout} label="劵面名称">
+                                    {getFieldDecorator('name', {
+                                        rules: [ { required: true, message: '此项为必填项!' } ],
+                                        initialValue: theData.name
+                                    })(<Input placeholder="请输入劵面名称." maxLength={200}/>)}
+                                </FormItem>
+		                    	<FormItem 
 				                     {...formItemLayout}
-				                    label="使用期限"
+				                     label={<span><strong style={{color:'#f00'}}> * </strong>关联项目</span>}
 			                        >
-		                    	 	<Input placeholder="使用期限" style={{width:'95%'}} value={this.state.durationDay} onChange={(e) => {
-			                        this.setState({ durationDay:  e.target.value }) }} /> 天
+                                    <span>{this.state.objTitle}</span>
+			                        <Button 
+									    onClick={this.selContent.bind(this)} 
+                                        type="primary" 
+                                        style={{marginLeft:10}}>搜索</Button>
 		                    	 </FormItem>
-	                    	 </div>
-	                    	 <Button className="setSubmit" type="primary" htmlType="submit" style={{marginLeft:'150px'}}>保存</Button>  
-					         <Button  type="ghost" onClick={this.visitCancel}  style={{marginLeft:'100px'}}>取消</Button>
+                                 <div className="clearfix">
+                                    <FormItem 
+                                        {...formItemLayout}
+                                        label={<span><strong style={{color:'#f00'}}> * </strong>面额</span>}>
+                                        <div><InputNumber value={this.state.money} 
+                                        onChange={(e)=>{this.setState({money:e})}} min={0} max={999999} step={0.01} placeholder="输入面额."/><span> 元</span></div>
+                                    </FormItem>
+                                    <FormItem 
+                                        {...formItemLayout}
+                                        label={<span><strong style={{color:'#f00'}}> * </strong>使用期限</span>}>
+                                        <div><InputNumber value={this.state.durationDay}
+                                            onChange={(e)=>{this.setState({durationDay:e})}}   
+                                        min={0} max={9999} step={0} placeholder="输入天数"/><span> 天</span></div>
+                                    </FormItem>
+                                </div>
+	                    	</div>
+                            <Button className="setSubmit" type="primary" htmlType="submit" style={{marginLeft:140,marginBottom:20}}>保存</Button>  
+                            <Button  type="ghost" onClick={this.visitCancel}  style={{marginLeft:50}}>取消</Button>
 	                	</Spin>
 					</Form>	
 			    </Modal>
@@ -345,4 +367,4 @@ const DemandList = React.createClass({
     }
 });
 
-export default DemandList;
+export default  Form.create()(DemandList);

+ 5 - 2
js/component/administration/messagePush/messageOut/messageForm.jsx

@@ -21,7 +21,8 @@ const NewDetailForm = Form.create()(React.createClass({
 			videoFileList: [],
 			objData:[],
 			objName:'',
-			objId:''
+			objId:'',
+			selData:{}
         };
     },
     getPictureUrl(e) {
@@ -111,7 +112,8 @@ const NewDetailForm = Form.create()(React.createClass({
 	},
 	selContent(){
 		this.setState({
-			visibleSel:true
+			visibleSel:true,
+			selData:{}
 		})
 	},
     componentWillReceiveProps(nextProps) {
@@ -211,6 +213,7 @@ const NewDetailForm = Form.create()(React.createClass({
 				</Spin>
 			</Form>  
 			<SelectContent 
+				data={this.state.selData}
 				visible={this.state.visibleSel}
 				visFun={this.visFun.bind(this)}
 			/>  

+ 87 - 12
js/component/administration/messagePush/messageOut/selectContent.jsx

@@ -1,7 +1,8 @@
 import {Component} from 'react';
 import {Button,Modal,message,Table,Spin,Input, Row,Col,Card,Form} from 'antd';
 import './selectContent.less';
-import {getMsgType} from '@/tools';
+import {getMsgType,getGameState} from '@/tools';
+
 class SelectContent extends Component {
     constructor(props) {
         super(props);
@@ -62,6 +63,58 @@ class SelectContent extends Component {
                     }
                 }
             ],
+            objColumns: [
+                {
+                   title: '名称',
+                   dataIndex: 'name',
+                   key: 'name',
+                   render: text => { return text&&text.length>16?text.substr(0,16)+'...':text}
+               },
+               {
+                   title: '简介',
+                   dataIndex: 'summary',
+                   key: 'summary',
+                   render: text => { return text&&text.length>16?text.substr(0,16)+'...':text}
+               },
+               {
+                title: '市场价(万元)',
+                dataIndex: 'price',
+                key: 'price'
+                },
+                {
+                    title: '最低折扣',
+                    dataIndex: 'offset',
+                    key: 'offset'
+                },
+                {
+                    title: '会员价(万元)',
+                    dataIndex: 'memberPrice',
+                    key: 'memberPrice'
+                },
+                {
+                    title: '活动价(万元)',
+                    dataIndex: 'activityPrice',
+                    key: 'activityPrice'
+                },
+                {
+                    title: '活动生效标识',
+                    dataIndex: 'activityFlag',
+                    key: 'activityFlag',
+                    render: (text) => {
+                        return getGameState(text);
+                    }
+                },
+               {
+                   title: '操作',
+                   dataIndex: 'caozuo',
+                   key: 'caozuo',
+                   render:(text,recard) => {
+                       return  <div className="btnRight">
+                                   <Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation();this.subVal(recard)}}>选择</Button>
+                               </div>
+                   }
+               }
+           ],
             dataSource: [],
          }
     }
@@ -72,15 +125,24 @@ class SelectContent extends Component {
             page:pageNo,
             loading: true
         });
+       
         $.ajax({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/portal/globalSearch",
-            data: {
-                pageNo: pageNo || 1,
-            	pageSize: 5,
-                name:this.state.searchVal
+            url: globalConfig.context +  this.props.data&&this.props.data.url?this.props.data.url:"/portal/globalSearch",
+            data: this.props.data&&this.props.data.url?
+                {
+                    pageNo: pageNo || 1,
+                    pageSize: 5,
+                    privateProject:this.props.data.privateProject,
+                    auditStatus:this.props.data.auditStatus,
+                    name:this.state.searchVal
+                }
+                :{
+                    pageNo: pageNo || 1,
+                    pageSize: 5,
+                    name:this.state.searchVal
             },
             success: function (data) {
                 let theArr = [];
@@ -94,10 +156,17 @@ class SelectContent extends Component {
                         theArr.push({
                             key: i,
                             rowId: thisdata.rowId,
+                            id:thisdata.id,
                             keyword: thisdata.keyword,
                             summary:thisdata.summary,
                             title:thisdata.title,
-                            fromTable:thisdata.fromTable
+                            fromTable:thisdata.fromTable,
+                            name:thisdata.name,
+                            price:thisdata.price,
+                            offset:thisdata.offset,
+                            memberPrice:thisdata.memberPrice,
+                            activityPrice:thisdata.activityPrice,
+                            activityFlag:thisdata.activityFlag
                         });
                     };
                 };
@@ -139,9 +208,15 @@ class SelectContent extends Component {
     }
     tableRowClick(record, index) {
         this.state.RowData = record;
-        this.setState({
-            DetailVis: true
-        });
+        if(this.props.data&&this.props.data.url){
+            this.setState({
+                DetailVis: false
+            });
+        }else{
+            this.setState({
+                DetailVis: true
+            });
+        }
     }
     searchFun(){
         this.loadData()
@@ -165,7 +240,7 @@ class SelectContent extends Component {
                 onOk={this.handOk.bind(this)}
                 onCancel={this.handleCancel.bind(this)}
                 width="800px"
-                title="选择推送内容"
+                title={this.props.data&&this.props.data.url?'我的项目':"选择推送内容"}
                 footer=""
                >
                 <div className="sendBody">
@@ -177,7 +252,7 @@ class SelectContent extends Component {
                         <Button type="primary" size="large" onClick={this.searchFun.bind(this)}>搜索</Button>
                     </div>
                     <Spin spinning={this.state.loading}>
-                        <Table columns={this.state.columns}
+                        <Table columns={this.props.data&&this.props.data.url?this.state.objColumns:this.state.columns}
                             dataSource={this.state.dataSource}
                             pagination={this.state.pagination}
                             onRowClick={this.tableRowClick.bind(this)} />

+ 1 - 1
js/component/administration/messagePush/messagePhoto/systemMessage.jsx

@@ -39,7 +39,7 @@ const DemandList = React.createClass({
                         theArr.push({
                             key: i,
                             id: thisdata.id,
-                            messageCode: thisdata.messageCode,
+                            messageCode: thisdata.code,
                             isSend:thisdata.isSend,
                             admin:thisdata.admin?thisdata.admin:'管理员',
                             createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():'',

+ 3 - 3
js/component/administration/ticket/coupon.jsx

@@ -19,7 +19,7 @@ const DemandList = React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/api/admin/voucher/selectList",
+            url: globalConfig.context + "/api/admin/voucher/selectList",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
@@ -158,7 +158,7 @@ const DemandList = React.createClass({
             method: "post",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/api/admin/voucher/update",
+            url: globalConfig.context + "/api/admin/voucher/update",
             data: {
                 id:id,
                 activeState:"0"
@@ -202,7 +202,7 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/api/admin/voucher/save",
+            url: globalConfig.context + "/api/admin/voucher/save",
             data: {
                 name:this.state.newName,//抵用券名称
                 source:this.state.source,//抵用券来源

+ 1 - 1
js/component/administration/ticket/vouchers.jsx

@@ -19,7 +19,7 @@ const DemandList = React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/api/admin/voucherDetail/selectList",
+            url: globalConfig.context + "/api/admin/voucherDetail/selectList",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,

+ 5 - 1
js/component/dataDic.js

@@ -2478,7 +2478,11 @@ module.exports = {
 	    },{
 	        value: "1",
 	        key: "已使用"
-	    },
+        },
+        {
+	        value: "2",
+	        key: "已过期"
+        },
     ],
     //抵用券来源
     couponCome:[

+ 1 - 1
webpack-dll.config.js

@@ -10,7 +10,7 @@ let theme = {
   '@link-color': '#58a3ff'
 };
 module.exports = (function () {
-	let staticHost = 'http://192.168.0.188:80';   
+	let staticHost = 'http://192.168.0.188';   
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';

+ 2 - 2
webpack.config.js

@@ -121,7 +121,7 @@ module.exports = (function () {
         }));
     }
 
-    let staticHost = 'http://192.168.0.190:80';    
+    let staticHost = 'http://192.168.0.188';    
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';
@@ -156,7 +156,7 @@ module.exports = (function () {
         plugins: plugins,
         devServer: {
             disableHostCheck: true,
-            host: '192.168.0.190',
+            host: '192.168.0.188',
             port: 80,
             allowedHosts: ['127.0.0.1','192.168.0.20','192.168.0.99'],
             headers: {