Merge branch 'addMenu' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend into addMenu

This commit is contained in:
许红梅 2022-05-18 15:16:56 +08:00
commit 53deeeda51
9 changed files with 888 additions and 601 deletions

View File

@ -573,6 +573,7 @@ export default class exchangedit extends React.Component {
this.setState({ codeInfo: model2 })
}
//渲染范围列表数据以及数据转换
async productSubmit() {
let visible = ''
if (this.state.addIsType === 'addProduct') {
@ -615,7 +616,7 @@ export default class exchangedit extends React.Component {
data = JSON.parse(sessionStorage.getItem('knockGoldData'))
temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => {
return o.product_id === item.id
return o.product_id === item.uuid
})
if (index > -1) {
@ -625,7 +626,7 @@ export default class exchangedit extends React.Component {
/* 转换商品结构 */
// temp
return {
product_id: item.id,
product_id: item.uuid,
product_name: item.batch_goods_name, //名字
cost_price: '',
contract_price: item.contract_price, //单价
@ -689,6 +690,7 @@ export default class exchangedit extends React.Component {
}
}
/* 修改商品名称 */
onNameChange(e, row) {
let rowIndex = this.state.tempdata.findIndex((o) => {
return o.product_id == row.product_id
@ -696,6 +698,8 @@ export default class exchangedit extends React.Component {
this.state.tempdata[rowIndex].product_name = e.target.value
this.setState({ tempdata: this.state.tempdata })
}
/* 修改库存总数 */
onQuantityChange(e, row) {
this.setState({ tempdata: this.state.tempdata })
let value = e.target.value
@ -713,6 +717,8 @@ export default class exchangedit extends React.Component {
value - this.state.tempdata[rowIndex].usage
this.setState({ tempdata: this.state.tempdata })
}
/* 修改合同价 */
onPriceChange(e, row) {
let str = e.target.value
let value = str
@ -851,6 +857,7 @@ export default class exchangedit extends React.Component {
})
}
/* 商品范围列表编辑 */
productEditShow(rowData) {
console.log('direct_reseller_id ==>', this.state.direct_reseller_id)
console.log('rowData 12==>', rowData)
@ -865,7 +872,7 @@ export default class exchangedit extends React.Component {
if (rowData.type === 'knockGold') {
const temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
const editData = temp.filter(
(item) => item.id === rowData.product_id
(item) => item.uuid === rowData.product_id
)
this.setState({

View File

@ -1,41 +1,56 @@
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { Button,Notify,Select,Alert,CombinedDateRangePicker,Sweetalert,Icon} from 'zent';
import "./list.less"
import "../../../assets/comm.css"
import Ipt from "../../../components/input/main"
import Grid from "../../../components/gird/main.js"
import TabPage from "../../../components/tabPage/main.js"
import Filterbar from "../../../components/filterbar/main.js"
import menu from "../../../assets/enum.js"
import { nowMonth, nowDay } from "../../../assets/comm.js";
import {getOrderList,getOrderExport,handelResponse,putOrderSuccess,putOrderCancel} from "../../../assets/api.js"
var moment = require("moment");
let day = moment(nowDay()).format("YYYY-MM-DD");
let tomonth = moment(nowMonth()).format("YYYY-MM-DD");
import ReactDOM from 'react-dom'
import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import {
Button,
Notify,
Select,
Alert,
CombinedDateRangePicker,
Sweetalert,
Icon
} from 'zent'
import './list.less'
import '../../../assets/comm.css'
import Ipt from '../../../components/input/main'
import Grid from '../../../components/gird/main.js'
import TabPage from '../../../components/tabPage/main.js'
import Filterbar from '../../../components/filterbar/main.js'
import menu from '../../../assets/enum.js'
import { nowMonth, nowDay } from '../../../assets/comm.js'
import {
getOrderList,
getOrderExport,
handelResponse,
putOrderSuccess,
putOrderCancel
} from '../../../assets/api.js'
var moment = require('moment')
let day = moment(nowDay()).format('YYYY-MM-DD')
let tomonth = moment(nowMonth()).format('YYYY-MM-DD')
const options = [
{
key: '1',
text: '查询key',
text: '查询key'
},
{
key: '2',
text: '通用查询',
text: '通用查询'
}
];
]
const Column = [
{
title: '订单号',
name: 'order_number',
prop: 'order_number',
type: "normal",
type: 'normal',
width: '100px'
}, {
},
{
title: '兑换码-批次ID',
name: 'code_batch_id',
prop: 'code_batch_id',
type: "normal",
type: 'normal',
width: '100px'
},
{
@ -43,108 +58,124 @@ const Column = [
prop: 'product_name',
name: 'product_name',
width: '120px',
type: "normal",
}, {
type: 'normal'
},
{
title: '官方价格',
name: 'official_price',
prop: 'official_price',
type: "normal",
type: 'normal',
width: 'auto'
},
{
title: '合同价(成本价)',
name: 'cost',
type: "slot",
type: 'slot',
prop: 'cost',
width: 'auto'
},
{
title: '分销商',
name: 'reseller_name',
type: "normal",
type: 'normal',
prop: 'reseller_name',
width:'auto',
},{
width: 'auto'
},
{
title: '归属营销计划',
name: 'plan_title',
prop: 'plan_title',
width: 'auto',
type: "normal",
type: 'normal'
},
{
title: '购买数量',
name: 'num',
type: "normal",
type: 'normal',
prop: 'num',
width:'auto',
width: 'auto'
},
{
title: '状态',
name: 'statusDom',
prop: 'statusDom',
type: "slot",
width:'auto',
type: 'slot',
width: 'auto'
},
{
title: '操作',
prop: 'opearo',
name: 'opearo',
type: "slot",
width:'140px',
type: 'slot',
width: '140px'
},
{
title: '创建时间',
name: 'create_time',
prop: 'create_time',
width: '120px',
type: "normal",
}, {
type: 'normal'
},
{
title: '账号',
name: 'account',
type: "normal",
type: 'normal',
prop: 'account',
width:'auto',
width: 'auto'
},
{
title: '订单类型',
name: 'type_text',
prop: 'type_text',
width: 'auto',
type: "normal",
type: 'normal'
},
{
title: '折扣',
name: 'discount',
type: "normal",
type: 'normal',
prop: 'discount',
width:'auto',
width: 'auto'
},
{
title: '结算',
name: 'total',
prop: 'total',
width: 'auto',
type: "normal",
type: 'normal'
},
{
title: 'key',
name: 'key',
prop: 'key',
width: 'auto',
type: "normal",
type: 'normal'
}
];
]
export default class orderlist extends React.Component {
constructor(props) {
super(props)
this.state = {
tabList:[{title:"订单列表"}],
tabList: [{ title: '订单列表' }],
orderList: [],
filterList:[{id:0,label:"订单状态",prop:"status",menuList:[{id:999,name:"全部"},{id:1,name:"充值中"},{id:2,name:"已完成"},{id:3,name:"充值失败"},{id:4,name:"已取消"}]}],
filterList: [
{
id: 0,
label: '订单状态',
prop: 'status',
menuList: [
{ id: 999, name: '全部' },
{ id: 1, name: '充值中' },
{ id: 2, name: '已完成' },
{ id: 3, name: '充值失败' },
{ id: 4, name: '已取消' }
]
}
],
selectiondata: [],
menuList:[{id:0,name:"订单状态",check:false}]
,allcheck:false,
menuList: [{ id: 0, name: '订单状态', check: false }],
allcheck: false,
itemcheck: false,
combinedValue: [],
tableHeight: 500,
@ -152,46 +183,53 @@ export default class orderlist extends React.Component{
page: 1,
limit: 10,
key_word: '',
officialprice:0,contractprice:0,costprice:0,totalprice:0
officialprice: 0,
contractprice: 0,
costprice: 0,
totalprice: 0
}
this.onChangeCombinedDate=this.onChangeCombinedDate.bind(this);
this.onChangeCombinedDate = this.onChangeCombinedDate.bind(this)
}
//选中表格的选框
selection(selection) {
this.setState({selectiondata:selection});
let officialprice=0;
let contractprice=0;
let costprice=0;
let totalprice=0;
selection.forEach(item=>{
officialprice+=Number(item.official_price);
contractprice+=Number(item.contract_price);
costprice+=Number(item.cost_price);
totalprice+=Number(item.total);
});
this.setState({officialprice,contractprice,costprice,totalprice});
this.setState({ selectiondata: selection })
let officialprice = 0
let contractprice = 0
let costprice = 0
let totalprice = 0
selection.forEach((item) => {
officialprice += Number(item.official_price)
contractprice += Number(item.contract_price)
costprice += Number(item.cost_price)
totalprice += Number(item.total)
})
this.setState({ officialprice, contractprice, costprice, totalprice })
}
//新建订单
clickFn() {
this.props.history.push('/order-add');
this.props.history.push('/order-add')
sessionStorage.setItem('pathname2', '/order-add')
let activerou=[{items:[
let activerou = [
{
"path": "/home/order-list",
"name": "订单管理"
items: [
{
path: '/home/order-list',
name: '订单管理'
},
{
"path": "/home/order-add",
"name": "新建订单"
path: '/home/order-add',
name: '新建订单'
}
]}]
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
]
}
]
sessionStorage.setItem('breaknav', JSON.stringify(activerou))
}
//批量作废
batchdelFn() {
if (this.state.selectiondata.length < 1) {
Notify.clear();
Notify.warn('请先勾选需作废的选项');
Notify.clear()
Notify.warn('请先勾选需作废的选项')
} else {
Sweetalert.confirm({
type: 'warning',
@ -199,47 +237,44 @@ export default class orderlist extends React.Component{
title: '确认操作',
content: <p>是否作废选中充值中的订单</p>,
onConfirm() {
alert('开始调用作废接口');
},
onCancel(){
alert('开始调用作废接口')
},
onCancel() {},
className: 'questModal',
parentComponent: this
});
})
}
}
//导出订单
exportFn() {
let _self=this;
let {key_word,key,status,option}=_self.state;
let _self = this
let { key_word, key, status, option } = _self.state
let data = {}
if (this.state.combinedValue && this.state.combinedValue[0]) {
data.begin_time=this.state.combinedValue[0];
data.end_time=this.state.combinedValue[1];
data.begin_time = this.state.combinedValue[0]
data.end_time = this.state.combinedValue[1]
}
if (status || status === 0) {
data.status=status;
data.status = status
}
if (option && option.key == 1) {
if (key_word) {
data.key=key_word;
data.key = key_word
}
}
if (option && option.key == 2) {
if (key_word) {
data.key_word=key_word;
data.key_word = key_word
}
}
if (this.state.selectiondata && this.state.selectiondata.length > 0) {
let orders=this.state.selectiondata;
let orderNum=orders.map(item=>item.order_number);
data.order_numbers=orderNum.join(',');
let orders = this.state.selectiondata
let orderNum = orders.map((item) => item.order_number)
data.order_numbers = orderNum.join(',')
}
Sweetalert.confirm({
type: 'warning',
@ -247,307 +282,372 @@ export default class orderlist extends React.Component{
title: '确认操作',
content: <p>是否导出订单</p>,
onConfirm() {
getOrderExport(data).then(res=>{
getOrderExport(data)
.then((res) => {
if (res.type == 'application/json') {
const reader = new FileReader(); //创建一个FileReader实例
reader.readAsText(res, 'utf-8'); //读取文件,结果用字符串形式表示
const reader = new FileReader() //创建一个FileReader实例
reader.readAsText(res, 'utf-8') //读取文件,结果用字符串形式表示
reader.onload = function () {
const obj = JSON.parse(reader.result);
const obj = JSON.parse(reader.result)
Notify.clear()
Notify.error(obj.message)
}
} else {
let bl = new Blob([res]);
let fileName = '订单管理'+_self.getnow()+ ".xlsx"; //设置文件名
var link = document.createElement('a');//创建<a>标签
link.href = window.URL.createObjectURL(bl);
link.download = fileName;//下载的文件名
link.click();
window.URL.revokeObjectURL(link.href);//清除URL
let bl = new Blob([res])
let fileName = '订单管理' + _self.getnow() + '.xlsx' //设置文件名
var link = document.createElement('a') //创建<a>标签
link.href = window.URL.createObjectURL(bl)
link.download = fileName //下载的文件名
link.click()
window.URL.revokeObjectURL(link.href) //清除URL
}
}).catch(err=>{
});
})
.catch((err) => {})
},
onCancel(){
},
onCancel() {},
className: 'questModal',
parentComponent: this
});
})
}
//获取当前时间
getnow() {
var now = new Date();
var year = now.getFullYear();
var now = new Date()
var year = now.getFullYear()
var month =
now.getMonth() + 1 <= 9
? "0" + (now.getMonth() + 1)
: now.getMonth() + 1;
var day = now.getDate() <= 9 ? "0" + now.getDate() : now.getDate();
var tt = now.getHours() <= 9 ? "0" + now.getHours() : now.getHours();
var mm =
now.getMinutes() <= 9 ? "0" + now.getMinutes() : now.getMinutes();
var ss =
now.getSeconds() <= 9 ? "0" + now.getSeconds() : now.getSeconds();
let datelist = [year, month, day, tt, mm, ss];
return datelist.join("");
now.getMonth() + 1 <= 9 ? '0' + (now.getMonth() + 1) : now.getMonth() + 1
var day = now.getDate() <= 9 ? '0' + now.getDate() : now.getDate()
var tt = now.getHours() <= 9 ? '0' + now.getHours() : now.getHours()
var mm = now.getMinutes() <= 9 ? '0' + now.getMinutes() : now.getMinutes()
var ss = now.getSeconds() <= 9 ? '0' + now.getSeconds() : now.getSeconds()
let datelist = [year, month, day, tt, mm, ss]
return datelist.join('')
}
componentWillMount() {
this.setState({tableHeight:window.innerHeight-430});
this.setState({ tableHeight: window.innerHeight - 430 })
}
//作废
deleteFn(e, row) {
let self=this;
let self = this
Sweetalert.confirm({
type: 'warning',
closeBtn: true,
title: '确认操作',
content: <p>是否作废<b>[{row.order_number}]</b></p>,
content: (
<p>
是否作废<b>[{row.order_number}]</b>
</p>
),
onConfirm() {
putOrderCancel(row.order_number).then(res=>{
handelResponse(res,(response,msg)=>{
Notify.clear();
Notify.success(msg);
self.getOrderFn();
},(err)=>{
putOrderCancel(row.order_number)
.then((res) => {
handelResponse(
res,
(response, msg) => {
Notify.clear()
Notify.success(msg)
self.getOrderFn()
},
(err) => {
Notify.error(err)
}
)
})
}).catch(err=>{
});
},
onCancel(){
.catch((err) => {})
},
onCancel() {},
className: 'questModal',
parentComponent: this
});
})
}
//改为成功
changeSuccessFn(e, row) {
let self=this;
let self = this
Sweetalert.confirm({
type: 'warning',
closeBtn: true,
title: '确认操作',
content: <p>是否将<b>[{row.order_number}]</b></p>,
content: (
<p>
是否将<b>[{row.order_number}]</b>
</p>
),
onConfirm() {
putOrderSuccess(row.order_number).then(res=>{
handelResponse(res,(response,msg)=>{
Notify.clear();
Notify.success(msg);
self.getOrderFn();
},(err)=>{
putOrderSuccess(row.order_number)
.then((res) => {
handelResponse(
res,
(response, msg) => {
Notify.clear()
Notify.success(msg)
self.getOrderFn()
},
(err) => {
Notify.error(err)
}
)
})
}).catch(err=>{
});
},
onCancel(){
.catch((err) => {})
},
onCancel() {},
className: 'questModal',
parentComponent: this
});
})
}
//详情
moreFn(e, row) {
this.props.history.push('/home/order-addetails?oid='+row.order_number);
this.props.history.push('/home/order-addetails?oid=' + row.order_number)
sessionStorage.setItem('pathname2', '/home/order-addetails')
let activerou=[{items:[
let activerou = [
{
"path": "/home/order-list",
"name": "订单管理"
items: [
{
path: '/home/order-list',
name: '订单管理'
},
{
"path": "/home/order-addetails",
"name": "订单详情"
path: '/home/order-addetails',
name: '订单详情'
}
]}]
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
]
}
]
sessionStorage.setItem('breaknav', JSON.stringify(activerou))
}
//再次充值
againinvestFn(e,row){
}
againinvestFn(e, row) {}
//清空
clearFn() {
this.setState({'selectiondata':[]})
this.setState({ selectiondata: [] })
this.setState({ allcheck: false })
this.setState({ itemcheck: false })
}
//选择时间
onChangeCombinedDate(e) {
this.setState({combinedValue:e});
this.getOrderFn(e);
this.setState({ combinedValue: e })
this.getOrderFn(e)
}
//page
pageChange(e) {
this.setState({page:e});
this.setState({'selectiondata':[]})
this.setState({ page: e })
this.setState({ selectiondata: [] })
setTimeout(() => {
this.getOrderFn();
}, 0);
this.getOrderFn()
}, 0)
}
//limit
countChange(e) {
this.setState({page:1,limit:e});
this.setState({'selectiondata':[]})
this.setState({ page: 1, limit: e })
this.setState({ selectiondata: [] })
setTimeout(() => {
this.getOrderFn();
}, 0);
this.getOrderFn()
}, 0)
}
//敲回车查询
sureFn() {
this.setState({page:1});
this.setState({ page: 1 })
setTimeout(() => {
this.getOrderFn();
},300);
this.getOrderFn()
}, 300)
}
onFilterClose(prop) {
let data = {}
data[prop] = null;
data[prop] = null
this.setState(data)
}
//获取订单列表
getOrderFn(time = {}) {
let _self=this;
let {page,limit,option,key_word,status}=_self.state;
let _self = this
let { page, limit, option, key_word, status } = _self.state
let data = { page, limit }
if (this.state.combinedValue && this.state.combinedValue[0]) {
data.begin_time=this.state.combinedValue[0];
data.end_time=this.state.combinedValue[1];
data.begin_time = this.state.combinedValue[0]
data.end_time = this.state.combinedValue[1]
}
if (status || status === 0) {
data.status=status;
data.status = status
}
if (time && time[0]) {
data.begin_time=time[0];
data.end_time=time[1];
data.begin_time = time[0]
data.end_time = time[1]
}
if (time && time[0] == null && time.length > 1) {
delete data.begin_time;
delete data.end_time;
delete data.begin_time
delete data.end_time
}
if (option && option.key == 1) {
if (key_word) {
data.key=key_word;
data.key = key_word
}
}
if (option && option.key == 2) {
if (key_word) {
data.key_word=key_word;
data.key_word = key_word
}
}
getOrderList(data).then(res=>{
handelResponse(res,(response,msg)=>{
const orderList_data=response.data;
const {total}=response;
_self.setState({orderList:orderList_data,total});
},(err)=>{
getOrderList(data)
.then((res) => {
handelResponse(
res,
(response, msg) => {
const orderList_data = response.data
const { total } = response
_self.setState({ orderList: orderList_data, total })
},
(err) => {
Notify.error(err)
}
)
})
}).catch(err=>{
});
.catch((err) => {})
}
optiononChange(e) {
this.setState({option:e,key_word:''});
this.setState({ option: e, key_word: '' })
}
componentWillMount() {
let datetime = [
tomonth + " " + "00:00:00",
day + " " + "23:59:59"
];
this.setState({combinedValue:datetime});
this.getOrderFn(datetime);
let datetime = [tomonth + ' ' + '00:00:00', day + ' ' + '23:59:59']
this.setState({ combinedValue: datetime })
this.getOrderFn(datetime)
}
//状态筛选
selectedId(e, prop) {
let data = {}
if(e==999)
{
data[prop] = null;
}
else{
if (e == 999) {
data[prop] = null
} else {
data[prop] = e
}
this.setState(data);
}
onclearFn(e){
this.setState(data)
}
onclearFn(e) {}
// 监听组件内部状态的变化:
componentDidUpdate(prevProps, prevState) {
// 参数分别为改变之前的数据状态对象
if (prevState.key_word != this.state.key_word && !this.state.key_word) {
this.getOrderFn();
this.getOrderFn()
}
if (prevState.option != this.state.option && !this.state.option) {
this.getOrderFn();
this.setState({key_word:""});
this.getOrderFn()
this.setState({ key_word: '' })
}
if (prevState.status != this.state.status) {
this.getOrderFn();
this.getOrderFn()
}
}
//过滤表格枚举状态
render() {
const date = <CombinedDateRangePicker
className="zent-datepicker-demo"
const date = (
<CombinedDateRangePicker
className='zent-datepicker-demo'
value={this.state.combinedValue}
showTime={{
format: 'HH:mm:ss',
defaultTime: ['00:00:00', '23:59:59'],
defaultTime: ['00:00:00', '23:59:59']
}}
format="YYYY-MM-DD HH:mm:ss"
format='YYYY-MM-DD HH:mm:ss'
onChange={this.onChangeCombinedDate}
/>
)
const { current, pageSize } = this.state;
const { current, pageSize } = this.state
return (
<div id="dislist" className="orderList">
<div id='dislist' className='orderList'>
<TabPage tabs={this.state.tabList} slot={date}>
<div className="distable dflexj">
<div className='distable dflexj'>
<p>
{/* <Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}></Button>
<Button type="danger" onClick={this.batchdelFn.bind(this)}>批量作废</Button> */}
<Button type="default" icon="download" onClick={this.exportFn.bind(this)}>导出订单</Button>
<Button
type='default'
icon='download'
onClick={this.exportFn.bind(this)}>
导出订单
</Button>
</p>
<div className="dfleac">
<Select width="180px" value={this.state.option} onChange={(e)=>this.optiononChange(e)} disableSearch options={options} clearable placeholder="请选择查询分类" />
<div className='dfleac'>
<Select
width='180px'
value={this.state.option}
onChange={(e) => this.optiononChange(e)}
disableSearch
options={options}
clearable
placeholder='请选择查询分类'
/>
{/* <Button type="info">批量操作</Button> */}
{
this.state.option?this.state.option.key=='1'? <Ipt labelWidth={0} onClearItem={(e)=>{this.setState({key_word:''})}} wordSearch={this.sureFn.bind(this)} onChange={(e)=>this.setState({key_word:e})} value={this.state.key_word} icon="search" placeholder={"请输入key进行搜索"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>:
<Ipt labelWidth={0} onClearItem={(e)=>{this.setState({key_word:''})}} wordSearch={this.sureFn.bind(this)} onChange={(e)=>this.setState({key_word:e})} value={this.state.key_word} icon="search" placeholder={"请输入关键字进行搜索"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>:null
}
{this.state.option ? (
this.state.option.key == '1' ? (
<Ipt
labelWidth={0}
onClearItem={(e) => {
this.setState({ key_word: '' })
}}
wordSearch={this.sureFn.bind(this)}
onChange={(e) => this.setState({ key_word: e })}
value={this.state.key_word}
icon='search'
placeholder={'请输入key进行搜索'}
countShow={false}
height={'36px'}
width={'260px'}
alignment={'left'}
/>
) : (
<Ipt
labelWidth={0}
onClearItem={(e) => {
this.setState({ key_word: '' })
}}
wordSearch={this.sureFn.bind(this)}
onChange={(e) => this.setState({ key_word: e })}
value={this.state.key_word}
icon='search'
placeholder={'请输入关键字进行搜索'}
countShow={false}
height={'36px'}
width={'260px'}
alignment={'left'}
/>
)
) : null}
</div>
</div>
<Filterbar onClose={(e)=>{this.onFilterClose(e) }} selectFn={(e,prop)=>{this.selectedId(e,prop)}} filterList={this.state.filterList} menuList={this.state.menuList}></Filterbar>
<Filterbar
onClose={(e) => {
this.onFilterClose(e)
}}
selectFn={(e, prop) => {
this.selectedId(e, prop)
}}
filterList={this.state.filterList}
menuList={this.state.menuList}></Filterbar>
<div>
{this.state.selectiondata.length>0?(<Alert
type="info"
extraContent={<Button type="primary" onClick={this.clearFn.bind(this)}>清空</Button>}
>
已选择<font color="#296bef" style={{fontWeight:'bold'}}>{this.state.selectiondata.length}</font>{this.state.officialprice.toFixed(4)}{this.state.contractprice.toFixed(4)}{this.state.costprice.toFixed(4)}{this.state.totalprice.toFixed(4)}
</Alert>):null
}
{this.state.selectiondata.length > 0 ? (
<Alert
type='info'
extraContent={
<Button type='primary' onClick={this.clearFn.bind(this)}>
清空
</Button>
}>
已选择
<font color='#296bef' style={{ fontWeight: 'bold' }}>
{this.state.selectiondata.length}
</font>
官方价金额总计{this.state.officialprice.toFixed(4)}
合同价金额总计{this.state.contractprice.toFixed(4)}
成本价金额总计{this.state.costprice.toFixed(4)}
结算价金额总计{this.state.totalprice.toFixed(4)}
</Alert>
) : null}
<Grid
spliteColor={'#fff'}
tableData={this.state.orderList}
@ -563,44 +663,69 @@ componentDidUpdate(prevProps,prevState){
pageChange={(e) => {
this.pageChange(e)
}}
countChange={
(e)=>{
countChange={(e) => {
this.countChange(e)
}
}
}}
checkChange={this.selection.bind(this)}
ComponentHandler={(com, rowData) => {
if(com == "cost")
{
return <span>{rowData.contract_price}({rowData.cost_price})</span>
if (com == 'cost') {
return (
<span>
{rowData.contract_price}({rowData.cost_price})
</span>
)
}
if(com == "statusDom")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.orderStatusBg(parseInt(rowData.status))}}></font>{rowData.status_text}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status==0||rowData.status==1||rowData.status==2||rowData.status==3? <span className="grid-link" onClick={(e)=>this.moreFn(e,rowData)}>详情</span>:null
}
{
rowData.status==1? <span className="grid-link" onClick={(e)=>this.deleteFn(e,rowData)} >作废</span>:null
if (com == 'statusDom') {
return (
<p className='dflexa'>
<span>
<font
className='icon'
style={{
background: menu.orderStatusBg(
parseInt(rowData.status)
)
}}></font>
{rowData.status_text}
</span>
</p>
)
}
if (com == 'opearo') {
return (
<div>
{rowData.status == 0 ||
rowData.status == 1 ||
rowData.status == 2 ||
rowData.status == 3 ? (
<span
className='grid-link'
onClick={(e) => this.moreFn(e, rowData)}>
详情
</span>
) : null}
{rowData.status == 1 ? (
<span
className='grid-link'
onClick={(e) => this.deleteFn(e, rowData)}>
作废
</span>
) : null}
{
// rowData.status==3? <span className="grid-link" onClick={(e)=>this.againinvestFn(e,rowData)}>再次充值</span>:null
}
{
rowData.status==1? <span className="grid-link" onClick={(e)=>this.changeSuccessFn(e,rowData)} >改为成功</span>:null
}
{rowData.status == 1 ? (
<span
className='grid-link'
onClick={(e) => this.changeSuccessFn(e, rowData)}>
改为成功
</span>
) : null}
</div>
)
}
}}
/>
</div>
</TabPage>
</div>

View File

@ -1,7 +1,6 @@
.draw2 {
.zent-card-body {
border: none;
padding: 0 !important;
}
.borderNone {

View File

@ -29,14 +29,18 @@ export default ({ data, onChangeMoney }) => {
预估当前剩余余额为<span className='green'> 60000.21</span>
</p>
<Form ref={ref} model={stateData} rules={rules.addNew}>
<FormItem id='addNew' prop='addNew' labelname='使用说明'>
<FormItem
id='addNew'
prop='addNew'
labelname='加款'
labelwidth='60px'>
<Ipt
className='addNew'
onChange={(value) => {
setStateData({ stateData: value })
setStateData({ addNew: value })
}}
onClearItem={() => {
setStateData({ stateData: '' })
setStateData({ addNew: '' })
}}
kind='number'
value={stateData.addNew}
@ -46,25 +50,17 @@ export default ({ data, onChangeMoney }) => {
height={'36px'}
unit='元'
countShow={false}
width={'200px'}
width={'260px'}
alignment={'left'}
/>
</FormItem>
<FormItem
id='addNew'
prop='addNew'
labelname='加款'
labelwidth='60px'>
<FormItem id='addNew1' labelname='加款' labelwidth='60px'>
<Ipt
className='addNew'
onChange={(value) => {
setStateData({ stateData: value })
}}
onClearItem={() => {
setStateData({ stateData: '' })
}}
onChange={(value) => {}}
onClearItem={() => {}}
kind='number'
value={stateData.addNew}
value={''}
placeholder={''}
labelWidth={'0px'}
maxLength={16}

View File

@ -6,6 +6,7 @@ import Form from '../../../components/form/main'
import FormItem from '../../../components/form-item/main'
import rules from './rules'
import moment from 'moment'
import { uuid } from './utils'
import {
Select,
Button,
@ -18,9 +19,10 @@ import {
Card,
Dialog,
Notify,
Input
Input,
Tag
} from 'zent'
import _ from 'lodash'
import _, { isArray } from 'lodash'
import AddNewDialog from './Dialog'
import MobileComponent from './mobileCmponent'
export default class adduserinfo extends React.Component {
@ -29,7 +31,7 @@ export default class adduserinfo extends React.Component {
this.state = {
model: {
//
id: '888',
uuid: '',
channel: '1', //
entry_time: '', //
expire_time: '', //
@ -48,7 +50,7 @@ export default class adduserinfo extends React.Component {
time_limit: '', // '',
instruction: '', //'使',
early_per: [], //'',
early_notifier: '', //'',
early_notifier: [], //'',
create_time: '', // '',
creator: '', // ',
addNew: '', //
@ -66,12 +68,35 @@ export default class adduserinfo extends React.Component {
loadshow: false,
productpic: [],
copyEarly_per: '', //
visible: false //
visible: false, //
warningInput: '', //
//
userSelectList: [
{
key: '1',
text: 'Option 1',
closable: true
},
{
key: '2',
text: 'Option 2',
closable: true
},
{
key: '3',
text: 'Option 3',
disabled: true
},
{
key: '4',
text: `君不见,黄河之水天上来,奔流到海不复回`,
closable: false
}
]
}
}
componentWillMount() {
console.log(this.props.data)
if (this.props.data) {
let model = this.state.model
for (let key in this.props.data) {
@ -115,8 +140,8 @@ export default class adduserinfo extends React.Component {
// }
}
/* x时间控件禁用 */
onDisabledRange = (date, type) => {
console.log(type)
let disabled = false
if (type == 'end') {
disabled = moment(date.getTime()).add(1, 'days') <= new Date().getTime()
@ -127,6 +152,7 @@ export default class adduserinfo extends React.Component {
return disabled
}
/* 提交 */
async submit() {
if (
this.refs.form.validator() &&
@ -141,7 +167,7 @@ export default class adduserinfo extends React.Component {
temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
let index = temp.findIndex((item) => {
return item.id === this.props.data.id
return item.uuid === this.props.data.uuid
})
for (let key in this.state.model) {
@ -174,7 +200,9 @@ export default class adduserinfo extends React.Component {
temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
}
let data = temp ? temp : []
data.push(this.state.model)
const models = this.state.model
models.uuid = uuid(6, 16)
data.push(models)
sessionStorage.setItem('knockGoldData', JSON.stringify(data))
return true
}
@ -213,19 +241,40 @@ export default class adduserinfo extends React.Component {
//
/* 方框单选事件 */
onTypeChange(e, type) {
onTypeChange(e, key) {
let model2 = this.state.model
model2[type] = e.target.value
model2[key] = e.target.value
this.setState({ model: model2 })
}
//
onInputChange(value, type) {
onInputChange(value, key) {
let model2 = this.state.model
model2[type] = value
model2[key] = value
this.setState({ model: model2 })
}
//tag
closeCallback(item) {
const newData = this.state.model.early_notifier.filter(
(items) => items.key !== item.key
)
this.onInputChange(newData, 'early_notifier') /* 调用公用setState */
/* 当预警人为0 清除输入框 */
if (newData.length < 1) this.setState({ warningInput: '' })
}
/* 预警人去重 */
deWeightThree(data) {
let map = new Map()
for (let item of data) {
if (!map.has(item.key)) {
map.set(item.key, item)
}
}
return [...map.values()]
}
render() {
return (
<div id='addKnockGold'>
@ -234,7 +283,7 @@ export default class adduserinfo extends React.Component {
<Form model={this.state.model} rules={rules.basic} ref='form'>
<FormItem labelname='渠道' prop='channel' id='type'>
<RadioGroup
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
onChange={(e) => {
this.onTypeChange(e, 'channel')
}}
@ -254,7 +303,7 @@ export default class adduserinfo extends React.Component {
onClearItem={() => {
this.onInputChange('', 'batch_number')
}}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.batch_number}
placeholder={'请输入'}
labelWidth={'0px'}
@ -276,7 +325,7 @@ export default class adduserinfo extends React.Component {
this.onInputChange('', 'batch_goods_name')
}}
value={this.state.model.batch_goods_name}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
placeholder={'请输入'}
labelWidth={'0px'}
maxLength={30}
@ -301,7 +350,7 @@ export default class adduserinfo extends React.Component {
labelWidth={'0px'}
maxLength={7}
height={'36px'}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
kind='number'
width={'520px'}
unit='元'
@ -318,7 +367,7 @@ export default class adduserinfo extends React.Component {
this.onInputChange('', 'money')
}}
value={this.state.model.money}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
placeholder={'请输入'}
unit='元'
countShow={false}
@ -356,11 +405,11 @@ export default class adduserinfo extends React.Component {
placeholder={'请输入'}
labelWidth={'0px'}
unit='元'
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
countShow={false}
maxLength={16}
height={'36px'}
width={'200px'}
width={'231px'}
alignment={'left'}
kind='number'
/>
@ -376,11 +425,11 @@ export default class adduserinfo extends React.Component {
placeholder={'请输入'}
labelWidth={'0px'}
unit='元'
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
countShow={false}
maxLength={16}
height={'36px'}
width={'200px'}
width={'231px'}
alignment={'left'}
kind='number'
/>
@ -396,7 +445,7 @@ export default class adduserinfo extends React.Component {
value={this.state.model.all_budget}
placeholder={'请输入'}
kind='number'
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
labelWidth={'0px'}
maxLength={16}
height={'36px'}
@ -418,7 +467,7 @@ export default class adduserinfo extends React.Component {
onClearItem={() => {
this.onInputChange('', 'day_budget')
}}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.day_budget}
placeholder={'请输入'}
labelWidth={'0px'}
@ -442,7 +491,7 @@ export default class adduserinfo extends React.Component {
onClearItem={() => {
this.onInputChange('', 'receive_number')
}}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.receive_number}
placeholder={'请输入'}
labelWidth={'0px'}
@ -455,7 +504,7 @@ export default class adduserinfo extends React.Component {
kind='number'
/>
<RadioGroup
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
onChange={(e) => {
this.onTypeChange(e, 'receive_type')
}}
@ -468,7 +517,7 @@ export default class adduserinfo extends React.Component {
</FormItem>
<FormItem id='card_type' labelname='卡种' prop='card_type'>
<CheckboxGroup
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.card_type}
onChange={(value) => {
this.onInputChange(value, 'card_type')
@ -482,7 +531,7 @@ export default class adduserinfo extends React.Component {
labelname='是否开启自然人限制'
prop='natural_limit'>
<RadioGroup
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
onChange={(e) => {
this.onTypeChange(e, 'natural_limit')
}}
@ -496,7 +545,7 @@ export default class adduserinfo extends React.Component {
labelname='是否开启防刷拦截'
prop='brush_limit'>
<RadioGroup
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
onChange={(e) => {
this.onTypeChange(e, 'brush_limit')
}}
@ -518,10 +567,11 @@ export default class adduserinfo extends React.Component {
defaultTime: [moment().format('HH:mm:ss'), '23:59:59']
}}
format='YYYY-MM-DD HH:mm:ss'
disabled={[
this.state.model.id ? false : true,
this.state.model.id ? false : true
]}
// disabled={[
// this.props?.data?.id ? true : false,
// this.props?.data?.id ? true : false
// ]}
width={245}
value={this.state.model.entry_time}
onChange={(value) => {
this.onInputChange(value, 'entry_time')
@ -538,10 +588,10 @@ export default class adduserinfo extends React.Component {
defaultTime: [moment().format('HH:mm:ss'), '23:59:59']
}}
format='YYYY-MM-DD HH:mm:ss'
disabled={[
this.state.model.id ? false : true,
this.state.model.id ? false : true
]}
// disabled={[
// this.props?.data?.id ? true : false,
// this.props?.data?.id ? true : false
// ]}
value={this.state.model.timer}
onChange={(value) => {
this.onInputChange(value, 'timer')
@ -552,7 +602,7 @@ export default class adduserinfo extends React.Component {
onChange={(e) => {
this.onTypeChange(e, 'timer_type')
}}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.timer_type}>
<RadioButton value={'1'}>不设置</RadioButton>
<RadioButton value={'2'}>每天</RadioButton>
@ -564,7 +614,7 @@ export default class adduserinfo extends React.Component {
onChange={(e) => {
this.onTypeChange(e, 'timer_type')
}}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.timer_type}>
<RadioButton value={'1'}>不设置</RadioButton>
<RadioButton value={'2'}>每天</RadioButton>
@ -580,7 +630,7 @@ export default class adduserinfo extends React.Component {
<RadioGroup
value={this.state.model.usable_time}
isValueEqual={this.isValueEqual}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
onChange={({ target }) => {
this.onInputChange(target.value, 'usable_time')
}}>
@ -592,7 +642,7 @@ export default class adduserinfo extends React.Component {
clearable
options={[]}
placeholder='选择一项'
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
/>
</div>
<Ipt
@ -602,7 +652,7 @@ export default class adduserinfo extends React.Component {
onClearItem={() => {
this.onInputChange('', 'product_name')
}}
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.product_name}
placeholder={'请输入'}
labelWidth={'0px'}
@ -611,13 +661,13 @@ export default class adduserinfo extends React.Component {
height={'36px'}
unit='天'
countShow={false}
width={'230px'}
width={'292px'}
alignment={'left'}
/>
</div>
<div className='boxTime'>
<RadioGroup
disabled={this.state.model.id ? false : true}
// disabled={this.props?.data?.id ? true : false}
value={this.state.model.usable_time}
onChange={({ target }) => {
this.onInputChange(target.value, 'usable_time')
@ -631,10 +681,11 @@ export default class adduserinfo extends React.Component {
defaultTime: [moment().format('HH:mm:ss'), '23:59:59']
}}
format='YYYY-MM-DD HH:mm:ss'
disabled={[
this.state.model.id ? false : true,
this.state.model.id ? false : true
]}
// disabled={[
// this.props?.data?.id ? true : false,
// this.props?.data?.id ? true : false
// ]}
width={195}
value={this.state.model.fixed_time}
onChange={(value) => {
this.onInputChange(value, 'fixed_time')
@ -695,23 +746,44 @@ export default class adduserinfo extends React.Component {
height={'36px'}
unit='%'
countShow={false}
width={'120px'}
width={'190px'}
alignment={'left'}
/>
</FormItem>
<FormItem
id='early_notifier'
labelname='预警通知人'
// prop='early_notifier'
>
<FormItem id='early_notifier' labelname='预警通知人'>
<div className='bt_se'>
<Select
multiple
options={[]}
placeholder='选择一项'
clearable
creatable
options={this.state.userSelectList}
placeholder='选择一项'
size={'xl'}
value={this.state.warningInput}
onChange={(value) => {
const model = this.state.model
/* 防止清除select时报错 is key undefine */
if (value) {
model.early_notifier.push(value)
model.early_notifier = this.deWeightThree(
model.early_notifier
)
}
this.setState({ warningInput: value, model: model })
}}
/>
<div className='userSelect'></div>
</div>
<div className='userSelect'>
<ol>
{isArray(this.state.model.early_notifier) &&
this.state.model.early_notifier?.map((item) => (
<Tag
closable={item.closable}
onClose={() => this.closeCallback(item)}
key={item.key}>
{item.text}
</Tag>
))}
</ol>
</div>
</FormItem>
</Form>
<Dialog

View File

@ -9,7 +9,9 @@
right: 90px !important;
-ms-overflow-style: none;
overflow: -moz-scrollbars-none;
background: rgba(218, 218, 218, 0.1);
background: #fff;
border: 1px solid #e4e4e4;
border-radius: 5px;
padding: 15px 0;
box-sizing: border-box;
font-size: 16px;
@ -72,6 +74,12 @@
font-size: 30px;
}
.TextBlock {
.zent-placeholder-text-row:nth-child(6) {
margin-top: 1.7em !important;
}
}
.coupon-right>p {
margin: 0;
font-size: 12px;
@ -239,11 +247,47 @@
}
}
.bt_se {
display: flex;
button {
margin-left: 10px;
}
}
.userSelect {
width: 520px;
height: 200px;
min-height: 150px;
border: 1px solid #e4e4e4;
margin-top: 20px;
ol {
padding: 10px 5px;
.zent-tag {
margin-right: 7px;
margin-bottom: 10px;
padding: 7px;
background-color: #e6efff;
border: #145bd4;
color: #145bd4;
}
}
}
#addNew {
display: flex;
align-items: center;
margin-left: 0;
.form-compontent {
padding: 0;
}
}
}
.dialog_p {
@ -263,17 +307,16 @@
.blue {
color: blue;
}
}
#addNew {
display: flex;
align-items: center;
margin-left: 0;
.form-compontent {
padding: 0;
}
.form-Item {
margin: 20px 0;
}
#addNew1 {
display: none;
}
}

View File

@ -1,5 +1,6 @@
import { filter } from 'lodash'
import { Placeholder } from 'zent'
import './index.less'
const widths = [24, 100, 100, 100, 80, 24, 100, 100, 100, 80, 100, 100, 100, 80]
export default ({ data }) => {
return (
<div id='reduceKnockGold' className='mobile'>
@ -19,19 +20,19 @@ export default ({ data }) => {
{data.channel === '1' ? '支付宝' : '微信'}
{data.batch_goods_name ? data.batch_goods_name : 'xxx'}
</p>
<p className='validity'>
有效期:
{data.entry_time ? data.entry_time[0] : 'xxxx-xx-xx xx:xx:xx'}
{data.entry_time ? data.entry_time[1] : 'xxxx-xx-xx xx:xx:xx'}
</p>
<p>
{data.card_type.length > 0
{data?.card_type.length > 0
? data.card_type.map(
(item) => (item === '1' ? '借记卡' : '信用卡') + ' '
)
: 'xxx xxx xxx'}{' '}
可用
</p>
<p className='validity'>
有效期:
{data?.entry_time ? data.entry_time[0] : 'xxxx-xx-xx xx:xx:xx'}
{data?.entry_time ? data.entry_time[1] : 'xxxx-xx-xx xx:xx:xx'}
</p>
</div>
</div>
<div className='receiveBtn'>立即领取</div>
@ -59,7 +60,13 @@ export default ({ data }) => {
</div>
</>
) : (
<div className='blank'>使用说明</div>
<Placeholder.TextBlock
className='TextBlock'
animate
widths={widths}
rows={14}
dashed={false}
/>
)}
</div>
</div>

View File

@ -71,7 +71,14 @@ export default {
early_notifier: [{ type: 'required', message: '请选择预警通知人' }] //'预警通知人',
},
addNew: {
addNew: [{ type: 'required', message: '请输入加款金额' }]
addNew: [
{ type: 'required', message: '请输入加款金额' },
{
type: 'regExp',
message: '最多保留2位小数',
reg: '^[0-9]+(.[0-9]{1,2})?$'
}
]
}
// quantity: [
// { type: 'required', message: '请输入商品库存' },

View File

@ -0,0 +1,31 @@
/* uuid生成器 */
export function uuid(len, radix) {
var chars =
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
var uuid = [],
i
radix = radix || chars.length
if (len) {
// Compact form
for (i = 0; i < len; i++) uuid[i] = chars[0 | (Math.random() * radix)]
} else {
// rfc4122, version 4 form
var r
// rfc4122 requires these characters
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
uuid[14] = '4'
// Fill in random data. At i==19 set the high bits of clock sequence as
// per rfc4122, sec. 4.1.5
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | (Math.random() * 16)
uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r]
}
}
}
return uuid.join('')
}