电子商城测试版v4
This commit is contained in:
parent
bbc485ee3f
commit
f05389ced7
@ -1,5 +1,4 @@
|
|||||||
import { useRequest } from "@/use/useHttp"
|
import { useRequest } from "@/use/useHttp"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解密用户微信信息
|
* 解密用户微信信息
|
||||||
*/
|
*/
|
||||||
|
@ -6,12 +6,13 @@
|
|||||||
// export const BASE_URL = `http://192.168.1.165: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: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 = `http://192.168.1.30:50001/lymarket` // 发
|
||||||
// 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
|
||||||
// 生成密钥
|
// 生成密钥
|
||||||
|
@ -29,13 +29,13 @@ export const AFTER_ORDER_STATUS = {
|
|||||||
|
|
||||||
//支付方式
|
//支付方式
|
||||||
export const PAYMENT_METHOD = {
|
export const PAYMENT_METHOD = {
|
||||||
PaymentMethodPreDeposit: {value:1, label:'预存款'},
|
PaymentMethodPreDeposit: {value:2, label:'预存款'},
|
||||||
PaymentMethodAccountPeriod : {value:2, label:'账期'},
|
PaymentMethodAccountPeriod : {value:3, label:'账期'},
|
||||||
PaymentMethodofflineRemittance: {value:0, label:'线下汇款'},
|
PaymentMethodofflineRemittance: {value:1, label:'线下汇款'},
|
||||||
PaymentMethodScanCodeToPay: {value:3, label:'扫码支付'},
|
PaymentMethodScanCodeToPay: {value:4, label:'扫码支付'},
|
||||||
PaymentMethodCashOnDelivery: {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
|
||||||
|
|
||||||
|
|
||||||
//订单类型
|
//订单类型
|
||||||
@ -58,10 +58,17 @@ export const SUBSCRIPTION_MESSAGE_SCENE = {
|
|||||||
ApplyGoods: {value:3, label: '申请退款'}
|
ApplyGoods: {value:3, label: '申请退款'}
|
||||||
}
|
}
|
||||||
|
|
||||||
//退款状态枚举
|
//应收单退款状态枚举
|
||||||
export const REFUND_STATUS = {
|
export const REFUND_STATUS = {
|
||||||
ShouldCollectOrderRefundTypeUnknown: {value:0, label:'未知退款'},
|
ShouldCollectOrderRefundTypeUnknown: {value:0, label:'未知退款'},
|
||||||
ShouldCollectOrderRefundTypeAdvanceReceiptRefund: {value:1, label:'预收退款'},
|
ShouldCollectOrderRefundTypeAdvanceReceiptRefund: {value:1, label:'预收退款'},
|
||||||
ShouldCollectOrderRefundTypeReturnForRefund: {value:2, label:'退货退款'},
|
ShouldCollectOrderRefundTypeReturnForRefund: {value:2, label:'退货退款'},
|
||||||
ShouldCollectOrderRefundTypeSalesRefund: {value:3, 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;
|
let pre = 0;
|
||||||
return (...params) => {
|
return (...params) => {
|
||||||
let now = new Date().getTime();
|
let now = new Date().getTime();
|
||||||
console.log('相差:',now-pre)
|
|
||||||
if (now - pre > delay) {
|
if (now - pre > delay) {
|
||||||
fn(...params);
|
fn(...params);
|
||||||
pre = now;
|
pre = now;
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||||
import { alert } from "@/common/common"
|
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 {Text, View } from "@tarojs/components"
|
||||||
import Taro from "@tarojs/taro"
|
import Taro from "@tarojs/taro"
|
||||||
import {useRef, memo, useState, useMemo } from "react"
|
import {useRef, memo, useState, useMemo } from "react"
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { ReturnApplyOrderCancelApi } from "@/api/salesAfterOrder"
|
import { ReturnApplyOrderCancelApi } from "@/api/salesAfterOrder"
|
||||||
|
import { throttle } from "@/common/util"
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
orderInfo: {
|
orderInfo: {
|
||||||
@ -31,6 +32,12 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
|||||||
ReturnStageServiceOrderPendingRefund,
|
ReturnStageServiceOrderPendingRefund,
|
||||||
} = AFTER_ORDER_STATUS
|
} = AFTER_ORDER_STATUS
|
||||||
|
|
||||||
|
const {
|
||||||
|
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||||
|
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||||
|
ReturnApplyOrderTypeSalesRefund // 销售退款
|
||||||
|
} = REFUND_STATUS_ORDER
|
||||||
|
|
||||||
//订单类型
|
//订单类型
|
||||||
// const {
|
// const {
|
||||||
// SaLeModeBulk,
|
// SaLeModeBulk,
|
||||||
@ -50,7 +57,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
|||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value],
|
big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value],
|
||||||
cut_value: [],
|
cut_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value, ],
|
||||||
model_value: [],
|
model_value: [],
|
||||||
label: '取消退货'
|
label: '取消退货'
|
||||||
},
|
},
|
||||||
@ -77,13 +84,17 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
|||||||
let key = ['big_value', 'model_value', 'cut_value']
|
let key = ['big_value', 'model_value', 'cut_value']
|
||||||
if(item.id == 1) {
|
if(item.id == 1) {
|
||||||
//取消退货
|
//取消退货
|
||||||
return (orderInfo.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
return (orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||||
} else if (item.id == 6) {
|
} else if (item.id == 6) {
|
||||||
//取消退款
|
//取消退款
|
||||||
return (orderInfo.type == 2)&&item[key[orderInfo?.sale_mode]]?.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) {
|
} else if (item.id == 4) {
|
||||||
//质检结果
|
//质检结果
|
||||||
return (orderInfo?.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有
|
return (orderInfo?.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有
|
||||||
} else {
|
} else {
|
||||||
return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||||
}
|
}
|
||||||
@ -99,19 +110,19 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
|||||||
|
|
||||||
|
|
||||||
//点击按钮操作
|
//点击按钮操作
|
||||||
const submitBtns = (val, index) => {
|
const submitBtns = throttle((val, index) => {
|
||||||
if (val == 1) {
|
if (val == 1) {
|
||||||
cancelOrder({title:'要取消退货吗?'})
|
cancelOrder({title:'要取消退货吗?', val})
|
||||||
} else if (val == 6) {
|
} else if (val == 6) {
|
||||||
cancelOrder({title:'要取消退款吗?'})
|
cancelOrder({title:'要取消退款吗?', val})
|
||||||
} else {
|
} else {
|
||||||
onClick?.(val)
|
onClick?.(val)
|
||||||
}
|
}
|
||||||
}
|
}, 600)
|
||||||
|
|
||||||
//取消退货/退款
|
//取消退货/退款
|
||||||
const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi()
|
const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi()
|
||||||
const cancelOrder = ({title = ''}) => {
|
const cancelOrder = ({title = '', val}) => {
|
||||||
Taro.showModal({
|
Taro.showModal({
|
||||||
title,
|
title,
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
@ -119,7 +130,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
|||||||
let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id})
|
let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id})
|
||||||
if(res.success) {
|
if(res.success) {
|
||||||
alert.success('取消成功')
|
alert.success('取消成功')
|
||||||
onClick?.(1)
|
onClick?.(val)
|
||||||
} else {
|
} else {
|
||||||
alert.none(res.msg)
|
alert.none(res.msg)
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import styles from './index.module.scss'
|
|||||||
import { AddShoppingCartApi } from "@/api/shopCart"
|
import { AddShoppingCartApi } from "@/api/shopCart"
|
||||||
import { ApplyRefundApi } from "@/api/salesAfterOrder"
|
import { ApplyRefundApi } from "@/api/salesAfterOrder"
|
||||||
import { UseSubscriptionMessage } from "@/use/useCommonData"
|
import { UseSubscriptionMessage } from "@/use/useCommonData"
|
||||||
|
import { throttle } from "@/common/util"
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
orderInfo: {
|
orderInfo: {
|
||||||
@ -132,7 +133,7 @@ export default memo(({orderInfo, onClick}:Param) => {
|
|||||||
const {openSubscriptionMessage} = UseSubscriptionMessage()
|
const {openSubscriptionMessage} = UseSubscriptionMessage()
|
||||||
|
|
||||||
//点击按钮操作
|
//点击按钮操作
|
||||||
const submitBtns = async (val, index) => {
|
const submitBtns = throttle(async (val, index) => {
|
||||||
if (val == 1) {
|
if (val == 1) {
|
||||||
cancelOrder()
|
cancelOrder()
|
||||||
} else if (val == 6) {
|
} else if (val == 6) {
|
||||||
@ -142,14 +143,27 @@ export default memo(({orderInfo, onClick}:Param) => {
|
|||||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
||||||
goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
|
goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
|
||||||
} else if (val == 3) {
|
} else if (val == 3) {
|
||||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
bigApplyRefurn()
|
||||||
onClick?.(val)
|
|
||||||
} else if(val == 8) {
|
} else if(val == 8) {
|
||||||
applyRefund()
|
applyRefund()
|
||||||
} else {
|
} else {
|
||||||
onClick?.(val)
|
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('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消订单
|
//取消订单
|
||||||
|
@ -1,352 +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, 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>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
@ -302,7 +302,7 @@ export default ({show = false, onClose}: param) => {
|
|||||||
<View className={styles.tag}>{item.sale_mode_name}</View>
|
<View className={styles.tag}>{item.sale_mode_name}</View>
|
||||||
</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[item.sale_mode].eunit}</text></View>
|
||||||
{/* <View className={styles.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
|
{/* <View className={styles.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
|
||||||
<View className={styles.btn_count}>
|
<View className={styles.btn_count}>
|
||||||
<Counter
|
<Counter
|
||||||
|
@ -8,9 +8,10 @@ type Param = {
|
|||||||
title?: string,
|
title?: string,
|
||||||
onChange?: (val: string) => void,
|
onChange?: (val: string) => void,
|
||||||
placeholder?: string,
|
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({
|
const [descData, setDescData] = useState({
|
||||||
number: 0,
|
number: 0,
|
||||||
value: '',
|
value: '',
|
||||||
@ -37,7 +38,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa
|
|||||||
<View className={styles.other_desc}>
|
<View className={styles.other_desc}>
|
||||||
<View className={styles.title}>{title}</View>
|
<View className={styles.title}>{title}</View>
|
||||||
<View className={styles.textarea}>
|
<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.detail.value)}></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={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>
|
<View className={styles.descDataNum}>{descData.number +'/'+ descData.count}</View>
|
||||||
|
@ -9,9 +9,10 @@ import styles from './index.module.scss'
|
|||||||
//图片列表
|
//图片列表
|
||||||
type ImageParam = {
|
type ImageParam = {
|
||||||
onChange?:(val: string[]) => void,
|
onChange?:(val: string[]) => void,
|
||||||
defaultList?: string[]
|
defaultList?: string[],
|
||||||
|
onlyRead?: false|true
|
||||||
}
|
}
|
||||||
const PictureItem:FC<ImageParam> = memo(({onChange, defaultList}) => {
|
const PictureItem:FC<ImageParam> = memo(({onChange, defaultList, onlyRead = false}) => {
|
||||||
const {getWxPhoto} = useUploadCDNImg()
|
const {getWxPhoto} = useUploadCDNImg()
|
||||||
const [imageList, setImageLise] = useState<string[]>([])
|
const [imageList, setImageLise] = useState<string[]>([])
|
||||||
|
|
||||||
@ -54,12 +55,12 @@ const PictureItem:FC<ImageParam> = memo(({onChange, defaultList}) => {
|
|||||||
{imageList.map((item, index) =>
|
{imageList.map((item, index) =>
|
||||||
<View className={styles.ImgItem}>
|
<View className={styles.ImgItem}>
|
||||||
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
|
<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>)}
|
||||||
<View className={styles.uploadImg } onClick={uploadImage}>
|
{!onlyRead && <View className={styles.uploadImg } onClick={uploadImage}>
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
|
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
|
||||||
<Text className={styles.uploadText}>上传照片</Text>
|
<Text className={styles.uploadText}>上传照片</Text>
|
||||||
</View>
|
</View>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -7,8 +7,10 @@ import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro"
|
|||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
import {addressAddApi, addressDetailApi,addressEditApi} from "@/api/addressManager"
|
import {addressAddApi, addressDetailApi,addressEditApi} from "@/api/addressManager"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||||
const {type,id} = useRouter().params;
|
const {type,id} = useRouter().params;
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
|
|
||||||
import AddressList from "@/components/AddressList"
|
import AddressList from "@/components/AddressList"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
import { Button, ScrollView, Text, View } from "@tarojs/components"
|
import { Button, ScrollView, Text, View } from "@tarojs/components"
|
||||||
import { stopPullDownRefresh, usePullDownRefresh } from "@tarojs/taro"
|
import { stopPullDownRefresh, usePullDownRefresh } from "@tarojs/taro"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
return (
|
return (
|
||||||
<View className="address-manager">
|
<View className="address-manager">
|
||||||
<AddressList refresherEnabled={true}/>
|
<AddressList refresherEnabled={true}/>
|
||||||
|
@ -11,6 +11,7 @@ import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReas
|
|||||||
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";
|
||||||
|
import useLogin from "@/use/useLogin";
|
||||||
|
|
||||||
enum returnStatus {
|
enum returnStatus {
|
||||||
return_reason = 1, //原因
|
return_reason = 1, //原因
|
||||||
@ -19,7 +20,7 @@ enum returnStatus {
|
|||||||
|
|
||||||
}
|
}
|
||||||
export default () => {
|
export default () => {
|
||||||
|
useLogin()
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
})
|
})
|
||||||
|
@ -12,8 +12,10 @@ import {GetProductListApi} from '@/api/material'
|
|||||||
import { useRouter } from "@tarojs/taro";
|
import { useRouter } from "@tarojs/taro";
|
||||||
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
||||||
import LoadingCard from "@/components/loadingCard";
|
import LoadingCard from "@/components/loadingCard";
|
||||||
|
import useLogin from "@/use/useLogin";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
useLogin()
|
||||||
const [showPopup, setShowPopup] = useState(false)
|
const [showPopup, setShowPopup] = useState(false)
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -4,7 +4,7 @@ import { getFilterData } from "@/common/util";
|
|||||||
import Product from "../components/product";
|
import Product from "../components/product";
|
||||||
import Search from "@/components/search"
|
import Search from "@/components/search"
|
||||||
import { Text, View } from "@tarojs/components"
|
import { Text, View } from "@tarojs/components"
|
||||||
import Taro from "@tarojs/taro";
|
import Taro, { useRouter } from "@tarojs/taro";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import CreatePopup from "../components/createPopup";
|
import CreatePopup from "../components/createPopup";
|
||||||
@ -16,6 +16,8 @@ import AddCollection from "@/components/addCollection";
|
|||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
//获取收藏夹面料
|
//获取收藏夹面料
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
const getFavoriteInfo = () => {
|
const getFavoriteInfo = () => {
|
||||||
@ -43,24 +45,40 @@ export default () => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//全选反选
|
//全选反选
|
||||||
const [selectStatus, setSelectStatus] = useState(false)
|
const [allSelectStatus, setAllSelectStatus] = useState(false)
|
||||||
const selectCallBack = useCallback(() => {
|
const selectCallBack = useCallback(() => {
|
||||||
setSelectStatus(() => true)
|
setAllSelectStatus(() => true)
|
||||||
|
setSelectStatus(1)
|
||||||
}, [])
|
}, [])
|
||||||
const colseCallBack = useCallback(() => {
|
const colseCallBack = useCallback(() => {
|
||||||
setSelectStatus(() => false)
|
setAllSelectStatus(() => false)
|
||||||
|
setSelectStatus(3)
|
||||||
}, [])
|
}, [])
|
||||||
// useEffect(() => {
|
|
||||||
// if(list.length)
|
const [selectStatus, setSelectStatus] = useState<1|2|3>(3)
|
||||||
// setSelectStatus(ids.length == list.length)
|
useEffect(() => {
|
||||||
// }, [ids, list])
|
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 [collectionShow, setCollectionShow] = useState(false)
|
||||||
const closeCollection = useCallback(() => {
|
const closeCollection = useCallback(() => {
|
||||||
setCollectionShow(false)
|
setCollectionShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const onAdd = () => {
|
const onAdd = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -70,7 +88,7 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
<View className={styles.operation}>
|
<View className={styles.operation}>
|
||||||
<View className={styles.operation_check}>
|
<View className={styles.operation_check}>
|
||||||
<MCheckbox status={selectStatus} onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
|
<MCheckbox status={allSelectStatus} onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
|
||||||
<Text>全选</Text>
|
<Text>全选</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.operation_check_right}>
|
<View className={styles.operation_check_right}>
|
||||||
@ -79,7 +97,7 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.class_list}>
|
<View className={styles.class_list}>
|
||||||
<Product productList={list} onSelectIds={getSelectIds} selectStatus={selectStatus}/>
|
<Product productList={list} onSelectIds={getSelectIds} selectStatus={selectStatus} openCheckBox={true}/>
|
||||||
</View>
|
</View>
|
||||||
<AddCollection show={collectionShow} onAdd={onAdd} onClose={closeCollection}/>
|
<AddCollection show={collectionShow} onAdd={onAdd} onClose={closeCollection}/>
|
||||||
</View>
|
</View>
|
||||||
|
@ -9,22 +9,24 @@ import { useCallback, useEffect, useRef, useState } from "react"
|
|||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
productList?: any[],
|
productList?: any[],
|
||||||
onSelectIds?: (val: number[]) => void
|
onSelectIds?: (val: number[]) => void,
|
||||||
selectStatus?: false|true
|
selectStatus?: 1|2|3, //1全选,2不做处理,3全清空
|
||||||
|
openCheckBox?: true|false //是否开启选择
|
||||||
}
|
}
|
||||||
export default ({productList = [], onSelectIds, selectStatus = false}:Params) => {
|
export default ({productList = [], onSelectIds, selectStatus = 2, openCheckBox = false}:Params) => {
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setList(() => [...productList])
|
setList(() => [...productList])
|
||||||
},[productList])
|
},[productList])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(list.length) {
|
if(list.length && selectStatus != 2) {
|
||||||
list.map(item => {
|
list.map(item => {
|
||||||
item.check = selectStatus
|
item.check = (selectStatus == 1)
|
||||||
})
|
})
|
||||||
|
setList(() => [...list])
|
||||||
}
|
}
|
||||||
setList(() => [...list])
|
|
||||||
}, [selectStatus])
|
}, [selectStatus])
|
||||||
|
|
||||||
const onChangeSelect = (item) => {
|
const onChangeSelect = (item) => {
|
||||||
@ -57,13 +59,13 @@ export default ({productList = [], onSelectIds, selectStatus = false}:Params) =>
|
|||||||
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={() => onChangeSelect(item)}>
|
return <View className={styles.products_item} onClick={() => openCheckBox?onChangeSelect(item):goLink(`/pages/details/index?id=${item.product_id}`)}>
|
||||||
<View className={styles.checkbox} onClick={(e) => e.stopPropagation()}>
|
{openCheckBox&&<View className={styles.checkbox} onClick={(e) => e.stopPropagation()}>
|
||||||
<MCheckbox status={item.check} onSelect={() => onSelect(item)} onClose={() => onClose(item)}/>
|
<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.enable_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>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite";
|
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite";
|
||||||
import { alert } from "@/common/common";
|
import { alert, goLink } from "@/common/common";
|
||||||
import { getFilterData } from "@/common/util";
|
import { getFilterData } from "@/common/util";
|
||||||
import Product from "./components/product";
|
import Product from "./components/product";
|
||||||
import Search from "@/components/search"
|
import Search from "@/components/search"
|
||||||
@ -10,8 +10,9 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|||||||
import CreatePopup from "./components/createPopup";
|
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 useLogin from "@/use/useLogin";
|
||||||
export default () => {
|
export default () => {
|
||||||
|
useLogin()
|
||||||
const changeOpenCon = (item) => {
|
const changeOpenCon = (item) => {
|
||||||
item.openStatus = !item.openStatus
|
item.openStatus = !item.openStatus
|
||||||
setList((e) => [...e])
|
setList((e) => [...e])
|
||||||
@ -117,6 +118,10 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onBatchManagement = useCallback(() => {
|
||||||
|
// goLink('pages/collection/collectionClass/index', {id: })
|
||||||
|
}, [])
|
||||||
|
|
||||||
//操作文件夹
|
//操作文件夹
|
||||||
const onCreatSuccess = (submitData) => {
|
const onCreatSuccess = (submitData) => {
|
||||||
if (!initData.id) {
|
if (!initData.id) {
|
||||||
@ -147,7 +152,7 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>)}
|
</View>)}
|
||||||
</View>
|
</View>
|
||||||
<UpdatePopup show={updateShow} onClose={closeUpdate} onDelete={onDeleteCollect} onUpdate={onUpdateShow}/>
|
<UpdatePopup show={updateShow} onClose={closeUpdate} onDelete={onDeleteCollect} onUpdate={onUpdateShow} onBatchManagement={onBatchManagement}/>
|
||||||
<CreatePopup defaultValue={initData} show={collectioinShow} onClose={closeCollection} onSuccess={onCreatSuccess}/>
|
<CreatePopup defaultValue={initData} show={collectioinShow} onClose={closeCollection} onSuccess={onCreatSuccess}/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
@ -7,8 +7,10 @@ import { useEffect, useState } from "react"
|
|||||||
import { alert, retrieval } from "@/common/common";
|
import { alert, retrieval } from "@/common/common";
|
||||||
import { companyDetailApi, companyUpdateApi } from "@/api/company"
|
import { companyDetailApi, companyUpdateApi } from "@/api/company"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||||
const handleSelectSite = ()=>{
|
const handleSelectSite = ()=>{
|
||||||
setShowSiteModal(true);
|
setShowSiteModal(true);
|
||||||
|
@ -8,9 +8,10 @@ import "./index.scss"
|
|||||||
import { useSelector } from "@/reducers/hooks";
|
import { useSelector } from "@/reducers/hooks";
|
||||||
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
||||||
import Message from "@/components/Message"
|
import Message from "@/components/Message"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
const userInfo = useSelector(state => state.userInfo);
|
const userInfo = useSelector(state => state.userInfo);
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
getData()
|
getData()
|
||||||
|
@ -6,8 +6,10 @@ import {creditListApi} from "@/api/creditLine"
|
|||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
import { formatDateTime, formatPriceDiv, toDecimal2 } from "@/common/fotmat"
|
import { formatDateTime, formatPriceDiv, toDecimal2 } from "@/common/fotmat"
|
||||||
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
const {fetchData, state} = creditListApi();
|
const {fetchData, state} = creditListApi();
|
||||||
// 渲染(数据)
|
// 渲染(数据)
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
|
@ -7,8 +7,10 @@ import { useEffect } from "react";
|
|||||||
import { formatPriceDiv, toDecimal2 } from "@/common/fotmat";
|
import { formatPriceDiv, toDecimal2 } from "@/common/fotmat";
|
||||||
import { setClipboardData } from "@tarojs/taro";
|
import { setClipboardData } from "@tarojs/taro";
|
||||||
import Message from "@/components/Message";
|
import Message from "@/components/Message";
|
||||||
|
import useLogin from "@/use/useLogin";
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
const {fetchData, state} = depositInfoApi();
|
const {fetchData, state} = depositInfoApi();
|
||||||
const getData = async ()=>{
|
const getData = async ()=>{
|
||||||
fetchData();
|
fetchData();
|
||||||
|
@ -6,9 +6,10 @@ import Taro, { useReady } from "@tarojs/taro"
|
|||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import {creditListApi} from "@/api/creditLine"
|
import {creditListApi} from "@/api/creditLine"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
return (
|
return (
|
||||||
<View className="deposit-detail">
|
<View className="deposit-detail">
|
||||||
<View className="deposit-detail-tips">
|
<View className="deposit-detail-tips">
|
||||||
|
@ -7,8 +7,10 @@ import { useCallback, useEffect, useState } from "react"
|
|||||||
import { depositListApi } from "@/api/deposit"
|
import { depositListApi } from "@/api/deposit"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
const {fetchData, state} = depositListApi();
|
const {fetchData, state} = depositListApi();
|
||||||
// 渲染(数据)
|
// 渲染(数据)
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 200px;
|
height: 60vh;
|
||||||
|
margin-top: 100px;
|
||||||
|
padding: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
image{
|
image{
|
||||||
width:100%;
|
width:100%;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
|
import LabAndImg from "@/components/LabAndImg"
|
||||||
import { Image, View } from "@tarojs/components"
|
import { Image, View } from "@tarojs/components"
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export type colorItem = {
|
export type colorItem = {
|
||||||
title: string,
|
title: string,
|
||||||
img: string
|
lab: {l:number, a:number, b:number},
|
||||||
|
rgb: {r:number, g:number, b:number},
|
||||||
|
texture_url: string
|
||||||
}
|
}
|
||||||
export type colorParams = {
|
export type colorParams = {
|
||||||
value?: colorItem,
|
value?: colorItem,
|
||||||
@ -15,7 +18,7 @@ export default ({value, show = false, onClose}: colorParams) => {
|
|||||||
<>
|
<>
|
||||||
{show&&<View className={styles.main} catch-move="true" onClick={() => onClose?.()}>
|
{show&&<View className={styles.main} catch-move="true" onClick={() => onClose?.()}>
|
||||||
<View className={styles.con}>
|
<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 className={styles.name}>{value?.title}</View>
|
||||||
</View>
|
</View>
|
||||||
</View>}
|
</View>}
|
||||||
|
@ -125,16 +125,33 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
.buy_cart{
|
.buy_cart{
|
||||||
width: 150px;
|
width: 150px;
|
||||||
color: $color_font_three;
|
color: $color_font_three;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
.text{
|
.text{
|
||||||
font-size: $font_size_min;
|
font-size: $font_size_min;
|
||||||
}
|
}
|
||||||
.miconfont{
|
.miconfont{
|
||||||
font-size: 36px;
|
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{
|
.buy_btn{
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -18,6 +18,7 @@ import LabAndImg from '@/components/LabAndImg';
|
|||||||
import { alert } from '@/common/common';
|
import { alert } from '@/common/common';
|
||||||
import AddCollection from '@/components/addCollection';
|
import AddCollection from '@/components/addCollection';
|
||||||
import { AddFavoriteApi } from '@/api/favorite';
|
import { AddFavoriteApi } from '@/api/favorite';
|
||||||
|
import { GetShoppingCartApi } from '@/api/shopCart';
|
||||||
|
|
||||||
type item = {title:string, img:string, url:string, id:number}
|
type item = {title:string, img:string, url:string, id:number}
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ type Params = {
|
|||||||
style?: Object
|
style?: Object
|
||||||
}
|
}
|
||||||
export default (props:Params) => {
|
export default (props:Params) => {
|
||||||
const {checkLogin, getPhoneNumber, userInfo} = useLogin()
|
const {getPhoneNumber, userInfo} = useLogin()
|
||||||
|
|
||||||
//获取参数(有两种参数:1.商品id, 2.页面分享)
|
//获取参数(有两种参数:1.商品id, 2.页面分享)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -50,9 +51,9 @@ export default (props:Params) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
checkLogin()
|
|
||||||
judgeParam()
|
judgeParam()
|
||||||
setShowCart(false)
|
setShowCart(false)
|
||||||
|
getShoppingCart()
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -96,7 +97,9 @@ export default (props:Params) => {
|
|||||||
const getColorItem = (item) => {
|
const getColorItem = (item) => {
|
||||||
setColorInfo({
|
setColorInfo({
|
||||||
title: item.code,
|
title: item.code,
|
||||||
img: item.texture_url,
|
texture_url: item.texture_url,
|
||||||
|
lab: item.lab,
|
||||||
|
rgb: item.rgb
|
||||||
})
|
})
|
||||||
setShowPreview(true)
|
setShowPreview(true)
|
||||||
}
|
}
|
||||||
@ -149,7 +152,14 @@ export default (props:Params) => {
|
|||||||
setCollectionShow(false)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//页面下拉刷新
|
//页面下拉刷新
|
||||||
@ -163,7 +173,7 @@ export default (props:Params) => {
|
|||||||
<DesSwiper list={productInfo.texture_url||[]}/>
|
<DesSwiper list={productInfo.texture_url||[]}/>
|
||||||
<View className={styles.product_header}>
|
<View className={styles.product_header}>
|
||||||
<View className={styles.title}>
|
<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 className={styles.des}>{productInfo.describe}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.share}>
|
<View className={styles.share}>
|
||||||
@ -205,6 +215,7 @@ export default (props:Params) => {
|
|||||||
<View className={styles.buy_cart} onClick={() => setShowCart(true)}>
|
<View className={styles.buy_cart} onClick={() => setShowCart(true)}>
|
||||||
<View className={classnames('iconfont icon-gouwuche', styles.miconfont)}></View>
|
<View className={classnames('iconfont icon-gouwuche', styles.miconfont)}></View>
|
||||||
<View className={styles.text}>购物车</View>
|
<View className={styles.text}>购物车</View>
|
||||||
|
{(shopCount > 0)&&<View className={styles.product_num}>{shopCount > 99?'99+':shopCount}</View>}
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
(!userInfo.adminUserInfo?.is_authorize_phone)&&<View className={styles.buy_btn} >
|
(!userInfo.adminUserInfo?.is_authorize_phone)&&<View className={styles.buy_btn} >
|
||||||
|
@ -8,9 +8,10 @@ import { alert, goLink } from "@/common/common";
|
|||||||
import { getParam } from "@/common/system";
|
import { getParam } from "@/common/system";
|
||||||
import {EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi} from "@/api/order";
|
import {EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi} from "@/api/order";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
|
import useLogin from "@/use/useLogin";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
useLogin()
|
||||||
//获取临时传递的数据
|
//获取临时传递的数据
|
||||||
const params = getParam()
|
const params = getParam()
|
||||||
const [paramsData, setParamsData] = useState<any>(params)
|
const [paramsData, setParamsData] = useState<any>(params)
|
||||||
|
@ -15,11 +15,7 @@ import { dataLoadingStatus } from '@/common/util'
|
|||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
|
||||||
const { checkLogin } = useLogin()
|
useLogin()
|
||||||
useDidShow(async () => {
|
|
||||||
await checkLogin()
|
|
||||||
})
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
categoryList()
|
categoryList()
|
||||||
}, [])
|
}, [])
|
||||||
@ -87,21 +83,12 @@ export default () => {
|
|||||||
setRefresherTriggeredStatus(true)
|
setRefresherTriggeredStatus(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//页面下拉刷新
|
|
||||||
// const res = useManualPullDownRefresh()
|
|
||||||
// usePullDownRefresh(() => {
|
|
||||||
// console.log('123')
|
|
||||||
// })
|
|
||||||
|
|
||||||
//数据加载状态
|
//数据加载状态
|
||||||
const statusMore = useMemo(() => {
|
const statusMore = useMemo(() => {
|
||||||
return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading })
|
return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading })
|
||||||
}, [productData, productState.loading])
|
}, [productData, productState.loading])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MoveBtn onClick={() => setShowShopCart(!showShopCart)}>
|
<MoveBtn onClick={() => setShowShopCart(!showShopCart)}>
|
||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
|
@ -37,6 +37,20 @@ type Param = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//订单状态
|
||||||
|
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) => {
|
export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false, onLogistics}: Param, ref) => {
|
||||||
|
|
||||||
const [addressInfo, setAddressInfo] = useState<any>()
|
const [addressInfo, setAddressInfo] = useState<any>()
|
||||||
@ -53,7 +67,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
|||||||
//打开地址列表
|
//打开地址列表
|
||||||
const [showAddressList, setShowAddressList] = useState(false)
|
const [showAddressList, setShowAddressList] = useState(false)
|
||||||
const changeShow = () => {
|
const changeShow = () => {
|
||||||
if(receivingStatus == 2 && !logisticsShow)
|
if(receivingStatus == 2 && !logisticsShow && limitEdit())
|
||||||
setShowAddressList(() => true)
|
setShowAddressList(() => true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +81,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
|||||||
const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi()
|
const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi()
|
||||||
const onReceivingStatus = (value, e) => {
|
const onReceivingStatus = (value, e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
changeReceivingStatus(value)
|
if(limitEdit()) changeReceivingStatus(value)
|
||||||
|
|
||||||
}
|
}
|
||||||
const changeReceivingStatus = debounce(async (value) => {
|
const changeReceivingStatus = debounce(async (value) => {
|
||||||
if(!orderInfo) return false
|
if(!orderInfo) return false
|
||||||
@ -112,14 +127,18 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//订单状态
|
//根据订单状态判断是否可用修改
|
||||||
const {
|
const limitEdit = () => {
|
||||||
SaleOrderStatusWaitingReceipt,
|
let res = [
|
||||||
SaleOrderStatusAlreadyReceipt,
|
SaleorderstatusWaitingPrePayment.value,
|
||||||
SaleOrderStatusComplete,
|
SaleOrderStatusBooking.value,
|
||||||
SaleOrderStatusRefund,
|
SaleOrderStatusArranging.value,
|
||||||
SaleOrderStatusCancel,
|
SaleOrderStatusArranged.value,
|
||||||
} = ORDER_STATUS
|
SaleOrderStatusWaitingPayment.value,
|
||||||
|
].includes(orderInfo?.status as number)
|
||||||
|
if(!res && status != 1) alert.none('该订单状态不能修改地址!')
|
||||||
|
return status == 1? true : res
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//根据订单状态判断是否显示物流
|
//根据订单状态判断是否显示物流
|
||||||
|
@ -13,6 +13,7 @@ import OrderBtns from "@/components/orderBtns";
|
|||||||
import Popup from "@/components/popup";
|
import Popup from "@/components/popup";
|
||||||
import SearchInput from "@/components/searchInput";
|
import SearchInput from "@/components/searchInput";
|
||||||
import ShopCart from "@/components/shopCart";
|
import ShopCart from "@/components/shopCart";
|
||||||
|
import useLogin from "@/use/useLogin";
|
||||||
import { Text, Textarea, View } from "@tarojs/components"
|
import { Text, Textarea, View } from "@tarojs/components"
|
||||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
@ -28,6 +29,7 @@ import Remark from "./components/remark";
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
useLogin()
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
const [showDesc, setShowDesc] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const orderId = useRef<number>(Number(router.params.id))
|
const orderId = useRef<number>(Number(router.params.id))
|
||||||
@ -37,6 +39,8 @@ import styles from './index.module.scss'
|
|||||||
|
|
||||||
//订单状态枚举
|
//订单状态枚举
|
||||||
const {
|
const {
|
||||||
|
SaleOrderStatusTaking,
|
||||||
|
SaleOrderStatusWaitingDelivery,
|
||||||
SaleOrderStatusWaitingReceipt, // 待收货
|
SaleOrderStatusWaitingReceipt, // 待收货
|
||||||
SaleOrderStatusAlreadyReceipt, // 已收货
|
SaleOrderStatusAlreadyReceipt, // 已收货
|
||||||
SaleOrderStatusComplete, // 已完成
|
SaleOrderStatusComplete, // 已完成
|
||||||
@ -46,6 +50,7 @@ import styles from './index.module.scss'
|
|||||||
} = ORDER_STATUS
|
} = ORDER_STATUS
|
||||||
|
|
||||||
//获取订单详情
|
//获取订单详情
|
||||||
|
const firstOpen = useRef(true)
|
||||||
const [orderDetail, setOrderDetail] = useState<any>() //获取到的原始数据
|
const [orderDetail, setOrderDetail] = useState<any>() //获取到的原始数据
|
||||||
const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
|
const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
|
||||||
const getSaleOrderPreView = async () => {
|
const getSaleOrderPreView = async () => {
|
||||||
@ -53,7 +58,10 @@ 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()
|
if(firstOpen.current) {
|
||||||
|
firstOpen.current = false
|
||||||
|
toPay()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Taro.stopPullDownRefresh()
|
Taro.stopPullDownRefresh()
|
||||||
Taro.hideToast()
|
Taro.hideToast()
|
||||||
@ -115,7 +123,9 @@ import styles from './index.module.scss'
|
|||||||
shipment_mode: orderDetail?.shipment_mode,
|
shipment_mode: orderDetail?.shipment_mode,
|
||||||
id: orderDetail?.id,
|
id: orderDetail?.id,
|
||||||
sale_mode: orderDetail?.sale_mode,
|
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])
|
}, [orderDetail])
|
||||||
@ -135,6 +145,8 @@ import styles from './index.module.scss'
|
|||||||
setShowDesc(() => false)
|
setShowDesc(() => false)
|
||||||
}, [])
|
}, [])
|
||||||
const noCanOpenDescList = useRef([
|
const noCanOpenDescList = useRef([
|
||||||
|
SaleOrderStatusTaking.value, //提货中
|
||||||
|
SaleOrderStatusWaitingDelivery.value, //待发货
|
||||||
SaleOrderStatusWaitingReceipt.value, // 待收货
|
SaleOrderStatusWaitingReceipt.value, // 待收货
|
||||||
SaleOrderStatusAlreadyReceipt.value, // 已收货
|
SaleOrderStatusAlreadyReceipt.value, // 已收货
|
||||||
SaleOrderStatusComplete.value, // 已完成
|
SaleOrderStatusComplete.value, // 已完成
|
||||||
@ -142,7 +154,7 @@ import styles from './index.module.scss'
|
|||||||
SaleOrderStatusCancel.value, // 已取消
|
SaleOrderStatusCancel.value, // 已取消
|
||||||
])
|
])
|
||||||
const descOpen = () => {
|
const descOpen = () => {
|
||||||
if(noCanOpenDescList.current.includes(orderDetail?.status)) return false
|
if(noCanOpenDescList.current.includes(orderDetail?.status)) return alert.none('该订单状态不能修改备注')
|
||||||
setShowDesc(() => true)
|
setShowDesc(() => true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +179,6 @@ import styles from './index.module.scss'
|
|||||||
|
|
||||||
//获取底部按钮点击, 获取按钮状态
|
//获取底部按钮点击, 获取按钮状态
|
||||||
const orderStateClick = useCallback((val) => {
|
const orderStateClick = useCallback((val) => {
|
||||||
console.log('123456789',val)
|
|
||||||
if(val == 1 || val == 6) {
|
if(val == 1 || val == 6) {
|
||||||
//取消订单
|
//取消订单
|
||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
|
@ -7,7 +7,7 @@ import styles from './index.module.scss'
|
|||||||
type Param = {
|
type Param = {
|
||||||
return_address?:string,
|
return_address?:string,
|
||||||
return_phone?: string,
|
return_phone?: string,
|
||||||
onLogistics?: (val: number) => void,
|
onLogistics?: (val: 1|2) => void, //1 上传物流 2 查看物流
|
||||||
stage?: number,
|
stage?: number,
|
||||||
}
|
}
|
||||||
export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => {
|
export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => {
|
||||||
|
@ -118,7 +118,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
cut_value: [ReturnStageReturned.value],
|
cut_value: [ReturnStageReturned.value],
|
||||||
model_value: [ReturnStageReturned.value],
|
model_value: [ReturnStageReturned.value],
|
||||||
label:'退款去向',
|
label:'退款去向',
|
||||||
field: 'actual_amount'
|
field: 'refund_flow_name'
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -14,8 +14,9 @@ type Param = {
|
|||||||
id?: number, //订单id
|
id?: number, //订单id
|
||||||
images: string[], //图片列表
|
images: string[], //图片列表
|
||||||
descValue?: string, //描述
|
descValue?: string, //描述
|
||||||
|
onlyRead?: false|true //true 只读
|
||||||
}
|
}
|
||||||
export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = ''}: Param) => {
|
export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = '', onlyRead = false}: Param) => {
|
||||||
//需要提交的数据
|
//需要提交的数据
|
||||||
const submitData = useRef({
|
const submitData = useRef({
|
||||||
accessory_url: [],
|
accessory_url: [],
|
||||||
@ -52,20 +53,20 @@ export default memo(({show = false, onClose, onSubmit, id = 0, images = [], desc
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Popup show={show} title="上传物流" onClose={onClose}>
|
<Popup show={show} title={onlyRead?'查看物流':"上传物流"} onClose={onClose}>
|
||||||
<View className={styles.logistics_main}>
|
<View className={styles.logistics_main}>
|
||||||
<View className={styles.logistics_image}>
|
<View className={styles.logistics_image}>
|
||||||
<Text className={styles.title_desc}>上传附件:</Text>
|
<Text className={styles.title_desc}>上传附件:</Text>
|
||||||
<View className={styles.upload_image}>
|
<View className={styles.upload_image}>
|
||||||
<UploadImage onChange={getImageList} defaultList={images}/>
|
<UploadImage onChange={getImageList} defaultList={images} onlyRead={onlyRead}/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.logistics_desc}>
|
<View className={styles.logistics_desc}>
|
||||||
<TextareaEnhance defaultValue={descValue} onChange={getOtherReason} title="备注:" placeholder="请输入备注信息"/>
|
<TextareaEnhance defaultValue={descValue} onChange={getOtherReason} title="备注:" onlyRead={onlyRead} placeholder="请输入备注信息"/>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.btns_two}>
|
{!onlyRead&&<View className={styles.btns_two}>
|
||||||
<View className={styles.verify_btn } onClick={() => onSubmitEven()}>保存</View>
|
<View className={styles.verify_btn } onClick={() => onSubmitEven()}>保存</View>
|
||||||
</View >
|
</View >}
|
||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
</>
|
</>
|
||||||
|
@ -4,6 +4,7 @@ import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum";
|
|||||||
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||||
import AfterOrderBtns from "@/components/afterOrderBtns";
|
import AfterOrderBtns from "@/components/afterOrderBtns";
|
||||||
import SearchInput from "@/components/searchInput";
|
import SearchInput from "@/components/searchInput";
|
||||||
|
import useLogin from "@/use/useLogin";
|
||||||
import { Image, Text, Textarea, View } from "@tarojs/components"
|
import { Image, Text, Textarea, View } from "@tarojs/components"
|
||||||
import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
@ -17,7 +18,7 @@ import ReturnLogistics from "./components/returnLogistics";
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
useLogin()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const orderId = useRef<number>(Number(router.params.id))
|
const orderId = useRef<number>(Number(router.params.id))
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
@ -63,7 +64,8 @@ import styles from './index.module.scss'
|
|||||||
other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额
|
other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额
|
||||||
total_refund_amount: orderDetail.total_refund_amount, //合计金额
|
total_refund_amount: orderDetail.total_refund_amount, //合计金额
|
||||||
refund_amount: orderDetail.refund_amount, //退款金额
|
refund_amount: orderDetail.refund_amount, //退款金额
|
||||||
refund_type: orderDetail.refund_type //退款状态
|
refund_type: orderDetail.refund_type, //退款状态
|
||||||
|
refund_flow_name: orderDetail.refund_flow_name //退款去向
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -74,7 +76,9 @@ import styles from './index.module.scss'
|
|||||||
|
|
||||||
//获取底部按钮点击, 获取按钮状态
|
//获取底部按钮点击, 获取按钮状态
|
||||||
const orderStateClick = useCallback((val) => {
|
const orderStateClick = useCallback((val) => {
|
||||||
if(val == 8) {
|
if(val == 1 || val == 6) {
|
||||||
|
getSaleOrderPreView()
|
||||||
|
} else if(val == 8) {
|
||||||
//申请记录
|
//申请记录
|
||||||
setApplyRecord(true)
|
setApplyRecord(true)
|
||||||
}
|
}
|
||||||
@ -105,19 +109,22 @@ import styles from './index.module.scss'
|
|||||||
|
|
||||||
//物流显示
|
//物流显示
|
||||||
const [logisticsShow, setLogisticsShow] = useState(false)
|
const [logisticsShow, setLogisticsShow] = useState(false)
|
||||||
|
const [logistics, setLogistics] = useState(false)
|
||||||
const onShowLogistics = useCallback((val) => {
|
const onShowLogistics = useCallback((val) => {
|
||||||
if(val == 1) {
|
setLogisticsShow(true)
|
||||||
setLogisticsShow(true)
|
if(val != 1) setLogistics(true)
|
||||||
} else {
|
// if(val == 1) {
|
||||||
const list = orderDetail?.accessory_url.map(item => {
|
// setLogisticsShow(true)
|
||||||
return formatImgUrl(item)
|
// } else {
|
||||||
})
|
// const list = orderDetail?.accessory_url.map(item => {
|
||||||
Taro.previewImage({
|
// return formatImgUrl(item)
|
||||||
current: list[0], // 当前显示
|
// })
|
||||||
urls: list // 需要预览的图片http链接列表
|
// Taro.previewImage({
|
||||||
})
|
// current: list[0], // 当前显示
|
||||||
}
|
// urls: list // 需要预览的图片http链接列表
|
||||||
}, [orderDetail])
|
// })
|
||||||
|
// }
|
||||||
|
}, [])
|
||||||
const onCloseLogistics = useCallback(() => {
|
const onCloseLogistics = useCallback(() => {
|
||||||
setLogisticsShow(false)
|
setLogisticsShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
@ -139,7 +146,7 @@ import styles from './index.module.scss'
|
|||||||
<OrderDes orderInfo={orderDetail}/>
|
<OrderDes orderInfo={orderDetail}/>
|
||||||
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
||||||
<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 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)}/>
|
<ApplyRecord show={applyRecord} id={orderDetail?.id} onClose={() => setApplyRecord(false)}/>
|
||||||
<View className="common_safe_area_y"></View>
|
<View className="common_safe_area_y"></View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { goLink } from "@/common/common";
|
import { goLink } from "@/common/common";
|
||||||
|
import { REFUND_STATUS_ORDER } from "@/common/enum";
|
||||||
import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||||
import AfterOrderBtns from "@/components/afterOrderBtns";
|
import AfterOrderBtns from "@/components/afterOrderBtns";
|
||||||
import LabAndImg from "@/components/LabAndImg";
|
import LabAndImg from "@/components/LabAndImg";
|
||||||
@ -26,7 +27,7 @@ type Param = {
|
|||||||
lab: {l:number, a:number, b:number},
|
lab: {l:number, a:number, b:number},
|
||||||
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 //2 退货 1 预收退款 3 销售
|
||||||
return_apply_order_id: number //退款申请单
|
return_apply_order_id: number //退款申请单
|
||||||
},
|
},
|
||||||
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
||||||
@ -63,6 +64,10 @@ export default memo(({value, onClickBtn}: Param) => {
|
|||||||
return {lab:{...value?.lab}, rgb:{...value?.rgb}, texturl_url: value?.texturl_url}
|
return {lab:{...value?.lab}, rgb:{...value?.rgb}, texturl_url: value?.texturl_url}
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
|
const {
|
||||||
|
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||||
|
} = REFUND_STATUS_ORDER
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_item}>
|
<View className={styles.order_item}>
|
||||||
<View className={styles.header} onClick={() => goLink('/pages/salesAfter/index', {id: value?.id})}>
|
<View className={styles.header} onClick={() => goLink('/pages/salesAfter/index', {id: value?.id})}>
|
||||||
@ -71,8 +76,8 @@ export default memo(({value, onClickBtn}: Param) => {
|
|||||||
<Text className={styles.name}>{userInfo?.adminUserInfo?.user_name}</Text>
|
<Text className={styles.name}>{userInfo?.adminUserInfo?.user_name}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.order_num}>
|
<View className={styles.order_num}>
|
||||||
<Text>售后单号:{value?.return_order_no}</Text>
|
<Text>售后单号:{value?.return_order_no}</Text>
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
||||||
</View>
|
</View>
|
||||||
<OrderStatusTag status={value?.type}/>
|
<OrderStatusTag status={value?.type}/>
|
||||||
</View>
|
</View>
|
||||||
@ -107,7 +112,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
<View className={styles.color_count_num}>{`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`}</View>
|
<View className={styles.color_count_num}>{`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`}</View>
|
||||||
<View className={styles.order_number}>
|
<View className={styles.order_number}>
|
||||||
<Text>{value?.type == 1?'已申请退货':'已申请退款'}</Text>
|
<Text>{value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'}</Text>
|
||||||
<Text>订单号:{value?.order_no}</Text>
|
<Text>订单号:{value?.order_no}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -2,17 +2,23 @@ import { Text, View } from "@tarojs/components"
|
|||||||
import { memo } from "react"
|
import { memo } from "react"
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
import { REFUND_STATUS_ORDER } from "@/common/enum";
|
||||||
|
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
status?: number //0默认不处理, 1退货,2退款
|
status?: number
|
||||||
}
|
}
|
||||||
export default memo(({status = 0}:Param) => {
|
export default memo(({status = 0}:Param) => {
|
||||||
|
const {
|
||||||
|
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||||
|
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||||
|
ReturnApplyOrderTypeSalesRefund // 销售退款
|
||||||
|
} = REFUND_STATUS_ORDER
|
||||||
return (
|
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>
|
<View className={classnames(styles.miconfont, 'iconfont icon-yucunkuan')}></View>
|
||||||
<Text>{ status == 1?'退货':'退款'}</Text>
|
<Text>{ status == ReturnApplyOrderTypeReturnForRefund.value?'退货':'退款'}</Text>
|
||||||
</View>}
|
</View>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -14,9 +14,9 @@ import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder
|
|||||||
import ReturnLogistics from "./components/returnLogistics"
|
import ReturnLogistics from "./components/returnLogistics"
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const {checkLogin} = useLogin()
|
useLogin()
|
||||||
useDidShow(async () => {
|
useDidShow(() => {
|
||||||
await checkLogin()
|
getOrderList()
|
||||||
})
|
})
|
||||||
|
|
||||||
//搜索参数
|
//搜索参数
|
||||||
@ -94,9 +94,8 @@ export default () => {
|
|||||||
|
|
||||||
//监听点击的按钮
|
//监听点击的按钮
|
||||||
const clickOrderBtn = useCallback(({status, orderInfo}) => {
|
const clickOrderBtn = useCallback(({status, orderInfo}) => {
|
||||||
if(status == 2) {
|
if(status == 1 || status == 6) {
|
||||||
//退货物流
|
getOrderList()
|
||||||
|
|
||||||
}
|
}
|
||||||
}, [orderData])
|
}, [orderData])
|
||||||
|
|
||||||
|
@ -5,8 +5,10 @@ import { goLink } from '@/common/common';
|
|||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
import useLogin from '@/use/useLogin';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
useLogin()
|
||||||
return (
|
return (
|
||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
<View className={styles.search}>
|
<View className={styles.search}>
|
||||||
|
@ -20,10 +20,7 @@ import SelectData, {ListProps} from "./components/selectData";
|
|||||||
import LabAndImg from "@/components/LabAndImg";
|
import LabAndImg from "@/components/LabAndImg";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const {checkLogin} = useLogin()
|
useLogin()
|
||||||
useDidShow(async () => {
|
|
||||||
await checkLogin()
|
|
||||||
})
|
|
||||||
|
|
||||||
const [showFilter, setShowFilter] = useState(false)
|
const [showFilter, setShowFilter] = useState(false)
|
||||||
|
|
||||||
|
@ -12,10 +12,7 @@ import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro';
|
|||||||
|
|
||||||
type searchDataParam = {'search_key':''}
|
type searchDataParam = {'search_key':''}
|
||||||
export default () => {
|
export default () => {
|
||||||
const {checkLogin} = useLogin()
|
useLogin()
|
||||||
useDidShow(async () => {
|
|
||||||
await checkLogin()
|
|
||||||
})
|
|
||||||
|
|
||||||
const [searchData, setSearchData] = useState<{hotField: searchDataParam[], historyField: searchDataParam[]}>({
|
const [searchData, setSearchData] = useState<{hotField: searchDataParam[], historyField: searchDataParam[]}>({
|
||||||
hotField: [],
|
hotField: [],
|
||||||
|
@ -16,10 +16,7 @@ import useLogin from "@/use/useLogin";
|
|||||||
import LabAndImg from "@/components/LabAndImg";
|
import LabAndImg from "@/components/LabAndImg";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const {checkLogin} = useLogin()
|
useLogin()
|
||||||
useDidShow(async () => {
|
|
||||||
await checkLogin()
|
|
||||||
})
|
|
||||||
|
|
||||||
const [showFilter, setShowFilter] = useState(false)
|
const [showFilter, setShowFilter] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -10,7 +10,17 @@ import Taro from "@tarojs/taro";
|
|||||||
import { userassets, userorderStatistics } from "@/api/mine"
|
import { userassets, userorderStatistics } from "@/api/mine"
|
||||||
import { formatPriceDiv } from "@/common/fotmat"
|
import { formatPriceDiv } from "@/common/fotmat"
|
||||||
import { useDidShow, } from '@tarojs/taro'
|
import { useDidShow, } from '@tarojs/taro'
|
||||||
|
import { GetAdminUserInfoApi } from "@/api/user";
|
||||||
export default () => {
|
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 { getSelfUserInfo } = useLogin();
|
||||||
const { adminUserInfo } = useSelector(state => state.userInfo);
|
const { adminUserInfo } = useSelector(state => state.userInfo);
|
||||||
@ -31,6 +41,7 @@ export default () => {
|
|||||||
}, [])
|
}, [])
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
ApigetTotal()
|
ApigetTotal()
|
||||||
|
getUserData()
|
||||||
})
|
})
|
||||||
const checkGo = () => {
|
const checkGo = () => {
|
||||||
if (adminUserInfo?.authentication_status === 0 || adminUserInfo?.authentication_status === 1 || adminUserInfo?.authentication_status === 2 || adminUserInfo?.authentication_status === 3) {
|
if (adminUserInfo?.authentication_status === 0 || adminUserInfo?.authentication_status === 1 || adminUserInfo?.authentication_status === 2 || adminUserInfo?.authentication_status === 3) {
|
||||||
@ -55,13 +66,13 @@ export default () => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
<Header data={adminUserInfo} MenuData={stateData} />
|
<Header data={userDataAgain} MenuData={stateData} />
|
||||||
<Assets data={state} checkShow={() => checkGo()} />
|
<Assets data={state} checkShow={() => checkGo()} userInfo={userDataAgain}/>
|
||||||
<Main />
|
<Main />
|
||||||
{/* {(adminUserInfo as any)?.authentication_status==1&&<Modal data={adminUserInfo}/>} */}
|
{/* {(adminUserInfo as any)?.authentication_status==1&&<Modal data={adminUserInfo}/>} */}
|
||||||
{/* 测试暂时添加 */}
|
{/* 测试暂时添加 */}
|
||||||
<View style={{ fontSize: '26rpx', textAlign: 'center' }}>{BASE_URL}</View>
|
<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>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -143,7 +154,7 @@ const Header = memo((props: any) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles['auth']}>
|
<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-box']} onClick={() => navTo()}>
|
||||||
<View className={styles['auth-left-box']}>
|
<View className={styles['auth-left-box']}>
|
||||||
<View className={styles['auth-tag']}>
|
<View className={styles['auth-tag']}>
|
||||||
@ -156,7 +167,7 @@ const Header = memo((props: any) => {
|
|||||||
<Text className="iconfont icon-a-moreback"></Text>
|
<Text className="iconfont icon-a-moreback"></Text>
|
||||||
</View>
|
</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-box']} onClick={() => navTo()}>
|
||||||
<View className={styles['auth-left-box']}>
|
<View className={styles['auth-left-box']}>
|
||||||
<View className={styles['auth-tagthree']}>
|
<View className={styles['auth-tagthree']}>
|
||||||
@ -169,7 +180,7 @@ const Header = memo((props: any) => {
|
|||||||
<Text className="iconfont icon-a-moreback"></Text>
|
<Text className="iconfont icon-a-moreback"></Text>
|
||||||
</View>
|
</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-box']} onClick={() => navTo()}>
|
||||||
<View className={styles['auth-left-box']}>
|
<View className={styles['auth-left-box']}>
|
||||||
<View className={styles['auth-tagone']}>
|
<View className={styles['auth-tagone']}>
|
||||||
@ -182,7 +193,7 @@ const Header = memo((props: any) => {
|
|||||||
<Text className="iconfont icon-a-moreback"></Text>
|
<Text className="iconfont icon-a-moreback"></Text>
|
||||||
</View>
|
</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-box']} onClick={() => navTo()}>
|
||||||
<View className={styles['auth-left-box']}>
|
<View className={styles['auth-left-box']}>
|
||||||
<View className={styles['auth-tagtwo']}>
|
<View className={styles['auth-tagtwo']}>
|
||||||
@ -274,34 +285,36 @@ const Header = memo((props: any) => {
|
|||||||
// 我的资产
|
// 我的资产
|
||||||
const Assets = (props: any) => {
|
const Assets = (props: any) => {
|
||||||
return (
|
return (
|
||||||
<View className={`${styles.assets} ${styles.crad} ${styles['main-card']}`}>
|
<>
|
||||||
<View className={`${styles['assets-title']}`}>我的资产</View>
|
{(props.userInfo.order_access_status == 3) &&<View className={`${styles.assets} ${styles.crad} ${styles['main-card']}`}>
|
||||||
<View className={`${styles['assets-content']}`}>
|
<View className={`${styles['assets-title']}`}>我的资产</View>
|
||||||
<Navigator hoverClass="none" url="/pages/depositBeforehand/index">
|
<View className={`${styles['assets-content']}`}>
|
||||||
<View className={`${styles['assets-content-item-top']}`}>
|
<Navigator hoverClass="none" url="/pages/depositBeforehand/index">
|
||||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
<View className={`${styles['assets-content-item-top']}`}>
|
||||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.wallet_money || 0)}</Text>
|
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>{props.wallet_money || 0}</Text> */}
|
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.wallet_money || 0)}</Text>
|
||||||
</View>
|
{/* <Text className={`${styles['assets-content-item-top-after']}`}>{props.wallet_money || 0}</Text> */}
|
||||||
<Text className={`${styles['assets-content-item-tips']}`}>预存款</Text>
|
</View>
|
||||||
</Navigator>
|
<Text className={`${styles['assets-content-item-tips']}`}>预存款</Text>
|
||||||
{/* <View>
|
</Navigator>
|
||||||
<View className={`${styles['assets-content-item-top']}`}>
|
{/* <View>
|
||||||
<Text className={`${styles['assets-content-item-top-content']}`}>{props.data.data.coupon_count || 0}</Text>
|
<View className={`${styles['assets-content-item-top']}`}>
|
||||||
<Text className={`${styles['assets-content-item-top-after']}`}>张</Text>
|
<Text className={`${styles['assets-content-item-top-content']}`}>{props.data.data.coupon_count || 0}</Text>
|
||||||
</View>
|
<Text className={`${styles['assets-content-item-top-after']}`}>张</Text>
|
||||||
<Text className={`${styles['assets-content-item-tips']}`}>优惠券</Text>
|
</View>
|
||||||
</View> */}
|
<Text className={`${styles['assets-content-item-tips']}`}>优惠券</Text>
|
||||||
<Navigator hoverClass="none" onClick={() => props.checkShow()}>
|
</View> */}
|
||||||
<View className={`${styles['assets-content-item-top']}`} >
|
<Navigator hoverClass="none" onClick={() => props.checkShow()}>
|
||||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
<View className={`${styles['assets-content-item-top']}`} >
|
||||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.credit_line || 0)}</Text>
|
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>.-00</Text> */}
|
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.credit_line || 0)}</Text>
|
||||||
</View>
|
{/* <Text className={`${styles['assets-content-item-top-after']}`}>.-00</Text> */}
|
||||||
<Text className={`${styles['assets-content-item-tips']}`}>授信额度</Text>
|
</View>
|
||||||
</Navigator>
|
<Text className={`${styles['assets-content-item-tips']}`}>授信额度</Text>
|
||||||
</View>
|
</Navigator>
|
||||||
</View>
|
</View>
|
||||||
|
</View>||<View className={styles['main-card']}></View>}
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,9 @@ import {weightListApi,weightDeleteApi} from "@/api/weightList"
|
|||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
import Taro, { showModal } from "@tarojs/taro"
|
import Taro, { showModal } from "@tarojs/taro"
|
||||||
import { alert } from "@/common/common"
|
import { alert } from "@/common/common"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
const weightListManager = ()=>{
|
const weightListManager = ()=>{
|
||||||
|
useLogin()
|
||||||
return(
|
return(
|
||||||
<View className="weight-list-manager">
|
<View className="weight-list-manager">
|
||||||
<WeightList />
|
<WeightList />
|
||||||
|
@ -6,8 +6,10 @@ import {weightAddApi, weightDetailApi,weightEditApi} from "@/api/weightList"
|
|||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { alert, retrieval } from "@/common/common"
|
import { alert, retrieval } from "@/common/common"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
|
import useLogin from "@/use/useLogin"
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
useLogin()
|
||||||
const {type,id} = useRouter().params;
|
const {type,id} = useRouter().params;
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(type=="add"){
|
if(type=="add"){
|
||||||
|
@ -122,14 +122,12 @@ export const useRequest = (options:option = {
|
|||||||
|
|
||||||
const stateRef = useRef({...params})
|
const stateRef = useRef({...params})
|
||||||
const [state, setState] = useState({...stateRef.current})
|
const [state, setState] = useState({...stateRef.current})
|
||||||
const {removeToken, removeSessionKey} = useUserInfo()
|
const {removeToken, removeSessionKey, removeUserInfo} = useUserInfo()
|
||||||
const {login} = useLoginRequest()
|
const {login} = useLoginRequest()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log('变化1::', state.loading)
|
|
||||||
}, [state.loading])
|
|
||||||
// 请求函数
|
// 请求函数
|
||||||
const fetchData = async (sub_options?:any) => {
|
const fetchData = async (sub_options?:any) => {
|
||||||
|
|
||||||
stateRef.current.loading = true
|
stateRef.current.loading = true
|
||||||
setState((e) => ({...e, loading:true}))
|
setState((e) => ({...e, loading:true}))
|
||||||
stateRef.current.query = {
|
stateRef.current.query = {
|
||||||
@ -179,9 +177,11 @@ export const useRequest = (options:option = {
|
|||||||
console.log('错误::',msg)
|
console.log('错误::',msg)
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if (statusCode === 401) {
|
if (statusCode === 401) {
|
||||||
removeToken()
|
removeToken()
|
||||||
removeSessionKey()
|
removeSessionKey()
|
||||||
|
removeUserInfo()
|
||||||
login()
|
login()
|
||||||
//todo 登录数据刷新次数问题
|
//todo 登录数据刷新次数问题
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
import useUserInfo from "./useUserInfo"
|
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 { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi, BindingCompanyApi } from "@/api/user"
|
||||||
import useLoginRequest from "./useLoginRequest"
|
import useLoginRequest from "./useLoginRequest"
|
||||||
import { SHARE_SCENE } from "@/common/enum"
|
import { SHARE_SCENE } from "@/common/enum"
|
||||||
import { GetShortCodeApi } from "@/api/share"
|
import { GetShortCodeApi } from "@/api/share"
|
||||||
import { alert } from "@/common/common"
|
import { alert } from "@/common/common"
|
||||||
|
import { LoginApi } from "@/api/login"
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo()
|
const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo()
|
||||||
|
|
||||||
//登录请求 (调用这个就不能再useHttp中使用,当前这个hook, 否则会死循环内存溢出)
|
useDidShow(() => {
|
||||||
// const {fetchData} = LoginApi()
|
checkLogin()
|
||||||
|
})
|
||||||
|
|
||||||
//登录请求
|
//登录请求
|
||||||
const {login} = useLoginRequest()
|
const {login} = useLoginRequest()
|
||||||
|
// const {fetchData:login} = LoginApi()
|
||||||
const wxLogin = async () => {
|
const wxLogin = async () => {
|
||||||
try {
|
try {
|
||||||
await login()
|
await login()
|
||||||
|
@ -3,11 +3,15 @@ import Taro, { useRouter } from "@tarojs/taro"
|
|||||||
import { useRef, useState } from "react"
|
import { useRef, useState } from "react"
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
import useUserInfo from "./useUserInfo"
|
import useUserInfo from "./useUserInfo"
|
||||||
|
import useLogin from "./useLogin"
|
||||||
|
|
||||||
//开这个hook 主要是为了让useHttp 能够调用
|
//开这个hook 主要是为了让useHttp 能够调用
|
||||||
|
|
||||||
type Param = {success: true|false, data: any, msg: string, code: null|number, loading: false|true}
|
type Param = {success: true|false, data: any, msg: string, code: null|number, loading: false|true}
|
||||||
|
let loginStatus = false //登录状态,true登录中
|
||||||
|
console.log('你不要过来啊')
|
||||||
export default () => {
|
export default () => {
|
||||||
|
|
||||||
let initData = {
|
let initData = {
|
||||||
success: false,
|
success: false,
|
||||||
data: null,
|
data: null,
|
||||||
@ -19,7 +23,7 @@ export default () => {
|
|||||||
const {setToken, setSessionKey} = useUserInfo()
|
const {setToken, setSessionKey} = useUserInfo()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
//微信登录请求v2
|
//微信登录请求v2
|
||||||
const fetchData = async (login_code) => {
|
const fetchDataLogin = async (login_code) => {
|
||||||
const q = {
|
const q = {
|
||||||
url: BASE_URL + '/v1/mall/login',
|
url: BASE_URL + '/v1/mall/login',
|
||||||
header: {
|
header: {
|
||||||
@ -57,11 +61,13 @@ export default () => {
|
|||||||
|
|
||||||
//微信登录
|
//微信登录
|
||||||
const login = () => {
|
const login = () => {
|
||||||
|
if(loginStatus) return false
|
||||||
|
loginStatus = true
|
||||||
return new Promise((reslove, reject) => {
|
return new Promise((reslove, reject) => {
|
||||||
Taro.login({
|
Taro.login({
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
const {data, success, msg} = await fetchData(res.code)
|
const {data, success, msg} = await fetchDataLogin(res.code)
|
||||||
if(success) {
|
if(success) {
|
||||||
setToken(data.token)
|
setToken(data.token)
|
||||||
setSessionKey(data.session_key)
|
setSessionKey(data.session_key)
|
||||||
@ -88,10 +94,12 @@ export default () => {
|
|||||||
console.log('登录失败!' + res.errMsg)
|
console.log('登录失败!' + res.errMsg)
|
||||||
reject(res.errMsg)
|
reject(res.errMsg)
|
||||||
}
|
}
|
||||||
|
loginStatus = false
|
||||||
},
|
},
|
||||||
fail: function(e) {
|
fail: function(e) {
|
||||||
console.log('登录失败!::',e)
|
console.log('登录失败!::',e)
|
||||||
reject(e)
|
reject(e)
|
||||||
|
loginStatus = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user