✨ feat:新建收款完成100%
This commit is contained in:
parent
5c2e3d46ac
commit
ccc3530aff
@ -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",
|
||||
})
|
||||
}
|
@ -36,7 +36,7 @@ export const mpproductcolorlist = () => {
|
||||
method: "get"
|
||||
})
|
||||
}
|
||||
//加入购物车
|
||||
//购物车提交
|
||||
export const mpsaleOrderpreView = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mp/saleOrder/preView`,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<ImageParam> = memo(({ onChange, defaultList, onlyRead = false }) => {
|
||||
const { getWxPhoto } = useUploadCDNImg()
|
||||
const { getWxPhoto, getChatPhoto } = useUploadCDNImg()
|
||||
const [imageList, setImageLise] = useState<string[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
@ -22,13 +23,27 @@ const PictureItem: FC<ImageParam> = 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<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
|
||||
})
|
||||
}
|
||||
|
||||
//筛选内容展示
|
||||
const [showPopup, setshowPopup] = useState(false)
|
||||
const [List, setList] = useState<any[]>([{ 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 (
|
||||
<View className={styles.image_main}>
|
||||
{imageList?.map((item, index) => (
|
||||
@ -64,6 +96,16 @@ const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
|
||||
{/* <Text className={styles.uploadText}>上传照片</Text> */}
|
||||
</View>
|
||||
)}
|
||||
<Popup title={'选择方式'} show={showPopup} onClose={() => setshowPopup(false)}>
|
||||
{
|
||||
List.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.itemBox} key={index} onClick={() => handItem(item)}>{item.name}</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user