Merge branch 'dev' of http://git.online.zzfzyc.com/mp/EShop into dev
This commit is contained in:
commit
f704a67f06
24
package-lock.json
generated
24
package-lock.json
generated
@ -14,13 +14,15 @@
|
|||||||
"@tarojs/runtime": "3.3.10",
|
"@tarojs/runtime": "3.3.10",
|
||||||
"@tarojs/taro": "3.3.10",
|
"@tarojs/taro": "3.3.10",
|
||||||
"big.js": "^6.1.1",
|
"big.js": "^6.1.1",
|
||||||
|
"dayjs": "^1.11.3",
|
||||||
"qs": "^6.10.3",
|
"qs": "^6.10.3",
|
||||||
"react": "^17.0.0",
|
"react": "^17.0.0",
|
||||||
"react-dom": "^17.0.0",
|
"react-dom": "^17.0.0",
|
||||||
"react-redux": "^8.0.1",
|
"react-redux": "^8.0.1",
|
||||||
"redux": "^4.2.0",
|
"redux": "^4.2.0",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-thunk": "^2.4.1"
|
"redux-thunk": "^2.4.1",
|
||||||
|
"tarojs": "^2.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.8.0",
|
"@babel/core": "^7.8.0",
|
||||||
@ -7594,6 +7596,11 @@
|
|||||||
"whatwg-url": "^7.0.0"
|
"whatwg-url": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dayjs": {
|
||||||
|
"version": "1.11.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz",
|
||||||
|
"integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A=="
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "2.6.9",
|
"version": "2.6.9",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
@ -18794,6 +18801,11 @@
|
|||||||
"postcss-value-parser": "^3.3.0"
|
"postcss-value-parser": "^3.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tarojs": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tarojs/-/tarojs-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-5wJ2fuiA6Fk/9zr76ZPrsJAe6UXI66gHbtwOWaxjrJZetRurfxDZUUw6wkSZB/ZxAhVhWlv9PMuNc7DlB+rtsA=="
|
||||||
|
},
|
||||||
"node_modules/terser": {
|
"node_modules/terser": {
|
||||||
"version": "4.8.0",
|
"version": "4.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
|
||||||
@ -26469,6 +26481,11 @@
|
|||||||
"whatwg-url": "^7.0.0"
|
"whatwg-url": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dayjs": {
|
||||||
|
"version": "1.11.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz",
|
||||||
|
"integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A=="
|
||||||
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "2.6.9",
|
"version": "2.6.9",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
@ -34649,6 +34666,11 @@
|
|||||||
"postcss-value-parser": "^3.3.0"
|
"postcss-value-parser": "^3.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tarojs": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tarojs/-/tarojs-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-5wJ2fuiA6Fk/9zr76ZPrsJAe6UXI66gHbtwOWaxjrJZetRurfxDZUUw6wkSZB/ZxAhVhWlv9PMuNc7DlB+rtsA=="
|
||||||
|
},
|
||||||
"terser": {
|
"terser": {
|
||||||
"version": "4.8.0",
|
"version": "4.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
"@tarojs/runtime": "3.3.10",
|
"@tarojs/runtime": "3.3.10",
|
||||||
"@tarojs/taro": "3.3.10",
|
"@tarojs/taro": "3.3.10",
|
||||||
"big.js": "^6.1.1",
|
"big.js": "^6.1.1",
|
||||||
|
"dayjs": "^1.11.3",
|
||||||
"qs": "^6.10.3",
|
"qs": "^6.10.3",
|
||||||
"react": "^17.0.0",
|
"react": "^17.0.0",
|
||||||
"react-dom": "^17.0.0",
|
"react-dom": "^17.0.0",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useRequest } from "@/use/useHttp"
|
import { useRequest } from "@/use/useHttp"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单支付方式信息
|
* 获取应收单订单支付方式信息
|
||||||
*/
|
*/
|
||||||
export const GetOrderPayApi = () => {
|
export const GetOrderPayApi = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
@ -11,7 +11,7 @@ import { useRequest } from "@/use/useHttp"
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单支付提交
|
* 应收单订单支付提交
|
||||||
*/
|
*/
|
||||||
export const SubmitOrderPayApi = () => {
|
export const SubmitOrderPayApi = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
@ -19,3 +19,23 @@ import { useRequest } from "@/use/useHttp"
|
|||||||
method: "put",
|
method: "put",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预付单支付方式信息
|
||||||
|
*/
|
||||||
|
export const GetPrepayOrderPayApi = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mall/orderPayment/preCollectOrder/orderPaymentMethodInfo`,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预付单订单支付提交
|
||||||
|
*/
|
||||||
|
export const SubmitPrepayOrderPayApi = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mall/orderPayment/preCollectOrder/orderPaymentSubmission`,
|
||||||
|
method: "put",
|
||||||
|
})
|
||||||
|
}
|
@ -96,7 +96,8 @@ export default {
|
|||||||
root: "pages/order",
|
root: "pages/order",
|
||||||
pages: [
|
pages: [
|
||||||
"index",
|
"index",
|
||||||
"comfirm"
|
"comfirm",
|
||||||
|
"cutOrder/index",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
//订单状态枚举
|
//订单状态枚举
|
||||||
export const ORDER_STATUS = {
|
export const ORDER_STATUS = {
|
||||||
|
SaleorderstatusWaitingPrePayment : {value:10, label:'预付款'}, // 预付款
|
||||||
SaleOrderStatusBooking : {value:0, label:'待接单'}, // 待接单
|
SaleOrderStatusBooking : {value:0, label:'待接单'}, // 待接单
|
||||||
SaleOrderStatusArranging : {value:1, label:'配布中'}, // 配布中
|
SaleOrderStatusArranging : {value:1, label:'配布中'}, // 配布中
|
||||||
SaleOrderStatusArranged : {value:2, label:'已配布'}, // 已配布
|
SaleOrderStatusArranged : {value:2, label:'已配布'}, // 已配布
|
||||||
SaleOrderStatusWaitingPayment : {value:7, label:'待付款'}, // 待付款
|
SaleOrderStatusWaitingPayment : {value:7, label:'待付款'}, // 待付款
|
||||||
|
SaleOrderStatusTaking: {value: 11, label:'提货中'}, //提货中
|
||||||
SaleOrderStatusWaitingDelivery : {value:3, label:'待发货'}, // 待发货
|
SaleOrderStatusWaitingDelivery : {value:3, label:'待发货'}, // 待发货
|
||||||
SaleOrderStatusWaitingReceipt : {value:8, label:'待收货'}, // 待收货
|
SaleOrderStatusWaitingReceipt : {value:8, label:'待收货'}, // 待收货
|
||||||
SaleOrderStatusAlreadyReceipt : {value:9, label:'已收货'}, // 已收货
|
SaleOrderStatusAlreadyReceipt : {value:9, label:'已收货'}, // 已收货
|
||||||
@ -15,24 +17,33 @@ export const ORDER_STATUS = {
|
|||||||
|
|
||||||
//售后单状态枚举
|
//售后单状态枚举
|
||||||
export const AFTER_ORDER_STATUS = {
|
export const AFTER_ORDER_STATUS = {
|
||||||
SaleOrderStatusBooking : {value:0, label:'申请中'},
|
ReturnStageApplying : {value:0, label:'申请中'}, // 申请中
|
||||||
SaleOrderStatusArranging : {value:1, label:'退货中'},
|
ReturnStageWaitCheck : {value:1, label:'退货中'}, // 退货中
|
||||||
SaleOrderStatusArranged : {value:2, label:'待验布'},
|
ReturnStageChecked : {value:2, label:'待验布'}, // 待验布
|
||||||
SaleOrderStatusWaitingPayment : {value:7, label:'退款中'},
|
ReturnStageReturned : {value:3, label:'已退款'}, // 已退款
|
||||||
SaleOrderStatusWaitingDelivery : {value:3, label:'已退款'},
|
ReturnStageCancel : {value:4, label:'已取消'}, // 已取消
|
||||||
SaleOrderStatusWaitingReceipt : {value:8, label:'已取消'},
|
ReturnStageQualityCheckPendingRefund : {value:5, label:'待退款'}, // 待退款-质检
|
||||||
SaleOrderStatusAlreadyReceipt : {value:9, label:'已拒绝'},
|
ReturnStageServiceOrderPendingRefund : {value:6, label:'待退款'}, // 待退款
|
||||||
|
ReturnStageRejected : {value:7, label:'已拒绝'}, // 已拒绝
|
||||||
}
|
}
|
||||||
|
|
||||||
//支付方式
|
//支付方式
|
||||||
export const PAYMENT_METHOD = {
|
export const PAYMENT_METHOD = {
|
||||||
PaymentMethodPreDeposit: {value:1, label:'预存款'},
|
PaymentMethodPreDeposit: {value:1, label:'预存款'},
|
||||||
PaymentMethodAccountPeriod : {value:2, label:'账期'},
|
PaymentMethodAccountPeriod : {value:2, label:'账期'},
|
||||||
PaymentMethodofflineRemittance: {value:3, label:'线下汇款'},
|
PaymentMethodofflineRemittance: {value:0, label:'线下汇款'},
|
||||||
PaymentMethodScanCodeToPay: {value:4, label:'扫码支付'},
|
PaymentMethodScanCodeToPay: {value:3, label:'扫码支付'},
|
||||||
PaymentMethodCashOnDelivery: {value:5, label:'货到付款'},
|
PaymentMethodCashOnDelivery: {value:4, label:'货到付款'},
|
||||||
|
}
|
||||||
|
export type PAYMENT_METHOD_PARAM = 0|1|2|3|4
|
||||||
|
|
||||||
|
|
||||||
|
//订单类型
|
||||||
|
export const SALE_MODE = {
|
||||||
|
SaLeModeBulk: {value:0, label:'大货'},
|
||||||
|
SaleModeLengthCut: {value:1, label:'剪版'},
|
||||||
|
SaLeModeWeightCut: {value:2, label:'散剪'},
|
||||||
}
|
}
|
||||||
export type PAYMENT_METHOD_PARAM = 1|2|3|4|5
|
|
||||||
|
|
||||||
//分享场景枚举
|
//分享场景枚举
|
||||||
export const SHARE_SCENE = {
|
export const SHARE_SCENE = {
|
||||||
|
202
src/components/orderBtns/index copy.tsx
Normal file
202
src/components/orderBtns/index copy.tsx
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||||
|
import { alert } from "@/common/common"
|
||||||
|
import { ORDER_STATUS, SALE_MODE } from "@/common/enum"
|
||||||
|
import { ScrollView, Text, View } from "@tarojs/components"
|
||||||
|
import Taro from "@tarojs/taro"
|
||||||
|
import { useCallback, useRef, memo, useState, useEffect, useMemo } from "react"
|
||||||
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
|
type Param = {
|
||||||
|
orderInfo: {
|
||||||
|
status: number, //订单状态
|
||||||
|
orderId: number, //订单id
|
||||||
|
actual_amount: number, //实付金额
|
||||||
|
wait_pay_amount: number, //待付金额
|
||||||
|
sale_mode: number //订单类型
|
||||||
|
}|null,
|
||||||
|
onClick?: (val: number) => void //点击后触发的事件,返回订单状态
|
||||||
|
}
|
||||||
|
|
||||||
|
export default memo(({orderInfo, onClick}:Param) => {
|
||||||
|
//订单状态枚举
|
||||||
|
const {
|
||||||
|
SaleOrderStatusBooking,
|
||||||
|
SaleOrderStatusArranging,
|
||||||
|
SaleOrderStatusArranged,
|
||||||
|
SaleOrderStatusWaitingDelivery,
|
||||||
|
SaleOrderStatusComplete,
|
||||||
|
SaleOrderStatusRefund,
|
||||||
|
SaleOrderStatusWaitingPayment,
|
||||||
|
SaleOrderStatusWaitingReceipt,
|
||||||
|
SaleOrderStatusAlreadyReceipt,
|
||||||
|
SaleorderstatusWaitingPrePayment
|
||||||
|
} = ORDER_STATUS
|
||||||
|
|
||||||
|
//订单类型
|
||||||
|
const {
|
||||||
|
SaLeModeBulk,
|
||||||
|
SaleModeLengthCut,
|
||||||
|
SaLeModeWeightCut,
|
||||||
|
} = SALE_MODE
|
||||||
|
|
||||||
|
//订单按钮按订单状态归类, value是该订单状态,可能该按钮会出现
|
||||||
|
const orderBtnsList = useRef([
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
value: [SaleOrderStatusBooking.value,
|
||||||
|
SaleOrderStatusArranging.value,
|
||||||
|
SaleOrderStatusArranged.value,
|
||||||
|
SaleOrderStatusWaitingPayment.value,
|
||||||
|
SaleOrderStatusWaitingDelivery.value], //取消订单按钮对应: 待接单,配布中,已配布, 待付款, 待发货
|
||||||
|
label: '取消订单'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
value: [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value], //去付款按钮对应:待付款, 待发货, 待收货, 已收货, 已完成
|
||||||
|
label: '去付款'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
value: [SaleOrderStatusWaitingDelivery.value], //申请退款按钮对应: 待发货
|
||||||
|
label: '申请退款'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
value: [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value], //取消订单按钮对应: 待收货, 已收货, 已完成, 已退款
|
||||||
|
label: '查看物流'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
value: [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusRefund.value], //申请退货按钮对应: 待收货, 已收货, 已退款
|
||||||
|
label: '申请退货'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
value: [SaleOrderStatusWaitingReceipt.value], //确认收货按钮对应: 待收货
|
||||||
|
label: '确认收货'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
value: [SaleOrderStatusWaitingReceipt.value,SaleOrderStatusAlreadyReceipt.value,SaleOrderStatusComplete.value,SaleOrderStatusRefund.value], //再次购买按钮对应: 待收货,已收货,已完成, 已退款
|
||||||
|
label: '再次购买'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
value: [SaleOrderStatusBooking.value], //按钮对应: 待接单
|
||||||
|
label: '退款'
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
//判断是否显示该按钮
|
||||||
|
const orderBtnsShow = (item) => {
|
||||||
|
if(orderInfo) {
|
||||||
|
if(item.id == 1) {
|
||||||
|
//取消订单按钮
|
||||||
|
return( orderInfo.actual_amount == 0 && item.value.includes(orderInfo.status)) //在待发货之前没有付过款
|
||||||
|
} else if (item.id == 2) {
|
||||||
|
//去付款按钮
|
||||||
|
return( orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) //只要没有付完款就显示
|
||||||
|
} else if(item.id == 3 ) {
|
||||||
|
//申请退款, 只有大货才有
|
||||||
|
return (orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //大货在待发货付过款
|
||||||
|
} else if( item.id == 8) {
|
||||||
|
//退款按钮(直接退款不用申请), 只有散剪和剪板有
|
||||||
|
return (orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //散剪和剪板在待接单时付过款
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//其他按钮
|
||||||
|
return item.value.includes(orderInfo.status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示的按钮数组
|
||||||
|
const orderBtnsShowList: {id: number, value: any, label: string}[] = useMemo(() => {
|
||||||
|
return orderBtnsList.current.filter(item => {
|
||||||
|
return orderBtnsShow(item)
|
||||||
|
})
|
||||||
|
}, [orderInfo])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//点击按钮操作
|
||||||
|
const submitBtns = (val, index) => {
|
||||||
|
(val == 1)&&cancelOrder(); //取消订单按钮
|
||||||
|
(val == 2)&&onClick?.(2); //去付款按钮
|
||||||
|
(val == 6)&&receiveOrder(); //确认收货
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消订单
|
||||||
|
const {fetchData: cancelFetchData} = CancelOrderApi()
|
||||||
|
const cancelOrder = () => {
|
||||||
|
Taro.showModal({
|
||||||
|
title: '要取消该订单吗?',
|
||||||
|
success: async function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
let res = await cancelFetchData({id: orderInfo?.orderId})
|
||||||
|
if(res.success) {
|
||||||
|
alert.success('取消成功')
|
||||||
|
onClick?.(1)
|
||||||
|
} else {
|
||||||
|
alert.none(res.msg)
|
||||||
|
}
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//确认订单
|
||||||
|
const {fetchData: receiveOrderFetchData} = ReceiveOrderApi()
|
||||||
|
const receiveOrder = async () => {
|
||||||
|
console.log('123456')
|
||||||
|
Taro.showModal({
|
||||||
|
title: '确定收货?',
|
||||||
|
success: async function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
let res = await receiveOrderFetchData({sale_order_id: orderInfo?.orderId})
|
||||||
|
if(res.success){
|
||||||
|
onClick?.(6)
|
||||||
|
alert.success('收货成功')
|
||||||
|
} else {
|
||||||
|
alert.error('收货失败')
|
||||||
|
}
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示更多按钮
|
||||||
|
const [showMore, setShowMore] = useState(false)
|
||||||
|
const styleTop = useMemo(() => {
|
||||||
|
return {top:`-${(orderBtnsShowList.length - 3)*70 + 10}rpx`, left: `-${10}rpx`}
|
||||||
|
}, [orderBtnsShowList])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View className={styles.btns_list}>
|
||||||
|
{(orderBtnsShowList.length > 3)&&<View className={styles.more}>
|
||||||
|
<Text onClick={() => setShowMore(true)}>更多</Text>
|
||||||
|
{showMore&&<View className={styles.more_con}>
|
||||||
|
<View className={styles.more_list} style={styleTop}>
|
||||||
|
{orderBtnsShowList.map((item, index) => {
|
||||||
|
return ((index >= 3) &&<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>{item.label}</View>)
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
<View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View>
|
||||||
|
</View>}
|
||||||
|
</View>}
|
||||||
|
|
||||||
|
<View className={styles.list_scroll}>
|
||||||
|
{orderBtnsShowList.map((item, index) =>
|
||||||
|
(index < 3)&&<View key={item.id} className={styles.btns_item} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
})
|
@ -1,8 +1,57 @@
|
|||||||
.btns_list{
|
.btns_list{
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// margin-top: 30px;
|
// margin-top: 30px;
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
|
.more{
|
||||||
|
font-size: 28px;
|
||||||
|
width: 143px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: $color_font_two;
|
||||||
|
padding-left: 20px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.more_list{
|
||||||
|
position: absolute;
|
||||||
|
background-color: #fff;
|
||||||
|
width: 226px;
|
||||||
|
box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.06);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 0 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
z-index:999;
|
||||||
|
&::before{
|
||||||
|
z-index: 1;
|
||||||
|
position: absolute;
|
||||||
|
bottom: -7px;
|
||||||
|
left: 50px;
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
content: " ";
|
||||||
|
transform: rotate(45deg);
|
||||||
|
background: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
.more_item{
|
||||||
|
font-size: 28px;
|
||||||
|
height: 70px;
|
||||||
|
line-height: 70px;
|
||||||
|
text-align: center;
|
||||||
|
&:nth-last-child(n+2) {
|
||||||
|
border-bottom: 1PX solid #F0F0F0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.more_bg{
|
||||||
|
position:fixed;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.scroll{
|
.scroll{
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -14,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
.btns_item{
|
.btns_item{
|
||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
width: 100px;
|
width: 130px;
|
||||||
border: 2px solid #dddddd;
|
border: 2px solid #dddddd;
|
||||||
border-radius: 38px;
|
border-radius: 38px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||||
import { alert } from "@/common/common"
|
import { alert } from "@/common/common"
|
||||||
import { ORDER_STATUS } from "@/common/enum"
|
import { ORDER_STATUS, SALE_MODE } from "@/common/enum"
|
||||||
import { ScrollView, View } from "@tarojs/components"
|
import { ScrollView, Text, View } from "@tarojs/components"
|
||||||
import Taro from "@tarojs/taro"
|
import Taro from "@tarojs/taro"
|
||||||
import { useCallback, useRef, memo, useState, useEffect } from "react"
|
import { useCallback, useRef, memo, useState, useEffect, useMemo } from "react"
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
@ -12,12 +12,13 @@ type Param = {
|
|||||||
orderId: number, //订单id
|
orderId: number, //订单id
|
||||||
actual_amount: number, //实付金额
|
actual_amount: number, //实付金额
|
||||||
wait_pay_amount: number, //待付金额
|
wait_pay_amount: number, //待付金额
|
||||||
|
sale_mode: number //订单类型
|
||||||
}|null,
|
}|null,
|
||||||
onClick?: (val: number) => void //点击后触发的事件,返回订单状态
|
onClick?: (val: number) => void //点击后触发的事件,返回订单状态
|
||||||
}
|
}
|
||||||
|
|
||||||
// export const OrderBtnsemus = [{id:1, label:'取消订单'},{id:2, label:'去付款'},{id:3, label:'申请退款'},{id:4, label:'查看物流'}, {id:5, label:'申请退货'}, {id:6, label:'确认收货'}, {id:7, label:'再次购买'}]
|
|
||||||
export default memo(({orderInfo, onClick}:Param) => {
|
export default memo(({orderInfo, onClick}:Param) => {
|
||||||
|
//订单状态枚举
|
||||||
const {
|
const {
|
||||||
SaleOrderStatusBooking,
|
SaleOrderStatusBooking,
|
||||||
SaleOrderStatusArranging,
|
SaleOrderStatusArranging,
|
||||||
@ -27,48 +28,68 @@ export default memo(({orderInfo, onClick}:Param) => {
|
|||||||
SaleOrderStatusRefund,
|
SaleOrderStatusRefund,
|
||||||
SaleOrderStatusWaitingPayment,
|
SaleOrderStatusWaitingPayment,
|
||||||
SaleOrderStatusWaitingReceipt,
|
SaleOrderStatusWaitingReceipt,
|
||||||
SaleOrderStatusAlreadyReceipt
|
SaleOrderStatusAlreadyReceipt,
|
||||||
|
SaleorderstatusWaitingPrePayment
|
||||||
} = ORDER_STATUS
|
} = ORDER_STATUS
|
||||||
//订单按钮按订单状态归类
|
|
||||||
|
//订单类型
|
||||||
|
const {
|
||||||
|
SaLeModeBulk,
|
||||||
|
SaleModeLengthCut,
|
||||||
|
SaLeModeWeightCut,
|
||||||
|
} = SALE_MODE
|
||||||
|
|
||||||
|
//订单按钮按订单状态归类, value是该订单状态,可能该按钮会出现
|
||||||
const orderBtnsList = useRef([
|
const orderBtnsList = useRef([
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
value: [SaleOrderStatusBooking.value, SaleOrderStatusArranging.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value], //取消订单按钮对应: 待接单,配布中,已配布, 待付款, 待发货
|
value: [SaleOrderStatusBooking.value,
|
||||||
|
SaleOrderStatusArranging.value,
|
||||||
|
SaleOrderStatusArranged.value,
|
||||||
|
SaleOrderStatusWaitingPayment.value,
|
||||||
|
SaleOrderStatusWaitingDelivery.value], //取消订单按钮对应: 待接单,配布中,已配布, 待付款, 待发货
|
||||||
label: '取消订单'
|
label: '取消订单'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
value: [SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value], //去付款按钮对应:待付款, 待发货, 待收货, 已收货, 已完成
|
value: [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value], //去付款按钮对应:待付款, 待发货, 待收货, 已收货, 已完成
|
||||||
label: '去付款'
|
label: '去付款'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
value: [SaleOrderStatusWaitingDelivery.value], //取消订单按钮对应: 待发货
|
value: [SaleOrderStatusWaitingDelivery.value], //申请退款按钮对应: 待发货
|
||||||
label: '申请退款'
|
label: '申请退款'
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
id: 4,
|
// id: 4,
|
||||||
value: [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value], //取消订单按钮对应: 待收货, 已收货, 已完成, 已退款
|
// value: [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value], //取消订单按钮对应: 待收货, 已收货, 已完成, 已退款
|
||||||
label: '查看物流'
|
// label: '查看物流'
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
value: [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusRefund.value], //取消订单按钮对应: 待收货, 已收货, 已退款
|
value: [SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusRefund.value], //申请退货按钮对应:已收货, 已退款
|
||||||
label: '申请退货'
|
label: '申请退货'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 6,
|
id: 6,
|
||||||
value: [SaleOrderStatusWaitingReceipt.value], //取消订单按钮对应: 待收货
|
value: [SaleOrderStatusWaitingReceipt.value], //确认收货按钮对应: 待收货
|
||||||
label: '确认收货'
|
label: '确认收货'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 7,
|
id: 7,
|
||||||
value: [SaleOrderStatusWaitingReceipt.value,SaleOrderStatusAlreadyReceipt.value,SaleOrderStatusComplete.value,SaleOrderStatusRefund.value], //取消订单按钮对应: 待收货,已收货,已完成, 已退款
|
value: [SaleOrderStatusWaitingReceipt.value,SaleOrderStatusAlreadyReceipt.value,SaleOrderStatusComplete.value,SaleOrderStatusRefund.value], //再次购买按钮对应: 待收货,已收货,已完成, 已退款
|
||||||
label: '再次购买'
|
label: '再次购买'
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
value: [SaleOrderStatusBooking.value], //按钮对应: 待接单
|
||||||
|
label: '退款'
|
||||||
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
//判断是否显示该按钮
|
//判断是否显示该按钮
|
||||||
const orderBtnsShow = useCallback((item) => {
|
const orderBtnsShow = (item) => {
|
||||||
if(orderInfo) {
|
if(orderInfo) {
|
||||||
if(item.id == 1) {
|
if(item.id == 1) {
|
||||||
//取消订单按钮
|
//取消订单按钮
|
||||||
@ -77,18 +98,31 @@ export default memo(({orderInfo, onClick}:Param) => {
|
|||||||
//去付款按钮
|
//去付款按钮
|
||||||
return( orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) //只要没有付完款就显示
|
return( orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) //只要没有付完款就显示
|
||||||
} else if(item.id == 3 ) {
|
} else if(item.id == 3 ) {
|
||||||
//申请退款
|
//申请退款, 只有大货才有
|
||||||
return (orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //在待发货之前付过款
|
return (orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //大货在待发货付过款
|
||||||
|
} else if( item.id == 8) {
|
||||||
|
//退款按钮(直接退款不用申请), 只有散剪和剪板有
|
||||||
|
return (orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //散剪和剪板在待接单时付过款
|
||||||
|
} else if (item.id == 7) {
|
||||||
|
return true //再次购买按钮一直存在
|
||||||
} else {
|
} else {
|
||||||
//其他按钮
|
//其他按钮
|
||||||
return item.value.includes(orderInfo.status)
|
return item.value.includes(orderInfo.status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示的按钮数组
|
||||||
|
const orderBtnsShowList: {id: number, value: any, label: string}[] = useMemo(() => {
|
||||||
|
return orderBtnsList.current.filter(item => {
|
||||||
|
return orderBtnsShow(item)
|
||||||
|
})
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//点击按钮操作
|
//点击按钮操作
|
||||||
const submitBtns = (val, index) => {
|
const submitBtns = (val, index) => {
|
||||||
clickEvent(val, index);
|
|
||||||
(val == 1)&&cancelOrder(); //取消订单按钮
|
(val == 1)&&cancelOrder(); //取消订单按钮
|
||||||
(val == 2)&&onClick?.(2); //去付款按钮
|
(val == 2)&&onClick?.(2); //去付款按钮
|
||||||
(val == 6)&&receiveOrder(); //确认收货
|
(val == 6)&&receiveOrder(); //确认收货
|
||||||
@ -136,32 +170,33 @@ export default memo(({orderInfo, onClick}:Param) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//显示更多按钮
|
||||||
//按钮点击滚动
|
const [showMore, setShowMore] = useState(false)
|
||||||
const [selectInfo, setSelectInfo] = useState({
|
const styleTop = useMemo(() => {
|
||||||
selected: -1, //当前选中的id
|
return {top:`-${(orderBtnsShowList.length - 3)*70 + 10}rpx`, left: `-${10}rpx`}
|
||||||
tabId: '', //需要滚动到的id
|
}, [orderBtnsShowList])
|
||||||
})
|
|
||||||
const clickEvent = (id, index) => {
|
|
||||||
console.log(id, index)
|
|
||||||
const num = index > 0?( index - 1) : 0
|
|
||||||
console.log('num::',orderBtnsList.current[num].id)
|
|
||||||
setSelectInfo((e) => ({...e, tabId:orderBtnsList.current[num].id.toString(), selected: id}))
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.btns_list}>
|
<View className={styles.btns_list}>
|
||||||
<ScrollView scrollX scrollIntoView={`orderBtns_${selectInfo.tabId}`} scrollWithAnimation={true} className={styles.scroll}>
|
{(orderBtnsShowList.length > 3)&&<View className={styles.more}>
|
||||||
|
<Text onClick={() => setShowMore(true)}>更多</Text>
|
||||||
|
{showMore&&<View className={styles.more_con}>
|
||||||
|
<View className={styles.more_list} style={styleTop}>
|
||||||
|
{orderBtnsShowList.map((item, index) => {
|
||||||
|
return ((index >= 3) &&<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>{item.label}</View>)
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
<View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View>
|
||||||
|
</View>}
|
||||||
|
</View>}
|
||||||
|
|
||||||
<View className={styles.list_scroll}>
|
<View className={styles.list_scroll}>
|
||||||
{orderBtnsList.current.map((item, index) =>
|
{orderBtnsShowList.map((item, index) =>
|
||||||
orderBtnsShow(item)&&<View key={item.id} className={styles.btns_item} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
(index < 3)&&<View key={item.id} className={styles.btns_item} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||||
// <View key={item.id} className={styles.btns_item} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
.apply_after_sales_list{
|
.apply_after_sales_list{
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
.apply_after_sales_item{
|
.apply_after_sales_item{
|
||||||
margin-bottom: 30px;
|
margin-bottom: 50px;
|
||||||
.apply_after_sales_title{
|
.apply_after_sales_title{
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -19,7 +19,6 @@ export default () => {
|
|||||||
const onShowReason = (status) => setShowReason({...showReason, status, show:true})
|
const onShowReason = (status) => setShowReason({...showReason, status, show:true})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//底部按钮
|
//底部按钮
|
||||||
const onSubmit = (val) => {
|
const onSubmit = (val) => {
|
||||||
|
|
||||||
@ -32,7 +31,8 @@ export default () => {
|
|||||||
<ScrollView scrollY className={styles.scroll}>
|
<ScrollView scrollY className={styles.scroll}>
|
||||||
<View className={styles.scroll_con}>
|
<View className={styles.scroll_con}>
|
||||||
<View className={styles.apply_after_sales_list}>
|
<View className={styles.apply_after_sales_list}>
|
||||||
<View className={styles.apply_after_sales_item}>
|
|
||||||
|
{new Array(5).fill(5).map(item => <View className={styles.apply_after_sales_item}>
|
||||||
<View className={styles.apply_after_sales_title}>
|
<View className={styles.apply_after_sales_title}>
|
||||||
<View className={styles.tag}>大货</View>
|
<View className={styles.tag}>大货</View>
|
||||||
<View className={styles.title}>0770# 21S单面平纹(食毛)</View>
|
<View className={styles.title}>0770# 21S单面平纹(食毛)</View>
|
||||||
@ -53,29 +53,8 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>)}
|
||||||
<View className={styles.apply_after_sales_item}>
|
|
||||||
<View className={styles.apply_after_sales_title}>
|
|
||||||
<View className={styles.tag}>大货</View>
|
|
||||||
<View className={styles.title}>0770# 21S单面平纹(食毛)</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.color_list}>
|
|
||||||
<View className={styles.color_item}>
|
|
||||||
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
|
|
||||||
<View className={styles.name_and_number}><Text>1# 薄荷绿</Text><Text>x1</Text></View>
|
|
||||||
<View className={styles.btn_count}>
|
|
||||||
<Counter/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.color_item}>
|
|
||||||
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
|
|
||||||
<View className={styles.name_and_number}><Text>1# 薄荷绿</Text><Text>x1</Text></View>
|
|
||||||
<View className={styles.btn_count}>
|
|
||||||
<Counter/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.returnSaleInput}>
|
<View className={styles.returnSaleInput}>
|
||||||
<View className={styles.returnSaleInput_item}>
|
<View className={styles.returnSaleInput_item}>
|
||||||
@ -123,19 +102,10 @@ export default () => {
|
|||||||
|
|
||||||
//图片列表
|
//图片列表
|
||||||
const PictureItem = memo(() => {
|
const PictureItem = memo(() => {
|
||||||
const {uploadCDNImg} = useUploadCDNImg()
|
const {getWxPhoto} = useUploadCDNImg()
|
||||||
|
|
||||||
//图片
|
//图片
|
||||||
const uploadImage = () => {
|
const uploadImage = async () => {
|
||||||
Taro.chooseImage({
|
let res = await getWxPhoto('after-sale')
|
||||||
count: 1, // 默认9
|
|
||||||
sizeType: ['original', 'compressed'],
|
|
||||||
sourceType: ['album', 'camera'],
|
|
||||||
success: function (res) {
|
|
||||||
const file = res.tempFiles[0]
|
|
||||||
uploadCDNImg(file, 'product', 'product')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
export default {
|
|
||||||
navigationBarTitleText: '确认订单',
|
|
||||||
enableShareAppMessage: true,
|
|
||||||
}
|
|
@ -1,130 +0,0 @@
|
|||||||
.order_main{
|
|
||||||
min-height: 100%;
|
|
||||||
background-color:$color_bg_one;
|
|
||||||
padding: 20px;
|
|
||||||
padding-bottom: 190px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
.order_title{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 20px 30px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: #fff;
|
|
||||||
height: 116px;
|
|
||||||
border-radius: 20px;
|
|
||||||
margin-top: 20px;
|
|
||||||
text{
|
|
||||||
flex:1;
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.order_status{
|
|
||||||
background-color: #F0F0F0;
|
|
||||||
width: 148px;
|
|
||||||
height: 55px;
|
|
||||||
color: $color_font_three;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 55px;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
border-radius: 30px;
|
|
||||||
&:nth-last-child(1) {
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_status_selected{
|
|
||||||
color: $color_main;
|
|
||||||
border: 1px solid $color_main;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_desc{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #fff;
|
|
||||||
padding: 20px;
|
|
||||||
min-height: 116px;
|
|
||||||
border-radius: 20px;
|
|
||||||
margin-top: 20px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
.order_desc_con{
|
|
||||||
width: 150px;
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.order_desc_text, .order_desc_text_hint{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
color: $color_font_two;
|
|
||||||
margin-right: 10px;
|
|
||||||
flex:1;
|
|
||||||
}
|
|
||||||
.order_desc_text_hint{
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.miconfont{
|
|
||||||
font-size: 20px;
|
|
||||||
color: $color_font_two;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.submit_order{
|
|
||||||
display: flex;
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
justify-content: space-between;
|
|
||||||
width: 100%;
|
|
||||||
height: 175px;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #fff;
|
|
||||||
box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16);
|
|
||||||
padding: 20px 50px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding-bottom: constant(safe-area-inset-bottom);
|
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
.order_btn {
|
|
||||||
width: 250px;
|
|
||||||
height: 90px;
|
|
||||||
opacity: 0.6;
|
|
||||||
background: linear-gradient(38deg,#007aff, #4fa6ff 100%, #68b4ff 100%);
|
|
||||||
border-radius: 46px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.ok_order_btn {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
.order_number_desc{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
color: $color_font_two;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_info{
|
|
||||||
background-color: #fff;
|
|
||||||
margin-top: 20px;
|
|
||||||
border-radius: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
.order_info_title{
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
|
|
||||||
}
|
|
||||||
.order_num{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
.order_num_btn{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
padding: 5px 10px;
|
|
||||||
border: 2px solid #007cf7;
|
|
||||||
border-radius: 10px;
|
|
||||||
color: $color_main;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text{
|
|
||||||
font-size: $font_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,188 +0,0 @@
|
|||||||
import { SaleOrderPreViewApi, SaleOrderApi } from "@/api/order";
|
|
||||||
import { formatPriceDiv } from "@/common/fotmat";
|
|
||||||
import Popup from "@/components/popup";
|
|
||||||
import SearchInput from "@/components/searchInput";
|
|
||||||
import { Text, Textarea, View } from "@tarojs/components"
|
|
||||||
import Taro, { useDidShow, useRouter } from "@tarojs/taro";
|
|
||||||
import classnames from "classnames";
|
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
||||||
import AddressInfo,{AddressInfoParam} from "./components/addressInfo";
|
|
||||||
import EstimatedAmount from "./components/estimatedAmount";
|
|
||||||
import KindList from "./components/kindList";
|
|
||||||
import OrderState from "./components/orderState";
|
|
||||||
import Remark from "./components/remark";
|
|
||||||
import styles from './comfirm.module.scss'
|
|
||||||
import { getParam } from "@/common/system";
|
|
||||||
import useLogin from "@/use/useLogin";
|
|
||||||
import { alert, goLink } from "@/common/common";
|
|
||||||
import ShipmentMode from "../editOrder/components/shipmentMode";
|
|
||||||
import SubmitOrderBtn from "./components/submitOrderBtn";
|
|
||||||
|
|
||||||
export default () => {
|
|
||||||
const {checkLogin} = useLogin()
|
|
||||||
|
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
|
||||||
//下单信息
|
|
||||||
type OrderParams = {address_id?: number, remark?: string, sale_mode?: number, shipment_mode?: number, list?: any[]}
|
|
||||||
const [submitOrderData, setSubmitOrderData] = useState<OrderParams>()
|
|
||||||
|
|
||||||
//获取购物车传过来的id
|
|
||||||
type orderPreParam = {shopping_cart_product_color_list:{shopping_cart_product_color_id:number}[], sale_mode:number}
|
|
||||||
const param = getParam()
|
|
||||||
const idsAndSaleModel = useRef<orderPreParam>({shopping_cart_product_color_list:[], sale_mode:0})
|
|
||||||
useDidShow(async () => {
|
|
||||||
idsAndSaleModel.current = {shopping_cart_product_color_list:[], sale_mode:0} //初始化
|
|
||||||
idsAndSaleModel.current.sale_mode = Number(param?.sale_mode)
|
|
||||||
param?.ids?.split('-')?.map(item => {
|
|
||||||
return idsAndSaleModel.current.shopping_cart_product_color_list?.push({
|
|
||||||
shopping_cart_product_color_id: Number(item)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
getSaleOrderPreView()
|
|
||||||
setSubmitOrderData((val) => ({...val, sale_mode:param?.sale_mode}))
|
|
||||||
})
|
|
||||||
|
|
||||||
//获取销售预览订单
|
|
||||||
const [preViewOrder, setPreViewOrder] = useState<any>() //获取到的原始数据
|
|
||||||
const {fetchData} = SaleOrderPreViewApi()
|
|
||||||
const getSaleOrderPreView = async () => {
|
|
||||||
if(idsAndSaleModel.current.shopping_cart_product_color_list?.length > 0) {
|
|
||||||
let res = await fetchData(idsAndSaleModel.current)
|
|
||||||
setPreViewOrder(res.data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//监听获取到的数据
|
|
||||||
useEffect(() => {
|
|
||||||
if(preViewOrder) {
|
|
||||||
formatData()
|
|
||||||
getDataList()
|
|
||||||
//当有默认地址时设置默认地址id
|
|
||||||
preViewOrder.default_address&&setSubmitOrderData((val) => ({...val, address_id:preViewOrder.default_address.id}))
|
|
||||||
}
|
|
||||||
}, [preViewOrder])
|
|
||||||
|
|
||||||
//格式化数据格式
|
|
||||||
const [formatPreViewOrder, setFormatPreViewOrder] = useState<any>() //格式化后的数据
|
|
||||||
const formatData = () => {
|
|
||||||
setFormatPreViewOrder({
|
|
||||||
estimate_amount: preViewOrder.estimate_amount, //预估金额
|
|
||||||
sale_mode: preViewOrder.sale_mode,
|
|
||||||
sale_mode_name: preViewOrder.sale_mode_name,
|
|
||||||
total_colors: preViewOrder.total_colors, //总颜色数量
|
|
||||||
total_number: preViewOrder.total_number, //总数量
|
|
||||||
total_fabrics: preViewOrder.total_fabrics, //面料数量
|
|
||||||
unit: preViewOrder.sale_mode == 0?'条':'m', //单位
|
|
||||||
list: preViewOrder.product_list
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const formatPreViewOrderMemo = useMemo(() => {
|
|
||||||
return formatPreViewOrder
|
|
||||||
}, [formatPreViewOrder])
|
|
||||||
|
|
||||||
//格式化初始地址
|
|
||||||
const defaultAddress = useMemo(() => {
|
|
||||||
const address = preViewOrder?.default_address
|
|
||||||
if(address) {
|
|
||||||
return {
|
|
||||||
province_name: address.province_name,
|
|
||||||
city_name: address.city_name,
|
|
||||||
district_name: address.district_name,
|
|
||||||
address_detail: address.address_detail,
|
|
||||||
id: address.id,
|
|
||||||
name: address.name,
|
|
||||||
phone: address.phone
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}, [preViewOrder])
|
|
||||||
|
|
||||||
//获取提交格式数据列表
|
|
||||||
const getDataList = () => {
|
|
||||||
let list:{shopping_cart_product_color_id:number}[] = []
|
|
||||||
preViewOrder.product_list?.map(item => {
|
|
||||||
item.product_colors?.map(colorItem => {
|
|
||||||
list.push({shopping_cart_product_color_id:colorItem.id})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
setSubmitOrderData((val) => ({...val, list}))
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取地址
|
|
||||||
const getAddress = (e) => {
|
|
||||||
setSubmitOrderData((val) => ({...val, address_id:e.id}))
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectShipmentMode = useCallback((value) => {
|
|
||||||
setSubmitOrderData((val) => ({...val, shipment_mode:value}))
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
//获取备注
|
|
||||||
const getRemark = useCallback((e) => {
|
|
||||||
setSubmitOrderData((val) => ({...val, remark:e}))
|
|
||||||
setShowDesc(() => false)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
//提交按钮是否可用
|
|
||||||
const btnStatus = useMemo(() => {
|
|
||||||
if( submitOrderData?.list?.length == 0 || !submitOrderData?.shipment_mode || (submitOrderData?.shipment_mode == 2 && !submitOrderData?.address_id)) {
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}, [submitOrderData])
|
|
||||||
|
|
||||||
//提交订单
|
|
||||||
const {fetchData: saleOrderFetchData} = SaleOrderApi()
|
|
||||||
const submitOrderEven = () => {
|
|
||||||
if(!submitOrderData?.address_id) {
|
|
||||||
alert.error('请选择地址')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if(!submitOrderData?.shipment_mode) {
|
|
||||||
alert.error('请选择收货方式')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
Taro.showModal({
|
|
||||||
title: '确定提交?',
|
|
||||||
success: async function (res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
const res = await saleOrderFetchData(submitOrderData)
|
|
||||||
if(res.success) {
|
|
||||||
goLink('/pages/order/index',{id: res.data.id}, 'redirectTo')
|
|
||||||
} else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
} else if (res.cancel) {
|
|
||||||
console.log('用户点击取消')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<View className={styles.order_main}>
|
|
||||||
<ShipmentMode onSelect={selectShipmentMode}/>
|
|
||||||
<AddressInfo onSelect={(e) => getAddress(e)} defaultValue={defaultAddress}/>
|
|
||||||
<KindList order={formatPreViewOrderMemo} comfirm={true}/>
|
|
||||||
<View className={styles.order_desc} onClick={() => setShowDesc(true)}>
|
|
||||||
<View className={styles.order_desc_con}>订单备注</View>
|
|
||||||
{
|
|
||||||
submitOrderData?.remark&&<View className={styles.order_desc_text}>{submitOrderData?.remark}</View>||
|
|
||||||
<View className={styles.order_desc_text_hint}>填写备注</View>
|
|
||||||
}
|
|
||||||
<View className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.submit_order}>
|
|
||||||
<View className={styles.submit_order_number}>
|
|
||||||
<SubmitOrderBtn style={{color:'#007AFF'}} number={formatPriceDiv(formatPreViewOrder?.estimate_amount)}/>
|
|
||||||
<View className={styles.order_number_desc}>{`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`}</View>
|
|
||||||
</View>
|
|
||||||
<View className={classnames(styles.order_btn, btnStatus&&styles.ok_order_btn)} onClick={() => submitOrderEven()}>提交订单</View>
|
|
||||||
</View>
|
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)} >
|
|
||||||
<Remark onSave={(e) => getRemark(e)}/>
|
|
||||||
</Popup>
|
|
||||||
<View className="common_safe_area_y"></View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
.order_address{
|
|
||||||
height: 178px;
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 30px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-top: 20px;
|
|
||||||
.order_address_icon{
|
|
||||||
font-size: 76px;
|
|
||||||
color: $color_main;
|
|
||||||
}
|
|
||||||
.order_address_text_con{
|
|
||||||
flex:1;
|
|
||||||
padding: 0 30px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
.order_address_text_title{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
margin-top: 10px;
|
|
||||||
@include common_ellipsis;
|
|
||||||
}
|
|
||||||
.order_address_text_name{
|
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
text{
|
|
||||||
&:nth-child(1) {
|
|
||||||
color: #000;
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: $color_font_one;
|
|
||||||
margin-right: 40px;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
color: $color_font_one;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.updateBtn{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
color: $color_font_three;
|
|
||||||
width: 96px;
|
|
||||||
height: 52px;
|
|
||||||
border: 2px solid #dddddd;
|
|
||||||
border-radius: 28px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 52px;
|
|
||||||
}
|
|
||||||
.order_address_text_no{
|
|
||||||
flex: 1;
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
|
||||||
.order_address_more_icon{
|
|
||||||
color: $color_font_three;
|
|
||||||
font-size: $font_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
.order_address_list {
|
|
||||||
height: 900px;
|
|
||||||
.order_address_title{
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
padding: 20px 0 30px 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
import AddressList from "@/components/AddressList";
|
|
||||||
import Popup from "@/components/popup";
|
|
||||||
import { Text, View } from "@tarojs/components"
|
|
||||||
import classnames from "classnames";
|
|
||||||
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
export type AddressInfoParam = {
|
|
||||||
province_name: string,
|
|
||||||
city_name: string,
|
|
||||||
district_name: string,
|
|
||||||
address_detail: string,
|
|
||||||
id?: number,
|
|
||||||
name: string,
|
|
||||||
phone: string
|
|
||||||
}
|
|
||||||
type Param = {
|
|
||||||
onSelect?: (val:any) => void, //选择
|
|
||||||
defaultValue?: AddressInfoParam|null //默认值
|
|
||||||
disabled?: false|true //true禁用后只用于展示
|
|
||||||
}
|
|
||||||
|
|
||||||
export default memo(({onSelect, defaultValue = null, disabled = false}: Param) => {
|
|
||||||
const [showAddressList, setShowAddressList] = useState(false)
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setUserInfo(() => defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
//选择地址
|
|
||||||
const [userInfo, setUserInfo] = useState<any>()
|
|
||||||
const getAddress = useCallback((val) => {
|
|
||||||
setShowAddressList(() => false)
|
|
||||||
setUserInfo(() => val)
|
|
||||||
onSelect?.(val)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
//地址格式
|
|
||||||
const formatAddress = useMemo(() => {
|
|
||||||
if(userInfo)
|
|
||||||
return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail
|
|
||||||
}, [userInfo])
|
|
||||||
|
|
||||||
const changeShow = () => {
|
|
||||||
if(!disabled)
|
|
||||||
setShowAddressList(() => true)
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
|
||||||
<View className={classnames(styles.order_address_icon, 'iconfont icon-daohang')}></View>
|
|
||||||
{!userInfo&&
|
|
||||||
<>
|
|
||||||
<View className={styles.order_address_text_no}>请选择收货地址及信息</View>
|
|
||||||
<View className={classnames(styles.order_address_more_icon, 'iconfont icon-a-moreback')}></View>
|
|
||||||
</>
|
|
||||||
||<>
|
|
||||||
<View className={styles.order_address_text_con}>
|
|
||||||
<View className={styles.order_address_text_name}>
|
|
||||||
<Text>{userInfo?.name}</Text>
|
|
||||||
<Text>{userInfo?.phone}</Text>
|
|
||||||
</View>
|
|
||||||
<View className={styles.order_address_text_title}>{formatAddress}</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.updateBtn}>修改</View>
|
|
||||||
</>}
|
|
||||||
</View>
|
|
||||||
{!disabled&&<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
|
||||||
<View className={styles.order_address_list}>
|
|
||||||
<View className={styles.order_address_title}>请选择收货地址</View>
|
|
||||||
<AddressList onSelect={(item) => getAddress(item)}/>
|
|
||||||
</View>
|
|
||||||
</Popup>}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,117 +0,0 @@
|
|||||||
.order_address{
|
|
||||||
height: 178px;
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 30px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-top: 20px;
|
|
||||||
position: relative;
|
|
||||||
.order_address_icon{
|
|
||||||
font-size: 50px;
|
|
||||||
color: $color_main;
|
|
||||||
position: absolute;
|
|
||||||
top: 35px;
|
|
||||||
left: 20px;
|
|
||||||
}
|
|
||||||
.order_address_text_con{
|
|
||||||
flex:1;
|
|
||||||
padding-left: 50px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
.order_address_text_title{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
margin-top: 10px;
|
|
||||||
@include common_ellipsis;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
.moreIconfont{
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_address_text_name{
|
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
text{
|
|
||||||
&:nth-child(1) {
|
|
||||||
color: #000;
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: $color_font_one;
|
|
||||||
margin-right: 40px;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
color: $color_font_one;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.updateBtn{
|
|
||||||
width:200px;
|
|
||||||
font-size: $font_size_min;
|
|
||||||
background-color: #F0F0F0;
|
|
||||||
height: 64px;
|
|
||||||
border-radius: 24px;
|
|
||||||
color: $color_font_two;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 10px;
|
|
||||||
right: 10px;
|
|
||||||
z-index: 999;
|
|
||||||
.updateBtn_list{
|
|
||||||
position: absolute;
|
|
||||||
display: flex;
|
|
||||||
z-index: 5;
|
|
||||||
width: 100%;
|
|
||||||
.updateBtn_item_select{
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.updateBtn_item{
|
|
||||||
flex:1;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 64px;
|
|
||||||
}
|
|
||||||
.updateBtn_select{
|
|
||||||
color: #fff;
|
|
||||||
background-color: $color_main;
|
|
||||||
border-radius: 24px;
|
|
||||||
position: absolute;
|
|
||||||
width: 100px;
|
|
||||||
height: 61px;
|
|
||||||
z-index: 1;
|
|
||||||
transition: all 0.3s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
.order_address_text_no{
|
|
||||||
flex: 1;
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
|
||||||
.order_address_more_icon{
|
|
||||||
color: $color_font_three;
|
|
||||||
font-size: $font_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
.order_address_list {
|
|
||||||
height:80vh;
|
|
||||||
.order_address_title{
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
padding: 20px 0 30px 0;
|
|
||||||
height: 100px;
|
|
||||||
}
|
|
||||||
.addressList_con{
|
|
||||||
padding-bottom: 20px;
|
|
||||||
height: calc(100% - 160px);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order";
|
|
||||||
import { alert } from "@/common/common";
|
|
||||||
import { debounce } from "@/common/util";
|
|
||||||
import AddressList from "@/components/AddressList";
|
|
||||||
import Popup from "@/components/popup";
|
|
||||||
import { Text, View } from "@tarojs/components"
|
|
||||||
import classnames from "classnames";
|
|
||||||
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useState } from "react";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
export type AddressInfoParam = {
|
|
||||||
province_name: string,
|
|
||||||
city_name: string,
|
|
||||||
district_name: string,
|
|
||||||
address_detail: string,
|
|
||||||
id?: number,
|
|
||||||
name: string,
|
|
||||||
phone: string,
|
|
||||||
}
|
|
||||||
type Param = {
|
|
||||||
onSelect?: (val:any) => void, //选择
|
|
||||||
defaultValue?: AddressInfoParam|null, //默认值
|
|
||||||
disabled?: false|true, //true禁用后只用于展示
|
|
||||||
shipment_mode?: 1|2, //1自提 2物流
|
|
||||||
onChangeShipmentMode?: (val: number) => void, //返回收货方式
|
|
||||||
orderId?: number //订单id
|
|
||||||
}
|
|
||||||
|
|
||||||
export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderId = 0, shipment_mode = 1}: Param, ref) => {
|
|
||||||
const [showAddressList, setShowAddressList] = useState(false)
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setUserInfo(() => defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
const [userInfo, setUserInfo] = useState<any>()
|
|
||||||
|
|
||||||
//地址格式
|
|
||||||
const formatAddress = useMemo(() => {
|
|
||||||
if(userInfo)
|
|
||||||
return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail
|
|
||||||
}, [userInfo])
|
|
||||||
|
|
||||||
const changeShow = () => {
|
|
||||||
if(receivingStatus == 2)
|
|
||||||
setShowAddressList(() => true)
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setReceivingStatus(() => shipment_mode)
|
|
||||||
}, [shipment_mode])
|
|
||||||
|
|
||||||
//把内部方法提供给外部
|
|
||||||
useImperativeHandle(ref, () => ({
|
|
||||||
changeShow
|
|
||||||
}))
|
|
||||||
|
|
||||||
//收货方法,1:自提,2物流
|
|
||||||
const [receivingStatus, setReceivingStatus] = useState(1)
|
|
||||||
const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi()
|
|
||||||
const onReceivingStatus = (value, e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
changeReceivingStatus(value)
|
|
||||||
}
|
|
||||||
const changeReceivingStatus = debounce(async (value) => {
|
|
||||||
alert.loading('正在修改')
|
|
||||||
const res = await shipmentModeFetchData({id: orderId, shipment_mode:value})
|
|
||||||
if(res.success) {
|
|
||||||
alert.success('收货方式修改成功')
|
|
||||||
onChangeShipmentMode?.(value)
|
|
||||||
setReceivingStatus(value)
|
|
||||||
} else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
}, 10)
|
|
||||||
|
|
||||||
//修改地址
|
|
||||||
const [addressId, setAddressId] = useState(0)
|
|
||||||
const {fetchData: addressFetchData} = EditSaleOrderAddressApi()
|
|
||||||
const getAddress = async (value) => {
|
|
||||||
alert.loading('正在修改')
|
|
||||||
const res = await addressFetchData({id: orderId, address_id: value.id})
|
|
||||||
if(res.success) {
|
|
||||||
alert.success('地址修改成功')
|
|
||||||
onSelect?.(value)
|
|
||||||
setShowAddressList(() => false)
|
|
||||||
setAddressId(value.id)
|
|
||||||
setUserInfo(() => value)
|
|
||||||
} else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
|
||||||
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2?'icon-daohang':'icon-fahuo')}></View>
|
|
||||||
<View className={styles.order_address_text_con}>
|
|
||||||
<View className={styles.order_address_text_title}>
|
|
||||||
<Text>{formatAddress}</Text>
|
|
||||||
{(receivingStatus == 2)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
|
||||||
</View>
|
|
||||||
<View className={styles.order_address_text_name}>
|
|
||||||
<Text>{userInfo?.name}</Text>
|
|
||||||
<Text>{userInfo?.phone}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.updateBtn}>
|
|
||||||
<View className={styles.updateBtn_list}>
|
|
||||||
<View className={classnames(styles.updateBtn_item, receivingStatus==1&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(1,e)}>自提</View>
|
|
||||||
<View className={classnames(styles.updateBtn_item, receivingStatus==2&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(2,e)}>物流</View>
|
|
||||||
</View>
|
|
||||||
<View style={{transform: receivingStatus==1?'translateX(0)':'translateX(100%)'}} className={classnames(styles.updateBtn_select)}></View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
|
||||||
<View className={styles.order_address_list}>
|
|
||||||
<View className={styles.order_address_title}>请选择收货地址</View>
|
|
||||||
<View className={styles.addressList_con}>
|
|
||||||
<AddressList onSelect={getAddress} id={addressId}/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</Popup>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}))
|
|
@ -1,35 +0,0 @@
|
|||||||
.order_price_num{
|
|
||||||
color: $color_main;
|
|
||||||
font-weight: 700;
|
|
||||||
text{
|
|
||||||
&:nth-child(1) {
|
|
||||||
font-size: $font_size_min;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: $font_size;
|
|
||||||
}
|
|
||||||
&:nth-child(3) {
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.emphasis_num{
|
|
||||||
.price_text{
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: $font_size_big;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.emphasis_num_big{
|
|
||||||
.price_text{
|
|
||||||
&:nth-child(1) {
|
|
||||||
font-size: $font_size_big;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: 60px;
|
|
||||||
}
|
|
||||||
&:nth-child(1) {
|
|
||||||
font-size: $font_size_big;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
import { Text, View } from "@tarojs/components";
|
|
||||||
import { memo, useCallback } from "react";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
import classnames from "classnames";
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
number: number, //数字
|
|
||||||
status: 0|1|2 //0 小型,1中型,2大
|
|
||||||
}
|
|
||||||
export default memo(({number = 0, status = 1}:Param) => {
|
|
||||||
const priceDom = useCallback(() => {
|
|
||||||
let res = number.toFixed(2).split('.')
|
|
||||||
let int_num = parseInt(res[0]) + ''
|
|
||||||
let decimals_num = res[1]
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Text className={styles.price_text}>¥</Text>
|
|
||||||
<Text className={styles.price_text}>{Number(int_num).toLocaleString()}</Text>
|
|
||||||
<Text className={styles.price_text}>.{decimals_num}</Text>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}, [number])
|
|
||||||
return (
|
|
||||||
<View className={classnames(styles.order_price_num, status==1&&styles.emphasis_num, status==2&&styles.emphasis_num_big)} >
|
|
||||||
{priceDom()}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,70 +0,0 @@
|
|||||||
.order_price{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
width: 100%;
|
|
||||||
&:nth-last-child(n+2) {
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
.order_price_text{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
// margin-right: 10px;
|
|
||||||
display: flex;
|
|
||||||
.iconfont_msg{
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.miconfont{
|
|
||||||
font-size: 26px;
|
|
||||||
font-weight: normal;
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
.message{
|
|
||||||
position: absolute;
|
|
||||||
top: -50px;
|
|
||||||
background: #A8B3BD;
|
|
||||||
z-index: 9;
|
|
||||||
min-height: 50px;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
&::before{
|
|
||||||
z-index: 1;
|
|
||||||
position: absolute;
|
|
||||||
bottom: -7px;
|
|
||||||
left: 10px;
|
|
||||||
width: 15px;
|
|
||||||
height: 15px;
|
|
||||||
content: " ";
|
|
||||||
transform: rotate(45deg);
|
|
||||||
background: #A8B3BD;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.emphasis{
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.order_price_num{
|
|
||||||
color: $color_main;
|
|
||||||
font-weight: 700;
|
|
||||||
text{
|
|
||||||
&:nth-child(1) {
|
|
||||||
font-size: $font_size_min;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
&:nth-child(3) {
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.emphasis_num{
|
|
||||||
text{
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: $font_size_big;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
import { Text, View } from "@tarojs/components"
|
|
||||||
import { memo, useCallback, useEffect, useMemo } from "react"
|
|
||||||
import {formatKbPrice} from '@/common/common'
|
|
||||||
import classnames from "classnames";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
import AmountShow from "../amountShow";
|
|
||||||
type Param = {
|
|
||||||
style?: Object,
|
|
||||||
number?: number,
|
|
||||||
title?: string,
|
|
||||||
titleStatus?: true|false, //true 标题加大加深
|
|
||||||
numberStatus?: 0|1|2, //数字尺寸
|
|
||||||
}
|
|
||||||
export default memo(({style, number = 0, titleStatus = true, title = '', numberStatus = 1}:Param) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<View className={styles.order_price}>
|
|
||||||
<View className={classnames(styles.order_price_text, titleStatus&&styles.emphasis)}>
|
|
||||||
<Text>{title}</Text>
|
|
||||||
<View className={styles.iconfont_msg}>
|
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont icon-zhushi')}></Text>
|
|
||||||
{/* <View className={classnames(styles.message)}>123123123121212312312312312</View> */}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<AmountShow status={numberStatus} number={number}/>
|
|
||||||
</View>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,108 +0,0 @@
|
|||||||
|
|
||||||
.orders_list_title{
|
|
||||||
padding: 20px 20px 10px 20px;
|
|
||||||
color: $color_font_two;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
.orders_list_con{
|
|
||||||
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
.order_list{
|
|
||||||
&:nth-child(n+2) {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
.order_list_title{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
.tag{
|
|
||||||
font-size: $font_size_min;
|
|
||||||
background-color: #CDE5FF;
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 6px;
|
|
||||||
color: $color_main;
|
|
||||||
}
|
|
||||||
.title{
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: $font_size;
|
|
||||||
margin-left: 20px;
|
|
||||||
flex:1;
|
|
||||||
}
|
|
||||||
.num{
|
|
||||||
color: $color_font_two;
|
|
||||||
font-size: $font_size_min;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_list_scroll{
|
|
||||||
margin-top: 30px;
|
|
||||||
|
|
||||||
.order_list_item {
|
|
||||||
display: flex;
|
|
||||||
&:nth-child(2) {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
.order_list_item_img{
|
|
||||||
width: 126px;
|
|
||||||
height: 126px;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
.order_list_item_con{
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
flex:1;
|
|
||||||
border-bottom: 1px solid #f0f0f0;
|
|
||||||
height: 150px;
|
|
||||||
padding-top: 20px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.order_list_item_des{
|
|
||||||
flex:1;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding-left: 30px;
|
|
||||||
.order_list_item_title{
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: $font_size;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
.order_list_item_price{
|
|
||||||
font-size: 26px;
|
|
||||||
color: $color_font_three;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_list_item_count{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: flex-end;
|
|
||||||
.count_num{
|
|
||||||
color: $color_main;
|
|
||||||
font-size: $font_size;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
font-weight: 400;
|
|
||||||
text{
|
|
||||||
font-size: $font_size_min;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.count_price {
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
text{
|
|
||||||
font-size: $font_size_min;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_estimated_amount{
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 30px 0;
|
|
||||||
.order_price_des{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
color: $color_font_two;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,169 +0,0 @@
|
|||||||
import { ORDER_STATUS } from "@/common/enum"
|
|
||||||
import { formatHashTag, formatPriceDiv } from "@/common/fotmat"
|
|
||||||
import LabAndImg from "@/components/LabAndImg"
|
|
||||||
import { View } from "@tarojs/components"
|
|
||||||
import { memo, useCallback, useMemo } from "react"
|
|
||||||
import EstimatedAmount from "../estimatedAmount"
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
type OrderParam = {
|
|
||||||
estimate_amount: number, //预估金额
|
|
||||||
list: any[],
|
|
||||||
sale_mode: number,
|
|
||||||
sale_mode_name: string,
|
|
||||||
unit: string,
|
|
||||||
total_colors: number,
|
|
||||||
total_fabrics: number,
|
|
||||||
total_number: number,
|
|
||||||
status: number, //订单状态
|
|
||||||
total_sale_price: number, //销售金额
|
|
||||||
total_should_collect_money: number, //应收金额
|
|
||||||
total_weight_error_discount: number, //空差优惠
|
|
||||||
the_previous_status: number, //取消订单时的订单状态
|
|
||||||
actual_amount: number //实付金额
|
|
||||||
}
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
order: OrderParam,
|
|
||||||
comfirm?: boolean //是否是确认订单页面使用
|
|
||||||
}
|
|
||||||
|
|
||||||
export default memo(({order, comfirm = false}:Param) => {
|
|
||||||
//对应数量
|
|
||||||
const formatCount = useCallback((item) => {
|
|
||||||
return order?.sale_mode == 0? item.roll : Number(item.length / 100)
|
|
||||||
}, [order])
|
|
||||||
//对应单价
|
|
||||||
const standardPrice = useCallback(price => {
|
|
||||||
return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg')
|
|
||||||
}, [order])
|
|
||||||
|
|
||||||
//数量格式
|
|
||||||
const numText = useMemo(() => {
|
|
||||||
if(order)
|
|
||||||
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
|
|
||||||
}, [order])
|
|
||||||
|
|
||||||
const {
|
|
||||||
SaleOrderStatusBooking, // 待接单
|
|
||||||
SaleOrderStatusArranging, // 配布中
|
|
||||||
SaleOrderStatusArranged, // 已配布
|
|
||||||
SaleOrderStatusWaitingPayment, // 待付款
|
|
||||||
SaleOrderStatusWaitingDelivery, // 待发货
|
|
||||||
SaleOrderStatusWaitingReceipt, // 待收货
|
|
||||||
SaleOrderStatusAlreadyReceipt, // 已收货
|
|
||||||
SaleOrderStatusComplete, // 已完成
|
|
||||||
SaleOrderStatusRefund, // 已退款
|
|
||||||
SaleOrderStatusCancel, // 已取消
|
|
||||||
} = ORDER_STATUS
|
|
||||||
|
|
||||||
//金额列表枚举
|
|
||||||
const priceList = [
|
|
||||||
{
|
|
||||||
id:1,
|
|
||||||
value:[SaleOrderStatusBooking.value, SaleOrderStatusArranging.value],
|
|
||||||
label:'预估金额',
|
|
||||||
field: 'estimate_amount'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:2,
|
|
||||||
value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
|
||||||
label:'合计金额',
|
|
||||||
field: 'total_sale_price'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:3,
|
|
||||||
value:[SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
|
||||||
label:'空差优惠',
|
|
||||||
field: 'total_weight_error_discount'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:4,
|
|
||||||
value:[ SaleOrderStatusWaitingPayment.value],
|
|
||||||
label:'应付金额',
|
|
||||||
field: 'total_should_collect_money'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:5,
|
|
||||||
value:[SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
|
||||||
label:'实付金额',
|
|
||||||
field: 'actual_amount'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
//是否显示价格
|
|
||||||
const showPrice = useCallback((priceInfo, status) => {
|
|
||||||
return priceInfo.value.includes(status)
|
|
||||||
}, [order])
|
|
||||||
|
|
||||||
const priceConDom = useMemo(() => {
|
|
||||||
if(!order) return
|
|
||||||
//确认订单
|
|
||||||
if(comfirm == true) {
|
|
||||||
return <EstimatedAmount number={formatPriceDiv(order.estimate_amount)} title="预估金额" />
|
|
||||||
}
|
|
||||||
//订单为取消订单状态
|
|
||||||
if(order?.status == SaleOrderStatusCancel.value) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{
|
|
||||||
priceList.map(item => {
|
|
||||||
return <>{showPrice(item, order?.the_previous_status)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{
|
|
||||||
priceList.map(item => {
|
|
||||||
return <>{showPrice(item, order?.status)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}, [order])
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<View className={styles.orders_list_title}>{numText}</View>
|
|
||||||
<View className={styles.orders_list_con}>
|
|
||||||
{
|
|
||||||
order?.list?.map(item => {
|
|
||||||
return <View key={item.product_code} className={styles.order_list}>
|
|
||||||
<View className={styles.order_list_title}>
|
|
||||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
|
||||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
|
||||||
<View className={styles.num}>共{item?.product_colors.length}种</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.order_list_scroll}>
|
|
||||||
{item?.product_colors?.map(colorItem => {
|
|
||||||
return <View key={colorItem.id} className={styles.order_list_item}>
|
|
||||||
<View className={styles.order_list_item_img}>
|
|
||||||
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
|
|
||||||
</View>
|
|
||||||
<View className={styles.order_list_item_con}>
|
|
||||||
<View className={styles.order_list_item_des}>
|
|
||||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
|
||||||
<View className={styles.order_list_item_price}>¥{standardPrice(colorItem.sale_price)}</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.order_list_item_count}>
|
|
||||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
|
||||||
<View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
})}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
})
|
|
||||||
}
|
|
||||||
<View className={styles.order_estimated_amount}>
|
|
||||||
{priceConDom}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,46 +0,0 @@
|
|||||||
$top:170px;
|
|
||||||
.offlinePay_main{
|
|
||||||
.offlinePay_con{
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #F6F6F6;
|
|
||||||
border-radius: 20px;
|
|
||||||
.miconfont_title{
|
|
||||||
transform: rotate(-180deg);
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
top: 27px;
|
|
||||||
font-size: 37px;
|
|
||||||
color: $color_font_three;
|
|
||||||
z-index: 99;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.title{
|
|
||||||
font-size: $font_size_big;
|
|
||||||
color: #000000;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 700;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.offlinePay_list{
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 60px 0;
|
|
||||||
.offlinePay_con_text{
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.btns{
|
|
||||||
background: #007aff;
|
|
||||||
border-radius: 40px;
|
|
||||||
width: 668px;
|
|
||||||
height: 82px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 80px;
|
|
||||||
width: 100%;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32px;
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
import { Text, View } from "@tarojs/components";
|
|
||||||
import { memo } from "react";
|
|
||||||
import AmountShow from "../amountShow";
|
|
||||||
import classnames from "classnames";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
import MCheckbox from "@/components/checkbox";
|
|
||||||
import Popup from "@/components/popup";
|
|
||||||
import SearchInput from "@/components/searchInput";
|
|
||||||
import Taro from "@tarojs/taro";
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
show?: true|false,
|
|
||||||
onClose?: () => void
|
|
||||||
}
|
|
||||||
export default memo(({show = true, onClose}:Param) => {
|
|
||||||
//复制功能
|
|
||||||
const clipboardData = () => {
|
|
||||||
Taro.setClipboardData({
|
|
||||||
data: '开户名称:佛山市浩川盛世科技有限公司; 开户银行:招商银行汾江支行; 转账汇款账号:62062342120001221231212',
|
|
||||||
success: function (res) {
|
|
||||||
Taro.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: '复制成功'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<View className={styles.offlinePay_main}>
|
|
||||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
|
||||||
<View className={styles.offlinePay_con}>
|
|
||||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_title)} onClick={onClose}></View>
|
|
||||||
<View className={styles.title}>线下汇款</View>
|
|
||||||
<View className={styles.offlinePay_list}>
|
|
||||||
<SearchInput showBorder={false} title='开户名称' titleStyle={{fontSize:'23rpx'}}>
|
|
||||||
<Text className={styles.offlinePay_con_text}>佛山市浩川盛世科技有限公司</Text>
|
|
||||||
</SearchInput>
|
|
||||||
<SearchInput showBorder={false} title='开户银行' titleStyle={{fontSize:'23rpx'}}>
|
|
||||||
<Text className={styles.offlinePay_con_text}>招商银行汾江支行</Text>
|
|
||||||
</SearchInput>
|
|
||||||
<SearchInput showBorder={false} title='转账汇款账号' titleStyle={{fontSize:'23rpx'}}>
|
|
||||||
<Text className={styles.offlinePay_con_text}>62062342120001221231212</Text>
|
|
||||||
</SearchInput>
|
|
||||||
</View>
|
|
||||||
<View className={styles.btns} onClick={clipboardData}>复制信息</View>
|
|
||||||
</View>
|
|
||||||
</Popup>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,18 +0,0 @@
|
|||||||
.order_flow_state{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 30px;
|
|
||||||
height: 116px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 20px;
|
|
||||||
.order_flow_state_text{
|
|
||||||
color: $color_main;
|
|
||||||
font-size:$font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.order_flow_state_desc{
|
|
||||||
color: $color_font_three;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
margin-left: 50px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
import { View } from "@tarojs/components"
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
export default ({
|
|
||||||
state = '',
|
|
||||||
desc = ''
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<View className={styles.order_flow_state}>
|
|
||||||
<View className={styles.order_flow_state_text}>{state}</View>
|
|
||||||
<View className={styles.order_flow_state_desc}>{desc}</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
.order_flow_state{
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
box-sizing:border-box;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
.order_status_list{
|
|
||||||
max-height: 250px;
|
|
||||||
overflow: hidden;
|
|
||||||
transition: all 0.3s ease-in-out;
|
|
||||||
}
|
|
||||||
.order_status_list_show {
|
|
||||||
max-height: 1000px !important;
|
|
||||||
}
|
|
||||||
.order_status_item{
|
|
||||||
position: relative;
|
|
||||||
padding-left: 50px;
|
|
||||||
&:nth-last-child(n+2) {
|
|
||||||
padding-bottom: 30px;
|
|
||||||
}
|
|
||||||
.order_status_tail_end, .order_status_tail{
|
|
||||||
width: 15px;
|
|
||||||
height: 15px;
|
|
||||||
border: 2px solid $color_main;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
position:absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 10px;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
.order_status_tail_end{
|
|
||||||
background-color: $color_main;
|
|
||||||
}
|
|
||||||
.order_status_line{
|
|
||||||
border-left: 2px solid $color_main;
|
|
||||||
height: 100%;
|
|
||||||
top: 10px;
|
|
||||||
left: 9px;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
.order_status_content{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
.order_status_title{
|
|
||||||
color: $color_font_two;
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.order_status_time{
|
|
||||||
color: $color_font_two;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
|
||||||
.order_status_tag{
|
|
||||||
font-size: $font_size_min;
|
|
||||||
background: #F0F0F0;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
color: $color_font_two;
|
|
||||||
}
|
|
||||||
.order_status_select{
|
|
||||||
color: $color_main;
|
|
||||||
}
|
|
||||||
.order_status_tag_select{
|
|
||||||
color: $color_main;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_status_des{
|
|
||||||
color: $color_font_two;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
.order_status_des_select{
|
|
||||||
color: $color_font_one;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.more{
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
font-size: $font_size_min;
|
|
||||||
color: $color_font_one;
|
|
||||||
padding-top: 20px;
|
|
||||||
.miconfonts{
|
|
||||||
display: inline-block;
|
|
||||||
font-size: 25px;
|
|
||||||
transform:rotate(90deg);
|
|
||||||
}
|
|
||||||
.open_miconfonts{
|
|
||||||
transform:rotate(-90deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.image_tag{
|
|
||||||
width: 140px;
|
|
||||||
height: 144px;
|
|
||||||
.image{
|
|
||||||
width: 140px;
|
|
||||||
height: 144px;
|
|
||||||
}
|
|
||||||
position: absolute;
|
|
||||||
top: -10px;
|
|
||||||
right: -10px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
import { Image, Text, View } from "@tarojs/components"
|
|
||||||
import { memo, useMemo, useState } from "react"
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
import classnames from "classnames";
|
|
||||||
import { formatDateTime, formatImgUrl } from "@/common/fotmat";
|
|
||||||
import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
list: {
|
|
||||||
status: string,
|
|
||||||
time: string,
|
|
||||||
tag: string,
|
|
||||||
desc: string
|
|
||||||
}[],
|
|
||||||
payment_method: 0|PAYMENT_METHOD_PARAM,
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//支付方式枚举
|
|
||||||
const {
|
|
||||||
PaymentMethodAccountPeriod,
|
|
||||||
PaymentMethodCashOnDelivery,
|
|
||||||
} = PAYMENT_METHOD
|
|
||||||
|
|
||||||
export default memo(({list = [], payment_method = 0}:Param) => {
|
|
||||||
|
|
||||||
const [showMore, setShowMore] = useState(false)
|
|
||||||
const changeMore = () => {
|
|
||||||
setShowMore(() => !showMore)
|
|
||||||
}
|
|
||||||
const dataList = useMemo(() => {
|
|
||||||
return list.reverse()
|
|
||||||
}, [list])
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{(dataList.length > 0)&&<View className={styles.order_flow_state}>
|
|
||||||
<View className={classnames(styles.order_status_list, showMore&&styles.order_status_list_show)}>
|
|
||||||
{dataList.map((item, index) => <View className={styles.order_status_item}>
|
|
||||||
{(dataList.length > 1)&&<View className={classnames(styles.order_status_tail, (index == 0)&&styles.order_status_tail_end)}></View>}
|
|
||||||
{(dataList.length != (index + 1))&&<View className={styles.order_status_line}></View>}
|
|
||||||
<View className={styles.order_status_content}>
|
|
||||||
<View className={classnames(styles.order_status_title, (index == 0)&&styles.order_status_select)}>{item.status}</View>
|
|
||||||
<View className={classnames(styles.order_status_time, (index == 0)&&styles.order_status_select)}>{formatDateTime(item.time)}</View>
|
|
||||||
{/* <View className={classnames(styles.order_status_tag, (index == 0)&&styles.order_status_tag_select)}>{item.tag}</View> */}
|
|
||||||
</View>
|
|
||||||
<Text className={classnames(styles.order_status_des, (index == 0)&&styles.order_status_des_select)}>{item.desc}</Text>
|
|
||||||
</View>)}
|
|
||||||
</View>
|
|
||||||
{(dataList.length > 2) && <View className={styles.more} onClick={() => changeMore()}>
|
|
||||||
<Text>{showMore&&'收起详情'||'点击查看详情'}</Text>
|
|
||||||
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore&&styles.open_miconfonts)}></Text>
|
|
||||||
</View>}
|
|
||||||
<View className={styles.image_tag}>
|
|
||||||
{(payment_method == PaymentMethodCashOnDelivery.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status.png')} className={styles.image}/>}
|
|
||||||
{(payment_method == PaymentMethodAccountPeriod.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status_7day.png')} className={styles.image}/>}
|
|
||||||
</View>
|
|
||||||
</View>}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,126 +0,0 @@
|
|||||||
$top:190px;
|
|
||||||
.payment_main{
|
|
||||||
.payment_con{
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #F6F6F6;
|
|
||||||
border-radius: 20px;
|
|
||||||
.miconfont_title{
|
|
||||||
transform: rotate(-180deg);
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
top: 27px;
|
|
||||||
font-size: 37px;
|
|
||||||
color: $color_font_three;
|
|
||||||
z-index: 99;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
.title{
|
|
||||||
font-size: $font_size_big;
|
|
||||||
color: #000000;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 700;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
}
|
|
||||||
.amount{
|
|
||||||
text-align: center;
|
|
||||||
padding: 25px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment_list{
|
|
||||||
background-color: #fff;
|
|
||||||
// box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.16);
|
|
||||||
min-height: 300px;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding-bottom: 100px;
|
|
||||||
position: relative;
|
|
||||||
background: radial-gradient(circle 20px at left $top, transparent 20px, #fff 20px + 3px) left 0px/60% no-repeat ,
|
|
||||||
radial-gradient(circle 20px at right $top, transparent 20px, #fff 20px + 3px) right 0px/60% no-repeat;
|
|
||||||
filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, .16));
|
|
||||||
position: relative;
|
|
||||||
&::before{
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
border-bottom: 3px dashed #ccc;
|
|
||||||
top: $top;
|
|
||||||
width: calc(100% - 100px);
|
|
||||||
left:0;
|
|
||||||
right: 0;
|
|
||||||
margin: auto;
|
|
||||||
|
|
||||||
}
|
|
||||||
.payment_list_top_border{
|
|
||||||
height: 32px;
|
|
||||||
width: 100%;
|
|
||||||
background: linear-gradient(215deg,#cde5ff 2%, #cde5ff 2%, #68b4ff 72%);
|
|
||||||
border-radius: 10px 10px 0px 0px;
|
|
||||||
}
|
|
||||||
.payment_list_title{
|
|
||||||
text-align: center;
|
|
||||||
padding: 30px 0 50px 0;
|
|
||||||
font-size: $font_size;
|
|
||||||
color: $color_font_three;
|
|
||||||
.payment_list_title_price_item{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 0 90px;
|
|
||||||
&:nth-child(1) {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text{
|
|
||||||
&:nth-child(2) {
|
|
||||||
color: $color_main;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.payment_list_con{
|
|
||||||
padding: 20px 30px 0 30px;
|
|
||||||
.payment_list_item{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
height: 123px;
|
|
||||||
&:nth-last-child(n+2) {
|
|
||||||
border-bottom: 2px solid #F3F3F3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.payment_list_item_left{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
font-size: $font_size;
|
|
||||||
.payment_list_item_left_name{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.miconfont{
|
|
||||||
font-size: 30px;
|
|
||||||
color: #FFC300;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
.payment_list_item_left_price{
|
|
||||||
font-size: $font_size_min;
|
|
||||||
color: $color_font_two;
|
|
||||||
padding-left: 35px;
|
|
||||||
padding-top: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.miconfont_more{
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.btns{
|
|
||||||
background: #007aff;
|
|
||||||
border-radius: 40px;
|
|
||||||
width: 668px;
|
|
||||||
height: 82px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 80px;
|
|
||||||
width: 100%;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32px;
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,185 +0,0 @@
|
|||||||
import { Text, View } from "@tarojs/components";
|
|
||||||
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
||||||
import AmountShow from "../amountShow";
|
|
||||||
import classnames from "classnames";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
import MCheckbox from "@/components/checkbox";
|
|
||||||
import Popup from "@/components/popup";
|
|
||||||
import OfflinePay from "../offlinePay";
|
|
||||||
import ScanPay from "../scanPay";
|
|
||||||
import { GetOrderPayApi, SubmitOrderPayApi } from "@/api/orderPay";
|
|
||||||
import { formatPriceDiv } from "@/common/fotmat";
|
|
||||||
import {alert} from "@/common/common"
|
|
||||||
import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
show?: true|false,
|
|
||||||
onClose?: () => void,
|
|
||||||
onSubmitSuccess?: () => void, //支付成功
|
|
||||||
orderInfo?: OrderInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
type OrderInfo = {
|
|
||||||
orderId: number, //应付单id
|
|
||||||
payment_method: 0|PAYMENT_METHOD_PARAM //支付方式
|
|
||||||
}
|
|
||||||
|
|
||||||
type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
|
|
||||||
export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) => {
|
|
||||||
|
|
||||||
//提交参数
|
|
||||||
const [submitData, setSubmitData] = useState<{id:number, payment_method: PayStatus}>({
|
|
||||||
id:0,
|
|
||||||
payment_method: null
|
|
||||||
})
|
|
||||||
|
|
||||||
//线下付款
|
|
||||||
const [offlinePayShow, setofflinePayShow] = useState(false)
|
|
||||||
const onShowOfflinePay = () => {
|
|
||||||
setofflinePayShow(true)
|
|
||||||
onClose?.()
|
|
||||||
}
|
|
||||||
|
|
||||||
//扫码支付
|
|
||||||
const [scanPayShow, setScanPayShow] = useState(false)
|
|
||||||
const onShowScanPay = () => {
|
|
||||||
setScanPayShow(true)
|
|
||||||
onClose?.()
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取支付方式数据
|
|
||||||
const [payInfo, setPayInfo] = useState<any>()
|
|
||||||
const {fetchData: orderFetchData} = GetOrderPayApi()
|
|
||||||
const getOrderPay = async () => {
|
|
||||||
let {data} = await orderFetchData({id: orderInfo?.orderId})
|
|
||||||
setPayInfo(() => data)
|
|
||||||
}
|
|
||||||
useEffect(() => {
|
|
||||||
if(show&&orderInfo?.orderId) {
|
|
||||||
setSubmitData((val) => ({...val, id:orderInfo.orderId}))
|
|
||||||
getOrderPay()
|
|
||||||
}
|
|
||||||
}, [show, orderInfo])
|
|
||||||
|
|
||||||
//预存款选择
|
|
||||||
const advanceSelectData = useCallback((val) => {
|
|
||||||
setSubmitData((e) => ({...e, payment_method:val}))
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
//账期选择
|
|
||||||
const periodSelectData = (val) => {
|
|
||||||
setSubmitData((e) => ({...e, payment_method:val}))
|
|
||||||
}
|
|
||||||
|
|
||||||
//提交支付
|
|
||||||
const {fetchData: submitFetchData} = SubmitOrderPayApi()
|
|
||||||
const submitPay = async () => {
|
|
||||||
if(submitData.payment_method === null) {
|
|
||||||
alert.error('请选择支付方式')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
alert.loading('正在支付')
|
|
||||||
let res = await submitFetchData(submitData)
|
|
||||||
if(res.success) {
|
|
||||||
alert.success('支付成功')
|
|
||||||
onSubmitSuccess?.()
|
|
||||||
} else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//预付款
|
|
||||||
const advance_payment = useMemo(() => {
|
|
||||||
const price = payInfo?.should_collect_money - payInfo?.amount_paid
|
|
||||||
return (
|
|
||||||
<View className={styles.payment_list_item_left_price}>{(payInfo?.advance_deposit_balance < price)&&'余额不足,' }剩余 ¥{formatPriceDiv(payInfo?.advance_deposit_balance)}</View>
|
|
||||||
)
|
|
||||||
}, [payInfo])
|
|
||||||
|
|
||||||
//账期
|
|
||||||
const account_peyment = useMemo(() => {
|
|
||||||
const price = payInfo?.should_collect_money - payInfo?.amount_paid
|
|
||||||
return (
|
|
||||||
<View className={styles.payment_list_item_left_price}>{(payInfo?.account_period_credit_available_line < price)&&'额度不足, '}剩余 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)}</View>
|
|
||||||
)
|
|
||||||
}, [payInfo])
|
|
||||||
|
|
||||||
//支付方式枚举
|
|
||||||
const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod} = PAYMENT_METHOD
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View className={styles.payment_main}>
|
|
||||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
|
||||||
<View className={styles.payment_con}>
|
|
||||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_title)} onClick={onClose}></View>
|
|
||||||
<View className={styles.title}>订单支付</View>
|
|
||||||
<View className={styles.amount}>
|
|
||||||
<AmountShow status={2} number={formatPriceDiv(payInfo?.should_collect_money - payInfo?.amount_paid)}/>
|
|
||||||
</View>
|
|
||||||
<View className={styles.payment_list}>
|
|
||||||
<View className={styles.payment_list_top_border}></View>
|
|
||||||
<View className={styles.payment_list_title}>
|
|
||||||
{/* <Text>向商家发起支付</Text> */}
|
|
||||||
<View className={styles.payment_list_title_price}>
|
|
||||||
<View className={styles.payment_list_title_price_item}>
|
|
||||||
<Text>订单金额</Text>
|
|
||||||
<Text>¥{formatPriceDiv(payInfo?.should_collect_money)}</Text>
|
|
||||||
</View>
|
|
||||||
<View className={styles.payment_list_title_price_item}>
|
|
||||||
<Text>已付金额</Text>
|
|
||||||
<Text>¥{formatPriceDiv(payInfo?.amount_paid)}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.payment_list_con}>
|
|
||||||
<View className={styles.payment_list_item}>
|
|
||||||
<View className={styles.payment_list_item_left}>
|
|
||||||
<View className={styles.payment_list_item_left_name}>
|
|
||||||
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
|
||||||
<View className={styles.payment_list_item_left_text}>预存款</View>
|
|
||||||
</View>
|
|
||||||
{advance_payment}
|
|
||||||
</View>
|
|
||||||
<MCheckbox status={submitData.payment_method == PaymentMethodPreDeposit.value} onSelect={() => advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/>
|
|
||||||
</View>
|
|
||||||
{(orderInfo?.payment_method != PaymentMethodAccountPeriod.value)&&<View className={styles.payment_list_item}>
|
|
||||||
<View className={styles.payment_list_item_left}>
|
|
||||||
<View className={styles.payment_list_item_left_name}>
|
|
||||||
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
|
||||||
<View className={styles.payment_list_item_left_text}>{payInfo?.account_period}天账期</View>
|
|
||||||
</View>
|
|
||||||
{/* <View className={styles.payment_list_item_left_price}>可用额度 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)}</View> */}
|
|
||||||
{account_peyment}
|
|
||||||
</View>
|
|
||||||
<MCheckbox status={submitData.payment_method == PaymentMethodAccountPeriod.value} onSelect={() => periodSelectData(PaymentMethodAccountPeriod.value)} onClose={() => periodSelectData(null)}/>
|
|
||||||
</View>}
|
|
||||||
<View className={styles.payment_list_item} onClick={onShowOfflinePay}>
|
|
||||||
<View className={styles.payment_list_item_left}>
|
|
||||||
<View className={styles.payment_list_item_left_name}>
|
|
||||||
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
|
||||||
<View className={styles.payment_list_item_left_text}>线下汇款</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_more)}></View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.payment_list_item} onClick={onShowScanPay}>
|
|
||||||
<View className={styles.payment_list_item_left}>
|
|
||||||
<View className={styles.payment_list_item_left_name}>
|
|
||||||
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
|
||||||
<View className={styles.payment_list_item_left_text}>扫码支付</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_more)}></View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.btns} onClick={submitPay}>确认交易</View>
|
|
||||||
</View>
|
|
||||||
</Popup>
|
|
||||||
<OfflinePay show={offlinePayShow} onClose={() => setofflinePayShow(false)}/>
|
|
||||||
<ScanPay show={scanPayShow} onClose={() => setScanPayShow(false)}/>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,48 +0,0 @@
|
|||||||
.order_popup{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
padding: 20px 0;
|
|
||||||
.order_popup_title{
|
|
||||||
color: $font_size_big;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #000000;
|
|
||||||
padding-bottom: 20px;
|
|
||||||
}
|
|
||||||
.order_popup_input{
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 25px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-top: 43px;
|
|
||||||
position: relative;
|
|
||||||
.descDataNum{
|
|
||||||
position: absolute;
|
|
||||||
right: 40px;
|
|
||||||
bottom: 10px;
|
|
||||||
height: 39px;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
color: $color_font_two;
|
|
||||||
}
|
|
||||||
textarea{
|
|
||||||
background-color: #f3f3f3;
|
|
||||||
border-radius: 10px;
|
|
||||||
width: 100%;
|
|
||||||
height: 313px;
|
|
||||||
padding: 20px;
|
|
||||||
padding-bottom: 50px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $font_size;
|
|
||||||
border: 2px solid #e6e6e6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_save_address{
|
|
||||||
height: 82px;
|
|
||||||
background: #007aff;
|
|
||||||
border-radius: 40px;
|
|
||||||
width: 668px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 82px;
|
|
||||||
color: #fff;
|
|
||||||
margin-top: 60px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
import Popup from "@/components/popup"
|
|
||||||
import { Textarea, View } from "@tarojs/components"
|
|
||||||
import { useCallback, useState } from "react"
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
onBlur?: (val:any) => void
|
|
||||||
onSave?: (val: string) => void
|
|
||||||
}
|
|
||||||
export default ({onBlur, onSave}:Param) => {
|
|
||||||
const [descData, setDescData] = useState({
|
|
||||||
number: 0,
|
|
||||||
value: '',
|
|
||||||
count: 200
|
|
||||||
})
|
|
||||||
const getDesc = useCallback((e) => {
|
|
||||||
let value = e.detail.value
|
|
||||||
let res = value
|
|
||||||
if(value.length > descData.count) {
|
|
||||||
res = value.slice(0, descData.count)
|
|
||||||
}
|
|
||||||
setDescData({...descData, number:res.length, value: res})
|
|
||||||
},[])
|
|
||||||
|
|
||||||
const setSave = () => {
|
|
||||||
onSave?.(descData.value)
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<View className={styles.order_popup}>
|
|
||||||
<View className={styles.order_popup_title}>编辑备注</View>
|
|
||||||
<View className={styles.order_popup_input}>
|
|
||||||
<Textarea placeholder="请添加备注" maxlength={descData.count} cursorSpacing={100} onInput={(e) => getDesc(e)} onBlur={(e) => onBlur?.(e)}></Textarea>
|
|
||||||
<View className={styles.descDataNum}>{descData.number}/{descData.count}</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.order_save_address} onClick={() => setSave()}>保存</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
$top:170px;
|
|
||||||
.scanPay_main{
|
|
||||||
.scanPay_con{
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #F6F6F6;
|
|
||||||
border-radius: 20px;
|
|
||||||
.miconfont_title{
|
|
||||||
transform: rotate(-180deg);
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
top: 27px;
|
|
||||||
font-size: 37px;
|
|
||||||
color: $color_font_three;
|
|
||||||
z-index: 99;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.title{
|
|
||||||
font-size: $font_size_big;
|
|
||||||
color: #000000;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 700;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.desc{
|
|
||||||
font-size: $font_size_min;
|
|
||||||
color: $color_main;
|
|
||||||
text-align: center;
|
|
||||||
padding: 10px 0;
|
|
||||||
.miconfont{
|
|
||||||
font-size: 25px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.scanPay_list{
|
|
||||||
border-radius: 10px;
|
|
||||||
height: 900px;
|
|
||||||
image{
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.btns{
|
|
||||||
background: #007aff;
|
|
||||||
border-radius: 40px;
|
|
||||||
width: 668px;
|
|
||||||
height: 82px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 80px;
|
|
||||||
width: 100%;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32px;
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
import { Image, ScrollView, Text, View } from "@tarojs/components";
|
|
||||||
import { memo, useEffect, useRef, useState } from "react";
|
|
||||||
import classnames from "classnames";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
import Popup from "@/components/popup";
|
|
||||||
import Taro from "@tarojs/taro";
|
|
||||||
import { alert } from "@/common/common";
|
|
||||||
import { formatImgUrl } from "@/common/fotmat";
|
|
||||||
import useCheckAuthorize from "@/use/useCheckAuthorize";
|
|
||||||
import { GetPayCode } from "@/api/onlinePay";
|
|
||||||
import LoadingCard from "@/components/loadingCard";
|
|
||||||
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
show?: true|false,
|
|
||||||
onClose?: () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
type Item = {
|
|
||||||
product_code: string,
|
|
||||||
product_name: string,
|
|
||||||
product_color_code: string,
|
|
||||||
product_color_name: string,
|
|
||||||
num: string,
|
|
||||||
weight: string,
|
|
||||||
sale_price: string,
|
|
||||||
total_price: string
|
|
||||||
}
|
|
||||||
type CodeParam = {
|
|
||||||
title: string,
|
|
||||||
company: string,
|
|
||||||
order_type: string,
|
|
||||||
sale_user: string,
|
|
||||||
order_created_time: string,
|
|
||||||
order_no: string,
|
|
||||||
department: string,
|
|
||||||
shipment_mode: string,
|
|
||||||
target_user_name: string,
|
|
||||||
target_address: string,
|
|
||||||
target_description: string,
|
|
||||||
pay_account: string,
|
|
||||||
bank_account_name: string,
|
|
||||||
bank_name: string,
|
|
||||||
pay_type: string,
|
|
||||||
client: string,
|
|
||||||
phone: string,
|
|
||||||
order_total_length: string,
|
|
||||||
order_total_price: string,
|
|
||||||
qrcode: string,
|
|
||||||
order_total_weight: string,
|
|
||||||
list: Item[]
|
|
||||||
}
|
|
||||||
export default memo(({show = true, onClose}:Param) => {
|
|
||||||
|
|
||||||
//获取支付二维码
|
|
||||||
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
|
||||||
const fileData = useRef({
|
|
||||||
filePath: '',
|
|
||||||
base64: ''
|
|
||||||
})
|
|
||||||
const {fetchData, state} = GetPayCode()
|
|
||||||
const getCore = async () => {
|
|
||||||
let res = await fetchData({
|
|
||||||
title: "面料销售电子确认单",
|
|
||||||
company: "什么什么公司123",
|
|
||||||
order_type: "散剪",
|
|
||||||
sale_user: "小崔",
|
|
||||||
order_created_time:"2022/02/01 12:32:13",
|
|
||||||
order_no:"XS-211005888",
|
|
||||||
department:"嘻嘻嘻",
|
|
||||||
shipment_mode:"自提",
|
|
||||||
target_user_name:"大崔",
|
|
||||||
target_address:"阿斯顿发斯蒂芬",
|
|
||||||
target_description:"无",
|
|
||||||
pay_account:"1234567890123450001",
|
|
||||||
bank_account_name:"佛山市浩川长盛科技有限公司",
|
|
||||||
bank_name:"招商银行佛山分行禅城支行",
|
|
||||||
pay_type:"现结",
|
|
||||||
client:"客户名称",
|
|
||||||
phone:"15818085802",
|
|
||||||
order_total_length:"12",
|
|
||||||
order_total_price:"63000",
|
|
||||||
qrcode:"https://www.zzfzyc.com/checkorder/XS-211005888",
|
|
||||||
order_total_weight:"300.00",
|
|
||||||
list: [{product_code:'5215',product_name:'26S双纱亲水滑爽棉',product_color_code:'053',product_color_name:'洋红',num:'4',weight:'123.23',sale_price:'43',total_price:'4510.7'}]
|
|
||||||
})
|
|
||||||
const base64 = res.data.base64
|
|
||||||
setPayCodeImage(() => base64)
|
|
||||||
const time = new Date().valueOf()
|
|
||||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || [];
|
|
||||||
let filePath = Taro.env.USER_DATA_PATH + '/img' + time +'.'+ format
|
|
||||||
fileData.current.filePath = filePath
|
|
||||||
fileData.current.base64 = bodyData
|
|
||||||
const save = Taro.getFileSystemManager()
|
|
||||||
save.writeFile({
|
|
||||||
filePath: fileData.current.filePath,
|
|
||||||
data: fileData.current.base64,
|
|
||||||
encoding: 'base64',
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
useEffect(() => {
|
|
||||||
if(show)
|
|
||||||
getCore()
|
|
||||||
}, [show])
|
|
||||||
|
|
||||||
//检查是否开启保存图片权限
|
|
||||||
const {check} = useCheckAuthorize({scope:'scope.writePhotosAlbum', msg:'您没授权,无法保存图片'})
|
|
||||||
const saveImageCheck = async () => {
|
|
||||||
const res = await check()
|
|
||||||
res&&saveImage()
|
|
||||||
}
|
|
||||||
|
|
||||||
//保存图片
|
|
||||||
const saveImage = () => {
|
|
||||||
alert.loading('正在保存图片')
|
|
||||||
Taro.saveImageToPhotosAlbum({
|
|
||||||
filePath: fileData.current.filePath,
|
|
||||||
success: function (res) {
|
|
||||||
alert.success('图片保存成功')
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
console.log('err::', err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//预览图片
|
|
||||||
const showImage = () => {
|
|
||||||
console.log('fileData.current.filePath::', fileData.current.filePath)
|
|
||||||
Taro.previewImage({
|
|
||||||
current: fileData.current.filePath, // 当前显示
|
|
||||||
urls: [fileData.current.filePath] // 需要预览的图片http链接列表
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//复制功能
|
|
||||||
return (
|
|
||||||
<View className={styles.scanPay_main}>
|
|
||||||
<Popup show={show} showTitle={false} onClose={onClose}>
|
|
||||||
<View className={styles.scanPay_con}>
|
|
||||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_title)} onClick={onClose}></View>
|
|
||||||
<View className={styles.title}>扫码支付</View>
|
|
||||||
<View className={styles.desc}>
|
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-zhuyi')}></Text>
|
|
||||||
扫码支付成功后,自动更新状态
|
|
||||||
</View>
|
|
||||||
<View className={styles.scanPay_list}>
|
|
||||||
{(state.loading)&&<LoadingCard/>||
|
|
||||||
<ScrollView scrollY className={styles.scanPay_list}>
|
|
||||||
<Image mode="widthFix" src={payCodeImage} onClick={showImage}></Image>
|
|
||||||
</ScrollView>}
|
|
||||||
</View>
|
|
||||||
<View className={styles.btns} onClick={saveImageCheck}>保存电子确认单</View>
|
|
||||||
</View>
|
|
||||||
</Popup>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,33 +0,0 @@
|
|||||||
|
|
||||||
.order_title{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 20px 30px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: #fff;
|
|
||||||
height: 116px;
|
|
||||||
border-radius: 20px;
|
|
||||||
margin-top: 20px;
|
|
||||||
text{
|
|
||||||
flex:1;
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.order_status{
|
|
||||||
background-color: #F0F0F0;
|
|
||||||
width: 148px;
|
|
||||||
height: 55px;
|
|
||||||
color: $color_font_three;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 55px;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
border-radius: 30px;
|
|
||||||
&:nth-last-child(1) {
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_status_selected{
|
|
||||||
color: $color_main;
|
|
||||||
border: 1px solid $color_main;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
import { Text, View } from "@tarojs/components"
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
import classnames from "classnames";
|
|
||||||
import { memo, useRef, useState } from "react";
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
onSelect?:(val:number) => void
|
|
||||||
}
|
|
||||||
export default memo(({onSelect}: Param) => {
|
|
||||||
//收货方法 1:自提,2:物流
|
|
||||||
const shipmentMode = useRef([
|
|
||||||
{value:1, label:'上门自提', selected:false},
|
|
||||||
{value:2, label:'物流', selected:false}
|
|
||||||
])
|
|
||||||
const [selectValue, setSelectValue] = useState()
|
|
||||||
const selectShipmentMode = (value) => {
|
|
||||||
setSelectValue(() => value)
|
|
||||||
onSelect?.(value)
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<View className={styles.order_title}>
|
|
||||||
<Text>收货方式</Text>
|
|
||||||
{shipmentMode.current.map(item => {
|
|
||||||
return <View className={classnames(styles.order_status, (selectValue == item.value)&&styles.order_status_selected)} onClick={() => selectShipmentMode(item.value)}>{item.label}</View>
|
|
||||||
})}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,69 +0,0 @@
|
|||||||
.order_price{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
width: 100%;
|
|
||||||
&:nth-last-child(n+2) {
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
.order_price_text{
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
// margin-right: 10px;
|
|
||||||
display: flex;
|
|
||||||
.iconfont_msg{
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.miconfont{
|
|
||||||
font-size: 30px;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
.message{
|
|
||||||
position: absolute;
|
|
||||||
top: -50px;
|
|
||||||
background: #A8B3BD;
|
|
||||||
z-index: 9;
|
|
||||||
min-height: 50px;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
&::before{
|
|
||||||
z-index: 1;
|
|
||||||
position: absolute;
|
|
||||||
bottom: -7px;
|
|
||||||
left: 10px;
|
|
||||||
width: 15px;
|
|
||||||
height: 15px;
|
|
||||||
content: " ";
|
|
||||||
transform: rotate(45deg);
|
|
||||||
background: #A8B3BD;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.emphasis{
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.order_price_num{
|
|
||||||
color: $color_main;
|
|
||||||
font-weight: 700;
|
|
||||||
text{
|
|
||||||
&:nth-child(1) {
|
|
||||||
font-size: $font_size_min;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
&:nth-child(3) {
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.emphasis_num{
|
|
||||||
text{
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: $font_size_big;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
import { Text, View } from "@tarojs/components"
|
|
||||||
import { memo, useCallback, useEffect, useMemo } from "react"
|
|
||||||
import {formatKbPrice} from '@/common/common'
|
|
||||||
import classnames from "classnames";
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
type Param = {
|
|
||||||
style?: Object,
|
|
||||||
number?: number
|
|
||||||
}
|
|
||||||
export default memo(({style, number = 0}:Param) => {
|
|
||||||
const priceDom = useCallback(() => {
|
|
||||||
let res = number.toFixed(2).split('.')
|
|
||||||
let int_num = parseInt(res[0]) + ''
|
|
||||||
let decimals_num = res[1]
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Text>¥</Text>
|
|
||||||
<Text>{Number(int_num).toLocaleString()}</Text>
|
|
||||||
<Text>.{decimals_num}</Text>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}, [number])
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<View className={styles.order_price}>
|
|
||||||
<View className={classnames(styles.order_price_text, styles.emphasis)}>
|
|
||||||
<Text>预估金额</Text>
|
|
||||||
<View className={styles.iconfont_msg}>
|
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont icon-a-tuikuanshouhou')}></Text>
|
|
||||||
{/* <View className={classnames(styles.message)}>123123123121212312312312312</View> */}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={classnames(styles.order_price_num, styles.emphasis_num)} style={style}>
|
|
||||||
{priceDom()}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
})
|
|
@ -1,39 +0,0 @@
|
|||||||
|
|
||||||
.weight_memo{
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 20px;
|
|
||||||
padding: 0 20px;
|
|
||||||
.weight_memo_item{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
height: 130px;
|
|
||||||
&:nth-child(1) {
|
|
||||||
border-bottom: 1px solid #f3f3f3;
|
|
||||||
}
|
|
||||||
.title, .desc{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.desc{
|
|
||||||
color: $color_font_two;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
}
|
|
||||||
.miconfont_check, .miconfont_custom{
|
|
||||||
font-size: 37px;
|
|
||||||
color: $color_main;
|
|
||||||
font-weight: normal;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
.miconfont_custom{
|
|
||||||
color:#FFC300;
|
|
||||||
}
|
|
||||||
.miconfont_more{
|
|
||||||
font-size: 30px;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
import Popup from "@/components/popup"
|
|
||||||
import { Text, Textarea, View } from "@tarojs/components"
|
|
||||||
import { memo, useCallback, useState } from "react"
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
import classnames from "classnames";
|
|
||||||
|
|
||||||
type Param = {
|
|
||||||
onCheck?: () => void
|
|
||||||
onCustom?: () => void
|
|
||||||
}
|
|
||||||
export default memo(({onCheck, onCustom}:Param) => {
|
|
||||||
return (
|
|
||||||
<View className={styles.weight_memo}>
|
|
||||||
<View className={styles.weight_memo_item} onClick={() => onCheck?.()}>
|
|
||||||
<View className={styles.title}>
|
|
||||||
<Text className={classnames("iconfont icon-a-yuanmadanmadanguanli", styles.miconfont_check)}></Text>
|
|
||||||
<Text>陆盈纺织</Text>
|
|
||||||
</View>
|
|
||||||
<View className={styles.desc}>
|
|
||||||
<Text>查看原码单</Text>
|
|
||||||
<Text className={classnames("iconfont icon-a-moreback", styles.miconfont_more)}></Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.weight_memo_item} onClick={() => onCustom?.()}>
|
|
||||||
<View className={styles.title}>
|
|
||||||
<Text className={classnames("iconfont icon-a-yuanmadanmadanguanli", styles.miconfont_custom)}></Text>
|
|
||||||
<Text>我的码单</Text>
|
|
||||||
</View>
|
|
||||||
<View className={styles.desc}>
|
|
||||||
<Text>自定义</Text>
|
|
||||||
<Text className={classnames("iconfont icon-a-moreback", styles.miconfont_more)}></Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
@ -53,7 +53,6 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
|||||||
const condition = useRef({physical_warehouse:adminUserInfo?.physical_warehouse, sale_mode:selectIndex, product_id:0, code_or_name:null})
|
const condition = useRef({physical_warehouse:adminUserInfo?.physical_warehouse, sale_mode:selectIndex, product_id:0, code_or_name:null})
|
||||||
const getColorList = async () => {
|
const getColorList = async () => {
|
||||||
setLoading(() => true)
|
setLoading(() => true)
|
||||||
console.log('数据:::',getFilterData(condition.current))
|
|
||||||
let {data} = await colorFetchData(getFilterData(condition.current))
|
let {data} = await colorFetchData(getFilterData(condition.current))
|
||||||
let lists = initList(data.list)
|
let lists = initList(data.list)
|
||||||
setList(() => [...lists])
|
setList(() => [...lists])
|
||||||
@ -145,16 +144,15 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
|||||||
const {getSelfUserInfo} = UseLogin()
|
const {getSelfUserInfo} = UseLogin()
|
||||||
const {fetchData:addFetchData} = AddShoppingCartApi()
|
const {fetchData:addFetchData} = AddShoppingCartApi()
|
||||||
const addShopCart = async () => {
|
const addShopCart = async () => {
|
||||||
// try {
|
try {
|
||||||
// await getSelfUserInfo()
|
await getSelfUserInfo()
|
||||||
// } catch(msg) {
|
} catch(msg) {
|
||||||
// Taro.showToast({
|
Taro.showToast({
|
||||||
// icon:'none',
|
icon:'none',
|
||||||
// title:'授权失败,请求完善授权'
|
title:'授权失败,请求完善授权'
|
||||||
// })
|
})
|
||||||
// return false
|
return false
|
||||||
// }
|
}
|
||||||
|
|
||||||
if(selectCount.sumCount == 0) {
|
if(selectCount.sumCount == 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
icon:'none',
|
icon:'none',
|
||||||
@ -162,6 +160,7 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
|
|||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const state = await addFetchData({
|
const state = await addFetchData({
|
||||||
"sale_mode": selectIndex,
|
"sale_mode": selectIndex,
|
||||||
color_list: selectCount.color_list
|
color_list: selectCount.color_list
|
||||||
|
@ -15,6 +15,7 @@ import { AnalysisShortCodeApi, BindShortCodeApi, GetShortCodeApi } from '@/api/s
|
|||||||
import { SHARE_SCENE } from '@/common/enum';
|
import { SHARE_SCENE } from '@/common/enum';
|
||||||
import useUserInfo from '@/use/useUserInfo';
|
import useUserInfo from '@/use/useUserInfo';
|
||||||
import LabAndImg from '@/components/LabAndImg';
|
import LabAndImg from '@/components/LabAndImg';
|
||||||
|
import { alert } from '@/common/common';
|
||||||
|
|
||||||
type item = {title:string, img:string, url:string, id:number}
|
type item = {title:string, img:string, url:string, id:number}
|
||||||
|
|
||||||
@ -114,17 +115,20 @@ export default (props:Params) => {
|
|||||||
setSortCode({... userObj.sort_code, shareShortDetail: {title: productName as string, code: resDetail.md5_key, img:''}})
|
setSortCode({... userObj.sort_code, shareShortDetail: {title: productName as string, code: resDetail.md5_key, img:''}})
|
||||||
}
|
}
|
||||||
|
|
||||||
//开始下单
|
//授权手机号和下单
|
||||||
const placeOrder = async (e:any) => {
|
const placeOrder = async (status = 'to_phone',e:any = {}) => {
|
||||||
// try {
|
if(status == 'to_phone') {
|
||||||
// await getPhoneNumber(e.detail.code)
|
if(!e.detail.code) return alert.error('请授权手机号')
|
||||||
// } catch(msg) {
|
try {
|
||||||
// Taro.showToast({
|
await getPhoneNumber(e.detail.code)
|
||||||
// icon:"none",
|
} catch(msg) {
|
||||||
// title: msg
|
Taro.showToast({
|
||||||
// })
|
icon:"none",
|
||||||
// return false
|
title: msg
|
||||||
// }
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
setShowOrderCount(true)
|
setShowOrderCount(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +167,7 @@ export default (props:Params) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.product_color}>
|
<View className={styles.product_color}>
|
||||||
<View className={styles.title}>色号 (10)</View>
|
<View className={styles.title}>色号 ({productInfo?.product_color_list?.length})</View>
|
||||||
<View className={styles.list}>
|
<View className={styles.list}>
|
||||||
{productInfo?.product_color_list?.map(item => {
|
{productInfo?.product_color_list?.map(item => {
|
||||||
return <View className={styles.item} onClick={() => getColorItem(item)}>
|
return <View className={styles.item} onClick={() => getColorItem(item)}>
|
||||||
@ -184,12 +188,11 @@ export default (props:Params) => {
|
|||||||
<View className={styles.text}>购物车</View>
|
<View className={styles.text}>购物车</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
// !userInfo.adminUserInfo?.is_authorize_phone&&<View className={styles.buy_btn} >
|
(!userInfo.adminUserInfo?.is_authorize_phone)&&<View className={styles.buy_btn} >
|
||||||
// <Button className={styles.phoneBtn} open-type="getPhoneNumber" onGetPhoneNumber={(e) => placeOrder(e)}></Button>
|
<Button className={styles.phoneBtn} open-type="getPhoneNumber" onGetPhoneNumber={(e) => placeOrder('to_phone',e)}></Button>
|
||||||
// 开始下单
|
开始下单
|
||||||
// </View>
|
</View>
|
||||||
// || <View className={styles.buy_btn} onClick={(e) => placeOrder(e)}>开始下单</View>
|
|| <View className={styles.buy_btn} onClick={() => placeOrder('to_order')}>开始下单</View>
|
||||||
<View className={styles.buy_btn} onClick={(e) => placeOrder(e)}>开始下单</View>
|
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<CustomWrapper>
|
<CustomWrapper>
|
||||||
|
@ -73,7 +73,8 @@ import SubmitOrderBtn from "./components/submitOrderBtn";
|
|||||||
total_number: preViewOrder.total_number, //总数量
|
total_number: preViewOrder.total_number, //总数量
|
||||||
total_fabrics: preViewOrder.total_fabrics, //面料数量
|
total_fabrics: preViewOrder.total_fabrics, //面料数量
|
||||||
unit: preViewOrder.sale_mode == 0?'条':'m', //单位
|
unit: preViewOrder.sale_mode == 0?'条':'m', //单位
|
||||||
list: preViewOrder.product_list
|
list: preViewOrder.product_list,
|
||||||
|
total_should_collect_money: preViewOrder.total_should_collect_money //应收金额
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const formatPreViewOrderMemo = useMemo(() => {
|
const formatPreViewOrderMemo = useMemo(() => {
|
||||||
@ -174,7 +175,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn";
|
|||||||
</View>
|
</View>
|
||||||
<View className={styles.submit_order}>
|
<View className={styles.submit_order}>
|
||||||
<View className={styles.submit_order_number}>
|
<View className={styles.submit_order_number}>
|
||||||
<SubmitOrderBtn style={{color:'#007AFF'}} number={formatPriceDiv(formatPreViewOrder?.estimate_amount)}/>
|
<SubmitOrderBtn style={{color:'#007AFF'}} number={formatPriceDiv(preViewOrder?.sale_mode == 1?formatPreViewOrder?.total_should_collect_money:formatPreViewOrder?.estimate_amount)} priceTitle={preViewOrder?.sale_mode == 1?'合计金额':'预估金额'}/>
|
||||||
<View className={styles.order_number_desc}>{`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`}</View>
|
<View className={styles.order_number_desc}>{`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={classnames(styles.order_btn, btnStatus&&styles.ok_order_btn)} onClick={() => submitOrderEven()}>提交订单</View>
|
<View className={classnames(styles.order_btn, btnStatus&&styles.ok_order_btn)} onClick={() => submitOrderEven()}>提交订单</View>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
.order_address{
|
.order_address{
|
||||||
height: 178px;
|
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -26,16 +25,18 @@
|
|||||||
.order_address_text_title{
|
.order_address_text_title{
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
@include common_ellipsis;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.moreIconfont{
|
.moreIconfont{
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
.address_text{
|
||||||
|
word-break:break-all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.order_address_text_name{
|
.order_address_text_name{
|
||||||
|
margin-top: 30px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text{
|
text{
|
||||||
&:nth-child(1) {
|
&:nth-child(1) {
|
||||||
@ -88,6 +89,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.logisticsBtn{
|
||||||
|
width: 152px;
|
||||||
|
height: 72px;
|
||||||
|
background: #ffffff;
|
||||||
|
border: 2px solid #dddddd;
|
||||||
|
border-radius: 38px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
right: 10px;
|
||||||
|
z-index: 999;
|
||||||
|
font-size: 28px;
|
||||||
|
color: #707070;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 72px;
|
||||||
|
}
|
||||||
.order_address_text_no{
|
.order_address_text_no{
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: $font_size;
|
font-size: $font_size;
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order";
|
import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order";
|
||||||
import { alert } from "@/common/common";
|
import { alert } from "@/common/common";
|
||||||
|
import { ORDER_STATUS } from "@/common/enum";
|
||||||
import { debounce } from "@/common/util";
|
import { debounce } from "@/common/util";
|
||||||
import AddressList from "@/components/AddressList";
|
import AddressList from "@/components/AddressList";
|
||||||
import Popup from "@/components/popup";
|
import Popup from "@/components/popup";
|
||||||
import { Text, View } from "@tarojs/components"
|
import { Text, View } from "@tarojs/components"
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useState } from "react";
|
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useState } from "react";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export type AddressInfoParam = {
|
export type AddressInfoParam = {
|
||||||
@ -18,15 +19,18 @@ export type AddressInfoParam = {
|
|||||||
phone: string,
|
phone: string,
|
||||||
}
|
}
|
||||||
type Param = {
|
type Param = {
|
||||||
onSelect?: (val:any) => void, //选择
|
onSelect?: (val:any) => void, //选择地址
|
||||||
defaultValue?: AddressInfoParam|null, //默认值
|
defaultValue?: AddressInfoParam|null, //默认值
|
||||||
disabled?: false|true, //true禁用后只用于展示
|
disabled?: false|true, //true禁用后只用于展示
|
||||||
shipment_mode?: 1|2, //1自提 2物流
|
|
||||||
onChangeShipmentMode?: (val: number) => void, //返回收货方式
|
onChangeShipmentMode?: (val: number) => void, //返回收货方式
|
||||||
orderId?: number //订单id
|
orderInfo?: {
|
||||||
|
orderId: number //订单id
|
||||||
|
shipment_mode: 1|2, //1自提 2物流
|
||||||
|
status: number //订单状态
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderId = 0, shipment_mode = 1}: Param, ref) => {
|
export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderInfo}: Param, ref) => {
|
||||||
const [showAddressList, setShowAddressList] = useState(false)
|
const [showAddressList, setShowAddressList] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -42,13 +46,14 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue =
|
|||||||
}, [userInfo])
|
}, [userInfo])
|
||||||
|
|
||||||
const changeShow = () => {
|
const changeShow = () => {
|
||||||
if(receivingStatus == 2)
|
if(receivingStatus == 2 && !logisticsShow)
|
||||||
setShowAddressList(() => true)
|
setShowAddressList(() => true)
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setReceivingStatus(() => shipment_mode)
|
if(orderInfo)
|
||||||
}, [shipment_mode])
|
setReceivingStatus(() => orderInfo.shipment_mode)
|
||||||
|
}, [orderInfo])
|
||||||
|
|
||||||
//把内部方法提供给外部
|
//把内部方法提供给外部
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
@ -63,8 +68,9 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue =
|
|||||||
changeReceivingStatus(value)
|
changeReceivingStatus(value)
|
||||||
}
|
}
|
||||||
const changeReceivingStatus = debounce(async (value) => {
|
const changeReceivingStatus = debounce(async (value) => {
|
||||||
|
if(!orderInfo) return false
|
||||||
alert.loading('正在修改')
|
alert.loading('正在修改')
|
||||||
const res = await shipmentModeFetchData({id: orderId, shipment_mode:value})
|
const res = await shipmentModeFetchData({id: orderInfo.orderId, shipment_mode:value})
|
||||||
if(res.success) {
|
if(res.success) {
|
||||||
alert.success('收货方式修改成功')
|
alert.success('收货方式修改成功')
|
||||||
onChangeShipmentMode?.(value)
|
onChangeShipmentMode?.(value)
|
||||||
@ -78,8 +84,9 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue =
|
|||||||
const [addressId, setAddressId] = useState(0)
|
const [addressId, setAddressId] = useState(0)
|
||||||
const {fetchData: addressFetchData} = EditSaleOrderAddressApi()
|
const {fetchData: addressFetchData} = EditSaleOrderAddressApi()
|
||||||
const getAddress = async (value) => {
|
const getAddress = async (value) => {
|
||||||
|
if(!orderInfo) return false
|
||||||
alert.loading('正在修改')
|
alert.loading('正在修改')
|
||||||
const res = await addressFetchData({id: orderId, address_id: value.id})
|
const res = await addressFetchData({id: orderInfo.orderId, address_id: value.id})
|
||||||
if(res.success) {
|
if(res.success) {
|
||||||
alert.success('地址修改成功')
|
alert.success('地址修改成功')
|
||||||
onSelect?.(value)
|
onSelect?.(value)
|
||||||
@ -91,27 +98,45 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//订单状态
|
||||||
|
const {
|
||||||
|
SaleOrderStatusWaitingReceipt,
|
||||||
|
SaleOrderStatusAlreadyReceipt,
|
||||||
|
SaleOrderStatusComplete,
|
||||||
|
SaleOrderStatusRefund,
|
||||||
|
SaleOrderStatusCancel
|
||||||
|
} = ORDER_STATUS
|
||||||
|
|
||||||
|
//根据订单状态判断是否显示物流
|
||||||
|
const logisticsShowList = [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value]
|
||||||
|
const logisticsShow = useMemo(() => {
|
||||||
|
return logisticsShowList.includes(orderInfo?.status as number)
|
||||||
|
}, [orderInfo])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
<View className={styles.order_address} onClick={() => changeShow()}>
|
||||||
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2?'icon-daohang':'icon-fahuo')}></View>
|
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2?'icon-daohang':'icon-fahuo')}></View>
|
||||||
<View className={styles.order_address_text_con}>
|
<View className={styles.order_address_text_con}>
|
||||||
<View className={styles.order_address_text_title}>
|
<View className={styles.order_address_text_title}>
|
||||||
<Text>{formatAddress}</Text>
|
<Text className={styles.address_text}>{formatAddress}</Text>
|
||||||
{(receivingStatus == 2)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
{(receivingStatus == 2 && !logisticsShow)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.order_address_text_name}>
|
<View className={styles.order_address_text_name}>
|
||||||
<Text>{userInfo?.name}</Text>
|
<Text>{userInfo?.name}</Text>
|
||||||
<Text>{userInfo?.phone}</Text>
|
<Text>{userInfo?.phone}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.updateBtn}>
|
{!logisticsShow&&<View className={styles.updateBtn}>
|
||||||
<View className={styles.updateBtn_list}>
|
<View className={styles.updateBtn_list}>
|
||||||
<View className={classnames(styles.updateBtn_item, receivingStatus==1&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(1,e)}>自提</View>
|
<View className={classnames(styles.updateBtn_item, receivingStatus==1&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(1,e)}>自提</View>
|
||||||
<View className={classnames(styles.updateBtn_item, receivingStatus==2&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(2,e)}>物流</View>
|
<View className={classnames(styles.updateBtn_item, receivingStatus==2&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(2,e)}>物流</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={{transform: receivingStatus==1?'translateX(0)':'translateX(100%)'}} className={classnames(styles.updateBtn_select)}></View>
|
<View style={{transform: receivingStatus==1?'translateX(0)':'translateX(100%)'}} className={classnames(styles.updateBtn_select)}></View>
|
||||||
</View>
|
</View>||
|
||||||
|
<View className={styles.logisticsBtn}>
|
||||||
|
查看物流
|
||||||
|
</View>}
|
||||||
</View>
|
</View>
|
||||||
<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
||||||
<View className={styles.order_address_list}>
|
<View className={styles.order_address_list}>
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
.order_list_item {
|
.order_list_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
&:nth-child(2) {
|
&:nth-child(n + 2) {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
.order_list_item_img{
|
.order_list_item_img{
|
||||||
|
@ -40,8 +40,10 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
|
|
||||||
//数量格式
|
//数量格式
|
||||||
const numText = useMemo(() => {
|
const numText = useMemo(() => {
|
||||||
if(order)
|
if(order) {
|
||||||
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
|
let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100)
|
||||||
|
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${total_number}${order?.unit}`
|
||||||
|
}
|
||||||
}, [order])
|
}, [order])
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -55,6 +57,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
SaleOrderStatusComplete, // 已完成
|
SaleOrderStatusComplete, // 已完成
|
||||||
SaleOrderStatusRefund, // 已退款
|
SaleOrderStatusRefund, // 已退款
|
||||||
SaleOrderStatusCancel, // 已取消
|
SaleOrderStatusCancel, // 已取消
|
||||||
|
SaleorderstatusWaitingPrePayment // 预付款
|
||||||
} = ORDER_STATUS
|
} = ORDER_STATUS
|
||||||
|
|
||||||
//金额列表枚举
|
//金额列表枚举
|
||||||
@ -67,7 +70,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id:2,
|
id:2,
|
||||||
value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
value:[SaleorderstatusWaitingPrePayment.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
||||||
label:'合计金额',
|
label:'合计金额',
|
||||||
field: 'total_sale_price'
|
field: 'total_sale_price'
|
||||||
},
|
},
|
||||||
@ -96,14 +99,14 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
return priceInfo.value.includes(status)
|
return priceInfo.value.includes(status)
|
||||||
}, [order])
|
}, [order])
|
||||||
|
|
||||||
|
//金额展示大货
|
||||||
const priceConDom = useMemo(() => {
|
const priceConDom = useMemo(() => {
|
||||||
if(!order) return
|
if(!order) return
|
||||||
//确认订单
|
|
||||||
if(comfirm == true) {
|
if(comfirm == true) {
|
||||||
|
//确认订单时
|
||||||
return <EstimatedAmount number={formatPriceDiv(order.estimate_amount)} title="预估金额" />
|
return <EstimatedAmount number={formatPriceDiv(order.estimate_amount)} title="预估金额" />
|
||||||
}
|
} else if(order?.status == SaleOrderStatusCancel.value) {
|
||||||
//订单为取消订单状态
|
//订单状态为取消订单时
|
||||||
if(order?.status == SaleOrderStatusCancel.value) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{
|
{
|
||||||
@ -114,6 +117,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
//其他订单状态
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{
|
{
|
||||||
@ -126,6 +130,22 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
}
|
}
|
||||||
}, [order])
|
}, [order])
|
||||||
|
|
||||||
|
//金额展示剪板
|
||||||
|
const cutPriceConDom = useMemo(() => {
|
||||||
|
if(!order) return
|
||||||
|
return <EstimatedAmount number={formatPriceDiv(order.total_should_collect_money)} title="合计金额" />
|
||||||
|
}, [order])
|
||||||
|
|
||||||
|
const showPriceAll = useMemo(() => {
|
||||||
|
if(order?.sale_mode == 1) {
|
||||||
|
return cutPriceConDom //剪板
|
||||||
|
} else {
|
||||||
|
return priceConDom //大货
|
||||||
|
}
|
||||||
|
|
||||||
|
}, [order])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.orders_list_title}>{numText}</View>
|
<View className={styles.orders_list_title}>{numText}</View>
|
||||||
@ -161,7 +181,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
<View className={styles.order_estimated_amount}>
|
<View className={styles.order_estimated_amount}>
|
||||||
{priceConDom}
|
{showPriceAll}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
}
|
}
|
||||||
.order_status_item{
|
.order_status_item{
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 50px;
|
// padding-left: 50px;
|
||||||
&:nth-last-child(n+2) {
|
&:nth-last-child(n+2) {
|
||||||
padding-bottom: 30px;
|
padding-bottom: 30px;
|
||||||
}
|
}
|
||||||
@ -44,6 +44,7 @@
|
|||||||
.order_status_content{
|
.order_status_content{
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
padding: 0 30px;
|
||||||
.order_status_title{
|
.order_status_title{
|
||||||
color: $color_font_two;
|
color: $color_font_two;
|
||||||
font-size: $font_size;
|
font-size: $font_size;
|
||||||
@ -75,6 +76,24 @@
|
|||||||
.order_status_des_select{
|
.order_status_des_select{
|
||||||
color: $color_font_one;
|
color: $color_font_one;
|
||||||
}
|
}
|
||||||
|
.pay_time{
|
||||||
|
height: 56px;
|
||||||
|
background: #f6f6f6;
|
||||||
|
border-radius: 20px;
|
||||||
|
color: #3C3C3C;
|
||||||
|
font-size: 24px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 20px;
|
||||||
|
text{
|
||||||
|
font-size: 28px;
|
||||||
|
color: $color_main;
|
||||||
|
padding: 0 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.more{
|
.more{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -102,4 +121,20 @@
|
|||||||
top: -10px;
|
top: -10px;
|
||||||
right: -10px;
|
right: -10px;
|
||||||
}
|
}
|
||||||
|
.refresh{
|
||||||
|
position: absolute;
|
||||||
|
top: 23px;
|
||||||
|
right: 20px;
|
||||||
|
display: flex;
|
||||||
|
color: #707070;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.mconfont{
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
.refresh_text{
|
||||||
|
font-size: 23px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,42 +1,82 @@
|
|||||||
import { Image, Text, View } from "@tarojs/components"
|
import { Image, Text, View } from "@tarojs/components"
|
||||||
import { memo, useMemo, useState } from "react"
|
import { memo, useEffect, useMemo, useRef, useState } from "react"
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { formatDateTime, formatImgUrl } from "@/common/fotmat";
|
import { formatDateTime, formatImgUrl } from "@/common/fotmat";
|
||||||
import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
||||||
|
import * as dayjs from 'dayjs'
|
||||||
|
|
||||||
|
type List = {
|
||||||
|
|
||||||
type Param = {
|
|
||||||
list: {
|
|
||||||
status: string,
|
status: string,
|
||||||
time: string,
|
time: string,
|
||||||
tag: string,
|
tag: string,
|
||||||
desc: string
|
desc: string
|
||||||
}[],
|
|
||||||
payment_method: 0|PAYMENT_METHOD_PARAM,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Param = {
|
||||||
|
onRefresh?: () => void,
|
||||||
|
orderInfo?: {
|
||||||
|
logistics_details:List[], //订单状态列表
|
||||||
|
payment_method: 0|PAYMENT_METHOD_PARAM, //支付方式
|
||||||
|
status: number, //订单状态
|
||||||
|
expire_time: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default memo(({orderInfo = {logistics_details: [],payment_method: 0, status: 0, expire_time:0}, onRefresh}:Param) => {
|
||||||
|
|
||||||
|
const [showMore, setShowMore] = useState(false)
|
||||||
|
const changeMore = () => {
|
||||||
|
setShowMore(() => !showMore)
|
||||||
|
}
|
||||||
|
const dataList = useMemo(() => {
|
||||||
|
return orderInfo.logistics_details?orderInfo?.logistics_details.reverse():[]
|
||||||
|
}, [orderInfo.logistics_details])
|
||||||
|
|
||||||
|
//订单状态枚举
|
||||||
|
const {SaleorderstatusWaitingPrePayment} = ORDER_STATUS
|
||||||
|
|
||||||
//支付方式枚举
|
//支付方式枚举
|
||||||
const {
|
const {
|
||||||
PaymentMethodAccountPeriod,
|
PaymentMethodAccountPeriod,
|
||||||
PaymentMethodCashOnDelivery,
|
PaymentMethodCashOnDelivery,
|
||||||
} = PAYMENT_METHOD
|
} = PAYMENT_METHOD
|
||||||
|
|
||||||
export default memo(({list = [], payment_method = 0}:Param) => {
|
|
||||||
|
|
||||||
const [showMore, setShowMore] = useState(false)
|
//倒计时
|
||||||
const changeMore = () => {
|
const timeObj:any = useRef()
|
||||||
setShowMore(() => !showMore)
|
useEffect(() => {
|
||||||
|
if(orderInfo.expire_time) {
|
||||||
|
timeObj.current = setInterval(() => {
|
||||||
|
count_down()
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
clearInterval(timeObj.current)
|
||||||
|
}
|
||||||
|
}, [orderInfo.expire_time])
|
||||||
|
|
||||||
|
|
||||||
|
const count_down = () => {
|
||||||
|
var startData = dayjs();
|
||||||
|
var endDate = dayjs(orderInfo.expire_time);
|
||||||
|
console.log('endDate::', endDate.format('YYYY-MM-DD HH:mm'))
|
||||||
|
var _dd = endDate.diff(startData,'day');
|
||||||
|
var _hh = endDate.diff(startData,'hour');
|
||||||
|
var _mm = endDate.diff(startData,'minute');
|
||||||
|
var _ss = endDate.diff(startData,'second');
|
||||||
|
// 转换
|
||||||
|
var hh = _hh - (_dd*24);
|
||||||
|
var mm = _mm - (_hh*60);
|
||||||
|
var ss = _ss - (_mm*60);
|
||||||
|
console.log(`${_dd} ${hh} ${mm} ${ss}`)
|
||||||
}
|
}
|
||||||
const dataList = useMemo(() => {
|
|
||||||
return list.reverse()
|
|
||||||
}, [list])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(dataList.length > 0)&&<View className={styles.order_flow_state}>
|
{(dataList?.length > 0)&&<View className={styles.order_flow_state}>
|
||||||
<View className={classnames(styles.order_status_list, showMore&&styles.order_status_list_show)}>
|
<View className={classnames(styles.order_status_list, showMore&&styles.order_status_list_show)}>
|
||||||
{dataList.map((item, index) => <View className={styles.order_status_item}>
|
{dataList.map((item, index) => <View className={styles.order_status_item}>
|
||||||
{(dataList.length > 1)&&<View className={classnames(styles.order_status_tail, (index == 0)&&styles.order_status_tail_end)}></View>}
|
{(dataList.length > 1)&&<View className={classnames(styles.order_status_tail, (index == 0)&&styles.order_status_tail_end)}></View>}
|
||||||
@ -47,6 +87,9 @@ export default memo(({list = [], payment_method = 0}:Param) => {
|
|||||||
{/* <View className={classnames(styles.order_status_tag, (index == 0)&&styles.order_status_tag_select)}>{item.tag}</View> */}
|
{/* <View className={classnames(styles.order_status_tag, (index == 0)&&styles.order_status_tag_select)}>{item.tag}</View> */}
|
||||||
</View>
|
</View>
|
||||||
<Text className={classnames(styles.order_status_des, (index == 0)&&styles.order_status_des_select)}>{item.desc}</Text>
|
<Text className={classnames(styles.order_status_des, (index == 0)&&styles.order_status_des_select)}>{item.desc}</Text>
|
||||||
|
{(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&<View className={styles.pay_time}>
|
||||||
|
剩<Text>23:58:55</Text>支付关闭,订单自动取消
|
||||||
|
</View>}
|
||||||
</View>)}
|
</View>)}
|
||||||
</View>
|
</View>
|
||||||
{(dataList.length > 2) && <View className={styles.more} onClick={() => changeMore()}>
|
{(dataList.length > 2) && <View className={styles.more} onClick={() => changeMore()}>
|
||||||
@ -54,9 +97,13 @@ export default memo(({list = [], payment_method = 0}:Param) => {
|
|||||||
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore&&styles.open_miconfonts)}></Text>
|
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore&&styles.open_miconfonts)}></Text>
|
||||||
</View>}
|
</View>}
|
||||||
<View className={styles.image_tag}>
|
<View className={styles.image_tag}>
|
||||||
{(payment_method == PaymentMethodCashOnDelivery.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status.png')} className={styles.image}/>}
|
{(orderInfo.payment_method == PaymentMethodCashOnDelivery.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status.png')} className={styles.image}/>}
|
||||||
{(payment_method == PaymentMethodAccountPeriod.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status_7day.png')} className={styles.image}/>}
|
{(orderInfo.payment_method == PaymentMethodAccountPeriod.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status_7day.png')} className={styles.image}/>}
|
||||||
</View>
|
</View>
|
||||||
|
{(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&<View className={styles.refresh} onClick={onRefresh}>
|
||||||
|
<Text className={classnames(styles.mconfont, 'iconfont icon-xianxiahuikuan')}></Text>
|
||||||
|
<Text className={classnames(styles.refresh_text)}>刷新</Text>
|
||||||
|
</View>}
|
||||||
</View>}
|
</View>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -8,26 +8,33 @@ import MCheckbox from "@/components/checkbox";
|
|||||||
import Popup from "@/components/popup";
|
import Popup from "@/components/popup";
|
||||||
import OfflinePay from "../offlinePay";
|
import OfflinePay from "../offlinePay";
|
||||||
import ScanPay from "../scanPay";
|
import ScanPay from "../scanPay";
|
||||||
import { GetOrderPayApi, SubmitOrderPayApi } from "@/api/orderPay";
|
import { GetOrderPayApi, SubmitOrderPayApi, GetPrepayOrderPayApi, SubmitPrepayOrderPayApi } from "@/api/orderPay";
|
||||||
import { formatPriceDiv } from "@/common/fotmat";
|
import { formatPriceDiv } from "@/common/fotmat";
|
||||||
import {alert} from "@/common/common"
|
import {alert} from "@/common/common"
|
||||||
import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
show?: true|false,
|
show?: true|false,
|
||||||
onClose?: () => void,
|
onClose?: () => void,
|
||||||
onSubmitSuccess?: () => void, //支付成功
|
onSubmitSuccess?: () => void, //支付成功
|
||||||
orderInfo?: OrderInfo
|
orderInfo?: OrderInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderInfo = {
|
type OrderInfo = {
|
||||||
orderId: number, //应付单id
|
should_collect_order_id?: number, //应付单id
|
||||||
payment_method: 0|PAYMENT_METHOD_PARAM //支付方式
|
pre_collect_order_id?: number, //预付单id
|
||||||
|
status?: number, //订单状态
|
||||||
|
payment_method?: 0|PAYMENT_METHOD_PARAM //支付方式
|
||||||
}
|
}
|
||||||
|
|
||||||
type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
|
type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
|
||||||
export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) => {
|
export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) => {
|
||||||
|
|
||||||
|
//支付方式枚举
|
||||||
|
const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod, PaymentMethodCashOnDelivery} = PAYMENT_METHOD
|
||||||
|
//订单状态枚举
|
||||||
|
const {SaleorderstatusWaitingPrePayment} = ORDER_STATUS
|
||||||
|
|
||||||
//提交参数
|
//提交参数
|
||||||
const [submitData, setSubmitData] = useState<{id:number, payment_method: PayStatus}>({
|
const [submitData, setSubmitData] = useState<{id:number, payment_method: PayStatus}>({
|
||||||
id:0,
|
id:0,
|
||||||
@ -38,7 +45,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
const [offlinePayShow, setofflinePayShow] = useState(false)
|
const [offlinePayShow, setofflinePayShow] = useState(false)
|
||||||
const onShowOfflinePay = () => {
|
const onShowOfflinePay = () => {
|
||||||
setofflinePayShow(true)
|
setofflinePayShow(true)
|
||||||
onClose?.()
|
// onClose?.()
|
||||||
}
|
}
|
||||||
|
|
||||||
//扫码支付
|
//扫码支付
|
||||||
@ -51,13 +58,22 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
//获取支付方式数据
|
//获取支付方式数据
|
||||||
const [payInfo, setPayInfo] = useState<any>()
|
const [payInfo, setPayInfo] = useState<any>()
|
||||||
const {fetchData: orderFetchData} = GetOrderPayApi()
|
const {fetchData: orderFetchData} = GetOrderPayApi()
|
||||||
|
const {fetchData: prepayOrderFetchData} = GetPrepayOrderPayApi()
|
||||||
const getOrderPay = async () => {
|
const getOrderPay = async () => {
|
||||||
let {data} = await orderFetchData({id: orderInfo?.orderId})
|
if(orderInfo&&orderInfo.should_collect_order_id) {
|
||||||
|
//有应收单id时用应收单获取数据
|
||||||
|
let {data} = await orderFetchData({id: orderInfo?.should_collect_order_id})
|
||||||
|
setPayInfo(() => data)
|
||||||
|
} else {
|
||||||
|
//用预付单id获取支付信息
|
||||||
|
let {data} = await prepayOrderFetchData({id: orderInfo?.pre_collect_order_id})
|
||||||
setPayInfo(() => data)
|
setPayInfo(() => data)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(show&&orderInfo?.orderId) {
|
if(show&&orderInfo&&(orderInfo?.should_collect_order_id||orderInfo?.pre_collect_order_id)) {
|
||||||
setSubmitData((val) => ({...val, id:orderInfo.orderId}))
|
let id = orderInfo.should_collect_order_id||orderInfo.pre_collect_order_id
|
||||||
|
setSubmitData((val) => ({...val, id:id as number}))
|
||||||
getOrderPay()
|
getOrderPay()
|
||||||
}
|
}
|
||||||
}, [show, orderInfo])
|
}, [show, orderInfo])
|
||||||
@ -73,14 +89,20 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//提交支付
|
//提交支付
|
||||||
const {fetchData: submitFetchData} = SubmitOrderPayApi()
|
const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交
|
||||||
|
const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交
|
||||||
const submitPay = async () => {
|
const submitPay = async () => {
|
||||||
if(submitData.payment_method === null) {
|
if(submitData.payment_method === null) {
|
||||||
alert.error('请选择支付方式')
|
alert.error('请选择支付方式')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
alert.loading('正在支付')
|
alert.loading('正在支付')
|
||||||
let res = await submitFetchData(submitData)
|
let res:any = null
|
||||||
|
if(orderInfo?.should_collect_order_id) {
|
||||||
|
res = await submitFetchData(submitData)
|
||||||
|
} else {
|
||||||
|
res = await submitPrepayOrderFetchData(submitData)
|
||||||
|
}
|
||||||
if(res.success) {
|
if(res.success) {
|
||||||
alert.success('支付成功')
|
alert.success('支付成功')
|
||||||
onSubmitSuccess?.()
|
onSubmitSuccess?.()
|
||||||
@ -97,6 +119,18 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
)
|
)
|
||||||
}, [payInfo])
|
}, [payInfo])
|
||||||
|
|
||||||
|
//是否显示七天账期
|
||||||
|
const show_account_payment = useMemo(() => {
|
||||||
|
console.log('orderInfo?.status::',orderInfo)
|
||||||
|
//支付方式是账期支付,不显示
|
||||||
|
if(orderInfo?.payment_method == PaymentMethodAccountPeriod.value) return false
|
||||||
|
//支付方式是货到付款,不显示
|
||||||
|
if(orderInfo?.payment_method == PaymentMethodCashOnDelivery.value) return false
|
||||||
|
//订单状态是预付款,不显示
|
||||||
|
if(orderInfo?.status == SaleorderstatusWaitingPrePayment.value) return false
|
||||||
|
return true
|
||||||
|
}, [orderInfo])
|
||||||
|
|
||||||
//账期
|
//账期
|
||||||
const account_peyment = useMemo(() => {
|
const account_peyment = useMemo(() => {
|
||||||
const price = payInfo?.should_collect_money - payInfo?.amount_paid
|
const price = payInfo?.should_collect_money - payInfo?.amount_paid
|
||||||
@ -105,9 +139,6 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
)
|
)
|
||||||
}, [payInfo])
|
}, [payInfo])
|
||||||
|
|
||||||
//支付方式枚举
|
|
||||||
const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod} = PAYMENT_METHOD
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.payment_main}>
|
<View className={styles.payment_main}>
|
||||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
<Popup show={show} showTitle={false} onClose={onClose} >
|
||||||
@ -143,13 +174,12 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
|
|||||||
</View>
|
</View>
|
||||||
<MCheckbox status={submitData.payment_method == PaymentMethodPreDeposit.value} onSelect={() => advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/>
|
<MCheckbox status={submitData.payment_method == PaymentMethodPreDeposit.value} onSelect={() => advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/>
|
||||||
</View>
|
</View>
|
||||||
{(orderInfo?.payment_method != PaymentMethodAccountPeriod.value)&&<View className={styles.payment_list_item}>
|
{show_account_payment&&<View className={styles.payment_list_item}>
|
||||||
<View className={styles.payment_list_item_left}>
|
<View className={styles.payment_list_item_left}>
|
||||||
<View className={styles.payment_list_item_left_name}>
|
<View className={styles.payment_list_item_left_name}>
|
||||||
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
|
||||||
<View className={styles.payment_list_item_left_text}>{payInfo?.account_period}天账期</View>
|
<View className={styles.payment_list_item_left_text}>{payInfo?.account_period}天账期</View>
|
||||||
</View>
|
</View>
|
||||||
{/* <View className={styles.payment_list_item_left_price}>可用额度 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)}</View> */}
|
|
||||||
{account_peyment}
|
{account_peyment}
|
||||||
</View>
|
</View>
|
||||||
<MCheckbox status={submitData.payment_method == PaymentMethodAccountPeriod.value} onSelect={() => periodSelectData(PaymentMethodAccountPeriod.value)} onClose={() => periodSelectData(null)}/>
|
<MCheckbox status={submitData.payment_method == PaymentMethodAccountPeriod.value} onSelect={() => periodSelectData(PaymentMethodAccountPeriod.value)} onClose={() => periodSelectData(null)}/>
|
||||||
|
@ -5,9 +5,11 @@ import classnames from "classnames";
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
type Param = {
|
type Param = {
|
||||||
style?: Object,
|
style?: Object,
|
||||||
number?: number
|
number?: number, //数量
|
||||||
|
priceTitle: string //描述
|
||||||
|
|
||||||
}
|
}
|
||||||
export default memo(({style, number = 0}:Param) => {
|
export default memo(({style, number = 0, priceTitle = ''}:Param) => {
|
||||||
const priceDom = useCallback(() => {
|
const priceDom = useCallback(() => {
|
||||||
let res = number.toFixed(2).split('.')
|
let res = number.toFixed(2).split('.')
|
||||||
let int_num = parseInt(res[0]) + ''
|
let int_num = parseInt(res[0]) + ''
|
||||||
@ -24,7 +26,7 @@ export default memo(({style, number = 0}:Param) => {
|
|||||||
<>
|
<>
|
||||||
<View className={styles.order_price}>
|
<View className={styles.order_price}>
|
||||||
<View className={classnames(styles.order_price_text, styles.emphasis)}>
|
<View className={classnames(styles.order_price_text, styles.emphasis)}>
|
||||||
<Text>预估金额</Text>
|
<Text>{priceTitle}</Text>
|
||||||
<View className={styles.iconfont_msg}>
|
<View className={styles.iconfont_msg}>
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont icon-a-tuikuanshouhou')}></Text>
|
<Text className={classnames(styles.miconfont, 'iconfont icon-a-tuikuanshouhou')}></Text>
|
||||||
{/* <View className={classnames(styles.message)}>123123123121212312312312312</View> */}
|
{/* <View className={classnames(styles.message)}>123123123121212312312312312</View> */}
|
||||||
|
@ -14,13 +14,12 @@ 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";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import order from "../orderList/components/order";
|
import AddressInfoDetail from "../components/addressInfoDetail";
|
||||||
import AddressInfoDetail from "./components/addressInfoDetail";
|
import KindList from "../components/kindList";
|
||||||
import KindList from "./components/kindList";
|
import OrderState from "../components/orderState";
|
||||||
import OrderState from "./components/orderState";
|
import Payment from "../components/payment";
|
||||||
import Payment from "./components/payment";
|
import Remark from "../components/remark";
|
||||||
import Remark from "./components/remark";
|
import styles from '../index.module.scss'
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
const [showDesc, setShowDesc] = useState(false)
|
@ -63,19 +63,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.submit_order{
|
.submit_order{
|
||||||
display: flex;
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
justify-content: flex-end;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16);
|
box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16);
|
||||||
padding: 20px 20px;
|
padding: 20px 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
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);
|
||||||
.order_btn {
|
.order_btn {
|
||||||
width: 152px;
|
width: 152px;
|
||||||
height: 72px;
|
height: 72px;
|
||||||
|
@ -14,7 +14,6 @@ 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";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import order from "../orderList/components/order";
|
|
||||||
import AddressInfoDetail from "./components/addressInfoDetail";
|
import AddressInfoDetail from "./components/addressInfoDetail";
|
||||||
import KindList from "./components/kindList";
|
import KindList from "./components/kindList";
|
||||||
import OrderState from "./components/orderState";
|
import OrderState from "./components/orderState";
|
||||||
@ -116,10 +115,10 @@ import styles from './index.module.scss'
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//支付所需数据
|
//支付所需数据
|
||||||
const payOrderInfo = useMemo(() => {
|
// const payOrderInfo = useMemo(() => {
|
||||||
if(orderDetail)
|
// if(orderDetail)
|
||||||
return {orderId: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method }
|
// return {should_collect_order_id: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method, pre_collect_order_id:orderDetail.pre_collect_order_id}
|
||||||
}, [orderDetail])
|
// }, [orderDetail])
|
||||||
|
|
||||||
//去付款
|
//去付款
|
||||||
const [payMentShow, setPayMentShow] = useState(false)
|
const [payMentShow, setPayMentShow] = useState(false)
|
||||||
@ -127,6 +126,11 @@ import styles from './index.module.scss'
|
|||||||
setPayMentShow(true)
|
setPayMentShow(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//地址组件所需数据
|
||||||
|
const addressInfoDetailData = useMemo(() => {
|
||||||
|
return {orderId:orderDetail?.id, shipment_mode:orderDetail?.shipment_mode, status: orderDetail?.status}
|
||||||
|
}, [orderDetail])
|
||||||
|
|
||||||
//打开地址修改
|
//打开地址修改
|
||||||
const addressRef = useRef<any>(null)
|
const addressRef = useRef<any>(null)
|
||||||
|
|
||||||
@ -175,6 +179,7 @@ import styles from './index.module.scss'
|
|||||||
settle_mode: orderDetail?.settle_mode,
|
settle_mode: orderDetail?.settle_mode,
|
||||||
actual_amount: orderDetail?.actual_amount, //实付金额
|
actual_amount: orderDetail?.actual_amount, //实付金额
|
||||||
wait_pay_amount: orderDetail?.wait_pay_amount, //待付金额
|
wait_pay_amount: orderDetail?.wait_pay_amount, //待付金额
|
||||||
|
sale_mode: orderDetail?.sale_mode, //订单类型
|
||||||
}
|
}
|
||||||
}, [orderDetail])
|
}, [orderDetail])
|
||||||
|
|
||||||
@ -185,12 +190,9 @@ import styles from './index.module.scss'
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_main}>
|
<View className={styles.order_main}>
|
||||||
{/* <View className={styles.weight_memo_con}>
|
<OrderState orderInfo={{logistics_details:orderDetail?.logistics_details, payment_method: orderDetail?.payment_method, status:orderDetail?.status, expire_time:orderDetail?.expire_time}}/>
|
||||||
<WeightMemo/>
|
|
||||||
</View> */}
|
|
||||||
<OrderState list={orderDetail?.logistics_details} payment_method={orderDetail?.payment_method}/>
|
|
||||||
<View >
|
<View >
|
||||||
<AddressInfoDetail orderId={orderDetail?.id} onSelect={getAddress} onChangeShipmentMode={getShipmentMode} ref={addressRef} defaultValue={defaultAddress} shipment_mode={orderDetail?.shipment_mode}/>
|
<AddressInfoDetail orderInfo={addressInfoDetailData} onSelect={getAddress} onChangeShipmentMode={getShipmentMode} ref={addressRef} defaultValue={defaultAddress} />
|
||||||
</View>
|
</View>
|
||||||
<KindList order={formatPreViewOrderMemo}/>
|
<KindList order={formatPreViewOrderMemo}/>
|
||||||
<View className={styles.order_info} >
|
<View className={styles.order_info} >
|
||||||
@ -218,11 +220,12 @@ import styles from './index.module.scss'
|
|||||||
</View>
|
</View>
|
||||||
{(orderDetail?.status != SaleOrderStatusCancel.value)&&<View className={styles.submit_order}>
|
{(orderDetail?.status != SaleOrderStatusCancel.value)&&<View className={styles.submit_order}>
|
||||||
<OrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
<OrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
||||||
|
<View className="common_safe_area_y"></View>
|
||||||
</View> }
|
</View> }
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||||
<Remark onSave={(e) => getRemark(e)}/>
|
<Remark onSave={(e) => getRemark(e)}/>
|
||||||
</Popup>
|
</Popup>
|
||||||
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={payOrderInfo} />
|
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={orderDetail} />
|
||||||
<View className="common_safe_area_y"></View>
|
<View className="common_safe_area_y"></View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
@ -55,6 +55,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
|||||||
orderId: value?.id,
|
orderId: value?.id,
|
||||||
actual_amount: value?.actual_amount, //实付金额
|
actual_amount: value?.actual_amount, //实付金额
|
||||||
wait_pay_amount: value?.wait_pay_amount, //待付金额
|
wait_pay_amount: value?.wait_pay_amount, //待付金额
|
||||||
|
sale_mode: value?.sale_mode, //订单类型
|
||||||
}
|
}
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
|
@ -96,12 +96,17 @@ export default () => {
|
|||||||
|
|
||||||
//监听点击的按钮
|
//监听点击的按钮
|
||||||
const clickOrderBtn = useCallback(({status, orderInfo}) => {
|
const clickOrderBtn = useCallback(({status, orderInfo}) => {
|
||||||
console.log('status:::', status)
|
|
||||||
if(status == 1 || status == 6) {
|
if(status == 1 || status == 6) {
|
||||||
getOrderList()
|
getOrderList()
|
||||||
} else if(status == 2) {
|
} else if(status == 2) {
|
||||||
//去支付
|
//去支付
|
||||||
setPayOrderInfo({orderId:orderInfo.should_collect_order_id, payment_method:orderInfo.payment_method})
|
console.log('orderInfo::',orderInfo)
|
||||||
|
setPayOrderInfo({
|
||||||
|
should_collect_order_id: orderInfo.should_collect_order_id,//应付单id
|
||||||
|
pre_collect_order_id: orderInfo.pre_collect_order_id, //预付单id
|
||||||
|
status: orderInfo.status, //订单状态
|
||||||
|
payment_method: orderInfo.payment_method //支付方式
|
||||||
|
})
|
||||||
toPay()
|
toPay()
|
||||||
}
|
}
|
||||||
}, [orderData])
|
}, [orderData])
|
||||||
@ -131,7 +136,7 @@ export default () => {
|
|||||||
<OrderStatusList list={statusList} onSelect={changeStatus} defaultId={1}/>
|
<OrderStatusList list={statusList} onSelect={changeStatus} defaultId={1}/>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.order_list}>
|
<View className={styles.order_list}>
|
||||||
<InfiniteScroll statusMore={statusMore} selfonScrollToLower={getScrolltolower} refresherEnabled={true} refresherTriggered={refresherTriggeredStatus} selfOnRefresherRefresh={getRefresherRefresh}>
|
<InfiniteScroll statusMore={statusMore} selfonScrollToLower={getScrolltolower} refresherEnabled={false} refresherTriggered={refresherTriggeredStatus} selfOnRefresherRefresh={getRefresherRefresh}>
|
||||||
{orderData?.list.map(item => {
|
{orderData?.list.map(item => {
|
||||||
return <View key={item.id} className={styles.order_item_con}> <Order value={item} onClickBtn={clickOrderBtn}/></View>
|
return <View key={item.id} className={styles.order_item_con}> <Order value={item} onClickBtn={clickOrderBtn}/></View>
|
||||||
})}
|
})}
|
||||||
|
@ -69,7 +69,7 @@ export default () => {
|
|||||||
<View className={styles.search}>
|
<View className={styles.search}>
|
||||||
<Search style={{width: '100%'}} placeholder="请输入面料关键词" placeIcon="out" showBtn={true} clickOnSearch={(e) => searchEvent(e)}/>
|
<Search style={{width: '100%'}} placeholder="请输入面料关键词" placeIcon="out" showBtn={true} clickOnSearch={(e) => searchEvent(e)}/>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.up_search} onClick={() => goLink('/pages/searchList/searchList')}>高级搜索</View>
|
<View className={styles.up_search} onClick={() => goLink('/pages/searchList/hightSearchList')}>高级搜索</View>
|
||||||
{searchData?.hotField.length > 0 && <View className={styles.hot}>
|
{searchData?.hotField.length > 0 && <View className={styles.hot}>
|
||||||
<View className={styles.hot_header}>
|
<View className={styles.hot_header}>
|
||||||
<View className={styles.hot_header_title}>热门面料</View>
|
<View className={styles.hot_header_title}>热门面料</View>
|
||||||
|
@ -5,6 +5,7 @@ import classnames from "classnames";
|
|||||||
import { useSelector } from "@/reducers/hooks";
|
import { useSelector } from "@/reducers/hooks";
|
||||||
import { alert, goLink } from "@/common/common";
|
import { alert, goLink } from "@/common/common";
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
import {BASE_URL} from '@/common/constant'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
// 用户信息
|
// 用户信息
|
||||||
@ -27,6 +28,8 @@ export default () => {
|
|||||||
<Assets />
|
<Assets />
|
||||||
<Main />
|
<Main />
|
||||||
<Modal data={adminUserInfo}/>
|
<Modal data={adminUserInfo}/>
|
||||||
|
{/* 测试暂时添加 */}
|
||||||
|
<View style={{fontSize:'26rpx', textAlign:'center'}}>{BASE_URL}</View>
|
||||||
{!adminUserInfo.is_authorize_name&&<View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
{!adminUserInfo.is_authorize_name&&<View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
@ -4,6 +4,7 @@ import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi } from "@/api/
|
|||||||
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"
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo()
|
const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo()
|
||||||
@ -74,10 +75,9 @@ export default () => {
|
|||||||
})
|
})
|
||||||
if(user_res.success) {
|
if(user_res.success) {
|
||||||
setUserInfo({...user_res.data})
|
setUserInfo({...user_res.data})
|
||||||
|
|
||||||
getAdminUserInfo()
|
getAdminUserInfo()
|
||||||
|
reslove(true)
|
||||||
} else {
|
} else {
|
||||||
console.log('aaa:::',user_res.msg)
|
|
||||||
reject(user_res.msg)
|
reject(user_res.msg)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -114,8 +114,39 @@ export default () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
/**
|
||||||
uploadCDNImg
|
* 上传手机图片
|
||||||
|
* @param cdn_upload_type //CDN 文件上传场景值
|
||||||
|
*/
|
||||||
|
// product 产品相关,图片、纹理图等 全平台
|
||||||
|
// after-sale 售后(申请退货、退款)相关的、图片、视频 全平台
|
||||||
|
// mall 电子商城相关的 全平台
|
||||||
|
// logistics 物流(发货、提货)相关的、图片、视频 全平台
|
||||||
|
type cdn_upload_type_Param = 'product'|'after-sale'|'mall'|'logistics'
|
||||||
|
const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
Taro.chooseImage({
|
||||||
|
count: 1, // 默认9
|
||||||
|
sizeType: ['original', 'compressed'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
success: async function (res) {
|
||||||
|
const file = res.tempFiles[0]
|
||||||
|
try {
|
||||||
|
let data = await uploadCDNImg(file, cdn_upload_type, cdn_upload_type)
|
||||||
|
resolve(data)
|
||||||
|
} catch(res) {
|
||||||
|
reject(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
uploadCDNImg,
|
||||||
|
getWxPhoto
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user