diff --git a/config/routes.js b/config/routes.js index dc3bf43..9845600 100644 --- a/config/routes.js +++ b/config/routes.js @@ -308,6 +308,19 @@ export default [ }, ], }, + { + name: '优惠券管理', + icon: 'BankFilled', + path: '/shopmanage/coupon', + routes: [ + { + name: '纸质优惠券管理', + icon: 'smile', + path: '/shopmanage/coupon/paperCoupon', + component: './shopmanage/coupon/paperCoupon', + } + ], + }, { name: '门店会员管理', icon: 'BankFilled', diff --git a/src/pages/applet/basicconfiguration/index.jsx b/src/pages/applet/basicconfiguration/index.jsx index ca4cf38..2b716e2 100644 --- a/src/pages/applet/basicconfiguration/index.jsx +++ b/src/pages/applet/basicconfiguration/index.jsx @@ -495,10 +495,12 @@ const Material = () => { })() } - + - diff --git a/src/pages/applet/paytemplate/index.jsx b/src/pages/applet/paytemplate/index.jsx index f632ff0..7a189ad 100644 --- a/src/pages/applet/paytemplate/index.jsx +++ b/src/pages/applet/paytemplate/index.jsx @@ -255,13 +255,13 @@ const pageManage = () => { - - - + diff --git a/src/pages/push/batchingpush/index.jsx b/src/pages/push/batchingpush/index.jsx index c38f5b1..2ae8c1d 100644 --- a/src/pages/push/batchingpush/index.jsx +++ b/src/pages/push/batchingpush/index.jsx @@ -126,26 +126,26 @@ const goodspush = () => { > 重发 , - { - await DeleteGoodsType(record.id).then((r) => { - if (r.succeeded) { - message.success('删除成功'); - actionRef.current.reloadAndRest(); - } else { - message.error(r.errors); - } - }); - }} - onCancel={() => {}} - > - 删除 - , + // { + // await DeleteGoodsType(record.id).then((r) => { + // if (r.succeeded) { + // message.success('删除成功'); + // actionRef.current.reloadAndRest(); + // } else { + // message.error(r.errors); + // } + // }); + // }} + // onCancel={() => {}} + // > + // 删除 + // , ], }, ]; diff --git a/src/pages/push/batchingpush/services.js b/src/pages/push/batchingpush/services.js index d0c7680..23d29d3 100644 --- a/src/pages/push/batchingpush/services.js +++ b/src/pages/push/batchingpush/services.js @@ -15,7 +15,7 @@ export async function GetDevicePushRecodePage(data) { } export async function DevicePushRecodeUpdate(data) { return request(getStoremanagement()+`/api/devicepushrecode/update?id=`+data, { - method: 'POST', + method: 'get', data: data, }); } diff --git a/src/pages/push/goodspush/index.jsx b/src/pages/push/goodspush/index.jsx index a544967..26e744f 100644 --- a/src/pages/push/goodspush/index.jsx +++ b/src/pages/push/goodspush/index.jsx @@ -126,26 +126,26 @@ const goodspush = () => { > 重发 , - { - await DeleteGoodsType(record.id).then((r) => { - if (r.succeeded) { - message.success('删除成功'); - actionRef.current.reloadAndRest(); - } else { - message.error(r.errors); - } - }); - }} - onCancel={() => {}} - > - 删除 - , + // { + // await DeleteGoodsType(record.id).then((r) => { + // if (r.succeeded) { + // message.success('删除成功'); + // actionRef.current.reloadAndRest(); + // } else { + // message.error(r.errors); + // } + // }); + // }} + // onCancel={() => {}} + // > + // 删除 + // , ], }, ]; diff --git a/src/pages/push/goodspush/services.js b/src/pages/push/goodspush/services.js index 392befa..85bad56 100644 --- a/src/pages/push/goodspush/services.js +++ b/src/pages/push/goodspush/services.js @@ -15,7 +15,7 @@ export async function GetDevicePushRecodePage(data) { } export async function DevicePushRecodeUpdate(data) { return request(getStoremanagement()+`/api/devicepushrecode/update?id=`+data, { - method: 'POST', + method: 'get', data: data, }); } diff --git a/src/pages/push/technologypush/index.jsx b/src/pages/push/technologypush/index.jsx index e767ec8..c9f7add 100644 --- a/src/pages/push/technologypush/index.jsx +++ b/src/pages/push/technologypush/index.jsx @@ -126,26 +126,26 @@ const goodspush = () => { > 重发 , - { - await DeleteGoodsType(record.id).then((r) => { - if (r.succeeded) { - message.success('删除成功'); - actionRef.current.reloadAndRest(); - } else { - message.error(r.errors); - } - }); - }} - onCancel={() => {}} - > - 删除 - , + // { + // await DeleteGoodsType(record.id).then((r) => { + // if (r.succeeded) { + // message.success('删除成功'); + // actionRef.current.reloadAndRest(); + // } else { + // message.error(r.errors); + // } + // }); + // }} + // onCancel={() => {}} + // > + // 删除 + // , ], }, ]; diff --git a/src/pages/push/technologypush/services.js b/src/pages/push/technologypush/services.js index 392befa..85bad56 100644 --- a/src/pages/push/technologypush/services.js +++ b/src/pages/push/technologypush/services.js @@ -15,7 +15,7 @@ export async function GetDevicePushRecodePage(data) { } export async function DevicePushRecodeUpdate(data) { return request(getStoremanagement()+`/api/devicepushrecode/update?id=`+data, { - method: 'POST', + method: 'get', data: data, }); } diff --git a/src/pages/shopmanage/coupon/goodsCoupon/components/CreateForm/index.jsx b/src/pages/shopmanage/coupon/goodsCoupon/components/CreateForm/index.jsx new file mode 100644 index 0000000..a6f03fc --- /dev/null +++ b/src/pages/shopmanage/coupon/goodsCoupon/components/CreateForm/index.jsx @@ -0,0 +1,198 @@ +import React, { useRef,useState, useEffect } from 'react'; +import { Modal, Form, Input, Button, Select, InputNumber, Divider, Space,message } from 'antd'; +import { PlusOutlined } from '@ant-design/icons'; +import { GetPaperCouponType,AddPaperCouponType } from '../../service'; +import GoodsList from '../GoodsList' +let index = 0; +const CreateForm = (props) => { + const[form]=Form.useForm(); + const [items, setItems] = useState(); + const [visiblegoods, setvisiblegoods] = useState(false); + const inputRef = useRef(null); + const [name, setName] = useState(''); + const [checkgoods,setcheckgoods]=useState([]); + //初始化数据 + useEffect(() => { + //form.resetFields(); + initcouponType(); + }, []); + + useEffect(()=>{ + form.setFieldsValue(props.values); + },[props.values]) + const initcouponType = async () => { + var data = await GetPaperCouponType(); + var op=[] + data.data.map((item) => ( + op.push({label:item.value,value:item.key}) + )); + setItems(op) + }; + const formItemLayout = { + labelCol: { + sm: { span: 4 }, + }, + wrapperCol: {}, + }; + const tailFormItemLayout = { + wrapperCol: { + sm: { + span: 500, + offset: 1, + }, + }, + }; + const onNameChange = (event) => { + setName(event.target.value); + }; + const addItem = async (e) => { + e.preventDefault(); + setItems([...items, {label:name,value:index++} || `New item ${index++}`]); + setName(''); + setTimeout(() => { + inputRef.current?.focus(); + }, 0); + + await AddPaperCouponType(JSON.stringify({Name:name})).then((r) => { + if (r.data) { + message.success('添加成功'); + initcouponType(); + } else { + message.error('添加失败请重试!'); + } + }) + }; + const ongoodsopen= () => { + setvisiblegoods(true); + } + const oncheck=(data)=>{ + console.log(data) + setcheckgoods(data) + } + return <> + { + props.onCancel(); + }} + //关闭时销毁 Modal 里的子元素 + destroyOnClose + > +
+ + + + + + + + + + + + + + + )} + options={items} + > + {/* {options} */} + + + + + + + + + + + + + + + + + + + +
+
+ { + setvisiblegoods(false) + }} onOk={()=>{ + var na=""; + var naid=""; + var money=0.00; + var storeid=""; + checkgoods.forEach((item,index)=>{ + na=na+item.goods_Name + naid=naid+item.goodsId; + money=item.price; + storeid=item.storeId; + if(index + + + +}; + +export default CreateForm; diff --git a/src/pages/shopmanage/coupon/goodsCoupon/components/GoodsList/index.jsx b/src/pages/shopmanage/coupon/goodsCoupon/components/GoodsList/index.jsx new file mode 100644 index 0000000..7e7fb36 --- /dev/null +++ b/src/pages/shopmanage/coupon/goodsCoupon/components/GoodsList/index.jsx @@ -0,0 +1,140 @@ +import React, { useState, useEffect, useRef } from 'react'; +import ProTable from '@ant-design/pro-table'; +import { Form, Select,Card,Tabs,Pagination} from 'antd'; +const { TabPane } = Tabs; +import {GetStoreGoods,GetStoreInfoPage} from "../../service"; + +const key = 'message'; + +const GoodsList = (props) => { + //编辑商品信息 form实例 + const [dataLsit, SetDataLsit] = useState([]); + const [total, SetTotal] = useState(0); + const [loading, SetLoading] = useState(false); + const goodscolumns = [ + { + title: '主键', + dataIndex: 'id', + hideInSearch: true, + hideInTable: true, + tip: '规则名称是唯一的 key', + }, + { + title: '商品', + dataIndex: 'goods_Name', + valueType: 'textarea', + }, + { + title: '商品价格', + dataIndex: 'price', + valueType: 'money', + + }, + { + title: '商品会员价格', + dataIndex: 'vipPrice', + valueType: 'money', + + }, + + { + title: '是否设备制作', + dataIndex: 'isDevice', + valueEnum: { + 0: { text: '店铺', status: 'Processing' }, + 1: { text: '设备', status: 'Success' }, + }, + }, + { + title: '状态', + dataIndex: 'status', + valueEnum: { + 0: { text: '上架', status: 'Processing' }, + 1: { text: '下架', status: 'Success' }, + }, + }, + { + title: '估清', + dataIndex: 'stopSales', + valueEnum: { + 0: { text: '销售', status: 'Processing' }, + 1: { text: '估清', status: 'Success' }, + } + } + ]; + + const getStoreInfoPageInfo = async (page) => { + SetLoading(true); + try { + await GetStoreInfoPage({ current: page, pageSize: 10 }).then((r) => { + SetTotal(1); + SetDataLsit(r.data); + SetLoading(false); + }); + } catch { + SetLoading(false); + } + + } + const actionRef = useRef(); + const goodsactionRef = useRef(); + useEffect(() => { + getStoreInfoPageInfo(1); + }, []); + return <> + + { + }}> + {dataLsit?.map((item) => { + return ( + + { + var data = []; + var total = 0; + params.StoreId = item.id; + await GetStoreGoods(params).then((r) => { + data = r.data?.data; + total = r.data?.total; + }); + return { + data: data, + success: true, + total: total, + }; + }} + rowSelection={{ + type: "radio", + onChange: (_, selectedRows) => { + props.oncheck(selectedRows) + //setSelectedRows(selectedRows); + }, + }} + /> + + ); + + })} + + { getStoreInfoPageInfo(page) }} + showTotal={(total, range) => `总共 ${total} 条`} + defaultPageSize={10} + defaultCurrent={1} + /> + + +} + +export default GoodsList; \ No newline at end of file diff --git a/src/pages/shopmanage/coupon/goodsCoupon/index.jsx b/src/pages/shopmanage/coupon/goodsCoupon/index.jsx new file mode 100644 index 0000000..6e0c767 --- /dev/null +++ b/src/pages/shopmanage/coupon/goodsCoupon/index.jsx @@ -0,0 +1,311 @@ +import React, { useState, useRef, useEffect } from 'react'; +import moment from 'moment'; +import ProTable, { TableDropdown } from '@ant-design/pro-table'; +import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; +import { Select, Button, message, Drawer, Popconfirm,Modal } from 'antd'; +import CreateForm from './components/CreateForm'; +import { + GetGoodsCouponPgage, + AddGoodsCoupon, + DeleteGoodsCoupon, + UpdateGoodsCoupon, + GetPaperCouponType, + AddPaperCouponType +} from './service'; + +const Coupon = () => { + //绑定 + const actionRef = useRef(); + const [selectedRowsState, setSelectedRows] = useState([]); + /** 新建/更新窗口的弹窗 */ + const [createModalVisible, handleModalVisible] = useState(false); + //记录分页列表 + const [currentRow, setCurrentRow] = useState(); + const key = 'coupon'; + const [optyid, setOptyid] = useState(); + const [items, setItems] = useState(); + //初始化数据 + useEffect(() => { + initcouponType() + }, []); + const initcouponType = async () => { + var data = await GetPaperCouponType(); + var op=[] + data.data.map((item) => ( + op.push({label:item.value,value:item.key}) + )); + setItems(op) + }; + //新增 + const handleAdd = async (fields) => { + message.loading('正在添加...', key); + try { + if (fields.validEndTime < fields.validStartTime) { + message.error('开始时间不能大于结束时间'); + return false; + } + await AddGoodsCoupon(JSON.stringify(fields)).then((r) => { + message.destroy(key); + if (r.data) { + message.success('添加成功'); + } else { + message.error('添加失败请重试!'); + } + }); + //刷新数据 + actionRef.current.reload(); + return true; + } catch (error) { + message.destroy(key); + message.error('添加失败请重试!'); + return false; + } + }; + + //删除(支持批量删除) + const handleRemove = async (value) => { + message.loading('正在更新...', key); + try { + await DeleteGoodsCoupon(value).then((r) => { + console.log(r) + message.destroy(key); + if (r.data) { + message.destroy(key); + message.success('更新成功'); + } else { + message.error(r.errors); + } + }); + //刷新数据 + actionRef.current.reload(); + return true; + } catch (error) { + message.destroy(key); + message.error('更新失败请重试!'); + return false; + } + }; + + //修改 + const handleUpdate = async (fields) => { + message.loading('正在修改...', key); + try { + if (fields.validEndTime < fields.validStartTime) { + message.error('开始时间不能大于结束时间'); + return false; + } + await UpdateGoodsCoupon(JSON.stringify(fields)).then((r) => { + message.destroy(key); + if (r.data) { + message.success('修改成功'); + } else { + message.error(JSON.sstringify(r.errors)); + } + }); + //刷新数据 + actionRef.current.reload(); + return true; + } catch (error) { + message.destroy(key); + message.error('修改失败请重试!'); + return false; + } + }; + const onchangevalue=(value)=>{ + console.log(value) + setOptyid(value) + } + //table的展示列 + const columns = [ + { + title: '主键', + dataIndex: 'id', + tip: '规则名称是唯一的 key', + hideInSearch: true, + hideInTable: true, + }, + + { + title: '标题', + dataIndex: 'title', + valueType: 'textarea', + }, + { + title: '店铺名称', + dataIndex: 'storeName', + valueType: 'textarea', + width: 120, + }, + { + title: '商品名称', + dataIndex: 'goodsName', + valueType: 'textarea', + width: 120, + }, + { + title: '优惠平台', + width: 90, + dataIndex: 'cTypeName', + key: 'cTypeName', + renderFormItem: () => ( + + + + + + + + + + + )} + options={items} + > + {/* {options} */} + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default CreateForm; diff --git a/src/pages/shopmanage/coupon/paperCoupon/index.jsx b/src/pages/shopmanage/coupon/paperCoupon/index.jsx new file mode 100644 index 0000000..2d9e1b5 --- /dev/null +++ b/src/pages/shopmanage/coupon/paperCoupon/index.jsx @@ -0,0 +1,300 @@ +import React, { useState, useRef, useEffect } from 'react'; +import moment from 'moment'; +import ProTable, { TableDropdown } from '@ant-design/pro-table'; +import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; +import { Select, Button, message, Drawer, Popconfirm,Modal } from 'antd'; +import CreateForm from './components/CreateForm'; +import { + GetPaperCouponList, + AddPaperCoupon, + DeletePaperCoupon, + UpdatePaperCoupon, + GetPaperCouponType, + AddPaperCouponType +} from './service'; + +const Coupon = () => { + //绑定 + const actionRef = useRef(); + const [selectedRowsState, setSelectedRows] = useState([]); + /** 新建/更新窗口的弹窗 */ + const [createModalVisible, handleModalVisible] = useState(false); + //记录分页列表 + const [currentRow, setCurrentRow] = useState(); + const key = 'coupon'; + const [optyid, setOptyid] = useState(); + const [items, setItems] = useState(); + //初始化数据 + useEffect(() => { + initcouponType() + }, []); + const initcouponType = async () => { + var data = await GetPaperCouponType(); + var op=[] + data.data.map((item) => ( + op.push({label:item.value,value:item.key}) + )); + setItems(op) + }; + //新增 + const handleAdd = async (fields) => { + message.loading('正在添加...', key); + try { + if (fields.validEndTime < fields.validStartTime) { + message.error('开始时间不能大于结束时间'); + return false; + } + await AddPaperCoupon(JSON.stringify(fields)).then((r) => { + message.destroy(key); + if (r.data) { + message.success('添加成功'); + } else { + message.error('添加失败请重试!'); + } + }); + //刷新数据 + actionRef.current.reload(); + return true; + } catch (error) { + message.destroy(key); + message.error('添加失败请重试!'); + return false; + } + }; + + //删除(支持批量删除) + const handleRemove = async (value) => { + message.loading('正在执行...', key); + try { + await DeletePaperCoupon(JSON.stringify(value)).then((r) => { + console.log(r) + message.destroy(key); + if (r.data) { + message.destroy(key); + message.success('执行成功'); + } else { + message.error(r.errors); + } + }); + //刷新数据 + actionRef.current.reload(); + return true; + } catch (error) { + message.destroy(key); + message.error('执行失败请重试!'); + return false; + } + }; + + //修改 + const handleUpdate = async (fields) => { + message.loading('正在修改...', key); + try { + if (fields.validEndTime < fields.validStartTime) { + message.error('开始时间不能大于结束时间'); + return false; + } + await UpdatePaperCoupon(JSON.stringify(fields)).then((r) => { + message.destroy(key); + if (r.data) { + message.success('修改成功'); + } else { + message.error(JSON.sstringify(r.errors)); + } + }); + //刷新数据 + actionRef.current.reload(); + return true; + } catch (error) { + message.destroy(key); + message.error('修改失败请重试!'); + return false; + } + }; + const onchangevalue=(value)=>{ + console.log(value) + setOptyid(value) + } + //table的展示列 + const columns = [ + { + title: '主键', + dataIndex: 'id', + tip: '规则名称是唯一的 key', + hideInSearch: true, + hideInTable: true, + }, + { + title: '标题', + dataIndex: 'title', + valueType: 'textarea', + }, + { + title: '优惠卷类型', + width: 90, + dataIndex: 'cTypeName', + key: 'cTypeName', + renderFormItem: () => ( + - - - - - - - - - - + + + + + + + + + @@ -62,11 +61,17 @@ const CreateForm = (props) => { - + {/* - + */} + + );