电子商城测试版v4
This commit is contained in:
parent
29090350ef
commit
7a2dc0006f
@ -10,8 +10,8 @@
|
|||||||
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
||||||
// export const BASE_URL = `https://www.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.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` // 杰
|
export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰
|
||||||
|
|
||||||
// CDN
|
// CDN
|
||||||
// 生成密钥
|
// 生成密钥
|
||||||
|
@ -56,4 +56,12 @@ export const SUBSCRIPTION_MESSAGE_SCENE = {
|
|||||||
SubmitOrder: {value:1, label:'确认下单'},
|
SubmitOrder: {value:1, label:'确认下单'},
|
||||||
ToPay : {value:2, label:'去付款'},
|
ToPay : {value:2, label:'去付款'},
|
||||||
ApplyGoods: {value:3, 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:'销售退款'},
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ export const throttle = (fn, delay) => {
|
|||||||
* @param {Array} arr 排除过滤的属性
|
* @param {Array} arr 排除过滤的属性
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const getFilterData = (val = {}, arr = []) => {
|
export const getFilterData = (val = {}, arr: string[] = []) => {
|
||||||
let res = {}
|
let res = {}
|
||||||
for(let key in val) {
|
for(let key in val) {
|
||||||
if(val[key]!==undefined&&val[key]!==null&&val[key]!==''&&(!arr.includes(key))){
|
if(val[key]!==undefined&&val[key]!==null&&val[key]!==''&&(!arr.includes(key))){
|
||||||
|
@ -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{
|
.btns_list{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// margin-top: 30px;
|
// margin-top: 30px;
|
||||||
|
@ -17,10 +17,11 @@ type Param = {
|
|||||||
return_apply_order_id: number //售后申请单
|
return_apply_order_id: number //售后申请单
|
||||||
},
|
},
|
||||||
onClick?: (val: number) => void, //点击后触发的事件,返回订单状态
|
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 {
|
const {
|
||||||
ReturnStageApplying,
|
ReturnStageApplying,
|
||||||
@ -53,13 +54,6 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
|||||||
model_value: [],
|
model_value: [],
|
||||||
label: '取消退货'
|
label: '取消退货'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
big_value: [ReturnStageWaitCheck.value],
|
|
||||||
cut_value: [],
|
|
||||||
model_value: [],
|
|
||||||
label: '退货物流'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||||
@ -143,25 +137,28 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
|
|||||||
}, [orderBtnsShowList])
|
}, [orderBtnsShowList])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.btns_list}>
|
<>
|
||||||
{(orderBtnsShowList.length > 3)&&<View className={styles.more}>
|
{(orderBtnsShowList.length > 0)&&<View className={classnames(fixedBottom&&styles.submit_order)}>
|
||||||
<Text onClick={() => setShowMore(true)}>更多</Text>
|
<View className={styles.btns_list}>
|
||||||
{showMore&&<View className={styles.more_con}>
|
{(orderBtnsShowList.length > 3)&&<View className={styles.more}>
|
||||||
<View className={styles.more_list} style={styleTop}>
|
<Text onClick={() => setShowMore(true)}>更多</Text>
|
||||||
{orderBtnsShowList.map((item, index) => {
|
{showMore&&<View className={styles.more_con}>
|
||||||
return ((index >= 3) &&<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>{item.label}</View>)
|
<View className={styles.more_list} style={styleTop}>
|
||||||
})}
|
{orderBtnsShowList.map((item, index) => {
|
||||||
</View>
|
return ((index >= 3) &&<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>{item.label}</View>)
|
||||||
<View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View>
|
})}
|
||||||
</View>}
|
</View>
|
||||||
</View>}
|
<View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View>
|
||||||
|
</View>}
|
||||||
|
</View>}
|
||||||
|
|
||||||
<View className={styles.list_scroll}>
|
<View className={styles.list_scroll}>
|
||||||
{orderBtnsShowList.map((item, index) =>
|
{orderBtnsShowList.map((item, index) =>
|
||||||
(index < 3)&&<View key={item.id} className={classnames(styles.btns_item)} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
(index < 3)&&<View key={item.id} className={classnames(styles.btns_item)} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
</View>
|
||||||
</View>
|
</View>}
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
})
|
})
|
@ -14,7 +14,21 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
z-index:999;
|
z-index:999;
|
||||||
.shop_icon{
|
.shop_icon{
|
||||||
font-size: 50px;
|
font-size: 70px;
|
||||||
color: $color_main;
|
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 { ReactElement, useEffect, useRef, useState } from "react"
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
import { GetShoppingCartApi } from "@/api/shopCart";
|
||||||
|
|
||||||
type param = {
|
type param = {
|
||||||
children?: ReactElement|null,
|
children?: ReactElement|null,
|
||||||
@ -22,6 +23,19 @@ export default ({children = null, onClick}:param) => {
|
|||||||
setShowMoveBtn(true)
|
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) => {
|
const dragEnd = (e) => {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -31,6 +45,7 @@ export default ({children = null, onClick}:param) => {
|
|||||||
{children}
|
{children}
|
||||||
{showMoveBtn&&<MovableView onClick={onClick} className={styles.moveBtn} direction="all" inertia={true} x="630rpx" y={screenHeight+'rpx'} onTouchEnd={(e) => dragEnd(e)}>
|
{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>
|
<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>}
|
</MovableView>}
|
||||||
</MovableArea>
|
</MovableArea>
|
||||||
)
|
)
|
||||||
|
352
src/components/shopCart/index copy.tsx
Normal file
352
src/components/shopCart/index copy.tsx
Normal file
@ -0,0 +1,352 @@
|
|||||||
|
import {Image, ScrollView, View } from "@tarojs/components"
|
||||||
|
import Popup from "@/components/popup"
|
||||||
|
import classnames from "classnames";
|
||||||
|
import MCheckbox from "@/components/checkbox";
|
||||||
|
import LoadingCard from "@/components/loadingCard";
|
||||||
|
import InfiniteScroll from "@/components/infiniteScroll";
|
||||||
|
import styles from "./index.module.scss"
|
||||||
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
|
import Taro from "@tarojs/taro";
|
||||||
|
import { alert, goLink } from "@/common/common";
|
||||||
|
import {GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi} from "@/api/shopCart"
|
||||||
|
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,
|
||||||
|
onClose?: () => void
|
||||||
|
}
|
||||||
|
export default ({show = false, onClose}: param) => {
|
||||||
|
const selectList = [
|
||||||
|
{value:0, title:'大货', unit:'条', eunit:'kg', step:1, digits:0, minNum:1, maxNum:100000, defaultNum:1},
|
||||||
|
{value:1,title:'剪板', unit:'米', eunit:'m', step:1, digits:2, minNum:0.5, maxNum:9.99, defaultNum:1},
|
||||||
|
{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)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
resetList()
|
||||||
|
setSelectStatus(true)
|
||||||
|
}, [selectIndex])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//重置勾选数据
|
||||||
|
const resetList = () => {
|
||||||
|
list?.map(item => {
|
||||||
|
if(selectIndex == item.sale_mode || selectIndex == -1) {
|
||||||
|
item.select = true
|
||||||
|
} else {
|
||||||
|
item.select = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setList([...list])
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取数据
|
||||||
|
const [list, setList] = useState<any[]>([])
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
const {fetchData} = GetShoppingCartApi()
|
||||||
|
const getShoppingCart = async () => {
|
||||||
|
const {data} = await fetchData()
|
||||||
|
let color_list = data.color_list||[]
|
||||||
|
initList(color_list)
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化勾选数据
|
||||||
|
const [selectData, setSelectData] = useState<{id: number, checked: true|false}[]>([])
|
||||||
|
const initSelectData = (data:{id:number}[] = []) => {
|
||||||
|
let res = data?.map(item => {
|
||||||
|
return {id: item.id, checked: true}
|
||||||
|
})
|
||||||
|
setSelectData(() => res)
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化全部数据
|
||||||
|
const initList = (color_list) => {
|
||||||
|
color_list?.map(item => {
|
||||||
|
if(selectIndex == item.sale_mode) item.select = true
|
||||||
|
item.count = formatCount(item)
|
||||||
|
})
|
||||||
|
setList(color_list)
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示是展示数据
|
||||||
|
useEffect(() => {
|
||||||
|
if(!show) {
|
||||||
|
setList([])
|
||||||
|
setSelectIndex(0)
|
||||||
|
} else {
|
||||||
|
setLoading(true)
|
||||||
|
getShoppingCart()
|
||||||
|
}
|
||||||
|
}, [show])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
setList([])
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const [showPopup, setShowPopup] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
setShowPopup(show)
|
||||||
|
}, [show])
|
||||||
|
|
||||||
|
//全选反选
|
||||||
|
const [selectStatus, setSelectStatus] = useState(false)
|
||||||
|
const selectAll = () => {
|
||||||
|
list.map(item => {
|
||||||
|
if(selectIndex == item.sale_mode || selectIndex == -1)
|
||||||
|
item.select = !selectStatus
|
||||||
|
})
|
||||||
|
setSelectStatus(!selectStatus)
|
||||||
|
setList([...list])
|
||||||
|
}
|
||||||
|
|
||||||
|
//checkbox选中回调
|
||||||
|
const selectCallBack = (item) => {
|
||||||
|
item.select = true
|
||||||
|
checkSelect()
|
||||||
|
setList([...list])
|
||||||
|
}
|
||||||
|
|
||||||
|
//checkbox选中判断是否全部选中,全部选中后是全选,否则反选
|
||||||
|
const checkSelect = () => {
|
||||||
|
let list_count = 0
|
||||||
|
let select_count = 0
|
||||||
|
list?.map(item => {
|
||||||
|
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||||
|
list_count ++
|
||||||
|
if(item.select) select_count++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setSelectStatus(select_count == list_count)
|
||||||
|
}
|
||||||
|
|
||||||
|
//checkbox关闭回调
|
||||||
|
const colseCallBack = (item) => {
|
||||||
|
item.select = false
|
||||||
|
checkSelect()
|
||||||
|
setList([...list])
|
||||||
|
}
|
||||||
|
|
||||||
|
//popup关闭
|
||||||
|
const closePopup = () => {
|
||||||
|
onClose?.()
|
||||||
|
setShowPopup(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除购物车内容
|
||||||
|
const {fetchData:delShopFetchData} = DelShoppingCartApi()
|
||||||
|
const delSelect = () => {
|
||||||
|
getSelectId()
|
||||||
|
if(selectIds.current.length <= 0) return alert.none('请选择要删除的面料!')
|
||||||
|
Taro.showModal({
|
||||||
|
content: '删除所选商品?',
|
||||||
|
success: async function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
|
||||||
|
const res = await delShopFetchData({id:selectIds.current})
|
||||||
|
if(res.success) {
|
||||||
|
getShoppingCart()
|
||||||
|
Taro.showToast({
|
||||||
|
title: '成功',
|
||||||
|
icon: 'success',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取面料选中的id
|
||||||
|
const selectIds = useRef<number[]>([])
|
||||||
|
const getSelectId = () => {
|
||||||
|
selectIds.current = []
|
||||||
|
list?.map(item => {
|
||||||
|
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||||
|
item.select&&selectIds.current.push(item.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//格式化金额
|
||||||
|
const formatPirce = useCallback((price) => {
|
||||||
|
return Number(formatPriceDiv(price))
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
//格式化数量
|
||||||
|
const formatCount = useCallback((item) => {
|
||||||
|
console.log('item:::',item)
|
||||||
|
return item.sale_mode == 0? item.roll : (item.length/100)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
//格式化单位
|
||||||
|
const formatUnit = useCallback((item) => {
|
||||||
|
return item.sale_mode == 0? '条':'米'
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
//预估金额和总条数
|
||||||
|
const estimatePrice = useMemo(() => {
|
||||||
|
let estimate_amount = 0
|
||||||
|
let product_list = new Set() //面料
|
||||||
|
let color_count = 0 //颜色数量
|
||||||
|
let all_count = 0 //总数量
|
||||||
|
list.map(item => {
|
||||||
|
if(item.select) {
|
||||||
|
estimate_amount += item.estimate_amount
|
||||||
|
product_list.add(item.product_id)
|
||||||
|
color_count++
|
||||||
|
all_count += item.sale_mode == 0?item.roll: (item.length)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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])
|
||||||
|
|
||||||
|
|
||||||
|
//去结算
|
||||||
|
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('请选择面料')
|
||||||
|
} else {
|
||||||
|
let ids = selectIds.current.join('-')
|
||||||
|
setParam({ids, sale_mode:selectIndex}) //临时存储
|
||||||
|
closePopup()
|
||||||
|
goLink('/pages/order/comfirm')
|
||||||
|
}
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
|
||||||
|
//计数组件-当后端修改完成才修改前端显示
|
||||||
|
const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi()
|
||||||
|
const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false)
|
||||||
|
const getInputValue = debounce(async (num, item) => {
|
||||||
|
let roll = item.sale_mode == 0?parseFloat(num):0
|
||||||
|
let length = item.sale_mode != 0?(parseFloat(num)*100):0
|
||||||
|
setUpdateShoppingCartLoading(() => true)
|
||||||
|
let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length})
|
||||||
|
setUpdateShoppingCartLoading(() => false)
|
||||||
|
if(res.success) {
|
||||||
|
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 onClick={selectAll}>{!selectStatus?'全选':'反选'}</View>
|
||||||
|
<View onClick={delSelect}>
|
||||||
|
<text className={classnames('iconfont', 'icon-shanchu', styles.miconfont)}></text>
|
||||||
|
删除所选
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.count_all}>{estimatePrice.countText}</View>
|
||||||
|
<View className={styles.search}>
|
||||||
|
{selectList.map((item) => {
|
||||||
|
return <View key={item.value} onClick={() => selectProduct(item.value)} className={classnames(styles.search_item, (selectIndex==item.value)&&styles.search_item_select)}>{item.title}</View>
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
<View className={styles.con}>
|
||||||
|
{loading&&<LoadingCard/>}
|
||||||
|
{!loading&&list?.length > 0&&<InfiniteScroll moreStatus={false} >
|
||||||
|
<View className={styles.product_list}>
|
||||||
|
{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)}/>
|
||||||
|
</View>
|
||||||
|
<View className={styles.img}>
|
||||||
|
<Image mode="aspectFill" src={formatImgUrl(item.texture_url)}/>
|
||||||
|
</View>
|
||||||
|
<View className={styles.des}>
|
||||||
|
<View className={styles.title}>{formatHashTag(item.product_code, item.product_name)}</View>
|
||||||
|
<View className={styles.subtitle}>{item.product_color_code +' ' + item.product_color_name}</View>
|
||||||
|
<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.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
|
||||||
|
<View className={styles.btn_count}>
|
||||||
|
<Counter
|
||||||
|
onBlue={(e) => getInputValue(e, item)}
|
||||||
|
defaultNum={item.count}
|
||||||
|
step={selectList[selectIndex].step}
|
||||||
|
digits={selectList[selectIndex].digits}
|
||||||
|
onClickBtn={(e) => getInputValue(e, item)}
|
||||||
|
unit={formatUnit(item)}
|
||||||
|
minNum={selectList[selectIndex].minNum}
|
||||||
|
maxNum={selectList[selectIndex].maxNum}
|
||||||
|
disable={UpdateShoppingCartLoading}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
</InfiniteScroll>}
|
||||||
|
{!loading&&list?.length == 0 &&<View className={styles.empty}>
|
||||||
|
<View className={styles.title}>暂未选择商品</View>
|
||||||
|
<View className={styles.btn}>去选购</View>
|
||||||
|
</View>}
|
||||||
|
|
||||||
|
</View>
|
||||||
|
<View className={styles.buy_btn}>
|
||||||
|
<View className={styles.buy_con}>
|
||||||
|
<View className={styles.icon}>
|
||||||
|
<View className={classnames('iconfont', 'icon-gouwuche', styles.miconfont)}></View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.price_con}>
|
||||||
|
<View className={styles.price_real}><text>¥</text>{estimatePrice.price}</View>
|
||||||
|
<View className={styles.price_forecast}>预估金额</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.goPay} onClick={() => orderDetail()}>
|
||||||
|
去结算({estimatePrice.color_count})
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Popup>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -26,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},
|
{value:2,title:'散剪', unit:'米', eunit:'kg', step:1, digits:2, minNum:5, maxNum:100000, defaultNum:10},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
//切换面料类型
|
||||||
const [selectIndex, setSelectIndex] = useState(0)
|
const [selectIndex, setSelectIndex] = useState(0)
|
||||||
const selectProduct = (index:number) => {
|
const selectProduct = (index:number) => {
|
||||||
setSelectIndex(index)
|
setSelectIndex(index)
|
||||||
@ -42,12 +43,12 @@ export default ({show = false, onClose}: param) => {
|
|||||||
const resetList = () => {
|
const resetList = () => {
|
||||||
list?.map(item => {
|
list?.map(item => {
|
||||||
if(selectIndex == item.sale_mode || selectIndex == -1) {
|
if(selectIndex == item.sale_mode || selectIndex == -1) {
|
||||||
item.select = true
|
checkboxData[item.id] = true
|
||||||
} else {
|
} else {
|
||||||
item.select = false
|
checkboxData[item.id] = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setList([...list])
|
setCheckboxData(() => ({...checkboxData}))
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取数据
|
//获取数据
|
||||||
@ -58,25 +59,21 @@ export default ({show = false, onClose}: param) => {
|
|||||||
const {data} = await fetchData()
|
const {data} = await fetchData()
|
||||||
let color_list = data.color_list||[]
|
let color_list = data.color_list||[]
|
||||||
initList(color_list)
|
initList(color_list)
|
||||||
|
setList(color_list)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化勾选数据
|
//初始化全部数据默认勾选
|
||||||
const [selectData, setSelectData] = useState<{id: number, checked: true|false}[]>([])
|
const [checkboxData, setCheckboxData] = useState<{[index:number]:true|false}>({})
|
||||||
const initSelectData = (data:{id:number}[] = []) => {
|
const initStatus = useRef(false)
|
||||||
let res = data?.map(item => {
|
|
||||||
return {id: item.id, checked: true}
|
|
||||||
})
|
|
||||||
setSelectData(() => res)
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化全部数据
|
|
||||||
const initList = (color_list) => {
|
const initList = (color_list) => {
|
||||||
color_list?.map(item => {
|
if(initStatus.current) {
|
||||||
if(selectIndex == item.sale_mode) item.select = true
|
color_list?.map(item => {
|
||||||
item.count = formatCount(item)
|
if(selectIndex == item.sale_mode) checkboxData[item.id] = true
|
||||||
})
|
})
|
||||||
setList(color_list)
|
initStatus.current = false
|
||||||
|
}
|
||||||
|
setCheckboxData(() => checkboxData)
|
||||||
}
|
}
|
||||||
|
|
||||||
//显示是展示数据
|
//显示是展示数据
|
||||||
@ -86,6 +83,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
setSelectIndex(0)
|
setSelectIndex(0)
|
||||||
} else {
|
} else {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
|
initStatus.current = true
|
||||||
getShoppingCart()
|
getShoppingCart()
|
||||||
}
|
}
|
||||||
}, [show])
|
}, [show])
|
||||||
@ -106,17 +104,17 @@ export default ({show = false, onClose}: param) => {
|
|||||||
const selectAll = () => {
|
const selectAll = () => {
|
||||||
list.map(item => {
|
list.map(item => {
|
||||||
if(selectIndex == item.sale_mode || selectIndex == -1)
|
if(selectIndex == item.sale_mode || selectIndex == -1)
|
||||||
item.select = !selectStatus
|
checkboxData[item.id] = !selectStatus
|
||||||
})
|
})
|
||||||
setSelectStatus(!selectStatus)
|
setSelectStatus(!selectStatus)
|
||||||
setList([...list])
|
setCheckboxData(() => ({...checkboxData}))
|
||||||
}
|
}
|
||||||
|
|
||||||
//checkbox选中回调
|
//checkbox选中回调
|
||||||
const selectCallBack = (item) => {
|
const selectCallBack = (item) => {
|
||||||
item.select = true
|
checkboxData[item.id] = true
|
||||||
checkSelect()
|
checkSelect()
|
||||||
setList([...list])
|
setCheckboxData(() => ({...checkboxData}))
|
||||||
}
|
}
|
||||||
|
|
||||||
//checkbox选中判断是否全部选中,全部选中后是全选,否则反选
|
//checkbox选中判断是否全部选中,全部选中后是全选,否则反选
|
||||||
@ -126,7 +124,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
list?.map(item => {
|
list?.map(item => {
|
||||||
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||||
list_count ++
|
list_count ++
|
||||||
if(item.select) select_count++
|
if(checkboxData[item.id]) select_count++
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setSelectStatus(select_count == list_count)
|
setSelectStatus(select_count == list_count)
|
||||||
@ -134,9 +132,9 @@ export default ({show = false, onClose}: param) => {
|
|||||||
|
|
||||||
//checkbox关闭回调
|
//checkbox关闭回调
|
||||||
const colseCallBack = (item) => {
|
const colseCallBack = (item) => {
|
||||||
item.select = false
|
checkboxData[item.id] = false
|
||||||
checkSelect()
|
checkSelect()
|
||||||
setList([...list])
|
setCheckboxData(() => ({...checkboxData}))
|
||||||
}
|
}
|
||||||
|
|
||||||
//popup关闭
|
//popup关闭
|
||||||
@ -182,7 +180,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
selectIds.current = []
|
selectIds.current = []
|
||||||
list?.map(item => {
|
list?.map(item => {
|
||||||
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||||
item.select&&selectIds.current.push(item.id)
|
checkboxData[item.id]&&selectIds.current.push(item.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -210,7 +208,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
let color_count = 0 //颜色数量
|
let color_count = 0 //颜色数量
|
||||||
let all_count = 0 //总数量
|
let all_count = 0 //总数量
|
||||||
list.map(item => {
|
list.map(item => {
|
||||||
if(item.select) {
|
if(checkboxData[item.id]) {
|
||||||
estimate_amount += item.estimate_amount
|
estimate_amount += item.estimate_amount
|
||||||
product_list.add(item.product_id)
|
product_list.add(item.product_id)
|
||||||
color_count++
|
color_count++
|
||||||
@ -219,7 +217,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
})
|
})
|
||||||
let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米'
|
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}
|
return {price: Number(formatPriceDiv(estimate_amount)).toFixed(2), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count}
|
||||||
},[list])
|
},[list, checkboxData])
|
||||||
|
|
||||||
|
|
||||||
//去结算
|
//去结算
|
||||||
@ -293,7 +291,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
{list?.map((item, index) => {
|
{list?.map((item, index) => {
|
||||||
return <View key={index} className={classnames(styles.product_item, (selectIndex!=-1&&selectIndex!= item.sale_mode)&&styles.no_product_item_select)}>
|
return <View key={index} className={classnames(styles.product_item, (selectIndex!=-1&&selectIndex!= item.sale_mode)&&styles.no_product_item_select)}>
|
||||||
<View className={styles.checkbox}>
|
<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>
|
||||||
<View className={styles.img}>
|
<View className={styles.img}>
|
||||||
<Image mode="aspectFill" src={formatImgUrl(item.texture_url)}/>
|
<Image mode="aspectFill" src={formatImgUrl(item.texture_url)}/>
|
||||||
@ -309,7 +307,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
<View className={styles.btn_count}>
|
<View className={styles.btn_count}>
|
||||||
<Counter
|
<Counter
|
||||||
onBlue={(e) => getInputValue(e, item)}
|
onBlue={(e) => getInputValue(e, item)}
|
||||||
defaultNum={item.count}
|
defaultNum={formatCount(item)}
|
||||||
step={selectList[selectIndex].step}
|
step={selectList[selectIndex].step}
|
||||||
digits={selectList[selectIndex].digits}
|
digits={selectList[selectIndex].digits}
|
||||||
onClickBtn={(e) => getInputValue(e, item)}
|
onClickBtn={(e) => getInputValue(e, item)}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20px 20px 0 20px;
|
padding: 20px 30px 0 30px;
|
||||||
font-size: 26px;
|
font-size: 26px;
|
||||||
color: #707070;
|
color: #707070;
|
||||||
.operation_check{
|
.operation_check{
|
||||||
@ -35,9 +35,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.operation_check_right{
|
.operation_check_right{
|
||||||
Text{
|
.operation_check_move{
|
||||||
color: #CCCCCC;
|
color: #707070;
|
||||||
margin-right: 20px;
|
margin-right: 30px;
|
||||||
|
}
|
||||||
|
.operation_check_cancel{
|
||||||
|
color: #007AFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.class_list{
|
.class_list{
|
||||||
|
@ -11,6 +11,7 @@ import CreatePopup from "../components/createPopup";
|
|||||||
import UpdatePopup from "../components/updatePopup";
|
import UpdatePopup from "../components/updatePopup";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import MCheckbox from "@/components/checkbox";
|
import MCheckbox from "@/components/checkbox";
|
||||||
|
import AddCollection from "@/components/addCollection";
|
||||||
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
@ -20,7 +21,7 @@ export default () => {
|
|||||||
const getFavoriteInfo = () => {
|
const getFavoriteInfo = () => {
|
||||||
let arr:any[] = []
|
let arr:any[] = []
|
||||||
new Array(10).fill("").map((item, index) => {
|
new Array(10).fill("").map((item, index) => {
|
||||||
arr.push({code: index})
|
arr.push({id:index, code: index})
|
||||||
})
|
})
|
||||||
setList(arr)
|
setList(arr)
|
||||||
}
|
}
|
||||||
@ -34,32 +35,53 @@ export default () => {
|
|||||||
getFavoriteInfo()
|
getFavoriteInfo()
|
||||||
}, [searchData])
|
}, [searchData])
|
||||||
|
|
||||||
|
|
||||||
|
//获取选中的id
|
||||||
|
const [ids, setIds] = useState<number[]>([])
|
||||||
|
const getSelectIds = useCallback((val) => {
|
||||||
|
setIds(() => val)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
//全选反选
|
||||||
|
const [selectStatus, setSelectStatus] = useState(false)
|
||||||
const selectCallBack = useCallback(() => {
|
const selectCallBack = useCallback(() => {
|
||||||
|
setSelectStatus(() => true)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const colseCallBack = useCallback(() => {
|
const colseCallBack = useCallback(() => {
|
||||||
|
setSelectStatus(() => false)
|
||||||
|
}, [])
|
||||||
|
// useEffect(() => {
|
||||||
|
// if(list.length)
|
||||||
|
// setSelectStatus(ids.length == list.length)
|
||||||
|
// }, [ids, list])
|
||||||
|
const [collectionShow, setCollectionShow] = useState(false)
|
||||||
|
const closeCollection = useCallback(() => {
|
||||||
|
setCollectionShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
const onAdd = () => {
|
||||||
<View className={styles.collection_main}>
|
|
||||||
<View className={styles.search}>
|
}
|
||||||
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={onSearch} placeholder="请输入面料关键词" />
|
|
||||||
</View>
|
return (
|
||||||
<View className={styles.operation}>
|
<View className={styles.collection_main}>
|
||||||
<View className={styles.operation_check}>
|
<View className={styles.search}>
|
||||||
<MCheckbox onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
|
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={onSearch} placeholder="请输入面料关键词" />
|
||||||
<Text>全选</Text>
|
|
||||||
</View>
|
|
||||||
<View className={styles.operation_check_right}>
|
|
||||||
<Text>移动到</Text>
|
|
||||||
<Text>取消收藏</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.class_list}>
|
|
||||||
<Product productList={list}/>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
<View className={styles.operation}>
|
||||||
|
<View className={styles.operation_check}>
|
||||||
|
<MCheckbox status={selectStatus} 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}/>
|
||||||
|
</View>
|
||||||
|
<AddCollection show={collectionShow} onAdd={onAdd} onClose={closeCollection}/>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
}
|
}
|
@ -5,54 +5,77 @@ import styles from './index.module.scss'
|
|||||||
import { formatHashTag, formatImgUrl } from "@/common/fotmat"
|
import { formatHashTag, formatImgUrl } from "@/common/fotmat"
|
||||||
import LabAndImg from "@/components/LabAndImg"
|
import LabAndImg from "@/components/LabAndImg"
|
||||||
import MCheckbox from "@/components/checkbox";
|
import MCheckbox from "@/components/checkbox";
|
||||||
import { useCallback, useEffect, useState } from "react"
|
import { useCallback, useEffect, useRef, useState } from "react"
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
desStatus?: true|false,
|
productList?: any[],
|
||||||
productList?: any[]
|
onSelectIds?: (val: number[]) => void
|
||||||
|
selectStatus?: false|true
|
||||||
}
|
}
|
||||||
export default ({desStatus = true, productList = []}:Params) => {
|
export default ({productList = [], onSelectIds, selectStatus = false}:Params) => {
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('productList::', productList)
|
|
||||||
setList(() => [...productList])
|
setList(() => [...productList])
|
||||||
},[productList])
|
},[productList])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(list.length) {
|
||||||
|
list.map(item => {
|
||||||
|
item.check = selectStatus
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setList(() => [...list])
|
||||||
|
}, [selectStatus])
|
||||||
|
|
||||||
const onSelect = (item, e) => {
|
const onChangeSelect = (item) => {
|
||||||
console.log('e:::', e)
|
if(item.check) {
|
||||||
|
onClose(item)
|
||||||
|
} else {
|
||||||
|
onSelect(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//选中和取消选中
|
||||||
|
const onSelect = (item) => {
|
||||||
item.check = true
|
item.check = true
|
||||||
setList(() => ([...list]))
|
setList(() => ([...list]))
|
||||||
}
|
}
|
||||||
|
const onClose = (item) => {
|
||||||
const onClose = (item, e) => {
|
|
||||||
item.check = false
|
item.check = false
|
||||||
setList(() => ([...list]))
|
setList(() => ([...list]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//监听数据变化
|
||||||
|
useEffect(() => {
|
||||||
|
let ids: number[] = []
|
||||||
|
list.map(item => {
|
||||||
|
if(item.check) ids.push(item.id)
|
||||||
|
})
|
||||||
|
onSelectIds?.(ids)
|
||||||
|
}, [list])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.products_list}>
|
<View className={styles.products_list}>
|
||||||
{list?.map(item => {
|
{list?.map(item => {
|
||||||
return <View className={styles.products_item} onClick={() => goLink(`/pages/details/index?id=${item.id}`)}>
|
return <View className={styles.products_item} onClick={() => onChangeSelect(item)}>
|
||||||
<View className={styles.checkbox}>
|
<View className={styles.checkbox} onClick={(e) => e.stopPropagation()}>
|
||||||
<MCheckbox status={item.check} onSelect={() => onSelect(item, e)} onClose={() => onClose(item, e)}/>
|
<MCheckbox status={item.check} onSelect={() => onSelect(item)} onClose={() => onClose(item)}/>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.item_img}>
|
<View className={styles.item_img}>
|
||||||
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
|
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
|
||||||
<View className={styles.num}>{item.product_color_count}色</View>
|
<View className={styles.num}>{item.product_color_count}色</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.item_con}>
|
<View className={styles.item_con}>
|
||||||
<View className={styles.title}><text>{formatHashTag(item.product_code, '')} </text>{item.product_name}</View>
|
<View className={styles.title}><text>{formatHashTag(item.product_code, '')} </text>{item.product_name}</View>
|
||||||
<View className={styles.tag_list}>
|
<View className={styles.tag_list}>
|
||||||
<View className={styles.tag}>{item.width}</View>
|
<View className={styles.tag}>{item.width}</View>
|
||||||
<View className={styles.tag_g}>{item.weight_density}</View>
|
<View className={styles.tag_g}>{item.weight_density}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.introduce}>{item.component}</View>
|
<View className={styles.introduce}>{item.component}</View>
|
||||||
{desStatus&&<View className={styles.des}>{item.describe}</View>}
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
})}
|
})}
|
||||||
|
<View className="common_safe_area_y"></View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ export default () => {
|
|||||||
<View className={styles.more} onClick={(e) => moreUpdate(item,e)}>更多</View>
|
<View className={styles.more} onClick={(e) => moreUpdate(item,e)}>更多</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.class_con} style={item.openStatus?{maxHeight: 10*260 + 'rpx'}:{maxHeight: 0}} >
|
<View className={styles.class_con} style={item.openStatus?{maxHeight: 10*260 + 'rpx'}:{maxHeight: 0}} >
|
||||||
<Product productList={item.product_color_list}/>
|
<Product productList={item.product_color_list||[]}/>
|
||||||
</View>
|
</View>
|
||||||
</View>)}
|
</View>)}
|
||||||
</View>
|
</View>
|
||||||
|
@ -53,6 +53,7 @@ import styles from './index.module.scss'
|
|||||||
let res = await getOrderFetchData({id: orderId.current})
|
let res = await getOrderFetchData({id: orderId.current})
|
||||||
setOrderDetail(res.data)
|
setOrderDetail(res.data)
|
||||||
setOrderRemark(res.data.remark)
|
setOrderRemark(res.data.remark)
|
||||||
|
if(res.data.status == SaleorderstatusWaitingPrePayment.value) toPay()
|
||||||
}
|
}
|
||||||
Taro.stopPullDownRefresh()
|
Taro.stopPullDownRefresh()
|
||||||
Taro.hideToast()
|
Taro.hideToast()
|
||||||
|
@ -78,9 +78,9 @@
|
|||||||
width:152px;
|
width:152px;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
color: $color_font_two;
|
color:#007AFF;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
border: 2px solid #dddddd;
|
border: 2px solid #007AFF;
|
||||||
border-radius: 36px;
|
border-radius: 36px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 60px;
|
line-height: 60px;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
|
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS } from "@/common/enum"
|
||||||
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
|
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
|
||||||
import LabAndImg from "@/components/LabAndImg"
|
import LabAndImg from "@/components/LabAndImg"
|
||||||
import { Text, View } from "@tarojs/components"
|
import { Text, View } from "@tarojs/components"
|
||||||
@ -17,6 +17,7 @@ type OrderParam = {
|
|||||||
total_number: number,
|
total_number: number,
|
||||||
stage: number, //订单状态
|
stage: number, //订单状态
|
||||||
type: 1|2, //1退货, 2退款
|
type: 1|2, //1退货, 2退款
|
||||||
|
refund_type: number, //退款状态
|
||||||
total_sale_price: number, //销售金额
|
total_sale_price: number, //销售金额
|
||||||
total_should_collect_money: number, //应收金额
|
total_should_collect_money: number, //应收金额
|
||||||
total_weight_error_discount: number, //空差优惠
|
total_weight_error_discount: number, //空差优惠
|
||||||
@ -57,76 +58,80 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
ReturnStageRejected, // 已拒绝
|
ReturnStageRejected, // 已拒绝
|
||||||
} = AFTER_ORDER_STATUS
|
} = AFTER_ORDER_STATUS
|
||||||
|
|
||||||
|
//退款状态枚举
|
||||||
|
const {
|
||||||
|
ShouldCollectOrderRefundTypeUnknown,
|
||||||
|
ShouldCollectOrderRefundTypeAdvanceReceiptRefund,
|
||||||
|
ShouldCollectOrderRefundTypeReturnForRefund,
|
||||||
|
ShouldCollectOrderRefundTypeSalesRefund,
|
||||||
|
} = REFUND_STATUS
|
||||||
|
|
||||||
//金额列表枚举
|
//金额列表枚举
|
||||||
const priceList = [
|
const priceList = [
|
||||||
|
{
|
||||||
|
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:1,
|
id:1,
|
||||||
big_value:[
|
big_value:[ReturnStageReturned.value],
|
||||||
ReturnStageServiceOrderPendingRefund.value,
|
|
||||||
ReturnStageReturned.value
|
|
||||||
],
|
|
||||||
cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
||||||
model_value: [],
|
model_value: [],
|
||||||
label:'扣款金额',
|
label:'扣款金额',
|
||||||
field: 'total_sale_price'
|
field: 'other_deduction_amount'
|
||||||
},
|
|
||||||
{
|
|
||||||
id:2,
|
|
||||||
big_value:[
|
|
||||||
ReturnStageServiceOrderPendingRefund.value,
|
|
||||||
ReturnStageReturned.value
|
|
||||||
],
|
|
||||||
cut_value: [],
|
|
||||||
model_value: [],
|
|
||||||
label:'其他扣款',
|
|
||||||
field: 'total_weight_error_discount'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id:3,
|
id:3,
|
||||||
big_value:[
|
big_value:[ReturnStageReturned.value],
|
||||||
ReturnStageServiceOrderPendingRefund.value,
|
cut_value: [ReturnStageReturned.value],
|
||||||
ReturnStageReturned.value
|
model_value: [ReturnStageReturned.value],
|
||||||
],
|
label:'退款金额',
|
||||||
cut_value: [ReturnStageServiceOrderPendingRefund.value],
|
field: 'refund_amount'
|
||||||
model_value: [
|
|
||||||
ReturnStageQualityCheckPendingRefund.value,
|
|
||||||
ReturnStageServiceOrderPendingRefund.value
|
|
||||||
],
|
|
||||||
label:'应退金额',
|
|
||||||
field: 'total_should_collect_money'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id:4,
|
id:4,
|
||||||
big_value:[ReturnStageReturned.value],
|
big_value:[ReturnStageReturned.value],
|
||||||
cut_value: [ReturnStageReturned.value],
|
cut_value: [ReturnStageReturned.value],
|
||||||
model_value: [ReturnStageReturned.value],
|
model_value: [ReturnStageReturned.value],
|
||||||
label:'退款金额',
|
|
||||||
field: 'total_should_collect_money'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:5,
|
|
||||||
big_value:[ReturnStageReturned.value],
|
|
||||||
cut_value: [ReturnStageReturned.value],
|
|
||||||
model_value: [ReturnStageReturned.value],
|
|
||||||
label:'退款去向',
|
label:'退款去向',
|
||||||
field: 'actual_amount'
|
field: 'actual_amount'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id:6,
|
]
|
||||||
big_value:[ReturnStageQualityCheckPendingRefund.value],
|
|
||||||
cut_value: [ReturnStageRejected.value, ReturnStageApplying.value, ReturnStageWaitCheck.value, ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
|
|
||||||
model_value: [ReturnStageApplying.value],
|
|
||||||
label:'合计金额',
|
|
||||||
field: 'actual_amount'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
//是否显示价格
|
//是否显示价格
|
||||||
const showPrice = useCallback((priceInfo) => {
|
const showPrice = useCallback((priceInfo) => {
|
||||||
let key = ['big_value', 'model_value', 'cut_value']
|
let key = ['big_value', 'model_value', 'cut_value']
|
||||||
return priceInfo[key[order?.sale_mode]].includes(order?.stage)
|
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])
|
}, [order])
|
||||||
|
|
||||||
const priceConDom = useMemo(() => {
|
const priceConDom = useMemo(() => {
|
||||||
@ -175,7 +180,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
||||||
<View className={styles.order_list_item_price}>
|
<View className={styles.order_list_item_price}>
|
||||||
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
|
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
|
||||||
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
|
{(order?.stage == ReturnStageReturned.value)&&<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.order_list_item_count}>
|
<View className={styles.order_list_item_count}>
|
||||||
|
@ -60,6 +60,11 @@ import styles from './index.module.scss'
|
|||||||
total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠
|
total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠
|
||||||
actual_amount: orderDetail.actual_amount, //实付金额
|
actual_amount: orderDetail.actual_amount, //实付金额
|
||||||
the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态
|
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 //退款状态
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const formatPreViewOrderMemo = useMemo(() => {
|
const formatPreViewOrderMemo = useMemo(() => {
|
||||||
@ -104,7 +109,7 @@ import styles from './index.module.scss'
|
|||||||
if(val == 1) {
|
if(val == 1) {
|
||||||
setLogisticsShow(true)
|
setLogisticsShow(true)
|
||||||
} else {
|
} else {
|
||||||
const list = orderDetail?.fabric_piece_accessory_url.map(item => {
|
const list = orderDetail?.accessory_url.map(item => {
|
||||||
return formatImgUrl(item)
|
return formatImgUrl(item)
|
||||||
})
|
})
|
||||||
Taro.previewImage({
|
Taro.previewImage({
|
||||||
@ -132,9 +137,7 @@ import styles from './index.module.scss'
|
|||||||
<AddressInfoDetail return_address={orderDetail?.return_user_name} return_phone={orderDetail?.return_user_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}/>
|
<KindList order={formatPreViewOrderMemo}/>
|
||||||
<OrderDes orderInfo={orderDetail}/>
|
<OrderDes orderInfo={orderDetail}/>
|
||||||
<View className={styles.submit_order}>
|
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
||||||
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick} />
|
|
||||||
</View>
|
|
||||||
<AfterSalePricture urls={orderDetail?.fabric_piece_accessory_url}/>
|
<AfterSalePricture urls={orderDetail?.fabric_piece_accessory_url}/>
|
||||||
<ReturnLogistics images={orderDetail?.accessory_url} descValue={orderDetail?.take_goods_remark} show={logisticsShow} id={orderDetail?.return_apply_order_id} onClose={onCloseLogistics} onSubmit={logisticsSuccess}/>
|
<ReturnLogistics 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)}/>
|
<ApplyRecord show={applyRecord} id={orderDetail?.id} onClose={() => setApplyRecord(false)}/>
|
||||||
@ -194,7 +197,7 @@ import styles from './index.module.scss'
|
|||||||
|
|
||||||
const showList = useMemo(() => {
|
const showList = useMemo(() => {
|
||||||
let res = urls.map(item => {
|
let res = urls.map(item => {
|
||||||
return formatImgUrl(item)
|
return formatImgUrl(item, "!w800")
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
}, [urls])
|
}, [urls])
|
||||||
|
@ -27,6 +27,7 @@ type Param = {
|
|||||||
rgb: {r:number, g:number, b:number},
|
rgb: {r:number, g:number, b:number},
|
||||||
texturl_url: string,
|
texturl_url: string,
|
||||||
type: number //1 退货 2退款
|
type: number //1 退货 2退款
|
||||||
|
return_apply_order_id: number //退款申请单
|
||||||
},
|
},
|
||||||
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
||||||
}
|
}
|
||||||
@ -52,7 +53,8 @@ export default memo(({value, onClickBtn}: Param) => {
|
|||||||
stage: value?.stage, //订单状态
|
stage: value?.stage, //订单状态
|
||||||
orderId: value?.id,
|
orderId: value?.id,
|
||||||
sale_mode: value?.sale_mode, //订单类型
|
sale_mode: value?.sale_mode, //订单类型
|
||||||
type: value?.type //退货or退款
|
type: value?.type, //退货or退款
|
||||||
|
return_apply_order_id: value?.return_apply_order_id //退款申请单
|
||||||
}
|
}
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
@ -109,7 +111,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
|||||||
<Text>订单号:{value?.order_no}</Text>
|
<Text>订单号:{value?.order_no}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} />
|
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} fixedBottom={false}/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -15,6 +15,7 @@ export const useTimeCountDown = () => {
|
|||||||
const timeObj:any = useRef()
|
const timeObj:any = useRef()
|
||||||
const endTime = useRef('')
|
const endTime = useRef('')
|
||||||
const onStart = (val = '') => {
|
const onStart = (val = '') => {
|
||||||
|
console.log('time:::', val)
|
||||||
endTime.current = val
|
endTime.current = val
|
||||||
if(endTime.current) {
|
if(endTime.current) {
|
||||||
clearInterval(timeObj.current)
|
clearInterval(timeObj.current)
|
||||||
@ -51,7 +52,7 @@ export const useTimeCountDown = () => {
|
|||||||
var HH = ('00'+hh).slice(-2);
|
var HH = ('00'+hh).slice(-2);
|
||||||
var MM = ('00'+mm).slice(-2);
|
var MM = ('00'+mm).slice(-2);
|
||||||
var SS = ('00'+ss).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}))
|
setShowTime((e) => ({...e, DD, HH, MM, SS}))
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user