Browse Source

fix: 优惠券管理修改

tags/PMS_Frontend_v1.0.6-develop
chenglb 1 year ago
parent
commit
ae494b2732
  1. 6
      src/components/form/FormInputNumber/index.jsx
  2. 12
      src/pages/OperationCenter/OperationSales/CouponMgm/ActivitySpecificTopic/TemplateConfig.jsx
  3. 13
      src/pages/OperationCenter/OperationSales/CouponMgm/ActivitySpecificTopic/loadable.jsx
  4. 18
      src/pages/OperationCenter/OperationSales/CouponMgm/CouponDistribute/Add.jsx
  5. 9
      src/pages/OperationCenter/OperationSales/CouponMgm/CouponDistribute/loadable.jsx
  6. 2
      src/pages/OperationCenter/OperationSales/CouponMgm/CouponRules/CalculateRule.jsx
  7. 20
      src/pages/OperationCenter/OperationSales/CouponMgm/CouponRules/loadable.jsx
  8. 3
      src/services/OperationCenter/OperationSales/index.js

6
src/components/form/FormInputNumber/index.jsx

@ -17,7 +17,9 @@ export default function FormInputNumber(props) {
suffixWord = "",
prefixWord ='',
onBlur=()=>{},
controls= false
controls= false,
min=0,
max=9999
} = props;
return (
<div
@ -46,6 +48,8 @@ export default function FormInputNumber(props) {
onPressEnter={onPressEnter}
suffix={suffix}
onBlur={onBlur}
min={min}
max={max}
controls={false}
/>
</div>

12
src/pages/OperationCenter/OperationSales/CouponMgm/ActivitySpecificTopic/TemplateConfig.jsx

@ -14,11 +14,11 @@ function TemplateConfig(props) {
// activity_avatar : '',
// background : "#ffffff",
// text_color: "#000000",
description: "",
is_share: "",
title: "",
copywriting: "",
pic: ""
description: record.description,
is_share: record.is_share,
title: record.title,
copywriting: record.copywriting,
pic: record.pic
})
const uploadButton = (
<div>
@ -103,7 +103,7 @@ function TemplateConfig(props) {
}
useEffect(()=>{
console.log(formData, 'formdata')
// console.log(formData, 'formdata')
},[formData])
return (

13
src/pages/OperationCenter/OperationSales/CouponMgm/ActivitySpecificTopic/loadable.jsx

@ -48,12 +48,12 @@ function ActivitySpecificTopic() {
},
{
title: "活动状态",
dataIndex: "active_status",
key: "active_status",
dataIndex: "status_zhname",
key: "status",
},
{
title: "审核状态",
dataIndex: "is_examine",
dataIndex: "is_examine_zhname",
key: "is_examine",
},
{
@ -152,7 +152,12 @@ function ActivitySpecificTopic() {
const [templateModal, setTemplateModal] = useState({
visible: false,
record: {},
close: () => setTemplateModal({ ...templateModal, visible: false }),
close: () => {
setTemplateModal({ ...templateModal, visible: false });
if(tableRef.current){
tableRef.current.fetch()
}
},
});
const [couponOptions,setCouponOptions] = useState([])

18
src/pages/OperationCenter/OperationSales/CouponMgm/CouponDistribute/Add.jsx

@ -31,6 +31,7 @@ function Add(props) {
const [couponList, setCouponList] = useState([{ key: createKey() }]);
const [ modalVisible, setModalVisible] = useState(false)
const [fileList, setFileList] = useState([]);
const [phones, setPhones] = useState([])
function createKey() {
return Math.random().toString(36).substr(2, 5);
}
@ -57,7 +58,7 @@ function Add(props) {
return item;
});
setCouponList(_couponList);
console.log(_couponList);
// console.log(_couponList);
}
const uploadProps = {
@ -89,9 +90,11 @@ function Add(props) {
},
})
.then((res) => { console.log(res); return res.json()})
.then(() => {
.then((res) => {
// console.log(res.data.list)
message.success('上传成功');
getData();
// getData();
setPhones(res.data.list)
setModalVisible(false)
})
.catch(() => {
@ -108,7 +111,7 @@ function Add(props) {
.validateFields()
.then((values) => {
console.log(values, 'submit values')
// console.log(values, 'submit values')
let temp = 0;
values.info.map(item=>{
temp += parseInt(item.num)
@ -125,12 +128,14 @@ function Add(props) {
// num: item.num
// };
// }),
phones: phones,
total: temp
};
ajax.handleDistributionOperate(params).then((res) => {
if (res.status === 20000) {
message.success("添加成功");
// close();
getData();
setShowEdit(false);
form.resetFields();
}
@ -144,7 +149,7 @@ function Add(props) {
return (
<>
<Form form={form} initialValues={{info: [{key:createKey()}]}} >
<Form form={form} initialValues={{info: [{key:createKey()}], sending_type: '2'}} >
<Form.Item
label="活动名称"
name="activity_name"
@ -221,7 +226,8 @@ function Add(props) {
{/* <Input style={{ width: "20%" }} /> */}
<Select
style={{ width: "20%" }}
options={[{label: '按用户标签', value: '1'},{label: "按手机", value: "2"}]}
// options={[{label: '', value: '1'},{label: "", value: "2"}]}
options={[{label: "按手机", value: "2"}]}
></Select>
</Form.Item>
<Form.Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.sending_type == '1'}>

9
src/pages/OperationCenter/OperationSales/CouponMgm/CouponDistribute/loadable.jsx

@ -36,9 +36,12 @@ function CouponDistribute(props) {
const columns = [
{
title: '序号',
dataIndex: 'id',
// dataIndex: 'id',
key: 'id',
width: 150,
width: 80,
render: (_, record , index)=>{
return (<span >{index + 1}</span>)
}
},
{
title: '活动名称',
@ -84,7 +87,7 @@ function CouponDistribute(props) {
title: '发放时间',
dataIndex: 'send_time',
key: 'send_time',
// width: 150,
width: 250,
ellipsis: true,
align: 'center'
},

2
src/pages/OperationCenter/OperationSales/CouponMgm/CouponRules/CalculateRule.jsx

@ -81,7 +81,7 @@ const Child = (props)=>{
}
const handleInputChange = (key, value, idx)=>{
console.log(key, value, idx)
// console.log(key, value, idx)
let temp = [...arr]
arr[idx][key] = value
setArr(temp)

20
src/pages/OperationCenter/OperationSales/CouponMgm/CouponRules/loadable.jsx

@ -13,6 +13,7 @@ import moment from "moment";
import { useLocation } from "react-router-dom";
import { setCanvasCreator } from "echarts";
import CalculateRule from './CalculateRule'
import { current } from "@reduxjs/toolkit";
function CouponRules() {
const Column = Table.Column
@ -233,6 +234,15 @@ function CouponRules() {
})
}
const onChangePn = (current, pageSize) =>{
// console.log(current,pageSize)
setPageData({
pn: current,
size: pageSize,
})
}
//
const search = () => {
setPageData({
@ -611,7 +621,7 @@ function CouponRules() {
current={pageData.pn}
pageSize={pageData.size}
pageSizeOptions={dictionary?.pageSizeOptions}
onChange={onShowSizeChange}
onChange={onChangePn}
onShowSizeChange={onShowSizeChange}
/>
</div>
@ -636,7 +646,7 @@ function CouponRules() {
disabled={justCheck}
value={currentCouponInfo.mode}
options={[{value: 1, label: '自有券'},{value: 2, label: '合作券'}]}
onChange={e=>{setCurrentCouponInfo({...currentCouponInfo, mode: e.target.value}); console.log(e)}}
onChange={e=>{setCurrentCouponInfo({...currentCouponInfo, mode: e.target.value});}}
/>
<FormInput
yisaLabel="合作方"
@ -705,6 +715,8 @@ function CouponRules() {
isRequired={true}
disabled={justCheck}
value={currentCouponInfo.discount_ratio}
min={1}
max={99}
showClose={true}
showCount={false}
suffixWord="%"
@ -712,6 +724,8 @@ function CouponRules() {
/>
<FormInputNumber
yisaLabel="折扣金额上限"
min={0}
max={9999}
isRequired={true}
disabled={justCheck}
value={currentCouponInfo.discount_limit}
@ -731,6 +745,8 @@ function CouponRules() {
disabled={justCheck}
value={currentCouponInfo.hour}
showClose={true}
min={1}
max={9999}
showCount={false}
suffixWord="小时以上使用"
onChange={e => { setCurrentCouponInfo({ ...currentCouponInfo,hour: e }) } }

3
src/services/OperationCenter/OperationSales/index.js

@ -260,5 +260,6 @@ export default {
yardDiscountTableData,
yardDiscountDown,
yardDiscountDelete,
handleCouponDown
handleCouponDown,
handleAuditTemplate
};
Loading…
Cancel
Save