diff --git a/src/api/newCollection.ts b/src/api/newCollection.ts index a249e42..182a2e9 100644 --- a/src/api/newCollection.ts +++ b/src/api/newCollection.ts @@ -14,4 +14,17 @@ export const mpcashManagementOrder = () => { method: "get", }) } - +//收款账号 +export const mpcashManagementOrderaccount = () => { + return useRequest({ + url: `/v1/mp/cashManagementOrder/account`, + method: "get", + }) +} +//新建收款单 +export const mpcashManagementOrderpost = () => { + return useRequest({ + url: `/v1/mp/cashManagementOrder`, + method: "post", + }) +} \ No newline at end of file diff --git a/src/api/order.ts b/src/api/order.ts index b0ef2bd..08a5071 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -36,7 +36,7 @@ export const mpproductcolorlist = () => { method: "get" }) } -//加入购物车 +//购物车提交 export const mpsaleOrderpreView = () => { return useRequest({ url: `/v1/mp/saleOrder/preView`, diff --git a/src/components/uploadImage/index.module.scss b/src/components/uploadImage/index.module.scss index 9718ef4..ce972de 100644 --- a/src/components/uploadImage/index.module.scss +++ b/src/components/uploadImage/index.module.scss @@ -64,4 +64,18 @@ font-size: 30px; } } + + .itemBox { + width: 100%; + height: 88px; + display: flex; + align-items: center; + text-align: center; + justify-content: center; + line-height: 88px; + font-size: 28px; + font-weight: 500; + color: #000000; + border-bottom: 1px solid #f7f7f7; + } } \ No newline at end of file diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx index a26ab86..93a719f 100644 --- a/src/components/uploadImage/index.tsx +++ b/src/components/uploadImage/index.tsx @@ -5,6 +5,7 @@ import { Image, Text, View } from '@tarojs/components' import { formatImgUrl } from '@/common/format' import classnames from 'classnames' import styles from './index.module.scss' +import Popup from '@/components/popup' //图片列表 type ImageParam = { @@ -13,7 +14,7 @@ type ImageParam = { onlyRead?: false | true } const PictureItem: FC = memo(({ onChange, defaultList, onlyRead = false }) => { - const { getWxPhoto } = useUploadCDNImg() + const { getWxPhoto, getChatPhoto } = useUploadCDNImg() const [imageList, setImageLise] = useState([]) useEffect(() => { @@ -22,13 +23,27 @@ const PictureItem: FC = memo(({ onChange, defaultList, onlyRead = fa //上传图片 const uploadImage = async () => { - let list: any = await getWxPhoto('after-sale', 5) + setshowPopup(true) + } + + //上传图片逻辑 + const handPic = async (id) => { + // let resArr = List.filter(item => { + // return item.check + // }) + if (id == 1) { + var list: any = await getWxPhoto('after-sale', 5) + } else { + var list: any = await getChatPhoto('after-sale', 5) + } let images: any[] = [] list?.map((item) => { images.push(item.url) }) setImageLise([...imageList, ...images]) + setshowPopup(false) } + //删除图片 const delImage = (index) => { imageList.splice(index, 1) @@ -50,6 +65,23 @@ const PictureItem: FC = memo(({ onChange, defaultList, onlyRead = fa }) } + //筛选内容展示 + const [showPopup, setshowPopup] = useState(false) + const [List, setList] = useState([{ id: 1, name: '手机相册', check: false }, { id: 2, name: '从微信对话选择', check: false }]) + //点击选择的方式 + const handItem = (item) => { + List.map(it => { + if (item.id == it.id) { + it.check = true + } else { + it.check = false + } + return it + }) + setList([...List]) + handPic(item.id) + } + return ( {imageList?.map((item, index) => ( @@ -64,6 +96,16 @@ const PictureItem: FC = memo(({ onChange, defaultList, onlyRead = fa {/* 上传照片 */} )} + setshowPopup(false)}> + { + List.map((item, index) => { + return ( + handItem(item)}>{item.name} + ) + }) + } + + ) }) diff --git a/src/pages/accountPage/index.module.scss b/src/pages/accountPage/index.module.scss index 4de4ecc..231fc43 100644 --- a/src/pages/accountPage/index.module.scss +++ b/src/pages/accountPage/index.module.scss @@ -37,7 +37,6 @@ page { .cussName { margin-left: 48px; - width: 168px; height: 34px; font-size: 28px; font-family: PingFangSC-Medium, PingFang SC; diff --git a/src/pages/accountPage/index.tsx b/src/pages/accountPage/index.tsx index 19fcea6..3404172 100644 --- a/src/pages/accountPage/index.tsx +++ b/src/pages/accountPage/index.tsx @@ -3,7 +3,7 @@ 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 { mpcashManagementOrderaccount } from '@/api/newCollection' import { useDidShow } from '@tarojs/taro'; import Taro from '@tarojs/taro' import { useRouter } from '@tarojs/taro' @@ -15,13 +15,13 @@ export default () => { const [search, setSearch] = useState({ - name: null, + search_name: null, page: 1, size: 10, }) const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) - const { fetchData: clitentFetch, state: orderState } = mpenumsaleUserlist() + const { fetchData: clitentFetch, state: orderState } = mpcashManagementOrderaccount() //数据加载状态 const statusMore = useMemo(() => { return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading }) @@ -36,17 +36,17 @@ export default () => { const getSearchData = useCallback((eq) => { pageNum.current.page = 1 setClientlist(() => ({ list: [], total: 0 })) - setSearch((e) => ({ ...e, name: eq, size: 10 })) + setSearch((e) => ({ ...e, search_name: eq, size: 10 })) }, []) const router = useRouter() useEffect(() => { - if (search.name === '') { - setSearch((e) => ({ ...e, name: null })) + if (search.search_name === '') { + setSearch((e) => ({ ...e, search_name: null })) } - if (search.name !== '') getCuss() + if (search.search_name !== '') getCuss() }, [search]) //上拉加载数据 @@ -68,10 +68,10 @@ export default () => { setSearch((val) => ({ ...val, size: 10 })) } const getCuss = async () => { - let res = await clitentFetch({ name: search.name === null ? '' : search.name, page: search.page, size: search.size }) + let res = await clitentFetch({ search_name: search.search_name === null ? '' : search.search_name, page: search.page, size: search.size }) if (router?.params.bankId) { res.data.list.map(item => { - if (item.id == router?.params.bankId) { + if (item.receiving_account_id == router?.params.bankId) { item.checked = true } else { item.checked = false @@ -85,7 +85,7 @@ export default () => { //选择业务员 const selectClient = (item) => { clentList.list.map(it => { - if (item.id === it.id) { + if (item.receiving_account_id === it.receiving_account_id) { it.checked = true } else { it.checked = false @@ -95,8 +95,8 @@ export default () => { let pages = Taro.getCurrentPages(); // 获取当前的页面栈 let prevPage = pages[pages.length - 2]; prevPage.setData({ //设置上一个页面的值 - bankId: item.id, - bankName: item.name + bankId: item.receiving_account_id, + bankName: item.company_account }); setClientlist((e) => ({ ...e, list: clentList?.list, total: clentList?.total })) setclientObj(item) @@ -107,23 +107,24 @@ export default () => { useEffect(() => { if (clientObj?.bankId !== null) { setclientObj(clientObj) - } else { - let pages = Taro.getCurrentPages(); // 获取当前的页面栈 - let prevPage = pages[pages.length - 2]; - prevPage.setData({ //设置上一个页面的值 - bankId: '', - bankName: '', - }); } + // 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} + {item.company_account} + {/* {item.phone} + {item.company_account} */} ) }) diff --git a/src/pages/addCollection/components/form/index.module.scss b/src/pages/addCollection/components/form/index.module.scss index 8d81edb..f35606f 100644 --- a/src/pages/addCollection/components/form/index.module.scss +++ b/src/pages/addCollection/components/form/index.module.scss @@ -56,6 +56,10 @@ } .rightFlex { + width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; .placeholderStyle { color: #f7f7f7; font-size: 28px; diff --git a/src/pages/addCollection/index.tsx b/src/pages/addCollection/index.tsx index aba73af..ea20ef5 100644 --- a/src/pages/addCollection/index.tsx +++ b/src/pages/addCollection/index.tsx @@ -10,7 +10,7 @@ import Taro, { faceVerifyForPay, useDidShow } from '@tarojs/taro' import Form from './components/form' import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' import { - mpreturnApplyOrderlist + mpcashManagementOrderpost } from "@/api/newCollection" import TimePicker from "@/components/timePicker" import dayjs from 'dayjs' @@ -18,20 +18,18 @@ import { alert } from "@/common/common" import smallToBig from '@/common/money' export default () => { - + //获取选择的客户 + let pages = Taro.getCurrentPages(); + let currPage = pages[pages.length - 1]; // 获取当前页面 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 : '', + bankId: currPage.data?.bankId ? currPage.data?.bankId : '', + bankName: currPage.data?.bankName ? currPage.data?.bankName : '', })) }) @@ -50,6 +48,7 @@ export default () => { e.stopPropagation() Taro.scanCode({ success(res) { + // setQuery({...Query}) // setsearchObj((e) => ({ ...e, orderNo: res.result })) }, fail(res) { @@ -60,14 +59,16 @@ export default () => { //选择内容跳转 const navTo = (val) => { - if (val === 1) { - + if (val == 1) { + Taro.navigateTo({ + url: '/pages/customerPage/index?clientId=' + Query.purchaser_id + }) } else { - if (Query.purchaser_id == '') { + if (typeof (Query.purchaser_id) == 'undefined') { return alert.error('请先选择客户') } else { Taro.navigateTo({ - url: '/pages/accountPage/id?' + Query.bankId + url: '/pages/accountPage/index?bankId?=' + Query?.bankId }) } } @@ -77,14 +78,13 @@ export default () => { const isDisabled = useMemo(() => { if (Query.clientName == '' || Query.money == '' || - Query.bankNum == '' || picUrl.current.length == 0 ) { return true } else { return false } - }, []) + }, [Query, picUrl]) //收款金额回调 const getInput = (e) => { @@ -95,6 +95,12 @@ export default () => { setQuery(Query) }, [Query]) + useEffect(() => { + if (currPage.data?.clientId && (currPage.data?.clientId != Query.purchaser_id)) { + setQuery({ ...Query, bankId: '', bankName: '' }) + } + }, [Query]) + //备注信息 const [TextareaValue, setTextareaValue] = useState('') @@ -110,7 +116,46 @@ export default () => { }) } + //确认新建 + const { fetchData: sureFetch } = mpcashManagementOrderpost() + const handSure = () => { + const query = { + payment_credential_url: picUrl.current, + purchaser_id: Query.purchaser_id, + receipt_amount: Number(Query.money) * 100, + receiving_account_id: Query.bankId, + remark: TextareaValue + } + Taro.showModal({ + content: "确认提交吗?", + confirmText: "确认", + cancelText: "取消", + success: async function (res) { + if (res.confirm) { + Taro.showLoading({ + title: '请稍等...', + mask: true + }) + const res = await sureFetch(query) + if (res?.msg === 'success') { + Taro.showToast({ + title: '成功' + }) + Taro.hideLoading() + handCancl() + } else { + Taro.hideLoading() + Taro.showToast({ + title: res?.msg, + icon: 'error' + }) + } + } + + } + }) + } return ( <> @@ -162,7 +207,7 @@ export default () => { isInput={true} disabled={true} placeholderFont={'请选择银行账号'} - inputValue={Query.bankNum} + inputValue={Query.bankName} showMore={true} showScan={false} styleNone={true} @@ -178,7 +223,6 @@ export default () => { onInput={(e) => getDesc(e.detail.value)} value={TextareaValue} placeholderStyle='font-size: 28rpx;font-weight: 400;' - autoFocus maxlength={64} placeholder={'请填写备注信息'} > diff --git a/src/pages/collectionDetail/index.config.ts b/src/pages/collectionDetail/index.config.ts index 5188b1d..1c66055 100644 --- a/src/pages/collectionDetail/index.config.ts +++ b/src/pages/collectionDetail/index.config.ts @@ -1,3 +1,3 @@ export default { - navigationBarTitleText: '新建收款单', + navigationBarTitleText: '收款单详情', } diff --git a/src/pages/collectionDetail/index.tsx b/src/pages/collectionDetail/index.tsx index bfabcc7..f7a93b0 100644 --- a/src/pages/collectionDetail/index.tsx +++ b/src/pages/collectionDetail/index.tsx @@ -37,7 +37,6 @@ export default () => { // it = IMG_CND_Prefix + it // return it // }) - // console.log(res.data, 4444) Taro.hideLoading() setQuery(res.data) } @@ -89,7 +88,7 @@ export default () => { styleNone={false} title={'收款凭证'} require={false} - PicList={Query.payment_credential_url} + PicList={Query?.payment_credential_url} isInput={false} showMore={false} showScan={false} diff --git a/src/pages/customerPage/index.tsx b/src/pages/customerPage/index.tsx index cb9ca2b..ee8379f 100644 --- a/src/pages/customerPage/index.tsx +++ b/src/pages/customerPage/index.tsx @@ -110,14 +110,15 @@ export default () => { useEffect(() => { if (clientObj?.clientId !== null) { setclientObj(clientObj) - } else { - let pages = Taro.getCurrentPages(); // 获取当前的页面栈 - let prevPage = pages[pages.length - 2]; - prevPage.setData({ //设置上一个页面的值 - clientId: '', - clientName: '', - }); } + // else { + // let pages = Taro.getCurrentPages(); // 获取当前的页面栈 + // let prevPage = pages[pages.length - 2]; + // prevPage.setData({ //设置上一个页面的值 + // clientId: '', + // clientName: '', + // }); + // } }, [clientObj]) return ( diff --git a/src/pages/newCollection/index.tsx b/src/pages/newCollection/index.tsx index 3849b94..368cb65 100644 --- a/src/pages/newCollection/index.tsx +++ b/src/pages/newCollection/index.tsx @@ -33,6 +33,10 @@ export default () => { }) const pageNum = useRef({ size: searchField.size, page: searchField.page }) + useDidShow(() => { + getOrderList() + }) + //监听筛选条件变化 useEffect(() => { getOrderList() @@ -130,6 +134,7 @@ export default () => { //选择时间item const handSelect = (it) => { + TimeList.map(item => { if (item.id == it.id) { item.checked = true @@ -141,7 +146,7 @@ export default () => { setTimeList([...TimeList]) pageNum.current.size = 10 setSearchField({ ...searchField, start_time: it.start_time, end_time: it.end_time, size: 10 }) - setEnd(it.end_time) + setEnd('') } //重置 @@ -206,10 +211,11 @@ export default () => { const timeArea = useMemo(() => { - const res = TimeList.filter(item => { - return item.checked - }) - if (end !== '' && res.length > 0) { + // const res = TimeList.filter(item => { + // return item.checked + // }) + // && res.length > 0 + if (end !== '') { return start + ' ' + '-' + ' ' + end } else { return '自定义起始时间' diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index f64fedf..a2194b8 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -52,7 +52,7 @@ const feature: IconCardType[] = [ { iconName: 'icon-shoukuanliebiao', name: '收款列表', - path: '', + path: '/pages/newCollection/index', }, { iconName: 'icon-kehuxinxi', diff --git a/src/use/useUploadImage.ts b/src/use/useUploadImage.ts index 07599ce..9f0f184 100644 --- a/src/use/useUploadImage.ts +++ b/src/use/useUploadImage.ts @@ -148,8 +148,46 @@ export default () => { }) } + // product 产品相关,图片、纹理图等 全平台 + // after-sale 售后(申请退货、退款)相关的、图片、视频 全平台 + // mall 电子商城相关的 全平台 + // logistics 物流(发货、提货)相关的、图片、视频 全平台 + /** + * 上传聊天记录图片 + * @param cdn_upload_type 场景值 + * @param count // 1时返回一张图片信息, 大于1时返回图片数组 + * @returns + */ + const getChatPhoto = (cdn_upload_type: cdn_upload_type_Param, count: number = 1) => { + return new Promise((resolve, reject) => { + let list: any[] = [] + Taro.chooseMessageFile({ + count: count, + type: 'image', + success: async function (res) { + try { + if (count > 1) { + for (let i = 0; i < res.tempFiles.length; i++) { + let data = await uploadCDNImg(res.tempFiles[i], cdn_upload_type, cdn_upload_type) + list.push(data) + } + resolve(list) + } else { + //兼容以前上传一张的情况 + let data = await uploadCDNImg(res.tempFiles[0], cdn_upload_type, cdn_upload_type) + resolve(data) + } + } catch (res) { + reject(res) + } + }, + }) + }) + } + return { uploadCDNImg, getWxPhoto, + getChatPhoto } }