Merge branch 'couponV2.0' of https://codeup.aliyun.com/5f9118049cffa29cfdd3be1c/marketing/frontend into couponV2.0
This commit is contained in:
commit
51fc29c8f4
|
@ -1,4 +1,4 @@
|
|||
import React from "react";
|
||||
import React from "react"
|
||||
import {
|
||||
Button,
|
||||
Tag,
|
||||
|
@ -7,20 +7,20 @@ import {
|
|||
Notify,
|
||||
Sweetalert,
|
||||
Drawer,
|
||||
Card,
|
||||
} from "zent";
|
||||
import "./commodity.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";
|
||||
Card
|
||||
} from "zent"
|
||||
import "./commodity.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 {
|
||||
getCodeProductList,
|
||||
handelResponse,
|
||||
delCodeProduct,
|
||||
} from "../../../assets/api.js";
|
||||
import Productform from "@/pages/plan/product/add"; /* 商品 */
|
||||
import _ from "lodash";
|
||||
delCodeProduct
|
||||
} from "../../../assets/api.js"
|
||||
import Productform from "@/pages/plan/product/add" /* 商品 */
|
||||
import _ from "lodash"
|
||||
|
||||
const Column = [
|
||||
{
|
||||
|
@ -29,83 +29,83 @@ const Column = [
|
|||
prop: "product_id",
|
||||
className: "name",
|
||||
type: "normal",
|
||||
width: "auto",
|
||||
width: "auto"
|
||||
},
|
||||
{
|
||||
title: "商品名称",
|
||||
prop: "product_name",
|
||||
name: "product_name",
|
||||
width: "200px",
|
||||
type: "normal",
|
||||
type: "normal"
|
||||
},
|
||||
{
|
||||
title: "立减金平台批次号",
|
||||
width: "200px",
|
||||
prop: "channel_activity_id",
|
||||
name: "channel_activity_id",
|
||||
type: "normal",
|
||||
type: "normal"
|
||||
},
|
||||
{
|
||||
title: "上游平台",
|
||||
width: "auto",
|
||||
prop: "upstream",
|
||||
name: "upstream",
|
||||
type: "normal",
|
||||
type: "normal"
|
||||
},
|
||||
{
|
||||
title: "商品权重",
|
||||
width: "auto",
|
||||
prop: "weight",
|
||||
name: "weight",
|
||||
type: "normal",
|
||||
type: "normal"
|
||||
},
|
||||
{
|
||||
title: "有效时间段",
|
||||
width: "500px",
|
||||
prop: "effectDate",
|
||||
name: "effectDate",
|
||||
type: "normal",
|
||||
type: "normal"
|
||||
},
|
||||
{
|
||||
title: "官方价格",
|
||||
name: "official_price",
|
||||
prop: "official_price",
|
||||
type: "normal",
|
||||
width: "auto",
|
||||
width: "auto"
|
||||
},
|
||||
{
|
||||
title: "合同价",
|
||||
name: "contract_price",
|
||||
type: "normal",
|
||||
prop: "contract_price",
|
||||
width: "auto",
|
||||
width: "auto"
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
name: "create_time",
|
||||
type: "normal",
|
||||
prop: "create_time",
|
||||
width: "250px",
|
||||
width: "250px"
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
name: "product_type_text",
|
||||
type: "normal",
|
||||
prop: "product_type_text",
|
||||
width: "auto",
|
||||
width: "auto"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
prop: "opearo",
|
||||
name: "opearo",
|
||||
type: "slot",
|
||||
width: "200px",
|
||||
},
|
||||
];
|
||||
width: "200px"
|
||||
}
|
||||
]
|
||||
// <span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>
|
||||
export default class commoditylist extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
this.state = {
|
||||
dataCount: 0,
|
||||
page: 1,
|
||||
|
@ -120,33 +120,33 @@ export default class commoditylist extends React.Component {
|
|||
label: "商品类型",
|
||||
menuList: [
|
||||
{ id: 2, name: "卡密" },
|
||||
{ id: 1, name: "直充" },
|
||||
],
|
||||
},
|
||||
{ id: 1, name: "直充" }
|
||||
]
|
||||
}
|
||||
],
|
||||
menuList: [{ id: 0, name: "商品类型", check: false }],
|
||||
drawerVisible: false,
|
||||
contractprice: 0,
|
||||
totalprice: 0,
|
||||
};
|
||||
totalprice: 0
|
||||
}
|
||||
}
|
||||
//分页
|
||||
onPageChange(e) {
|
||||
let data = {
|
||||
code_batch_id: sessionStorage.getItem("code_id"),
|
||||
page: e,
|
||||
limit: this.state.limit,
|
||||
};
|
||||
limit: this.state.limit
|
||||
}
|
||||
|
||||
this.getTableList(data);
|
||||
this.getTableList(data)
|
||||
}
|
||||
componentDidMount(e) {
|
||||
let data = {
|
||||
code_batch_id: sessionStorage.getItem("code_id"),
|
||||
page: 1,
|
||||
limit: 10,
|
||||
};
|
||||
this.getTableList(data);
|
||||
limit: 10
|
||||
}
|
||||
this.getTableList(data)
|
||||
}
|
||||
|
||||
getTableList(data) {
|
||||
|
@ -155,18 +155,19 @@ export default class commoditylist extends React.Component {
|
|||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
const resData = [];
|
||||
const resData = []
|
||||
req.data.map((item) => {
|
||||
/* type 1为商品 2为立减金 转译字符方便处理 */
|
||||
/* 此处only 商品为product_id 立减金为channel_activity_id */
|
||||
if (item.type === 1) {
|
||||
item.entity.upstream = "直连天下";
|
||||
item.entity.only = item.entity.product_id;
|
||||
item.entity.id = item.id;
|
||||
item.entity.weight = item.weight;
|
||||
resData.push(item.entity);
|
||||
item.entity.upstream = "直连天下"
|
||||
item.entity.only = item.entity.product_id
|
||||
item.entity.id = item.id
|
||||
item.entity.weight = item.weight
|
||||
resData.push(item.entity)
|
||||
} else if (item.type === 2) {
|
||||
resData.push({
|
||||
product_id: item.entity.goods_id,
|
||||
product_type_text: "立减金",
|
||||
only: item.entity.channel_activity_id,
|
||||
id: item.id,
|
||||
|
@ -183,46 +184,46 @@ export default class commoditylist extends React.Component {
|
|||
effectDate:
|
||||
item.entity.time_limit.effect_time.start_time +
|
||||
" 至 " +
|
||||
item.entity.time_limit.effect_time.end_time, //有效时间
|
||||
});
|
||||
item.entity.time_limit.effect_time.end_time //有效时间
|
||||
})
|
||||
}
|
||||
});
|
||||
this.setState({ distdata: resData });
|
||||
this.setState({ dataCount: req.total });
|
||||
})
|
||||
this.setState({ distdata: resData })
|
||||
this.setState({ dataCount: req.total })
|
||||
},
|
||||
(err) => {}
|
||||
);
|
||||
)
|
||||
})
|
||||
.catch((err) => {});
|
||||
.catch((err) => {})
|
||||
}
|
||||
|
||||
async productSubmit() {
|
||||
let success = await this.refs.product.submit();
|
||||
let success = await this.refs.product.submit()
|
||||
if (success) {
|
||||
let productData = sessionStorage.getItem("product_item");
|
||||
let productData = sessionStorage.getItem("product_item")
|
||||
}
|
||||
}
|
||||
|
||||
clickFn() {
|
||||
this.setState({ drawerVisible: true });
|
||||
this.setState({ drawerVisible: true })
|
||||
}
|
||||
aboutFn(e, row) {
|
||||
this.props.history.push("/exchange-commodity");
|
||||
this.props.history.push("/exchange-commodity")
|
||||
}
|
||||
selection(selection) {
|
||||
this.setState({ selectiondata: selection });
|
||||
let contractprice = 0;
|
||||
let totalprice = 0;
|
||||
this.setState({ selectiondata: selection })
|
||||
let contractprice = 0
|
||||
let totalprice = 0
|
||||
selection.forEach((item) => {
|
||||
contractprice += Number(item.official_price);
|
||||
totalprice += Number(item.contract_price);
|
||||
});
|
||||
this.setState({ contractprice, totalprice });
|
||||
contractprice += Number(item.official_price)
|
||||
totalprice += Number(item.contract_price)
|
||||
})
|
||||
this.setState({ contractprice, totalprice })
|
||||
}
|
||||
batchdelFn() {
|
||||
if (this.state.selectiondata < 1) {
|
||||
Notify.clear();
|
||||
Notify.warn("请先勾选需删除的选项");
|
||||
Notify.clear()
|
||||
Notify.warn("请先勾选需删除的选项")
|
||||
} else {
|
||||
Sweetalert.confirm({
|
||||
type: "warning",
|
||||
|
@ -232,13 +233,13 @@ export default class commoditylist extends React.Component {
|
|||
onConfirm() {},
|
||||
onCancel() {},
|
||||
className: "questModal",
|
||||
parentComponent: this,
|
||||
});
|
||||
parentComponent: this
|
||||
})
|
||||
}
|
||||
}
|
||||
//删除
|
||||
deleteFn(e, row) {
|
||||
let _self = this;
|
||||
let _self = this
|
||||
Sweetalert.confirm({
|
||||
type: "warning",
|
||||
closeBtn: true,
|
||||
|
@ -250,49 +251,49 @@ export default class commoditylist extends React.Component {
|
|||
handelResponse(
|
||||
res,
|
||||
(response, msg) => {
|
||||
Notify.clear();
|
||||
Notify.success(msg);
|
||||
Notify.clear()
|
||||
Notify.success(msg)
|
||||
let data = {
|
||||
code_batch_id: sessionStorage.getItem("code_id"),
|
||||
page: _self.state.page,
|
||||
limit: _self.state.limit,
|
||||
};
|
||||
limit: _self.state.limit
|
||||
}
|
||||
|
||||
_self.getTableList(data); //更新列表
|
||||
_self.getTableList(data) //更新列表
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err);
|
||||
Notify.error(err)
|
||||
}
|
||||
);
|
||||
)
|
||||
})
|
||||
.catch((err) => {});
|
||||
.catch((err) => {})
|
||||
},
|
||||
onCancel() {},
|
||||
className: "questModal",
|
||||
parentComponent: this,
|
||||
});
|
||||
parentComponent: this
|
||||
})
|
||||
}
|
||||
editinfo(e, rowData) {
|
||||
this.props.history.push("/home/product-edit");
|
||||
sessionStorage.setItem("pathname2", "/home/product-edit");
|
||||
this.props.history.push("/home/product-edit")
|
||||
sessionStorage.setItem("pathname2", "/home/product-edit")
|
||||
let activerou = [
|
||||
{
|
||||
pagetitle: "编辑",
|
||||
items: [
|
||||
{
|
||||
path: "/home/exchangecode-list",
|
||||
name: "商品范围列表",
|
||||
name: "商品范围列表"
|
||||
},
|
||||
{
|
||||
path: "/home/product-edit",
|
||||
name: "编辑[ " + rowData.product_name + " ]商品",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
name: "编辑[ " + rowData.product_name + " ]商品"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
/* 此处only 商品为product_id 立减金为channel_activity_id */
|
||||
sessionStorage.setItem("dataInfo", rowData.only);
|
||||
sessionStorage.setItem("breakchangenav", JSON.stringify(activerou));
|
||||
sessionStorage.setItem("dataInfo", rowData.only)
|
||||
sessionStorage.setItem("breakchangenav", JSON.stringify(activerou))
|
||||
}
|
||||
//敲回车查询
|
||||
sureFn() {
|
||||
|
@ -300,49 +301,49 @@ export default class commoditylist extends React.Component {
|
|||
code_batch_id: sessionStorage.getItem("code_id"),
|
||||
page: this.state.page,
|
||||
limit: this.state.limit,
|
||||
key_word: this.state.key_word,
|
||||
};
|
||||
this.getTableList(data); //更新列表
|
||||
key_word: this.state.key_word
|
||||
}
|
||||
this.getTableList(data) //更新列表
|
||||
}
|
||||
componentWillMount() {
|
||||
this.setState({ tableHeight: window.innerHeight - 430 });
|
||||
this.setState({ tableHeight: window.innerHeight - 430 })
|
||||
}
|
||||
//状态筛选
|
||||
selectedId(e) {
|
||||
this.setState({ status: e });
|
||||
this.setState({ status: e })
|
||||
let data = {
|
||||
code_batch_id: sessionStorage.getItem("code_id"),
|
||||
page: this.state.page,
|
||||
limit: this.state.limit,
|
||||
product_type: e,
|
||||
};
|
||||
this.getTableList(data); //更新列表
|
||||
product_type: e
|
||||
}
|
||||
this.getTableList(data) //更新列表
|
||||
}
|
||||
|
||||
/* 改变count */
|
||||
onCountChange(e) {
|
||||
this.setState({
|
||||
page: 1,
|
||||
limit: e,
|
||||
});
|
||||
limit: e
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.getTableList();
|
||||
}, 200);
|
||||
this.getTableList()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { current, pageSize } = this.state;
|
||||
const { current, pageSize } = this.state
|
||||
return (
|
||||
<div id="exchangecodeaboutlist">
|
||||
<div id='exchangecodeaboutlist'>
|
||||
<TabPage tabs={this.state.tabList}>
|
||||
<div className="codetable dflexj">
|
||||
<div className='codetable dflexj'>
|
||||
<span>
|
||||
{/* <Button type="danger" onClick={this.batchdelFn.bind(this)}>批量删除</Button> */}
|
||||
</span>
|
||||
|
||||
{/* <Button type="info">批量操作</Button> */}
|
||||
<Ipt
|
||||
icon="search"
|
||||
icon='search'
|
||||
placeholder={"请输入商品名称进行匹配查询"}
|
||||
countShow={false}
|
||||
height={"36px"}
|
||||
|
@ -358,18 +359,17 @@ export default class commoditylist extends React.Component {
|
|||
</div>
|
||||
{this.state.selectiondata.length > 0 ? (
|
||||
<Alert
|
||||
type="info"
|
||||
extraContent={<Button type="primary">清空</Button>}
|
||||
>
|
||||
type='info'
|
||||
extraContent={<Button type='primary'>清空</Button>}>
|
||||
已选择
|
||||
<font color="#296bef" style={{ fontWeight: "bold" }}>
|
||||
<font color='#296bef' style={{ fontWeight: "bold" }}>
|
||||
{this.state.selectiondata.length}
|
||||
</font>
|
||||
项,官方价格总计:{this.state.contractprice.toFixed(4)}
|
||||
,合同价总计:{this.state.totalprice.toFixed(4)}
|
||||
</Alert>
|
||||
) : null}
|
||||
<div className="code-table">
|
||||
<div className='code-table'>
|
||||
<Grid
|
||||
isMultiple={true}
|
||||
spliteColor={"#fff"}
|
||||
|
@ -380,73 +380,69 @@ export default class commoditylist extends React.Component {
|
|||
isSwitch={false}
|
||||
maxheight={this.state.tableHeight}
|
||||
pageChange={(e) => {
|
||||
this.onPageChange(e);
|
||||
this.onPageChange(e)
|
||||
}}
|
||||
countChange={(e) => {
|
||||
this.onCountChange(e);
|
||||
this.onCountChange(e)
|
||||
}}
|
||||
checkChange={this.selection.bind(this)}
|
||||
ComponentHandler={(com, rowData) => {
|
||||
if (com == "status") {
|
||||
return (
|
||||
<Tag theme="blue" outline>
|
||||
<Tag theme='blue' outline>
|
||||
{rowData.status}
|
||||
</Tag>
|
||||
);
|
||||
)
|
||||
}
|
||||
if (com == "opearo") {
|
||||
return (
|
||||
<div>
|
||||
<span
|
||||
className="grid-link"
|
||||
className='grid-link'
|
||||
style={{ color: "red" }}
|
||||
onClick={(e) => this.deleteFn(e, rowData)}
|
||||
>
|
||||
onClick={(e) => this.deleteFn(e, rowData)}>
|
||||
删除
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</TabPage>
|
||||
<Drawer
|
||||
className="draw"
|
||||
className='draw'
|
||||
width={"86%"}
|
||||
maskClosable={false}
|
||||
title={"新建商品"}
|
||||
footer={
|
||||
<div style={{ textAlign: "center" }}>
|
||||
<Button
|
||||
type="primary"
|
||||
type='primary'
|
||||
onClick={(e) => {
|
||||
this.productSubmit();
|
||||
}}
|
||||
>
|
||||
this.productSubmit()
|
||||
}}>
|
||||
提交
|
||||
</Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
this.setState({ drawerVisible: false });
|
||||
}}
|
||||
>
|
||||
this.setState({ drawerVisible: false })
|
||||
}}>
|
||||
取消
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
visible={this.state.drawerVisible}
|
||||
onClose={(e) => {
|
||||
this.setState({ drawerVisible: false });
|
||||
}}
|
||||
>
|
||||
<div className="draw2">
|
||||
this.setState({ drawerVisible: false })
|
||||
}}>
|
||||
<div className='draw2'>
|
||||
<Card style={{ width: "90%", margin: "10px auto" }}>
|
||||
<Productform ref="product" data={this.state.productData} />
|
||||
<Productform ref='product' data={this.state.productData} />
|
||||
</Card>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue