✨ feat:新建收款完成100%
This commit is contained in:
@@ -37,7 +37,6 @@ page {
|
||||
|
||||
.cussName {
|
||||
margin-left: 48px;
|
||||
width: 168px;
|
||||
height: 34px;
|
||||
font-size: 28px;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
|
||||
@@ -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 (
|
||||
<View className={styles.cussBox}>
|
||||
<View className={styles.searchBox}>
|
||||
{/* <View className={styles.searchBox}>
|
||||
<View className={styles.two}>
|
||||
<Search placeholder='请输入业务员名称' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
|
||||
<Search placeholder='请输入收款账户' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View> */}
|
||||
<View className={styles.listBox}>
|
||||
<InfiniteScroll
|
||||
statusMore={statusMore}
|
||||
@@ -135,9 +136,9 @@ export default () => {
|
||||
clentList.list.map((item, index) => {
|
||||
return (
|
||||
<View className={classnames(item.checked ? styles.acticveitemBox : styles.itemBox)} key={index} onClick={() => { selectClient(item) }}>
|
||||
<View className={styles.cussName}>{item.name}</View>
|
||||
<View className={styles.phone}>{item.phone}</View>
|
||||
<View className={styles.woker}>{item.sale_user_name}</View>
|
||||
<View className={styles.cussName}>{item.company_account}</View>
|
||||
{/* <View className={styles.phone}>{item.phone}</View>
|
||||
<View className={styles.woker}>{item.company_account}</View> */}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
}
|
||||
|
||||
.rightFlex {
|
||||
width: 50%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
.placeholderStyle {
|
||||
color: #f7f7f7;
|
||||
font-size: 28px;
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<View className={styles.addBox}>
|
||||
@@ -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={'请填写备注信息'}
|
||||
></Textarea>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default {
|
||||
navigationBarTitleText: '新建收款单',
|
||||
navigationBarTitleText: '收款单详情',
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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 (
|
||||
<View className={styles.cussBox}>
|
||||
|
||||
@@ -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 '自定义起始时间'
|
||||
|
||||
@@ -52,7 +52,7 @@ const feature: IconCardType[] = [
|
||||
{
|
||||
iconName: 'icon-shoukuanliebiao',
|
||||
name: '收款列表',
|
||||
path: '',
|
||||
path: '/pages/newCollection/index',
|
||||
},
|
||||
{
|
||||
iconName: 'icon-kehuxinxi',
|
||||
|
||||
Reference in New Issue
Block a user