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

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

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

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

@ -48,12 +48,12 @@ function ActivitySpecificTopic() {
}, },
{ {
title: "活动状态", title: "活动状态",
dataIndex: "active_status",
key: "active_status",
dataIndex: "status_zhname",
key: "status",
}, },
{ {
title: "审核状态", title: "审核状态",
dataIndex: "is_examine",
dataIndex: "is_examine_zhname",
key: "is_examine", key: "is_examine",
}, },
{ {
@ -152,7 +152,12 @@ function ActivitySpecificTopic() {
const [templateModal, setTemplateModal] = useState({ const [templateModal, setTemplateModal] = useState({
visible: false, visible: false,
record: {}, record: {},
close: () => setTemplateModal({ ...templateModal, visible: false }),
close: () => {
setTemplateModal({ ...templateModal, visible: false });
if(tableRef.current){
tableRef.current.fetch()
}
},
}); });
const [couponOptions,setCouponOptions] = useState([]) 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 [couponList, setCouponList] = useState([{ key: createKey() }]);
const [ modalVisible, setModalVisible] = useState(false) const [ modalVisible, setModalVisible] = useState(false)
const [fileList, setFileList] = useState([]); const [fileList, setFileList] = useState([]);
const [phones, setPhones] = useState([])
function createKey() { function createKey() {
return Math.random().toString(36).substr(2, 5); return Math.random().toString(36).substr(2, 5);
} }
@ -57,7 +58,7 @@ function Add(props) {
return item; return item;
}); });
setCouponList(_couponList); setCouponList(_couponList);
console.log(_couponList);
// console.log(_couponList);
} }
const uploadProps = { const uploadProps = {
@ -89,9 +90,11 @@ function Add(props) {
}, },
}) })
.then((res) => { console.log(res); return res.json()}) .then((res) => { console.log(res); return res.json()})
.then(() => {
.then((res) => {
// console.log(res.data.list)
message.success('上传成功'); message.success('上传成功');
getData();
// getData();
setPhones(res.data.list)
setModalVisible(false) setModalVisible(false)
}) })
.catch(() => { .catch(() => {
@ -108,7 +111,7 @@ function Add(props) {
.validateFields() .validateFields()
.then((values) => { .then((values) => {
console.log(values, 'submit values')
// console.log(values, 'submit values')
let temp = 0; let temp = 0;
values.info.map(item=>{ values.info.map(item=>{
temp += parseInt(item.num) temp += parseInt(item.num)
@ -125,12 +128,14 @@ function Add(props) {
// num: item.num // num: item.num
// }; // };
// }), // }),
phones: phones,
total: temp total: temp
}; };
ajax.handleDistributionOperate(params).then((res) => { ajax.handleDistributionOperate(params).then((res) => {
if (res.status === 20000) { if (res.status === 20000) {
message.success("添加成功"); message.success("添加成功");
// close(); // close();
getData();
setShowEdit(false); setShowEdit(false);
form.resetFields(); form.resetFields();
} }
@ -144,7 +149,7 @@ function Add(props) {
return ( return (
<> <>
<Form form={form} initialValues={{info: [{key:createKey()}]}} >
<Form form={form} initialValues={{info: [{key:createKey()}], sending_type: '2'}} >
<Form.Item <Form.Item
label="活动名称" label="活动名称"
name="activity_name" name="activity_name"
@ -221,7 +226,8 @@ function Add(props) {
{/* <Input style={{ width: "20%" }} /> */} {/* <Input style={{ width: "20%" }} /> */}
<Select <Select
style={{ width: "20%" }} style={{ width: "20%" }}
options={[{label: '按用户标签', value: '1'},{label: "按手机", value: "2"}]}
// options={[{label: '', value: '1'},{label: "", value: "2"}]}
options={[{label: "按手机", value: "2"}]}
></Select> ></Select>
</Form.Item> </Form.Item>
<Form.Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.sending_type == '1'}> <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 = [ const columns = [
{ {
title: '序号', title: '序号',
dataIndex: 'id',
// dataIndex: 'id',
key: 'id', key: 'id',
width: 150,
width: 80,
render: (_, record , index)=>{
return (<span >{index + 1}</span>)
}
}, },
{ {
title: '活动名称', title: '活动名称',
@ -84,7 +87,7 @@ function CouponDistribute(props) {
title: '发放时间', title: '发放时间',
dataIndex: 'send_time', dataIndex: 'send_time',
key: 'send_time', key: 'send_time',
// width: 150,
width: 250,
ellipsis: true, ellipsis: true,
align: 'center' align: 'center'
}, },

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

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

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

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