剪板流程
This commit is contained in:
@@ -102,18 +102,10 @@ export default () => {
|
||||
|
||||
//图片列表
|
||||
const PictureItem = memo(() => {
|
||||
const {uploadCDNImg} = useUploadCDNImg()
|
||||
const {getWxPhoto} = useUploadCDNImg()
|
||||
//图片
|
||||
const uploadImage = () => {
|
||||
Taro.chooseImage({
|
||||
count: 1, // 默认9
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: function (res) {
|
||||
const file = res.tempFiles[0]
|
||||
uploadCDNImg(file, 'product', 'product')
|
||||
}
|
||||
})
|
||||
const uploadImage = async () => {
|
||||
let res = await getWxPhoto('after-sale')
|
||||
}
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -53,7 +53,6 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
||||
const condition = useRef({physical_warehouse:adminUserInfo?.physical_warehouse, sale_mode:selectIndex, product_id:0, code_or_name:null})
|
||||
const getColorList = async () => {
|
||||
setLoading(() => true)
|
||||
console.log('数据:::',getFilterData(condition.current))
|
||||
let {data} = await colorFetchData(getFilterData(condition.current))
|
||||
let lists = initList(data.list)
|
||||
setList(() => [...lists])
|
||||
|
||||
+20
-17
@@ -15,6 +15,7 @@ import { AnalysisShortCodeApi, BindShortCodeApi, GetShortCodeApi } from '@/api/s
|
||||
import { SHARE_SCENE } from '@/common/enum';
|
||||
import useUserInfo from '@/use/useUserInfo';
|
||||
import LabAndImg from '@/components/LabAndImg';
|
||||
import { alert } from '@/common/common';
|
||||
|
||||
type item = {title:string, img:string, url:string, id:number}
|
||||
|
||||
@@ -114,17 +115,20 @@ export default (props:Params) => {
|
||||
setSortCode({... userObj.sort_code, shareShortDetail: {title: productName as string, code: resDetail.md5_key, img:''}})
|
||||
}
|
||||
|
||||
//开始下单
|
||||
const placeOrder = async (e:any) => {
|
||||
// try {
|
||||
// await getPhoneNumber(e.detail.code)
|
||||
// } catch(msg) {
|
||||
// Taro.showToast({
|
||||
// icon:"none",
|
||||
// title: msg
|
||||
// })
|
||||
// return false
|
||||
// }
|
||||
//授权手机号和下单
|
||||
const placeOrder = async (status = 'to_phone',e:any = {}) => {
|
||||
if(status == 'to_phone') {
|
||||
if(!e.detail.code) return alert.error('请授权手机号')
|
||||
try {
|
||||
await getPhoneNumber(e.detail.code)
|
||||
} catch(msg) {
|
||||
Taro.showToast({
|
||||
icon:"none",
|
||||
title: msg
|
||||
})
|
||||
return false
|
||||
}
|
||||
}
|
||||
setShowOrderCount(true)
|
||||
}
|
||||
|
||||
@@ -184,12 +188,11 @@ export default (props:Params) => {
|
||||
<View className={styles.text}>购物车</View>
|
||||
</View>
|
||||
{
|
||||
// !userInfo.adminUserInfo?.is_authorize_phone&&<View className={styles.buy_btn} >
|
||||
// <Button className={styles.phoneBtn} open-type="getPhoneNumber" onGetPhoneNumber={(e) => placeOrder(e)}></Button>
|
||||
// 开始下单
|
||||
// </View>
|
||||
// || <View className={styles.buy_btn} onClick={(e) => placeOrder(e)}>开始下单</View>
|
||||
<View className={styles.buy_btn} onClick={(e) => placeOrder(e)}>开始下单</View>
|
||||
(!userInfo.adminUserInfo?.is_authorize_phone)&&<View className={styles.buy_btn} >
|
||||
<Button className={styles.phoneBtn} open-type="getPhoneNumber" onGetPhoneNumber={(e) => placeOrder('to_phone',e)}></Button>
|
||||
开始下单
|
||||
</View>
|
||||
|| <View className={styles.buy_btn} onClick={() => placeOrder('to_order')}>开始下单</View>
|
||||
}
|
||||
</View>
|
||||
<CustomWrapper>
|
||||
|
||||
@@ -150,11 +150,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn";
|
||||
if (res.confirm) {
|
||||
const res = await saleOrderFetchData(submitOrderData)
|
||||
if(res.success) {
|
||||
if(preViewOrder?.sale_mode == 0) {
|
||||
goLink('/pages/order/index',{id: res.data.id}, 'redirectTo')
|
||||
} else if (preViewOrder?.sale_mode == 1) {
|
||||
goLink('/pages/order/cutOrder/index',{id: res.data.id}, 'redirectTo')
|
||||
}
|
||||
goLink('/pages/order/index',{id: res.data.id}, 'redirectTo')
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.order_address{
|
||||
height: 178px;
|
||||
background: #ffffff;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
@@ -26,16 +25,18 @@
|
||||
.order_address_text_title{
|
||||
font-size: $font_size_medium;
|
||||
margin-top: 10px;
|
||||
@include common_ellipsis;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.moreIconfont{
|
||||
font-size: 20px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
.address_text{
|
||||
word-break:break-all;
|
||||
}
|
||||
}
|
||||
.order_address_text_name{
|
||||
|
||||
margin-top: 30px;
|
||||
align-items: center;
|
||||
text{
|
||||
&:nth-child(1) {
|
||||
|
||||
@@ -97,7 +97,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue =
|
||||
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2?'icon-daohang':'icon-fahuo')}></View>
|
||||
<View className={styles.order_address_text_con}>
|
||||
<View className={styles.order_address_text_title}>
|
||||
<Text>{formatAddress}</Text>
|
||||
<Text className={styles.address_text}>{formatAddress}</Text>
|
||||
{(receivingStatus == 2)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
||||
</View>
|
||||
<View className={styles.order_address_text_name}>
|
||||
|
||||
@@ -97,12 +97,12 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
return priceInfo.value.includes(status)
|
||||
}, [order])
|
||||
|
||||
//金额展示
|
||||
//金额展示大货
|
||||
const priceConDom = useMemo(() => {
|
||||
if(!order) return
|
||||
if(comfirm == true) {
|
||||
//确认订单时
|
||||
return (order.sale_mode == 1)?<EstimatedAmount number={formatPriceDiv(order.total_should_collect_money)} title="合计金额" /> : <EstimatedAmount number={formatPriceDiv(order.estimate_amount)} title="预估金额" />
|
||||
return <EstimatedAmount number={formatPriceDiv(order.estimate_amount)} title="预估金额" />
|
||||
} else if(order?.status == SaleOrderStatusCancel.value) {
|
||||
//订单状态为取消订单时
|
||||
return (
|
||||
@@ -127,6 +127,22 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
)
|
||||
}
|
||||
}, [order])
|
||||
|
||||
//金额展示剪板
|
||||
const cutPriceConDom = useMemo(() => {
|
||||
if(!order) return
|
||||
return <EstimatedAmount number={formatPriceDiv(order.total_should_collect_money)} title="合计金额" />
|
||||
}, [order])
|
||||
|
||||
const showPriceAll = useMemo(() => {
|
||||
if(order?.sale_mode == 1) {
|
||||
return cutPriceConDom //剪板
|
||||
} else {
|
||||
return priceConDom //大货
|
||||
}
|
||||
|
||||
}, [order])
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -163,7 +179,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
})
|
||||
}
|
||||
<View className={styles.order_estimated_amount}>
|
||||
{priceConDom}
|
||||
{showPriceAll}
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
|
||||
@@ -8,26 +8,33 @@ import MCheckbox from "@/components/checkbox";
|
||||
import Popup from "@/components/popup";
|
||||
import OfflinePay from "../offlinePay";
|
||||
import ScanPay from "../scanPay";
|
||||
import { GetOrderPayApi, SubmitOrderPayApi } from "@/api/orderPay";
|
||||
import { GetOrderPayApi, SubmitOrderPayApi, GetPrepayOrderPayApi, SubmitPrepayOrderPayApi } from "@/api/orderPay";
|
||||
import { formatPriceDiv } from "@/common/fotmat";
|
||||
import {alert} from "@/common/common"
|
||||
import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
||||
import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
||||
|
||||
type Param = {
|
||||
show?: true|false,
|
||||
onClose?: () => void,
|
||||
onSubmitSuccess?: () => void, //支付成功
|
||||
orderInfo?: OrderInfo
|
||||
orderInfo?: OrderInfo,
|
||||
}
|
||||
|
||||
type OrderInfo = {
|
||||
orderId: number, //应付单id
|
||||
payment_method: 0|PAYMENT_METHOD_PARAM //支付方式
|
||||
should_collect_order_id?: number, //应付单id
|
||||
pre_collect_order_id?: number, //预付单id
|
||||
status?: number, //订单状态
|
||||
payment_method?: 0|PAYMENT_METHOD_PARAM //支付方式
|
||||
}
|
||||
|
||||
type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
|
||||
export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) => {
|
||||
|
||||
//支付方式枚举
|
||||
const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod, PaymentMethodCashOnDelivery} = PAYMENT_METHOD
|
||||
//订单状态枚举
|
||||
const {SaleorderstatusWaitingPrePayment} = ORDER_STATUS
|
||||
|
||||
//提交参数
|
||||
const [submitData, setSubmitData] = useState<{id:number, payment_method: PayStatus}>({
|
||||
id:0,
|
||||
@@ -38,7 +45,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
const [offlinePayShow, setofflinePayShow] = useState(false)
|
||||
const onShowOfflinePay = () => {
|
||||
setofflinePayShow(true)
|
||||
onClose?.()
|
||||
// onClose?.()
|
||||
}
|
||||
|
||||
//扫码支付
|
||||
@@ -51,13 +58,22 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
//获取支付方式数据
|
||||
const [payInfo, setPayInfo] = useState<any>()
|
||||
const {fetchData: orderFetchData} = GetOrderPayApi()
|
||||
const {fetchData: prepayOrderFetchData} = GetPrepayOrderPayApi()
|
||||
const getOrderPay = async () => {
|
||||
let {data} = await orderFetchData({id: orderInfo?.orderId})
|
||||
setPayInfo(() => data)
|
||||
if(orderInfo&&orderInfo.should_collect_order_id) {
|
||||
//有应收单id时用应收单获取数据
|
||||
let {data} = await orderFetchData({id: orderInfo?.should_collect_order_id})
|
||||
setPayInfo(() => data)
|
||||
} else {
|
||||
//用预付单id获取支付信息
|
||||
let {data} = await prepayOrderFetchData({id: orderInfo?.pre_collect_order_id})
|
||||
setPayInfo(() => data)
|
||||
}
|
||||
}
|
||||
useEffect(() => {
|
||||
if(show&&orderInfo?.orderId) {
|
||||
setSubmitData((val) => ({...val, id:orderInfo.orderId}))
|
||||
if(show&&orderInfo&&(orderInfo?.should_collect_order_id||orderInfo?.pre_collect_order_id)) {
|
||||
let id = orderInfo.should_collect_order_id||orderInfo.pre_collect_order_id
|
||||
setSubmitData((val) => ({...val, id:id as number}))
|
||||
getOrderPay()
|
||||
}
|
||||
}, [show, orderInfo])
|
||||
@@ -73,14 +89,20 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
}
|
||||
|
||||
//提交支付
|
||||
const {fetchData: submitFetchData} = SubmitOrderPayApi()
|
||||
const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交
|
||||
const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交
|
||||
const submitPay = async () => {
|
||||
if(submitData.payment_method === null) {
|
||||
alert.error('请选择支付方式')
|
||||
return false
|
||||
}
|
||||
alert.loading('正在支付')
|
||||
let res = await submitFetchData(submitData)
|
||||
let res:any = null
|
||||
if(orderInfo?.should_collect_order_id) {
|
||||
res = await submitFetchData(submitData)
|
||||
} else {
|
||||
res = await submitPrepayOrderFetchData(submitData)
|
||||
}
|
||||
if(res.success) {
|
||||
alert.success('支付成功')
|
||||
onSubmitSuccess?.()
|
||||
@@ -97,6 +119,17 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
)
|
||||
}, [payInfo])
|
||||
|
||||
//是否显示七天账期
|
||||
const show_account_payment = useMemo(() => {
|
||||
//支付方式是账期支付,不显示
|
||||
if(orderInfo?.payment_method == PaymentMethodAccountPeriod.value) return false
|
||||
//支付方式是货到付款,不显示
|
||||
if(orderInfo?.payment_method == PaymentMethodCashOnDelivery.value) return false
|
||||
//订单状态是预付款,不显示
|
||||
if(orderInfo?.status == SaleorderstatusWaitingPrePayment.value) return false
|
||||
return true
|
||||
}, [orderInfo])
|
||||
|
||||
//账期
|
||||
const account_peyment = useMemo(() => {
|
||||
const price = payInfo?.should_collect_money - payInfo?.amount_paid
|
||||
@@ -105,9 +138,6 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
)
|
||||
}, [payInfo])
|
||||
|
||||
//支付方式枚举
|
||||
const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod} = PAYMENT_METHOD
|
||||
|
||||
return (
|
||||
<View className={styles.payment_main}>
|
||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
||||
@@ -143,13 +173,12 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
</View>
|
||||
<MCheckbox status={submitData.payment_method == PaymentMethodPreDeposit.value} onSelect={() => advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/>
|
||||
</View>
|
||||
{(orderInfo?.payment_method != PaymentMethodAccountPeriod.value)&&<View className={styles.payment_list_item}>
|
||||
{show_account_payment&&<View className={styles.payment_list_item}>
|
||||
<View className={styles.payment_list_item_left}>
|
||||
<View className={styles.payment_list_item_left_name}>
|
||||
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
||||
<View className={styles.payment_list_item_left_text}>{payInfo?.account_period}天账期</View>
|
||||
</View>
|
||||
{/* <View className={styles.payment_list_item_left_price}>可用额度 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)}</View> */}
|
||||
{account_peyment}
|
||||
</View>
|
||||
<MCheckbox status={submitData.payment_method == PaymentMethodAccountPeriod.value} onSelect={() => periodSelectData(PaymentMethodAccountPeriod.value)} onClose={() => periodSelectData(null)}/>
|
||||
|
||||
@@ -63,19 +63,17 @@
|
||||
}
|
||||
}
|
||||
.submit_order{
|
||||
display: flex;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
justify-content: flex-end;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16);
|
||||
padding: 20px 20px;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
// padding-bottom: constant(safe-area-inset-bottom);
|
||||
// padding-bottom: env(safe-area-inset-bottom);
|
||||
.order_btn {
|
||||
width: 152px;
|
||||
height: 72px;
|
||||
|
||||
@@ -115,10 +115,10 @@ import styles from './index.module.scss'
|
||||
}, [])
|
||||
|
||||
//支付所需数据
|
||||
const payOrderInfo = useMemo(() => {
|
||||
if(orderDetail)
|
||||
return {orderId: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method }
|
||||
}, [orderDetail])
|
||||
// const payOrderInfo = useMemo(() => {
|
||||
// if(orderDetail)
|
||||
// return {should_collect_order_id: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method, pre_collect_order_id:orderDetail.pre_collect_order_id}
|
||||
// }, [orderDetail])
|
||||
|
||||
//去付款
|
||||
const [payMentShow, setPayMentShow] = useState(false)
|
||||
@@ -217,11 +217,12 @@ import styles from './index.module.scss'
|
||||
</View>
|
||||
{(orderDetail?.status != SaleOrderStatusCancel.value)&&<View className={styles.submit_order}>
|
||||
<OrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
||||
<View className="common_safe_area_y"></View>
|
||||
</View> }
|
||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)} >
|
||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||
<Remark onSave={(e) => getRemark(e)}/>
|
||||
</Popup>
|
||||
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={payOrderInfo} />
|
||||
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={orderDetail} />
|
||||
<View className="common_safe_area_y"></View>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -131,7 +131,7 @@ export default () => {
|
||||
<OrderStatusList list={statusList} onSelect={changeStatus} defaultId={1}/>
|
||||
</View>
|
||||
<View className={styles.order_list}>
|
||||
<InfiniteScroll statusMore={statusMore} selfonScrollToLower={getScrolltolower} refresherEnabled={true} refresherTriggered={refresherTriggeredStatus} selfOnRefresherRefresh={getRefresherRefresh}>
|
||||
<InfiniteScroll statusMore={statusMore} selfonScrollToLower={getScrolltolower} refresherEnabled={false} refresherTriggered={refresherTriggeredStatus} selfOnRefresherRefresh={getRefresherRefresh}>
|
||||
{orderData?.list.map(item => {
|
||||
return <View key={item.id} className={styles.order_item_con}> <Order value={item} onClickBtn={clickOrderBtn}/></View>
|
||||
})}
|
||||
|
||||
@@ -69,7 +69,7 @@ export default () => {
|
||||
<View className={styles.search}>
|
||||
<Search style={{width: '100%'}} placeholder="请输入面料关键词" placeIcon="out" showBtn={true} clickOnSearch={(e) => searchEvent(e)}/>
|
||||
</View>
|
||||
<View className={styles.up_search} onClick={() => goLink('/pages/searchList/searchList')}>高级搜索</View>
|
||||
<View className={styles.up_search} onClick={() => goLink('/pages/searchList/hightSearchList')}>高级搜索</View>
|
||||
{searchData?.hotField.length > 0 && <View className={styles.hot}>
|
||||
<View className={styles.hot_header}>
|
||||
<View className={styles.hot_header_title}>热门面料</View>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useSelector } from "@/reducers/hooks";
|
||||
import { GetAdminUserInfoApi } from "@/api/user";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import useLogin from '@/use/useLogin'
|
||||
import {BASE_URL} from '@/common/constant'
|
||||
|
||||
export default () => {
|
||||
// 用户信息
|
||||
@@ -31,6 +32,8 @@ export default () => {
|
||||
<Assets />
|
||||
<Main />
|
||||
<Modal data={adminUserInfo}/>
|
||||
{/* 测试暂时添加 */}
|
||||
<View style={{fontSize:'26rpx', textAlign:'center'}}>{BASE_URL}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user