Commit 31a0ea7f authored by baixian's avatar baixian

积分管理bug修改

parent 9049c51c
......@@ -4,8 +4,10 @@ const basepath = `${location.protocol}//${pathify(window.location.host)}/`;
let api = '';
let dakaapi = '';
if (ENVIRONMENT == 'pro') {
api = 'https://wx.m.shangjiadao.cn/v2/api/';
dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
api = 'https://test.wp53.cn/v2/api/';
dakaapi = 'https:clock.wp53.cn/v3/';
// api = 'https://wx.m.shangjiadao.cn/v2/api/';
// dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
} else if (ENVIRONMENT == 'dev') {
api = 'https://test.wp53.cn/v2/api/';
dakaapi = 'https:clock.wp53.cn/v3/';
......
......@@ -162,8 +162,7 @@ export default {
});
yield put({
type: 'integralModeljournalList',
payload: {
},
payload: {},
});
} else if (scoreAdd.code == 4000) {
message.error(scoreAdd.msg, 1);
......@@ -281,7 +280,10 @@ export default {
yield put({
type: 'updateState',
payload: {
editCouponInfo: { ...record, banner: record.banner == '' ? [] : JSON.parse(record.banner) },
editCouponInfo: {
...record,
banner: record.banner == '' ? [] : JSON.parse(record.banner),
},
editGoodsModalShow: true,
},
});
......@@ -308,8 +310,7 @@ export default {
});
yield put({
type: 'integralModelList',
payload: {
},
payload: {},
});
} else {
yield put({
......@@ -324,13 +325,11 @@ export default {
const { sid } = yield select(state => state.webapp);
const { recordListTotal } = yield select(state => state.integral);
let newClassListTotal = recordListTotal;
const loadmessage = message.loading('数据加载中...', 0);
const courselistinfo = yield call(goodsAjax.journalList, {
school_id: sid,
page: payload.page ? payload.page : 1,
perPage: payload.perPage ? payload.perPage : 10,
});
setTimeout(loadmessage);
if (courselistinfo.code == 200) {
if (courselistinfo.data.total != undefined) {
newClassListTotal = courselistinfo.data.total;
......@@ -425,6 +424,7 @@ export default {
},
});
const loadmessage = message.loading('数据保存中...', 0);
console.log(type1, 'type1');
const data = {
1: {
single: type1.checked == false ? 0 : type1.single || 0,
......@@ -485,13 +485,11 @@ export default {
if (ruleData.code == 200) {
yield put({
type: 'updateState',
payload: {
},
payload: {},
});
yield put({
type: 'integralModelRuleList',
payload: {
},
payload: {},
});
} else {
yield put({
......@@ -507,11 +505,9 @@ export default {
},
* integralModelRuleList({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const loadmessage = message.loading('数据加载中...', 0);
const rulelistinfo = yield call(goodsAjax.ruleSelect, {
school_id: sid,
});
setTimeout(loadmessage);
if (rulelistinfo.code == 200) {
yield put({
type: 'updateState',
......@@ -543,6 +539,22 @@ export default {
});
}
},
* focusChange({ payload }, { call, put, select }) {
const { index } = payload;
const state = yield select(state => state.integral);
if (state[`type${index}`].unlimited == false) {
return;
}
yield put({
type: 'updateState',
payload: {
[`type${index}`]: {
...state[`type${index}`],
unlimited: false,
},
},
});
},
* moveGoodsimg({ payload }, { call, put, select }) {
const { index, direction } = payload;
const { editCouponInfo } = yield select(state => state.integral);
......@@ -563,13 +575,13 @@ export default {
},
* deleteGoodsImg({ payload }, { call, put, select }) {
const { index } = payload;
const { goodsBanner } = yield select(state => state.integral);
const newBannerImg = JSON.parse(JSON.stringify(goodsBanner));
const { editCouponInfo } = yield select(state => state.integral);
const newBannerImg = editCouponInfo.banner;
newBannerImg.splice(index, 1);
yield put({
type: 'updateState',
payload: {
goodsBanner: newBannerImg,
editCouponInfo: { ...editCouponInfo },
},
});
},
......
......@@ -90,12 +90,12 @@ class ClassMgtForm extends React.Component {
const operations = <Button onClick={() => this.integralBtn(true)} type="primary">积分变动</Button>;
const formItemModalLineLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 24 },
xs: { span: 4 },
sm: { span: 4 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 24 },
xs: { span: 20 },
sm: { span: 20 },
},
};
return (
......@@ -156,13 +156,15 @@ class ClassMgtForm extends React.Component {
</FormItem>
<FormItem {...formItemModalLineLayout} label="积分值">
{getFieldDecorator('number', {
initialValue: 0,
rules: [
{
required: true,
message: '请输入积分值',
message: '请输入正整数',
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
},
],
})(<InputNumber />)}
})(<InputNumber min={0} />)}
</FormItem>
<FormItem {...formItemModalLineLayout} label="备注">
{getFieldDecorator('remark', {
......@@ -171,6 +173,10 @@ class ClassMgtForm extends React.Component {
required: true,
message: '请输入备注',
},
{
max: 500,
message: '不能超过500个字符',
},
],
})(<TextArea
autosize={{ minRows: 3, maxRows: 5 }}
......
......@@ -20,7 +20,7 @@
align-items: center;
font-size:16px;
font-family:PingFangSC;
font-weight:500;
font-weight:600;
color:rgba(0,0,0,0.85);
line-height:24px;
margin-right: 30px;
......@@ -39,7 +39,7 @@
font-size:12px;
font-family:PingFangSC;
font-weight:400;
color:#999;
color: rgba(0,0,0,0.45);
line-height:22px;
margin-left: 15px;
}
......@@ -54,14 +54,14 @@
margin-left: 40px;
margin-bottom: 20px;
.number {
width: 40px;
height: 24px;
line-height: 24px;
width: 60px;
height: 30px;
line-height: 30px;
}
.numberActive {
width: 56px;
height: 32px;
line-height: 32px;
width: 80px;
height: 35px;
line-height: 35px;
}
.switch {
width: 40px;
......@@ -96,14 +96,11 @@
height: 24px;
line-height: 24px;
}
.ant-input-number-input {
width: 40px;
height: 24px;
line-height: 24px;
}
}
.checkLeftTip {
margin-left: 24px;
font-weight: 500;
font-family:PingFangSC;
}
.direction {
text-align: right;
......
......@@ -53,7 +53,7 @@ class StoreMgt extends React.Component {
if (row.type == 2) {
return <div>-{text}</div>;
}
return <div>{text}</div>;
return <div>+{text}</div>;
},
},
{
......
......@@ -115,6 +115,7 @@ class CouponAddModal extends React.Component {
sm: { span: 24 },
}}
>
<div className={pageStyle.topTip}>卡券封面:</div>
<div className={pageStyle.thumb}>
<img className={pageStyle.avatar} src={imagify(couponImg) ? imagify(couponImg) : imagify(editCouponInfo.cover)} alt="" />
<span className={pageStyle.uploadThumb}>
......@@ -134,8 +135,12 @@ class CouponAddModal extends React.Component {
required: true,
message: '请输入卡券标题',
},
{
max: 25,
message: '卡券标题不能超过25个字符',
},
],
})(<Input placeholder="请输入" />)}
})(<Input placeholder="请输入卡券标题" />)}
</FormItem>
<FormItem {...formItemModalLineLayout} label="兑换卡券需要">
{getFieldDecorator('price', {
......@@ -164,6 +169,12 @@ class CouponAddModal extends React.Component {
<FormItem {...formItemModalLineLayout} label="其他说明">
{getFieldDecorator('remark', {
initialValue: editCouponInfo.remark,
rules: [
{
max: 100,
message: '不能超过100个字符',
},
],
})(<TextArea
autosize={{ minRows: 3, maxRows: 5 }}
placeholder="请输入"
......
.topTip {
font-size:14px;
font-family:PingFangSC;
font-weight:400;
color:rgba(0,0,0,0.85);
line-height: 22px;
margin-bottom: 10px;
}
.thumb {
display: flex;
position: relative;
......@@ -6,8 +14,8 @@
position: absolute;
font-size:14px;
font-family:PingFangSC;
font-weight:400;
color:rgba(0,0,0,0.85);
font-weight:300;
color:rgba(0,0,0,0.8);
line-height:22px;
top: 50px;
left: 160px;
......@@ -18,6 +26,7 @@
height: 110px;
background-color: #D8D8D8;
margin-right: 30px;
border-right: 2px;
}
.uploadThumb {
width: 78px;
......@@ -49,4 +58,7 @@
margin-bottom: 20px;
}
}
.ant-modal-body {
padding: 10px 24px;
}
}
......@@ -172,6 +172,7 @@ class GoodsAddModal extends React.Component {
sm: { span: 24 },
}}
>
<div className={pageStyle.topTip}>商品封面:</div>
<div className={pageStyle.thumb}>
<img className={pageStyle.avatar} src={imagify(couponImg) ? imagify(couponImg) : imagify(editCouponInfo.cover)} alt="" />
<span className={pageStyle.uploadThumb}>
......@@ -191,6 +192,7 @@ class GoodsAddModal extends React.Component {
sm: { span: 24 },
}}
>
<div className={pageStyle.topTip}>商品详情图:</div>
<div className={pageStyle.banner}>
<div className={pageStyle.bannerBox}>
{ editCouponInfo.banner.length > 0 &&
......@@ -254,18 +256,22 @@ class GoodsAddModal extends React.Component {
</FormItem>
{getFieldDecorator('type', { initialValue: 1 })(<Input type="hidden" />)}
{getFieldDecorator('status', { initialValue: 1 })(<Input type="hidden" />)}
<FormItem {...formItemModalLineLayout} label="卡券标题">
<FormItem {...formItemModalLineLayout} label="商品标题">
{getFieldDecorator('title', {
initialValue: editCouponInfo.title,
rules: [
{
required: true,
message: '请输入卡券标题',
message: '请输入商品标题',
},
{
max: 25,
message: '商品标题不能超过25个字符',
},
],
})(<Input placeholder="请输入" />)}
})(<Input placeholder="请输入商品标题" />)}
</FormItem>
<FormItem {...formItemModalLineLayout} label="兑换卡券需要">
<FormItem {...formItemModalLineLayout} label="兑换商品需要">
{getFieldDecorator('price', {
initialValue: editCouponInfo.price,
rules: [
......@@ -277,7 +283,7 @@ class GoodsAddModal extends React.Component {
})(<InputNumber min={0} />)}
<span className="ant-form-text">积分</span>
</FormItem>
<FormItem {...formItemModalLineLayout} label="该卡券数量">
<FormItem {...formItemModalLineLayout} label="该商品数量">
{getFieldDecorator('inventory', {
initialValue: editCouponInfo.inventory,
rules: [
......@@ -292,9 +298,15 @@ class GoodsAddModal extends React.Component {
<FormItem {...formItemModalLineLayout} label="其他说明">
{getFieldDecorator('remark', {
initialValue: editCouponInfo.remark,
rules: [
{
max: 100,
message: '不能超过100个字符',
},
],
})(<TextArea
autosize={{ minRows: 3, maxRows: 5 }}
placeholder="请输入"
placeholder="请输入其他说明"
/>)}
</FormItem>
</Form>
......
.topTip {
font-size:14px;
font-family:PingFangSC;
font-weight:400;
color:rgba(0,0,0,0.85);
line-height: 22px;
margin-bottom: 10px;
}
.thumb {
display: flex;
position: relative;
......@@ -6,8 +14,8 @@
position: absolute;
font-size:14px;
font-family:PingFangSC;
font-weight:400;
color:rgba(0,0,0,0.85);
font-weight:300;
color:rgba(0,0,0,0.8);
line-height:22px;
top: 50px;
left: 160px;
......@@ -17,6 +25,7 @@
height: 110px;
background-color: #D8D8D8;
margin-right: 30px;
border-right: 2px;
}
}
.bannerBox {
......@@ -25,6 +34,7 @@
background-color: #D8D8D8;
margin-right: 30px;
position: relative;
border-right: 2px;
}
.banner {
display: flex;
......@@ -34,8 +44,8 @@
position: absolute;
font-size:14px;
font-family:PingFangSC;
font-weight:400;
color:rgba(0,0,0,0.85);
font-weight:300;
color:rgba(0,0,0,0.8);
line-height:22px;
top: 50px;
left: 252px;
......@@ -45,6 +55,7 @@
height: 92px;
background-color: #D8D8D8;
margin-right: 30px;
border-right: 2px;
}
}
......@@ -84,6 +95,9 @@
overflow: hidden;
background-color: #D8D8D8;
}
.ant-modal-body {
padding: 10px 24px;
}
}
@import '../../../less/variables.less';
@images: '@{imagesroot}/webapp/';
......
......@@ -22,7 +22,7 @@ class StoreMgt extends React.Component {
config: {
dragMode: 'move',
viewMode: 1,
aspectRatio: 1,
aspectRatio: 270 / 310,
autoCropArea: 0.8,
guides: !1,
center: !0,
......@@ -52,6 +52,10 @@ class StoreMgt extends React.Component {
deleteItem = (item) => {
const me = this;
const { dispatch } = me.props;
if (item.consumption > 0) {
message.error(`奖品已经有${item.consumption}人兑奖,无法删除`, 1);
return;
}
Modal.confirm({
title: `确定删除“${item.title}”?`,
content: '删除后不可恢复,请谨慎操作!',
......@@ -182,11 +186,13 @@ class StoreMgt extends React.Component {
}
uploadBanner = ({ files, uploadtype }) => {
const { dispatch } = this.props;
const avatorConfig = this.state.avatorUploader;
avatorConfig.cropper.config.aspectRatio = 750 / 310;
dispatch({
type: 'uploader/queryimgsignature',
payload: {
files,
avatorUploader: this.state.avatorUploader,
avatorUploader: avatorConfig,
uploadtype,
},
});
......@@ -242,6 +248,18 @@ class StoreMgt extends React.Component {
{
title: '商品名称',
dataIndex: 'title',
render: (text) => {
return (
<div style={{
width: '200px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}}
> {text}
</div>
);
},
},
{
title: '类型',
......@@ -261,7 +279,12 @@ class StoreMgt extends React.Component {
this.handlePreview((imagify(text)));
}}
src={(imagify(text))}
style={{ height: 70, width: 80, cursor: 'pointer' }}
style={{
height: 70,
width: 80,
cursor: 'pointer',
borderRadius: '2px',
}}
/>
);
},
......@@ -273,6 +296,11 @@ class StoreMgt extends React.Component {
{
title: '库存',
dataIndex: 'inventory',
render: (text, row) => {
return (
<div> {row.inventory - row.consumption}</div>
);
},
},
{
title: '操作',
......@@ -300,9 +328,9 @@ class StoreMgt extends React.Component {
];
return (
<div className={pageStyle.container}>
<Row gutter={16}>
<Col xs={10} sm={8} md={6} lg={4} xl={3}> <Button onClick={this.addCoupon} type="primary"><Icon type="credit-card" />添加卡券</Button></Col>
<Col xs={10} sm={8} md={6} lg={4} xl={3}> <Button onClick={() => this.addGoods()} type="primary"><Icon type="shopping" />添加商品</Button></Col>
<Row gutter={16} type="flex" justify="start">
<Col> <Button onClick={this.addCoupon} type="primary"><Icon type="credit-card" />添加卡券</Button></Col>
<Col> <Button onClick={() => this.addGoods()} type="primary"><Icon type="shopping" />添加商品</Button></Col>
</Row>
<div className={pageStyle.tablebox}>
<Table
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment