Compare commits

...

4 Commits

Author SHA1 Message Date
王文龙 a2474dddc0 修复已知bug 2024-02-29 13:42:55 +08:00
王文龙 3581889d7a 修复已知bug 2024-02-28 19:18:10 +08:00
王文龙 15759db8bc 修复已知bug,隐藏首页品牌介绍,优化sku选择规则 2024-02-28 18:42:55 +08:00
王文龙 1cc8f465a0 修复已知bug 2024-02-28 14:08:12 +08:00
21 changed files with 137 additions and 69 deletions

View File

@ -4,6 +4,10 @@ export function search (params = {}) {
// return req.get('/item.search', params)
return req.get('/goods/items', params)
}
export function searchHotKey (params = {}) {
// return req.get('/item.search', params)
return req.get('/goods/keywords', params)
}
export function detail (item_id, params = {}) {
return req.get(`/goods/items/${item_id}`, params)

View File

@ -49,7 +49,6 @@ export default class GoodsEvaluation extends Component {
}
fortmatStr (desc) {
console.log("🚀 ~ GoodsEvaluation ~ desc:", desc)
let desc_info = '颜色分类:'
if (desc) {
try {
@ -106,7 +105,7 @@ export default class GoodsEvaluation extends Component {
</View>
<View className='evaluation-item__main'>
<View className='name-wrap'>
<View className='name'>{info.anonymous ? '匿名用户' : info.username}
<View className='name'>{'匿名用户' || info.anonymous ? '匿名用户' : info.username}
<Text style={{ marginLeft: '10rpx' }}>{info.item_spec_desc_txt}</Text>
</View>
<AtRate size='14' value={info.star} />

View File

@ -111,7 +111,7 @@ export default class SearchBar extends Component {
}
handleClickHotItem = (item) => {
this.handleConfirm({ detail: { value: item.tit } })
this.handleConfirm({ detail: { value: item } })
}
handleBlurSearch = () => {
@ -123,7 +123,7 @@ export default class SearchBar extends Component {
}
render () {
const { isFixed, keyword, showDailog, placeholder } = this.props
const { isFixed, keyword, showDailog, placeholder, hotSearch } = this.props
const { showSearchDailog, historyList, isShowAction, searchValue } = this.state
return (
<View
@ -230,8 +230,8 @@ export default class SearchBar extends Component {
<Text className='hot-title__desc'>近期大家搜索最多</Text>
</View>
<View className='hot-list'>
{[{ tit: '#测试数据' }].map((item, index) => <View className='hot-list__item' onClick={this.handleClickHotItem.bind(this, item)} key={index}>
<Text>{item.tit}</Text>
{hotSearch.map((item, index) => <View className='hot-list__item' onClick={this.handleClickHotItem.bind(this, item.content)} key={index}>
<Text>{item.content ? '#' + item.content : ''}</Text>
{/* <View className='at-icon at-icon-chevron-right'></View> */}
</View>)}
</View>

View File

@ -98,12 +98,15 @@
padding: 40px 30px;
&__item {
padding: 24px 42px;
margin-right: 30px 30px 0 0;
margin: 0 20px 20px 0;
text-align: center;
display: inline-block;
color: #000;
background-color: #9e9e9e40;
border-radius: 6px;
// &:nth-child(3n) {
// margin-right: 0;
// }
}
.at-icon {
font-size: 40px;

View File

@ -28,7 +28,10 @@ const initialState = {
num: 1,
loading: false,
isClickSku: false,
isClickNum: false
isClickNum: false,
isClickPattern: false,
showClickPattern: false,
skuTxtArr: []
}
function SpSkuSelect (props, ref) {
@ -44,7 +47,7 @@ function SpSkuSelect (props, ref) {
// console.log('SpSkuSelect:info', info)
// const [state, setState] = useImmer(initialState)
const [state, setState] = useAsyncCallback(initialState)
const { selection, curImage, disabledSet, curItem, skuText, num, loading, isClickSku } = state
const { selection, curImage, disabledSet, curItem, skuText, num, loading, isClickSku, showClickPattern, skuTxtArr } = state
const dispatch = useDispatch()
const skuDictRef = useRef({})
@ -67,7 +70,8 @@ function SpSkuSelect (props, ref) {
if (a?.skuValue.length > 0 && b?.skuValue.length > 0 && c?.skuValue.length > 0) {
const key = [a.skuValue[0].specId, b.skuValue[0].specId, c.skuValue[0].specId].join('_')
const item = skuDictRef.current[key]
selItem = key && item && item.store > 0 && ['onsale'].includes(item.approveStatus) ? item : null
// && item.store > 0
selItem = key && item && ['onsale'].includes(item.approveStatus) ? item : null
}
}
// 默认选中有库存并且前端可销售的sku
@ -104,14 +108,14 @@ function SpSkuSelect (props, ref) {
for (let i = 0, l = skuList.length; i < l; i++) {
const { skuValue } = skuList[i]
if (i === 2) {
// if (i === 2) {
for (let j = 0, k = skuValue.length; j < k; j++) {
const id = skuValue[j].specId
if (!disabledSet.has(id) && !isNotDisabled(selection, i, id)) {
disabledSet.add(id)
}
}
}
// }
}
// console.log(
// 'skuDict:',
@ -130,11 +134,19 @@ function SpSkuSelect (props, ref) {
? `已选择 ${curItem.specItem.map((item, index) => `${index === 1 ? item.specName.substr(0, 2) : item.specName}`).join(' ')}`
: '请选择规格'
const _skuTxtArr = ['', '', '']
if (curItem) {
const name = curItem.specItem?.[0]?.specName
_skuTxtArr[0] = name ? name + ':' + curItem.itemBn : ''
_skuTxtArr[2] = name ? name + ':' + curItem.itemBnDetail : ''
}
setState((draft) => {
draft.selection = selection
draft.disabledSet = disabledSet
draft.curItem = curItem
draft.skuText = e === -1 ? '' : skuText
draft.skuTxtArr = _skuTxtArr
})
onChange(skuText, curItem, e === -1 ? 0 : e)
@ -151,17 +163,30 @@ function SpSkuSelect (props, ref) {
_selection[idx] = specId
const key = _selection.join('_')
const row = skuDictRef.current[key] || {}
if (disabledSet.has(specId)) return
if (row?.store <= 0) {
if (disabledSet.has(specId) && idx !== 2) return
setState((draft) => {
draft.selection[idx] = specId //null
draft.curImage = 1
})
return showToast('该规格库存为空')
}
if (!state.isClickNum) {
setState((draft) => {
draft.isClickNum = idx === 2
})
}
if (!state.isClickPattern) {
setState((draft) => {
draft.isClickPattern = idx === 1
})
}
setState(
(draft) => {
draft.selection[idx] = specId //null
draft.curImage = 1
draft.isClickSku = draft.isClickNum ? row.store > 0 : idx === 2
draft.showClickPattern = draft.isClickPattern ? row.store > 0 : idx === 1
},
(row) => {
calcDisabled(row.selection, idx)
@ -202,7 +227,7 @@ function SpSkuSelect (props, ref) {
const addToCart = async () => {
const { nospec } = info
if (!nospec && !curItem) {
if ((!nospec && !curItem) || !isClickSku || !showClickPattern) {
showToast('请选择规格')
return
}
@ -224,7 +249,7 @@ function SpSkuSelect (props, ref) {
const fastBuy = async () => {
const { nospec } = info
if ((!nospec && !curItem) || !isClickSku) {
if ((!nospec && !curItem) || !isClickSku || !showClickPattern) {
showToast('请选择规格')
return
}
@ -362,6 +387,7 @@ function SpSkuSelect (props, ref) {
)
}
const txt = ['选择颜色', '', '选择尺码']
return (
<View className='sp-sku-select'>
{/* <SpFloatLayout
@ -391,9 +417,12 @@ function SpSkuSelect (props, ref) {
</View>}
<View className='sku-list'>
{info.skuList.map((item, index) => (
<View className='sku-group' key={`sku-group__${index}`}>
<View className={classNames('sku-group', {
'mt30': index === 1
})} key={`sku-group__${index}`}>
{/* <View className='sku-name'>{item.skuName}</View> */}
<View className='sku-values'>
{index !== 1 && <View className="select-txt">{txt[index]}{index === 2 ? isClickSku && skuTxtArr[index] : skuTxtArr[isClickSku ? 2 : index]}</View>}
<View className={classNames('sku-values')}>
{index === 0 && <ScrollView scrollX scrollWithAnimation showScrollbar={false} scrollLeft={0} className="sku-img-box">
{item.skuValue?.length > 0 && item.skuValue.map((spec, idx) => spec.specImgs.length > 0 && (
<View
@ -411,11 +440,11 @@ function SpSkuSelect (props, ref) {
</ScrollView>}
{index > 0 && (item.skuValue.length > 0 ? item.skuValue.map((spec, idx) => (
<>
{index === 2 && disabledSet.has(spec.specId) ? null : <View
{index === 2 && (showClickPattern && disabledSet.has(spec.specId)) ? null : <View
className={classNames('sku-btn btn-noac', {
'active': spec.specId == selection[index] && isClickSku,
'btn-primary': index !== 2 ? spec.specId == selection[index] : spec.specId == selection[index] && isClickSku,
'disabled': disabledSet.has(spec.specId),
'active': spec.specId == selection[index],
'btn-primary': index !== 2 ? index === 1 ? spec.specId == selection[index] && showClickPattern : spec.specId == selection[index] : spec.specId == selection[index] && isClickSku,
'disabled': index === 1 && disabledSet.has(spec.specId),
'sku-img': spec.specImgs.length > 0
})}
onClick={handleSelectSku.bind(this, spec, index)}
@ -432,7 +461,9 @@ function SpSkuSelect (props, ref) {
</View>
))}
{/* {!hideInputNumber && renderLimitTip()} */}
<View className="select">{skuText.split(' ').map((item, index) => <Text key={`sku-text__${index}`} style={{ marginRight: '14px' }}>{item}</Text>)}</View>
<View className="select">
{/* {skuText.split(' ').map((item, index) => <Text key={`sku-text__${index}`} style={{ marginRight: '14px' }}>{item}</Text>)} */}
</View>
</View>
{/* </SpFloatLayout> */}
</View>

View File

@ -1,4 +1,5 @@
.sp-sku-select {
margin-top: 20px;
.sku-info {
display: flex;
.sku-image {
@ -43,7 +44,7 @@
.sku-list {
position: relative;
padding: 0 30px;
margin: 0;
// margin-top: 20px;
// margin-top: 30px;
// margin-bottom: 100px;
.select {
@ -54,7 +55,16 @@
}
}
.sku-group {
margin: 30px 0 0;
margin: 10px 0 0;
&.mt30 {
margin-top: 30px;
}
.select-txt {
height: 24px;
line-height: 24px;
font-size: 24px;
margin-bottom: 14px;
}
}
.buy-count {
margin-bottom: 20px;

View File

@ -41,8 +41,8 @@
}
.sku-list {
margin-top: 30px;
margin-bottom: 100px;
// margin-top: 30px;
// margin-bottom: 100px;
}
.sku-group {
margin-bottom: 20px;

View File

@ -201,6 +201,8 @@ export const GOODS_INFO = {
specItems: ({ spec_items, is_point }) => {
return pickBy(spec_items, {
approveStatus: 'approve_status',
itemBn: ({ item_bn }) => item_bn ? item_bn.split('-')?.[0] : '',
itemBnDetail: 'item_bn',
specItem: ({ item_spec }) => {
return pickBy(item_spec, {
specId: 'spec_value_id',

View File

@ -1097,7 +1097,7 @@ function CartCheckout (props) {
)}
{!bargain_id && (
<View>
<View style={{ marginBottom: '40rpx' }}>
<SpCell
isLink
className='cart-checkout__pay'

View File

@ -9,7 +9,7 @@ $margin24: 10px;
justify-content: space-between;
align-items: flex-end;
background: #fff;
padding: 0 40px 90px 50px;
padding: 10px 40px 90px 50px;
// height: 100%;
&__total {
white-space: nowrap;

View File

@ -551,7 +551,7 @@ function Home () {
</ScrollView>
</View>)}
</>}
{isUpOperation && showRecommend && <View className="brand" style={{ padding: '15px', height: '550px' }}>
{false && isUpOperation && showRecommend && <View className="brand" style={{ padding: '15px', height: '550px' }}>
<View className="brand-title">品牌介绍</View>
<ScrollView scrollX scrollWithAnimation showScrollbar={false} scrollLeft={0} className="brand-img" style={{ height: '220px' }}>
<View className="brand-img-left brand-img-item" style={{ marginRight: '8px' }}>

View File

@ -43,21 +43,20 @@ function CompEvaluation (props) {
return (
<View className={classNames('comp-evaluation', className)}>
<View className='evaluation-hd'>
{/* <View className='evaluation-hd'>
<View className='title'>{`商品评价(${list.length}`}</View>
{list.length > 0 && (
<View className='extra-more' onClick={onViewMore}>
{/* 查看全部 */}
<Text className='iconfont icon-qianwang-01'></Text>
</View>
)}
</View>
</View> */}
<View className='evaluation-bd'>
{list.map((item) => (
<View className='evaluation-item-wrap'>
<View className='evaluation-item-wrap' onClick={onViewMore}>
<View className='item-hd'>
<SpImage src={item.avatar} className='evaluation-icon' width={50} height={50} />
<Text className='evaluation-name'>{item.username || '匿名用户'}
<Text className='evaluation-name'>{'匿名用户' || item.username}
<Text style={{ marginLeft: '10rpx' }}>{fortmatStr(item.item_spec_desc)}</Text>
</Text>
</View>

View File

@ -1,7 +1,7 @@
.comp-evaluation {
// margin: 0 16px;
background-color: #fff;
padding: 0 30px;
// padding: 0 30px;
// box-shadow: 0px 2px 10px 0px #eae7e0;
.evaluation-hd {
display: flex;
@ -23,6 +23,7 @@
// padding: 24px 0;
.evaluation-item-wrap {
margin-bottom: 20px;
margin-top: 20px;
// &:not(:last-child) {
// margin-bottom: 20px;
// }

View File

@ -291,16 +291,15 @@ function EspierDetail (props) {
}
})
}
// console.log("🚀 ~ data.introList:", data)
setState((draft) => {
draft.info = {
...data,
subscribe,
}
draft.introList = (data.introList || []).map((item) => {
draft.introList = (data.introList || []).concat([{ isOpen: false, id: '99999999', type: 'eva', title: '商品评价' }]).map((item) => {
return {
...item,
isOpen: false
isOpen: false,
}
})
draft.promotionActivity = data.promotionActivity
@ -785,13 +784,15 @@ function EspierDetail (props) {
})
// if (!item.isOpen) {
// setState((draft) => {
// draft.scrollTop = 742 + Math.random()
// draft.scrollTop = 1042 + Math.random() / 10
// })
// }
}}
title={item.title}
>
<SpHtml content={item.content} />
{item.type !== 'eva' ? <SpHtml content={item.content} /> :
<CompEvaluation list={evaluationList} itemId={info.itemId}></CompEvaluation>
}
</AtAccordion>
<View onClick={() => {
setState((draft) => {
@ -803,7 +804,7 @@ function EspierDetail (props) {
})
// if (!item.isOpen) {
// setState((draft) => {
// draft.scrollTop = 742 + Math.random()
// draft.scrollTop = 1042 + Math.random() / 10
// })
// }
}}>
@ -813,7 +814,8 @@ function EspierDetail (props) {
</View>
</View>) : <View style={{ height: `calc(100% - 380px)` }}></View>}
{/* 商品评价 */}
<CompEvaluation list={evaluationList} itemId={info.itemId}></CompEvaluation>
{/* <CompEvaluation list={evaluationList} itemId={info.itemId}></CompEvaluation> */}
{isArray(historyList) ? <View className='bottom-box'>
<View className="bottom-box-tit">浏览历史</View>
<ScrollView scrollX scrollWithAnimation showScrollbar={true} scrollLeft={0} className="shop-box">

View File

@ -50,6 +50,7 @@ const initialState = {
routerParams: null,
card_id: null, // 兑换券
total: undefined,
historyList: []
}
function ItemList () {
@ -68,7 +69,8 @@ function ItemList () {
show,
fixTop,
routerParams,
total
total,
historyList
} = state
const [isShowSearch, setIsShowSearch] = useState(false)
const { cat_id, main_cat_id, tag_id, card_id, user_card_id } = routerParams || {}
@ -202,7 +204,6 @@ function ItemList () {
select_tags_list = [],
brand_list
} = await api.item.search(params)
console.time('list render')
console.log('fetch list:', list)
const n_list = pickBy(list, doc.goods.ITEM_LIST_GOODS)
const resLeftList = n_list.filter((item, index) => {
@ -216,12 +217,14 @@ function ItemList () {
}
})
console.timeEnd('list render')
const _historyList = await api.item.searchHotKey({ distributor_id: 0, page: 1, pageSize: 10 })
setState((v) => {
v.total = total_count
v.leftList[pageIndex - 1] = resLeftList
v.rightList[pageIndex - 1] = resRightList
v.brandList = pickBy(brand_list?.list, doc.goods.WGT_GOODS_BRAND)
v.historyList = _historyList?.list || []
if (v.tagList.length < 1) {
if (select_tags_list.length > 0) {
v.tagList = [
@ -266,12 +269,13 @@ function ItemList () {
})
}
const handleConfirm = async (val) => {
const handleConfirm = (val) => {
setIsShowSearch(false)
await setState((draft) => {
setState((draft) => {
draft.leftList = []
draft.rightList = []
draft.keywords = val
// draft.keywords = ''
})
goodsRef.current.reset()
}
@ -354,10 +358,11 @@ function ItemList () {
<SpSearchBar
className='search-wrap'
keyword={keywords}
hotSearch={historyList}
placeholder='搜索商品'
isOpened={true}
onFocus={handleOnFocus}
onBlur={() => handleConfirm(keywords)}
// onBlur={() => handleConfirm('')}
onChange={handleOnChange}
onClear={handleOnClear}
onCancel={handleSearchOff}

View File

@ -47,6 +47,7 @@ export default class RecommendList extends Component {
shareInfo: {},
isSpAddressOpened: false,
play: false,
windowWidth: 750,
page: {
isLoading: true
}
@ -578,10 +579,12 @@ export default class RecommendList extends Component {
query,
isShowSearch,
isSpAddressOpened,
play
play,
} = this.state
const { colors } = this.props
let address = info.province + info.city
const windowWidth = Taro.getSystemInfoSync().windowWidth
const height = windowWidth * 9 / 17
return (
<SpPage renderFooter={<SpTabbar />} className='has-nav' title="" isBlack>
@ -764,14 +767,14 @@ export default class RecommendList extends Component {
<View className="line"></View>
</View> */}
<View className="content-item">
<SpImage height={400} width={750} mode="aspectFill" src='recommend/02.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={400} width={750} mode="aspectFill" src='recommend/03.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={400} width={750} mode="aspectFill" src='recommend/04.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={400} width={750} mode="aspectFill" src='recommend/05.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={400} width={750} mode="aspectFill" src='recommend/06.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={400} width={750} mode="aspectFill" src='recommend/07.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={400} width={750} mode="aspectFill" src='recommend/08.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={400} width={750} mode="aspectFill" src='recommend/09.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/03.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/02.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/04.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/05.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/06.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/07.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/08.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
<SpImage height={height * 2} width={windowWidth * 2} mode="aspectFill" src='recommend/09.jpg' isShowMenuByLongpress={false} lazyLoad isNew />
</View>
</View>
}

View File

@ -259,7 +259,7 @@ export default class TradeItem extends Component {
查看物流
</Button>
)} */}
{info.receipt_type !== 'dada' && (
{!info.aftersales_bn && info.receipt_type !== 'dada' && (
<Button
className='btn-action'
style={`box-shadow: 0 0 0 1PX ${colors.data[0].primary}; color: ${colors.data[0].primary}`}

View File

@ -756,7 +756,7 @@ export default class TradeDetail extends Component {
</View>
)}
<ScrollView scroll-y className='scroll-view' scrollIntoView={scrollIntoView}>
<ScrollView scroll-y className='scroll-view' style={{ bottom: info.status === 'WAIT_BUYER_PAY' || info.can_apply_aftersales === 1 || info.status === 'WAIT_BUYER_CONFIRM_GOODS' ? '140rpx' : '40rpx' }} scrollIntoView={scrollIntoView}>
{false && <View className='trade-detail-header' id='order-0'>
<View className='trade-detail-waitdeliver'>
{info.is_logistics && <View className='oneline'>线上订单</View>}

View File

@ -444,9 +444,10 @@ $paddingBottom: 100px;
.right {
font-size: 32px;
}
.left,
.sp-price__symbol,
.sp-price__int {
.left
// ,.sp-price__symbol,
// .sp-price__int
{
font-weight: bold;
}
}

View File

@ -227,11 +227,13 @@ function InvoiceInfo (props) {
// 预览文件
const preview = (url, fileName) => {
Taro.showLoading({ title: '正在加载中', mask: true })
Taro.downloadFile({
url: url,
success: function (res) {
console.log("下载:", res)
var filePath = res.tempFilePath
Taro.hideLoading()
Taro.openDocument({
filePath: filePath,
fileType: getFileType(url),
@ -241,6 +243,9 @@ function InvoiceInfo (props) {
},
})
},
fail: function (_) {
Taro.hideLoading()
}
})
}
// 获取文件类型

View File

@ -304,8 +304,11 @@ function TradeAfterSale (props) {
}
>
{!afterSaleTid ? <View className="after-item">
<View className="after-item-label">请选择售后类型:</View>
<Picker
<View className="after-item-label">售后类型:</View>
<View className="after-item-input">
<View className="input-txt color-hui">{tabList[curTabIdx] ? tabList[curTabIdx].title : '请选择售后类型'}</View>
</View>
{/* <Picker
mode='selector'
range={tabList.map(item => item.title)}
onChange={(e) => {
@ -318,7 +321,7 @@ function TradeAfterSale (props) {
<View className="input-txt">{tabList[curTabIdx] ? tabList[curTabIdx].title : '请选择售后类型'}</View>
<View className="iconfont icon-arrowRight" style={{ color: tabList[curTabIdx] > -1 ? '#000' : '#a5a5a5' }}></View>
</View>
</Picker>
</Picker> */}
</View> : aftersales.progress >= 0 && aftersales.progress != 12 ? <View className="after-item">
<View className="after-item-label">售后单号{afterSaleTid}</View>
<View className="after-item-label" style={{ fontSize: '30rpx', display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', opacity: '80', margin: '36rpx 0 50rpx 0', lineHeight: '0.8' }}>
@ -441,7 +444,7 @@ function TradeAfterSale (props) {
</View>
<View className="after-item mt-40" style={{ marginTop: '60rpx' }}>
<View className="after-item-label color-hui">退货原因</View>
<View className="after-item-label color-hui">退货原因*</View>
{!afterSaleTid ? <Picker
mode='selector'
range={reasons}