合并电子商城测试版v4
This commit is contained in:
commit
33c4401d54
@ -33,4 +33,26 @@ export const DelFavoriteApi = () => {
|
||||
url: `/v1/mall/favorite`,
|
||||
method: "delete",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新收藏夹
|
||||
* @returns
|
||||
*/
|
||||
export const UpdateFavoriteApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/favorite`,
|
||||
method: "put",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入收藏夹
|
||||
* @returns
|
||||
*/
|
||||
export const AddFavoriteApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/favorite/product`,
|
||||
method: "post",
|
||||
})
|
||||
}
|
||||
@ -99,4 +99,14 @@ export const ReceiveOrderApi = () => {
|
||||
url: `/v1/mall/saleOrder/receive`,
|
||||
method: "put",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态列表
|
||||
*/
|
||||
export const OrderStatusListApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/enum/filterSaleOrderStatus`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
@ -99,4 +99,14 @@ export const GetSaleOrderListApi = () => {
|
||||
url: `/v1/mall/enum/filterReturnStage`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款说明
|
||||
*/
|
||||
export const RefundExplainApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/enum/refundExplain`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
import { useRequest } from "@/use/useHttp"
|
||||
|
||||
/**
|
||||
* 解密用户微信信息
|
||||
*/
|
||||
@ -68,4 +67,25 @@ import { useRequest } from "@/use/useHttp"
|
||||
url: `/v1/mall/user/binding/company`,
|
||||
method: "put",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请下单权限
|
||||
*/
|
||||
export const ApplyOrderAccessApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/orderAccess/apply`,
|
||||
method: "post",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订阅模板id
|
||||
*/
|
||||
export const SubscriptionMessageApi = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/subscriptionMessage`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -176,6 +176,7 @@ export default {
|
||||
root: "pages/collection",
|
||||
pages: [
|
||||
"index",
|
||||
"collectionClass/index"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -4,13 +4,14 @@
|
||||
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
||||
// export const BASE_URL = `http://192.168.0.89:40001/lymarket`
|
||||
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
|
||||
// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
|
||||
export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
|
||||
// export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发
|
||||
// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发
|
||||
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
||||
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
||||
// export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境
|
||||
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
||||
export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
||||
// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
||||
// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰
|
||||
|
||||
// CDN
|
||||
|
||||
@ -29,13 +29,13 @@ export const AFTER_ORDER_STATUS = {
|
||||
|
||||
//支付方式
|
||||
export const PAYMENT_METHOD = {
|
||||
PaymentMethodPreDeposit: {value:1, label:'预存款'},
|
||||
PaymentMethodAccountPeriod : {value:2, label:'账期'},
|
||||
PaymentMethodofflineRemittance: {value:0, label:'线下汇款'},
|
||||
PaymentMethodScanCodeToPay: {value:3, label:'扫码支付'},
|
||||
PaymentMethodCashOnDelivery: {value:4, label:'货到付款'},
|
||||
PaymentMethodPreDeposit: {value:2, label:'预存款'},
|
||||
PaymentMethodAccountPeriod : {value:3, label:'账期'},
|
||||
PaymentMethodofflineRemittance: {value:1, label:'线下汇款'},
|
||||
PaymentMethodScanCodeToPay: {value:4, label:'扫码支付'},
|
||||
PaymentMethodCashOnDelivery: {value:5, label:'货到付款'},
|
||||
}
|
||||
export type PAYMENT_METHOD_PARAM = 0|1|2|3|4
|
||||
export type PAYMENT_METHOD_PARAM = 1|2|3|4|5
|
||||
|
||||
|
||||
//订单类型
|
||||
@ -50,3 +50,25 @@ export const SHARE_SCENE = {
|
||||
ShareDetail: {value:1, label:'详情分享'},
|
||||
SharePage : {value:2, label:'页面分享'},
|
||||
}
|
||||
|
||||
//订阅消息
|
||||
export const SUBSCRIPTION_MESSAGE_SCENE = {
|
||||
SubmitOrder: {value:1, label:'确认下单'},
|
||||
ToPay : {value:2, label:'去付款'},
|
||||
ApplyGoods: {value:3, label: '申请退款'}
|
||||
}
|
||||
|
||||
//应收单退款状态枚举
|
||||
export const REFUND_STATUS = {
|
||||
ShouldCollectOrderRefundTypeUnknown: {value:0, label:'未知退款'},
|
||||
ShouldCollectOrderRefundTypeAdvanceReceiptRefund: {value:1, label:'预收退款'},
|
||||
ShouldCollectOrderRefundTypeReturnForRefund: {value:2, label:'退货退款'},
|
||||
ShouldCollectOrderRefundTypeSalesRefund: {value:3, label:'销售退款'},
|
||||
}
|
||||
|
||||
//申请单退款状态枚举
|
||||
export const REFUND_STATUS_ORDER = {
|
||||
ReturnApplyOrderTypeAdvanceReceiptRefund: {value:1, label:'预收退款'}, // 预收退款
|
||||
ReturnApplyOrderTypeReturnForRefund: {value:2, label:'退货退款'}, // 退货退款
|
||||
ReturnApplyOrderTypeSalesRefund: {value:3, label:'销售退款'}, // 销售退款
|
||||
}
|
||||
@ -24,7 +24,6 @@ export const throttle = (fn, delay) => {
|
||||
let pre = 0;
|
||||
return (...params) => {
|
||||
let now = new Date().getTime();
|
||||
console.log('相差:',now-pre)
|
||||
if (now - pre > delay) {
|
||||
fn(...params);
|
||||
pre = now;
|
||||
@ -39,15 +38,15 @@ export const throttle = (fn, delay) => {
|
||||
* @param {Array} arr 排除过滤的属性
|
||||
* @returns
|
||||
*/
|
||||
export const getFilterData = (val = {}, arr = []) => {
|
||||
export const getFilterData = (val = {}, arr: string[] = []) => {
|
||||
let res = {}
|
||||
for(let key in val) {
|
||||
if(val[key]!==undefined&&val[key]!==null&&val[key]!==''&&(!arr.includes(key))){
|
||||
if(val[key] instanceof Number){
|
||||
if(typeof val[key] == 'number'){
|
||||
if(!isNaN(val[key])) {
|
||||
res[key] = val[key]
|
||||
}
|
||||
}else{
|
||||
} else{
|
||||
res[key] = val[key]
|
||||
}
|
||||
}
|
||||
|
||||
47
src/components/addCollection/index.module.scss
Normal file
47
src/components/addCollection/index.module.scss
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
.collection_con{
|
||||
padding: 20px ;
|
||||
.header{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
.title{
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.miconfont_con{
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 0;
|
||||
font-size: 26px;
|
||||
color: #007AFF;
|
||||
.miconfont{
|
||||
font-size: 30px;
|
||||
color: #007AFF;
|
||||
border: 1px solid #007AFF;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.scrollView{
|
||||
height: 60vh;
|
||||
}
|
||||
.collection_item{
|
||||
padding: 30px 0 15px 0;
|
||||
border-bottom: 1px solid #F3F3F3;
|
||||
.name{
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
text{
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
.desc{
|
||||
font-size: 22px;
|
||||
color: #707070;
|
||||
padding-left: 10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
src/components/addCollection/index.tsx
Normal file
49
src/components/addCollection/index.tsx
Normal file
@ -0,0 +1,49 @@
|
||||
import Popup from "@/components/popup";
|
||||
import { Input, ScrollView, Text, View } from "@tarojs/components";
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import TextareaEnhance from "@/components/textareaEnhance";
|
||||
import { CreateFavoriteApi, FavoriteListApi } from "@/api/favorite";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import { getFilterData } from "@/common/util";
|
||||
|
||||
//原因选择
|
||||
type ReasonInfoParam = {
|
||||
show?: boolean, //显示
|
||||
onClose?: () => void, //关闭
|
||||
onAdd?: (val: any) => void
|
||||
|
||||
}
|
||||
export default memo(({show = false, onClose, onAdd}: ReasonInfoParam) => {
|
||||
//获取列表
|
||||
const [list, setList] = useState([])
|
||||
const {fetchData: fetchDataList} = FavoriteListApi()
|
||||
const getFavoriteList = async () => {
|
||||
let res = await fetchDataList(getFilterData())
|
||||
setList(() => res.data.list)
|
||||
}
|
||||
useEffect(() => {
|
||||
if(show) getFavoriteList()
|
||||
}, [show])
|
||||
|
||||
return (
|
||||
<Popup show={show} onClose={onClose} showTitle={false} >
|
||||
<View className={styles.collection_con}>
|
||||
<View className={styles.header}>
|
||||
<Text className={styles.title}>选择文件夹</Text>
|
||||
<View className={styles.miconfont_con} >
|
||||
<Text className={classnames(styles.miconfont, 'iconfont icon-jia')}></Text>
|
||||
<Text onClick={() => goLink('/pages/collection/index')}>新建</Text>
|
||||
</View>
|
||||
</View>
|
||||
<ScrollView scrollY className={styles.scrollView}>
|
||||
{list?.map((item: any) => <View onClick={() => onAdd?.(item)} className={styles.collection_item}>
|
||||
<View className={styles.name}>{item.name}<Text>({item.product_color_list?.length||0})</Text></View>
|
||||
<View className={styles.desc}>{item.remark}</View>
|
||||
</View>)}
|
||||
</ScrollView>
|
||||
</View>
|
||||
</Popup>
|
||||
)
|
||||
})
|
||||
@ -1,3 +1,40 @@
|
||||
.submit_order{
|
||||
display: flex;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
justify-content: flex-end;
|
||||
width: 100%;
|
||||
height: 175px;
|
||||
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);
|
||||
.order_btn {
|
||||
width: 152px;
|
||||
height: 72px;
|
||||
border: 2px solid #dddddd;
|
||||
border-radius: 46px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: $color_font_three;
|
||||
&:nth-child(n+2) {
|
||||
margin-left: 34px;
|
||||
}
|
||||
}
|
||||
.order_btn_select{
|
||||
color: $color_main;
|
||||
border: 2px solid $color_main;
|
||||
}
|
||||
.order_number_desc{
|
||||
font-size: $font_size_medium;
|
||||
color: $color_font_two;
|
||||
}
|
||||
}
|
||||
.btns_list{
|
||||
width: 100%;
|
||||
// margin-top: 30px;
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||
import { alert } from "@/common/common"
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS, SALE_MODE } from "@/common/enum"
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from "@/common/enum"
|
||||
import {Text, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro"
|
||||
import {useRef, memo, useState, useMemo } from "react"
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { ReturnApplyOrderCancelApi } from "@/api/salesAfterOrder"
|
||||
import { throttle } from "@/common/util"
|
||||
|
||||
type Param = {
|
||||
orderInfo: {
|
||||
@ -17,10 +18,11 @@ type Param = {
|
||||
return_apply_order_id: number //售后申请单
|
||||
},
|
||||
onClick?: (val: number) => void, //点击后触发的事件,返回订单状态
|
||||
onBtnNull?: () => void //所有按钮都为空
|
||||
fixedBottom?: true|false, //是否固定在底部
|
||||
|
||||
}
|
||||
|
||||
export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
||||
export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
||||
//售后订单状态
|
||||
const {
|
||||
ReturnStageApplying,
|
||||
@ -30,6 +32,12 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
||||
ReturnStageServiceOrderPendingRefund,
|
||||
} = AFTER_ORDER_STATUS
|
||||
|
||||
const {
|
||||
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||
ReturnApplyOrderTypeSalesRefund // 销售退款
|
||||
} = REFUND_STATUS_ORDER
|
||||
|
||||
//订单类型
|
||||
// const {
|
||||
// SaLeModeBulk,
|
||||
@ -39,68 +47,61 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
||||
|
||||
//售后按钮按售后状态归类, value是该订单状态,可能该按钮会出现
|
||||
const orderBtnsList = useRef([
|
||||
{
|
||||
id: 8,
|
||||
big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value],
|
||||
cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value ],
|
||||
model_value: [],
|
||||
label: '申请记录'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
value: [ReturnStageApplying.value, ReturnStageWaitCheck.value],
|
||||
big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value],
|
||||
cut_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value, ],
|
||||
model_value: [],
|
||||
label: '取消退货'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: [ReturnStageWaitCheck.value],
|
||||
label: '退货物流'
|
||||
},
|
||||
// {
|
||||
// id: 3,
|
||||
// value: [ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value],
|
||||
// label: '查看物流'
|
||||
// },
|
||||
{
|
||||
id: 4,
|
||||
value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||
big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||
cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||
model_value: [],
|
||||
label: '质检结果'
|
||||
},
|
||||
// {
|
||||
// id: 5,
|
||||
// value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||
// label: '退货码单'
|
||||
// },
|
||||
{
|
||||
id: 6,
|
||||
value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value],
|
||||
big_value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value],
|
||||
cut_value: [ReturnStageWaitCheck.value, ReturnStageApplying.value],
|
||||
model_value: [ReturnStageApplying.value],
|
||||
label: '取消退款'
|
||||
},
|
||||
// {
|
||||
// id: 7,
|
||||
// value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||
// label: '退款码单'
|
||||
// },
|
||||
{
|
||||
id: 8,
|
||||
value: [],
|
||||
label: '申请记录'
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
|
||||
//判断是否显示该按钮
|
||||
const orderBtnsShow = (item) => {
|
||||
if(!orderInfo) return false
|
||||
let key = ['big_value', 'model_value', 'cut_value']
|
||||
if(item.id == 1) {
|
||||
//取消退货
|
||||
return (orderInfo.type == 1)&&item.value.includes(orderInfo.stage)
|
||||
return (orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
} else if (item.id == 6) {
|
||||
//取消退款
|
||||
return (orderInfo.type == 2)&&item.value.includes(orderInfo.stage)
|
||||
if(orderInfo?.sale_mode == 0) {
|
||||
return (orderInfo.type != ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
} else {
|
||||
return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
}
|
||||
} else if (item.id == 4) {
|
||||
//质检结果
|
||||
return (orderInfo?.type == 1)&&item.value.includes(orderInfo.stage) //退货才有
|
||||
return (orderInfo?.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有
|
||||
} else {
|
||||
return item.value.includes(orderInfo.stage)
|
||||
return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
}
|
||||
}
|
||||
|
||||
//显示的按钮数组
|
||||
const orderBtnsShowList: {id: number, value: any, label: string}[] = useMemo(() => {
|
||||
const orderBtnsShowList: any[] = useMemo(() => {
|
||||
return orderBtnsList.current.filter(item => {
|
||||
return orderBtnsShow(item)
|
||||
})
|
||||
@ -109,19 +110,19 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
||||
|
||||
|
||||
//点击按钮操作
|
||||
const submitBtns = (val, index) => {
|
||||
const submitBtns = throttle((val, index) => {
|
||||
if (val == 1) {
|
||||
cancelOrder({title:'要取消退货吗?'})
|
||||
cancelOrder({title:'要取消退货吗?', val})
|
||||
} else if (val == 6) {
|
||||
cancelOrder({title:'要取消退款吗?'})
|
||||
cancelOrder({title:'要取消退款吗?', val})
|
||||
} else {
|
||||
onClick?.(val)
|
||||
}
|
||||
}
|
||||
}, 600)
|
||||
|
||||
//取消退货/退款
|
||||
const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi()
|
||||
const cancelOrder = ({title = ''}) => {
|
||||
const cancelOrder = ({title = '', val}) => {
|
||||
Taro.showModal({
|
||||
title,
|
||||
success: async function (res) {
|
||||
@ -129,7 +130,7 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
||||
let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id})
|
||||
if(res.success) {
|
||||
alert.success('取消成功')
|
||||
onClick?.(1)
|
||||
onClick?.(val)
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
@ -147,25 +148,28 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
||||
}, [orderBtnsShowList])
|
||||
|
||||
return (
|
||||
<View className={styles.btns_list}>
|
||||
{(orderBtnsShowList.length > 3)&&<View className={styles.more}>
|
||||
<Text onClick={() => setShowMore(true)}>更多</Text>
|
||||
{showMore&&<View className={styles.more_con}>
|
||||
<View className={styles.more_list} style={styleTop}>
|
||||
{orderBtnsShowList.map((item, index) => {
|
||||
return ((index >= 3) &&<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>{item.label}</View>)
|
||||
})}
|
||||
</View>
|
||||
<View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View>
|
||||
</View>}
|
||||
</View>}
|
||||
<>
|
||||
{(orderBtnsShowList.length > 0)&&<View className={classnames(fixedBottom&&styles.submit_order)}>
|
||||
<View className={styles.btns_list}>
|
||||
{(orderBtnsShowList.length > 3)&&<View className={styles.more}>
|
||||
<Text onClick={() => setShowMore(true)}>更多</Text>
|
||||
{showMore&&<View className={styles.more_con}>
|
||||
<View className={styles.more_list} style={styleTop}>
|
||||
{orderBtnsShowList.map((item, index) => {
|
||||
return ((index >= 3) &&<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>{item.label}</View>)
|
||||
})}
|
||||
</View>
|
||||
<View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View>
|
||||
</View>}
|
||||
</View>}
|
||||
|
||||
<View className={styles.list_scroll}>
|
||||
{orderBtnsShowList.map((item, index) =>
|
||||
(index < 3)&&<View key={item.id} className={classnames(styles.btns_item)} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
<View className={styles.list_scroll}>
|
||||
{orderBtnsShowList.map((item, index) =>
|
||||
(index < 3)&&<View key={item.id} className={classnames(styles.btns_item)} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
})
|
||||
@ -12,6 +12,7 @@
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.no_checkbox_item{
|
||||
border:0;
|
||||
|
||||
@ -14,7 +14,21 @@
|
||||
align-items: center;
|
||||
z-index:999;
|
||||
.shop_icon{
|
||||
font-size: 50px;
|
||||
font-size: 70px;
|
||||
color: $color_main;
|
||||
}
|
||||
.product_num{
|
||||
position: absolute;
|
||||
font-size: 23px;
|
||||
background-color: red;
|
||||
color: #fff;
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
padding: 0 6px;
|
||||
border-radius: 72px;
|
||||
min-width: 25px;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ import Taro, { useReady } from "@tarojs/taro"
|
||||
import { ReactElement, useEffect, useRef, useState } from "react"
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { GetShoppingCartApi } from "@/api/shopCart";
|
||||
|
||||
type param = {
|
||||
children?: ReactElement|null,
|
||||
@ -22,6 +23,19 @@ export default ({children = null, onClick}:param) => {
|
||||
setShowMoveBtn(true)
|
||||
})
|
||||
|
||||
//获取数据
|
||||
const [list, setList] = useState<any[]>([])
|
||||
const {fetchData} = GetShoppingCartApi()
|
||||
const getShoppingCart = async () => {
|
||||
const {data} = await fetchData()
|
||||
let color_list = data.color_list||[]
|
||||
setList(color_list)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getShoppingCart()
|
||||
}, [])
|
||||
|
||||
const dragEnd = (e) => {
|
||||
|
||||
}
|
||||
@ -31,6 +45,7 @@ export default ({children = null, onClick}:param) => {
|
||||
{children}
|
||||
{showMoveBtn&&<MovableView onClick={onClick} className={styles.moveBtn} direction="all" inertia={true} x="630rpx" y={screenHeight+'rpx'} onTouchEnd={(e) => dragEnd(e)}>
|
||||
<View className={classnames('iconfont','icon-gouwuche', styles.shop_icon) } ></View>
|
||||
{(list.length > 0)&&<View className={styles.product_num}>{list.length > 99?'99+':list.length}</View>}
|
||||
</MovableView>}
|
||||
</MovableArea>
|
||||
)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||
import { alert, goLink } from "@/common/common"
|
||||
import { ORDER_STATUS, SALE_MODE } from "@/common/enum"
|
||||
import { ORDER_STATUS, SALE_MODE, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum"
|
||||
import {Text, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro"
|
||||
import {useRef, memo, useState, useMemo } from "react"
|
||||
@ -8,6 +8,8 @@ import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { AddShoppingCartApi } from "@/api/shopCart"
|
||||
import { ApplyRefundApi } from "@/api/salesAfterOrder"
|
||||
import { UseSubscriptionMessage } from "@/use/useCommonData"
|
||||
import { throttle } from "@/common/util"
|
||||
|
||||
type Param = {
|
||||
orderInfo: {
|
||||
@ -126,22 +128,42 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
})
|
||||
}, [orderInfo])
|
||||
|
||||
|
||||
//订阅消息
|
||||
const {ApplyGoods} = SUBSCRIPTION_MESSAGE_SCENE
|
||||
const {openSubscriptionMessage} = UseSubscriptionMessage()
|
||||
|
||||
//点击按钮操作
|
||||
const submitBtns = (val, index) => {
|
||||
const submitBtns = throttle(async (val, index) => {
|
||||
if (val == 1) {
|
||||
cancelOrder()
|
||||
} else if (val == 6) {
|
||||
receiveOrder()
|
||||
} else if(val == 5) {
|
||||
if(!orderInfo?.av_return_roll) return alert.none('该订单没有可退条数')
|
||||
goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
|
||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
||||
goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
|
||||
} else if (val == 3) {
|
||||
bigApplyRefurn()
|
||||
} else if(val == 8) {
|
||||
applyRefund()
|
||||
} else {
|
||||
onClick?.(val)
|
||||
}
|
||||
}, 600)
|
||||
|
||||
//大货申请退款
|
||||
const bigApplyRefurn = () => {
|
||||
Taro.showModal({
|
||||
title: '要申请退款吗?',
|
||||
success: async function (res) {
|
||||
if(res.confirm) {
|
||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
||||
onClick?.(3)
|
||||
} else {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//取消订单
|
||||
@ -168,7 +190,6 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
//确认订单
|
||||
const {fetchData: receiveOrderFetchData} = ReceiveOrderApi()
|
||||
const receiveOrder = async () => {
|
||||
console.log('123456')
|
||||
Taro.showModal({
|
||||
title: '确定收货?',
|
||||
success: async function (res) {
|
||||
@ -195,6 +216,7 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
title: '确定退款?',
|
||||
success: async function async (res) {
|
||||
if(res.confirm) {
|
||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
||||
let res = await fetchDataApplyRefund({sale_order_id: orderInfo?.orderId})
|
||||
if(res.success) {
|
||||
alert.success('申请成功')
|
||||
|
||||
@ -51,15 +51,16 @@
|
||||
.tag_list{
|
||||
display: flex;
|
||||
margin-top: 16px;
|
||||
flex-wrap: wrap;
|
||||
.tag, .tag_g{
|
||||
max-width: 260rpx;
|
||||
padding: 3px 10px;
|
||||
background-color: #CDE5FF;
|
||||
font-size: $font_size_min;
|
||||
border-radius: 5px;
|
||||
color: $color_main;
|
||||
&:nth-child(2) {
|
||||
margin-left: 10px;
|
||||
}
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.tag_g{
|
||||
background-color: #FFE6CE;
|
||||
@ -69,7 +70,7 @@
|
||||
.introduce{
|
||||
font-size: $font_size_medium;
|
||||
color: $color_font_two;
|
||||
margin-top: 16px;
|
||||
|
||||
}
|
||||
.des{
|
||||
font-size:$font_size_medium;
|
||||
|
||||
@ -13,6 +13,7 @@ import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||
import { setParam } from "@/common/system";
|
||||
import { debounce } from "@/common/util";
|
||||
import Counter from "../counter";
|
||||
import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from "@/api/user";
|
||||
|
||||
type param = {
|
||||
show?: true|false,
|
||||
@ -25,6 +26,7 @@ export default ({show = false, onClose}: param) => {
|
||||
{value:2,title:'散剪', unit:'米', eunit:'kg', step:1, digits:2, minNum:5, maxNum:100000, defaultNum:10},
|
||||
]
|
||||
|
||||
//切换面料类型
|
||||
const [selectIndex, setSelectIndex] = useState(0)
|
||||
const selectProduct = (index:number) => {
|
||||
setSelectIndex(index)
|
||||
@ -35,16 +37,18 @@ export default ({show = false, onClose}: param) => {
|
||||
setSelectStatus(true)
|
||||
}, [selectIndex])
|
||||
|
||||
|
||||
|
||||
//重置勾选数据
|
||||
const resetList = () => {
|
||||
list?.map(item => {
|
||||
if(selectIndex == item.sale_mode || selectIndex == -1) {
|
||||
item.select = true
|
||||
checkboxData[item.id] = true
|
||||
} else {
|
||||
item.select = false
|
||||
checkboxData[item.id] = false
|
||||
}
|
||||
})
|
||||
setList([...list])
|
||||
setCheckboxData(() => ({...checkboxData}))
|
||||
}
|
||||
|
||||
//获取数据
|
||||
@ -59,12 +63,17 @@ export default ({show = false, onClose}: param) => {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
//初始化全部数据
|
||||
//初始化全部数据默认勾选
|
||||
const [checkboxData, setCheckboxData] = useState<{[index:number]:true|false}>({})
|
||||
const initStatus = useRef(false)
|
||||
const initList = (color_list) => {
|
||||
color_list?.map(item => {
|
||||
if(selectIndex == item.sale_mode) item.select = true
|
||||
item.count = formatCount(item)
|
||||
})
|
||||
if(initStatus.current) {
|
||||
color_list?.map(item => {
|
||||
if(selectIndex == item.sale_mode) checkboxData[item.id] = true
|
||||
})
|
||||
initStatus.current = false
|
||||
}
|
||||
setCheckboxData(() => checkboxData)
|
||||
}
|
||||
|
||||
//显示是展示数据
|
||||
@ -74,6 +83,7 @@ export default ({show = false, onClose}: param) => {
|
||||
setSelectIndex(0)
|
||||
} else {
|
||||
setLoading(true)
|
||||
initStatus.current = true
|
||||
getShoppingCart()
|
||||
}
|
||||
}, [show])
|
||||
@ -94,17 +104,17 @@ export default ({show = false, onClose}: param) => {
|
||||
const selectAll = () => {
|
||||
list.map(item => {
|
||||
if(selectIndex == item.sale_mode || selectIndex == -1)
|
||||
item.select = !selectStatus
|
||||
checkboxData[item.id] = !selectStatus
|
||||
})
|
||||
setSelectStatus(!selectStatus)
|
||||
setList([...list])
|
||||
setCheckboxData(() => ({...checkboxData}))
|
||||
}
|
||||
|
||||
//checkbox选中回调
|
||||
const selectCallBack = (item) => {
|
||||
item.select = true
|
||||
checkboxData[item.id] = true
|
||||
checkSelect()
|
||||
setList([...list])
|
||||
setCheckboxData(() => ({...checkboxData}))
|
||||
}
|
||||
|
||||
//checkbox选中判断是否全部选中,全部选中后是全选,否则反选
|
||||
@ -114,7 +124,7 @@ export default ({show = false, onClose}: param) => {
|
||||
list?.map(item => {
|
||||
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||
list_count ++
|
||||
if(item.select) select_count++
|
||||
if(checkboxData[item.id]) select_count++
|
||||
}
|
||||
})
|
||||
setSelectStatus(select_count == list_count)
|
||||
@ -122,9 +132,9 @@ export default ({show = false, onClose}: param) => {
|
||||
|
||||
//checkbox关闭回调
|
||||
const colseCallBack = (item) => {
|
||||
item.select = false
|
||||
checkboxData[item.id] = false
|
||||
checkSelect()
|
||||
setList([...list])
|
||||
setCheckboxData(() => ({...checkboxData}))
|
||||
}
|
||||
|
||||
//popup关闭
|
||||
@ -170,7 +180,7 @@ export default ({show = false, onClose}: param) => {
|
||||
selectIds.current = []
|
||||
list?.map(item => {
|
||||
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||
item.select&&selectIds.current.push(item.id)
|
||||
checkboxData[item.id]&&selectIds.current.push(item.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -198,7 +208,7 @@ export default ({show = false, onClose}: param) => {
|
||||
let color_count = 0 //颜色数量
|
||||
let all_count = 0 //总数量
|
||||
list.map(item => {
|
||||
if(item.select) {
|
||||
if(checkboxData[item.id]) {
|
||||
estimate_amount += item.estimate_amount
|
||||
product_list.add(item.product_id)
|
||||
color_count++
|
||||
@ -207,11 +217,30 @@ export default ({show = false, onClose}: param) => {
|
||||
})
|
||||
let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米'
|
||||
return {price: Number(formatPriceDiv(estimate_amount)).toFixed(2), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count}
|
||||
},[list])
|
||||
},[list, checkboxData])
|
||||
|
||||
|
||||
//去结算
|
||||
const orderDetail = debounce(() => {
|
||||
const {fetchData: useFetchData} = GetAdminUserInfoApi()
|
||||
const {fetchData: applyOrderAccessFetchData} = ApplyOrderAccessApi()
|
||||
const orderDetail = debounce( async () => {
|
||||
let res = await useFetchData()
|
||||
if(res.data.order_access_status !== 3) {
|
||||
if(res.data.order_access_status == 1) applyOrderAccessFetchData()
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
content: '暂未开通下单权限功能,稍后有客服联系您,请注意接受电话。',
|
||||
cancelText: '联系客服',
|
||||
confirmText: '我知道',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
return false
|
||||
}
|
||||
getSelectId()
|
||||
if(selectIds.current.length == 0) {
|
||||
alert.error('请选择面料')
|
||||
@ -223,6 +252,7 @@ export default ({show = false, onClose}: param) => {
|
||||
}
|
||||
}, 500)
|
||||
|
||||
|
||||
//计数组件-当后端修改完成才修改前端显示
|
||||
const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi()
|
||||
const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false)
|
||||
@ -236,12 +266,12 @@ export default ({show = false, onClose}: param) => {
|
||||
getShoppingCart()
|
||||
}
|
||||
}, 300)
|
||||
|
||||
|
||||
return (
|
||||
<View className={styles.shop_cart_main}>
|
||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()} >
|
||||
<View className={styles.popup_con}>
|
||||
<View className={styles.header}>
|
||||
<View className={styles.header}>
|
||||
<View onClick={selectAll}>{!selectStatus?'全选':'反选'}</View>
|
||||
<View onClick={delSelect}>
|
||||
<text className={classnames('iconfont', 'icon-shanchu', styles.miconfont)}></text>
|
||||
@ -261,7 +291,7 @@ export default ({show = false, onClose}: param) => {
|
||||
{list?.map((item, index) => {
|
||||
return <View key={index} className={classnames(styles.product_item, (selectIndex!=-1&&selectIndex!= item.sale_mode)&&styles.no_product_item_select)}>
|
||||
<View className={styles.checkbox}>
|
||||
<MCheckbox disabled={selectIndex!=-1&&selectIndex!=item.sale_mode} status={item.select} onSelect={() => selectCallBack(item)} onClose={() => colseCallBack(item)}/>
|
||||
<MCheckbox disabled={selectIndex!=-1&&selectIndex!=item.sale_mode} status={!!checkboxData[item.id]} onSelect={() => selectCallBack(item)} onClose={() => colseCallBack(item)}/>
|
||||
</View>
|
||||
<View className={styles.img}>
|
||||
<Image mode="aspectFill" src={formatImgUrl(item.texture_url)}/>
|
||||
@ -272,12 +302,12 @@ export default ({show = false, onClose}: param) => {
|
||||
<View className={styles.tag}>{item.sale_mode_name}</View>
|
||||
</View>
|
||||
<View className={styles.count}>
|
||||
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/{selectList[selectIndex].eunit}</text></View>
|
||||
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/{selectList[item.sale_mode].eunit}</text></View>
|
||||
{/* <View className={styles.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
|
||||
<View className={styles.btn_count}>
|
||||
<Counter
|
||||
onBlue={(e) => getInputValue(e, item)}
|
||||
defaultNum={item.count}
|
||||
defaultNum={formatCount(item)}
|
||||
step={selectList[selectIndex].step}
|
||||
digits={selectList[selectIndex].digits}
|
||||
onClickBtn={(e) => getInputValue(e, item)}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import {Textarea, View } from "@tarojs/components";
|
||||
import { memo, useMemo, useState } from "react";
|
||||
import { memo, useEffect, useMemo, useState } from "react";
|
||||
import styles from './index.module.scss'
|
||||
import classnames from "classnames";
|
||||
|
||||
@ -8,17 +8,17 @@ type Param = {
|
||||
title?: string,
|
||||
onChange?: (val: string) => void,
|
||||
placeholder?: string,
|
||||
defaultValue?: string
|
||||
defaultValue?: string,
|
||||
onlyRead?: false|true
|
||||
}
|
||||
export default memo(({onChange, title = '', placeholder = '请输入', defaultValue}:Param) => {
|
||||
export default memo(({onChange, title = '', placeholder = '请输入', defaultValue, onlyRead = false}:Param) => {
|
||||
const [descData, setDescData] = useState({
|
||||
number: 0,
|
||||
value: '',
|
||||
count: 200,
|
||||
show: false
|
||||
})
|
||||
const getDesc = (e) => {
|
||||
let value = e.detail.value
|
||||
const getDesc = (value = '') => {
|
||||
let res = value
|
||||
if(value.length > descData.count) {
|
||||
res = value.slice(0, descData.count)
|
||||
@ -27,6 +27,10 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa
|
||||
onChange?.(res)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getDesc(defaultValue)
|
||||
}, [defaultValue])
|
||||
|
||||
const toggleShowRealTextarea = (show) => {
|
||||
setDescData({...descData, show:show})
|
||||
}
|
||||
@ -34,7 +38,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa
|
||||
<View className={styles.other_desc}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
<View className={styles.textarea}>
|
||||
{descData.show&&<Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={(e) => getDesc(e)}></Textarea>||
|
||||
{(descData.show && !onlyRead)&&<Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={(e) => getDesc(e.detail.value)}></Textarea>||
|
||||
<View className={classnames(styles.textarea_con_pretend, descData.value&&styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value||placeholder}</View>
|
||||
}
|
||||
<View className={styles.descDataNum}>{descData.number +'/'+ descData.count}</View>
|
||||
|
||||
@ -8,17 +8,26 @@ import styles from './index.module.scss'
|
||||
|
||||
//图片列表
|
||||
type ImageParam = {
|
||||
onChange?:(val: string[]) => void
|
||||
onChange?:(val: string[]) => void,
|
||||
defaultList?: string[],
|
||||
onlyRead?: false|true
|
||||
}
|
||||
const PictureItem:FC<ImageParam> = memo(({onChange}) => {
|
||||
const PictureItem:FC<ImageParam> = memo(({onChange, defaultList, onlyRead = false}) => {
|
||||
const {getWxPhoto} = useUploadCDNImg()
|
||||
const [imageList, setImageLise] = useState<string[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
setImageLise(defaultList||[])
|
||||
}, [defaultList])
|
||||
|
||||
//上传图片
|
||||
const uploadImage = async () => {
|
||||
let res:any = await getWxPhoto('after-sale')
|
||||
if(res.code == 200) {
|
||||
setImageLise([...imageList, res.url])
|
||||
}
|
||||
let list:any = await getWxPhoto('after-sale', 5)
|
||||
let images:any[] = []
|
||||
list?.map(item => {
|
||||
images.push(item.url)
|
||||
})
|
||||
setImageLise([...imageList, ...images])
|
||||
}
|
||||
//删除图片
|
||||
const delImage = (index) => {
|
||||
@ -27,7 +36,7 @@ const PictureItem:FC<ImageParam> = memo(({onChange}) => {
|
||||
}
|
||||
//监听上传的图片变化
|
||||
useEffect(() => {
|
||||
onChange?.(imageList||[])
|
||||
onChange?.(imageList)
|
||||
}, [imageList])
|
||||
|
||||
//预览图片
|
||||
@ -46,12 +55,12 @@ const PictureItem:FC<ImageParam> = memo(({onChange}) => {
|
||||
{imageList.map((item, index) =>
|
||||
<View className={styles.ImgItem}>
|
||||
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
|
||||
<View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>
|
||||
{!onlyRead && <View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>}
|
||||
</View>)}
|
||||
<View className={styles.uploadImg } onClick={uploadImage}>
|
||||
{!onlyRead && <View className={styles.uploadImg } onClick={uploadImage}>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
|
||||
<Text className={styles.uploadText}>上传照片</Text>
|
||||
</View>
|
||||
</View>}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
@ -7,8 +7,10 @@ import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro"
|
||||
import { useEffect, useState } from "react"
|
||||
import "./index.scss"
|
||||
import {addressAddApi, addressDetailApi,addressEditApi} from "@/api/addressManager"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||
const {type,id} = useRouter().params;
|
||||
useEffect(()=>{
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
|
||||
import AddressList from "@/components/AddressList"
|
||||
import useLogin from "@/use/useLogin"
|
||||
import { Button, ScrollView, Text, View } from "@tarojs/components"
|
||||
import { stopPullDownRefresh, usePullDownRefresh } from "@tarojs/taro"
|
||||
import { useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
export default ()=>{
|
||||
|
||||
useLogin()
|
||||
return (
|
||||
<View className="address-manager">
|
||||
<AddressList refresherEnabled={true}/>
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
.apply_after_sales_list{
|
||||
padding: 0 20px;
|
||||
.apply_after_sales_item{
|
||||
margin-bottom: 50px;
|
||||
.apply_after_sales_title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.tag{
|
||||
font-size: $font_size_min;
|
||||
background-color: #CDE5FF;
|
||||
padding: 5px 10px;
|
||||
border-radius: 6px;
|
||||
color: $color_main;
|
||||
}
|
||||
.title{
|
||||
font-weight: 700;
|
||||
font-size: $font_size;
|
||||
margin-left: 20px;
|
||||
flex:1;
|
||||
}
|
||||
}
|
||||
.color_list {
|
||||
.color_item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 30px 0;
|
||||
}
|
||||
.image{
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.name_and_number{
|
||||
padding-left: 30px;
|
||||
flex:1;
|
||||
text{
|
||||
&:nth-child(1) {
|
||||
font-weight: 700;
|
||||
font-size: $font_size;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
color: $color_font_two;
|
||||
font-size: $font_size;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn_count{
|
||||
width: 216px;
|
||||
height: 64px;
|
||||
background-color: #ECF5FF;
|
||||
border-radius: 40px 0px 16px 0px;
|
||||
padding: 0 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
68
src/pages/applyAfterSales/components/cutKindList/index.tsx
Normal file
68
src/pages/applyAfterSales/components/cutKindList/index.tsx
Normal file
@ -0,0 +1,68 @@
|
||||
import { formatHashTag, formatImgUrl } from "@/common/fotmat";
|
||||
import Counter from "@/components/counter";
|
||||
import MCheckbox from "@/components/checkbox";
|
||||
import { Image, Text, View } from "@tarojs/components";
|
||||
import { FC, memo, useCallback } from "react";
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type OrderParam = {
|
||||
list?: any[],
|
||||
sale_mode?: number,
|
||||
sale_mode_name?: string,
|
||||
unit?: string,
|
||||
total_colors?: number,
|
||||
total_fabrics?: number,
|
||||
total_number?: number,
|
||||
status?: number, //订单状态
|
||||
}
|
||||
|
||||
type Param = {
|
||||
order: OrderParam,
|
||||
onSelectChange?: (val: {color_id:number, length: number, status: true|false, sale_order_detail_id:number}) => void
|
||||
}
|
||||
|
||||
const kindeList:FC<Param> = memo(({order, onSelectChange}) => {
|
||||
//对应数量
|
||||
const formatCount = useCallback((item) => {
|
||||
return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit
|
||||
}, [order])
|
||||
|
||||
|
||||
//checkbox选中回调
|
||||
const selectCallBack = (colorItem) => {
|
||||
console.log('colorItem::',colorItem)
|
||||
onSelectChange?.({color_id:colorItem.id, length:colorItem.length, sale_order_detail_id:colorItem.sale_order_detail_id, status: true})
|
||||
}
|
||||
|
||||
//checkbox关闭回调
|
||||
const colseCallBack = (colorItem) => {
|
||||
onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: false, sale_order_detail_id:colorItem.sale_order_detail_id,})
|
||||
}
|
||||
|
||||
//判断该面料下的颜色都退完了
|
||||
const colorNum = (item) => {
|
||||
return item.product_colors.some(val => {
|
||||
return val.return_roll + val.apply_return_roll == 0
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.apply_after_sales_list}>
|
||||
{order?.list?.map(item => colorNum(item)&&<View className={styles.apply_after_sales_item} >
|
||||
<View className={styles.apply_after_sales_title}>
|
||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||
</View>
|
||||
<View className={styles.color_list}>
|
||||
{item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) == 0)&&<View className={styles.color_item}>
|
||||
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
|
||||
<View className={styles.name_and_number}><Text>{colorItem.code + ' ' + colorItem.name}</Text><Text>x {formatCount(colorItem)}</Text></View>
|
||||
<MCheckbox status={item.select} onSelect={() => selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/>
|
||||
</View>)}
|
||||
</View>
|
||||
</View>)}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
export default kindeList
|
||||
@ -19,48 +19,43 @@ type OrderParam = {
|
||||
type Param = {
|
||||
order: OrderParam,
|
||||
onNumChange?: (val:any) => void
|
||||
onSelectChange?: (val: {color_id:number, length: number, status: true|false}) => void
|
||||
}
|
||||
|
||||
const kindeList:FC<Param> = memo(({order, onNumChange, onSelectChange}) => {
|
||||
const kindeList:FC<Param> = memo(({order, onNumChange}) => {
|
||||
//对应数量
|
||||
const formatCount = useCallback((item) => {
|
||||
return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit
|
||||
return (item.roll - item.return_roll - item.apply_return_roll) + order?.unit!
|
||||
}, [order])
|
||||
|
||||
//计步器失返回值
|
||||
const getCounterChange = useCallback((colorItem) => {
|
||||
return (number) => {
|
||||
onNumChange?.({number, color_id: colorItem.id})
|
||||
onNumChange?.({number, color_id: colorItem.id, sale_order_detail_id:colorItem.sale_order_detail_id})
|
||||
}
|
||||
}, [])
|
||||
|
||||
//checkbox选中回调
|
||||
const selectCallBack = (colorItem) => {
|
||||
console.log('colorItem::',colorItem)
|
||||
onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: true})
|
||||
}
|
||||
|
||||
//checkbox关闭回调
|
||||
const colseCallBack = (colorItem) => {
|
||||
onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: false})
|
||||
//判断该面料下的颜色都退完了
|
||||
const colorNum = (item) => {
|
||||
let res = item.product_colors.some(val => {
|
||||
return val.return_roll < val.roll
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.apply_after_sales_list}>
|
||||
{order?.list?.map(item => <View className={styles.apply_after_sales_item}>
|
||||
{order?.list?.map(item => (colorNum(item))&&<View className={styles.apply_after_sales_item}>
|
||||
<View className={styles.apply_after_sales_title}>
|
||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||
</View>
|
||||
<View className={styles.color_list}>
|
||||
{item.product_colors.map(colorItem => <View className={styles.color_item}>
|
||||
{item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) < colorItem.roll)&&<View className={styles.color_item}>
|
||||
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
|
||||
<View className={styles.name_and_number}><Text>{colorItem.code + ' ' + colorItem.name}</Text><Text>x {formatCount(colorItem)}</Text></View>
|
||||
{(order.sale_mode == 0)&&<View className={styles.btn_count}>
|
||||
<Counter maxNum={colorItem.roll} onChange={getCounterChange(colorItem)}/>
|
||||
</View>||
|
||||
<MCheckbox status={item.select} onSelect={() => selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/>}
|
||||
<View className={styles.btn_count}>
|
||||
<Counter maxNum={colorItem.roll - (colorItem.return_roll + colorItem.apply_return_roll)} onChange={getCounterChange(colorItem)}/>
|
||||
</View>
|
||||
</View>)}
|
||||
</View>
|
||||
</View>)}
|
||||
|
||||
@ -6,10 +6,12 @@ import ReasonPopup from "./components/reasonPopup";
|
||||
import { useDidShow, useRouter } from "@tarojs/taro";
|
||||
import { GetSaleOrderDetailApi } from "@/api/order";
|
||||
import KindList from "./components/kindList"
|
||||
import CutKindList from "./components/cutkindList"
|
||||
import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from "@/api/salesAfterOrder";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import UploadImage from "@/components/uploadImage"
|
||||
import TextareaEnhance from "@/components/textareaEnhance";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
enum returnStatus {
|
||||
return_reason = 1, //原因
|
||||
@ -18,7 +20,7 @@ enum returnStatus {
|
||||
|
||||
}
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
useDidShow(() => {
|
||||
getSaleOrderPreView()
|
||||
})
|
||||
@ -67,7 +69,6 @@ export default () => {
|
||||
unit: orderDetail.sale_mode == 0?'条':'m', //单位
|
||||
list: orderDetail.product_list,
|
||||
status: orderDetail.status, //订单状态
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -86,7 +87,7 @@ export default () => {
|
||||
//大货时获取计步器数据
|
||||
const getNumChange = useCallback((val) => {
|
||||
if(parseInt(val.number) > 0) {
|
||||
roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number}
|
||||
roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id}
|
||||
} else {
|
||||
delete roll_list.current[val.color_id]
|
||||
}
|
||||
@ -101,7 +102,7 @@ export default () => {
|
||||
//散剪和剪板
|
||||
const getSelectChange = useCallback((val) => {
|
||||
if(val.status) {
|
||||
roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length}
|
||||
roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id}
|
||||
} else {
|
||||
delete roll_list.current[val.color_id]
|
||||
}
|
||||
@ -126,6 +127,7 @@ export default () => {
|
||||
const {fetchData: fetchDataReturnApply} = ReturnApplyOrderApi()
|
||||
const onSubmitData = async () => {
|
||||
if(submitData.roll_list.length <= 0) return alert.error('请选择退货颜色')
|
||||
console.log('submitData::',submitData)
|
||||
let res = await fetchDataReturnApply(submitData)
|
||||
if(res.success) {
|
||||
alert.success('申请成功')
|
||||
@ -157,6 +159,8 @@ export default () => {
|
||||
setShowReason(true)
|
||||
}
|
||||
|
||||
console.log('aaa:', 123456789)
|
||||
|
||||
//请求获取到的数据
|
||||
const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[], status: 1|2|3}>({title:'', list:[], status: returnStatus.goods_status})
|
||||
//售后货物状况
|
||||
@ -202,7 +206,8 @@ export default () => {
|
||||
<View className={styles.kind_number}><Text>{dataCount}</Text></View>
|
||||
<ScrollView scrollY className={styles.scroll}>
|
||||
<View className={styles.scroll_con}>
|
||||
<KindList order={formatDetailOrder} onNumChange={getNumChange} onSelectChange={getSelectChange}/>
|
||||
{(orderDetail?.sale_mode == 0)&&<KindList order={formatDetailOrder} onNumChange={getNumChange} />||
|
||||
<CutKindList order={formatDetailOrder} onSelectChange={getSelectChange}/>}
|
||||
<View className={styles.returnSaleInput}>
|
||||
<View className={styles.returnSaleInput_item}>
|
||||
<View className={styles.title}>退货原因</View>
|
||||
|
||||
@ -36,7 +36,7 @@ export default () => {
|
||||
business_license_url: "",
|
||||
legal_person: "",
|
||||
legal_person_identity: "",
|
||||
businessLicense: '',
|
||||
business_license: '',
|
||||
legal_person_identity_url: [],
|
||||
name: ""
|
||||
});
|
||||
@ -47,6 +47,9 @@ export default () => {
|
||||
name: [{
|
||||
message: "请输入企业名称"
|
||||
}],
|
||||
business_license: [{
|
||||
message: "请输入企业营业执照"
|
||||
}],
|
||||
business_license_url: [{
|
||||
message: "请上传营业执照"
|
||||
}],
|
||||
@ -132,7 +135,7 @@ export default () => {
|
||||
<SelectEnterpriseType ref={selectTypeRef} confirm={handleSelectTypeConfirm} />
|
||||
<FromListCertification onInput={(ev: any) => setFormData({ ...formData, name: ev.detail.value })} value={formData["name"]} label="企业名称" placeholder="请输入营业执照上的企业名称" required />
|
||||
{/* <FromListCertification type="select" style={{border: "0"}}label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required showIcon={false}/> */}
|
||||
<FromListCertification onInput={(ev: any) => setFormData({ ...formData, businessLicense: ev.detail.value })} value={formData["businessLicense"]} style={{ border: "0" }} label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required />
|
||||
<FromListCertification onInput={(ev: any) => setFormData({ ...formData, business_license: ev.detail.value })} value={formData["business_license"]} style={{ border: "0" }} label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required />
|
||||
<View onClick={() => handleUploadImage("business_license_url")} className="certification-upload">
|
||||
{(formData as any)?.business_license_url ?
|
||||
<>
|
||||
|
||||
@ -12,8 +12,10 @@ import {GetProductListApi} from '@/api/material'
|
||||
import { useRouter } from "@tarojs/taro";
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
||||
import LoadingCard from "@/components/loadingCard";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
export default () => {
|
||||
useLogin()
|
||||
const [showPopup, setShowPopup] = useState(false)
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
4
src/pages/collection/collectionClass/index.config.ts
Normal file
4
src/pages/collection/collectionClass/index.config.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export default {
|
||||
navigationBarTitleText: '我的收藏a',
|
||||
enableShareAppMessage: true,
|
||||
}
|
||||
50
src/pages/collection/collectionClass/index.module.scss
Normal file
50
src/pages/collection/collectionClass/index.module.scss
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
.collection_main {
|
||||
padding: 0 20px;
|
||||
min-height: 100%;
|
||||
background-color: #F8F8F8;
|
||||
.search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.miconfont_con{
|
||||
padding: 0 20px;
|
||||
}
|
||||
.miconfont{
|
||||
font-size: 30px;
|
||||
color: #007AFF;
|
||||
border: 1px solid #007AFF;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.operation{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 30px 0 30px;
|
||||
font-size: 26px;
|
||||
color: #707070;
|
||||
.operation_check{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
Text{
|
||||
margin-left: 15px;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
.operation_check_right{
|
||||
.operation_check_move{
|
||||
color: #707070;
|
||||
margin-right: 30px;
|
||||
}
|
||||
.operation_check_cancel{
|
||||
color: #007AFF;
|
||||
}
|
||||
}
|
||||
.class_list{
|
||||
margin-top: 30px;
|
||||
|
||||
}
|
||||
}
|
||||
105
src/pages/collection/collectionClass/index.tsx
Normal file
105
src/pages/collection/collectionClass/index.tsx
Normal file
@ -0,0 +1,105 @@
|
||||
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite";
|
||||
import { alert } from "@/common/common";
|
||||
import { getFilterData } from "@/common/util";
|
||||
import Product from "../components/product";
|
||||
import Search from "@/components/search"
|
||||
import { Text, View } from "@tarojs/components"
|
||||
import Taro, { useRouter } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import CreatePopup from "../components/createPopup";
|
||||
import UpdatePopup from "../components/updatePopup";
|
||||
import styles from './index.module.scss'
|
||||
import MCheckbox from "@/components/checkbox";
|
||||
import AddCollection from "@/components/addCollection";
|
||||
|
||||
|
||||
export default () => {
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
//获取收藏夹面料
|
||||
const [list, setList] = useState<any[]>([])
|
||||
const getFavoriteInfo = () => {
|
||||
let arr:any[] = []
|
||||
new Array(10).fill("").map((item, index) => {
|
||||
arr.push({id:index, code: index})
|
||||
})
|
||||
setList(arr)
|
||||
}
|
||||
|
||||
//获取搜索数据
|
||||
const [searchData, setSearchData] = useState('')
|
||||
const onSearch = useCallback((e) => {
|
||||
setSearchData(() => e)
|
||||
}, [])
|
||||
useEffect(() => {
|
||||
getFavoriteInfo()
|
||||
}, [searchData])
|
||||
|
||||
|
||||
//获取选中的id
|
||||
const [ids, setIds] = useState<number[]>([])
|
||||
const getSelectIds = useCallback((val) => {
|
||||
setIds(() => val)
|
||||
}, [])
|
||||
|
||||
//全选反选
|
||||
const [allSelectStatus, setAllSelectStatus] = useState(false)
|
||||
const selectCallBack = useCallback(() => {
|
||||
setAllSelectStatus(() => true)
|
||||
setSelectStatus(1)
|
||||
}, [])
|
||||
const colseCallBack = useCallback(() => {
|
||||
setAllSelectStatus(() => false)
|
||||
setSelectStatus(3)
|
||||
}, [])
|
||||
|
||||
const [selectStatus, setSelectStatus] = useState<1|2|3>(3)
|
||||
useEffect(() => {
|
||||
if(list.length) {
|
||||
if(ids.length == list.length) {
|
||||
setSelectStatus(1)
|
||||
setAllSelectStatus(true)
|
||||
} else if ( 0 < ids.length && ids.length < list.length){
|
||||
setSelectStatus(2)
|
||||
setAllSelectStatus(false)
|
||||
} else {
|
||||
setSelectStatus(3)
|
||||
setAllSelectStatus(false)
|
||||
}
|
||||
}
|
||||
}, [ids, list])
|
||||
|
||||
|
||||
const [collectionShow, setCollectionShow] = useState(false)
|
||||
const closeCollection = useCallback(() => {
|
||||
setCollectionShow(false)
|
||||
}, [])
|
||||
|
||||
const onAdd = () => {
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.collection_main}>
|
||||
<View className={styles.search}>
|
||||
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={onSearch} placeholder="请输入面料关键词" />
|
||||
</View>
|
||||
<View className={styles.operation}>
|
||||
<View className={styles.operation_check}>
|
||||
<MCheckbox status={allSelectStatus} onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
|
||||
<Text>全选</Text>
|
||||
</View>
|
||||
<View className={styles.operation_check_right}>
|
||||
<Text className={styles.operation_check_move} onClick={() => setCollectionShow(true)}>移动到</Text>
|
||||
<Text className={styles.operation_check_cancel}>取消收藏</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.class_list}>
|
||||
<Product productList={list} onSelectIds={getSelectIds} selectStatus={selectStatus} openCheckBox={true}/>
|
||||
</View>
|
||||
<AddCollection show={collectionShow} onAdd={onAdd} onClose={closeCollection}/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
import Popup from "@/components/popup";
|
||||
import { Input, ScrollView, Text, View } from "@tarojs/components";
|
||||
import { memo, useCallback, useMemo, useRef } from "react";
|
||||
import { memo, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import TextareaEnhance from "@/components/textareaEnhance";
|
||||
@ -11,7 +11,7 @@ import { alert } from "@/common/common";
|
||||
type ReasonInfoParam = {
|
||||
show?: boolean, //显示
|
||||
onClose?: () => void, //关闭
|
||||
onSuccess?: () => void, //成功
|
||||
onSuccess?: (val:any) => void, //成功
|
||||
defaultValue?: {
|
||||
remark: string,
|
||||
name: string
|
||||
@ -24,40 +24,34 @@ export default memo(({show = false, onClose, onSuccess, defaultValue}: ReasonInf
|
||||
"remark": ''
|
||||
})
|
||||
|
||||
const getOtherReason = useCallback((val) => {
|
||||
const getOtherReason = (val) => {
|
||||
submitData.current.remark = val
|
||||
}, [])
|
||||
|
||||
const changeInput = useCallback((val) => {
|
||||
submitData.current.name = val.detail.value
|
||||
}, [])
|
||||
|
||||
//创建
|
||||
const {fetchData} = CreateFavoriteApi()
|
||||
const onSubmit = async () => {
|
||||
if(!submitData.current.name) return alert.none('请输入收藏夹名称!')
|
||||
let res = await fetchData(submitData.current)
|
||||
if(res.success) {
|
||||
alert.success('创建成功')
|
||||
onSuccess?.()
|
||||
} else {
|
||||
alert.error('创建失败')
|
||||
}
|
||||
onClose?.()
|
||||
}
|
||||
|
||||
const changeInput = (val) => {
|
||||
submitData.current.name = val.detail.value
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
onSuccess?.(submitData.current)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
submitData.current = {name: defaultValue?.name!, remark: defaultValue?.remark!}
|
||||
}, [defaultValue])
|
||||
return (
|
||||
<Popup show={show} title="新建收藏夹" onClose={onClose} >
|
||||
<View className={styles.collection_con}>
|
||||
<View className={styles.title_item}>
|
||||
<View className={styles.title}>名称</View>
|
||||
<View className={styles.select}>
|
||||
<Input placeholder="请输入文件夹名称" className={styles.input} onInput={changeInput} value={defaultValue?.remark}/>
|
||||
<Input placeholder="请输入文件夹名称" className={styles.input} onInput={changeInput} value={defaultValue?.name}/>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.desc_item}>
|
||||
<View className={styles.title}>简介</View>
|
||||
<View className={styles.desc}>
|
||||
<TextareaEnhance onChange={getOtherReason} placeholder="请输入简介" />
|
||||
<TextareaEnhance defaultValue={defaultValue?.remark} onChange={getOtherReason} placeholder="请输入简介" />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
89
src/pages/collection/components/product/index.module.scss
Normal file
89
src/pages/collection/components/product/index.module.scss
Normal file
@ -0,0 +1,89 @@
|
||||
|
||||
.products_list{
|
||||
padding: 0 20px 20px 20px;
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
}
|
||||
.products_item{
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
&:nth-child(n+2){
|
||||
margin-top: 16px;
|
||||
}
|
||||
.checkbox{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
z-index: 999;
|
||||
}
|
||||
.item_img{
|
||||
width: 198px;
|
||||
height: 198px;
|
||||
position: relative;
|
||||
image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.num{
|
||||
padding: 5px 10px 5px 20px;
|
||||
font-size: $font_size_min;
|
||||
position: absolute;
|
||||
right:0;
|
||||
bottom: 0;
|
||||
background: rgba($color: #000, $alpha: 0.3);
|
||||
border-radius: 36px 0px 10px 0px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
.item_con{
|
||||
padding-left: 20px;
|
||||
font-size: $font_size;
|
||||
flex:1;
|
||||
.title{
|
||||
font-size: $font_size;
|
||||
color: #707070;
|
||||
text{
|
||||
color: $color_font_one;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.tag_list{
|
||||
display: flex;
|
||||
margin-top: 16px;
|
||||
flex-wrap: wrap;
|
||||
.tag, .tag_g{
|
||||
max-width: 260rpx;
|
||||
padding: 3px 10px;
|
||||
background-color: #CDE5FF;
|
||||
font-size: $font_size_min;
|
||||
border-radius: 5px;
|
||||
color: $color_main;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.tag_g{
|
||||
background-color: #FFE6CE;
|
||||
color: #EE7500;
|
||||
}
|
||||
}
|
||||
.introduce{
|
||||
font-size: $font_size_medium;
|
||||
color: $color_font_two;
|
||||
|
||||
}
|
||||
.des{
|
||||
font-size:$font_size_medium;
|
||||
color: #707070;
|
||||
margin-top: 16px;
|
||||
@include common_ellipsis($params:2);
|
||||
}
|
||||
}
|
||||
}
|
||||
83
src/pages/collection/components/product/index.tsx
Normal file
83
src/pages/collection/components/product/index.tsx
Normal file
@ -0,0 +1,83 @@
|
||||
import { Image, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { goLink } from "@/common/common"
|
||||
import styles from './index.module.scss'
|
||||
import { formatHashTag, formatImgUrl } from "@/common/fotmat"
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import MCheckbox from "@/components/checkbox";
|
||||
import { useCallback, useEffect, useRef, useState } from "react"
|
||||
|
||||
type Params = {
|
||||
productList?: any[],
|
||||
onSelectIds?: (val: number[]) => void,
|
||||
selectStatus?: 1|2|3, //1全选,2不做处理,3全清空
|
||||
openCheckBox?: true|false //是否开启选择
|
||||
}
|
||||
export default ({productList = [], onSelectIds, selectStatus = 2, openCheckBox = false}:Params) => {
|
||||
const [list, setList] = useState<any[]>([])
|
||||
useEffect(() => {
|
||||
setList(() => [...productList])
|
||||
},[productList])
|
||||
|
||||
useEffect(() => {
|
||||
if(list.length && selectStatus != 2) {
|
||||
list.map(item => {
|
||||
item.check = (selectStatus == 1)
|
||||
})
|
||||
setList(() => [...list])
|
||||
}
|
||||
|
||||
}, [selectStatus])
|
||||
|
||||
const onChangeSelect = (item) => {
|
||||
if(item.check) {
|
||||
onClose(item)
|
||||
} else {
|
||||
onSelect(item)
|
||||
}
|
||||
}
|
||||
|
||||
//选中和取消选中
|
||||
const onSelect = (item) => {
|
||||
item.check = true
|
||||
setList(() => ([...list]))
|
||||
}
|
||||
const onClose = (item) => {
|
||||
item.check = false
|
||||
setList(() => ([...list]))
|
||||
}
|
||||
|
||||
//监听数据变化
|
||||
useEffect(() => {
|
||||
let ids: number[] = []
|
||||
list.map(item => {
|
||||
if(item.check) ids.push(item.id)
|
||||
})
|
||||
onSelectIds?.(ids)
|
||||
}, [list])
|
||||
|
||||
return (
|
||||
<View className={styles.products_list}>
|
||||
{list?.map(item => {
|
||||
return <View className={styles.products_item} onClick={() => openCheckBox?onChangeSelect(item):goLink(`/pages/details/index?id=${item.product_id}`)}>
|
||||
{openCheckBox&&<View className={styles.checkbox} onClick={(e) => e.stopPropagation()}>
|
||||
<MCheckbox status={item.check} onSelect={() => onSelect(item)} onClose={() => onClose(item)}/>
|
||||
</View>}
|
||||
<View className={styles.item_img}>
|
||||
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
|
||||
<View className={styles.num}>{item.enable_product_color_count}色</View>
|
||||
</View>
|
||||
<View className={styles.item_con}>
|
||||
<View className={styles.title}><text>{formatHashTag(item.product_code, '')} </text>{item.product_name}</View>
|
||||
<View className={styles.tag_list}>
|
||||
<View className={styles.tag}>{item.width}</View>
|
||||
<View className={styles.tag_g}>{item.weight_density}</View>
|
||||
</View>
|
||||
<View className={styles.introduce}>{item.component}</View>
|
||||
</View>
|
||||
</View>
|
||||
})}
|
||||
<View className="common_safe_area_y"></View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
import { DelFavoriteApi, FavoriteListApi } from "@/api/favorite";
|
||||
import { alert } from "@/common/common";
|
||||
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import { getFilterData } from "@/common/util";
|
||||
import Product from "@/components/product";
|
||||
import Product from "./components/product";
|
||||
import Search from "@/components/search"
|
||||
import { Text, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro";
|
||||
@ -10,8 +10,9 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import CreatePopup from "./components/createPopup";
|
||||
import UpdatePopup from "./components/updatePopup";
|
||||
import styles from './index.module.scss'
|
||||
import useLogin from "@/use/useLogin";
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
const changeOpenCon = (item) => {
|
||||
item.openStatus = !item.openStatus
|
||||
setList((e) => [...e])
|
||||
@ -32,9 +33,6 @@ export default () => {
|
||||
let res = await fetchDataList(getFilterData({name: searchData}))
|
||||
setList(() => res.data.list)
|
||||
}
|
||||
useEffect(() => {
|
||||
getFavoriteList()
|
||||
}, [])
|
||||
|
||||
//创建收藏夹
|
||||
const [collectioinShow, setCollectioinShow] = useState(false)
|
||||
@ -42,12 +40,31 @@ export default () => {
|
||||
setCollectioinShow(false)
|
||||
}, [])
|
||||
|
||||
//创建成功
|
||||
const onCreatSuccess = useCallback(() => {
|
||||
getFavoriteList()
|
||||
}, [])
|
||||
const creatShow = () => {
|
||||
setCollectioinShow(true)
|
||||
setInitData(() => ({ remark: '',name: '', id:0}))
|
||||
}
|
||||
|
||||
|
||||
//新增
|
||||
const {fetchData} = CreateFavoriteApi()
|
||||
const onCreate = async (submitData) => {
|
||||
if(!submitData.name) return alert.none('请输入收藏夹名称!')
|
||||
let res = await fetchData({...submitData})
|
||||
if(res.success) {
|
||||
alert.success('创建成功')
|
||||
getFavoriteList()
|
||||
} else {
|
||||
alert.error('创建失败')
|
||||
}
|
||||
}
|
||||
|
||||
//更多编辑
|
||||
const [initData, setInitData] = useState({
|
||||
remark: '',
|
||||
name: '',
|
||||
id:0
|
||||
})
|
||||
const selectInfo = useRef<any>(null)
|
||||
const [updateShow, setUpdateShow] = useState(false)
|
||||
const closeUpdate = useCallback(() => {
|
||||
@ -56,6 +73,8 @@ export default () => {
|
||||
const moreUpdate = (item,e) => {
|
||||
e.stopPropagation()
|
||||
selectInfo.current = item
|
||||
console.log('item:::', item)
|
||||
setInitData((e) =>({ ...e, remark:item.remark , name: item.name, id: item.id}))
|
||||
setUpdateShow(true)
|
||||
}
|
||||
|
||||
@ -84,15 +103,40 @@ export default () => {
|
||||
}, [])
|
||||
|
||||
//编辑
|
||||
const onUpdate = useCallback(() => {
|
||||
|
||||
const {fetchData: updateFavoriteFetchData} = UpdateFavoriteApi()
|
||||
const onUpdateShow = useCallback(() => {
|
||||
setCollectioinShow(true)
|
||||
}, [])
|
||||
const onUpdate = async (submitData) => {
|
||||
if(!submitData.name) return alert.none('请输入收藏夹名称!')
|
||||
let res = await updateFavoriteFetchData({...submitData})
|
||||
if(res.success) {
|
||||
alert.success('编辑成功')
|
||||
getFavoriteList()
|
||||
} else {
|
||||
alert.error('编辑失败')
|
||||
}
|
||||
}
|
||||
|
||||
const onBatchManagement = useCallback(() => {
|
||||
// goLink('pages/collection/collectionClass/index', {id: })
|
||||
}, [])
|
||||
|
||||
//操作文件夹
|
||||
const onCreatSuccess = (submitData) => {
|
||||
if (!initData.id) {
|
||||
onCreate(submitData)
|
||||
} else {
|
||||
onUpdate({...submitData, id: initData.id})
|
||||
}
|
||||
setCollectioinShow(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.collection_main}>
|
||||
<View className={styles.search}>
|
||||
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={onSearch} placeholder="请输入面料关键词" />
|
||||
<View className={styles.miconfont_con} onClick={() => setCollectioinShow(true)}><Text className={classnames(styles.miconfont, 'iconfont icon-jia')}></Text></View>
|
||||
<View className={styles.miconfont_con} onClick={creatShow}><Text className={classnames(styles.miconfont, 'iconfont icon-jia')}></Text></View>
|
||||
</View>
|
||||
<View className={styles.class_list}>
|
||||
{list?.map((item:any) => <View className={styles.class_item}>
|
||||
@ -104,12 +148,12 @@ export default () => {
|
||||
<View className={styles.more} onClick={(e) => moreUpdate(item,e)}>更多</View>
|
||||
</View>
|
||||
<View className={styles.class_con} style={item.openStatus?{maxHeight: 10*260 + 'rpx'}:{maxHeight: 0}} >
|
||||
<Product productList={new Array(10).fill('')}/>
|
||||
<Product productList={item.product_color_list||[]}/>
|
||||
</View>
|
||||
</View>)}
|
||||
</View>
|
||||
<CreatePopup show={collectioinShow} onClose={closeCollection} onSuccess={onCreatSuccess}/>
|
||||
<UpdatePopup show={updateShow} onClose={closeUpdate} onDelete={onDeleteCollect} onUpdate={onUpdate}/>
|
||||
<UpdatePopup show={updateShow} onClose={closeUpdate} onDelete={onDeleteCollect} onUpdate={onUpdateShow} onBatchManagement={onBatchManagement}/>
|
||||
<CreatePopup defaultValue={initData} show={collectioinShow} onClose={closeCollection} onSuccess={onCreatSuccess}/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -7,8 +7,10 @@ import { useEffect, useState } from "react"
|
||||
import { alert, retrieval } from "@/common/common";
|
||||
import { companyDetailApi, companyUpdateApi } from "@/api/company"
|
||||
import "./index.scss"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||
const handleSelectSite = ()=>{
|
||||
setShowSiteModal(true);
|
||||
|
||||
@ -8,9 +8,10 @@ import "./index.scss"
|
||||
import { useSelector } from "@/reducers/hooks";
|
||||
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
||||
import Message from "@/components/Message"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
|
||||
useLogin()
|
||||
const userInfo = useSelector(state => state.userInfo);
|
||||
useEffect(()=>{
|
||||
getData()
|
||||
|
||||
@ -6,8 +6,10 @@ import {creditListApi} from "@/api/creditLine"
|
||||
import "./index.scss"
|
||||
import { formatDateTime, formatPriceDiv, toDecimal2 } from "@/common/fotmat"
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {fetchData, state} = creditListApi();
|
||||
// 渲染(数据)
|
||||
const [data, setData] = useState({
|
||||
|
||||
@ -7,8 +7,10 @@ import { useEffect } from "react";
|
||||
import { formatPriceDiv, toDecimal2 } from "@/common/fotmat";
|
||||
import { setClipboardData } from "@tarojs/taro";
|
||||
import Message from "@/components/Message";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {fetchData, state} = depositInfoApi();
|
||||
const getData = async ()=>{
|
||||
fetchData();
|
||||
|
||||
@ -6,9 +6,10 @@ import Taro, { useReady } from "@tarojs/taro"
|
||||
import { useEffect, useState } from "react"
|
||||
import {creditListApi} from "@/api/creditLine"
|
||||
import "./index.scss"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
|
||||
useLogin()
|
||||
return (
|
||||
<View className="deposit-detail">
|
||||
<View className="deposit-detail-tips">
|
||||
|
||||
@ -7,8 +7,10 @@ import { useCallback, useEffect, useState } from "react"
|
||||
import { depositListApi } from "@/api/deposit"
|
||||
import "./index.scss"
|
||||
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {fetchData, state} = depositListApi();
|
||||
// 渲染(数据)
|
||||
const [data, setData] = useState({
|
||||
|
||||
@ -14,7 +14,10 @@
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
margin-top: 200px;
|
||||
height: 60vh;
|
||||
margin-top: 100px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
image{
|
||||
width:100%;
|
||||
border-radius: 10px;
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import { Image, View } from "@tarojs/components"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
export type colorItem = {
|
||||
title: string,
|
||||
img: string
|
||||
lab: {l:number, a:number, b:number},
|
||||
rgb: {r:number, g:number, b:number},
|
||||
texture_url: string
|
||||
}
|
||||
export type colorParams = {
|
||||
value?: colorItem,
|
||||
@ -15,7 +18,7 @@ export default ({value, show = false, onClose}: colorParams) => {
|
||||
<>
|
||||
{show&&<View className={styles.main} catch-move="true" onClick={() => onClose?.()}>
|
||||
<View className={styles.con}>
|
||||
<Image mode="aspectFill" src={value?.img as string}/>
|
||||
<LabAndImg value={{lab:value?.lab,rgb:value?.rgb,texture_url:value?.texture_url}}/>
|
||||
<View className={styles.name}>{value?.title}</View>
|
||||
</View>
|
||||
</View>}
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
opacity: 0;
|
||||
}
|
||||
.miconfont{
|
||||
font-size: 36px;
|
||||
font-size: 45px;
|
||||
}
|
||||
.collected{
|
||||
color: #FFC300;
|
||||
@ -125,16 +125,33 @@
|
||||
background-color: #fff;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
|
||||
|
||||
.buy_cart{
|
||||
width: 150px;
|
||||
color: $color_font_three;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
.text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
.miconfont{
|
||||
font-size: 36px;
|
||||
}
|
||||
.product_num{
|
||||
position: absolute;
|
||||
font-size: 23px;
|
||||
background-color: red;
|
||||
color: #fff;
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
padding: 0 6px;
|
||||
border-radius: 72px;
|
||||
min-width: 25px;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
right: 20px;
|
||||
}
|
||||
}
|
||||
.buy_btn{
|
||||
display: flex;
|
||||
|
||||
@ -7,7 +7,7 @@ import OrderCount from './components/orderCount';
|
||||
import ShopCart from '@/components/shopCart';
|
||||
import Preview,{colorItem} from './components/preview';
|
||||
import styles from './index.module.scss'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {formatHashTag, formatImgUrl} from '@/common/fotmat'
|
||||
import {GetProductDetailApi} from '@/api/material'
|
||||
import useLogin from '@/use/useLogin';
|
||||
@ -16,6 +16,9 @@ import { SHARE_SCENE } from '@/common/enum';
|
||||
import useUserInfo from '@/use/useUserInfo';
|
||||
import LabAndImg from '@/components/LabAndImg';
|
||||
import { alert } from '@/common/common';
|
||||
import AddCollection from '@/components/addCollection';
|
||||
import { AddFavoriteApi } from '@/api/favorite';
|
||||
import { GetShoppingCartApi } from '@/api/shopCart';
|
||||
|
||||
type item = {title:string, img:string, url:string, id:number}
|
||||
|
||||
@ -25,7 +28,7 @@ type Params = {
|
||||
style?: Object
|
||||
}
|
||||
export default (props:Params) => {
|
||||
const {checkLogin, getPhoneNumber, userInfo} = useLogin()
|
||||
const {getPhoneNumber, userInfo} = useLogin()
|
||||
|
||||
//获取参数(有两种参数:1.商品id, 2.页面分享)
|
||||
const router = useRouter()
|
||||
@ -48,9 +51,9 @@ export default (props:Params) => {
|
||||
}
|
||||
|
||||
useDidShow(() => {
|
||||
checkLogin()
|
||||
judgeParam()
|
||||
setShowCart(false)
|
||||
getShoppingCart()
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
@ -69,7 +72,10 @@ export default (props:Params) => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if(productInfo.code) getShortCode()
|
||||
if(productInfo.code) {
|
||||
getShortCode()
|
||||
setCollectStatus(() => productInfo.is_favorite)
|
||||
}
|
||||
}, [productInfo])
|
||||
|
||||
|
||||
@ -91,21 +97,14 @@ export default (props:Params) => {
|
||||
const getColorItem = (item) => {
|
||||
setColorInfo({
|
||||
title: item.code,
|
||||
img: item.texture_url,
|
||||
texture_url: item.texture_url,
|
||||
lab: item.lab,
|
||||
rgb: item.rgb
|
||||
})
|
||||
setShowPreview(true)
|
||||
}
|
||||
|
||||
//收藏功能
|
||||
const [collectStatus, setCollectStatus] = useState(false)
|
||||
const changeCollect = () => {
|
||||
setCollectStatus(!collectStatus)
|
||||
Taro.showToast({
|
||||
title: '收藏成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const {setSortCode, userInfo : userObj } = useUserInfo()
|
||||
//详情页获取分享短码
|
||||
@ -134,7 +133,35 @@ export default (props:Params) => {
|
||||
setShowOrderCount(true)
|
||||
}
|
||||
|
||||
|
||||
//收藏功能
|
||||
const [collectStatus, setCollectStatus] = useState(false)
|
||||
const [collectionShow, setCollectionShow] = useState(false)
|
||||
const {fetchData: addFavoritefetchData} = AddFavoriteApi()
|
||||
const onAdd = useCallback(async (val) => {
|
||||
let res = await addFavoritefetchData({favorite_id: val.id, product_id: Number(params.id)})
|
||||
if(res.success) {
|
||||
alert.success('添加成功')
|
||||
setCollectStatus(true)
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
|
||||
setCollectionShow(false)
|
||||
}, [params])
|
||||
const closeCollection = useCallback(() => {
|
||||
setCollectionShow(false)
|
||||
}, [])
|
||||
|
||||
//获取购物车数据数量
|
||||
const [shopCount, setShopCount] = useState<number>(0)
|
||||
const {fetchData: fetchDataShopCount} = GetShoppingCartApi()
|
||||
const getShoppingCart = async () => {
|
||||
const {data} = await fetchDataShopCount()
|
||||
let color_list = data.color_list||[]
|
||||
setShopCount(color_list.length)
|
||||
}
|
||||
|
||||
|
||||
//页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getProductDetail()
|
||||
@ -146,7 +173,7 @@ export default (props:Params) => {
|
||||
<DesSwiper list={productInfo.texture_url||[]}/>
|
||||
<View className={styles.product_header}>
|
||||
<View className={styles.title}>
|
||||
<View className={styles.name}>{productName}</View>
|
||||
{productInfo.code&&<View className={styles.name}>{productName}</View>}
|
||||
<View className={styles.des}>{productInfo.describe}</View>
|
||||
</View>
|
||||
<View className={styles.share}>
|
||||
@ -154,8 +181,8 @@ export default (props:Params) => {
|
||||
<View className={styles.text}>分享</View>
|
||||
<Button open-type="share" className={styles.shareBtn}></Button>
|
||||
</View>
|
||||
<View className={styles.collect}>
|
||||
<View className={classnames('iconfont icon-shoucang', styles.miconfont, collectStatus&&styles.collected)} onClick={() => changeCollect()}></View>
|
||||
<View className={styles.collect} onClick={() => setCollectionShow(true)}>
|
||||
<View className={classnames(`iconfont ${collectStatus?'icon-shoucang-pressed':'icon-shoucang'}`, styles.miconfont, collectStatus&&styles.collected)} ></View>
|
||||
<View className={styles.text}>收藏</View>
|
||||
</View>
|
||||
</View>
|
||||
@ -188,6 +215,7 @@ export default (props:Params) => {
|
||||
<View className={styles.buy_cart} onClick={() => setShowCart(true)}>
|
||||
<View className={classnames('iconfont icon-gouwuche', styles.miconfont)}></View>
|
||||
<View className={styles.text}>购物车</View>
|
||||
{(shopCount > 0)&&<View className={styles.product_num}>{shopCount > 99?'99+':shopCount}</View>}
|
||||
</View>
|
||||
{
|
||||
(!userInfo.adminUserInfo?.is_authorize_phone)&&<View className={styles.buy_btn} >
|
||||
@ -202,6 +230,7 @@ export default (props:Params) => {
|
||||
</CustomWrapper>
|
||||
<ShopCart show={showCart} onClose={() => setShowCart(false)}/>
|
||||
<Preview value={colorInfo} show={showPreview} onClose={() => setShowPreview(false)}/>
|
||||
<AddCollection show={collectionShow} onAdd={onAdd} onClose={closeCollection}/>
|
||||
<View className='common_safe_area_y'></View>
|
||||
</View>
|
||||
)
|
||||
|
||||
@ -8,9 +8,10 @@ import { alert, goLink } from "@/common/common";
|
||||
import { getParam } from "@/common/system";
|
||||
import {EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi} from "@/api/order";
|
||||
import Taro from "@tarojs/taro";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
//获取临时传递的数据
|
||||
const params = getParam()
|
||||
const [paramsData, setParamsData] = useState<any>(params)
|
||||
|
||||
@ -15,11 +15,7 @@ import { dataLoadingStatus } from '@/common/util'
|
||||
|
||||
export default () => {
|
||||
|
||||
const { checkLogin } = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
|
||||
useLogin()
|
||||
useEffect(() => {
|
||||
categoryList()
|
||||
}, [])
|
||||
@ -87,21 +83,12 @@ export default () => {
|
||||
setRefresherTriggeredStatus(true)
|
||||
}
|
||||
|
||||
|
||||
//页面下拉刷新
|
||||
// const res = useManualPullDownRefresh()
|
||||
// usePullDownRefresh(() => {
|
||||
// console.log('123')
|
||||
// })
|
||||
|
||||
//数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading })
|
||||
}, [productData, productState.loading])
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<MoveBtn onClick={() => setShowShopCart(!showShopCart)}>
|
||||
<View className={styles.main}>
|
||||
|
||||
@ -5,16 +5,16 @@ import { View } from "@tarojs/components"
|
||||
import Taro, { useDidShow, usePullDownRefresh} from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import AddressInfo from "./components/addressInfo";
|
||||
import KindList from "./components/kindList";
|
||||
import Remark from "./components/remark";
|
||||
import styles from './comfirm.module.scss'
|
||||
import { getParam } from "@/common/system";
|
||||
import useLogin from "@/use/useLogin";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import ShipmentMode from "../editOrder/components/shipmentMode";
|
||||
import SubmitOrderBtn from "./components/submitOrderBtn";
|
||||
import AddressInfoDetail from "./components/addressInfoDetail";
|
||||
import { SubscriptionMessageApi } from "@/api/user";
|
||||
import { SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum";
|
||||
import { UseSubscriptionMessage } from "@/use/useCommonData";
|
||||
|
||||
export default () => {
|
||||
|
||||
@ -89,7 +89,9 @@ import AddressInfoDetail from "./components/addressInfoDetail";
|
||||
id: address?.id,
|
||||
name: address?.name,
|
||||
phone: address?.phone,
|
||||
shipment_mode: address?.shipment_mode
|
||||
shipment_mode: address?.shipment_mode,
|
||||
take_goods_address: address?.take_goods_address,
|
||||
take_goods_phone: address?.take_goods_phone,
|
||||
}
|
||||
}, [preViewOrder])
|
||||
|
||||
@ -132,9 +134,13 @@ import AddressInfoDetail from "./components/addressInfoDetail";
|
||||
}
|
||||
}, [formatPreViewOrder])
|
||||
|
||||
//订阅消息
|
||||
const {SubmitOrder} = SUBSCRIPTION_MESSAGE_SCENE
|
||||
const {openSubscriptionMessage} = UseSubscriptionMessage()
|
||||
|
||||
//提交订单
|
||||
const {fetchData: saleOrderFetchData} = SaleOrderApi()
|
||||
const submitOrderEven = () => {
|
||||
const submitOrderEven = async () => {
|
||||
if(!submitOrderData?.shipment_mode) {
|
||||
alert.error('请选择收货方式')
|
||||
return false
|
||||
@ -143,28 +149,20 @@ import AddressInfoDetail from "./components/addressInfoDetail";
|
||||
alert.error('请选择地址')
|
||||
return false
|
||||
}
|
||||
|
||||
Taro.showModal({
|
||||
title: '确定提交?',
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
const res = await saleOrderFetchData(submitOrderData)
|
||||
if(res.success) {
|
||||
goLink('/pages/order/index',{id: res.data.id}, 'redirectTo')
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
await openSubscriptionMessage({scenes: SubmitOrder.value})
|
||||
const res = await saleOrderFetchData(submitOrderData)
|
||||
if(res.success) {
|
||||
goLink('/pages/order/index',{id: res.data.id}, 'redirectTo')
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
}
|
||||
|
||||
//页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getSaleOrderPreView()
|
||||
})
|
||||
|
||||
return (
|
||||
<View className={styles.order_main}>
|
||||
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={selectShipmentMode} status={1}/>
|
||||
|
||||
@ -31,10 +31,26 @@ type Param = {
|
||||
province_name: string,
|
||||
city_name: string,
|
||||
district_name: string,
|
||||
address_detail: string
|
||||
address_detail: string,
|
||||
take_goods_address: string,
|
||||
take_goods_phone: string
|
||||
}
|
||||
}
|
||||
|
||||
//订单状态
|
||||
const {
|
||||
SaleorderstatusWaitingPrePayment,
|
||||
SaleOrderStatusBooking,
|
||||
SaleOrderStatusArranging,
|
||||
SaleOrderStatusArranged,
|
||||
SaleOrderStatusWaitingPayment,
|
||||
SaleOrderStatusWaitingReceipt,
|
||||
SaleOrderStatusAlreadyReceipt,
|
||||
SaleOrderStatusComplete,
|
||||
SaleOrderStatusRefund,
|
||||
SaleOrderStatusCancel,
|
||||
} = ORDER_STATUS
|
||||
|
||||
export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false, onLogistics}: Param, ref) => {
|
||||
|
||||
const [addressInfo, setAddressInfo] = useState<any>()
|
||||
@ -46,19 +62,12 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
}, [orderInfo])
|
||||
|
||||
|
||||
//地址格式
|
||||
const formatAddress = useMemo(() => {
|
||||
if(addressInfo?.province_name) {
|
||||
return addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
}, [addressInfo])
|
||||
|
||||
|
||||
//打开地址列表
|
||||
const [showAddressList, setShowAddressList] = useState(false)
|
||||
const changeShow = () => {
|
||||
if(receivingStatus == 2 && !logisticsShow)
|
||||
if(receivingStatus == 2 && !logisticsShow && limitEdit())
|
||||
setShowAddressList(() => true)
|
||||
}
|
||||
|
||||
@ -72,7 +81,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi()
|
||||
const onReceivingStatus = (value, e) => {
|
||||
e.stopPropagation()
|
||||
changeReceivingStatus(value)
|
||||
if(limitEdit()) changeReceivingStatus(value)
|
||||
|
||||
}
|
||||
const changeReceivingStatus = debounce(async (value) => {
|
||||
if(!orderInfo) return false
|
||||
@ -117,14 +127,18 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
}
|
||||
}
|
||||
|
||||
//订单状态
|
||||
const {
|
||||
SaleOrderStatusWaitingReceipt,
|
||||
SaleOrderStatusAlreadyReceipt,
|
||||
SaleOrderStatusComplete,
|
||||
SaleOrderStatusRefund,
|
||||
SaleOrderStatusCancel,
|
||||
} = ORDER_STATUS
|
||||
//根据订单状态判断是否可用修改
|
||||
const limitEdit = () => {
|
||||
let res = [
|
||||
SaleorderstatusWaitingPrePayment.value,
|
||||
SaleOrderStatusBooking.value,
|
||||
SaleOrderStatusArranging.value,
|
||||
SaleOrderStatusArranged.value,
|
||||
SaleOrderStatusWaitingPayment.value,
|
||||
].includes(orderInfo?.status as number)
|
||||
if(!res && status != 1) alert.none('该订单状态不能修改地址!')
|
||||
return status == 1? true : res
|
||||
}
|
||||
|
||||
|
||||
//根据订单状态判断是否显示物流
|
||||
@ -134,6 +148,15 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
return logisticsShowList.includes(orderInfo?.status as number)
|
||||
}, [orderInfo])
|
||||
|
||||
//地址格式
|
||||
const formatAddress = useMemo(() => {
|
||||
if(receivingStatus == 2) {
|
||||
return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:''
|
||||
} else {
|
||||
return addressInfo?.take_goods_address
|
||||
}
|
||||
}, [addressInfo, receivingStatus])
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
||||
@ -144,8 +167,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
{(receivingStatus == 2 && !logisticsShow)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
||||
</View>
|
||||
<View className={styles.order_address_text_name}>
|
||||
<Text>{addressInfo?.name}</Text>
|
||||
<Text>{addressInfo?.phone}</Text>
|
||||
<Text>{receivingStatus == 1?'管理员':addressInfo?.name}</Text>
|
||||
<Text>{receivingStatus == 1?addressInfo?.take_goods_phone: addressInfo?.phone}</Text>
|
||||
</View>
|
||||
</View>
|
||||
{!logisticsShow&&<View className={styles.updateBtn}>
|
||||
|
||||
@ -5,7 +5,7 @@ import { memo, useCallback, useEffect, useRef, useState } from "react";
|
||||
import ReasonPopup from "../reasonPopup";
|
||||
import styles from './index.module.scss'
|
||||
import classnames from "classnames";
|
||||
import { ApplyRefundApi } from "@/api/salesAfterOrder";
|
||||
import { ApplyRefundApi, RefundExplainApi } from "@/api/salesAfterOrder";
|
||||
import { alert } from "@/common/common";
|
||||
|
||||
type Param = {
|
||||
@ -17,21 +17,24 @@ export default memo(({show, onClose, orderId}:Param) => {
|
||||
|
||||
//提交的数据
|
||||
const submitData = useRef({
|
||||
return_explain: 1,
|
||||
return_explain: 0,
|
||||
sale_order_id: 0,
|
||||
reason_describe: ''
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if(orderId)
|
||||
if(orderId) {
|
||||
submitData.current.sale_order_id = orderId
|
||||
refundExplain()
|
||||
}
|
||||
|
||||
}, [orderId])
|
||||
|
||||
//申请退款
|
||||
const {fetchData} = ApplyRefundApi()
|
||||
const getApplyRefund = async () => {
|
||||
let res = await fetchData(submitData.current)
|
||||
if(!submitData.current.return_explain) return alert.error('请选择说明原因')
|
||||
let res = await fetchData(submitData.current)
|
||||
if(res.success) {
|
||||
alert.error('申请成功')
|
||||
} else {
|
||||
@ -42,6 +45,17 @@ export default memo(({show, onClose, orderId}:Param) => {
|
||||
|
||||
//获取说明数据
|
||||
const [list, setList] = useState<any[]>([])
|
||||
const {fetchData: refundExplainFetchdata} = RefundExplainApi()
|
||||
const refundExplain = async () => {
|
||||
let res = await refundExplainFetchdata()
|
||||
setList(res.data.list)
|
||||
}
|
||||
const [reason, setReason] = useState({id:0, name:''})
|
||||
const reasonSelect = useCallback((e) => {
|
||||
setReason({...reason, name:e.name, id:e.id})
|
||||
submitData.current.return_explain = e.id
|
||||
closeReason()
|
||||
}, [])
|
||||
|
||||
|
||||
//备注
|
||||
@ -71,8 +85,6 @@ export default memo(({show, onClose, orderId}:Param) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popup show={show} title="申请退款" onClose={onClose} >
|
||||
@ -80,7 +92,7 @@ export default memo(({show, onClose, orderId}:Param) => {
|
||||
<View className={styles.returnSaleInput_item}>
|
||||
<View className={styles.title}>退款说明</View>
|
||||
<View className={styles.select} onClick={() => setShowReason(true)}>
|
||||
<Text>请选择</Text>
|
||||
<Text>{reason.name||'请选择'}</Text>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
|
||||
</View>
|
||||
</View>
|
||||
@ -93,7 +105,7 @@ export default memo(({show, onClose, orderId}:Param) => {
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
<ReasonPopup show={showReason} onClose={closeReason} list={list} title="退款说明"/>
|
||||
<ReasonPopup defaultValue={reason.id} show={showReason} onClose={closeReason} list={list} title="退款说明" onSelect={reasonSelect}/>
|
||||
</>
|
||||
)
|
||||
})
|
||||
@ -90,7 +90,6 @@
|
||||
.order_list_item_count{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
.count_num{
|
||||
color: $color_main;
|
||||
|
||||
@ -167,13 +167,13 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
<View className={styles.order_list_item_des}>
|
||||
<View className={styles.order_list_item_title}>
|
||||
{colorItem.code + ' ' + colorItem.name}
|
||||
{colorItem?.return_roll&&<Text>{`已退${colorItem?.return_roll}条`}</Text>}
|
||||
{(colorItem?.return_roll > 0)&&<Text>{`已退${colorItem?.return_roll}条`}</Text>}
|
||||
{(colorItem?.apply_return_roll > 0)&&<Text>{`待退${colorItem?.apply_return_roll}条`}</Text>}
|
||||
</View>
|
||||
<View className={styles.order_list_item_price}>
|
||||
¥{standardPrice(colorItem.sale_price)}
|
||||
{aboutWeight(colorItem.estimate_weight)}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
<View className={styles.order_list_item_count}>
|
||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
||||
|
||||
@ -27,6 +27,13 @@ $top:190px;
|
||||
text-align: center;
|
||||
padding: 25px 0;
|
||||
}
|
||||
.playMode{
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
font-size: 26px;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
.payment_list{
|
||||
background-color: #fff;
|
||||
@ -44,7 +51,7 @@ $top:190px;
|
||||
position: absolute;
|
||||
border-bottom: 3px dashed #ccc;
|
||||
top: $top;
|
||||
width: calc(100% - 100px);
|
||||
width: calc(100% - 50px);
|
||||
left:0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
|
||||
@ -11,7 +11,8 @@ import ScanPay from "../scanPay";
|
||||
import { GetOrderPayApi, SubmitOrderPayApi, GetPrepayOrderPayApi, SubmitPrepayOrderPayApi } from "@/api/orderPay";
|
||||
import { formatPriceDiv } from "@/common/fotmat";
|
||||
import {alert} from "@/common/common"
|
||||
import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
||||
import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum";
|
||||
import { UseSubscriptionMessage } from "@/use/useCommonData";
|
||||
|
||||
type Param = {
|
||||
show?: true|false,
|
||||
@ -21,11 +22,13 @@ type Param = {
|
||||
}
|
||||
|
||||
type OrderInfo = {
|
||||
id?: number, //销售单id
|
||||
should_collect_order_id?: number, //应付单id
|
||||
pre_collect_order_id?: number, //预付单id
|
||||
status?: number, //订单状态
|
||||
payment_method?: 0|PAYMENT_METHOD_PARAM //支付方式
|
||||
sale_mode?: number //订单类型 0:大货 1剪板 2散剪
|
||||
sale_mode?: number, //订单类型 0:大货 1剪板 2散剪
|
||||
[val: string]: any
|
||||
}
|
||||
|
||||
type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
|
||||
@ -88,28 +91,36 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
const periodSelectData = (val) => {
|
||||
setSubmitData((e) => ({...e, payment_method:val}))
|
||||
}
|
||||
|
||||
//订阅消息
|
||||
const {ToPay} = SUBSCRIPTION_MESSAGE_SCENE
|
||||
const {openSubscriptionMessage} = UseSubscriptionMessage()
|
||||
|
||||
//提交支付
|
||||
const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交
|
||||
const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交
|
||||
const submitPay = async () => {
|
||||
if(submitData.payment_method === null) {
|
||||
alert.error('请选择支付方式')
|
||||
return false
|
||||
}
|
||||
alert.loading('正在支付')
|
||||
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?.()
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
if(submitData.payment_method === null) {
|
||||
alert.error('请选择支付方式')
|
||||
return false
|
||||
}
|
||||
//账期支付,或预付款并且不是剪板才会订阅
|
||||
if((submitData.payment_method == PaymentMethodAccountPeriod.value || orderInfo?.status == SaleorderstatusWaitingPrePayment.value)&& orderInfo?.sale_mode != 1) {
|
||||
await openSubscriptionMessage({orderId: orderInfo?.id, scenes: ToPay.value})
|
||||
}
|
||||
alert.loading('正在支付')
|
||||
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?.()
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
}
|
||||
|
||||
//预付款
|
||||
@ -122,7 +133,6 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
|
||||
//是否显示七天账期
|
||||
const show_account_payment = useMemo(() => {
|
||||
console.log('orderInfo?.status::123',orderInfo)
|
||||
//剪板合散剪不显示
|
||||
if(orderInfo?.sale_mode != 0) return false
|
||||
//支付方式是账期支付,不显示
|
||||
@ -146,15 +156,22 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
const changeSelect = () => {
|
||||
}
|
||||
|
||||
//在线支付所需数据
|
||||
const onlinePayData = useMemo(() => {
|
||||
return {...orderInfo, offline_remittance_information: payInfo?.offline_remittance_information}
|
||||
|
||||
}, [orderInfo, payInfo])
|
||||
|
||||
return (
|
||||
<View className={styles.payment_main}>
|
||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
||||
<View className={styles.payment_con}>
|
||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_title)} onClick={onClose}></View>
|
||||
<View className={styles.title}>订单支付</View>
|
||||
<View className={styles.title}>待支付款项</View>
|
||||
<View className={styles.amount}>
|
||||
<AmountShow status={2} number={formatPriceDiv(payInfo?.should_collect_money - payInfo?.amount_paid)}/>
|
||||
</View>
|
||||
{(payInfo?.delivery_payment_name)&&<View className={styles.playMode}>已使用{payInfo?.delivery_payment_name}方式付款</View>}
|
||||
<View className={styles.payment_list}>
|
||||
<View className={styles.payment_list_top_border}></View>
|
||||
<View className={styles.payment_list_title}>
|
||||
@ -215,7 +232,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
||||
</View>
|
||||
</Popup>
|
||||
<OfflinePay show={offlinePayShow} onClose={() => setofflinePayShow(false)} offlineInfo={payInfo?.offline_remittance_information}/>
|
||||
<ScanPay show={scanPayShow} onClose={() => setScanPayShow(false)}/>
|
||||
<ScanPay orderInfo={onlinePayData} show={scanPayShow} onClose={() => setScanPayShow(false)} />
|
||||
</View>
|
||||
|
||||
)
|
||||
|
||||
@ -5,7 +5,7 @@ import styles from './index.module.scss'
|
||||
import Popup from "@/components/popup";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { alert } from "@/common/common";
|
||||
import { formatImgUrl } from "@/common/fotmat";
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from "@/common/fotmat";
|
||||
import useCheckAuthorize from "@/use/useCheckAuthorize";
|
||||
import { GetPayCode } from "@/api/onlinePay";
|
||||
import LoadingCard from "@/components/loadingCard";
|
||||
@ -13,45 +13,91 @@ import LoadingCard from "@/components/loadingCard";
|
||||
|
||||
type Param = {
|
||||
show?: true|false,
|
||||
onClose?: () => void
|
||||
onClose?: () => void,
|
||||
company?: string,
|
||||
qrcode?: string,
|
||||
orderInfo?: any,
|
||||
|
||||
}
|
||||
|
||||
|
||||
type Item = {
|
||||
type ListParam = {
|
||||
product_code: string,
|
||||
product_name: string,
|
||||
product_color_code: string,
|
||||
product_color_name: string,
|
||||
num: string,
|
||||
weight: string,
|
||||
length: string,
|
||||
sale_price: string,
|
||||
total_price: string
|
||||
}
|
||||
type CodeParam = {
|
||||
title: string,
|
||||
company: string,
|
||||
order_type: string,
|
||||
sale_user: string,
|
||||
order_created_time: string,
|
||||
order_no: string,
|
||||
department: string,
|
||||
shipment_mode: string,
|
||||
target_user_name: string,
|
||||
target_address: string,
|
||||
target_description: string,
|
||||
pay_account: string,
|
||||
bank_account_name: string,
|
||||
bank_name: string,
|
||||
pay_type: string,
|
||||
client: string,
|
||||
phone: string,
|
||||
order_total_length: string,
|
||||
order_total_price: string,
|
||||
qrcode: string,
|
||||
order_total_weight: string,
|
||||
list: Item[]
|
||||
}
|
||||
export default memo(({show = true, onClose}:Param) => {
|
||||
export default memo(({show = true, onClose, company, orderInfo}:Param) => {
|
||||
const [detail, setDetail] = useState<any>()
|
||||
|
||||
useEffect(() => {
|
||||
if(orderInfo) {
|
||||
console.log('orderInfo::',orderInfo)
|
||||
let lists:ListParam[] = []
|
||||
orderInfo.product_list?.map(pitem => {
|
||||
pitem?.product_colors?.map(citem => {
|
||||
lists.push({
|
||||
product_code: formatHashTag(pitem.code, '', 'name')!,
|
||||
product_name: pitem.name,
|
||||
product_color_code: formatHashTag(citem.code)!,
|
||||
product_color_name: citem.name,
|
||||
num: citem.roll.toString(),
|
||||
length: (citem.length/100).toString(),
|
||||
weight: formatWeightDiv(citem.estimate_weight).toString(),
|
||||
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
||||
total_price: formatPriceDiv(citem.estimate_amount).toString(),
|
||||
})
|
||||
})
|
||||
})
|
||||
setDetail(() => ({
|
||||
title: "面料销售电子确认单",
|
||||
company: orderInfo.company_name, //后端公司
|
||||
order_type: orderInfo.sale_mode_name, //类型:大货
|
||||
sale_user: orderInfo.sale_user_name, //业务员
|
||||
order_created_time: formatDateTime(orderInfo.create_time),
|
||||
order_no: orderInfo.order_no,
|
||||
shipment_mode: orderInfo.shipment_mode_name, //发货方式
|
||||
target_user_name: userName(orderInfo), //收件人
|
||||
target_address: address(orderInfo), //收货地址
|
||||
target_description: orderInfo.remark, //发货备注
|
||||
pay_account: orderInfo.offline_remittance_information?.transfer_remittance_account, //专属收款账号
|
||||
bank_account_name: orderInfo.offline_remittance_information?.account_name, //账户名称
|
||||
bank_name: orderInfo.offline_remittance_information?.bank_of_deposit, //开户银行
|
||||
pay_type:"", //支付方式, 可不传
|
||||
client: orderInfo.purchaser_name, //客户名称
|
||||
phone: userPhone(orderInfo), //收货手机号码
|
||||
order_total_length: (orderInfo.total_number/100).toString(), //订单布匹长度
|
||||
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(), //订单布匹重量
|
||||
list: lists
|
||||
}))
|
||||
}
|
||||
}, [orderInfo])
|
||||
|
||||
//收货地址
|
||||
const address = (addressInfo) => {
|
||||
if(addressInfo?.shipment_mode == 2) {
|
||||
return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:''
|
||||
} else {
|
||||
return addressInfo?.take_goods_address
|
||||
}
|
||||
}
|
||||
|
||||
//收件人
|
||||
const userName = (addressInfo) => {
|
||||
return addressInfo?.shipment_mode == 2? orderInfo.target_user_name: ''
|
||||
}
|
||||
|
||||
//手机号
|
||||
const userPhone = (addressInfo) => {
|
||||
return addressInfo?.shipment_mode == 2? orderInfo.target_user_phone : orderInfo.take_goods_phone
|
||||
}
|
||||
|
||||
|
||||
//获取支付二维码
|
||||
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
||||
@ -61,30 +107,7 @@ export default memo(({show = true, onClose}:Param) => {
|
||||
})
|
||||
const {fetchData, state} = GetPayCode()
|
||||
const getCore = async () => {
|
||||
let res = await fetchData({
|
||||
title: "面料销售电子确认单",
|
||||
company: "什么什么公司123",
|
||||
order_type: "散剪",
|
||||
sale_user: "小崔",
|
||||
order_created_time:"2022/02/01 12:32:13",
|
||||
order_no:"XS-211005888",
|
||||
department:"嘻嘻嘻",
|
||||
shipment_mode:"自提",
|
||||
target_user_name:"大崔",
|
||||
target_address:"阿斯顿发斯蒂芬",
|
||||
target_description:"无",
|
||||
pay_account:"1234567890123450001",
|
||||
bank_account_name:"佛山市浩川长盛科技有限公司",
|
||||
bank_name:"招商银行佛山分行禅城支行",
|
||||
pay_type:"现结",
|
||||
client:"客户名称",
|
||||
phone:"15818085802",
|
||||
order_total_length:"12",
|
||||
order_total_price:"63000",
|
||||
qrcode:"https://www.zzfzyc.com/checkorder/XS-211005888",
|
||||
order_total_weight:"300.00",
|
||||
list: [{product_code:'5215',product_name:'26S双纱亲水滑爽棉',product_color_code:'053',product_color_name:'洋红',num:'4',weight:'123.23',sale_price:'43',total_price:'4510.7'}]
|
||||
})
|
||||
let res = await fetchData(detail)
|
||||
const base64 = res.data.base64
|
||||
setPayCodeImage(() => base64)
|
||||
const time = new Date().valueOf()
|
||||
@ -98,7 +121,6 @@ export default memo(({show = true, onClose}:Param) => {
|
||||
data: fileData.current.base64,
|
||||
encoding: 'base64',
|
||||
})
|
||||
|
||||
}
|
||||
useEffect(() => {
|
||||
if(show)
|
||||
|
||||
@ -5,13 +5,15 @@ import {
|
||||
} from "@/api/order";
|
||||
import { GetOrderPayApi } from "@/api/orderPay";
|
||||
import { AddShoppingCartApi } from "@/api/shopCart";
|
||||
import { SubscriptionMessageApi } from "@/api/user";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import { ORDER_STATUS } from "@/common/enum";
|
||||
import { ORDER_STATUS, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum";
|
||||
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||
import OrderBtns from "@/components/orderBtns";
|
||||
import Popup from "@/components/popup";
|
||||
import SearchInput from "@/components/searchInput";
|
||||
import ShopCart from "@/components/shopCart";
|
||||
import useLogin from "@/use/useLogin";
|
||||
import { Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
@ -27,6 +29,7 @@ import Remark from "./components/remark";
|
||||
import styles from './index.module.scss'
|
||||
|
||||
export default () => {
|
||||
useLogin()
|
||||
const [showDesc, setShowDesc] = useState(false)
|
||||
const router = useRouter()
|
||||
const orderId = useRef<number>(Number(router.params.id))
|
||||
@ -34,7 +37,20 @@ import styles from './index.module.scss'
|
||||
getSaleOrderPreView()
|
||||
})
|
||||
|
||||
//订单状态枚举
|
||||
const {
|
||||
SaleOrderStatusTaking,
|
||||
SaleOrderStatusWaitingDelivery,
|
||||
SaleOrderStatusWaitingReceipt, // 待收货
|
||||
SaleOrderStatusAlreadyReceipt, // 已收货
|
||||
SaleOrderStatusComplete, // 已完成
|
||||
SaleOrderStatusRefund, // 已退款
|
||||
SaleOrderStatusCancel, // 已取消
|
||||
SaleorderstatusWaitingPrePayment, // 预付款
|
||||
} = ORDER_STATUS
|
||||
|
||||
//获取订单详情
|
||||
const firstOpen = useRef(true)
|
||||
const [orderDetail, setOrderDetail] = useState<any>() //获取到的原始数据
|
||||
const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
|
||||
const getSaleOrderPreView = async () => {
|
||||
@ -42,6 +58,10 @@ import styles from './index.module.scss'
|
||||
let res = await getOrderFetchData({id: orderId.current})
|
||||
setOrderDetail(res.data)
|
||||
setOrderRemark(res.data.remark)
|
||||
if(firstOpen.current) {
|
||||
firstOpen.current = false
|
||||
toPay()
|
||||
}
|
||||
}
|
||||
Taro.stopPullDownRefresh()
|
||||
Taro.hideToast()
|
||||
@ -103,7 +123,9 @@ import styles from './index.module.scss'
|
||||
shipment_mode: orderDetail?.shipment_mode,
|
||||
id: orderDetail?.id,
|
||||
sale_mode: orderDetail?.sale_mode,
|
||||
status: orderDetail?.status
|
||||
status: orderDetail?.status,
|
||||
take_goods_address: orderDetail?.take_goods_address,
|
||||
take_goods_phone: orderDetail?.take_goods_phone
|
||||
}
|
||||
|
||||
}, [orderDetail])
|
||||
@ -122,6 +144,19 @@ import styles from './index.module.scss'
|
||||
}
|
||||
setShowDesc(() => false)
|
||||
}, [])
|
||||
const noCanOpenDescList = useRef([
|
||||
SaleOrderStatusTaking.value, //提货中
|
||||
SaleOrderStatusWaitingDelivery.value, //待发货
|
||||
SaleOrderStatusWaitingReceipt.value, // 待收货
|
||||
SaleOrderStatusAlreadyReceipt.value, // 已收货
|
||||
SaleOrderStatusComplete.value, // 已完成
|
||||
SaleOrderStatusRefund.value, // 已退款
|
||||
SaleOrderStatusCancel.value, // 已取消
|
||||
])
|
||||
const descOpen = () => {
|
||||
if(noCanOpenDescList.current.includes(orderDetail?.status)) return alert.none('该订单状态不能修改备注')
|
||||
setShowDesc(() => true)
|
||||
}
|
||||
|
||||
//去付款
|
||||
const [payMentShow, setPayMentShow] = useState(false)
|
||||
@ -144,7 +179,6 @@ import styles from './index.module.scss'
|
||||
|
||||
//获取底部按钮点击, 获取按钮状态
|
||||
const orderStateClick = useCallback((val) => {
|
||||
console.log('123456789',val)
|
||||
if(val == 1 || val == 6) {
|
||||
//取消订单
|
||||
getSaleOrderPreView()
|
||||
@ -191,8 +225,7 @@ import styles from './index.module.scss'
|
||||
}
|
||||
}, [orderDetail])
|
||||
|
||||
//订单状态枚举
|
||||
const {SaleOrderStatusCancel, SaleorderstatusWaitingPrePayment} = ORDER_STATUS
|
||||
|
||||
|
||||
//刷新页面
|
||||
const refresh = useCallback(() => {
|
||||
@ -268,11 +301,11 @@ import styles from './index.module.scss'
|
||||
<SearchInput showBorder={false} title='下单时间' height={50}>
|
||||
<Text>{formatDateTime(orderDetail?.create_time)}</Text>
|
||||
</SearchInput>
|
||||
<SearchInput showBorder={false} title='付款时间' height={50}>
|
||||
<Text>{formatDateTime(orderDetail?.create_time)}</Text>
|
||||
</SearchInput>
|
||||
{(orderDetail?.payment_time)&&<SearchInput showBorder={false} title='付款时间' height={50}>
|
||||
<Text>{formatDateTime(orderDetail?.payment_time)}</Text>
|
||||
</SearchInput>}
|
||||
</View>
|
||||
<View className={styles.order_desc} onClick={() => setShowDesc(true)}>
|
||||
<View className={styles.order_desc} onClick={descOpen}>
|
||||
<View className={styles.order_desc_con}>订单备注</View>
|
||||
{
|
||||
orderRemark&&<View className={styles.order_desc_text}>{orderDetail?.remark}</View>||
|
||||
|
||||
@ -9,38 +9,46 @@
|
||||
.user{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.name {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
margin-left: 15px;
|
||||
font-size: $font_size;
|
||||
}
|
||||
|
||||
image{
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.order_num {
|
||||
flex: 1;
|
||||
font-size: $font_size_medium;
|
||||
color: $color_font_one;
|
||||
text-align: right;
|
||||
padding-right: 30px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
.miconfont {
|
||||
font-size: 20px;
|
||||
.order_con {
|
||||
padding-left: 15px;
|
||||
width: 100%;
|
||||
.name {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
font-size: $font_size;
|
||||
}
|
||||
.order_num {
|
||||
font-size: $font_size_medium;
|
||||
padding-right: 30px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
.order_num_con{
|
||||
flex:1;
|
||||
}
|
||||
.miconfont {
|
||||
font-size: 20px;
|
||||
}
|
||||
.order_no{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.tag{
|
||||
font-size: $font_size_min;
|
||||
padding: 5px 15px;
|
||||
background-color: $color_main;
|
||||
color: #fff;
|
||||
border-radius: 0px 20px 0px 20px;
|
||||
.product_status{
|
||||
font-size: $font_size;
|
||||
color: $color_main;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
}
|
||||
.product_con{
|
||||
margin-bottom: 20px;
|
||||
@ -63,9 +71,15 @@
|
||||
padding: 0 20px;
|
||||
@include common_ellipsis()
|
||||
}
|
||||
.product_status{
|
||||
font-size: $font_size;
|
||||
color: $color_main;
|
||||
|
||||
.tag{
|
||||
font-size: $font_size_min;
|
||||
padding: 5px 15px;
|
||||
background-color: $color_main;
|
||||
color: #fff;
|
||||
border-radius: 0px 20px 0px 20px;
|
||||
position:relative;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
.product_list{
|
||||
|
||||
@ -5,6 +5,7 @@ import OrderBtns from "@/components/orderBtns";
|
||||
import Payment from "@/pages/order/components/payment";
|
||||
import { useSelector } from "@/reducers/hooks";
|
||||
import { Image, Text, View } from "@tarojs/components"
|
||||
import { useRouter } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
import { memo, useCallback, useMemo, useRef, useState } from "react";
|
||||
import styles from './index.module.scss'
|
||||
@ -29,10 +30,12 @@ type Param = {
|
||||
actual_amount: number, //实付金额
|
||||
wait_pay_amount: number, //待付金额
|
||||
should_collect_order_id: number, //应付单id
|
||||
av_return_roll: number
|
||||
},
|
||||
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
||||
}
|
||||
export default memo(({value, onClickBtn}: Param) => {
|
||||
|
||||
const userInfo = useSelector(state => state.userInfo)
|
||||
//对应数量
|
||||
const formatCount = useCallback((item, sale_mode) => {
|
||||
@ -56,6 +59,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
actual_amount: value?.actual_amount, //实付金额
|
||||
wait_pay_amount: value?.wait_pay_amount, //待付金额
|
||||
sale_mode: value?.sale_mode, //订单类型
|
||||
av_return_roll: value?.av_return_roll //可退条数
|
||||
}
|
||||
}, [value])
|
||||
|
||||
@ -68,20 +72,26 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
<View className={styles.order_item}>
|
||||
<View className={styles.header} onClick={() => goLink('/pages/order/index', {id: value?.id})}>
|
||||
<View className={styles.user}>
|
||||
<Image src={`${userInfo?.adminUserInfo?.avatar_url}`}/>
|
||||
<Text className={styles.name}>{userInfo?.adminUserInfo?.user_name}</Text>
|
||||
<Image src={`${userInfo?.adminUserInfo?.avatar_url}`}/>
|
||||
</View>
|
||||
<View className={styles.order_num}>
|
||||
<Text>订单号:{value?.order_no}</Text>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
||||
<View className={styles.order_con}>
|
||||
<Text className={styles.name}>{userInfo?.adminUserInfo?.user_name}</Text>
|
||||
<View className={styles.order_num}>
|
||||
<View className={styles.order_num_con}>
|
||||
<Text className={styles.order_no}>订单号:{value?.order_no}</Text>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
||||
</View>
|
||||
<View className={styles.product_status}>{value?.status_name}</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.tag}>{value?.shipment_mode_name}</View>
|
||||
|
||||
|
||||
</View>
|
||||
<View className={styles.product_con} onClick={() => goLink('/pages/order/index', {id: value?.id})}>
|
||||
<View className={styles.product_title}>
|
||||
<View className={styles.product_tag}>{value?.sale_mode_name}</View>
|
||||
<View className={styles.product_name}>{formatHashTag(value?.product_list[0].code, value?.product_list[0].name)}</View>
|
||||
<View className={styles.product_status}>{value?.status_name}</View>
|
||||
<View className={styles.tag}>{value?.shipment_mode_name}</View>
|
||||
</View>
|
||||
<View className={styles.product_list}>
|
||||
<View className={styles.image}>
|
||||
|
||||
@ -15,8 +15,8 @@ export default memo(({list = [], defaultId = null, onSelect}: Param) => {
|
||||
})
|
||||
useEffect(() => {
|
||||
if(defaultId) {
|
||||
console.log('defaultId:::', defaultId)
|
||||
const index = list?.findIndex(item => {
|
||||
console.log(item.id, defaultId)
|
||||
return item.id == defaultId
|
||||
})
|
||||
if(index !== -1) {
|
||||
@ -24,6 +24,7 @@ export default memo(({list = [], defaultId = null, onSelect}: Param) => {
|
||||
setSelectInfo((e) => ({...e, tabId:list[num].id.toString()}))
|
||||
}
|
||||
}
|
||||
setSelectInfo((e) => ({...e, selected: defaultId||-1}))
|
||||
}, [defaultId])
|
||||
const clickEvent = ({item, index}: {item:any, index:number}) => {
|
||||
const num = index > 0?( index - 1) : 0
|
||||
|
||||
194
src/pages/orderList/index copy.tsx
Normal file
194
src/pages/orderList/index copy.tsx
Normal file
@ -0,0 +1,194 @@
|
||||
import Search from "@/components/search"
|
||||
import useLogin from "@/use/useLogin"
|
||||
import { Image, ScrollView, Text, View } from "@tarojs/components"
|
||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import styles from './index.module.scss'
|
||||
import classnames from "classnames";
|
||||
import Order from "./components/order"
|
||||
import InfiniteScroll from "@/components/infiniteScroll"
|
||||
import {GetOrderStatusListApi, GetOrderListApi, OrderStatusListApi} from '@/api/order'
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util"
|
||||
import OrderStatusList from "./components/orderStatusList"
|
||||
import Payment from "../order/components/payment"
|
||||
import { ORDER_STATUS } from "@/common/enum"
|
||||
import { AddShoppingCartApi } from "@/api/shopCart"
|
||||
import ShopCart from "@/components/shopCart"
|
||||
import ApplyRefund from "./components/applyRefund"
|
||||
import { alert } from "@/common/common"
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
|
||||
//搜索参数
|
||||
const [searchField, setSearchField] = useState({
|
||||
status: -1,
|
||||
page : 1,
|
||||
size : 10,
|
||||
Name:''
|
||||
})
|
||||
|
||||
//获取订单状态
|
||||
const {fetchData: orderStatusListFetchData} = OrderStatusListApi()
|
||||
const [statusList, setStatusList] = useState<any[]>([{id: -1, name: '全部'}])
|
||||
const getOrderStatusList = () => {
|
||||
const status = Object.values(ORDER_STATUS).map(item => {
|
||||
return {id: item.value, name: item.label}
|
||||
})
|
||||
setStatusList((e) => [...e, ...status])
|
||||
}
|
||||
useEffect(() => {
|
||||
getOrderStatusList()
|
||||
}, [])
|
||||
|
||||
//获取订单列表
|
||||
const {fetchData: listFetchData, state:orderState} = GetOrderListApi()
|
||||
const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0})
|
||||
const getOrderList = async () => {
|
||||
let res = await listFetchData(getFilterData(searchField))
|
||||
setOrderData({list: res.data.list, total: res.data.total})
|
||||
setRefresherTriggeredStatus(() => false)
|
||||
}
|
||||
|
||||
|
||||
//监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
}, [searchField])
|
||||
|
||||
//上拉加载数据
|
||||
const pageNum = useRef({size: searchField.size, page: searchField.page})
|
||||
const getScrolltolower = useCallback(() => {
|
||||
if(orderData.list.length < orderData.total) {
|
||||
pageNum.current.page++
|
||||
const size = pageNum.current.size * pageNum.current.page
|
||||
setSearchField({...searchField, size })
|
||||
}
|
||||
}, [orderData])
|
||||
|
||||
//状态改变
|
||||
const changeStatus = useCallback((e) => {
|
||||
pageNum.current.page = 1
|
||||
setSearchField((value) => ({...value, status:e, size:10}))
|
||||
setOrderData(() => ({list:[], total:0}))
|
||||
}, [])
|
||||
|
||||
|
||||
//数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({list:orderData.list, total: orderData.total, status: orderState.loading})
|
||||
}, [orderData, orderState])
|
||||
|
||||
//输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
pageNum.current.page = 1
|
||||
setOrderData(() => ({list:[], total:0}))
|
||||
setSearchField((val) => ({...val, name:e, size:10}))
|
||||
}, [])
|
||||
|
||||
|
||||
//列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getRefresherRefresh = async () => {
|
||||
pageNum.current.size = 1
|
||||
setRefresherTriggeredStatus(true)
|
||||
setSearchField((val) => ({...val, size:10}))
|
||||
}
|
||||
|
||||
//监听点击的按钮
|
||||
const clickOrderBtn = useCallback(({status, orderInfo}) => {
|
||||
setCallBackPayOrderInfo(() => orderInfo)
|
||||
if(status == 1 || status == 6) {
|
||||
getOrderList()
|
||||
} else if(status == 2) {
|
||||
//去支付
|
||||
toPay()
|
||||
} else if (status == 3) {
|
||||
//申请退款
|
||||
if(!orderInfo?.av_return_roll) return alert.none('该订单已申请过退款')
|
||||
setRefundShow(true)
|
||||
} else if (status == 7) {
|
||||
//购买
|
||||
addShopCart(orderInfo)
|
||||
}
|
||||
}, [orderData])
|
||||
|
||||
|
||||
const [callBackOrderInfo, setCallBackPayOrderInfo] = useState<any>()
|
||||
|
||||
//去付款
|
||||
const [payMentShow, setPayMentShow] = useState(false)
|
||||
const toPay = () => {
|
||||
setPayMentShow(true)
|
||||
}
|
||||
//关闭支付弹窗
|
||||
const closePayShow = useCallback(() => {
|
||||
setPayMentShow(() => false)
|
||||
}, [])
|
||||
//支付成功
|
||||
const onPaySuccess = useCallback(() => {
|
||||
getOrderList()
|
||||
closePayShow()
|
||||
}, [])
|
||||
|
||||
//添加购物车
|
||||
const [showCart, setShowCart] = useState(false)
|
||||
const {fetchData:addFetchData} = AddShoppingCartApi()
|
||||
const addShopCart = async (item) => {
|
||||
let color_list:{product_color_id: number, roll?: number, length?: number}[] = []
|
||||
item?.product_list.map(pitem => {
|
||||
pitem?.product_colors.map(citem => {
|
||||
if(item?.sale_mode == 0) {
|
||||
return color_list.push({product_color_id: citem.id, roll: citem.roll})
|
||||
} else {
|
||||
return color_list.push({product_color_id: citem.id, length: citem.length})
|
||||
}
|
||||
})
|
||||
})
|
||||
const state = await addFetchData({
|
||||
sale_mode: item?.sale_mode,
|
||||
color_list
|
||||
})
|
||||
if(state.success) {
|
||||
Taro.showToast({
|
||||
title:'已加入购物车'
|
||||
})
|
||||
setShowCart(true)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
icon:'none',
|
||||
title: state.msg
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//申请退款
|
||||
const [refundShow, setRefundShow] = useState(false)
|
||||
const applyRefundClose = useCallback(() => {
|
||||
setRefundShow(false)
|
||||
}, [])
|
||||
|
||||
|
||||
return (
|
||||
<View className={styles.order_list_main}>
|
||||
<View className={styles.title}>
|
||||
<Search placeIcon="out" placeholder="搜索商品/名称/颜色/订单号" showBtn={true} changeOnSearch={getSearchData} debounceTime={300}/>
|
||||
<OrderStatusList list={statusList} onSelect={changeStatus} defaultId={1}/>
|
||||
</View>
|
||||
<View className={styles.order_list}>
|
||||
<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>
|
||||
})}
|
||||
</InfiniteScroll>
|
||||
</View>
|
||||
<ApplyRefund show={refundShow} onClose={applyRefundClose} orderId={callBackOrderInfo?.id}/>
|
||||
<ShopCart show={showCart} onClose={() => setShowCart(false)}/>
|
||||
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={callBackOrderInfo}/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -1,21 +1,20 @@
|
||||
import Search from "@/components/search"
|
||||
import useLogin from "@/use/useLogin"
|
||||
import { Image, ScrollView, Text, View } from "@tarojs/components"
|
||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"
|
||||
import {View } from "@tarojs/components"
|
||||
import Taro, { useDidShow,} from "@tarojs/taro"
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import styles from './index.module.scss'
|
||||
import classnames from "classnames";
|
||||
import Order from "./components/order"
|
||||
import InfiniteScroll from "@/components/infiniteScroll"
|
||||
import {GetOrderStatusListApi, GetOrderListApi} from '@/api/order'
|
||||
import { GetOrderListApi, OrderStatusListApi} from '@/api/order'
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util"
|
||||
import OrderStatusList from "./components/orderStatusList"
|
||||
import Payment from "../order/components/payment"
|
||||
import { ORDER_STATUS } from "@/common/enum"
|
||||
import { AddShoppingCartApi } from "@/api/shopCart"
|
||||
import ShopCart from "@/components/shopCart"
|
||||
import ApplyRefund from "./components/applyRefund"
|
||||
import { alert } from "@/common/common"
|
||||
import { useRouter } from "@tarojs/runtime"
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
@ -23,22 +22,30 @@ export default () => {
|
||||
await checkLogin()
|
||||
})
|
||||
|
||||
//传递过来的参数
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
if(router?.params.status != undefined && router?.params.status !== '') {
|
||||
setSearchField((e) => ({...e, status: router?.params.status as number}))
|
||||
} else {
|
||||
setSearchField((e) => ({...e, status:-1}))
|
||||
}
|
||||
}, [router])
|
||||
|
||||
//搜索参数
|
||||
const [searchField, setSearchField] = useState({
|
||||
status: -1,
|
||||
const [searchField, setSearchField] = useState<{status: number|null, page: number, size: number, name: string}>({
|
||||
status: null,
|
||||
page : 1,
|
||||
size : 10,
|
||||
Name:''
|
||||
name:''
|
||||
})
|
||||
|
||||
//获取订单状态
|
||||
// const {fetchData: statusFetchData} = GetOrderStatusListApi()
|
||||
const {fetchData: orderStatusListFetchData} = OrderStatusListApi()
|
||||
const [statusList, setStatusList] = useState<any[]>([{id: -1, name: '全部'}])
|
||||
const getOrderStatusList = () => {
|
||||
const status = Object.values(ORDER_STATUS).map(item => {
|
||||
return {id: item.value, name: item.label}
|
||||
})
|
||||
setStatusList((e) => [...e, ...status])
|
||||
const getOrderStatusList = async () => {
|
||||
let res = await orderStatusListFetchData()
|
||||
setStatusList((e) => [...e, ...res.data.list])
|
||||
}
|
||||
useEffect(() => {
|
||||
getOrderStatusList()
|
||||
@ -49,14 +56,13 @@ export default () => {
|
||||
const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0})
|
||||
const getOrderList = async () => {
|
||||
let res = await listFetchData(getFilterData(searchField))
|
||||
setOrderData({list: res.data.list, total: res.data.total})
|
||||
setOrderData((e) => ({...e, list: res.data.list, total: res.data.total}))
|
||||
setRefresherTriggeredStatus(() => false)
|
||||
}
|
||||
|
||||
|
||||
//监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
if(searchField.status != null) getOrderList()
|
||||
}, [searchField])
|
||||
|
||||
//上拉加载数据
|
||||
@ -177,7 +183,7 @@ export default () => {
|
||||
<View className={styles.order_list_main}>
|
||||
<View className={styles.title}>
|
||||
<Search placeIcon="out" placeholder="搜索商品/名称/颜色/订单号" showBtn={true} changeOnSearch={getSearchData} debounceTime={300}/>
|
||||
<OrderStatusList list={statusList} onSelect={changeStatus} defaultId={1}/>
|
||||
<OrderStatusList list={statusList} onSelect={changeStatus} defaultId={router?.params.status as number}/>
|
||||
</View>
|
||||
<View className={styles.order_list}>
|
||||
<InfiniteScroll statusMore={statusMore} selfonScrollToLower={getScrolltolower} refresherEnabled={false} refresherTriggered={refresherTriggeredStatus} selfOnRefresherRefresh={getRefresherRefresh}>
|
||||
|
||||
@ -78,9 +78,9 @@
|
||||
width:152px;
|
||||
font-size: 28px;
|
||||
height: 60px;
|
||||
color: $color_font_two;
|
||||
color:#007AFF;
|
||||
z-index: 999;
|
||||
border: 2px solid #dddddd;
|
||||
border: 2px solid #007AFF;
|
||||
border-radius: 36px;
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
|
||||
@ -7,8 +7,8 @@ import styles from './index.module.scss'
|
||||
type Param = {
|
||||
return_address?:string,
|
||||
return_phone?: string,
|
||||
onLogistics?: (val: number) => void,
|
||||
stage?: number
|
||||
onLogistics?: (val: 1|2) => void, //1 上传物流 2 查看物流
|
||||
stage?: number,
|
||||
}
|
||||
export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => {
|
||||
const {
|
||||
@ -30,12 +30,7 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage
|
||||
//上传物流
|
||||
const upLogistics = useMemo(() => {
|
||||
return stage == ReturnStageWaitCheck.value
|
||||
}, [stage])
|
||||
|
||||
//查看物流
|
||||
const showLogistics = useMemo(() => {
|
||||
return (stage == ReturnStageChecked.value || stage == ReturnStageQualityCheckPendingRefund.value)
|
||||
}, [stage])
|
||||
}, [stage])
|
||||
|
||||
|
||||
return (
|
||||
@ -56,8 +51,8 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage
|
||||
<Text>{return_phone}</Text>
|
||||
{upLogistics&&<View className={styles.updateBtn} onClick={() => onLogistics?.(1)}>
|
||||
上传物流
|
||||
</View>}
|
||||
{showLogistics&&<View className={styles.updateBtn} onClick={() => onLogistics?.(2)}>
|
||||
</View>
|
||||
||<View className={styles.updateBtn} onClick={() => onLogistics?.(2)}>
|
||||
查看物流
|
||||
</View>}
|
||||
</View>
|
||||
|
||||
@ -89,6 +89,11 @@
|
||||
.order_list_item_price{
|
||||
font-size: 26px;
|
||||
color: $color_font_three;
|
||||
text{
|
||||
&:nth-child(1) {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_list_item_count{
|
||||
|
||||
@ -98,7 +98,10 @@ export default memo(({show, onClose, onSubmit, id}:Param) => {
|
||||
<View className={styles.order_list_item_con}>
|
||||
<View className={styles.order_list_item_des}>
|
||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
||||
<View className={styles.order_list_item_price}>¥{standardPrice(colorItem.sale_price)}</View>
|
||||
<View className={styles.order_list_item_price}>
|
||||
<Text>¥{standardPrice(colorItem.sale_price)}</Text>
|
||||
<Text>总重{standardPrice(colorItem.estimate_weight)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.order_list_item_count}>
|
||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{formatDetailOrder.unit}</text></View>
|
||||
|
||||
131
src/pages/salesAfter/components/cutlKindList/index.module.scss
Normal file
131
src/pages/salesAfter/components/cutlKindList/index.module.scss
Normal file
@ -0,0 +1,131 @@
|
||||
|
||||
.kindsList_main{
|
||||
margin-top: 20px;
|
||||
}
|
||||
.orders_list_con{
|
||||
|
||||
background-color: #fff;
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
.orders_return_title{
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.order_list{
|
||||
&:nth-child(n+2) {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.order_list_title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.tag{
|
||||
font-size: $font_size_min;
|
||||
background-color: #CDE5FF;
|
||||
padding: 5px 10px;
|
||||
border-radius: 6px;
|
||||
color: $color_main;
|
||||
}
|
||||
.title{
|
||||
font-weight: 700;
|
||||
font-size: $font_size;
|
||||
margin-left: 20px;
|
||||
flex:1;
|
||||
}
|
||||
.num{
|
||||
color: $color_font_two;
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_list_scroll{
|
||||
margin-top: 30px;
|
||||
|
||||
.order_list_item {
|
||||
display: flex;
|
||||
&:nth-child(2) {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.order_list_item_img{
|
||||
width: 126px;
|
||||
height: 126px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.order_list_item_con{
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex:1;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
height: 150px;
|
||||
padding-top: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.order_list_item_des{
|
||||
flex:1;
|
||||
box-sizing: border-box;
|
||||
padding-left: 30px;
|
||||
.order_list_item_title{
|
||||
font-weight: 700;
|
||||
font-size: $font_size;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.order_list_item_price{
|
||||
font-size: 26px;
|
||||
color: $color_font_three;
|
||||
text{
|
||||
&:nth-child(n+1) {
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_list_item_count{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
.count_num{
|
||||
color: $color_main;
|
||||
font-size: $font_size;
|
||||
margin-bottom: 15px;
|
||||
font-weight: 400;
|
||||
text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
.count_price {
|
||||
font-size: $font_size;
|
||||
font-weight: 700;
|
||||
text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_total{
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
text{
|
||||
&:nth-child(1) {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_estimated_amount{
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
flex-direction: column;
|
||||
padding: 30px 0;
|
||||
.order_price_des{
|
||||
font-size: $font_size_medium;
|
||||
color: $color_font_two;
|
||||
}
|
||||
}
|
||||
}
|
||||
192
src/pages/salesAfter/components/cutlKindList/index.tsx
Normal file
192
src/pages/salesAfter/components/cutlKindList/index.tsx
Normal file
@ -0,0 +1,192 @@
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
|
||||
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import { Text, View } from "@tarojs/components"
|
||||
import { memo, useCallback, useMemo } from "react"
|
||||
import EstimatedAmount from "../estimatedAmount"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type OrderParam = {
|
||||
estimate_amount: number, //预估金额
|
||||
list: any[],
|
||||
sale_mode: number,
|
||||
sale_mode_name: string,
|
||||
unit: string,
|
||||
total_colors: number,
|
||||
total_fabrics: number,
|
||||
total_number: number,
|
||||
stage: number, //订单状态
|
||||
type: 1|2, //1退货, 2退款
|
||||
total_sale_price: number, //销售金额
|
||||
total_should_collect_money: number, //应收金额
|
||||
total_weight_error_discount: number, //空差优惠
|
||||
the_previous_status: number, //取消订单时的订单状态
|
||||
actual_amount: number //实付金额
|
||||
}
|
||||
|
||||
type Param = {
|
||||
order: OrderParam,
|
||||
comfirm?: boolean //是否是确认订单页面使用
|
||||
}
|
||||
|
||||
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)
|
||||
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
|
||||
}, [order])
|
||||
|
||||
//售后单状态枚举
|
||||
const {
|
||||
ReturnStageApplying, // 申请中
|
||||
ReturnStageWaitCheck, // 退货中
|
||||
ReturnStageChecked, // 待验布
|
||||
ReturnStageReturned, // 已退款
|
||||
ReturnStageCancel, // 已取消
|
||||
ReturnStageQualityCheckPendingRefund, // 已验布
|
||||
ReturnStageServiceOrderPendingRefund, // 待退款
|
||||
ReturnStageRejected, // 已拒绝
|
||||
} = AFTER_ORDER_STATUS
|
||||
|
||||
|
||||
//金额列表枚举
|
||||
const priceList = [
|
||||
{
|
||||
id:1,
|
||||
value:[],
|
||||
label:'退货条数',
|
||||
field: ''
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
value:[
|
||||
ReturnStageServiceOrderPendingRefund.value,
|
||||
ReturnStageReturned.value
|
||||
],
|
||||
label:'扣款金额',
|
||||
field: 'total_sale_price'
|
||||
},
|
||||
{
|
||||
id:3,
|
||||
value:[
|
||||
ReturnStageServiceOrderPendingRefund.value,
|
||||
ReturnStageReturned.value
|
||||
],
|
||||
label:'其他扣款',
|
||||
field: 'total_weight_error_discount'
|
||||
},
|
||||
{
|
||||
id:4,
|
||||
value:[
|
||||
ReturnStageServiceOrderPendingRefund.value,
|
||||
ReturnStageReturned.value
|
||||
],
|
||||
label:'应退金额',
|
||||
field: 'total_should_collect_money'
|
||||
},
|
||||
{
|
||||
id:5,
|
||||
value:[ReturnStageReturned.value],
|
||||
label:'退款金额',
|
||||
field: 'total_should_collect_money'
|
||||
},
|
||||
{
|
||||
id:6,
|
||||
value:[ReturnStageReturned.value],
|
||||
label:'退款去向',
|
||||
field: 'actual_amount'
|
||||
},
|
||||
{
|
||||
id:7,
|
||||
value:[ReturnStageQualityCheckPendingRefund.value],
|
||||
label:'合计金额',
|
||||
field: 'actual_amount'
|
||||
},
|
||||
]
|
||||
|
||||
//是否显示价格
|
||||
const showPrice = useCallback((priceInfo) => {
|
||||
if(priceInfo.value == 8) {
|
||||
//合计金额
|
||||
|
||||
}
|
||||
return priceInfo.value.includes(order?.stage)
|
||||
}, [order])
|
||||
|
||||
const priceConDom = useMemo(() => {
|
||||
if(!order) return
|
||||
return (
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
)
|
||||
}, [order])
|
||||
|
||||
//整理颜色
|
||||
const labAndRgbAndUrl = useCallback((item) => {
|
||||
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
|
||||
}, [])
|
||||
|
||||
//单价显示判断
|
||||
const sale_price_show = useMemo(() => {
|
||||
return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
|
||||
}, [order])
|
||||
|
||||
return (
|
||||
<View className={styles.kindsList_main}>
|
||||
<View className={styles.orders_list_con}>
|
||||
<View className={styles.orders_return_title}>{order?.type == 1?'退货信息':'退款信息'}</View>
|
||||
{
|
||||
order?.list?.map(item => {
|
||||
return <View key={item.product_code} className={styles.order_list}>
|
||||
<View className={styles.order_list_title}>
|
||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||
<View className={styles.num}>共{item?.product_colors?.length}种</View>
|
||||
</View>
|
||||
<View className={styles.order_list_scroll}>
|
||||
{item?.product_colors?.map(colorItem => {
|
||||
return <View key={colorItem.id} className={styles.order_list_item}>
|
||||
<View className={styles.order_list_item_img}>
|
||||
<LabAndImg value={labAndRgbAndUrl(colorItem)}/>
|
||||
</View>
|
||||
<View className={styles.order_list_item_con}>
|
||||
<View className={styles.order_list_item_des}>
|
||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
||||
<View className={styles.order_list_item_price}>
|
||||
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
|
||||
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.order_list_item_count}>
|
||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
||||
<View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
<View className={styles.order_total}><Text>合计</Text><Text>{numText}</Text></View>
|
||||
<View className={styles.order_estimated_amount}>
|
||||
{priceConDom}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
@ -72,6 +72,11 @@
|
||||
.order_list_item_price{
|
||||
font-size: 26px;
|
||||
color: $color_font_three;
|
||||
text{
|
||||
&:nth-child(n+1) {
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_list_item_count{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ORDER_STATUS } from "@/common/enum"
|
||||
import { formatHashTag, formatPriceDiv } from "@/common/fotmat"
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS } from "@/common/enum"
|
||||
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import { Text, View } from "@tarojs/components"
|
||||
import { memo, useCallback, useMemo } from "react"
|
||||
@ -17,6 +17,7 @@ type OrderParam = {
|
||||
total_number: number,
|
||||
stage: number, //订单状态
|
||||
type: 1|2, //1退货, 2退款
|
||||
refund_type: number, //退款状态
|
||||
total_sale_price: number, //销售金额
|
||||
total_should_collect_money: number, //应收金额
|
||||
total_weight_error_discount: number, //空差优惠
|
||||
@ -45,68 +46,92 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
|
||||
}, [order])
|
||||
|
||||
// const {
|
||||
// SaleOrderStatusBooking, // 待接单
|
||||
// SaleOrderStatusArranging, // 配布中
|
||||
// SaleOrderStatusArranged, // 已配布
|
||||
// SaleOrderStatusWaitingPayment, // 待付款
|
||||
// SaleOrderStatusWaitingDelivery, // 待发货
|
||||
// SaleOrderStatusWaitingReceipt, // 待收货
|
||||
// SaleOrderStatusAlreadyReceipt, // 已收货
|
||||
// SaleOrderStatusComplete, // 已完成
|
||||
// SaleOrderStatusRefund, // 已退款
|
||||
// SaleOrderStatusCancel, // 已取消
|
||||
// } = ORDER_STATUS
|
||||
//售后单状态枚举
|
||||
const {
|
||||
ReturnStageApplying, // 申请中
|
||||
ReturnStageWaitCheck, // 退货中
|
||||
ReturnStageChecked, // 待验布
|
||||
ReturnStageReturned, // 已退款
|
||||
ReturnStageCancel, // 已取消
|
||||
ReturnStageQualityCheckPendingRefund, // 已验布
|
||||
ReturnStageServiceOrderPendingRefund, // 待退款
|
||||
ReturnStageRejected, // 已拒绝
|
||||
} = AFTER_ORDER_STATUS
|
||||
|
||||
//退款状态枚举
|
||||
const {
|
||||
ShouldCollectOrderRefundTypeUnknown,
|
||||
ShouldCollectOrderRefundTypeAdvanceReceiptRefund,
|
||||
ShouldCollectOrderRefundTypeReturnForRefund,
|
||||
ShouldCollectOrderRefundTypeSalesRefund,
|
||||
} = REFUND_STATUS
|
||||
|
||||
//金额列表枚举
|
||||
const priceList = [
|
||||
{
|
||||
id:1,
|
||||
value:[],
|
||||
label:'退货条数',
|
||||
field: 'estimate_amount'
|
||||
id:5,
|
||||
big_value:[
|
||||
ReturnStageQualityCheckPendingRefund.value,
|
||||
ReturnStageServiceOrderPendingRefund.value,
|
||||
ReturnStageReturned.value,
|
||||
],
|
||||
cut_value: [ReturnStageRejected.value,
|
||||
ReturnStageApplying.value,
|
||||
ReturnStageWaitCheck.value,
|
||||
ReturnStageChecked.value,
|
||||
ReturnStageQualityCheckPendingRefund.value,
|
||||
ReturnStageServiceOrderPendingRefund.value,
|
||||
ReturnStageReturned.value,
|
||||
ReturnStageCancel.value
|
||||
],
|
||||
model_value: [
|
||||
ReturnStageApplying.value,
|
||||
ReturnStageWaitCheck.value,
|
||||
ReturnStageChecked.value,
|
||||
ReturnStageQualityCheckPendingRefund.value,
|
||||
ReturnStageServiceOrderPendingRefund.value,
|
||||
ReturnStageReturned.value,
|
||||
ReturnStageCancel.value
|
||||
],
|
||||
label:'合计金额',
|
||||
field: 'total_refund_amount'
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
value:[],
|
||||
id:1,
|
||||
big_value:[ReturnStageReturned.value],
|
||||
cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||
model_value: [],
|
||||
label:'扣款金额',
|
||||
field: 'total_sale_price'
|
||||
field: 'other_deduction_amount'
|
||||
},
|
||||
{
|
||||
id:3,
|
||||
value:[],
|
||||
label:'其他扣款',
|
||||
field: 'total_weight_error_discount'
|
||||
big_value:[ReturnStageReturned.value],
|
||||
cut_value: [ReturnStageReturned.value],
|
||||
model_value: [ReturnStageReturned.value],
|
||||
label:'退款金额',
|
||||
field: 'refund_amount'
|
||||
},
|
||||
{
|
||||
id:4,
|
||||
value:[],
|
||||
label:'应退金额',
|
||||
field: 'total_should_collect_money'
|
||||
},
|
||||
{
|
||||
id:5,
|
||||
value:[],
|
||||
label:'退款金额',
|
||||
field: 'total_should_collect_money'
|
||||
},
|
||||
{
|
||||
id:6,
|
||||
value:[],
|
||||
big_value:[ReturnStageReturned.value],
|
||||
cut_value: [ReturnStageReturned.value],
|
||||
model_value: [ReturnStageReturned.value],
|
||||
label:'退款去向',
|
||||
field: 'actual_amount'
|
||||
field: 'refund_flow_name'
|
||||
},
|
||||
{
|
||||
id:7,
|
||||
value:[],
|
||||
label:'实付金额',
|
||||
field: 'actual_amount'
|
||||
}
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
//是否显示价格
|
||||
const showPrice = useCallback((priceInfo, status) => {
|
||||
return priceInfo.value.includes(status)
|
||||
const showPrice = useCallback((priceInfo) => {
|
||||
let key = ['big_value', 'model_value', 'cut_value']
|
||||
if(priceInfo.id == 5) {
|
||||
return priceInfo[key[order?.sale_mode]].includes(order?.stage)||(order.refund_type == ShouldCollectOrderRefundTypeSalesRefund.value)
|
||||
} else {
|
||||
return priceInfo[key[order?.sale_mode]].includes(order?.stage)
|
||||
}
|
||||
|
||||
}, [order])
|
||||
|
||||
const priceConDom = useMemo(() => {
|
||||
@ -115,7 +140,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item, order?.stage)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
return <>{showPrice(item)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
@ -126,6 +151,11 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
const labAndRgbAndUrl = useCallback((item) => {
|
||||
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
|
||||
}, [])
|
||||
|
||||
//单价显示判断
|
||||
const sale_price_show = useMemo(() => {
|
||||
return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
|
||||
}, [order])
|
||||
|
||||
return (
|
||||
<View className={styles.kindsList_main}>
|
||||
@ -137,7 +167,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
<View className={styles.order_list_title}>
|
||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||
<View className={styles.num}>共{item?.product_colors.length}种</View>
|
||||
<View className={styles.num}>共{item?.product_colors?.length}种</View>
|
||||
</View>
|
||||
<View className={styles.order_list_scroll}>
|
||||
{item?.product_colors?.map(colorItem => {
|
||||
@ -148,7 +178,10 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
<View className={styles.order_list_item_con}>
|
||||
<View className={styles.order_list_item_des}>
|
||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
||||
<View className={styles.order_list_item_price}>¥{standardPrice(colorItem.sale_price)}</View>
|
||||
<View className={styles.order_list_item_price}>
|
||||
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
|
||||
{(order?.stage == ReturnStageReturned.value)&&<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>}
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.order_list_item_count}>
|
||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
||||
|
||||
131
src/pages/salesAfter/components/modelKindList/index.module.scss
Normal file
131
src/pages/salesAfter/components/modelKindList/index.module.scss
Normal file
@ -0,0 +1,131 @@
|
||||
|
||||
.kindsList_main{
|
||||
margin-top: 20px;
|
||||
}
|
||||
.orders_list_con{
|
||||
|
||||
background-color: #fff;
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
.orders_return_title{
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.order_list{
|
||||
&:nth-child(n+2) {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.order_list_title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.tag{
|
||||
font-size: $font_size_min;
|
||||
background-color: #CDE5FF;
|
||||
padding: 5px 10px;
|
||||
border-radius: 6px;
|
||||
color: $color_main;
|
||||
}
|
||||
.title{
|
||||
font-weight: 700;
|
||||
font-size: $font_size;
|
||||
margin-left: 20px;
|
||||
flex:1;
|
||||
}
|
||||
.num{
|
||||
color: $color_font_two;
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_list_scroll{
|
||||
margin-top: 30px;
|
||||
|
||||
.order_list_item {
|
||||
display: flex;
|
||||
&:nth-child(2) {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.order_list_item_img{
|
||||
width: 126px;
|
||||
height: 126px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.order_list_item_con{
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex:1;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
height: 150px;
|
||||
padding-top: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.order_list_item_des{
|
||||
flex:1;
|
||||
box-sizing: border-box;
|
||||
padding-left: 30px;
|
||||
.order_list_item_title{
|
||||
font-weight: 700;
|
||||
font-size: $font_size;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.order_list_item_price{
|
||||
font-size: 26px;
|
||||
color: $color_font_three;
|
||||
text{
|
||||
&:nth-child(n+1) {
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_list_item_count{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
.count_num{
|
||||
color: $color_main;
|
||||
font-size: $font_size;
|
||||
margin-bottom: 15px;
|
||||
font-weight: 400;
|
||||
text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
.count_price {
|
||||
font-size: $font_size;
|
||||
font-weight: 700;
|
||||
text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_total{
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
text{
|
||||
&:nth-child(1) {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_estimated_amount{
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
flex-direction: column;
|
||||
padding: 30px 0;
|
||||
.order_price_des{
|
||||
font-size: $font_size_medium;
|
||||
color: $color_font_two;
|
||||
}
|
||||
}
|
||||
}
|
||||
168
src/pages/salesAfter/components/modelKindList/index.tsx
Normal file
168
src/pages/salesAfter/components/modelKindList/index.tsx
Normal file
@ -0,0 +1,168 @@
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
|
||||
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import { Text, View } from "@tarojs/components"
|
||||
import { memo, useCallback, useMemo } from "react"
|
||||
import EstimatedAmount from "../estimatedAmount"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type OrderParam = {
|
||||
estimate_amount: number, //预估金额
|
||||
list: any[],
|
||||
sale_mode: number,
|
||||
sale_mode_name: string,
|
||||
unit: string,
|
||||
total_colors: number,
|
||||
total_fabrics: number,
|
||||
total_number: number,
|
||||
stage: number, //订单状态
|
||||
type: 1|2, //1退货, 2退款
|
||||
total_sale_price: number, //销售金额
|
||||
total_should_collect_money: number, //应收金额
|
||||
total_weight_error_discount: number, //空差优惠
|
||||
the_previous_status: number, //取消订单时的订单状态
|
||||
actual_amount: number //实付金额
|
||||
}
|
||||
|
||||
type Param = {
|
||||
order: OrderParam,
|
||||
comfirm?: boolean //是否是确认订单页面使用
|
||||
}
|
||||
|
||||
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)
|
||||
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
|
||||
}, [order])
|
||||
|
||||
//售后单状态枚举
|
||||
const {
|
||||
ReturnStageApplying, // 申请中
|
||||
ReturnStageWaitCheck, // 退货中
|
||||
ReturnStageChecked, // 待验布
|
||||
ReturnStageReturned, // 已退款
|
||||
ReturnStageCancel, // 已取消
|
||||
ReturnStageQualityCheckPendingRefund, // 已验布
|
||||
ReturnStageServiceOrderPendingRefund, // 待退款
|
||||
ReturnStageRejected, // 已拒绝
|
||||
} = AFTER_ORDER_STATUS
|
||||
|
||||
|
||||
//金额列表枚举
|
||||
const priceList = [
|
||||
{
|
||||
id:1,
|
||||
value:[
|
||||
ReturnStageServiceOrderPendingRefund.value,
|
||||
ReturnStageReturned.value
|
||||
],
|
||||
label:'应退金额',
|
||||
field: 'total_should_collect_money'
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
value:[ReturnStageReturned.value],
|
||||
label:'退款金额',
|
||||
field: 'total_should_collect_money'
|
||||
},
|
||||
{
|
||||
id:3,
|
||||
value:[ReturnStageReturned.value],
|
||||
label:'退款去向',
|
||||
field: 'actual_amount'
|
||||
},
|
||||
{
|
||||
id:4,
|
||||
value:[ReturnStageQualityCheckPendingRefund.value],
|
||||
label:'合计金额',
|
||||
field: 'actual_amount'
|
||||
},
|
||||
]
|
||||
|
||||
//是否显示价格
|
||||
const showPrice = useCallback((priceInfo) => {
|
||||
if(priceInfo.value == 8) {
|
||||
//合计金额
|
||||
|
||||
}
|
||||
return priceInfo.value.includes(order?.stage)
|
||||
}, [order])
|
||||
|
||||
const priceConDom = useMemo(() => {
|
||||
if(!order) return
|
||||
return (
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
)
|
||||
}, [order])
|
||||
|
||||
//整理颜色
|
||||
const labAndRgbAndUrl = useCallback((item) => {
|
||||
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
|
||||
}, [])
|
||||
|
||||
//单价显示判断
|
||||
const sale_price_show = useMemo(() => {
|
||||
return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
|
||||
}, [order])
|
||||
|
||||
return (
|
||||
<View className={styles.kindsList_main}>
|
||||
<View className={styles.orders_list_con}>
|
||||
<View className={styles.orders_return_title}>{order?.type == 1?'退货信息':'退款信息'}</View>
|
||||
{
|
||||
order?.list?.map(item => {
|
||||
return <View key={item.product_code} className={styles.order_list}>
|
||||
<View className={styles.order_list_title}>
|
||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||
<View className={styles.num}>共{item?.product_colors?.length}种</View>
|
||||
</View>
|
||||
<View className={styles.order_list_scroll}>
|
||||
{item?.product_colors?.map(colorItem => {
|
||||
return <View key={colorItem.id} className={styles.order_list_item}>
|
||||
<View className={styles.order_list_item_img}>
|
||||
<LabAndImg value={labAndRgbAndUrl(colorItem)}/>
|
||||
</View>
|
||||
<View className={styles.order_list_item_con}>
|
||||
<View className={styles.order_list_item_des}>
|
||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
||||
<View className={styles.order_list_item_price}>
|
||||
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
|
||||
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.order_list_item_count}>
|
||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
||||
<View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
<View className={styles.order_total}><Text>合计</Text><Text>{numText}</Text></View>
|
||||
<View className={styles.order_estimated_amount}>
|
||||
{priceConDom}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
@ -11,9 +11,12 @@ type Param = {
|
||||
show?: true|false,
|
||||
onClose?: () => void,
|
||||
onSubmit?: () => void,
|
||||
id?: number //订单id
|
||||
id?: number, //订单id
|
||||
images: string[], //图片列表
|
||||
descValue?: string, //描述
|
||||
onlyRead?: false|true //true 只读
|
||||
}
|
||||
export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => {
|
||||
export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = '', onlyRead = false}: Param) => {
|
||||
//需要提交的数据
|
||||
const submitData = useRef({
|
||||
accessory_url: [],
|
||||
@ -45,24 +48,25 @@ export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => {
|
||||
} else {
|
||||
alert.error('上传失败')
|
||||
}
|
||||
onSubmit?.()
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popup show={show} title="上传物流" onClose={onClose}>
|
||||
<Popup show={show} title={onlyRead?'查看物流':"上传物流"} onClose={onClose}>
|
||||
<View className={styles.logistics_main}>
|
||||
<View className={styles.logistics_image}>
|
||||
<Text className={styles.title_desc}>上传附件:</Text>
|
||||
<View className={styles.upload_image}>
|
||||
<UploadImage onChange={getImageList}/>
|
||||
<UploadImage onChange={getImageList} defaultList={images} onlyRead={onlyRead}/>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.logistics_desc}>
|
||||
<TextareaEnhance onChange={getOtherReason} title="备注:" placeholder="请输入备注信息"/>
|
||||
<TextareaEnhance defaultValue={descValue} onChange={getOtherReason} title="备注:" onlyRead={onlyRead} placeholder="请输入备注信息"/>
|
||||
</View>
|
||||
<View className={styles.btns_two}>
|
||||
{!onlyRead&&<View className={styles.btns_two}>
|
||||
<View className={styles.verify_btn } onClick={() => onSubmitEven()}>保存</View>
|
||||
</View >
|
||||
</View >}
|
||||
</View>
|
||||
</Popup>
|
||||
</>
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
import {
|
||||
GetSaleOrderDetailApi,
|
||||
EditSaleOrderRemarkApi,
|
||||
} from "@/api/order";
|
||||
import { GetOrderPayApi } from "@/api/orderPay";
|
||||
|
||||
import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum";
|
||||
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||
import AfterOrderBtns from "@/components/afterOrderBtns";
|
||||
import OrderBtns from "@/components/orderBtns";
|
||||
import SearchInput from "@/components/searchInput";
|
||||
import useLogin from "@/use/useLogin";
|
||||
import { Image, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
@ -23,7 +18,7 @@ import ReturnLogistics from "./components/returnLogistics";
|
||||
import styles from './index.module.scss'
|
||||
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
const router = useRouter()
|
||||
const orderId = useRef<number>(Number(router.params.id))
|
||||
useDidShow(() => {
|
||||
@ -58,7 +53,7 @@ import styles from './index.module.scss'
|
||||
total_number: orderDetail.total_number, //总数量
|
||||
total_fabrics: orderDetail.total_fabrics, //面料数量
|
||||
unit: orderDetail.sale_mode == 0?'条':'m', //单位
|
||||
list: orderDetail.product_list,
|
||||
list: orderDetail.quality_check_pass_product,
|
||||
stage: orderDetail.stage, //订单状态
|
||||
type: orderDetail.type, //退货or退款
|
||||
total_sale_price: orderDetail.total_sale_price, //销售金额
|
||||
@ -66,6 +61,12 @@ import styles from './index.module.scss'
|
||||
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(() => {
|
||||
@ -75,7 +76,12 @@ import styles from './index.module.scss'
|
||||
|
||||
//获取底部按钮点击, 获取按钮状态
|
||||
const orderStateClick = useCallback((val) => {
|
||||
|
||||
if(val == 1 || val == 6) {
|
||||
getSaleOrderPreView()
|
||||
} else if(val == 8) {
|
||||
//申请记录
|
||||
setApplyRecord(true)
|
||||
}
|
||||
}, [orderDetail])
|
||||
|
||||
//页面下拉刷新
|
||||
@ -91,7 +97,7 @@ import styles from './index.module.scss'
|
||||
orderId: orderDetail?.id,
|
||||
settle_mode: orderDetail?.settle_mode,
|
||||
type: orderDetail?.type, //退货or退款
|
||||
sale_mode: orderDetail?.sale_model, //订单类型
|
||||
sale_mode: orderDetail?.sale_mode, //订单类型
|
||||
return_apply_order_id: orderDetail?.return_apply_order_id
|
||||
}
|
||||
}, [orderDetail])
|
||||
@ -103,41 +109,44 @@ import styles from './index.module.scss'
|
||||
|
||||
//物流显示
|
||||
const [logisticsShow, setLogisticsShow] = useState(false)
|
||||
const [logistics, setLogistics] = useState(false)
|
||||
const onShowLogistics = useCallback((val) => {
|
||||
if(val == 1) {
|
||||
setLogisticsShow(true)
|
||||
} else {
|
||||
const list = orderDetail?.fabric_piece_accessory_url.map(item => {
|
||||
return formatImgUrl(item)
|
||||
})
|
||||
Taro.previewImage({
|
||||
current: list[0], // 当前显示
|
||||
urls: list // 需要预览的图片http链接列表
|
||||
})
|
||||
}
|
||||
}, [orderDetail])
|
||||
const onCloseLogistics = useCallback(() => setLogisticsShow(false), [])
|
||||
setLogisticsShow(true)
|
||||
if(val != 1) setLogistics(true)
|
||||
// if(val == 1) {
|
||||
// setLogisticsShow(true)
|
||||
// } else {
|
||||
// const list = orderDetail?.accessory_url.map(item => {
|
||||
// return formatImgUrl(item)
|
||||
// })
|
||||
// Taro.previewImage({
|
||||
// current: list[0], // 当前显示
|
||||
// urls: list // 需要预览的图片http链接列表
|
||||
// })
|
||||
// }
|
||||
}, [])
|
||||
const onCloseLogistics = useCallback(() => {
|
||||
setLogisticsShow(false)
|
||||
}, [])
|
||||
//物流成功上传
|
||||
const logisticsSuccess = useCallback(() => {
|
||||
setLogisticsShow(false)
|
||||
getSaleOrderPreView()
|
||||
}, [])
|
||||
|
||||
//显示生气记录
|
||||
//显示记录
|
||||
const [applyRecord, setApplyRecord] = useState(false)
|
||||
|
||||
//货
|
||||
|
||||
return (
|
||||
<View className={styles.order_main}>
|
||||
<OrderState orderInfo={orderDetail}/>
|
||||
<AddressInfoDetail return_address={orderDetail?.return_address} return_phone={orderDetail?.return_phone} stage={orderDetail?.stage} onLogistics={onShowLogistics}/>
|
||||
<AddressInfoDetail return_address={orderDetail?.return_user_name} return_phone={orderDetail?.return_user_phone} stage={orderDetail?.stage} onLogistics={onShowLogistics}/>
|
||||
<KindList order={formatPreViewOrderMemo}/>
|
||||
<OrderDes orderInfo={orderDetail}/>
|
||||
<View className={styles.submit_order}>
|
||||
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick} />
|
||||
</View>
|
||||
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
||||
<AfterSalePricture urls={orderDetail?.fabric_piece_accessory_url}/>
|
||||
<ReturnLogistics show={logisticsShow} id={orderDetail?.return_apply_order_id} onClose={onCloseLogistics} onSubmit={logisticsSuccess}/>
|
||||
<ReturnLogistics onlyRead={logistics} images={orderDetail?.accessory_url} descValue={orderDetail?.take_goods_remark} show={logisticsShow} id={orderDetail?.return_apply_order_id} onClose={onCloseLogistics} onSubmit={logisticsSuccess}/>
|
||||
<ApplyRecord show={applyRecord} id={orderDetail?.id} onClose={() => setApplyRecord(false)}/>
|
||||
<View className="common_safe_area_y"></View>
|
||||
</View>
|
||||
@ -195,7 +204,7 @@ import styles from './index.module.scss'
|
||||
|
||||
const showList = useMemo(() => {
|
||||
let res = urls.map(item => {
|
||||
return formatImgUrl(item)
|
||||
return formatImgUrl(item, "!w800")
|
||||
})
|
||||
return res
|
||||
}, [urls])
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { goLink } from "@/common/common";
|
||||
import { REFUND_STATUS_ORDER } from "@/common/enum";
|
||||
import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||
import AfterOrderBtns from "@/components/afterOrderBtns";
|
||||
import LabAndImg from "@/components/LabAndImg";
|
||||
@ -26,7 +27,8 @@ type Param = {
|
||||
lab: {l:number, a:number, b:number},
|
||||
rgb: {r:number, g:number, b:number},
|
||||
texturl_url: string,
|
||||
type: number //1 退货 2退款
|
||||
type: number //2 退货 1 预收退款 3 销售
|
||||
return_apply_order_id: number //退款申请单
|
||||
},
|
||||
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
||||
}
|
||||
@ -52,7 +54,8 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
stage: value?.stage, //订单状态
|
||||
orderId: value?.id,
|
||||
sale_mode: value?.sale_mode, //订单类型
|
||||
type: value?.type //退货or退款
|
||||
type: value?.type, //退货or退款
|
||||
return_apply_order_id: value?.return_apply_order_id //退款申请单
|
||||
}
|
||||
}, [value])
|
||||
|
||||
@ -61,6 +64,10 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
return {lab:{...value?.lab}, rgb:{...value?.rgb}, texturl_url: value?.texturl_url}
|
||||
}, [value])
|
||||
|
||||
const {
|
||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||
} = REFUND_STATUS_ORDER
|
||||
|
||||
return (
|
||||
<View className={styles.order_item}>
|
||||
<View className={styles.header} onClick={() => goLink('/pages/salesAfter/index', {id: value?.id})}>
|
||||
@ -69,24 +76,24 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
<Text className={styles.name}>{userInfo?.adminUserInfo?.user_name}</Text>
|
||||
</View>
|
||||
<View className={styles.order_num}>
|
||||
<Text>售后单号:{value?.return_order_no}</Text>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
||||
<Text>售后单号:{value?.return_order_no}</Text>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
||||
</View>
|
||||
<OrderStatusTag status={value?.type}/>
|
||||
</View>
|
||||
<View className={styles.product_con} onClick={() => goLink('/pages/salesAfter/index', {id: value?.id})}>
|
||||
<View className={styles.product_title}>
|
||||
<View className={styles.product_tag}>{value?.sale_mode_name}</View>
|
||||
<View className={styles.product_name}>{formatHashTag(value?.product_list[0].code, value?.product_list[0].name)}</View>
|
||||
<View className={styles.product_name}>{formatHashTag(value?.product_list?.[0].code, value?.product_list?.[0].name)}</View>
|
||||
<View className={styles.product_status}>{value?.stage_name}</View>
|
||||
</View>
|
||||
<View className={styles.product_list}>
|
||||
<View className={styles.image}>
|
||||
<LabAndImg value={labAndRgbAndUrl}/>
|
||||
<View className={styles.color_num}>{value?.product_list[0].product_colors[0].code}</View>
|
||||
<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>
|
||||
@ -105,11 +112,11 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
</View>
|
||||
<View className={styles.color_count_num}>{`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`}</View>
|
||||
<View className={styles.order_number}>
|
||||
<Text>{value?.type == 1?'已申请退货':'已申请退款'}</Text>
|
||||
<Text>{value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'}</Text>
|
||||
<Text>订单号:{value?.order_no}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} />
|
||||
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} fixedBottom={false}/>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
@ -2,17 +2,23 @@ import { Text, View } from "@tarojs/components"
|
||||
import { memo } from "react"
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { REFUND_STATUS_ORDER } from "@/common/enum";
|
||||
|
||||
|
||||
type Param = {
|
||||
status?: number //0默认不处理, 1退货,2退款
|
||||
status?: number
|
||||
}
|
||||
export default memo(({status = 0}:Param) => {
|
||||
const {
|
||||
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||
ReturnApplyOrderTypeSalesRefund // 销售退款
|
||||
} = REFUND_STATUS_ORDER
|
||||
return (
|
||||
<>
|
||||
{(status !== 0)&&<View className={classnames(styles.tag, status == 2?styles.refund_tag :styles.saleReturn_tag)}>
|
||||
{(status !== 0)&&<View className={classnames(styles.tag, status != ReturnApplyOrderTypeReturnForRefund.value?styles.refund_tag :styles.saleReturn_tag)}>
|
||||
<View className={classnames(styles.miconfont, 'iconfont icon-yucunkuan')}></View>
|
||||
<Text>{ status == 1?'退货':'退款'}</Text>
|
||||
<Text>{ status == ReturnApplyOrderTypeReturnForRefund.value?'退货':'退款'}</Text>
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
|
||||
@ -10,7 +10,7 @@ import InfiniteScroll from "@/components/infiniteScroll"
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util"
|
||||
import OrderStatusList from "./components/orderStatusList"
|
||||
import { AFTER_ORDER_STATUS } from "@/common/enum"
|
||||
import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder"
|
||||
import { GetSaleOrderListApi } from "@/api/salesAfterOrder"
|
||||
import ReturnLogistics from "./components/returnLogistics"
|
||||
|
||||
export default () => {
|
||||
@ -29,10 +29,11 @@ export default () => {
|
||||
|
||||
//获取订单状态
|
||||
const [statusList, setStatusList] = useState<any[]>([{id: -1, name: '全部'}])
|
||||
const {fetchData: fetchDataStatus} = RefundOrderSatausApi()
|
||||
const getOrderStatusList = async () => {
|
||||
let res = await fetchDataStatus()
|
||||
setStatusList((e) => [...e, ...res.data.list])
|
||||
const getOrderStatusList = () => {
|
||||
const status = Object.values(AFTER_ORDER_STATUS).map(item => {
|
||||
return {id: item.value, name: item.label}
|
||||
})
|
||||
setStatusList((e) => [...e, ...status])
|
||||
}
|
||||
useEffect(() => {
|
||||
getOrderStatusList()
|
||||
@ -10,13 +10,13 @@ import InfiniteScroll from "@/components/infiniteScroll"
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util"
|
||||
import OrderStatusList from "./components/orderStatusList"
|
||||
import { AFTER_ORDER_STATUS } from "@/common/enum"
|
||||
import { GetSaleOrderListApi } from "@/api/salesAfterOrder"
|
||||
import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder"
|
||||
import ReturnLogistics from "./components/returnLogistics"
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
useLogin()
|
||||
useDidShow(() => {
|
||||
getOrderList()
|
||||
})
|
||||
|
||||
//搜索参数
|
||||
@ -29,11 +29,10 @@ export default () => {
|
||||
|
||||
//获取订单状态
|
||||
const [statusList, setStatusList] = useState<any[]>([{id: -1, name: '全部'}])
|
||||
const getOrderStatusList = () => {
|
||||
const status = Object.values(AFTER_ORDER_STATUS).map(item => {
|
||||
return {id: item.value, name: item.label}
|
||||
})
|
||||
setStatusList((e) => [...e, ...status])
|
||||
const {fetchData: fetchDataStatus} = RefundOrderSatausApi()
|
||||
const getOrderStatusList = async () => {
|
||||
let res = await fetchDataStatus()
|
||||
setStatusList((e) => [...e, ...res.data.list])
|
||||
}
|
||||
useEffect(() => {
|
||||
getOrderStatusList()
|
||||
@ -95,9 +94,8 @@ export default () => {
|
||||
|
||||
//监听点击的按钮
|
||||
const clickOrderBtn = useCallback(({status, orderInfo}) => {
|
||||
if(status == 2) {
|
||||
//退货物流
|
||||
|
||||
if(status == 1 || status == 6) {
|
||||
getOrderList()
|
||||
}
|
||||
}, [orderData])
|
||||
|
||||
|
||||
@ -18,11 +18,11 @@ export default () => {
|
||||
a2: '',
|
||||
b2: '',
|
||||
})
|
||||
|
||||
const [colorList, setColorList] = useState({
|
||||
one: null,
|
||||
two: null
|
||||
})
|
||||
type ColorList = {
|
||||
one?: any,
|
||||
two?: any
|
||||
}
|
||||
const [colorList, setColorList] = useState<ColorList>()
|
||||
const { state: colorState, measureAndGetLab } = useBluetooth()
|
||||
|
||||
const getLab = async (val) => {
|
||||
@ -57,25 +57,28 @@ export default () => {
|
||||
useEffect(() => {
|
||||
if (colorState.deviceLab) {
|
||||
|
||||
if (colorList.one?.constructor === Object) {
|
||||
const rgb = toRgb([colorList.one.L, colorList.one.a, colorList.one.b])
|
||||
if ((colorList as any).one?.constructor === Object) {
|
||||
const rgb = toRgb([(colorList as any).one.L, (colorList as any).one.a, (colorList as any).one.b])
|
||||
setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
|
||||
setTime(getNowTime())
|
||||
setSearchField({ ...searchField, l1: rgb[0], a1: rgb[1], b1: rgb[2] })
|
||||
}
|
||||
if (colorList.two?.constructor === Object) {
|
||||
const rgb = toRgb([colorList.two.L, colorList.two.a, colorList.two.b])
|
||||
if ((colorList as any).two?.constructor === Object) {
|
||||
|
||||
const rgb = toRgb([(colorList as any).two.L, (colorList as any).two.a, (colorList as any).two.b])
|
||||
setBlueToothColorTwo(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
|
||||
setTimeTwo(getNowTime())
|
||||
setSearchField({ ...searchField, l2: rgb[0], a2: rgb[1], b2: rgb[2] })
|
||||
|
||||
}
|
||||
}
|
||||
}, [colorList])
|
||||
const reset = () => {
|
||||
setColorList({})
|
||||
setBlueToothColor('')
|
||||
setBlueToothColorTwo('')
|
||||
setTime('')
|
||||
setTime('')
|
||||
setTimeTwo('')
|
||||
setData('')
|
||||
setResult('')
|
||||
}
|
||||
|
||||
@ -5,8 +5,10 @@ import { goLink } from '@/common/common';
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { useEffect } from 'react';
|
||||
import useLogin from '@/use/useLogin';
|
||||
|
||||
export default () => {
|
||||
useLogin()
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.search}>
|
||||
|
||||
@ -20,10 +20,7 @@ import SelectData, {ListProps} from "./components/selectData";
|
||||
import LabAndImg from "@/components/LabAndImg";
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
useLogin()
|
||||
|
||||
const [showFilter, setShowFilter] = useState(false)
|
||||
|
||||
|
||||
@ -12,10 +12,7 @@ import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
type searchDataParam = {'search_key':''}
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
useLogin()
|
||||
|
||||
const [searchData, setSearchData] = useState<{hotField: searchDataParam[], historyField: searchDataParam[]}>({
|
||||
hotField: [],
|
||||
|
||||
@ -16,10 +16,7 @@ import useLogin from "@/use/useLogin";
|
||||
import LabAndImg from "@/components/LabAndImg";
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
useLogin()
|
||||
|
||||
const [showFilter, setShowFilter] = useState(false)
|
||||
const router = useRouter()
|
||||
|
||||
@ -10,7 +10,17 @@ import Taro from "@tarojs/taro";
|
||||
import { userassets, userorderStatistics } from "@/api/mine"
|
||||
import { formatPriceDiv } from "@/common/fotmat"
|
||||
import { useDidShow, } from '@tarojs/taro'
|
||||
import { GetAdminUserInfoApi } from "@/api/user";
|
||||
export default () => {
|
||||
//重新获取用户信息
|
||||
const {fetchData: useFetchData} = GetAdminUserInfoApi()
|
||||
const [userDataAgain, setUserDataAgain] = useState<any>({})
|
||||
const getUserData = async () => {
|
||||
let res = await useFetchData()
|
||||
setUserDataAgain(res.data)
|
||||
}
|
||||
|
||||
|
||||
// 用户信息
|
||||
const { getSelfUserInfo } = useLogin();
|
||||
const { adminUserInfo } = useSelector(state => state.userInfo);
|
||||
@ -31,6 +41,7 @@ export default () => {
|
||||
}, [])
|
||||
useDidShow(() => {
|
||||
ApigetTotal()
|
||||
getUserData()
|
||||
})
|
||||
const checkGo = () => {
|
||||
if (adminUserInfo?.authentication_status === 0 || adminUserInfo?.authentication_status === 1 || adminUserInfo?.authentication_status === 2 || adminUserInfo?.authentication_status === 3) {
|
||||
@ -55,13 +66,13 @@ export default () => {
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<Header data={adminUserInfo} MenuData={stateData} />
|
||||
<Assets data={state} checkShow={() => checkGo()} />
|
||||
<Header data={userDataAgain} MenuData={stateData} />
|
||||
<Assets data={state} checkShow={() => checkGo()} userInfo={userDataAgain}/>
|
||||
<Main />
|
||||
{/* {(adminUserInfo as any)?.authentication_status==1&&<Modal data={adminUserInfo}/>} */}
|
||||
{/* 测试暂时添加 */}
|
||||
<View style={{ fontSize: '26rpx', textAlign: 'center' }}>{BASE_URL}</View>
|
||||
{!adminUserInfo.is_authorize_name && <View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
||||
{!userDataAgain?.is_authorize_name && <View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -97,8 +108,8 @@ const Modal = memo((props: any) => {
|
||||
const Header = memo((props: any) => {
|
||||
const { data } = props;
|
||||
console.log(props, 'propsprops')
|
||||
let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index" },
|
||||
{ text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" },
|
||||
let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index?status=0" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index?status=1" },
|
||||
{ text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index?status=2" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index?status=3" },
|
||||
{ text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/salesAfterList/index" }];
|
||||
const { getPhoneNumber } = useLogin();
|
||||
const mGetPhoneNumber = (ev) => {
|
||||
@ -143,7 +154,7 @@ const Header = memo((props: any) => {
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles['auth']}>
|
||||
{(data?.authentication_status == 0 || data?.authentication_status == 1) &&
|
||||
{((data?.authentication_status == 0 || data?.authentication_status == 1) && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tag']}>
|
||||
@ -156,7 +167,7 @@ const Header = memo((props: any) => {
|
||||
<Text className="iconfont icon-a-moreback"></Text>
|
||||
</View>
|
||||
}
|
||||
{(data?.authentication_status == 3) &&
|
||||
{(data?.authentication_status == 3 && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tagthree']}>
|
||||
@ -169,7 +180,7 @@ const Header = memo((props: any) => {
|
||||
<Text className="iconfont icon-a-moreback"></Text>
|
||||
</View>
|
||||
}
|
||||
{data?.authentication_status == 2 &&
|
||||
{(data?.authentication_status == 2 && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tagone']}>
|
||||
@ -182,7 +193,7 @@ const Header = memo((props: any) => {
|
||||
<Text className="iconfont icon-a-moreback"></Text>
|
||||
</View>
|
||||
}
|
||||
{data?.authentication_status == 4 &&
|
||||
{(data?.authentication_status == 4 && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tagtwo']}>
|
||||
@ -274,34 +285,36 @@ const Header = memo((props: any) => {
|
||||
// 我的资产
|
||||
const Assets = (props: any) => {
|
||||
return (
|
||||
<View className={`${styles.assets} ${styles.crad} ${styles['main-card']}`}>
|
||||
<View className={`${styles['assets-title']}`}>我的资产</View>
|
||||
<View className={`${styles['assets-content']}`}>
|
||||
<Navigator hoverClass="none" url="/pages/depositBeforehand/index">
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.wallet_money || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>{props.wallet_money || 0}</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>预存款</Text>
|
||||
</Navigator>
|
||||
{/* <View>
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{props.data.data.coupon_count || 0}</Text>
|
||||
<Text className={`${styles['assets-content-item-top-after']}`}>张</Text>
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>优惠券</Text>
|
||||
</View> */}
|
||||
<Navigator hoverClass="none" onClick={() => props.checkShow()}>
|
||||
<View className={`${styles['assets-content-item-top']}`} >
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.credit_line || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>.-00</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>授信额度</Text>
|
||||
</Navigator>
|
||||
</View>
|
||||
</View>
|
||||
<>
|
||||
{(props.userInfo.order_access_status == 3) &&<View className={`${styles.assets} ${styles.crad} ${styles['main-card']}`}>
|
||||
<View className={`${styles['assets-title']}`}>我的资产</View>
|
||||
<View className={`${styles['assets-content']}`}>
|
||||
<Navigator hoverClass="none" url="/pages/depositBeforehand/index">
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.wallet_money || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>{props.wallet_money || 0}</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>预存款</Text>
|
||||
</Navigator>
|
||||
{/* <View>
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{props.data.data.coupon_count || 0}</Text>
|
||||
<Text className={`${styles['assets-content-item-top-after']}`}>张</Text>
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>优惠券</Text>
|
||||
</View> */}
|
||||
<Navigator hoverClass="none" onClick={() => props.checkShow()}>
|
||||
<View className={`${styles['assets-content-item-top']}`} >
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.credit_line || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>.-00</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>授信额度</Text>
|
||||
</Navigator>
|
||||
</View>
|
||||
</View>||<View className={styles['main-card']}></View>}
|
||||
</>
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import useLogin from "@/use/useLogin";
|
||||
import { useSelector } from "@/reducers/hooks";
|
||||
import useUploadCDNImg from "@/use/useUploadImage";
|
||||
import { IMG_CND_Prefix } from "@/common/constant";
|
||||
import useUserInfo from "@/use/useUserInfo";
|
||||
|
||||
export default () => {
|
||||
const { getPhoneNumber, getAdminUserInfo } = useLogin();
|
||||
@ -141,6 +142,14 @@ export default () => {
|
||||
}
|
||||
}
|
||||
|
||||
const {removeToken, removeSessionKey, removeUserInfo} = useUserInfo()
|
||||
const outLogin = () => {
|
||||
removeToken()
|
||||
removeSessionKey()
|
||||
removeUserInfo()
|
||||
goLink('/pages/index/index',{}, 'switchTab')
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="user-edit">
|
||||
<View onClick={handleSelectRortrait} className="user-edit-portrait">
|
||||
@ -174,7 +183,7 @@ export default () => {
|
||||
</UserEditList>
|
||||
<UserEditList label="创建人" data={(formData as any)?.founder_user_name} placeholder="完善公司/组织信息" icon="" useIcon="true" />
|
||||
</View>
|
||||
{/* <Button hoverClass="none" className="user-edit-logout">退出当前账号</Button> */}
|
||||
<Button hoverClass="none" className="user-edit-logout" onClick={outLogin}>退出当前账号</Button>
|
||||
|
||||
<ModifyModal title="修改昵称" ref={ModifyIcknameEl} value={(formData as any)?.user_name} save={(value) => handleTextareaSave(value, "Ickname")} />
|
||||
<ModifyModal title="修改名称" ref={ModifyCompanyNameEl} value={(formData as any)?.company_name} save={(value) => handleTextareaSave(value, "companyName")} />
|
||||
|
||||
@ -5,7 +5,9 @@ import {weightListApi,weightDeleteApi} from "@/api/weightList"
|
||||
import "./index.scss"
|
||||
import Taro, { showModal } from "@tarojs/taro"
|
||||
import { alert } from "@/common/common"
|
||||
import useLogin from "@/use/useLogin"
|
||||
const weightListManager = ()=>{
|
||||
useLogin()
|
||||
return(
|
||||
<View className="weight-list-manager">
|
||||
<WeightList />
|
||||
|
||||
@ -6,8 +6,10 @@ import {weightAddApi, weightDetailApi,weightEditApi} from "@/api/weightList"
|
||||
import { useEffect, useState } from "react"
|
||||
import { alert, retrieval } from "@/common/common"
|
||||
import "./index.scss"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {type,id} = useRouter().params;
|
||||
useEffect(()=>{
|
||||
if(type=="add"){
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { SubscriptionMessageApi } from "@/api/user"
|
||||
import Taro from "@tarojs/taro"
|
||||
import dayjs from "dayjs"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
|
||||
@ -13,6 +15,7 @@ export const useTimeCountDown = () => {
|
||||
const timeObj:any = useRef()
|
||||
const endTime = useRef('')
|
||||
const onStart = (val = '') => {
|
||||
console.log('time:::', val)
|
||||
endTime.current = val
|
||||
if(endTime.current) {
|
||||
clearInterval(timeObj.current)
|
||||
@ -49,7 +52,7 @@ export const useTimeCountDown = () => {
|
||||
var HH = ('00'+hh).slice(-2);
|
||||
var MM = ('00'+mm).slice(-2);
|
||||
var SS = ('00'+ss).slice(-2);
|
||||
// console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`)
|
||||
console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`)
|
||||
setShowTime((e) => ({...e, DD, HH, MM, SS}))
|
||||
}
|
||||
return {
|
||||
@ -58,3 +61,32 @@ export const useTimeCountDown = () => {
|
||||
timeStatus
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//订阅消息hook
|
||||
export const UseSubscriptionMessage = () => {
|
||||
const {fetchData: fetchDataMessage} = SubscriptionMessageApi()
|
||||
const openSubscriptionMessage = ({orderId = 0, scenes = 0}:{orderId?: number, scenes: number}) => {
|
||||
return new Promise(async (resolve) => {
|
||||
let params:{sale_order_id?: number, scenes?: number} = {}
|
||||
orderId&&(params.sale_order_id = orderId)
|
||||
params.scenes = scenes
|
||||
let res = await fetchDataMessage(params)
|
||||
if(res.success&&res.data.TemplateID&&res.data.TemplateID.length > 0) {
|
||||
Taro.requestSubscribeMessage({
|
||||
tmplIds: res.data.TemplateID,
|
||||
complete: function (res) {
|
||||
resolve(res)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
resolve(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
openSubscriptionMessage
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -122,14 +122,12 @@ export const useRequest = (options:option = {
|
||||
|
||||
const stateRef = useRef({...params})
|
||||
const [state, setState] = useState({...stateRef.current})
|
||||
const {removeToken, removeSessionKey} = useUserInfo()
|
||||
const {removeToken, removeSessionKey, removeUserInfo} = useUserInfo()
|
||||
const {login} = useLoginRequest()
|
||||
|
||||
useEffect(() => {
|
||||
console.log('变化1::', state.loading)
|
||||
}, [state.loading])
|
||||
// 请求函数
|
||||
const fetchData = async (sub_options?:any) => {
|
||||
|
||||
stateRef.current.loading = true
|
||||
setState((e) => ({...e, loading:true}))
|
||||
stateRef.current.query = {
|
||||
@ -171,10 +169,19 @@ export const useRequest = (options:option = {
|
||||
stateRef.current.msg = msg
|
||||
stateRef.current.data = data
|
||||
stateRef.current.total = data?.list ? data?.total : 0
|
||||
if(code !== 0) {
|
||||
Taro.showToast({
|
||||
title: `${msg}`,
|
||||
icon: 'none'
|
||||
})
|
||||
console.log('错误::',msg)
|
||||
}
|
||||
}else{
|
||||
|
||||
if (statusCode === 401) {
|
||||
removeToken()
|
||||
removeSessionKey()
|
||||
removeUserInfo()
|
||||
login()
|
||||
//todo 登录数据刷新次数问题
|
||||
} else {
|
||||
@ -189,6 +196,7 @@ export const useRequest = (options:option = {
|
||||
stateRef.current.success = false
|
||||
stateRef.current.error = true
|
||||
stateRef.current.msg = e.errMsg
|
||||
console.log('后台错误信息::',e.errMsg)
|
||||
|
||||
}
|
||||
stateRef.current.error = false
|
||||
|
||||
@ -1,19 +1,22 @@
|
||||
import useUserInfo from "./useUserInfo"
|
||||
import Taro, { useRouter } from "@tarojs/taro"
|
||||
import Taro, { useDidShow, useRouter } from "@tarojs/taro"
|
||||
import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi, BindingCompanyApi } from "@/api/user"
|
||||
import useLoginRequest from "./useLoginRequest"
|
||||
import { SHARE_SCENE } from "@/common/enum"
|
||||
import { GetShortCodeApi } from "@/api/share"
|
||||
import { alert } from "@/common/common"
|
||||
import { LoginApi } from "@/api/login"
|
||||
|
||||
export default () => {
|
||||
const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo()
|
||||
|
||||
//登录请求 (调用这个就不能再useHttp中使用,当前这个hook, 否则会死循环内存溢出)
|
||||
// const {fetchData} = LoginApi()
|
||||
useDidShow(() => {
|
||||
checkLogin()
|
||||
})
|
||||
|
||||
//登录请求
|
||||
const {login} = useLoginRequest()
|
||||
// const {fetchData:login} = LoginApi()
|
||||
const wxLogin = async () => {
|
||||
try {
|
||||
await login()
|
||||
|
||||
@ -3,11 +3,15 @@ import Taro, { useRouter } from "@tarojs/taro"
|
||||
import { useRef, useState } from "react"
|
||||
import qs from 'qs'
|
||||
import useUserInfo from "./useUserInfo"
|
||||
import useLogin from "./useLogin"
|
||||
|
||||
//开这个hook 主要是为了让useHttp 能够调用
|
||||
|
||||
type Param = {success: true|false, data: any, msg: string, code: null|number, loading: false|true}
|
||||
let loginStatus = false //登录状态,true登录中
|
||||
console.log('你不要过来啊')
|
||||
export default () => {
|
||||
|
||||
let initData = {
|
||||
success: false,
|
||||
data: null,
|
||||
@ -19,7 +23,7 @@ export default () => {
|
||||
const {setToken, setSessionKey} = useUserInfo()
|
||||
const router = useRouter()
|
||||
//微信登录请求v2
|
||||
const fetchData = async (login_code) => {
|
||||
const fetchDataLogin = async (login_code) => {
|
||||
const q = {
|
||||
url: BASE_URL + '/v1/mall/login',
|
||||
header: {
|
||||
@ -57,11 +61,13 @@ export default () => {
|
||||
|
||||
//微信登录
|
||||
const login = () => {
|
||||
if(loginStatus) return false
|
||||
loginStatus = true
|
||||
return new Promise((reslove, reject) => {
|
||||
Taro.login({
|
||||
success: async (res) => {
|
||||
if (res.code) {
|
||||
const {data, success, msg} = await fetchData(res.code)
|
||||
const {data, success, msg} = await fetchDataLogin(res.code)
|
||||
if(success) {
|
||||
setToken(data.token)
|
||||
setSessionKey(data.session_key)
|
||||
@ -88,10 +94,12 @@ export default () => {
|
||||
console.log('登录失败!' + res.errMsg)
|
||||
reject(res.errMsg)
|
||||
}
|
||||
loginStatus = false
|
||||
},
|
||||
fail: function(e) {
|
||||
console.log('登录失败!::',e)
|
||||
reject(e)
|
||||
loginStatus = false
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@ -114,26 +114,39 @@ export default () => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传手机图片
|
||||
* @param cdn_upload_type //CDN 文件上传场景值
|
||||
*/
|
||||
|
||||
// product 产品相关,图片、纹理图等 全平台
|
||||
// after-sale 售后(申请退货、退款)相关的、图片、视频 全平台
|
||||
// mall 电子商城相关的 全平台
|
||||
// logistics 物流(发货、提货)相关的、图片、视频 全平台
|
||||
type cdn_upload_type_Param = 'product'|'after-sale'|'mall'|'logistics'
|
||||
const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => {
|
||||
/**
|
||||
* 上传手机图片
|
||||
* @param cdn_upload_type 场景值
|
||||
* @param count // 1时返回一张图片信息, 大于1时返回图片数组
|
||||
* @returns
|
||||
*/
|
||||
const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param, count: number = 1) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let list:any[] = []
|
||||
Taro.chooseImage({
|
||||
count: 1,
|
||||
count: count,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async function (res) {
|
||||
const file = res.tempFiles[0]
|
||||
try {
|
||||
let data = await uploadCDNImg(file, cdn_upload_type, cdn_upload_type)
|
||||
resolve(data)
|
||||
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)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user