🎈 perf(优化商城):
This commit is contained in:
parent
9fa06c5a2c
commit
c2ca7f9e4e
9
package-lock.json
generated
9
package-lock.json
generated
@ -8070,6 +8070,8 @@
|
|||||||
},
|
},
|
||||||
"node_modules/babel-loader/node_modules/webpack": {
|
"node_modules/babel-loader/node_modules/webpack": {
|
||||||
"version": "4.46.0",
|
"version": "4.46.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
|
||||||
|
"integrity": "sha512-6jJuJjg8znb/xRItk7bkT0+Q7AHCYjjFnvKIWQPkNIOyRqoCGvkOs0ipeQzrqz4l5FtN5ZI/ukEHroeX/o1/5Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -8153,9 +8155,8 @@
|
|||||||
},
|
},
|
||||||
"node_modules/babel-plugin-dynamic-import-node": {
|
"node_modules/babel-plugin-dynamic-import-node": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
|
"resolved": "https://registry.npmmirror.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
|
||||||
"integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==",
|
"integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==",
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"object.assign": "^4.1.0"
|
"object.assign": "^4.1.0"
|
||||||
}
|
}
|
||||||
@ -34159,6 +34160,8 @@
|
|||||||
},
|
},
|
||||||
"webpack": {
|
"webpack": {
|
||||||
"version": "4.46.0",
|
"version": "4.46.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
|
||||||
|
"integrity": "sha512-6jJuJjg8znb/xRItk7bkT0+Q7AHCYjjFnvKIWQPkNIOyRqoCGvkOs0ipeQzrqz4l5FtN5ZI/ukEHroeX/o1/5Q==",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@webassemblyjs/ast": "1.9.0",
|
"@webassemblyjs/ast": "1.9.0",
|
||||||
@ -34221,7 +34224,7 @@
|
|||||||
},
|
},
|
||||||
"babel-plugin-dynamic-import-node": {
|
"babel-plugin-dynamic-import-node": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
|
"resolved": "https://registry.npmmirror.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
|
||||||
"integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==",
|
"integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"object.assign": "^4.1.0"
|
"object.assign": "^4.1.0"
|
||||||
|
@ -28,7 +28,7 @@ export const GetProductKindListApi = () => {
|
|||||||
*/
|
*/
|
||||||
export const GetProductListApi = () => {
|
export const GetProductListApi = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: `/v1/mall/product/list`,
|
url: `/v2/mall/product/list`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.
|
|||||||
|
|
||||||
//在线支付图片baseUrl
|
//在线支付图片baseUrl
|
||||||
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL
|
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL
|
||||||
// export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('production') ? 'https://www.zzfzyc.com' : 'http://192.168.1.127:8082'
|
// export const CAP_HTML_TO_IMAGE_BASE_URL = 'http://192.168.1.127:8081'
|
||||||
|
|
||||||
// 上传图片视频
|
// 上传图片视频
|
||||||
export const CDN_UPLOAD_IMG = `${UPLOAD_CDN_URL || ''}`
|
export const CDN_UPLOAD_IMG = `${UPLOAD_CDN_URL || ''}`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Input, View } from '@tarojs/components'
|
import { CustomWrapper, Input, View } from '@tarojs/components'
|
||||||
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import Big from 'big.js'
|
import Big from 'big.js'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
@ -109,7 +109,7 @@ const Counter = memo((props: params) => {
|
|||||||
-
|
-
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.input}>
|
<View className={styles.input}>
|
||||||
<Input type='digit' value={String(value.count)} onInput={onInputEven} onBlur={onBluerEven} disabled={disabled} alwaysEmbed={true} cursorSpacing={150} />
|
<Input type='digit' value={value.count} onInput={onInputEven} onBlur={onBluerEven} disabled={disabled} alwaysEmbed={true} cursorSpacing={150} />
|
||||||
<View className={styles.unit}>{unit}</View>
|
<View className={styles.unit}>{unit}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.plus} onClick={() => onPlus()}>
|
<View className={styles.plus} onClick={() => onPlus()}>
|
||||||
|
@ -60,8 +60,8 @@ export default memo((props: param) => {
|
|||||||
return sale_model != item.sale_mode
|
return sale_model != item.sale_mode
|
||||||
}, [item])
|
}, [item])
|
||||||
return (
|
return (
|
||||||
<View className={classnames(styles.product_item, model_status && styles.no_product_item_select)} onClick={clickProduct}>
|
<View className={classnames(styles.product_item, model_status && styles.no_product_item_select)}>
|
||||||
<View className={styles.checkbox} catchMove>
|
<View className={styles.checkbox}>
|
||||||
<MCheckbox status={item.selected} onSelect={selectCallBack} onClose={colseCallBack} disabled={model_status} />
|
<MCheckbox status={item.selected} onSelect={selectCallBack} onClose={colseCallBack} disabled={model_status} />
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.img}>
|
<View className={styles.img}>
|
||||||
|
@ -5,7 +5,7 @@ import MCheckbox from '@/components/checkbox'
|
|||||||
import LoadingCard from '@/components/loadingCard'
|
import LoadingCard from '@/components/loadingCard'
|
||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
import InfiniteScroll from '@/components/infiniteScroll'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState, useTransition } from 'react'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import { alert, goLink } from '@/common/common'
|
import { alert, goLink } from '@/common/common'
|
||||||
import { GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi } from '@/api/shopCart'
|
import { GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi } from '@/api/shopCart'
|
||||||
@ -45,22 +45,28 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
{ value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 3, maxNum: 100000, defaultNum: 3 },
|
{ value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 3, maxNum: 100000, defaultNum: 3 },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const [isPending, startTransition] = useTransition()
|
||||||
|
|
||||||
//切换面料类型
|
//切换面料类型
|
||||||
const [selectIndex, setSelectIndex] = useState<saleModeType>(default_sale_mode || 0)
|
const [selectIndex, setSelectIndex] = useState<saleModeType>(default_sale_mode || 0)
|
||||||
const selectProduct = (index: 0 | 1 | 2) => {
|
const selectProduct = (index: 0 | 1 | 2) => {
|
||||||
setSelectIndex(index)
|
setSelectIndex(index)
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!isPending) {
|
||||||
setSelectIndex(() => default_sale_mode!)
|
setSelectIndex(() => default_sale_mode!)
|
||||||
|
}
|
||||||
}, [default_sale_mode])
|
}, [default_sale_mode])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
startTransition(() => {
|
||||||
resetList()
|
resetList()
|
||||||
setSelectStatus(true)
|
setSelectStatus(true)
|
||||||
|
})
|
||||||
}, [selectIndex])
|
}, [selectIndex])
|
||||||
|
|
||||||
//获取购物车数据数量
|
//获取购物车数据数量
|
||||||
const { setShopCount } = useCommonData()
|
const { getShopCount } = useCommonData()
|
||||||
|
|
||||||
//获取所有数据数据
|
//获取所有数据数据
|
||||||
const [list, setList] = useState<{ [id: number]: any }>({})
|
const [list, setList] = useState<{ [id: number]: any }>({})
|
||||||
@ -193,6 +199,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
const res = await delShopFetchData({ id: selectIds.current })
|
const res = await delShopFetchData({ id: selectIds.current })
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
getShoppingCart()
|
getShoppingCart()
|
||||||
|
getShopCount()
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '成功',
|
title: '成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -321,8 +328,8 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
})}
|
})}
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.con}>
|
<View className={styles.con}>
|
||||||
{loading && <LoadingCard />}
|
{(loading || isPending) && <LoadingCard />}
|
||||||
{!loading && listData?.length > 0 && (
|
{!loading && !isPending && listData?.length > 0 && (
|
||||||
<InfiniteScroll moreStatus={false}>
|
<InfiniteScroll moreStatus={false}>
|
||||||
<View className={styles.product_list}>
|
<View className={styles.product_list}>
|
||||||
{listData?.map((item) => {
|
{listData?.map((item) => {
|
||||||
|
@ -1,46 +1,46 @@
|
|||||||
.main{
|
.main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: $color_bg_one;
|
background-color: #fff;
|
||||||
.search{
|
.search {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
.filter{
|
.filter {
|
||||||
.filter_all {
|
.filter_all {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 20px 50px;
|
padding: 20px 50px;
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
color: $color_font_three;
|
color: $color_font_three;
|
||||||
.text_one{
|
.text_one {
|
||||||
color: $color_main;
|
color: $color_main;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.text_two{
|
.text_two {
|
||||||
position: relative;
|
position: relative;
|
||||||
.miconfont{
|
.miconfont {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
&::before{
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
width: 2px;
|
width: 2px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
background-color: #C2C2C2;
|
background-color: #c2c2c2;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: -50px;
|
left: -50px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.filter_btns{
|
.filter_btns {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
||||||
.selected{
|
.selected {
|
||||||
background-color: #ecf5ff;
|
background-color: #ecf5ff;
|
||||||
border: 2px solid #cde5ff;
|
border: 2px solid #cde5ff;
|
||||||
color: $color_main;
|
color: $color_main;
|
||||||
@ -49,43 +49,42 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.list{
|
.list {
|
||||||
flex:1;
|
flex: 1;
|
||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
.popup_main{
|
.popup_main {
|
||||||
width: 608px;
|
width: 608px;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
.popup_title{
|
.popup_title {
|
||||||
font-size: $font_size;
|
font-size: $font_size;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
}
|
}
|
||||||
.scroll{
|
.scroll {
|
||||||
flex:1;
|
flex: 1;
|
||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
.popup_filter{
|
.popup_filter {
|
||||||
|
|
||||||
}
|
}
|
||||||
.popup_filter_item{
|
.popup_filter_item {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
.title{
|
.title {
|
||||||
font-size: $font_size;
|
font-size: $font_size;
|
||||||
color: $color_font_one;
|
color: $color_font_one;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
}
|
}
|
||||||
.btn_list{
|
.btn_list {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 165.75px);
|
grid-template-columns: repeat(3, 165.75px);
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.btn_item{
|
.btn_item {
|
||||||
width: 165.75px;
|
width: 165.75px;
|
||||||
height: 69.2px;
|
height: 69.2px;
|
||||||
background: #f0f0f0;
|
background: #f0f0f0;
|
||||||
@ -96,7 +95,7 @@
|
|||||||
color: $color_font_one;
|
color: $color_font_one;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
.select_btn_item{
|
.select_btn_item {
|
||||||
color: $color_main;
|
color: $color_main;
|
||||||
background: #ecf5ff;
|
background: #ecf5ff;
|
||||||
border: 2px solid #007aff;
|
border: 2px solid #007aff;
|
||||||
@ -104,7 +103,7 @@
|
|||||||
height: 65.2px;
|
height: 65.2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.btn_list_input{
|
.btn_list_input {
|
||||||
display: flex;
|
display: flex;
|
||||||
// justify-content: space-between;
|
// justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -115,31 +114,30 @@
|
|||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
input{
|
input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.unit{
|
.unit {
|
||||||
color: $color_font_one;
|
color: $color_font_one;
|
||||||
font-size: $font_size;
|
font-size: $font_size;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
text{
|
text {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
.width_main{
|
.width_main {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.btn_list_element{
|
.btn_list_element {
|
||||||
background-color: #F0F0F0;
|
background-color: #f0f0f0;
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
textarea{
|
textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 126px;
|
height: 126px;
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
|
position: fixed;
|
||||||
.shop_icon {
|
.shop_icon {
|
||||||
font-size: 70px;
|
font-size: 70px;
|
||||||
color: $color_main;
|
color: $color_main;
|
||||||
|
@ -29,8 +29,6 @@ type ListParam = {
|
|||||||
sale_price: string
|
sale_price: string
|
||||||
total_price: string
|
total_price: string
|
||||||
weight_error: string
|
weight_error: string
|
||||||
show_sale_price: boolean
|
|
||||||
show_total_price: boolean
|
|
||||||
}
|
}
|
||||||
export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
||||||
const [detail, setDetail] = useState<any>()
|
const [detail, setDetail] = useState<any>()
|
||||||
@ -49,9 +47,7 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
length: (citem.length / 100).toString(),
|
length: (citem.length / 100).toString(),
|
||||||
weight: formatWeightDiv(citem.actual_weight || citem.estimate_weight).toString(),
|
weight: formatWeightDiv(citem.actual_weight || citem.estimate_weight).toString(),
|
||||||
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
||||||
show_sale_price: orderInfo.is_display_price,
|
|
||||||
total_price: formatPriceDiv(citem.total_sale_price || citem.estimate_amount).toString(), //小计
|
total_price: formatPriceDiv(citem.total_sale_price || citem.estimate_amount).toString(), //小计
|
||||||
show_total_price: orderInfo.is_display_price,
|
|
||||||
weight_error: formatWeightDiv(citem.weight_error).toString(),
|
weight_error: formatWeightDiv(citem.weight_error).toString(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -92,8 +88,10 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
show_actual_amount: orderInfo.actual_amount > 0 && orderInfo.is_display_price,
|
show_actual_amount: orderInfo.actual_amount > 0 && orderInfo.is_display_price,
|
||||||
wait_pay_amount: formatPriceDiv(orderInfo.wait_pay_amount).toString(),
|
wait_pay_amount: formatPriceDiv(orderInfo.wait_pay_amount).toString(),
|
||||||
show_wait_pay_amount: orderInfo.wait_pay_amount > 0 && orderInfo.is_display_price,
|
show_wait_pay_amount: orderInfo.wait_pay_amount > 0 && orderInfo.is_display_price,
|
||||||
show_barcode: true,
|
show_barcode: false, //条形码
|
||||||
order_total_weight_error: formatWeightDiv(orderInfo.total_weight_error).toString(), //总空差重量
|
order_total_weight_error: formatWeightDiv(orderInfo.total_weight_error).toString(), //总空差重量
|
||||||
|
show_total_price: orderInfo.is_display_price,
|
||||||
|
show_sale_price: orderInfo.is_display_price,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}, [orderInfo, show])
|
}, [orderInfo, show])
|
||||||
|
@ -28,8 +28,6 @@ type ListParam = {
|
|||||||
sale_price: string
|
sale_price: string
|
||||||
total_price: string
|
total_price: string
|
||||||
weight_error: string
|
weight_error: string
|
||||||
show_sale_price: boolean
|
|
||||||
show_total_price: boolean
|
|
||||||
}
|
}
|
||||||
export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
||||||
const [detail, setDetail] = useState<any>()
|
const [detail, setDetail] = useState<any>()
|
||||||
@ -54,9 +52,7 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
length: (citem.length / 100).toString(),
|
length: (citem.length / 100).toString(),
|
||||||
weight: formatWeightDiv(citem.actual_weight || citem.estimate_weight).toString(),
|
weight: formatWeightDiv(citem.actual_weight || citem.estimate_weight).toString(),
|
||||||
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
||||||
show_sale_price: orderInfo.is_display_price,
|
|
||||||
total_price: formatPriceDiv(citem.total_sale_price || citem.estimate_amount).toString(), //小计
|
total_price: formatPriceDiv(citem.total_sale_price || citem.estimate_amount).toString(), //小计
|
||||||
show_total_price: orderInfo.is_display_price,
|
|
||||||
weight_error: formatWeightDiv(citem.weight_error).toString(),
|
weight_error: formatWeightDiv(citem.weight_error).toString(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -95,8 +91,10 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
show_actual_amount: orderInfo.actual_amount > 0 && orderInfo.is_display_price,
|
show_actual_amount: orderInfo.actual_amount > 0 && orderInfo.is_display_price,
|
||||||
wait_pay_amount: formatPriceDiv(orderInfo.wait_pay_amount).toString(),
|
wait_pay_amount: formatPriceDiv(orderInfo.wait_pay_amount).toString(),
|
||||||
show_wait_pay_amount: orderInfo.wait_pay_amount > 0 && orderInfo.is_display_price,
|
show_wait_pay_amount: orderInfo.wait_pay_amount > 0 && orderInfo.is_display_price,
|
||||||
show_barcode: true,
|
show_barcode: false,
|
||||||
order_total_weight_error: formatWeightDiv(orderInfo.total_weight_error).toString(), //总空差重量
|
order_total_weight_error: formatWeightDiv(orderInfo.total_weight_error).toString(), //总空差重量
|
||||||
|
show_total_price: orderInfo.is_display_price,
|
||||||
|
show_sale_price: orderInfo.is_display_price,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
@ -31,9 +31,6 @@ type ListParam = {
|
|||||||
deduction_weight: string
|
deduction_weight: string
|
||||||
settle_weight: string
|
settle_weight: string
|
||||||
deduction_amount: string
|
deduction_amount: string
|
||||||
show_sale_price: boolean
|
|
||||||
show_total_price: boolean
|
|
||||||
show_deduction_amount: boolean
|
|
||||||
}
|
}
|
||||||
export default memo(({ show = true, onClose, orderInfo }: Param) => {
|
export default memo(({ show = true, onClose, orderInfo }: Param) => {
|
||||||
const [detail, setDetail] = useState<any>()
|
const [detail, setDetail] = useState<any>()
|
||||||
@ -59,14 +56,11 @@ export default memo(({ show = true, onClose, orderInfo }: Param) => {
|
|||||||
length: (citem.length / 100).toString(),
|
length: (citem.length / 100).toString(),
|
||||||
weight: formatWeightDiv(citem.label_weight).toString(),
|
weight: formatWeightDiv(citem.label_weight).toString(),
|
||||||
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
sale_price: formatPriceDiv(citem.sale_price).toString(),
|
||||||
show_sale_price: orderInfo.is_display_price,
|
|
||||||
total_price: formatPriceDiv(citem.refund_amount).toString(), //小计
|
total_price: formatPriceDiv(citem.refund_amount).toString(), //小计
|
||||||
show_total_price: orderInfo.is_display_price,
|
|
||||||
weight_error: formatWeightDiv(citem.settle_weight_error).toString(),
|
weight_error: formatWeightDiv(citem.settle_weight_error).toString(),
|
||||||
deduction_weight: formatWeightDiv(citem.deductions_weight).toString(),
|
deduction_weight: formatWeightDiv(citem.deductions_weight).toString(),
|
||||||
settle_weight: formatWeightDiv(citem.settle_weight).toString(),
|
settle_weight: formatWeightDiv(citem.settle_weight).toString(),
|
||||||
deduction_amount: formatPriceDiv(citem.deductions_amount).toString(),
|
deduction_amount: formatPriceDiv(citem.deductions_amount).toString(),
|
||||||
show_deduction_amount: orderInfo.is_display_price,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -89,6 +83,9 @@ export default memo(({ show = true, onClose, orderInfo }: Param) => {
|
|||||||
show_order_total_deduction_amount: orderInfo.is_display_price,
|
show_order_total_deduction_amount: orderInfo.is_display_price,
|
||||||
order_total_weight_error: formatWeightDiv(orderInfo.total_weight_error).toString(),
|
order_total_weight_error: formatWeightDiv(orderInfo.total_weight_error).toString(),
|
||||||
list: lists,
|
list: lists,
|
||||||
|
show_total_price: orderInfo.is_display_price,
|
||||||
|
show_sale_price: orderInfo.is_display_price,
|
||||||
|
show_deduction_amount: orderInfo.is_display_price,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
@ -1,95 +1,103 @@
|
|||||||
import { Image, ScrollView, Text, View } from "@tarojs/components";
|
import { Image, ScrollView, Text, View } from '@tarojs/components'
|
||||||
import { memo, useEffect, useRef, useState } from "react";
|
import { memo, useEffect, useRef, useState } from 'react'
|
||||||
import classnames from "classnames";
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Popup from "@/components/popup";
|
import Popup from '@/components/popup'
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
import { alert } from "@/common/common";
|
import { alert } from '@/common/common'
|
||||||
import { formatImgUrl } from "@/common/fotmat";
|
import { formatImgUrl } from '@/common/fotmat'
|
||||||
import useCheckAuthorize from "@/use/useCheckAuthorize";
|
import useCheckAuthorize from '@/use/useCheckAuthorize'
|
||||||
import { GetPayCode } from "@/api/onlinePay";
|
import { GetPayCode } from '@/api/onlinePay'
|
||||||
import LoadingCard from "@/components/loadingCard";
|
import LoadingCard from '@/components/loadingCard'
|
||||||
|
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
show?: true|false,
|
show?: true | false
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type Item = {
|
type Item = {
|
||||||
product_code: string,
|
product_code: string
|
||||||
product_name: string,
|
product_name: string
|
||||||
product_color_code: string,
|
product_color_code: string
|
||||||
product_color_name: string,
|
product_color_name: string
|
||||||
num: string,
|
num: string
|
||||||
weight: string,
|
weight: string
|
||||||
sale_price: string,
|
sale_price: string
|
||||||
total_price: string
|
total_price: string
|
||||||
}
|
}
|
||||||
type CodeParam = {
|
type CodeParam = {
|
||||||
title: string,
|
title: string
|
||||||
company: string,
|
company: string
|
||||||
order_type: string,
|
order_type: string
|
||||||
sale_user: string,
|
sale_user: string
|
||||||
order_created_time: string,
|
order_created_time: string
|
||||||
order_no: string,
|
order_no: string
|
||||||
department: string,
|
department: string
|
||||||
shipment_mode: string,
|
shipment_mode: string
|
||||||
target_user_name: string,
|
target_user_name: string
|
||||||
target_address: string,
|
target_address: string
|
||||||
target_description: string,
|
target_description: string
|
||||||
pay_account: string,
|
pay_account: string
|
||||||
bank_account_name: string,
|
bank_account_name: string
|
||||||
bank_name: string,
|
bank_name: string
|
||||||
pay_type: string,
|
pay_type: string
|
||||||
client: string,
|
client: string
|
||||||
phone: string,
|
phone: string
|
||||||
order_total_length: string,
|
order_total_length: string
|
||||||
order_total_price: string,
|
order_total_price: string
|
||||||
qrcode: string,
|
qrcode: string
|
||||||
order_total_weight: string,
|
order_total_weight: string
|
||||||
list: Item[]
|
list: Item[]
|
||||||
}
|
}
|
||||||
export default memo(({show = true, onClose}:Param) => {
|
export default memo(({ show = true, onClose }: Param) => {
|
||||||
|
|
||||||
//获取支付二维码
|
//获取支付二维码
|
||||||
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
||||||
const fileData = useRef({
|
const fileData = useRef({
|
||||||
filePath: '',
|
filePath: '',
|
||||||
base64: ''
|
base64: '',
|
||||||
})
|
})
|
||||||
const {fetchData, state} = GetPayCode()
|
const { fetchData, state } = GetPayCode()
|
||||||
const getCore = async () => {
|
const getCore = async () => {
|
||||||
let res = await fetchData({
|
let res = await fetchData({
|
||||||
title: "面料销售电子确认单",
|
title: '面料销售电子确认单',
|
||||||
company: "什么什么公司123",
|
company: '什么什么公司123',
|
||||||
order_type: "散剪",
|
order_type: '散剪',
|
||||||
sale_user: "小崔",
|
sale_user: '小崔',
|
||||||
order_created_time:"2022/02/01 12:32:13",
|
order_created_time: '2022/02/01 12:32:13',
|
||||||
order_no:"XS-211005888",
|
order_no: 'XS-211005888',
|
||||||
department:"嘻嘻嘻",
|
department: '嘻嘻嘻',
|
||||||
shipment_mode:"自提",
|
shipment_mode: '自提',
|
||||||
target_user_name:"大崔",
|
target_user_name: '大崔',
|
||||||
target_address:"阿斯顿发斯蒂芬",
|
target_address: '阿斯顿发斯蒂芬',
|
||||||
target_description:"无",
|
target_description: '无',
|
||||||
pay_account:"1234567890123450001",
|
pay_account: '1234567890123450001',
|
||||||
bank_account_name:"佛山市浩川长盛科技有限公司",
|
bank_account_name: '佛山市浩川长盛科技有限公司',
|
||||||
bank_name:"招商银行佛山分行禅城支行",
|
bank_name: '招商银行佛山分行禅城支行',
|
||||||
pay_type:"现结",
|
pay_type: '现结',
|
||||||
client:"客户名称",
|
client: '客户名称',
|
||||||
phone:"15818085802",
|
phone: '15818085802',
|
||||||
order_total_length:"12",
|
order_total_length: '12',
|
||||||
order_total_price:"63000",
|
order_total_price: '63000',
|
||||||
qrcode:"https://www.zzfzyc.com/checkorder/XS-211005888",
|
qrcode: 'https://www.zzfzyc.com/checkorder/XS-211005888',
|
||||||
order_total_weight:"300.00",
|
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'}]
|
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
|
const base64 = res.data.base64
|
||||||
setPayCodeImage(() => base64)
|
setPayCodeImage(() => base64)
|
||||||
const time = new Date().valueOf()
|
const time = new Date().valueOf()
|
||||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || [];
|
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || []
|
||||||
let filePath = Taro.env.USER_DATA_PATH + '/img' + time +'.'+ format
|
let filePath = Taro.env.USER_DATA_PATH + '/img' + time + '.' + format
|
||||||
fileData.current.filePath = filePath
|
fileData.current.filePath = filePath
|
||||||
fileData.current.base64 = bodyData
|
fileData.current.base64 = bodyData
|
||||||
const save = Taro.getFileSystemManager()
|
const save = Taro.getFileSystemManager()
|
||||||
@ -98,18 +106,16 @@ export default memo(({show = true, onClose}:Param) => {
|
|||||||
data: fileData.current.base64,
|
data: fileData.current.base64,
|
||||||
encoding: 'base64',
|
encoding: 'base64',
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(show)
|
if (show) getCore()
|
||||||
getCore()
|
|
||||||
}, [show])
|
}, [show])
|
||||||
|
|
||||||
//检查是否开启保存图片权限
|
//检查是否开启保存图片权限
|
||||||
const {check} = useCheckAuthorize({scope:'scope.writePhotosAlbum', msg:'您没授权,无法保存图片'})
|
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
||||||
const saveImageCheck = async () => {
|
const saveImageCheck = async () => {
|
||||||
const res = await check()
|
const res = await check()
|
||||||
res&&saveImage()
|
res && saveImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
//保存图片
|
//保存图片
|
||||||
@ -122,7 +128,7 @@ export default memo(({show = true, onClose}:Param) => {
|
|||||||
},
|
},
|
||||||
fail: function (err) {
|
fail: function (err) {
|
||||||
console.log('err::', err)
|
console.log('err::', err)
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +137,7 @@ export default memo(({show = true, onClose}:Param) => {
|
|||||||
console.log('fileData.current.filePath::', fileData.current.filePath)
|
console.log('fileData.current.filePath::', fileData.current.filePath)
|
||||||
Taro.previewImage({
|
Taro.previewImage({
|
||||||
current: fileData.current.filePath, // 当前显示
|
current: fileData.current.filePath, // 当前显示
|
||||||
urls: [fileData.current.filePath] // 需要预览的图片http链接列表
|
urls: [fileData.current.filePath], // 需要预览的图片http链接列表
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,15 +153,17 @@ export default memo(({show = true, onClose}:Param) => {
|
|||||||
扫码支付成功后,自动更新状态
|
扫码支付成功后,自动更新状态
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.scanPay_list}>
|
<View className={styles.scanPay_list}>
|
||||||
{(state.loading)&&<LoadingCard/>||
|
{(state.loading && <LoadingCard />) || (
|
||||||
<ScrollView scrollY className={styles.scanPay_list}>
|
<ScrollView scrollY className={styles.scanPay_list}>
|
||||||
<Image mode="widthFix" src={payCodeImage} onClick={showImage}></Image>
|
<Image mode='widthFix' src={payCodeImage} onClick={showImage}></Image>
|
||||||
</ScrollView>}
|
</ScrollView>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<View className={styles.btns} onClick={saveImageCheck}>
|
||||||
|
保存电子确认单
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.btns} onClick={saveImageCheck}>保存电子确认单</View>
|
|
||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
)
|
)
|
||||||
})
|
})
|
@ -2,7 +2,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #f8f8f8;
|
background-color: #fff;
|
||||||
.search {
|
.search {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
@ -102,16 +102,16 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
line-height: 86px;
|
line-height: 86px;
|
||||||
&::before {
|
// &::before {
|
||||||
content: '';
|
// content: '';
|
||||||
opacity: 1;
|
// opacity: 1;
|
||||||
width: 30px;
|
// width: 30px;
|
||||||
height: 100%;
|
// height: 100%;
|
||||||
position: absolute;
|
// position: absolute;
|
||||||
left: -15px;
|
// left: -15px;
|
||||||
background-image: linear-gradient(to right, rgba(248, 248, 248, 0.3), rgba(248, 248, 248, 1) 60%);
|
// background-image: linear-gradient(to right, rgba(255, 255, 255), rgba(248, 248, 248, 1) 60%);
|
||||||
// z-index: 99;
|
// // z-index: 99;
|
||||||
}
|
// }
|
||||||
.miconfont {
|
.miconfont {
|
||||||
font-size: 27px;
|
font-size: 27px;
|
||||||
}
|
}
|
||||||
|
@ -3816,7 +3816,7 @@
|
|||||||
|
|
||||||
"babel-plugin-dynamic-import-node@2.3.3":
|
"babel-plugin-dynamic-import-node@2.3.3":
|
||||||
"integrity" "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ=="
|
"integrity" "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ=="
|
||||||
"resolved" "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz"
|
"resolved" "https://registry.npmmirror.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz"
|
||||||
"version" "2.3.3"
|
"version" "2.3.3"
|
||||||
dependencies:
|
dependencies:
|
||||||
"object.assign" "^4.1.0"
|
"object.assign" "^4.1.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user