diff --git a/project.private.config.json b/project.private.config.json index 772adba..9a1e32c 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -120,6 +120,27 @@ "query": "orderId=28411", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/newCollection/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/addCollection/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/collectionDetail/index", + "query": "", + "launchMode": "default", + "scene": null } ] } diff --git a/src/api/newCollection.ts b/src/api/newCollection.ts new file mode 100644 index 0000000..a249e42 --- /dev/null +++ b/src/api/newCollection.ts @@ -0,0 +1,17 @@ +import { useRequest } from '@/use/useHttp' + +//收款单列表 +export const mpcashManagementOrderlist = () => { + return useRequest({ + url: `/v1/mp/cashManagementOrder/list`, + method: "get", + }) +} +//收款单详情 +export const mpcashManagementOrder = () => { + return useRequest({ + url: `/v1/mp/cashManagementOrder`, + method: "get", + }) +} + diff --git a/src/app.config.ts b/src/app.config.ts index 5f7398b..6a487bf 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -105,6 +105,30 @@ export default defineAppConfig({ pages: [ "index" ] - } + }, + { + root: "pages/newCollection", + pages: [ + "index" + ] + }, + { + root: "pages/addCollection", + pages: [ + "index" + ] + }, + { + root: "pages/accountPage", + pages: [ + "index" + ] + }, + { + root: "pages/collectionDetail", + pages: [ + "index" + ] + }, ], }) diff --git a/src/common/constant.js b/src/common/constant.js index 8bb7d32..57a4306 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -1,4 +1,4 @@ -export const BASE_URL = CURRENT_BASE_URL +// export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket` @@ -14,6 +14,7 @@ export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华 // CDN // 生成密钥 diff --git a/src/common/money.ts b/src/common/money.ts new file mode 100644 index 0000000..fa08169 --- /dev/null +++ b/src/common/money.ts @@ -0,0 +1,88 @@ +const smallToBig = function (money) { + // 将数字金额转换为大写金额 + var cnNums = new Array( + '零', + '壹', + '贰', + '叁', + '肆', + '伍', + '陆', + '柒', + '捌', + '玖' + ); //汉字的数字 + var cnIntRadice = new Array('', '拾', '佰', '仟'); //基本单位 + var cnIntUnits = new Array('', '万', '亿', '兆'); //对应整数部分扩展单位 + var cnDecUnits = new Array('角', '分', '毫', '厘'); //对应小数部分单位 + var cnInteger = '整'; //整数金额时后面跟的字符 + var cnIntLast = '元'; //整数完以后的单位 + //最大处理的数字 + var maxNum = 999999999999999.9999; + var integerNum; //金额整数部分 + var decimalNum; //金额小数部分 + //输出的中文金额字符串 + var chineseStr = ''; + var parts; //分离金额后用的数组,预定义 + if (money == '') { + return ''; + } + + money = parseFloat(money); + if (money >= maxNum) { + //超出最大处理数字 + return '超出最大处理数字'; + } + if (money == 0) { + chineseStr = cnNums[0] + cnIntLast + cnInteger; + return chineseStr; + } + + //四舍五入保留两位小数,转换为字符串 + money = Math.round(money * 100).toString(); + integerNum = money.substr(0, money.length - 2); + decimalNum = money.substr(money.length - 2); + + //获取整型部分转换 + if (parseInt(integerNum, 10) > 0) { + var zeroCount = 0; + var IntLen = integerNum.length; + for (var i = 0; i < IntLen; i++) { + var n = integerNum.substr(i, 1); + var p = IntLen - i - 1; + var q = p / 4; + var m = p % 4; + if (n == '0') { + zeroCount++; + } else { + if (zeroCount > 0) { + chineseStr += cnNums[0]; + } + //归零 + zeroCount = 0; + chineseStr += cnNums[parseInt(n)] + cnIntRadice[m]; + } + if (m == 0 && zeroCount < 4) { + chineseStr += cnIntUnits[q]; + } + } + chineseStr += cnIntLast; + } + //小数部分 + if (decimalNum != '') { + var decLen = decimalNum.length; + for (var i = 0; i < decLen; i++) { + var n = decimalNum.substr(i, 1); + if (n != '0') { + chineseStr += cnNums[Number(n)] + cnDecUnits[i]; + } + } + } + if (chineseStr == '') { + chineseStr += cnNums[0] + cnIntLast + cnInteger; + } else if (decimalNum == '' || /^0*$/.test(decimalNum)) { + chineseStr += cnInteger; + } + return chineseStr; +}; +export default smallToBig; diff --git a/src/pages/accountPage/index.config.ts b/src/pages/accountPage/index.config.ts new file mode 100644 index 0000000..aec3d40 --- /dev/null +++ b/src/pages/accountPage/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '收款账户', +} diff --git a/src/pages/accountPage/index.module.scss b/src/pages/accountPage/index.module.scss new file mode 100644 index 0000000..4de4ecc --- /dev/null +++ b/src/pages/accountPage/index.module.scss @@ -0,0 +1,110 @@ +page { + background: #f7f7f7; +} + +.cussBox { + + .searchBox { + position: sticky; + top: 0; + width: 750px; + height: 96px; + background: #FFFFFF; + display: flex; + align-items: center; + + .two { + width: 702px; + height: 72px; + margin-left: 24px; + } + } + + .listBox { + height: calc(100vh - 96px); + } + + .itemBox { + margin-left: 24px; + width: 702px; + height: 104px; + background: #FFFFFF; + border-radius: 16px; + display: flex; + align-items: center; + margin-top: 24px; + box-sizing: border-box; + + .cussName { + margin-left: 48px; + width: 168px; + height: 34px; + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #000000; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + + .phone { + margin-left: 88px; + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + + .woker { + margin-left: 88px; + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } + + .acticveitemBox { + margin-left: 24px; + width: 702px; + height: 104px; + background: #FFFFFF; + border-radius: 16px; + display: flex; + align-items: center; + margin-top: 24px; + box-sizing: border-box; + + border: 1px solid #337FFF; + + .cussName { + margin-left: 48px; + width: 168px; + height: 34px; + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #000000; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + + .phone { + margin-left: 88px; + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + + .woker { + margin-left: 88px; + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } +} \ No newline at end of file diff --git a/src/pages/accountPage/index.tsx b/src/pages/accountPage/index.tsx new file mode 100644 index 0000000..19fcea6 --- /dev/null +++ b/src/pages/accountPage/index.tsx @@ -0,0 +1,151 @@ +import { View, ScrollView, Image, Input, Button } from '@tarojs/components' +import { useCallback, useEffect, useMemo, useRef, useState, memo } from 'react' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Search from '@/components/search' +import { mpenumsaleUserlist } from '@/api/order' +import { useDidShow } from '@tarojs/taro'; +import Taro from '@tarojs/taro' +import { useRouter } from '@tarojs/taro' +import InfiniteScroll from '@/components/infiniteScroll' +import { dataLoadingStatus, getFilterData } from '@/common/util' + +export default () => { + + + + const [search, setSearch] = useState({ + name: null, + page: 1, + size: 10, + }) + const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) + + const { fetchData: clitentFetch, state: orderState } = mpenumsaleUserlist() + //数据加载状态 + const statusMore = useMemo(() => { + return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading }) + }, [clentList, orderState]) + + const [clientObj, setclientObj] = useState({ + bankId: null, + bankName: '' + }) + + //输入了搜索关键字 + const getSearchData = useCallback((eq) => { + pageNum.current.page = 1 + setClientlist(() => ({ list: [], total: 0 })) + setSearch((e) => ({ ...e, name: eq, size: 10 })) + }, []) + + + const router = useRouter() + + useEffect(() => { + if (search.name === '') { + setSearch((e) => ({ ...e, name: null })) + } + if (search.name !== '') getCuss() + }, [search]) + + //上拉加载数据 + const pageNum = useRef({ size: search.size, page: search.page }) + const getScrolltolower = useCallback(() => { + if (clentList.list.length < clentList.total) { + pageNum.current.page++ + const size = pageNum.current.size * pageNum.current.page + setSearch((e) => ({ ...e, size })) + console.log(search, 11111) + } + }, [clentList]) + + //列表下拉刷新 + const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) + const getRefresherRefresh = async () => { + pageNum.current.size = 1 + setRefresherTriggeredStatus(true) + setSearch((val) => ({ ...val, size: 10 })) + } + const getCuss = async () => { + let res = await clitentFetch({ name: search.name === null ? '' : search.name, page: search.page, size: search.size }) + if (router?.params.bankId) { + res.data.list.map(item => { + if (item.id == router?.params.bankId) { + item.checked = true + } else { + item.checked = false + } + return item + }) + } + setClientlist((e) => ({ ...e, list: res.data?.list, total: res.data?.total })) + setRefresherTriggeredStatus(() => false) + } + //选择业务员 + const selectClient = (item) => { + clentList.list.map(it => { + if (item.id === it.id) { + it.checked = true + } else { + it.checked = false + } + return it + }) + let pages = Taro.getCurrentPages(); // 获取当前的页面栈 + let prevPage = pages[pages.length - 2]; + prevPage.setData({ //设置上一个页面的值 + bankId: item.id, + bankName: item.name + }); + setClientlist((e) => ({ ...e, list: clentList?.list, total: clentList?.total })) + setclientObj(item) + Taro.navigateBack({ + delta: 1 + }) + } + useEffect(() => { + if (clientObj?.bankId !== null) { + setclientObj(clientObj) + } else { + let pages = Taro.getCurrentPages(); // 获取当前的页面栈 + let prevPage = pages[pages.length - 2]; + prevPage.setData({ //设置上一个页面的值 + bankId: '', + bankName: '', + }); + } + }, [clientObj]) + return ( + + + + + + + + + + { + clentList.list.map((item, index) => { + return ( + { selectClient(item) }}> + {item.name} + {item.phone} + {item.sale_user_name} + + ) + }) + } + + + + + + ) +} \ No newline at end of file diff --git a/src/pages/addCollection/components/form/index.module.scss b/src/pages/addCollection/components/form/index.module.scss new file mode 100644 index 0000000..8d81edb --- /dev/null +++ b/src/pages/addCollection/components/form/index.module.scss @@ -0,0 +1,97 @@ +.itemBox { + width: 100%; + border-bottom: 1px solid #f7f7f7; + display: flex; + // align-items: center; + padding-top: 40px; + padding-bottom: 40px; + + .itemLeft { + + // align-items: center; + .finkFlex { + display: flex; + + .itemTitle { + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .xing { + font-size: 28px; + font-weight: 500; + color: #E42945; + margin-right: 48px; + } + } + + .finkFont { + font-size: 20px; + font-weight: 400; + color: grey; + } + + + } + + .bigPic { + width: 70%; + } + + .itemRight { + // display: flex; + // align-items: center; + // justify-content: space-between; + width: 70%; + // position: relative; + + .assginFont { + // position: absolute; + // bottom: 10px; + // left: 0px; + font-size: 24px; + font-weight: 500; + color: #000000; + } + + .rightFlex { + .placeholderStyle { + color: #f7f7f7; + font-size: 28px; + font-weight: 400; + } + + .inputStyle { + font-size: 28px; + font-weight: 400; + color: #000000; + width: 100%; + } + } + + .iconFlex { + display: flex; + align-items: center; + + .chakanquanbukehu2 { + font-size: 50px !important; + } + + .shu { + width: 2px; + height: 36px; + background: #000000; + opacity: 0.2; + margin-left: 24px; + } + + .saomiao { + margin-left: 24px; + color: #087EFF; + font-size: 40px !important; + } + } + + } +} \ No newline at end of file diff --git a/src/pages/addCollection/components/form/index.tsx b/src/pages/addCollection/components/form/index.tsx new file mode 100644 index 0000000..1544633 --- /dev/null +++ b/src/pages/addCollection/components/form/index.tsx @@ -0,0 +1,101 @@ +import { ScrollView, View, Text, Input } from '@tarojs/components' +import { memo, useCallback, useEffect, useMemo, useState } from 'react' +import styles from './index.module.scss' +import classnames from 'classnames' +// import BottomBtns from '@/components/BottomBtns' +import { formatPriceDiv, formatDateTime } from '@/common/format' +import Taro from '@tarojs/taro' +import IconFont from '@/components/iconfont/iconfont' +import UploadImage from '@/components/uploadImage' + +interface Params { + title?: string, //传入的名称 + require?: boolean, //是否显示必须选填的内容图标 + isInput?: boolean, //是否显示输入框 + inputValue?: string, //输入框的值 + inputType?: any, //输入框类型 + getInput?: (any) => void //输入框回调 + showScan?: boolean, //是否显示扫描图标 + placeholderFont?: string, //输入框默认文本 + showMore?: boolean, // 是否显示更多图标 + disabled?: boolean, // 是否输入框禁止 + onlyRead?: boolean, //图片是否只读 + showPic?: boolean, // 是否显示图片组件 + getImageList?: (any) => void //上传图片回调 + PicList?: [], //默认图片列表 + styleNone?: boolean, //根据不同的栏目调整样式 + getScan?: (any) => void, // 扫描 + navTo?: () => void, //跳转选择 + showSizeFont?: boolean, //展示金额的大写 + bigMoney?: any //展示的大写金额 +} + +export default memo((pros: Params) => { + + + return ( + + + + {pros.title} + { + pros.require && * + } + + { + pros.showSizeFont && 展示大小写 + } + + { + pros.showPic && + + + + } + { + !pros.showPic && pros.navTo?.()} + style={{ + justifyContent: `${!pros.showSizeFont ? 'space-between' : ''}`, alignItems: `${!pros.showSizeFont ? 'center' : ''}`, + display: `${!pros.showSizeFont ? 'flex' : ''}` + }} + > + + { + pros.isInput && pros.getInput?.(e.detail.value)} + > + } + + + + { + pros.showMore && + + + } + { + pros.showScan && + + } + { + pros.showScan && pros.getScan?.(e)}> + + } + { + pros.showSizeFont && {pros.bigMoney} + } + + } + + + ) +}) \ No newline at end of file diff --git a/src/pages/addCollection/index.config.ts b/src/pages/addCollection/index.config.ts new file mode 100644 index 0000000..5188b1d --- /dev/null +++ b/src/pages/addCollection/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '新建收款单', +} diff --git a/src/pages/addCollection/index.module.scss b/src/pages/addCollection/index.module.scss new file mode 100644 index 0000000..4ea8f68 --- /dev/null +++ b/src/pages/addCollection/index.module.scss @@ -0,0 +1,96 @@ +.addBox { + margin: 24px; + padding: 0px 32px 40px 32px; + background: #FFFFFF; + border-radius: 16px 16px 0px 0px; + transition: 0.3s; +} + +.textAreaBox { + margin-top: 40px; + display: flex; + justify-content: space-between; + position: relative; + + .textAreaLeft { + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .textAreaRight { + width: 70%; + } + + .numsTotal { + position: absolute; + bottom: 0; + right: 0; + display: flex; + font-size: 28px; + font-weight: 400; + color: #000000; + + } + + +} + +.bottomBox { + width: 750px; + height: 160px; + background: #FFFFFF; + position: fixed; + bottom: 0; + z-index: 99; + display: flex; + padding-top: 16px; + justify-content: space-between; + + .resetBox { + margin-left: 48px; + width: 311px; + height: 80px; + border-radius: 44px; + border: 1px solid #087EFF; + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #337FFF; + text-align: center; + line-height: 80px; + } + + .button { + margin-right: 32px; + width: 311px; + height: 80px; + background: #68b4ff; + border-radius: 44px; + font-size: 32px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #FFFFFF; + text-align: center; + line-height: 80px; + } + + .activeButton { + margin-right: 32px; + width: 311px; + height: 80px; + background: #337FFF; + border-radius: 44px; + font-size: 32px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #fff; + text-align: center; + line-height: 80px; + } +} + +.safeBox { + height: 160px; + width: 100%; +} \ No newline at end of file diff --git a/src/pages/addCollection/index.tsx b/src/pages/addCollection/index.tsx new file mode 100644 index 0000000..aba73af --- /dev/null +++ b/src/pages/addCollection/index.tsx @@ -0,0 +1,198 @@ +import { View, Input, Button, Textarea } from '@tarojs/components' +import { useCallback, useEffect, useMemo, useRef, useState, } from 'react' +import Search from '@/components/search' +import { dataLoadingStatus, getFilterData } from '@/common/util' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Popup from '@/components/popup' +import InfiniteScroll from '@/components/infiniteScroll' +import Taro, { faceVerifyForPay, useDidShow } from '@tarojs/taro' +import Form from './components/form' +import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' +import { + mpreturnApplyOrderlist +} from "@/api/newCollection" +import TimePicker from "@/components/timePicker" +import dayjs from 'dayjs' +import { alert } from "@/common/common" +import smallToBig from '@/common/money' + +export default () => { + + useDidShow(() => { + + //获取选择的客户 + let pages = Taro.getCurrentPages(); + let currPage = pages[pages.length - 1]; // 获取当前页面 + console.log(currPage.data, '8888') + + setQuery((e) => ({ + ...e, + purchaser_id: currPage.data?.clientId ? currPage.data?.clientId : '', + clientName: currPage.data?.clientName ? currPage.data?.clientName : '', + // sale_user_id: currPage.data?.saleuserId ? currPage.data?.saleuserId : '', + // saleuserName: currPage.data?.saleuserName ? currPage.data?.saleuserName : '', + })) + }) + + const [Query, setQuery] = useState({}) + + //获取图片列表 + const picUrl = useRef([]) + const getImageList = useCallback((list) => { + picUrl.current = list + console.log(picUrl.current, 'picUrl.current') + }, []) + + + //扫描 + const handScan = (e) => { + e.stopPropagation() + Taro.scanCode({ + success(res) { + // setsearchObj((e) => ({ ...e, orderNo: res.result })) + }, + fail(res) { + console.log(res); + }, + }); + } + + //选择内容跳转 + const navTo = (val) => { + if (val === 1) { + + } else { + if (Query.purchaser_id == '') { + return alert.error('请先选择客户') + } else { + Taro.navigateTo({ + url: '/pages/accountPage/id?' + Query.bankId + }) + } + } + } + + //判断是否可以提交 + const isDisabled = useMemo(() => { + if (Query.clientName == '' || + Query.money == '' || + Query.bankNum == '' || + picUrl.current.length == 0 + ) { + return true + } else { + return false + } + }, []) + + //收款金额回调 + const getInput = (e) => { + setQuery({ ...Query, money: e }) + } + + useEffect(() => { + setQuery(Query) + }, [Query]) + + + //备注信息 + const [TextareaValue, setTextareaValue] = useState('') + const getDesc = (e) => { + setQuery({ ...Query, nums: e.length }) + setTextareaValue(e) + } + + //取消返回 + const handCancl = () => { + Taro.navigateBack({ + delta: 1 + }) + } + + + return ( + <> + +
handScan(e)} + navTo={() => navTo(1)} + showSizeFont={false} + >
+
getInput(e)} + showSizeFont={true} + bigMoney={smallToBig(typeof (Query.money) == 'undefined' ? 0 : Query.money)} + >
+
getImageList(list)} + showSizeFont={false} + >
+
navTo(2)} + showSizeFont={false} + >
+ + 备注信息 + + + {`${typeof (Query.nums) == 'undefined' ? 0 : Query.nums}/64`} + + + + +
+ + + + + + + ) +} \ No newline at end of file diff --git a/src/pages/collectionDetail/components/form/index.module.scss b/src/pages/collectionDetail/components/form/index.module.scss new file mode 100644 index 0000000..8d81edb --- /dev/null +++ b/src/pages/collectionDetail/components/form/index.module.scss @@ -0,0 +1,97 @@ +.itemBox { + width: 100%; + border-bottom: 1px solid #f7f7f7; + display: flex; + // align-items: center; + padding-top: 40px; + padding-bottom: 40px; + + .itemLeft { + + // align-items: center; + .finkFlex { + display: flex; + + .itemTitle { + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .xing { + font-size: 28px; + font-weight: 500; + color: #E42945; + margin-right: 48px; + } + } + + .finkFont { + font-size: 20px; + font-weight: 400; + color: grey; + } + + + } + + .bigPic { + width: 70%; + } + + .itemRight { + // display: flex; + // align-items: center; + // justify-content: space-between; + width: 70%; + // position: relative; + + .assginFont { + // position: absolute; + // bottom: 10px; + // left: 0px; + font-size: 24px; + font-weight: 500; + color: #000000; + } + + .rightFlex { + .placeholderStyle { + color: #f7f7f7; + font-size: 28px; + font-weight: 400; + } + + .inputStyle { + font-size: 28px; + font-weight: 400; + color: #000000; + width: 100%; + } + } + + .iconFlex { + display: flex; + align-items: center; + + .chakanquanbukehu2 { + font-size: 50px !important; + } + + .shu { + width: 2px; + height: 36px; + background: #000000; + opacity: 0.2; + margin-left: 24px; + } + + .saomiao { + margin-left: 24px; + color: #087EFF; + font-size: 40px !important; + } + } + + } +} \ No newline at end of file diff --git a/src/pages/collectionDetail/components/form/index.tsx b/src/pages/collectionDetail/components/form/index.tsx new file mode 100644 index 0000000..f05b294 --- /dev/null +++ b/src/pages/collectionDetail/components/form/index.tsx @@ -0,0 +1,101 @@ +import { ScrollView, View, Text, Input } from '@tarojs/components' +import { memo, useCallback, useEffect, useMemo, useState } from 'react' +import styles from './index.module.scss' +import classnames from 'classnames' +// import BottomBtns from '@/components/BottomBtns' +import { formatPriceDiv, formatDateTime } from '@/common/format' +import Taro from '@tarojs/taro' +import IconFont from '@/components/iconfont/iconfont' +import UploadImage from '@/components/uploadImage' + +interface Params { + title?: string, //传入的名称 + require?: boolean, //是否显示必须选填的内容图标 + isInput?: boolean, //是否显示输入框 + inputValue?: string, //输入框的值 + inputType?: any, //输入框类型 + getInput?: (any) => void //输入框回调 + showScan?: boolean, //是否显示扫描图标 + placeholderFont?: string, //输入框默认文本 + showMore?: boolean, // 是否显示更多图标 + disabled?: boolean, // 是否输入框禁止 + onlyRead?: boolean, //图片是否只读 + showPic?: boolean, // 是否显示图片组件 + getImageList?: (any) => void //上传图片回调 + PicList?: any[], //默认图片列表 + styleNone?: boolean, //根据不同的栏目调整样式 + getScan?: (any) => void, // 扫描 + navTo?: () => void, //跳转选择 + showSizeFont?: boolean, //展示金额的大写 + bigMoney?: any //展示的大写金额 +} + +export default memo((pros: Params) => { + + + return ( + + + + {pros.title} + { + pros.require && * + } + + { + pros.showSizeFont && 展示大小写 + } + + { + pros.showPic && + + + + } + { + !pros.showPic && pros.navTo?.()} + style={{ + justifyContent: `${!pros.showSizeFont ? 'space-between' : ''}`, alignItems: `${!pros.showSizeFont ? 'center' : ''}`, + display: `${!pros.showSizeFont ? 'flex' : ''}` + }} + > + + { + pros.isInput && pros.getInput?.(e.detail.value)} + > + } + + + + { + pros.showMore && + + + } + { + pros.showScan && + + } + { + pros.showScan && pros.getScan?.(e)}> + + } + { + pros.showSizeFont && {pros.bigMoney} + } + + } + + + ) +}) \ No newline at end of file diff --git a/src/pages/collectionDetail/index.config.ts b/src/pages/collectionDetail/index.config.ts new file mode 100644 index 0000000..5188b1d --- /dev/null +++ b/src/pages/collectionDetail/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '新建收款单', +} diff --git a/src/pages/collectionDetail/index.module.scss b/src/pages/collectionDetail/index.module.scss new file mode 100644 index 0000000..ccbc580 --- /dev/null +++ b/src/pages/collectionDetail/index.module.scss @@ -0,0 +1,71 @@ +.addBox { + margin: 24px; + padding: 0px 32px 40px 32px; + background: #FFFFFF; + border-radius: 16px 16px 0px 0px; + transition: 0.3s; +} + +.textAreaBox { + margin-top: 40px; + display: flex; + justify-content: space-between; + position: relative; + border-bottom: 1px solid #f7f7f7; + + .textAreaLeft { + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .textAreaRight { + width: 70%; + } + + .numsTotal { + position: absolute; + bottom: 0; + right: 0; + display: flex; + font-size: 28px; + font-weight: 400; + color: #000000; + + } + + +} + +.msgBox { + width: 100%; + border-bottom: 1px solid #f7f7f7; + display: flex; + align-items: center; + padding-top: 40px; + padding-bottom: 40px; + justify-content: space-between; + + .msgLeft { + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .msgFlex { + width: 70%; + display: flex; + justify-content: space-between; + .msgName { + font-size: 28px; + font-weight: 400; + color: #000000; + } + + .msgTime { + font-size: 28px; + font-weight: 400; + color: #000000; + } + } +} \ No newline at end of file diff --git a/src/pages/collectionDetail/index.tsx b/src/pages/collectionDetail/index.tsx new file mode 100644 index 0000000..bfabcc7 --- /dev/null +++ b/src/pages/collectionDetail/index.tsx @@ -0,0 +1,144 @@ +import { View, Input, Button, Textarea } from '@tarojs/components' +import { useCallback, useEffect, useMemo, useRef, useState, } from 'react' +import Search from '@/components/search' +import { dataLoadingStatus, getFilterData } from '@/common/util' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Popup from '@/components/popup' +import InfiniteScroll from '@/components/infiniteScroll' +import Taro, { faceVerifyForPay, useDidShow, useRouter } from '@tarojs/taro' +import Form from './components/form' +import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' +import { + mpcashManagementOrder +} from "@/api/newCollection" +import TimePicker from "@/components/timePicker" +import dayjs from 'dayjs' +import { alert } from "@/common/common" +import smallToBig from '@/common/money' +import { IMG_CND_Prefix } from "@/common/constant"; + +export default () => { + + const router = useRouter() + const [Query, setQuery] = useState({}) + const { fetchData: getFetch } = mpcashManagementOrder() + useEffect(() => { + getDetail() + }, []) + const getDetail = async () => { + Taro.showLoading({ + title: '请稍等', + mask: true + }) + const res = await getFetch({ id: Number(router.params.id) }) + if (res.data) { + // res.data?.payment_credential_url?.map(it => { + // it = IMG_CND_Prefix + it + // return it + // }) + // console.log(res.data, 4444) + Taro.hideLoading() + setQuery(res.data) + } + + } + + + useEffect(() => { + setQuery(Query) + }, [Query]) + + const money = useMemo(() => { + let res = 0 + res = Query.receipt_amount / 100 + return res + }, [Query]) + + + return ( + <> + +
+
+
+
+ + 备注信息 + + + {/* {`${typeof (Query.nums) == 'undefined' ? 0 : Query.nums}/64`} */} + + + + 创建信息 + + {Query.creator_name} + {formatDateTime(Query.create_time)} + + + + 审核信息 + + {Query.auditor_name} + {formatDateTime(Query.audit_time)} + + +
+ + ) +} \ No newline at end of file diff --git a/src/pages/newCollection/components/itemList/index.module.scss b/src/pages/newCollection/components/itemList/index.module.scss new file mode 100644 index 0000000..6e04555 --- /dev/null +++ b/src/pages/newCollection/components/itemList/index.module.scss @@ -0,0 +1,77 @@ +.itemBox { + margin: 24px; + height: 383px; + background: #FFFFFF; + border-radius: 16px; + padding: 0px 32px 32px 32px; + position: relative; + + .itemTop { + width: 100%; + height: 82px; + border-bottom: 1px solid #f7f7f7; + display: flex; + align-items: center; + justify-content: space-between; + + .itemTopLeft { + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .itemTopRight { + font-size: 28px; + font-weight: 500; + color: #E42945; + } + } + + .flexBox { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 20px; + + .flexLeft1 { + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .flexRight1 { + font-size: 32px; + font-weight: 500; + color: #000000; + } + + .flexLeft { + font-size: 28px; + font-weight: 400; + color: #000000; + } + + .flexRight { + font-size: 28px; + font-weight: 400; + color: #000000; + } + } + + .btnAnd { + position: absolute; + width: 160px; + height: 72px; + border-radius: 40px; + opacity: 0.6; + border: 1px solid #000000; + font-size: 28px; + font-weight: 400; + color: #000000; + text-align: center; + line-height: 72px; + right: 32px; + bottom: 32px; + } +} \ No newline at end of file diff --git a/src/pages/newCollection/components/itemList/index.tsx b/src/pages/newCollection/components/itemList/index.tsx new file mode 100644 index 0000000..2cc7d09 --- /dev/null +++ b/src/pages/newCollection/components/itemList/index.tsx @@ -0,0 +1,54 @@ +import { ScrollView, View } from '@tarojs/components' +import { memo, useCallback, useEffect, useMemo, useState } from 'react' +import styles from './index.module.scss' +import classnames from 'classnames' +// import BottomBtns from '@/components/BottomBtns' +import { formatPriceDiv, formatDateTime } from '@/common/format' +import Taro from '@tarojs/taro' +import { navigateTo } from '@tarojs/router' + +interface Params { + obj: any +} + +export default memo((pros: Params) => { + + + const navTo = () => { + Taro.navigateTo({ + url: '/pages/collectionDetail/index?id=' + pros.obj.id + }) + } + + const styleColor = useMemo(() => { + if (pros.obj.auditor_status_name == '待审核') { + return '#E42945' + } else if (pros.obj.auditor_status_name == '已审核') { + return '#337FFF' + } else if (pros.obj.auditor_status_name == '已拒绝') { + return '#000000' + } + }, [pros.obj]) + + return ( + + + {pros.obj.purchaser_name} + {pros.obj.auditor_status_name} + + + 转账金额: + ¥{formatPriceDiv(pros.obj.receipt_amount)} + + + 待认款金额: + ¥{formatPriceDiv(pros.obj.pending_distribute_amount)} + + + 收款时间: + {formatDateTime(pros.obj.create_time)} + + navTo()}>查看详情 + + ) +}) \ No newline at end of file diff --git a/src/pages/newCollection/index.config.ts b/src/pages/newCollection/index.config.ts new file mode 100644 index 0000000..99f2585 --- /dev/null +++ b/src/pages/newCollection/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '收款列表', +} diff --git a/src/pages/newCollection/index.module.scss b/src/pages/newCollection/index.module.scss new file mode 100644 index 0000000..1037c18 --- /dev/null +++ b/src/pages/newCollection/index.module.scss @@ -0,0 +1,232 @@ +.flexBox { + display: flex; + width: 200px; + align-items: center; + justify-content: flex-end; +} + +.icon_shaixuan { + color: #0D7CFF; + font-size: 35px !important; + margin-right: 10px; +} + +.activeshaixuan { + color: #000; + font-size: 35px !important; + margin-right: 10px; +} + +.shaixuan { + margin-right: 32px; + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; +} + +.activeshai { + color: #0D7CFF; + margin-right: 32px; + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; +} + +.order_list { + height: calc(100vh - 300px); + background: #f7f7f7; + + .bigBpx { + height: 200px; + } + + .kongboxTwo { + height: 100px; + } +} + +.fixedBox { + width: 100%; + position: fixed; + bottom: 64px; + display: flex; + align-items: center; + justify-content: center; +} + +.addBtn { + width: 490px; + height: 80px; + background: #337FFF; + border-radius: 44px; + font-size: 28px; + font-weight: 500; + text-align: center; + line-height: 80px; + color: #FFFFFF; +} + +.pageTop { + width: 100%; + margin-top: 24px; + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 20px; + + .pageTopLeft { + font-size: 24px; + font-weight: 400; + color: #000000; + margin-left: 24px; + } + + .pageTopRight { + font-size: 24px; + font-weight: 400; + color: #000000; + margin-right: 24px; + } +} + +.popupBox { + + // padding: 48px; + .timeFlex { + display: flex; + padding-left: 48px; + + .timeOne { + width: 319px; + height: 68px; + background: #E9E9E9; + border-radius: 8px; + opacity: 0.4; + font-size: 28px; + font-weight: 400; + color: #000000; + text-align: center; + line-height: 68px; + border: 1px solid #f7f7f7; + box-sizing: border-box; + margin-right: 16px; + } + + .activetimeOne { + width: 319px; + height: 68px; + background: rgba(51, 127, 255, 0.1); + border-radius: 8px; + border: 1px solid #337FFF; + font-size: 28px; + font-weight: 500; + color: #337FFF; + margin-right: 16px; + text-align: center; + line-height: 68px; + } + } + + + + .timeBox2 { + margin-top: 16px; + margin-right: 48px; + margin-left: 48px; + height: 68px; + background: #E9E9E9; + border-radius: 8px; + text-align: center; + line-height: 68px; + position: relative; + font-size: 28px; + font-weight: 400; + color: #000000; + margin-bottom: 72px; + + .more { + position: absolute; + right: 30px; + top: 5px; + font-size: 40px; + } + } + + .activetimeBox2 { + margin-top: 16px; + margin-right: 48px; + margin-left: 48px; + background: rgba(51, 127, 255, 0.1); + height: 68px; + border-radius: 8px; + text-align: center; + line-height: 68px; + position: relative; + font-size: 28px; + font-weight: 400; + color: #337FFF; + margin-bottom: 72px; + border: 1px solid #337FFF; + + .more { + position: absolute; + right: 30px; + top: 5px; + font-size: 40px; + } + } + + .bottomBox { + height: 160px; + background: #FFFFFF; + position: fixed; + bottom: 0; + z-index: 99; + display: flex; + padding-top: 16px; + justify-content: space-between; + width: 100vw; + + .resetBox { + width: 311px; + height: 80px; + border-radius: 44px; + border: 1px solid #087EFF; + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #337FFF; + text-align: center; + line-height: 80px; + } + + .button { + width: 311px; + height: 80px; + background: #68b4ff; + border-radius: 44px; + font-size: 32px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #FFFFFF; + text-align: center; + line-height: 80px; + margin-right: 48px; + } + + .activeButton { + margin-right: 48px; + width: 311px; + height: 80px; + background: #337FFF; + border-radius: 44px; + font-size: 32px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #fff; + text-align: center; + line-height: 80px; + } + } +} \ No newline at end of file diff --git a/src/pages/newCollection/index.tsx b/src/pages/newCollection/index.tsx new file mode 100644 index 0000000..3849b94 --- /dev/null +++ b/src/pages/newCollection/index.tsx @@ -0,0 +1,292 @@ +import { View, Input, Button } from '@tarojs/components' +import { useCallback, useEffect, useMemo, useRef, useState, } from 'react' +import Search from '@/components/search' +import { dataLoadingStatus, getFilterData } from '@/common/util' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Popup from '@/components/popup' +import InfiniteScroll from '@/components/infiniteScroll' +import Taro, { faceVerifyForPay, useDidShow } from '@tarojs/taro' +import ItemList from './components/itemList' +import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' +import { + mpcashManagementOrderlist +} from "@/api/newCollection" +import TimePicker from "@/components/timePicker" +import dayjs from 'dayjs' + +export default () => { + let myDate = new Date(); + const [searchField, setSearchField] = useState< + { + page: number; + size: number; + search_name: string; + start_time: number | string; + end_time: number | string; + }>({ + page: 1, + size: 10, + search_name: '', + start_time: `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).format('YYYY-MM-DD')} 00:00:00`, + end_time: `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).add(14, 'day').format('YYYY-MM-DD')} 00:00:00`, + }) + const pageNum = useRef({ size: searchField.size, page: searchField.page }) + + //监听筛选条件变化 + useEffect(() => { + getOrderList() + }, [searchField.size, searchField.search_name]) + //输入了搜索关键字 + const getSearchData = useCallback((e) => { + pageNum.current.page = 1 + setOrderData(() => ({ list: [], total: 0 })) + setSearchField((val) => ({ ...val, search_name: e, size: 10 })) + }, []) + + + //获取订单列表 + const { fetchData: listFetchData, state: orderState } = mpcashManagementOrderlist() + const [orderData, setOrderData] = useState<{ list: any[]; total: number, summary?: any }>({ list: [], total: 0, summary: {} }) + const getOrderList = async () => { + let res = await listFetchData({ + ...searchField + }) + setOrderData((e) => ({ ...e, list: res.data?.list, total: res.data?.total, summary: res.data?.summary })) + // setshowPopup(false) + setRefresherTriggeredStatus(false) + } + + //列表下拉刷新 + const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) + const getRefresherRefresh = async () => { + pageNum.current.page = 1 + // pageNum.current.size = 10 + setRefresherTriggeredStatus(true) + getOrderList() + setSearchField((val) => ({ ...val, size: 10 })) + } + //数据加载状态 + const statusMore = useMemo(() => { + return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading }) + }, [orderData, orderState]) + + //上拉加载数据 + const getScrolltolower = useCallback(() => { + if (orderData.list.length < orderData.total) { + pageNum.current.page++ + const size = pageNum.current.size * pageNum.current.page + console.log(pageNum.current.page, 'pageNum.current.page') + console.log(size, 123123) + setSearchField({ ...searchField, size }) + } + }, [orderData]) + + //是否不允许确认筛选 + const isDisabled = useMemo(() => { + // if (searchField.stage !== '不限' || + // searchField.sale_mode !== '不限' || + // searchField.return_type !== '不限' || + // searchField.start_time !== '' || + // searchField.end_time !== '' + // ) { + // return false + // } else { + // return true + // } + return false + }, []) + + //新建收款 + const handAdd = () => { + Taro.navigateTo({ + url: '/pages/addCollection/index' + }) + } + + //筛选弹出 + + const [SelectPopup, setSelectPopup] = useState(false) + + //时间数组 + const [TimeList, setTimeList] = useState( + [ + { + id: 1, + name: '默认14天内', + start_time: `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).format('YYYY-MM-DD')} 00:00:00`, + end_time: `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).add(14, 'day').format('YYYY-MM-DD')} 00:00:00`, + checked: true + }, + { + id: 2, + name: '展示全部日期', + start_time: '', + end_time: '', + checked: false + } + ] + ) + + //选择时间item + const handSelect = (it) => { + TimeList.map(item => { + if (item.id == it.id) { + item.checked = true + } else { + item.checked = false + } + return item + }) + setTimeList([...TimeList]) + pageNum.current.size = 10 + setSearchField({ ...searchField, start_time: it.start_time, end_time: it.end_time, size: 10 }) + setEnd(it.end_time) + } + + //重置 + const handReset = () => { + TimeList.map(item => { + if (item.id == 1) { + item.checked = true + } else { + item.checked = false + } + return item + }) + setTimeList([...TimeList]) + pageNum.current.size = 10 + setSearchField({ + ...searchField, + start_time: `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).format('YYYY-MM-DD')} 00:00:00`, + end_time: `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).add(14, 'day').format('YYYY-MM-DD')} 00:00:00`, + size: 10 + }) + setStart(myDate.toLocaleDateString()) + setEnd('') + } + + + + //弹窗确认选择 + const handSureSelect = () => { + pageNum.current.size = 10 + setSearchField({ ...searchField, size: 10 }) + getOrderList() + setSelectPopup(false) + } + + //展示时间筛选 + const [showTime, setShowTime] = useState(false) + //关闭时间筛选 + const handClose = () => { + setShowTime(false) + } + + const [start, setStart] = useState(myDate.toLocaleDateString()) + const [end, setEnd] = useState('') + //选择时间 + const handTime = (eq) => { + //直接进来点确定的时候做处理 + if (Object.keys(eq).length === 0) { + let obj = { + start: '', + end: '' + } + obj.start = `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).format('YYYY-MM-DD')} 00:00:00`, + obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00` + eq.value = obj + } + setSearchField((val) => ({ ...val, start_time: eq?.value?.start, end_time: eq?.value?.end })) + setStart(eq?.value?.start) + setEnd(eq?.value?.end) + setShowTime(false) + pageNum.current.size = 10 + } + + + const timeArea = useMemo(() => { + const res = TimeList.filter(item => { + return item.checked + }) + if (end !== '' && res.length > 0) { + return start + ' ' + '-' + ' ' + end + } else { + return '自定义起始时间' + } + }, [end]) + + useEffect(() => { + setSearchField(searchField) + }, [searchField]) + + return ( + <> + + + { setSelectPopup(true) }}> + + 筛选 + + + + + 时间默认14天内 + 金额汇总:{formatPriceDiv(orderData.summary.receipt_amount)} + + + + {orderData?.list?.map((item, index) => { + return ( + + + + ) + })} + + + + handAdd()}>新建收款 + + + { setSelectPopup(false) }}> + + + { + TimeList.map((item, index) => { + return ( + handSelect(item)} className={classnames((item.checked && timeArea == '自定义起始时间') ? styles.activetimeOne : styles.timeOne)} key={index}>{item.name} + ) + }) + } + + { setShowTime(true) }}>{timeArea} + { + timeArea == '自定义起始时间' && + } + + + + + + + + + handTime(e)} + > + + ) +} \ No newline at end of file diff --git a/src/pages/refundPage/index.tsx b/src/pages/refundPage/index.tsx index fe2a644..04afb07 100644 --- a/src/pages/refundPage/index.tsx +++ b/src/pages/refundPage/index.tsx @@ -363,7 +363,7 @@ export default () => { 售后时间 { setShowTime(true) }}>{timeArea} { - timeArea != '自定义起始时间' && + timeArea == '自定义起始时间' && }