Commit 7418f22f authored by GuanHua's avatar GuanHua

feat:对接积分兑换

parent 1281ab95
......@@ -26,7 +26,7 @@ interface CommodityPropsType {
}
interface filterQuery {
interface FilterQuery {
current: number;
pageSize: number;
name?: string;
......@@ -98,7 +98,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
useEffect(() => {
if (userInfo && layoutType === LAYOUT_TYPE.mall) {
let temp = JSON.parse(JSON.stringify(filterConfig))
const temp = JSON.parse(JSON.stringify(filterConfig))
temp.unshift(FILTER_TYPE.commonlyUsed)
setFilterConfig(temp)
}
......@@ -108,7 +108,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
}, [layoutType])
const fetchCommodityList = (currentParam?: number) => {
let param: filterQuery = {
let param: FilterQuery = {
current: currentParam ? currentParam : current,
pageSize
}
......@@ -149,7 +149,6 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
break
}
//@ts-ignore
getFn && getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
......
......@@ -37,11 +37,10 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
}, [mallTemplateId])
const findFirstAdvertsByType = () => {
let params = {
const params: any = {
templateId: mallTemplateId,
type: 1
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setFirstAdvertList(res.data)
......@@ -50,11 +49,10 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
}
const findSecondAdvertsByType = () => {
let params = {
const params: any = {
templateId: mallTemplateId,
type: 2
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setSecondAdvertList(res.data)
......@@ -81,12 +79,11 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param = {
const param: any = {
templateId: mallTemplateId,
categoryId
}
// @ts-ignore
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -96,12 +93,12 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
}
const getCategoryComponents = async () => {
let result = []
let firstCategory: any = await fetchFirstCategory()
const result = []
const firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
for (const item of firstCategory) {
if (item.id) {
let categoryDetail: any = await fetchCategoryById(item.id)
const categoryDetail: any = await fetchCategoryById(item.id)
result.push(
<FloorLine
linkUrl={`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
......
......@@ -27,11 +27,6 @@ interface LXMallLayoutPropsType {
SiteStore?: any;
}
interface queryType {
shopId: number;
memberId: number;
}
const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const { children, location } = props
......@@ -56,7 +51,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const getWebMallInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
const webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
setMallInfo(webMallInfo)
}
......@@ -67,7 +62,6 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
}, [query])
const fetchShopInfo = (memberId) => {
//@ts-ignore
PublicApi.getTemplateShopFindShop({ memberId }).then(res => {
if (res.code === 1000) {
setShopInfo(res.data)
......@@ -79,7 +73,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
}
useEffect(() => {
let body = document.getElementsByTagName('body')[0];
const body = document.getElementsByTagName('body')[0];
if (shopInfo) {
body.className = shopInfo.fileName ? `theme-shop-${shopInfo.fileName}` : templateName;
} else {
......
......@@ -43,12 +43,12 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
}, [orderInfo, payInfo])
const fetchBalanceInfo = () => {
let param = {
const param: any = {
payType: payInfo.ruleConfigurationId,
parentMemberId: orderInfo.supplyMembersId,
parentMemberRoleId: orderInfo.supplyMembersRoleId
}
//@ts-ignore
PublicApi.getPayAssetAccountGetUserBalance(param).then(res => {
if (res.code === 1000) {
setBalanceInfo(res.data)
......@@ -57,8 +57,6 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
setPageLoading(false)
onChange(true, res.message)
}
}).catch(() => {
})
}
......@@ -80,14 +78,13 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
message.info("请输入支付密码")
return
}
let param = {
const param: any = {
id: Number(orderId),
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: encryptedByAES(payPassword)
}
setConfirmLoading(true)
//@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => {
if (res.code === 1000) {
message.destroy()
......
......@@ -10,6 +10,7 @@ import { numFormat } from '@/utils/numberFomat'
import { linkToUrl } from '../../utils'
import { LAYOUT_TYPE } from '@/constants'
import styles from './index.less'
import { encryptedByAES } from '@/utils/cryptoAes'
import { message, Button, Spin } from 'antd'
interface CreditPayWayPropsType {
......@@ -43,7 +44,7 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
}, [orderInfo])
const fetchCreditInfo = () => {
let param = {
const param: any = {
parentMemberId: orderInfo.supplyMembersId,
parentMemberRoleId: orderInfo.supplyMembersRoleId
}
......@@ -77,14 +78,13 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
message.error("请输入支付密码")
return
}
let param = {
const param: any = {
id: Number(orderId),
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: Number(payPassword)
payPassword: encryptedByAES(payPassword)
}
setConfirmLoading(true)
//@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => {
if (res.code === 1000) {
message.destroy()
......
......@@ -47,11 +47,11 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
}, [orderInfo])
const fetchPointInfo = () => {
let param = {
const param: any = {
memberId: orderInfo.supplyMembersId,
roleId: orderInfo.supplyMembersRoleId
}
//@ts-ignore
PublicApi.getMemberBusinessLrcRightPointGet(param).then(res => {
if (res.code === 1000) {
setPointInfo(res.data)
......@@ -60,8 +60,6 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
setPageLoading(false)
onChange(true, res.message)
}
}).catch(() => {
})
}
......@@ -83,14 +81,15 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
message.error("请输入支付密码")
return
}
let param = {
const param: any = {
id: Number(orderId),
relType,
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: encryptedByAES(payPassword)
}
setConfirmLoading(true)
//@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => {
if (res.code === 1000) {
message.destroy()
......
import React, { useState, useEffect } from 'react'
import { CaretUpOutlined, CaretDownOutlined, UnorderedListOutlined, AppstoreOutlined, CloseOutlined } from '@ant-design/icons'
import { CaretUpOutlined, CaretDownOutlined, CloseOutlined } from '@ant-design/icons'
import Filter from '../components/Filter'
import { FILTER_TYPE } from '@/constants'
import { Pagination } from 'antd'
......@@ -13,7 +13,7 @@ import { PublicApi } from '@/services/api'
import { LAYOUT_TYPE } from '@/constants'
import cx from 'classnames'
import { PostSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import bannerImg from '@/assets/imgs/banner_2.png'
// import bannerImg from '@/assets/imgs/banner_2.png'
import styles from './index.less'
interface CommodityPropsType {
......@@ -23,7 +23,7 @@ interface CommodityPropsType {
shopId: number;
}
interface filterQuery {
interface FilterQuery {
current: number;
pageSize: number;
name?: string;
......@@ -73,7 +73,7 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
}, [])
const fetchCommodityList = (currentParam?: number) => {
let param: filterQuery = {
let param: FilterQuery = {
current: currentParam ? currentParam : current,
pageSize
}
......@@ -98,7 +98,6 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
break
}
//@ts-ignore
getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
......
import CryptoJS from 'crypto-js'
var key = CryptoJS.enc.Utf8.parse('GzSsyLingxi2.0.0');
const key = CryptoJS.enc.Utf8.parse('GzSsyLingxi2.0.0');
// var iv = CryptoJS.enc.Utf8.parse('JlM6cyqmrC2zKNsx');
/**
......@@ -8,8 +8,8 @@ var key = CryptoJS.enc.Utf8.parse('GzSsyLingxi2.0.0');
* 加密方法
*/
export const encryptedByAES = (source: string) => {
var password=CryptoJS.enc.Utf8.parse(source);
var encrypted = CryptoJS.AES.encrypt(password, key, {mode:CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}); //CryptoJS.pad.Pkcs7
const password=CryptoJS.enc.Utf8.parse(source);
const encrypted = CryptoJS.AES.encrypt(password, key, {mode:CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}); //CryptoJS.pad.Pkcs7
return encrypted.toString() // 加密后的base64
}
......@@ -18,6 +18,6 @@ export const encryptedByAES = (source: string) => {
* 解密方法
*/
export const decryptedByAES = (source: string) => {
var decrypted = CryptoJS.AES.decrypt(source, key, {mode:CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}); //CryptoJS.pad.Pkcs7
const decrypted = CryptoJS.AES.decrypt(source, key, {mode:CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}); //CryptoJS.pad.Pkcs7
return decrypted.toString(CryptoJS.enc.Utf8) // 解密后的原始字符串
}
\ No newline at end of file
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