商城测试版v7
This commit is contained in:
parent
c646bac0a4
commit
c4684c11b8
@ -42,7 +42,7 @@ import { useRequest } from "@/use/useHttp"
|
||||
/**
|
||||
* 公司类型|企业类型 下拉列表
|
||||
*/
|
||||
export const companyTypeApi = () => {
|
||||
export const companyTypeApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/enum/purchaserType`,
|
||||
method: "get",
|
||||
@ -89,3 +89,22 @@ import { useRequest } from "@/use/useHttp"
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请码获取业务员信息
|
||||
*/
|
||||
export const GetInvitationInfoApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/user/invitationInfo`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定业务员
|
||||
*/
|
||||
export const BindInvitationInfoApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/user/bindInvitationCode`,
|
||||
method: "post",
|
||||
})
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||
import { alert } from "@/common/common"
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from "@/common/enum"
|
||||
import {Text, View } from "@tarojs/components"
|
||||
@ -12,10 +11,10 @@ import { throttle } from "@/common/util"
|
||||
type Param = {
|
||||
orderInfo: {
|
||||
stage: number, //售后状态
|
||||
orderId: number, //订单id
|
||||
sale_mode: number, //订单类型
|
||||
type: number, //1退货,2退款
|
||||
return_apply_order_id: number //售后申请单
|
||||
is_quality_check: true|false //质检结果
|
||||
},
|
||||
onClick?: (val: number) => void, //点击后触发的事件,返回订单状态
|
||||
fixedBottom?: true|false, //是否固定在底部
|
||||
@ -61,8 +60,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
||||
id: 4,
|
||||
label: '质检结果',
|
||||
validatarFunc: (orderInfo) => {
|
||||
if(orderInfo.sale_mode !== 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage)
|
||||
return false
|
||||
return orderInfo?.is_quality_check
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -21,16 +21,29 @@
|
||||
z-index: 1999;
|
||||
.bindSalesman_header{
|
||||
width: 654px;
|
||||
height: 654px;
|
||||
position: relative;
|
||||
image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 40px 40px 0 0;
|
||||
}
|
||||
.sale_man{
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-size: 26px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 60px;
|
||||
height: 100px;
|
||||
line-height: 100px;
|
||||
}
|
||||
}
|
||||
.btns{
|
||||
width: 488px;
|
||||
height: 104px;
|
||||
margin: 50px;
|
||||
image{
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -8,16 +8,12 @@ import { useEffect, useState } from "react";
|
||||
|
||||
type params = {
|
||||
show?: true|false,
|
||||
onClose?: () => void
|
||||
onClose?: () => void,
|
||||
saleMan?: string
|
||||
}
|
||||
export default ({show = false, onClose}:params) => {
|
||||
const [showPop, setShowPop] = useState<true|false>(false)
|
||||
useEffect(() => {
|
||||
if(show !== undefined) setShowPop(() => show)
|
||||
}, [show])
|
||||
export default ({show = false, saleMan = '', onClose}:params) => {
|
||||
const onClick = async (val) => {
|
||||
onClose?.()
|
||||
setShowPop(() => false)
|
||||
if(val == 1) {
|
||||
goLink('/pages/depositBeforehand/index')
|
||||
} else {
|
||||
@ -25,20 +21,20 @@ export default ({show = false, onClose}:params) => {
|
||||
}
|
||||
}
|
||||
const onCloseEven = () => {
|
||||
setShowPop(() => false)
|
||||
onClose?.()
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{showPop&&<View className={styles.bindSalesman_main}>
|
||||
{show&&<View className={styles.bindSalesman_main}>
|
||||
<View className={styles.bindSalesman_pop}>
|
||||
<View className={styles.bindSalesman_header} onClick={() => onClick(1)}>
|
||||
<Image src={formatImgUrl('/mall/invite_code_success.png', '!w400')} mode="widthFix"/>
|
||||
<View className={styles.sale_man}>邀请人: {saleMan}</View>
|
||||
</View>
|
||||
<View className={styles.btns} onClick = {() => onClick(2)}>
|
||||
<Image src={formatImgUrl('/mall/invite_code_btn.png', '!w400')} mode="widthFix"/>
|
||||
<View className={styles.btns} >
|
||||
<Image src={formatImgUrl('/mall/invite_code_btn.png', '!w400')} mode="widthFix" onClick = {() => onClick(2)}/>
|
||||
</View>
|
||||
{/* <CloseBtn styleObj={{backgroundImage: '', border:'2PX solid #fff', color: '#fff'}}/> */}
|
||||
<CloseBtn styleObj={{backgroundImage: '', border:'2PX solid #fff', color: '#fff'}}/>
|
||||
</View>
|
||||
<View className={styles.bindSalesman_mask} onClick={onCloseEven}></View>
|
||||
</View>}
|
||||
|
@ -3,11 +3,13 @@ import styles from './index.module.scss'
|
||||
import useLogin from '@/use/useLogin'
|
||||
import classnames from "classnames";
|
||||
import { formatImgUrl } from '@/common/fotmat'
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { alert } from '@/common/common';
|
||||
import CloseBtn from '@/components/closeBtn';
|
||||
import SuccessBind from './component/successBind';
|
||||
import Taro, { useDidShow } from "@tarojs/taro";
|
||||
import { BindInvitationInfoApi, GetInvitationInfoApi } from '@/api/user';
|
||||
import { debounce, getFilterData, throttle } from '@/common/util';
|
||||
export default () => {
|
||||
useLogin()
|
||||
|
||||
@ -16,25 +18,45 @@ export default () => {
|
||||
})
|
||||
|
||||
const [submitData, setSubmitData] = useState({
|
||||
code: '',
|
||||
invitation_code: '',
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
if(!submitData.code) alert.error('请输入邀请码')
|
||||
//获取业务员信息
|
||||
type Param = {invitation_code: string, name: string, phone: string}
|
||||
const [salesMan, setSalesMan] = useState<Param|null>(null)
|
||||
const {fetchData: GetInvitationInfoFetchData} = GetInvitationInfoApi()
|
||||
const getInvitationInfo = async () => {
|
||||
let res = await GetInvitationInfoFetchData(getFilterData({...submitData}))
|
||||
res.success?setSalesMan(res.data):setSalesMan(null)
|
||||
}
|
||||
useEffect(() => {
|
||||
if(submitData.invitation_code.length === 4)
|
||||
getInvitationInfo()
|
||||
}, [submitData])
|
||||
|
||||
const onInputCode = (e) => {
|
||||
setSubmitData((val) => ({...val, code:e.detail.value}))
|
||||
const value = e.detail.value.replace(/[\W]/g, "")
|
||||
setSubmitData((val) => ({...val, invitation_code:value}))
|
||||
}
|
||||
|
||||
const oncloseEven = () => {
|
||||
setSubmitData((val) => ({...val, code:''}))
|
||||
setSubmitData((val) => ({...val, invitation_code:''}))
|
||||
setSalesMan(null)
|
||||
}
|
||||
|
||||
//绑定业务员
|
||||
const [bindShow, setBindShow] = useState(false)
|
||||
const {fetchData: bindInvitationInfoFetchData} = BindInvitationInfoApi()
|
||||
const onSubmit = async () => {
|
||||
if(!submitData.invitation_code) return alert.error('请输入邀请码')
|
||||
let res = await bindInvitationInfoFetchData({...submitData})
|
||||
if(res.success) setBindShow(() => true)
|
||||
}
|
||||
|
||||
const onScanCode = () => {
|
||||
Taro.scanCode({
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
setSubmitData(() => ({invitation_code: res.result}))
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -44,7 +66,7 @@ export default () => {
|
||||
Taro.getClipboardData({
|
||||
success: function (res){
|
||||
let val = res.data.match(/InviteCode:([a-zA-Z0-9]{4})/)
|
||||
setSubmitData((...e) => ({...e, code: val?val[1]:''}))
|
||||
setSubmitData((e) => ({...e, invitation_code: val?val[1]:''}))
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -55,15 +77,15 @@ export default () => {
|
||||
<Image src={formatImgUrl('/mall/invite_code_bg.png')} mode="aspectFill"/>
|
||||
</View>
|
||||
<View className={styles.inputCode}>
|
||||
<Input value={submitData.code} placeholder='请输入邀请码' onInput={(e) => onInputCode(e)}/>
|
||||
<Input maxlength={4} value={submitData.invitation_code} placeholder='请输入邀请码' onInput={onInputCode} type="text" />
|
||||
<View className={styles.close_btn} >
|
||||
{submitData.code&&<CloseBtn styleObj={{backgroundColor: '#ccc', color: '#fff'}} onClose={oncloseEven}/>}
|
||||
{submitData.invitation_code&&<CloseBtn styleObj={{backgroundColor: '#ccc', color: '#fff'}} onClose={oncloseEven}/>}
|
||||
</View>
|
||||
<View className={styles.scan_code} onClick={() => onScanCode()}>
|
||||
<Text className={classnames('iconfont icon-saomazhifu', styles.miconfont)}></Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.salesman_name}><Text>邀请人:</Text><Text>李先生(132****6690)</Text></View>
|
||||
{salesMan&&<View className={styles.salesman_name}><Text>邀请人:</Text><Text>{`${salesMan.name} (${salesMan.phone})`}</Text></View>}
|
||||
<View className={styles.btns} onClick={onSubmit}>提交</View>
|
||||
<View className={styles.message}>
|
||||
<Text>温馨提示</Text>
|
||||
@ -71,7 +93,7 @@ export default () => {
|
||||
<Text>2. 一个手机只能输入一次邀请码。输入邀请码。</Text>
|
||||
</View>
|
||||
<View className='common_safe_area_y'></View>
|
||||
<SuccessBind show={false}/>
|
||||
<SuccessBind show={bindShow} onClose={() => setBindShow(false)} saleMan={salesMan?.name}/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import AddCollection from '@/components/addCollection';
|
||||
import { AddFavoriteApi, DelFavoriteProductApi } from '@/api/favorite';
|
||||
import useCommonData from '@/use/useCommonData';
|
||||
import { IMG_CND_Prefix } from '@/common/constant';
|
||||
import LabAndImgShow from '@/components/LabAndImgShow';
|
||||
|
||||
type item = {title:string, img:string, url:string, id:number}
|
||||
|
||||
|
@ -165,7 +165,7 @@ import { throttle } from "@/common/util";
|
||||
alert.none(res.msg)
|
||||
}
|
||||
}
|
||||
}, 600)
|
||||
}, 800)
|
||||
|
||||
//页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
|
@ -125,7 +125,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
}, [order])
|
||||
//对应单价
|
||||
const standardPrice = useCallback(price => {
|
||||
return formatPriceDiv(price, 100, true) + '/' + (order?.sale_mode == 1?'m':'kg')
|
||||
return formatPriceDiv(price) + '/' + (order?.sale_mode == 1?'m':'kg')
|
||||
}, [order])
|
||||
|
||||
//数量格式
|
||||
|
@ -13,6 +13,7 @@ import { formatPriceDiv } from "@/common/fotmat";
|
||||
import {alert} from "@/common/common"
|
||||
import { ORDER_STATUS, PAYMENT_METHOD, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum";
|
||||
import { UseSubscriptionMessage } from "@/use/useCommon";
|
||||
import { throttle } from "@/common/util";
|
||||
|
||||
type Param = {
|
||||
show?: true|false,
|
||||
@ -28,6 +29,8 @@ type OrderInfo = {
|
||||
status?: number, //订单状态
|
||||
payment_method?: number, //支付方式
|
||||
sale_mode?: number, //订单类型 0:大货 1剪板 2散剪
|
||||
actual_weight?: number, //实际重量
|
||||
estimate_weight?: number, //预估重量
|
||||
[val: string]: any
|
||||
}
|
||||
|
||||
@ -99,7 +102,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
//提交支付
|
||||
const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交
|
||||
const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交
|
||||
const submitPay = async () => {
|
||||
const submitPay = throttle(async () => {
|
||||
if(submitData.payment_method === null) {
|
||||
alert.error('请选择支付方式')
|
||||
return false
|
||||
@ -121,7 +124,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
}
|
||||
}, 800)
|
||||
|
||||
//预付款
|
||||
const advance_payment = useMemo(() => {
|
||||
|
@ -9,7 +9,7 @@
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.16);
|
||||
margin-bottom: 20px;;
|
||||
margin-bottom: 20px;
|
||||
.header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -46,7 +46,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
product_color_name: citem.name,
|
||||
num: citem.roll.toString(),
|
||||
length: (citem.length/100).toString(),
|
||||
weight: formatWeightDiv(citem.estimate_weight).toString(),
|
||||
weight: formatWeightDiv(citem.actual_weight||citem.estimate_weight).toString(),
|
||||
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
||||
total_price: formatPriceDiv(citem.estimate_amount).toString(),
|
||||
})
|
||||
@ -73,7 +73,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格
|
||||
order_total_num: (orderInfo.total_number) + '',
|
||||
qrcode:"", //跳转链接
|
||||
order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量
|
||||
order_total_weight: formatWeightDiv(orderInfo.total_weight||orderInfo.total_estimate_weight).toString(), //订单布匹重量
|
||||
list: lists ,
|
||||
show_qrcode: true //是否显示码单
|
||||
}))
|
||||
@ -172,7 +172,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
<View className={styles.scanPay_list}>
|
||||
{(state.loading)&&<LoadingCard/>||
|
||||
<ScrollView scrollY className={styles.scanPay_list}>
|
||||
<Image mode="widthFix" src={payCodeImage} showMenuByLongpress={true} onClick={showImage}></Image>
|
||||
<Image mode="widthFix" src={payCodeImage} onClick={showImage}></Image>
|
||||
</ScrollView>}
|
||||
</View>
|
||||
<View className={styles.btns} onClick={saveImageCheck}>保存电子确认单</View>
|
||||
|
@ -5,12 +5,10 @@ import styles from './index.module.scss'
|
||||
import Popup from "@/components/popup";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { alert } from "@/common/common";
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from "@/common/fotmat";
|
||||
import { formatDateTime, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from "@/common/fotmat";
|
||||
import useCheckAuthorize from "@/use/useCheckAuthorize";
|
||||
import { GetPayCode } from "@/api/onlinePay";
|
||||
import LoadingCard from "@/components/loadingCard";
|
||||
import { GetOrderPayApi, GetPrepayOrderPayApi } from "@/api/orderPay";
|
||||
|
||||
|
||||
type Param = {
|
||||
show?: true|false,
|
||||
@ -52,7 +50,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
product_color_name: citem.name,
|
||||
num: citem.roll.toString(),
|
||||
length: (citem.length/100).toString(),
|
||||
weight: formatWeightDiv(citem.estimate_weight).toString(),
|
||||
weight: formatWeightDiv(citem.actual_weight||citem.estimate_weight).toString(),
|
||||
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
||||
total_price: formatPriceDiv(citem.total_sale_price||citem.estimate_amount).toString(),
|
||||
})
|
||||
@ -79,7 +77,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格
|
||||
order_total_num: (orderInfo.total_number).toString(),
|
||||
qrcode:"", //跳转链接
|
||||
order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量
|
||||
order_total_weight: formatWeightDiv(orderInfo.total_weight||orderInfo.total_estimate_weight).toString(), //订单布匹重量
|
||||
list: lists
|
||||
}))
|
||||
}
|
||||
@ -104,7 +102,6 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
return addressInfo?.shipment_mode == 2? orderInfo.target_user_phone : orderInfo.take_goods_phone
|
||||
}
|
||||
|
||||
|
||||
//获取支付二维码
|
||||
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
||||
const fileData = useRef({
|
||||
@ -142,7 +139,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
alert.loading('正在保存图片')
|
||||
Taro.saveImageToPhotosAlbum({
|
||||
filePath: fileData.current.filePath,
|
||||
success: function (res) {
|
||||
success: function () {
|
||||
alert.success('图片保存成功')
|
||||
},
|
||||
fail: function (err) {
|
||||
|
@ -48,7 +48,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
}, [value])
|
||||
//对应单价
|
||||
const standardPrice = useCallback((price, sale_mode) => {
|
||||
return formatPriceDiv(price).toLocaleString() + '/' + (sale_mode == 1?'m':'kg')
|
||||
return '¥' + formatPriceDiv(price).toLocaleString() + '/' + (sale_mode == 1?'m':'kg')
|
||||
}, [value])
|
||||
|
||||
//点击订单按钮
|
||||
|
@ -1,4 +1,6 @@
|
||||
export default {
|
||||
navigationBarTitleText: '订单列表',
|
||||
enableShareAppMessage: true,
|
||||
enablePullDownRefresh: true,
|
||||
backgroundTextStyle: 'dark',
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder";
|
||||
import { formatHashTag, formatPriceDiv } from "@/common/fotmat";
|
||||
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat";
|
||||
import LabAndImg from "@/components/LabAndImg";
|
||||
import Popup from "@/components/popup";
|
||||
import { ScrollView, Text, View } from "@tarojs/components";
|
||||
@ -106,7 +106,7 @@ export default memo(({show, onClose, onSubmit, id}:Param) => {
|
||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
||||
<View className={styles.order_list_item_price}>
|
||||
<Text>¥{standardPrice(colorItem.sale_price)}</Text>
|
||||
<Text>总重{standardPrice(colorItem.estimate_weight)}</Text>
|
||||
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.order_list_item_count}>
|
||||
|
@ -28,6 +28,7 @@ type OrderParam = {
|
||||
quality_check_pass_colors: number, //验布后的颜色总数
|
||||
quality_check_pass_fabrics: number, //验布后的面料数量
|
||||
quality_check_pass_number: number, //验布后的总数量
|
||||
is_quality_check: true|false, //是否质检过
|
||||
}
|
||||
|
||||
type Param = {
|
||||
@ -36,31 +37,6 @@ type Param = {
|
||||
}
|
||||
|
||||
export default memo(({order, comfirm = false}:Param) => {
|
||||
//对应数量
|
||||
const formatCount = useCallback((item) => {
|
||||
return order?.sale_mode == 0? item.roll : Number(item.length / 100)
|
||||
}, [order])
|
||||
//对应单价
|
||||
const standardPrice = useCallback(price => {
|
||||
return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg')
|
||||
}, [order])
|
||||
//数量格式
|
||||
const numText = useMemo(() => {
|
||||
if(order) {
|
||||
if(!order?.quality_check_pass_fabrics&&!order?.quality_check_pass_number&&!order?.quality_check_pass_colors) {
|
||||
let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100)
|
||||
return `${order?.total_fabrics} 种面料,${order?.total_colors} 种颜色,共 ${total_number} ${order?.unit}`
|
||||
} else {
|
||||
let total_number = order?.sale_mode == 0?order?.quality_check_pass_number:(order?.quality_check_pass_number/100)
|
||||
return `${order?.quality_check_pass_fabrics} 种面料,${order?.quality_check_pass_colors} 种颜色,共 ${total_number} ${order?.unit}`
|
||||
}
|
||||
}
|
||||
}, [order])
|
||||
|
||||
//获取面料数组
|
||||
const list = useMemo(() => {
|
||||
return order?.quality_check_pass_product?.length > 0?order?.quality_check_pass_product:order?.product_list
|
||||
}, [order])
|
||||
|
||||
//售后单状态枚举
|
||||
const {
|
||||
@ -73,15 +49,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
ReturnStageServiceOrderPendingRefund, // 待退款
|
||||
ReturnStageRejected, // 已拒绝
|
||||
} = AFTER_ORDER_STATUS
|
||||
|
||||
//退款状态枚举
|
||||
// const {
|
||||
// ShouldCollectOrderRefundTypeUnknown,
|
||||
// ShouldCollectOrderRefundTypeAdvanceReceiptRefund,
|
||||
// ShouldCollectOrderRefundTypeReturnForRefund,
|
||||
// ShouldCollectOrderRefundTypeSalesRefund,
|
||||
// } = REFUND_STATUS
|
||||
|
||||
|
||||
//金额列表枚举
|
||||
const priceList = [
|
||||
{
|
||||
@ -133,6 +101,34 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
)
|
||||
}, [order])
|
||||
|
||||
//对应数量
|
||||
const formatCount = useCallback((item) => {
|
||||
return order?.sale_mode == 0? item.roll : Number(item.length / 100)
|
||||
}, [order])
|
||||
|
||||
//对应单价
|
||||
const standardPrice = useCallback(price => {
|
||||
return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg')
|
||||
}, [order])
|
||||
|
||||
//数量格式
|
||||
const numText = useMemo(() => {
|
||||
if(order) {
|
||||
if(!order?.is_quality_check) {
|
||||
let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100)
|
||||
return `${order?.total_fabrics} 种面料,${order?.total_colors} 种颜色,共 ${total_number} ${order?.unit}`
|
||||
} else {
|
||||
let total_number = order?.sale_mode == 0?order?.quality_check_pass_number:(order?.quality_check_pass_number/100)
|
||||
return `${order?.quality_check_pass_fabrics} 种面料,${order?.quality_check_pass_colors} 种颜色,共 ${total_number} ${order?.unit}`
|
||||
}
|
||||
}
|
||||
}, [order])
|
||||
|
||||
//获取面料数组
|
||||
const list = useMemo(() => {
|
||||
return order?.is_quality_check?order?.quality_check_pass_product:order?.product_list
|
||||
}, [order])
|
||||
|
||||
//整理颜色
|
||||
const labAndRgbAndUrl = useCallback((item) => {
|
||||
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
|
||||
@ -145,7 +141,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
|
||||
//销售价格
|
||||
const formatPrice = useCallback((colorItem) => {
|
||||
return (ReturnStageReturned.value == order?.stage) && <View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount, {} , true)}</View>
|
||||
return (ReturnStageReturned.value == order?.stage) && <View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount, 100 , true)}</View>
|
||||
}, [order])
|
||||
|
||||
return (
|
||||
|
@ -46,32 +46,8 @@ import styles from './index.module.scss'
|
||||
const [formatDetailOrder, setFormatDetailOrder] = useState<any>() //格式化后的数据
|
||||
const formatData = () => {
|
||||
setFormatDetailOrder({
|
||||
estimate_amount: orderDetail.estimate_amount, //预估金额
|
||||
sale_mode: orderDetail.sale_mode,
|
||||
sale_mode_name: orderDetail.sale_mode_name,
|
||||
total_colors: orderDetail.total_colors, //总颜色数量
|
||||
total_number: orderDetail.total_number, //总数量
|
||||
total_fabrics: orderDetail.total_fabrics, //面料数量
|
||||
quality_check_pass_colors: orderDetail.quality_check_pass_colors, //验布后的颜色总数
|
||||
quality_check_pass_fabrics: orderDetail.quality_check_pass_fabrics, //验布后的面料数量
|
||||
quality_check_pass_number: orderDetail.quality_check_pass_number, //验布后的总数量
|
||||
...orderDetail,
|
||||
unit: orderDetail.sale_mode == 0?'条':'m', //单位
|
||||
// list: orderDetail.quality_check_pass_product.length > 0?orderDetail.quality_check_pass_product:orderDetail.product_list,
|
||||
product_list: orderDetail.product_list,
|
||||
quality_check_pass_product: orderDetail.quality_check_pass_product,
|
||||
stage: orderDetail.stage, //订单状态
|
||||
type: orderDetail.type, //退货or退款
|
||||
total_sale_price: orderDetail.total_sale_price, //销售金额
|
||||
total_should_collect_money: orderDetail.total_should_collect_money, //应收金额
|
||||
total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠
|
||||
actual_amount: orderDetail.actual_amount, //实付金额
|
||||
the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态
|
||||
other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额
|
||||
total_refund_amount: orderDetail.total_refund_amount, //合计金额
|
||||
refund_amount: orderDetail.refund_amount, //退款金额
|
||||
refund_type: orderDetail.refund_type, //退款状态
|
||||
refund_flow_name: orderDetail.refund_flow_name //退款去向
|
||||
|
||||
})
|
||||
}
|
||||
const formatPreViewOrderMemo = useMemo(() => {
|
||||
@ -99,12 +75,7 @@ import styles from './index.module.scss'
|
||||
//按钮所需数据
|
||||
const orderInfo = useMemo(() => {
|
||||
return {
|
||||
stage: orderDetail?.stage, //售后订单状态
|
||||
orderId: orderDetail?.id,
|
||||
settle_mode: orderDetail?.settle_mode,
|
||||
type: orderDetail?.type, //退货or退款
|
||||
sale_mode: orderDetail?.sale_mode, //订单类型
|
||||
return_apply_order_id: orderDetail?.return_apply_order_id
|
||||
...orderDetail
|
||||
}
|
||||
}, [orderDetail])
|
||||
|
||||
|
@ -31,6 +31,7 @@ type Param = {
|
||||
type: number //2 退货 1 预收退款 3 销售
|
||||
return_apply_order_id: number //退款申请单
|
||||
refund_amount: number // 退款金额
|
||||
is_quality_check: true|false
|
||||
},
|
||||
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
||||
}
|
||||
@ -52,13 +53,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
|
||||
//按钮所需数据
|
||||
const orderInfo = useMemo(() => {
|
||||
return {
|
||||
stage: value?.stage, //订单状态
|
||||
orderId: value?.id,
|
||||
sale_mode: value?.sale_mode, //订单类型
|
||||
type: value?.type, //退货or退款
|
||||
return_apply_order_id: value?.return_apply_order_id //退款申请单
|
||||
}
|
||||
return value
|
||||
}, [value])
|
||||
|
||||
//整理颜色
|
||||
@ -110,11 +105,11 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
<View className={styles.color_num}>{value?.product_list?.[0].product_colors?.[0].code}</View>
|
||||
</View>
|
||||
<View className={styles.color_list}>
|
||||
{value?.product_list?.[0].product_colors.map((itemColor, index) => {
|
||||
{value?.product_list?.[0].product_colors?.map((itemColor, index) => {
|
||||
return (
|
||||
(index <= 1)&&<View className={styles.color_item}>
|
||||
<View className={styles.color_title}>{formatHashTag(itemColor.code, itemColor.name)}</View>
|
||||
<View className={styles.color_price}>{standardPrice(itemColor.sale_price, value.sale_mode)}</View>
|
||||
<View className={styles.color_price}>¥{standardPrice(itemColor.sale_price, value.sale_mode)}</View>
|
||||
<View className={styles.color_num}>×{formatCount(itemColor, value.sale_mode)}</View>
|
||||
</View>
|
||||
)
|
||||
@ -129,7 +124,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
</View>
|
||||
<View className={styles.color_count_num}>
|
||||
<Text>{numText}</Text>
|
||||
{ReturnStageReturned.value == value?.stage && <Text className={styles.refund_amount}><Text>¥</Text>{formatPriceDiv(value?.refund_amount, 100, true)}</Text>}
|
||||
{/* {ReturnStageReturned.value == value?.stage && <Text className={styles.refund_amount}><Text>¥</Text>{formatPriceDiv(value?.refund_amount, 100, true)}</Text>} */}
|
||||
</View>
|
||||
<View className={styles.order_number}>
|
||||
<Text>{value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'}</Text>
|
||||
|
@ -35,7 +35,8 @@ type option = {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
pagination?: true|false,
|
||||
base_url?: string
|
||||
base_url?: string,
|
||||
apiMsgStatus?: true|false
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,8 +102,10 @@ export const useRequest = (options:option = {
|
||||
page: 1,
|
||||
pageSize: 24,
|
||||
pagination: false, // 是否分页
|
||||
base_url: ''
|
||||
base_url: '',
|
||||
apiMsgStatus: true //是否直接弹出后端错误
|
||||
}) => {
|
||||
|
||||
options.url = `${options.base_url||BASE_URL}${options.url}`
|
||||
let params:Params = {
|
||||
code: null, // 业务码
|
||||
@ -127,7 +130,6 @@ export const useRequest = (options:option = {
|
||||
|
||||
// 请求函数
|
||||
const fetchData = async (sub_options?:any) => {
|
||||
|
||||
stateRef.current.loading = true
|
||||
setState((e) => ({...e, loading:true}))
|
||||
stateRef.current.query = {
|
||||
@ -170,7 +172,7 @@ export const useRequest = (options:option = {
|
||||
stateRef.current.data = data
|
||||
stateRef.current.total = data?.list ? data?.total : 0
|
||||
if(code !== 0) {
|
||||
Taro.showToast({
|
||||
options.apiMsgStatus !== false &&Taro.showToast({
|
||||
title: `${msg}`,
|
||||
icon: 'none'
|
||||
})
|
||||
@ -183,7 +185,6 @@ export const useRequest = (options:option = {
|
||||
removeSessionKey()
|
||||
removeUserInfo()
|
||||
login()
|
||||
//todo 登录数据刷新次数问题
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: `错误:${showStatus(statusCode)}`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user