部分优化对接售后原因枚举
This commit is contained in:
parent
7c758f6896
commit
3b0f32c88a
@ -49,3 +49,14 @@ export const GetSaleOrderListApi = () => {
|
|||||||
method: "put",
|
method: "put",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 售后货物状况
|
||||||
|
*/
|
||||||
|
export const ReturnGoodsStatusApi = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mall/enum/return/goodsStatus`,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -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.224:50002/lymarket` // 添
|
// export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添
|
||||||
// export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰
|
export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰
|
||||||
|
|
||||||
// CDN
|
// CDN
|
||||||
// 生成密钥
|
// 生成密钥
|
||||||
|
@ -1,275 +0,0 @@
|
|||||||
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} from "@/api/shopCart"
|
|
||||||
import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
|
||||||
import { setParam } from "@/common/system";
|
|
||||||
import { debounce } from "@/common/util";
|
|
||||||
|
|
||||||
type param = {
|
|
||||||
show?: true|false,
|
|
||||||
onClose?: () => void
|
|
||||||
}
|
|
||||||
export default ({show = false, onClose}: param) => {
|
|
||||||
const selectList = [
|
|
||||||
// {value:-1, title:'不限', unit:'', eunit:''},
|
|
||||||
{value:0, title:'大货', unit:'件', eunit:'kg'},
|
|
||||||
{value:1,title:'剪板', unit:'米', eunit:'m'},
|
|
||||||
{value:2,title:'散剪', unit:'米', eunit:'kg'},
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
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 () => {
|
|
||||||
setLoading(true)
|
|
||||||
const {data} = await fetchData()
|
|
||||||
let color_list = data.color_list||[]
|
|
||||||
color_list.reverse()
|
|
||||||
initList(color_list)
|
|
||||||
setList(color_list)
|
|
||||||
setLoading(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化全部数据
|
|
||||||
const initList = (color_list) => {
|
|
||||||
color_list?.map(item => {
|
|
||||||
if(selectIndex == item.sale_mode) item.select = true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//显示是展示数据
|
|
||||||
useEffect(() => {
|
|
||||||
if(!show) {
|
|
||||||
setList([])
|
|
||||||
setSelectIndex(0)
|
|
||||||
} else {
|
|
||||||
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 = () => {
|
|
||||||
Taro.showModal({
|
|
||||||
content: '删除所选商品?',
|
|
||||||
success: async function (res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
getSelectId()
|
|
||||||
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) => {
|
|
||||||
return item.sale_mode == 0? item.roll + '件': (item.length/100) + 'm'
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
//预估金额
|
|
||||||
const estimatePrice = useMemo(() => {
|
|
||||||
let count = 0
|
|
||||||
list.map(item => {
|
|
||||||
if(item.select) count += item.estimate_amount
|
|
||||||
})
|
|
||||||
return Number(formatPriceDiv(count))
|
|
||||||
},[list])
|
|
||||||
|
|
||||||
//去结算
|
|
||||||
const orderDetail = debounce(() => {
|
|
||||||
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)
|
|
||||||
|
|
||||||
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.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)}</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}</View>
|
|
||||||
<View className={styles.price_forecast}>预估金额</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.goPay} onClick={() => orderDetail()}>
|
|
||||||
去结算
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</Popup>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
@ -164,6 +164,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding-bottom: constant(safe-area-inset-bottom);
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
z-index: 999;
|
||||||
.buy_con{
|
.buy_con{
|
||||||
width: 702px;
|
width: 702px;
|
||||||
height: 95px;
|
height: 95px;
|
||||||
|
@ -52,7 +52,6 @@ export default ({show = false, onClose}: param) => {
|
|||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const {fetchData} = GetShoppingCartApi()
|
const {fetchData} = GetShoppingCartApi()
|
||||||
const getShoppingCart = async () => {
|
const getShoppingCart = async () => {
|
||||||
setLoading(true)
|
|
||||||
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)
|
||||||
@ -74,6 +73,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
setList([])
|
setList([])
|
||||||
setSelectIndex(0)
|
setSelectIndex(0)
|
||||||
} else {
|
} else {
|
||||||
|
setLoading(true)
|
||||||
getShoppingCart()
|
getShoppingCart()
|
||||||
}
|
}
|
||||||
}, [show])
|
}, [show])
|
||||||
@ -206,7 +206,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)), 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])
|
||||||
|
|
||||||
|
|
||||||
@ -226,18 +226,16 @@ export default ({show = false, onClose}: param) => {
|
|||||||
//计数组件-当后端修改完成才修改前端显示
|
//计数组件-当后端修改完成才修改前端显示
|
||||||
const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi()
|
const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi()
|
||||||
const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false)
|
const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false)
|
||||||
const getInputValue = async (num, item) => {
|
const getInputValue = debounce(async (num, item) => {
|
||||||
let roll = item.sale_mode == 0?parseFloat(num):0
|
let roll = item.sale_mode == 0?parseFloat(num):0
|
||||||
let length = item.sale_mode != 0?(parseFloat(num)*100):0
|
let length = item.sale_mode != 0?(parseFloat(num)*100):0
|
||||||
setUpdateShoppingCartLoading(() => true)
|
setUpdateShoppingCartLoading(() => true)
|
||||||
let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length})
|
let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length})
|
||||||
setUpdateShoppingCartLoading(() => false)
|
setUpdateShoppingCartLoading(() => false)
|
||||||
if(res.success) {
|
if(res.success) {
|
||||||
item.count = parseFloat(num)
|
getShoppingCart()
|
||||||
setList([...list])
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}, 300)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.shop_cart_main}>
|
<View className={styles.shop_cart_main}>
|
||||||
@ -275,7 +273,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
</View>
|
</View>
|
||||||
<View className={styles.count}>
|
<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[selectIndex].eunit}</text></View>
|
||||||
{/* <View className={styles.long}>×{formatCount(item)}</View> */}
|
{/* <View className={styles.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
|
||||||
<View className={styles.btn_count}>
|
<View className={styles.btn_count}>
|
||||||
<Counter
|
<Counter
|
||||||
onBlue={(e) => getInputValue(e, item)}
|
onBlue={(e) => getInputValue(e, item)}
|
||||||
|
@ -3,39 +3,22 @@ import { ScrollView, Text, View } from "@tarojs/components";
|
|||||||
import { memo, useMemo } from "react";
|
import { memo, useMemo } from "react";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明
|
|
||||||
//原因选择
|
//原因选择
|
||||||
type ReasonInfoParam = {
|
type ReasonInfoParam = {
|
||||||
show?: boolean,
|
show?: boolean,
|
||||||
onClose?: () => void,
|
onClose?: () => void,
|
||||||
status: ReasonParam
|
title?: string,
|
||||||
|
list?: {id:number, name:string}[]
|
||||||
}
|
}
|
||||||
export default memo(({show = false, onClose, status}: ReasonInfoParam) => {
|
export default memo(({show = false, onClose, title = '', list= []}: ReasonInfoParam) => {
|
||||||
const title = useMemo(() => {
|
|
||||||
if(status == 1) return '退货原因'
|
|
||||||
if(status == 2) return '货物状况'
|
|
||||||
if(status == 3) return '退货说明'
|
|
||||||
},[status])
|
|
||||||
return (
|
return (
|
||||||
<Popup showIconButton={false} show={show} title="申请退货" onClose={onClose} >
|
<Popup showIconButton={false} show={show} title={title} onClose={onClose} >
|
||||||
<View className={styles.reason_return_con}>
|
<View className={styles.reason_return_con}>
|
||||||
<View className={styles.reason_title}><Text>{title}</Text></View>
|
<View className={styles.reason_title}><Text>{title}</Text></View>
|
||||||
<ScrollView scrollY className={styles.reason_scroll}>
|
<ScrollView scrollY className={styles.reason_scroll}>
|
||||||
<View className={styles.reason_list}>
|
<View className={styles.reason_list}>
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
{list.map(item => <View key={item.id} className={styles.reason_item}>{item.name}</View> )}
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
<View className={styles.reason_item}>完好无损带原标签</View>
|
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
|
@ -7,7 +7,7 @@ import OtherReason from "./components/otherReason";
|
|||||||
import { useDidShow, useRouter } from "@tarojs/taro";
|
import { useDidShow, useRouter } from "@tarojs/taro";
|
||||||
import { GetSaleOrderDetailApi } from "@/api/order";
|
import { GetSaleOrderDetailApi } from "@/api/order";
|
||||||
import KindList from "./components/kindList"
|
import KindList from "./components/kindList"
|
||||||
import { ReturnApplyOrderApi } from "@/api/salesAfterOrder";
|
import { ReturnApplyOrderApi, ReturnGoodsStatusApi } from "@/api/salesAfterOrder";
|
||||||
import { alert, goLink } from "@/common/common";
|
import { alert, goLink } from "@/common/common";
|
||||||
import UploadImage from "@/components/uploadImage"
|
import UploadImage from "@/components/uploadImage"
|
||||||
import TextareaEnhance from "@/components/textareaEnhance";
|
import TextareaEnhance from "@/components/textareaEnhance";
|
||||||
@ -76,9 +76,11 @@ export default () => {
|
|||||||
|
|
||||||
|
|
||||||
//退货选择弹窗
|
//退货选择弹窗
|
||||||
const [showReason, setShowReason] = useState<{show:true|false, status:ReasonParam}>({show:false, status:1})
|
const [showReason, setShowReason] = useState<{show:true|false, title: string}>({show:false, title: ''})
|
||||||
const closeReason = useCallback(() => setShowReason({...showReason, show:false}), [])
|
const closeReason = useCallback(() => setShowReason({...showReason, show:false}), [])
|
||||||
const onShowReason = (status) => setShowReason({...showReason, status, show:true})
|
const onShowReason = (status) => {
|
||||||
|
setShowReason({...showReason, show:true})
|
||||||
|
}
|
||||||
|
|
||||||
//面料数据
|
//面料数据
|
||||||
let roll_list = useRef({})
|
let roll_list = useRef({})
|
||||||
@ -144,6 +146,17 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[]}>({title:'', list:[]})
|
||||||
|
//售后货物状况
|
||||||
|
const {fetchData: fetchDataGoodsStatus} = ReturnGoodsStatusApi()
|
||||||
|
const getReturnGoodsStatus = async () => {
|
||||||
|
let res = await fetchDataGoodsStatus()
|
||||||
|
setReturnGoodsInfo((e) => ({...e, title: '售后货物状况', list:res.data?.list||[]}))
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getReturnGoodsStatus()
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.apply_after_sales_main}>
|
<View className={styles.apply_after_sales_main}>
|
||||||
<View className={styles.apply_after_sales_con}>
|
<View className={styles.apply_after_sales_con}>
|
||||||
@ -192,7 +205,7 @@ export default () => {
|
|||||||
<View className={styles.verify_btn } onClick={() => onSubmit(2)}>确认</View>
|
<View className={styles.verify_btn } onClick={() => onSubmit(2)}>确认</View>
|
||||||
</View >
|
</View >
|
||||||
</View >
|
</View >
|
||||||
<ReasonPopup show={showReason.show} onClose={closeReason} status={showReason.status}/>
|
<ReasonPopup show={showReason.show} onClose={closeReason} title={returnGoodsInfo.title} list={returnGoodsInfo.list}/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -72,6 +72,9 @@
|
|||||||
padding-bottom:151px;
|
padding-bottom:151px;
|
||||||
}
|
}
|
||||||
.color_con{
|
.color_con{
|
||||||
|
.virtual_list{
|
||||||
|
padding-bottom: 300px;
|
||||||
|
}
|
||||||
.item {
|
.item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
@ -50,20 +50,14 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
|||||||
//获取面料颜色列表
|
//获取面料颜色列表
|
||||||
const {fetchData:colorFetchData, state: colorState} = GetColorList()
|
const {fetchData:colorFetchData, state: colorState} = GetColorList()
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
const [loading, setLoading] = useState(false)
|
|
||||||
const condition = useRef({physical_warehouse:adminUserInfo?.physical_warehouse, sale_mode:selectIndex, product_id:0, code_or_name:null})
|
const condition = useRef({physical_warehouse:adminUserInfo?.physical_warehouse, sale_mode:selectIndex, product_id:0, code_or_name:null})
|
||||||
const getColorList = async () => {
|
const getColorList = async () => {
|
||||||
setLoading(() => true)
|
|
||||||
let {data} = await colorFetchData(getFilterData(condition.current))
|
let {data} = await colorFetchData(getFilterData(condition.current))
|
||||||
let lists = initList(data.list)
|
let lists = initList(data.list)
|
||||||
setList(() => [...lists])
|
setList(() => [...lists])
|
||||||
setLoading(() => false)
|
|
||||||
}
|
}
|
||||||
const [showPopup, setShowPopup] = useState(false)
|
const [showPopup, setShowPopup] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log('colorState::',colorState)
|
|
||||||
}, [colorState])
|
|
||||||
|
|
||||||
//显示获取
|
//显示获取
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -206,7 +200,8 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
|||||||
const Rows = memo(({id, index, style, data}:any) => {
|
const Rows = memo(({id, index, style, data}:any) => {
|
||||||
let item = data[index]
|
let item = data[index]
|
||||||
return (
|
return (
|
||||||
<View className={styles.item} key={item.id}>
|
<>
|
||||||
|
{item&&<View className={styles.item} key={item.id}>
|
||||||
<View className={styles.item_color}>
|
<View className={styles.item_color}>
|
||||||
<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>
|
</View>
|
||||||
@ -231,7 +226,9 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
|||||||
/>
|
/>
|
||||||
</View>}
|
</View>}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>||<View className={styles.item}></View>
|
||||||
|
}
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -296,10 +293,11 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
|||||||
// </InfiniteScroll>}
|
// </InfiniteScroll>}
|
||||||
<View className={styles.color_con}>
|
<View className={styles.color_con}>
|
||||||
<VirtualList
|
<VirtualList
|
||||||
|
className={styles.virtual_list}
|
||||||
height={400} /* 列表的高度 */
|
height={400} /* 列表的高度 */
|
||||||
width='100%' /* 列表的宽度 */
|
width='100%' /* 列表的宽度 */
|
||||||
itemData={list} /* 渲染列表的数据 */
|
itemData={list} /* 渲染列表的数据 */
|
||||||
itemCount={list.length} /* 渲染列表的长度 */
|
itemCount={list.length + 1} /* 渲染列表的长度 */
|
||||||
itemSize={100} /* 列表单项的高度 */
|
itemSize={100} /* 列表单项的高度 */
|
||||||
overscanCount={1}
|
overscanCount={1}
|
||||||
>
|
>
|
||||||
|
@ -2,7 +2,7 @@ import { SaleOrderPreViewApi, SaleOrderApi } from "@/api/order";
|
|||||||
import { formatPriceDiv } from "@/common/fotmat";
|
import { formatPriceDiv } from "@/common/fotmat";
|
||||||
import Popup from "@/components/popup";
|
import Popup from "@/components/popup";
|
||||||
import { View } from "@tarojs/components"
|
import { View } from "@tarojs/components"
|
||||||
import Taro, { useDidShow} from "@tarojs/taro";
|
import Taro, { useDidShow, usePullDownRefresh} from "@tarojs/taro";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import AddressInfo from "./components/addressInfo";
|
import AddressInfo from "./components/addressInfo";
|
||||||
@ -160,6 +160,11 @@ import AddressInfoDetail from "./components/addressInfoDetail";
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//页面下拉刷新
|
||||||
|
usePullDownRefresh(() => {
|
||||||
|
getSaleOrderPreView()
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_main}>
|
<View className={styles.order_main}>
|
||||||
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={selectShipmentMode} status={1}/>
|
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={selectShipmentMode} status={1}/>
|
||||||
|
@ -35,9 +35,9 @@ $top:190px;
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: radial-gradient(circle 20px at left $top, transparent 20px, #fff 20px + 3px) left 0px/60% no-repeat ,
|
// background: radial-gradient(circle 20px at left $top, transparent 20px, #fff 20px + 3px) left 0px/60% no-repeat ,
|
||||||
radial-gradient(circle 20px at right $top, transparent 20px, #fff 20px + 3px) right 0px/60% no-repeat;
|
// radial-gradient(circle 20px at right $top, transparent 20px, #fff 20px + 3px) right 0px/60% no-repeat;
|
||||||
filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, .16));
|
// filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, .16));
|
||||||
position: relative;
|
position: relative;
|
||||||
&::before{
|
&::before{
|
||||||
content: '';
|
content: '';
|
||||||
|
@ -142,6 +142,10 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
)
|
)
|
||||||
}, [payInfo])
|
}, [payInfo])
|
||||||
|
|
||||||
|
//选择改变
|
||||||
|
const changeSelect = () => {
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.payment_main}>
|
<View className={styles.payment_main}>
|
||||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
<Popup show={show} showTitle={false} onClose={onClose} >
|
||||||
@ -167,7 +171,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.payment_list_con}>
|
<View className={styles.payment_list_con}>
|
||||||
<View className={styles.payment_list_item}>
|
<View className={styles.payment_list_item} onClick={changeSelect}>
|
||||||
<View className={styles.payment_list_item_left}>
|
<View className={styles.payment_list_item_left}>
|
||||||
<View className={styles.payment_list_item_left_name}>
|
<View className={styles.payment_list_item_left_name}>
|
||||||
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
||||||
|
@ -12,6 +12,8 @@ import { dataLoadingStatus, getFilterData } from "@/common/util"
|
|||||||
import OrderStatusList from "./components/orderStatusList"
|
import OrderStatusList from "./components/orderStatusList"
|
||||||
import Payment from "../order/components/payment"
|
import Payment from "../order/components/payment"
|
||||||
import { ORDER_STATUS } from "@/common/enum"
|
import { ORDER_STATUS } from "@/common/enum"
|
||||||
|
import { AddShoppingCartApi } from "@/api/shopCart"
|
||||||
|
import ShopCart from "@/components/shopCart"
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const {checkLogin} = useLogin()
|
const {checkLogin} = useLogin()
|
||||||
@ -108,6 +110,9 @@ export default () => {
|
|||||||
payment_method: orderInfo.payment_method //支付方式
|
payment_method: orderInfo.payment_method //支付方式
|
||||||
})
|
})
|
||||||
toPay()
|
toPay()
|
||||||
|
} else if (status == 7) {
|
||||||
|
//购买
|
||||||
|
addShopCart(orderInfo)
|
||||||
}
|
}
|
||||||
}, [orderData])
|
}, [orderData])
|
||||||
|
|
||||||
@ -128,6 +133,38 @@ export default () => {
|
|||||||
closePayShow()
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_list_main}>
|
<View className={styles.order_list_main}>
|
||||||
@ -142,6 +179,7 @@ export default () => {
|
|||||||
})}
|
})}
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
</View>
|
</View>
|
||||||
|
<ShopCart show={showCart} onClose={() => setShowCart(false)}/>
|
||||||
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={payOrderInfo}/>
|
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={payOrderInfo}/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user