mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-14 17:41:45 +08:00
Merge remote-tracking branch 'ecshopx/feature/huiqiyd-173' into feature/huiqiyd-173
This commit is contained in:
@@ -819,8 +819,6 @@ function CartCheckout(props) {
|
||||
// cus_parmas.pay_type = totalInfo.freight_type === 'point' ? 'point' : payType
|
||||
cus_parmas.pay_channel = payChannel
|
||||
// }
|
||||
debugger
|
||||
|
||||
return cus_parmas
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,30 @@
|
||||
import { useContext } from 'react'
|
||||
import Taro, { Component, useRouter } from '@tarojs/taro'
|
||||
import { View, Text, Image } from '@tarojs/components'
|
||||
import React from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { SpGoodsItem, SpImage } from '@/components'
|
||||
import { pickBy, classNames, styleNames, linkPage } from '@/utils'
|
||||
import { pickBy, classNames, styleNames, showToast } from '@/utils'
|
||||
import api from '@/api'
|
||||
import { useImmer } from 'use-immer'
|
||||
|
||||
import doc from '@/doc'
|
||||
import BaSkuSelect from '../ba-sku-select'
|
||||
import './goods-grid.scss'
|
||||
|
||||
const initialState = {
|
||||
info: {},
|
||||
skuPanelOpen: false,
|
||||
selectType: 'picker'
|
||||
}
|
||||
|
||||
const MBaSkuSelect = React.memo(BaSkuSelect)
|
||||
|
||||
function WgtGoodsGrid(props) {
|
||||
const { info } = props
|
||||
if (!info) {
|
||||
return null
|
||||
}
|
||||
const { base, data, config } = info
|
||||
const [state, setState] = useImmer(initialState)
|
||||
const newData = Array.isArray(data) ? data : []
|
||||
const goods = pickBy(newData, doc.goods.WGT_GOODS_GRID) || []
|
||||
|
||||
@@ -25,6 +38,25 @@ function WgtGoodsGrid(props) {
|
||||
})
|
||||
}
|
||||
|
||||
const handleAddToCart = async ({ itemId, distributorId }) => {
|
||||
Taro.showLoading()
|
||||
try {
|
||||
const itemDetail = await api.item.detail(itemId, {
|
||||
showError: false,
|
||||
distributor_id: distributorId
|
||||
})
|
||||
Taro.hideLoading()
|
||||
setState((draft) => {
|
||||
draft.info = pickBy(itemDetail, doc.goods.GOODS_INFO)
|
||||
draft.skuPanelOpen = true
|
||||
draft.selectType = 'addcart'
|
||||
})
|
||||
} catch (e) {
|
||||
showToast(e.message)
|
||||
Taro.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
const leftFilterGoods = goods.filter((leftgoods, leftindex) => {
|
||||
if (leftindex % 2 == 0) {
|
||||
return leftgoods
|
||||
@@ -62,12 +94,15 @@ function WgtGoodsGrid(props) {
|
||||
lazyLoad={false}
|
||||
renderBrand={
|
||||
config.brand && (
|
||||
<View className='brand-info' style={styleNames({
|
||||
'width': '62px',
|
||||
'height': '62px',
|
||||
'border-radius': '32px',
|
||||
'padding': '2px'
|
||||
})}>
|
||||
<View
|
||||
className='brand-info'
|
||||
style={styleNames({
|
||||
'width': '62px',
|
||||
'height': '62px',
|
||||
'border-radius': '32px',
|
||||
'padding': '2px'
|
||||
})}
|
||||
>
|
||||
<SpImage
|
||||
src={item.brand}
|
||||
width={120}
|
||||
@@ -93,12 +128,15 @@ function WgtGoodsGrid(props) {
|
||||
lazyLoad={false}
|
||||
renderBrand={
|
||||
config.brand && (
|
||||
<View className='brand-info' style={styleNames({
|
||||
'width': '64px',
|
||||
'height': '64px',
|
||||
'border-radius': '32px',
|
||||
'padding': '2px'
|
||||
})}>
|
||||
<View
|
||||
className='brand-info'
|
||||
style={styleNames({
|
||||
'width': '64px',
|
||||
'height': '64px',
|
||||
'border-radius': '32px',
|
||||
'padding': '2px'
|
||||
})}
|
||||
>
|
||||
<SpImage
|
||||
src={item.brand}
|
||||
width={120}
|
||||
@@ -114,6 +152,7 @@ function WgtGoodsGrid(props) {
|
||||
jumpType={config.type}
|
||||
info={item}
|
||||
key={`right_${rightidx}`}
|
||||
onAddToCart={() => handleAddToCart(item)}
|
||||
onClick={() => handleClickItem(item)}
|
||||
/>
|
||||
))}
|
||||
@@ -128,12 +167,15 @@ function WgtGoodsGrid(props) {
|
||||
lazyLoad={false}
|
||||
renderBrand={
|
||||
config.brand && (
|
||||
<View className='brand-info' style={styleNames({
|
||||
'width': '64px',
|
||||
'height': '64px',
|
||||
'border-radius': '32px',
|
||||
'padding': '2px'
|
||||
})}>
|
||||
<View
|
||||
className='brand-info'
|
||||
style={styleNames({
|
||||
'width': '64px',
|
||||
'height': '64px',
|
||||
'border-radius': '32px',
|
||||
'padding': '2px'
|
||||
})}
|
||||
>
|
||||
<SpImage
|
||||
src={item.brand}
|
||||
width={120}
|
||||
@@ -155,6 +197,26 @@ function WgtGoodsGrid(props) {
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Sku选择器 */}
|
||||
{state.skuPanelOpen && (
|
||||
<MBaSkuSelect
|
||||
open={state.skuPanelOpen}
|
||||
type={state.selectType}
|
||||
info={state.info}
|
||||
onClose={() => {
|
||||
setState((draft) => {
|
||||
draft.skuPanelOpen = false
|
||||
})
|
||||
}}
|
||||
onChange={(skuText, curItem) => {
|
||||
setState((draft) => {
|
||||
draft.skuText = skuText
|
||||
draft.curItem = curItem
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ export default class WgtWriting extends Component {
|
||||
</View>
|
||||
)}
|
||||
<View
|
||||
className={`slider-wra wgt-writing ${config.padded ? 'padded' : ''}`}
|
||||
style={`${config.align ? `text-align:${config.align}` : ''}`}
|
||||
className={`slider-wra wgt-writing ${config?.padded ? 'padded' : ''}`}
|
||||
style={`${config?.align ? `text-align:${config?.align}` : ''}`}
|
||||
>
|
||||
{contentArr.map((item, index) => {
|
||||
return (
|
||||
|
||||
@@ -69,13 +69,13 @@ function CompTradeItem(props) {
|
||||
<View className='comp-tradeitem'>
|
||||
<View className='trade-item-hd' onClick={onViewTradeDetail}>
|
||||
<View>
|
||||
<View className='shop-info' onClick={onViewStorePage}>
|
||||
{/* <View className='shop-info' onClick={onViewStorePage}>
|
||||
<SpImage src={distributorInfo?.logo} width={100} height={100} />
|
||||
<View className='shop-name'>
|
||||
{distributorInfo?.name}
|
||||
{!VERSION_STANDARD && <Text className='iconfont icon-qianwang-01'></Text>}
|
||||
</View>
|
||||
</View>
|
||||
</View> */}
|
||||
<View className='trade-no'>{`订单编号: ${orderId}`}</View>
|
||||
<View className='trade-time'>{`订单时间: ${createDate}`}</View>
|
||||
</View>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
.trade-no {
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.trade-time {
|
||||
|
||||
Reference in New Issue
Block a user