完成发票管理功能
parent
ab8ccc7741
commit
37a7089aa9
|
|
@ -44,6 +44,9 @@ export function imgUpload (params = {}) {
|
|||
export function involiceList (params = {}) {
|
||||
return req.get(`/orders/invoice`, params)
|
||||
}
|
||||
export function involiceResend (params = {}) {
|
||||
return req.post(`/orders/invoice/resend`, params)
|
||||
}
|
||||
|
||||
export function zitiCode (params = {}) {
|
||||
return req.get(`/ziticode`, params)
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ export default class SearchBar extends Component {
|
|||
|
||||
handleBlurSearch = () => {
|
||||
this.props.onBlur?.()
|
||||
this.setState({
|
||||
showSearchDailog: false,
|
||||
isShowAction: false
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function SpGoodsPrice (props) {
|
|||
</View>
|
||||
}
|
||||
{
|
||||
!isPoint && <SpPrice size={36} className='sale-price' value={price} />
|
||||
!isPoint && <SpPrice size={36} className='sale-price' value={price} showSeparator noDecimal={false} />
|
||||
}
|
||||
{/* {marketPrice > 0 && enMarketPrice && (
|
||||
<SpPrice className='mkt-price' lineThrough value={marketPrice} />
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ export const GOODS_INFO = {
|
|||
itemBn: 'item_bn',
|
||||
itemName: 'itemName',
|
||||
itemName2: 'item_name_2',
|
||||
pdp: 'pdp',
|
||||
brief: 'brief',
|
||||
img: 'pics[0]',
|
||||
imgs: 'pics',
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ export const TRADE_AFTER_SALES_ITEM = {
|
|||
afterSalesMobile: ({ aftersales_address }) => aftersales_address.aftersales_mobile,
|
||||
afterSalesAddress: ({ aftersales_address }) => aftersales_address.aftersales_address,
|
||||
afterSalesContact: ({ aftersales_address }) => aftersales_address.aftersales_contact,
|
||||
afterSalesZip: ({ aftersales_address }) => aftersales_address.post_code,
|
||||
aftersalesHours: ({ aftersales_address }) => aftersales_address.aftersales_hours,
|
||||
refundFee: ({ refund_fee }) => refund_fee / 100,
|
||||
sendbackData: 'sendback_data',
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ export default (props = {}) => {
|
|||
// const { params, orderInfo } = state
|
||||
const cashierResultUrl = `/pages/cart/cashier-result`
|
||||
const $instance = getCurrentInstance()
|
||||
console.log("🚀 ~ $instance.router:", $instance.router)
|
||||
// console.log("🚀 ~ $instance.router:", $instance.router)
|
||||
const currentPath = $instance.router?.path
|
||||
|
||||
const cashierPayment = (params, orderInfo) => {
|
||||
console.log(`cashierPayment:`, params, orderInfo)
|
||||
// console.log(`cashierPayment:`, params, orderInfo)
|
||||
const { pay_type, pay_channel } = params
|
||||
switch (pay_type) {
|
||||
case 'wxpay':
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ function CartCheckout (props) {
|
|||
scene, // 情景值
|
||||
goodType = routerParams.goodType
|
||||
} = $instance?.router?.params || {}
|
||||
console.log('$instance.router?.params:', $instance.router)
|
||||
// console.log('$instance.router?.params:', $instance.router)
|
||||
useEffect(() => {
|
||||
if (isLogin) {
|
||||
getTradeSetting()
|
||||
|
|
@ -148,7 +148,7 @@ function CartCheckout (props) {
|
|||
}, [isNewUser])
|
||||
|
||||
useEffect(() => {
|
||||
console.log(`useEffect: payType: ${payType}, address: ${address}, zitiAddress: ${zitiAddress}, receiptType: ${receiptType}`)
|
||||
// console.log(`useEffect: payType: ${payType}, address: ${address}, zitiAddress: ${zitiAddress}, receiptType: ${receiptType}`)
|
||||
if (receiptType && payType) {
|
||||
calcOrder()
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ function CartCheckout (props) {
|
|||
params['building_number'] = buildingNumber
|
||||
params['house_number'] = houseNumber
|
||||
}
|
||||
console.log('trade params:', params)
|
||||
// console.log('trade params:', params)
|
||||
if (params.pay_type === 'deposit') {
|
||||
// 验证余额额度是否可用
|
||||
if (userInfo.deposit < totalInfo.total_fee / 100) {
|
||||
|
|
@ -365,6 +365,24 @@ function CartCheckout (props) {
|
|||
|
||||
// 开发票
|
||||
const handleInvoiceClick = () => {
|
||||
Taro.navigateTo({
|
||||
url: `/subpage/pages/trade/invoice-info?id=${totalInfo.tid || ''}`,
|
||||
events: {
|
||||
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
|
||||
acceptDataFromOpenedPage: function ({ data = {} }) {
|
||||
const { invoiceTitle } = data
|
||||
setState((draft) => {
|
||||
draft.invoiceTitle = invoiceTitle
|
||||
draft.paramsInfo = { ...paramsInfo, ...(data.paramsInfo || {}) }
|
||||
})
|
||||
},
|
||||
},
|
||||
success: function (res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
res.eventChannel.emit('acceptDataFromOpenerPage', { data: totalInfo })
|
||||
}
|
||||
})
|
||||
return
|
||||
authSetting('invoiceTitle', async () => {
|
||||
const res = await Taro.chooseInvoiceTitle()
|
||||
if (res.errMsg === 'chooseInvoiceTitle:ok') {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ function Home () {
|
|||
postions: 'left',
|
||||
url: '',
|
||||
img: 'index/rec/new.png',
|
||||
list: newList
|
||||
list: newList.map(item => ({ ...item, price: (item.price / 100) }))
|
||||
}, {
|
||||
type: 'hot',
|
||||
text: "热销单品",
|
||||
|
|
@ -223,7 +223,7 @@ function Home () {
|
|||
postions: 'left',
|
||||
url: '',
|
||||
img: 'index/rec/hot.png',
|
||||
list: hotList
|
||||
list: hotList.map(item => ({ ...item, price: (item.price / 100) }))
|
||||
}, {
|
||||
type: 'jd',
|
||||
text: "ARIZONA",
|
||||
|
|
@ -231,7 +231,7 @@ function Home () {
|
|||
postions: 'right',
|
||||
url: '',
|
||||
img: 'index/rec/jd.png',
|
||||
list: jdList
|
||||
list: jdList.map(item => ({ ...item, price: (item.price / 100) }))
|
||||
}
|
||||
]
|
||||
})
|
||||
|
|
@ -246,12 +246,11 @@ function Home () {
|
|||
goods: (item.goods_info_detail || []).map((ite) => {
|
||||
return {
|
||||
itemName: ite.item_name,
|
||||
price: ite.price,
|
||||
goods_id: ite.item_id,
|
||||
itemId: ite.item_id,
|
||||
pic: ite.pics?.[0],
|
||||
brief: ite.brief,
|
||||
price: ite.price,
|
||||
price: ite.price ? ite.price / 100 : 0,
|
||||
spec_images: ite.spec_images || [],
|
||||
tagList: ite.tagList || []
|
||||
}
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ function EspierDetail (props) {
|
|||
|
||||
<View className='goods-name-wrap'>
|
||||
<View className='goods-name'>
|
||||
<View className='brief'>{info.brief}</View>
|
||||
{info.pdp && <View className='brief'>{info.pdp}</View>}
|
||||
<View className='title'>{info?.itemName2 || info?.itemName}</View>
|
||||
</View>
|
||||
{/* {(isWeixin || isAPP()) && (
|
||||
|
|
|
|||
|
|
@ -357,6 +357,7 @@ function ItemList () {
|
|||
placeholder='搜索商品'
|
||||
isOpened={true}
|
||||
onFocus={handleOnFocus}
|
||||
onBlur={() => handleConfirm(keywords)}
|
||||
onChange={handleOnChange}
|
||||
onClear={handleOnClear}
|
||||
onCancel={handleSearchOff}
|
||||
|
|
|
|||
|
|
@ -10,22 +10,54 @@ import doc from '@/doc'
|
|||
|
||||
import './invoice-info.scss'
|
||||
import { useImmer } from 'use-immer'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const initState = {
|
||||
formList: [
|
||||
{
|
||||
name: '抬头类型',
|
||||
type: 'checkbox',
|
||||
key: 'invoice_title',
|
||||
key: 'title',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: '发票抬头',
|
||||
type: 'input',
|
||||
key: 'invoice_title',
|
||||
key: 'content',
|
||||
placeholder: '请填写抬头名称(必填)',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: '企业税号',
|
||||
type: 'input',
|
||||
key: 'registration_number',
|
||||
placeholder: '请填写企业税号(选填)',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: '注册地址',
|
||||
type: 'input',
|
||||
key: 'company_address',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
{
|
||||
name: '注册电话',
|
||||
type: 'input',
|
||||
key: 'company_phone',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
{
|
||||
name: '开户银行',
|
||||
type: 'input',
|
||||
key: 'bankname',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
{
|
||||
name: '银行账号',
|
||||
type: 'input',
|
||||
key: 'bankaccount',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
{
|
||||
name: '邮箱地址',
|
||||
type: 'input',
|
||||
|
|
@ -33,42 +65,52 @@ const initState = {
|
|||
placeholder: '用于接收电子发票(必填)',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: '注册地址',
|
||||
type: 'input',
|
||||
key: 'addr',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
{
|
||||
name: '注册电话',
|
||||
type: 'input',
|
||||
key: 'tel',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
{
|
||||
name: '开户银行',
|
||||
type: 'input',
|
||||
key: 'yh',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
{
|
||||
name: '银行账号',
|
||||
type: 'input',
|
||||
key: 'zh',
|
||||
placeholder: '(选填)',
|
||||
},
|
||||
],
|
||||
form: {},
|
||||
showModal: false,
|
||||
visible: false,
|
||||
showDetail: false
|
||||
showDetail: false,
|
||||
invoiceId: '',
|
||||
invoice: {},
|
||||
orderInfo: {},
|
||||
loading: false,
|
||||
title: '',
|
||||
totalFee: '',
|
||||
toastShow: false,
|
||||
invoiceInfo: {}
|
||||
}
|
||||
function InvoiceInfo (props) {
|
||||
const $instance = getCurrentInstance()
|
||||
const [state, setState] = useImmer(initState)
|
||||
const { formList, form, showModal, visible, showDetail } = state
|
||||
const { formList, form, showModal, visible, showDetail, invoiceId, invoice, orderInfo, loading, title, totalFee, toastShow, invoiceInfo } = state
|
||||
const pages = getCurrentPages()
|
||||
const current = pages[pages.length - 1]
|
||||
const eventChannel = current.getOpenerEventChannel()
|
||||
|
||||
const onChangeItemCheck = () => {
|
||||
useEffect(() => {
|
||||
const { id } = $instance.router.params
|
||||
if (id && id !== 'undefined') {
|
||||
setState((draft) => {
|
||||
draft.showDetail = true,
|
||||
draft.invoiceId = id
|
||||
})
|
||||
}
|
||||
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
|
||||
eventChannel?.on('acceptDataFromOpenerPage', function ({ data }) {
|
||||
setState((draft) => {
|
||||
draft.orderInfo = data.order || data || {}
|
||||
draft.invoiceInfo = data.invoice || {}
|
||||
draft.form = data.order?.invoice || {}
|
||||
draft.title = data.order?.title ? data.order.title === 'unit' ? '个人' : '企业' : ''
|
||||
draft.totalFee = data.order?.total_fee ?? ''
|
||||
})
|
||||
})
|
||||
}, [])
|
||||
|
||||
const onChangeItemCheck = (val) => {
|
||||
setState((draft) => {
|
||||
draft.form = { ...form, title: val }
|
||||
})
|
||||
}
|
||||
|
||||
const hadnleInput = (val, item) => {
|
||||
|
|
@ -83,11 +125,72 @@ function InvoiceInfo (props) {
|
|||
draft.visible = false
|
||||
})
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const { email } = form
|
||||
const emailReg = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
if (!emailReg.test(email)) {
|
||||
Taro.showToast({
|
||||
title: '邮箱格式不正确',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
return
|
||||
}
|
||||
setState((draft) => {
|
||||
draft.visible = false
|
||||
// draft.toastShow = true
|
||||
// draft.showModal = true
|
||||
})
|
||||
const res = await api.trade.involiceResend({
|
||||
order_id: orderInfo.order_id,
|
||||
email
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '发送成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack()
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
const handSubmitInvoice = () => {
|
||||
const { email, title, content } = form
|
||||
if (!title) {
|
||||
Taro.showToast({
|
||||
title: '请选择抬头类型',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!content) {
|
||||
Taro.showToast({
|
||||
title: '请填写抬头名称',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
return
|
||||
}
|
||||
const emailReg = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
if (!emailReg.test(email)) {
|
||||
Taro.showToast({
|
||||
title: '邮箱格式不正确',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
return
|
||||
}
|
||||
eventChannel?.emit('acceptDataFromOpenedPage', { data: invoice })
|
||||
Taro.navigateBack()
|
||||
}
|
||||
const handleInvoiceClick = () => {
|
||||
authSetting('invoiceTitle', async () => {
|
||||
const res = await Taro.chooseInvoiceTitle()
|
||||
if (res.errMsg === 'chooseInvoiceTitle:ok') {
|
||||
log.debug('[invoice] info:', res)
|
||||
// log.debug('[invoice] info:', res)
|
||||
const {
|
||||
type,
|
||||
content,
|
||||
|
|
@ -110,50 +213,84 @@ function InvoiceInfo (props) {
|
|||
company_phone
|
||||
}
|
||||
}
|
||||
console.log("🚀 ~ invoice_parmas:", invoice_parmas)
|
||||
// setState((draft) => {
|
||||
// draft.invoiceTitle = content
|
||||
// draft.paramsInfo = { ...paramsInfo, ...invoice_parmas }
|
||||
// })
|
||||
// console.log("🚀 ~ invoice_parmas:", invoice_parmas)
|
||||
setState((draft) => {
|
||||
draft.invoice = {
|
||||
invoiceTitle: content,
|
||||
paramsInfo: invoice_parmas
|
||||
}
|
||||
draft.form = invoice_parmas.invoice_content
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return <SpPage className='page-invoice-info has-navbar' navigationBarTitleText='开票信息'>
|
||||
// 预览文件
|
||||
const preview = (url, fileName) => {
|
||||
Taro.downloadFile({
|
||||
url: url,
|
||||
success: function (res) {
|
||||
console.log("下载:", res)
|
||||
var filePath = res.tempFilePath
|
||||
Taro.openDocument({
|
||||
filePath: filePath,
|
||||
fileType: getFileType(url),
|
||||
fileName: fileName,
|
||||
success: function (res) {
|
||||
console.log("打开:", res)
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
// 获取文件类型
|
||||
const getFileType = (name = '') => {
|
||||
if (name.lastIndexOf(".") > -1) {
|
||||
return name.slice(name.lastIndexOf(".") + 1).toLowerCase()
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return <SpPage className='page-invoice-info has-navbar' loading={loading} navigationBarTitleText='开票信息'>
|
||||
<View className="info-bd">
|
||||
{showDetail && <View className="info-bd-tips">共{0}张发票,含{1}个订单</View>}
|
||||
{showDetail && <View className="info-bd-tips">共{1}张发票,含{1}个订单</View>}
|
||||
<View className="info-item">
|
||||
<View className="tit">发票类型</View>
|
||||
<View className="content">
|
||||
<Text>电子发票</Text>
|
||||
{showDetail ? <View className='flex'>
|
||||
<Text className='ck'>查看</Text>
|
||||
<AtIcon value='chevron-right' size='18' color='#000'></AtIcon>
|
||||
<Text className='ck' onClick={() => preview(invoiceInfo.pdf_info, invoiceInfo.invoice_title + invoiceInfo.invoice_no)}>查看</Text>
|
||||
<Text className='iconfont icon-qianwang-01'></Text>
|
||||
{/* <AtIcon value='chevron-right' size='18' color='#000'></AtIcon> */}
|
||||
</View> : <Text className='sq' onClick={handleInvoiceClick}>一键授权微信发票</Text>}
|
||||
</View>
|
||||
</View>
|
||||
{showDetail && <View className="info-item">
|
||||
<View className="tit">发票状态</View>
|
||||
<View className="content">
|
||||
<Text>已申请</Text>
|
||||
<Text>{orderInfo.is_invoiced == 1 ? '已开票' : '已申请'}</Text>
|
||||
</View>
|
||||
</View>}
|
||||
<View className="info-item">
|
||||
<View className="tit">发票金额</View>
|
||||
<View className="content">
|
||||
<Text>¥9999</Text>
|
||||
<Text>¥{totalFee ? parseFloat(totalFee).toFixed(2) : (orderInfo.total_fee ? (orderInfo.total_fee / 100).toFixed(2) : 0)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
{formList.map((item) => <View className="info-item">
|
||||
<View className="tit">{item.name}</View>
|
||||
{showDetail ? <View className="content">{form[item.key] || '测试'}</View> : <>{item.type === 'checkbox' && <View className="content">
|
||||
{showDetail && item.key !== 'email' ? <View className="content">{item.key === 'title' ? title || orderInfo.invoice?.[item.key] || form[item.key] : orderInfo.invoice?.[item.key] || form[item.key] || ''}</View> : <>{item.type === 'checkbox' && <View className="content">
|
||||
<View className="content-item">
|
||||
<SpCheckboxNew checked={form.gr === '1'} onChange={() => onChangeItemCheck()} >
|
||||
<SpCheckboxNew checked={form.title === 'individual'} onChange={() => onChangeItemCheck('individual')} >
|
||||
<Text className="">个人/非企业单位</Text>
|
||||
</SpCheckboxNew>
|
||||
</View>
|
||||
<View className="content-item">
|
||||
<SpCheckboxNew checked={form.gr === '2'} onChange={onChangeItemCheck()} >
|
||||
<SpCheckboxNew checked={form.title === 'unit'} onChange={() => onChangeItemCheck('unit')} >
|
||||
<Text className="">企业</Text>
|
||||
</SpCheckboxNew>
|
||||
</View>
|
||||
|
|
@ -173,11 +310,20 @@ function InvoiceInfo (props) {
|
|||
</View>
|
||||
</View>}
|
||||
</View>
|
||||
<View className={classNames("bottom")}>
|
||||
<View onClick={() => setState((draft) => {
|
||||
draft.visible = true
|
||||
})} className={classNames("btn", { "btn-disabled": true })}>提交申请</View>
|
||||
</View>
|
||||
{!showDetail ? <View className={classNames("bottom")}>
|
||||
<View onClick={() => {
|
||||
handSubmitInvoice()
|
||||
// setState((draft) => {
|
||||
// draft.visible = true
|
||||
// })
|
||||
}} className={classNames("btn", { "btn-disabled": !form.title || !form.content || !form.email })}>提交申请</View>
|
||||
</View> : orderInfo.is_invoiced == 1 && <View className={classNames("bottom")}>
|
||||
<View onClick={() => {
|
||||
setState((draft) => {
|
||||
draft.visible = true
|
||||
})
|
||||
}} className={classNames("btn")}>重发发票</View>
|
||||
</View>}
|
||||
|
||||
<View className="sp-picker">
|
||||
<View
|
||||
|
|
@ -204,29 +350,31 @@ function InvoiceInfo (props) {
|
|||
</View>
|
||||
<View className='sp-picker-bd-item'>
|
||||
<View className="tit">抬头类型</View>
|
||||
<View className="content">电子发票</View>
|
||||
<View className="content">{form.title === 'unit' ? '企业' : '个人'}</View>
|
||||
</View>
|
||||
<View className='sp-picker-bd-item'>
|
||||
<View className="tit">发票抬头</View>
|
||||
<View className="content">电子发票</View>
|
||||
<View className="content">{form.content}</View>
|
||||
</View>
|
||||
<View className='sp-picker-bd-item'>
|
||||
<View className="tit">税号</View>
|
||||
<View className="content">{form.registration_number}</View>
|
||||
</View>
|
||||
</>}
|
||||
<View className='sp-picker-bd-item'>
|
||||
<View className="tit">邮箱地址</View>
|
||||
<View className="content">电子发票</View>
|
||||
<View className="content">{form.email}</View>
|
||||
</View>
|
||||
<View onClick={() => setState((draft) => {
|
||||
draft.visible = false
|
||||
draft.showModal = true
|
||||
})} className={classNames("btn", { "notop": showDetail })}>提交申请</View>
|
||||
<View onClick={handleSubmit} className={classNames("btn", { "notop": showDetail })}>提交申请</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={classNames('toast', {
|
||||
visible: false
|
||||
visible: toastShow
|
||||
})}>
|
||||
<View>已超重开发票时限</View>
|
||||
<View>不可操作重开发票</View>
|
||||
{/* <View>已超重开发票时限</View>
|
||||
<View>不可操作重开发票</View> */}
|
||||
<View>提交申请成功,请耐心等待</View>
|
||||
</View>
|
||||
|
||||
<AtModal
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
color: #163586;
|
||||
margin-right: 2px;
|
||||
}
|
||||
.icon-qianwang-01 {
|
||||
font-size: 20px;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ipt {
|
||||
|
|
@ -66,7 +70,7 @@
|
|||
font-size: 26px;
|
||||
line-height: 1;
|
||||
color: #000;
|
||||
padding-right: 40px;
|
||||
// padding-right: 40px;
|
||||
box-sizing: border-box;
|
||||
&-placeholder {
|
||||
color: #808080;
|
||||
|
|
@ -190,6 +194,9 @@
|
|||
display: flex;
|
||||
flex: 1;
|
||||
color: #000;
|
||||
.icon-qianwang-01 {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export default class InvoiceList extends Component {
|
|||
onChange={this.onChangeItemCheck.bind(this, {})}
|
||||
/>
|
||||
<View className="bottom-txt">本页全选</View>
|
||||
<View className="bottom-btn">下一步</View>
|
||||
<View className="bottom-btn" onClick={() => Taro.navigateTo({ url: '/subpage/pages/trade/invoice-info' })}>下一步</View>
|
||||
</View>
|
||||
</View>}
|
||||
{/*<AtButton
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import _mapKeys from 'lodash/mapKeys'
|
|||
import { Loading, SpNote, SpPage, SpPrice, SpCheckboxNew } from '@/components'
|
||||
import api from '@/api'
|
||||
import { withPager, withLogin } from '@/hocs'
|
||||
import { log, pickBy, resolveOrderStatus, authSetting } from '@/utils'
|
||||
import { log, pickBy, resolveOrderStatus, authSetting, formatDateTime } from '@/utils'
|
||||
import { AtIcon } from 'taro-ui'
|
||||
|
||||
import './invoice-record.scss'
|
||||
|
|
@ -45,27 +45,32 @@ export default class InvoiceList extends Component {
|
|||
tid: 'order_id',
|
||||
status_desc: 'order_status_msg',
|
||||
status: ({ order_status }) => resolveOrderStatus(order_status),
|
||||
totalItems: ({ items }) => items.reduce((acc, item) => +item.num + acc, 0),
|
||||
totalItems: ({ items }) => items?.reduce((acc, item) => +item.num + acc, 0),
|
||||
payment: ({ total_fee }) => (total_fee / 100).toFixed(2),
|
||||
pay_type: 'pay_type',
|
||||
point: 'point',
|
||||
create_date: 'create_date',
|
||||
order: ({ items }) =>
|
||||
pickBy(items, {
|
||||
order_id: 'order_id',
|
||||
item_id: 'item_id',
|
||||
pic_path: 'pic',
|
||||
title: 'item_name',
|
||||
price: ({ item_fee }) => (+item_fee / 100).toFixed(2),
|
||||
point: 'item_point',
|
||||
num: 'num'
|
||||
})
|
||||
invoice: ({ invoice }) => invoice ? JSON.parse(invoice) : {},
|
||||
id: 'id',
|
||||
order_id: 'order_id',
|
||||
status: 'status',
|
||||
order: ({ order: { orderInfo }, order }) => {
|
||||
return order.orderInfo ? {
|
||||
time: formatDateTime(orderInfo.create_time),
|
||||
tid: orderInfo.order_id,
|
||||
total_fee: orderInfo.total_fee / 100,
|
||||
order_id: orderInfo.order_id,
|
||||
title: orderInfo.title,
|
||||
invoice: orderInfo.invoice,
|
||||
is_invoiced: orderInfo.is_invoiced
|
||||
} : {}
|
||||
}
|
||||
})
|
||||
|
||||
log.debug('[trade list] list fetched and processed: ', nList)
|
||||
|
||||
this.setState({
|
||||
list: [...this.state.list, ...nList, {}, {}, {}, {}, {}, {}, {}, {}]
|
||||
list: [...this.state.list, ...nList]
|
||||
})
|
||||
|
||||
return { total }
|
||||
|
|
@ -130,6 +135,14 @@ export default class InvoiceList extends Component {
|
|||
onChangeItemCheck = (item) => {
|
||||
console.log(item, 'ckeck点击')
|
||||
}
|
||||
goDetail = (item) => {
|
||||
Taro.navigateTo({
|
||||
url: `/subpage/pages/trade/invoice-info?id=${item.id}`,
|
||||
success: function (res) {
|
||||
res.eventChannel?.emit('acceptDataFromOpenerPage', { data: item })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
const { list, page } = this.state
|
||||
|
|
@ -139,18 +152,23 @@ export default class InvoiceList extends Component {
|
|||
<ScrollView scrollY className='trade-list__scroll' onScrollToLower={this.nextPage}>
|
||||
{list.map((item, idx) => {
|
||||
return (
|
||||
<View className='invoice-item' key={`invoice_item_${idx}`}>
|
||||
<View className="right">
|
||||
<View className="right-item">{idx + 1}发票金额:
|
||||
<SpPrice size={28} className='total-pirce' value={item.payment / 100} showSeparator noDecimal />
|
||||
<View className='invoice-item' onClick={() => this.goDetail(item)} key={`invoice_item_${idx}`}>
|
||||
<View className="right-item">商品名称:{item.order?.title}</View>
|
||||
<View className='invoice-item-box'>
|
||||
<View className="right">
|
||||
<View className="right-item">订单编号:{item.order?.order_id}</View>
|
||||
<View className="right-item">发票金额:
|
||||
<SpPrice size={26} className='total-pirce' value={item.order?.total_fee} showSeparator noDecimal={false} />
|
||||
</View>
|
||||
<View className="right-item">发票类型:电子发票</View>
|
||||
<View className="right-item">抬头类型:{item.order?.invoice?.title === 'unit' ? '企业' : '个人'}</View>
|
||||
<View className="right-item">申请时间:{item.order?.time || ''}</View>
|
||||
</View>
|
||||
<View className="status">
|
||||
<Text className="txt">{item.order?.is_invoiced == 1 ? '已开票' : "已申请"}</Text>
|
||||
{/* <AtIcon value='chevron-right' size={20} color='#888'></AtIcon> */}
|
||||
<Text className='iconfont icon-qianwang-01'></Text>
|
||||
</View>
|
||||
<View className="right-item">发票类型:电子发票</View>
|
||||
<View className="right-item">抬头类型:{item.create_date}</View>
|
||||
<View className="right-item">申请时间:{item.create_date || '2023-12-18 10:10'}</View>
|
||||
</View>
|
||||
<View className="status">
|
||||
<Text className="txt">已申请</Text>
|
||||
<AtIcon value='chevron-right' size='18' color='#888'></AtIcon>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
.trade-list {
|
||||
&__scroll {
|
||||
// @include page-scroll($tabs-height + $navigate-height + 10px, 0);
|
||||
@include page-scroll(var(--nav-height), 140px);
|
||||
@include page-scroll(var(--nav-height), 10px);
|
||||
padding-top: 20px;
|
||||
padding-bottom: 210px;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
}
|
||||
.invoice-item {
|
||||
|
|
@ -15,18 +15,23 @@
|
|||
box-sizing: border-box;
|
||||
background: #f7f7f7;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
&-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.icon-qianwang-01 {
|
||||
font-size: 26px;
|
||||
}
|
||||
.right-item {
|
||||
color: #000;
|
||||
margin-bottom: 20px;
|
||||
font-size: 26px;
|
||||
line-height: 1;
|
||||
}
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 10px;
|
||||
&-item {
|
||||
color: #000;
|
||||
margin-bottom: 20px;
|
||||
line-height: 1;
|
||||
}
|
||||
&-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
@ -36,7 +41,7 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
.txt {
|
||||
margin-right: 20px;
|
||||
margin-right: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ function MemberIndex (props) {
|
|||
|
||||
const { memberConfig } = config
|
||||
|
||||
console.log('====config===', config.menu)
|
||||
// console.log('====config===', config.menu)
|
||||
|
||||
return (
|
||||
<SpPage className='pages-member-index has-navbar' renderFooter={<SpTabbar />} isTop>
|
||||
|
|
@ -709,7 +709,7 @@ function MemberIndex (props) {
|
|||
<SpImage className="member_con_item_img" src="member/dizhi.png" height={190} mode='aspectFill' isNew />
|
||||
<View className="member_con_item_txt">地址管理</View>
|
||||
</View>
|
||||
<View className="member_con_item" onClick={isLogin && handleClickLink.bind(this, '/subpage/pages/trade/invoice-list')}>
|
||||
<View className="member_con_item" onClick={isLogin && handleClickLink.bind(this, '/subpage/pages/trade/invoice-record')}>
|
||||
<SpImage className="member_con_item_img" src="member/fapiao.png" height={190} mode='aspectFill' isNew />
|
||||
<View className="member_con_item_txt">发票管理</View>
|
||||
</View>
|
||||
|
|
|
|||
Loading…
Reference in New Issue