diff --git a/src/components/sp-goods-cell/index.js b/src/components/sp-goods-cell/index.js index 037a22f..1d23674 100755 --- a/src/components/sp-goods-cell/index.js +++ b/src/components/sp-goods-cell/index.js @@ -136,14 +136,14 @@ function SpGoodsCell (props) { {isPoint && } {!isPoint && } - {info.marketPrice > 0 && ( + {/* {info.marketPrice > 0 && ( - )} + )} */} ) diff --git a/src/components/sp-goods-item/index.js b/src/components/sp-goods-item/index.js index a4c495f..b40482d 100755 --- a/src/components/sp-goods-item/index.js +++ b/src/components/sp-goods-item/index.js @@ -47,6 +47,7 @@ function SpGoodsItem (props) { const [current, setCurrent] = useState(0) const [move, setMove] = useState(0) const [selColorItem, setSelColorItem] = useState({}) + const { windowWidth } = Taro.getSystemInfoSync() const setSelColor = (index, item) => { setCurrent(index) @@ -134,7 +135,7 @@ function SpGoodsItem (props) { - {info.tagList?.map((item, index) => {item.tag_name})} + {info.tagList?.filter((item) => item.front_show === '1').map((item, index) => {item.tag_name})} {/* NEW */} {/* {renderBrand && {renderBrand}} */} @@ -168,7 +169,7 @@ function SpGoodsItem (props) { }} scrollLeft={move * 32} scrollX scrollWithAnimation className='color-box' showScrollbar={false}> {(info.spec_images || colors).map((item, index) => ( setSelColor(index, item)} key={`color__${index}`}> - + = 420 ? '14px' : '24rpx', height: windowWidth >= 420 ? '14px' : '24rpx' }}> ))} diff --git a/src/components/sp-image/index.js b/src/components/sp-image/index.js index f8d17f4..71c58a1 100755 --- a/src/components/sp-image/index.js +++ b/src/components/sp-image/index.js @@ -24,7 +24,8 @@ function SpImage (props) { lazyLoad = false, circle = false, isNew = false, - isShowMenuByLongpress = true + isShowMenuByLongpress = true, + children } = props const [state, setState] = useImmer(initialState) const { loadSuccess } = state @@ -83,6 +84,7 @@ function SpImage (props) { // lazyLoad={lazyLoad} showMenuByLongpress={isShowMenuByLongpress} /> + {children} ) } diff --git a/src/components/sp-image/index.scss b/src/components/sp-image/index.scss index 125ab2b..bc6b694 100755 --- a/src/components/sp-image/index.scss +++ b/src/components/sp-image/index.scss @@ -2,6 +2,7 @@ box-sizing: border-box; transition: all 0.2 ease-in-out; opacity: 0; + position: relative; &.opacity-1 { opacity: 1; } diff --git a/src/components/sp-order-item/index.scss b/src/components/sp-order-item/index.scss index d877962..23dcb75 100755 --- a/src/components/sp-order-item/index.scss +++ b/src/components/sp-order-item/index.scss @@ -15,7 +15,7 @@ margin-right: 60px; } &__bd { - width: 38%; + width: 42%; // margin-bottom: 40px; padding: 20px 0; position: relative; @@ -26,7 +26,7 @@ &__ft { flex: 1; text-align: right; - padding-top: 10px; + padding-top: 8px; // font-size: $font-size-small; } &__title { @@ -34,6 +34,7 @@ @include multi-ellipsis(1); margin-bottom: 26px; color: #000; + font-size: 20px; // margin: 0 0 15px; &-tag { display: inline-block; @@ -45,6 +46,7 @@ } } &__desc { + opacity: 0.85; // color: $color-gray; // font-size: $font-size-small; // margin-bottom: 10px; @@ -67,6 +69,7 @@ &__num { display: block; margin-top: 26px; + opacity: 0.85; // color: $color-gray; } &__pay-type { diff --git a/src/components/sp-page/index.js b/src/components/sp-page/index.js index 84bbe5c..8014598 100755 --- a/src/components/sp-page/index.js +++ b/src/components/sp-page/index.js @@ -309,7 +309,7 @@ function SpPage (props, ref) { } }} /> - {showNavCartIcon && Taro.redirectTo({ url: '/pages/cart/espier-index' })} height={36} mode='heightFix' isNew />} + {showNavCartIcon ? cartCount > 0 ? Taro.redirectTo({ url: '/pages/cart/espier-index' })} height={36} mode='heightFix' isNew /> : Taro.redirectTo({ url: '/pages/cart/espier-index' })} height={36} mode='heightFix' isNew /> : null} {showNavHomeIcon && Taro.redirectTo({ url: '/pages/index' })} height={36} mode='heightFix' isNew />} {showNavSearchIcon && Taro.navigateTo({ url: '/pages/item/list' })} src={`member/chazhao-${isBlack ? "black" : "light"}.png`} height={34} mode='heightFix' isNew />} diff --git a/src/components/sp-sku-select-new/index.js b/src/components/sp-sku-select-new/index.js index 5b9ee6d..b2d826b 100755 --- a/src/components/sp-sku-select-new/index.js +++ b/src/components/sp-sku-select-new/index.js @@ -63,10 +63,13 @@ function SpSkuSelect (props, ref) { const init = () => { const { skuList, specItems } = info - console.log("🚀 ~ skuList:", skuList) specItems.forEach((item) => { const key = item.specItem.map((spec) => spec.specId).join('_') skuDictRef.current[key] = item + if (item.store > 0) { + } else { + console.log("🚀 ~ item库存为0:", key, item.specItem.map((item) => item.specName).join('_')) + } }) // 默认选中有库存并且前端可销售的sku const defaultSpecItem = specItems.find((item) => item.store > 0 && ['onsale'].includes(item.approveStatus)) @@ -75,24 +78,28 @@ function SpSkuSelect (props, ref) { selection = defaultSpecItem.specItem.map((item) => item.specId) } - calcDisabled(selection) + calcDisabled(selection, -1) } - const calcDisabled = (selection, i = 0) => { - const { skuList } = info + const calcDisabled = (selection, e = 0) => { + const { skuList, specItems } = info const disabledSet = new Set() const makeReg = (sel, row, val) => { const tSel = sel.slice() const regStr = tSel.map((s, idx) => (row === idx ? val : !s ? '(\\d+)' : s)).join('_') - // console.log('regStr:', regStr) - return new RegExp(regStr) + return regStr + // return new RegExp(regStr) } const isNotDisabled = (sel, row, val) => { const reg = makeReg(sel, row, val) return Object.keys(skuDictRef.current).some((key) => { - return key.match(reg) && skuDictRef.current[key].store > 0 && ['onsale'].includes(skuDictRef.current[key].approveStatus) + if (key == reg) { + return skuDictRef.current[key].store > 0 && ['onsale'].includes(skuDictRef.current[key].approveStatus) + } else { + return false + } }) } @@ -126,10 +133,10 @@ function SpSkuSelect (props, ref) { draft.selection = selection draft.disabledSet = disabledSet draft.curItem = curItem - draft.skuText = skuText + draft.skuText = e === -1 ? '' : skuText }) - onChange(skuText, curItem, i) + onChange(skuText, curItem, e === -1 ? 0 : e) } // calcDisabled(initSelection) @@ -392,26 +399,28 @@ function SpSkuSelect (props, ref) { )} } {index > 0 && item.skuValue.map((spec, idx) => ( - 0 - })} - onClick={handleSelectSku.bind(this, spec, index)} - key={`sku-values-item__${idx}`} - > - {/* {spec.specImgs.length > 0 && ( - - )} */} - {spec.specName} - + <> + {!disabledSet.has(spec.specId) && 0 + })} + onClick={handleSelectSku.bind(this, spec, index)} + key={`sku-values-item__${idx}`} + > + {/* {spec.specImgs.length > 0 && ( + + )} */} + {spec.specName} + } + ))} ))} - {!hideInputNumber && renderLimitTip()} + {/* {!hideInputNumber && renderLimitTip()} */} {skuText.split(' ').map((item, index) => {item})} {/* */} diff --git a/src/doc/goods.js b/src/doc/goods.js index 5fb4147..1647d88 100755 --- a/src/doc/goods.js +++ b/src/doc/goods.js @@ -122,6 +122,7 @@ export const GOODS_INFO = { itemId: 'item_id', itemBn: 'item_bn', itemName: 'itemName', + itemName2: 'item_name_2', brief: 'brief', img: 'pics[0]', imgs: 'pics', diff --git a/src/doc/trade.js b/src/doc/trade.js index b7ebf27..7b8f249 100755 --- a/src/doc/trade.js +++ b/src/doc/trade.js @@ -72,18 +72,55 @@ export const SHOP_INFO = { export const TRADE_AFTER_SALES_ITEM = { orderId: 'order_id', progress: 'progress', + aftersalesAddress: 'aftersales_address', progressMsg: ({ app_info }) => app_info.progress_msg, afterSalesBn: 'aftersales_bn', + aftersalesStatus: 'aftersales_status', afterSalesType: 'aftersales_type', distributorRemark: 'distributor_remark', refuseReason: 'refuse_reason', items: ({ detail }) => { - return pickBy(detail, { - pic: ({ orderItem }) => orderItem.pic, - itemName: ({ orderItem }) => orderItem.item_name, - itemSpecDesc: ({ orderItem }) => orderItem.item_spec_desc, - num: ({ orderItem }) => orderItem.num, - price: ({ orderItem }) => orderItem.total_fee / 100, + // return pickBy(detail, { + // pic: ({ orderItem }) => orderItem.pic, + // itemName: ({ orderItem }) => orderItem.item_name, + // itemSpecDesc: ({ orderItem }) => orderItem.item_spec_desc, + // num: ({ orderItem }) => orderItem.num, + // price: ({ orderItem }) => orderItem.total_fee / 100, + // }) + const _detail = detail.filter(item => item.aftersales_bn).map(item => ({ + ...item, ...item.orderItem + })) + return pickBy(_detail, { + id: 'id', + pic: 'pic', + itemName: 'item_name', + price: ({ total_fee }) => total_fee / 100, + num: 'num', + // 可售后商品数 + leftAftersalesNum: 'left_aftersales_num', + // 默认售后商品数 + refundNum: 1, + itemSpecDesc: 'item_spec_desc', + point: 'point', + checked: () => false, + descInfo: ({ item_spec_desc }) => { + const desc = item_spec_desc + let desc_info = '' + if (desc) { + try { + const descArr = desc.split(',') + descArr.forEach((item, index) => { + let [_, value] = item.split(':') + if (index === 1) { + value = value.substring(0, 2) + } + desc_info += value + ' ' + }) + } catch (error) { + } + return desc_info + } + } }) }, hasAftersalesAddress: ({ aftersales_address }) => isObject(aftersales_address), @@ -93,6 +130,8 @@ export const TRADE_AFTER_SALES_ITEM = { afterSalesContact: ({ aftersales_address }) => aftersales_address.aftersales_contact, aftersalesHours: ({ aftersales_address }) => aftersales_address.aftersales_hours, refundFee: ({ refund_fee }) => refund_fee / 100, + sendbackData: 'sendback_data', + hasSendbackData: ({ sendback_data }) => isObject(sendback_data), refundPoint: 'refund_point', reason: 'reason', description: 'description', diff --git a/src/pages/home/index.scss b/src/pages/home/index.scss index 4f487bc..a5d8baf 100755 --- a/src/pages/home/index.scss +++ b/src/pages/home/index.scss @@ -73,13 +73,15 @@ page { // height: calc(100vh - #{$tabbar-height}); transition: height 0.3s ease-in-out; animation: fadeInAnimation 0.35s ease-in; - &.swiper-narrow { - height: calc(100vh - 620px - #{$tabbar-height} - var(--status-bar-height)); - } + // &.swiper-narrow { + // height: calc(100vh - 620px - #{$tabbar-height} - var(--status-bar-height)); + // } } .swiper-narrow { - height: calc(100vh - 620px - #{$tabbar-height} - var(--status-bar-height)); + // height: calc(100vh - 620px - #{$tabbar-height} - var(--status-bar-height)); + height: calc(100vh - 420px - #{$tabbar-height} - var(--status-bar-height)); transition: height 0.35s linear; + margin-top: -200px; } .item-btns { display: flex; @@ -139,7 +141,7 @@ page { } } .icon-kf { - position: absolute; + position: fixed; right: 20px; top: 60%; width: 80px; @@ -236,6 +238,29 @@ page { } } } +.recommend_btn { + display: flex; + flex-direction: column; + position: absolute; + bottom: 10%; + &-title { + font-size: 40px; + color: #fff; + margin-bottom: 12px; + font-weight: bold; + } + &-btn { + width: 174px; + height: 56px; + background-color: #000; + color: #fff; + font-size: 24px; + border-radius: 6px; + display: flex; + justify-content: center; + align-items: center; + } +} @keyframes fadeInAnimation { from { opacity: 0; diff --git a/src/pages/index.js b/src/pages/index.js index 2063dce..bde0656 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -102,12 +102,14 @@ const initialState = { pic: 'https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/image/1/2024/01/15/46fe6ca52277038e39ee2c026a4af3c90XruENsSSAhRiz0HPI3PjR8XQNVgbxHb' }, ], - goodList: [] + goodList: [], + recommend: [] } function Home () { const [state, setState] = useImmer(initialState) const [startY, setStartY] = useState(0) + const [startX, setStartX] = useState(0) const [likeList, setLikeList] = useImmer([]) const { initState, openRecommend, openLocation, openStore, appName, openScanQrcode } = useSelector( @@ -120,8 +122,10 @@ function Home () { const showAdv = useSelector((member) => member.user.showAdv) const { location } = useSelector((state) => state.user) const { setNavigationBarTitle } = useNavigation() + const { windowWidth } = Taro.getSystemInfoSync() + const imgW = parseFloat(((windowWidth * 2 - 60 - 32) / 3).toFixed(4)) - const { wgts, loading, searchComp, pageData, fixedTop, filterWgts, isShowHomeHeader, isUpOperation, showRecommend, shopList, swiperList, goodList } = state + const { wgts, loading, searchComp, pageData, fixedTop, filterWgts, isShowHomeHeader, isUpOperation, showRecommend, shopList, swiperList, goodList, recommend } = state const dispatch = useDispatch() @@ -130,6 +134,7 @@ function Home () { init() setNavigationBarTitle(appName) getSwiperList() + getRecommendItems() } }, [initState]) @@ -188,6 +193,50 @@ function Home () { } } + const getRecommendItems = async () => { + const req = { + page: 1, + pageSize: 10, + approve_status: 'onsale', + approve_status: 'onsale,only_show', + item_type: 'normal', + is_point: false, + // goodsSort: 6, + distributor_id: 0 + } + const { list: jdList } = await api.item.search({ ...req, tag_id: 1 }) + const { list: newList } = await api.item.search({ ...req, tag_id: 2 }) + const { list: hotList } = await api.item.search({ ...req, tag_id: 3 }) + setState((draft) => { + draft.recommend = [{ + type: 'new', + text: "新品推荐", + btnTxt: '查看更多', + postions: 'left', + url: '', + img: 'index/rec/new.png', + list: newList + }, { + type: 'hot', + text: "热销单品", + btnTxt: '查看更多', + postions: 'left', + url: '', + img: 'index/rec/hot.png', + list: hotList + }, { + type: 'jd', + text: "ARIZONA", + btnTxt: '经典双扣', + postions: 'right', + url: '', + img: 'index/rec/jd.png', + list: jdList + } + ] + }) + } + const getSwiperList = async () => { const res = await api.shop.homeSwiperList({ page: 1, pageSize: 999 }) const list = res?.list?.map((item) => { @@ -294,12 +343,16 @@ function Home () { } const handleTouchStart = (e) => { - setStartY(e.touches[0].clientY) + const { clientY, clientX } = e.touches[0] + setStartY(clientY) + setStartX(clientX) } const handleTouchEnd = (e) => { - const endY = e.changedTouches[0].clientY - const deltaY = endY - startY + const { clientX, clientY } = e.changedTouches[0] + const deltaY = clientY - startY + const deltaX = clientX - startX + if (Math.abs(deltaY) < 50) return if (deltaY > 0) { // 下滑操作 @@ -415,7 +468,7 @@ function Home () { // @@ -464,7 +517,7 @@ function Home () { } - {isUpOperation && + {isUpOperation && {goodList.map((item, idx) => ( ))} } - {isUpOperation && showRecommend && + {/* 推荐图片+商品 */} + {isUpOperation && <> + {recommend.length > 0 && recommend.map((_item, id) => + = 400 ? 920 : 800} mode='scaleToFill' src={_item.img} isShowMenuByLongpress={false} lazyLoad isNew > + {/* + {_item.text} + {_item.btnTxt} + */} + + + {_item.list?.map((item, idx) => ( + + + + ))} + + )} + } + {isUpOperation && showRecommend && 品牌介绍 - - - - + + + + - - + + - - - + + + Taro.navigateTo({ url: '/pages/webview?url=' + encodeURIComponent('https://www.baidu.com') - })} className="brand-guanzhu" width={690} mode="widthFix" src="index/guanzhu.png" isShowMenuByLongpress={false} lazyLoad isNew> + })} className="brand-guanzhu" mode="widthFix" src="index/guanzhu.png" isShowMenuByLongpress={false} lazyLoad isNew> 订阅消息 - + {/* */} } {/* */} diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 404a7bb..3f11088 100755 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -472,7 +472,7 @@ function EspierDetail (props) { {info.imgs.length > 1 && ( - {`${curImgIdx + 1}/${info.imgs.length}`} + {`${curImgIdx + 1}/${(swiperList)?.length || 1}`} )} {info.video && play && ( @@ -604,8 +604,8 @@ function EspierDetail (props) { - {info?.itemName} - {/* {info.brief} */} + {info.brief} + {info?.itemName2 || info?.itemName} {/* {(isWeixin || isAPP()) && ( // {( @@ -788,7 +788,7 @@ function EspierDetail (props) { }) if (!item.isOpen) { setState((draft) => { - draft.scrollTop = 610 + Math.random() + draft.scrollTop = 1010 + Math.random() }) } }} @@ -806,7 +806,7 @@ function EspierDetail (props) { }) if (!item.isOpen) { setState((draft) => { - draft.scrollTop = 610 + Math.random() + draft.scrollTop = 1010 + Math.random() }) } }}> diff --git a/src/pages/item/espier-detail.scss b/src/pages/item/espier-detail.scss index 2628d20..ae289f1 100755 --- a/src/pages/item/espier-detail.scss +++ b/src/pages/item/espier-detail.scss @@ -255,8 +255,10 @@ // @include multi-ellipsis(2); } .brief { - font-size: 28px; - color: #666; + font-size: 36px; + font-weight: bold; + margin-bottom: 10px; + // color: #666; // @include text-overflow(); } } diff --git a/src/subpage/pages/trade/comps/new-item.js b/src/subpage/pages/trade/comps/new-item.js index f32d9c8..707f5af 100755 --- a/src/subpage/pages/trade/comps/new-item.js +++ b/src/subpage/pages/trade/comps/new-item.js @@ -4,6 +4,7 @@ import Taro from '@tarojs/taro' import { View, Text, Button } from '@tarojs/components' import { classNames, formatPriceToHundred } from '@/utils' import { SpOrderItem, SpNewShopItem } from '@/components' +import { AtCountdown } from 'taro-ui' import './new-item.scss' @@ -42,6 +43,7 @@ export default class TradeItem extends Component { payType, pointName } = this.props + const [int, decimal] = String(payment || '').split('.') if (order_class === 'pointsmall') { if (freight_type === 'point' || (freight_type === 'cash' && freight_fee == 0)) { @@ -73,7 +75,10 @@ export default class TradeItem extends Component { } // 修改地址 - clickToEditAddress (choose) { + clickToEditAddress () { + const { choose } = this.props.info + console.log("🚀 ~ TradeItem ~ this.props.info:", this.props.info) + return Taro.navigateTo({ url: `/marketing/pages/member/address?isSelected=${choose}` }) @@ -88,7 +93,8 @@ export default class TradeItem extends Component { showActions, colors, rateStatus, - isShowDistributorInfo + isShowDistributorInfo, + onTimeUp = () => { } } = this.props if (!info) { @@ -104,7 +110,21 @@ export default class TradeItem extends Component { )} - 订单编号:{info.tid} + + 订单编号:{info.tid} + {info.status === 'WAIT_BUYER_PAY' && + 等待付款 + {info.timer && 0} + onTimeUp={onTimeUp} + />} + } + 订单时间:{info.create_date} @@ -126,7 +146,7 @@ export default class TradeItem extends Component { - {info.status_desc} + {/* {info.status_desc} */} {(info.order_status_des === 'PAYED' || info.order_status_des === 'NOTPAY') && !info.is_logistics && info.can_apply_cancel != 0 && @@ -153,17 +173,19 @@ export default class TradeItem extends Component { - {info.status_desc} - {(info.order_status_des === 'PAYED' || info.order_status_des === 'NOTPAY') && + {/* {info.status_desc} */} + {false && (info.order_status_des === 'PAYED' || info.order_status_des === 'NOTPAY') && info.can_apply_cancel != 0 && !info.is_logistics && (info.receipt_type !== 'dada' || (info.dada && info.dada.dada_status === 0)) ? ( ) : null} {info.pay_status === 'PAYED' && @@ -191,7 +213,7 @@ export default class TradeItem extends Component { - {info.status_desc} + {/* {info.status_desc} */} )} - + 确认收货 + : + } )} @@ -273,8 +303,8 @@ export default class TradeItem extends Component { - {info.status_desc} - {rateStatus && info.is_rate == 0 ? ( + {/* {info.status_desc} */} + {/* {rateStatus && info.is_rate == 0 ? ( - ) : null} - {info.receipt_type === 'logistics' && ( - - )} + ) : null} */} + { + !info.aftersales_bn && ( + + )} + {false && info.is_rate == 0 && !info.aftersales_bn && } + + + )} + {!customFooter && !!info.aftersales_bn && info.status !== 'WAIT_BUYER_CONFIRM_GOODS' && ( + + + + {/* {info.status_desc} */} diff --git a/src/subpage/pages/trade/comps/new-item.scss b/src/subpage/pages/trade/comps/new-item.scss index 89e637b..90ae01e 100755 --- a/src/subpage/pages/trade/comps/new-item.scss +++ b/src/subpage/pages/trade/comps/new-item.scss @@ -54,6 +54,20 @@ .linetwo { color: #999999; } + .at-countdown { + line-height: 30px; + &__time-box { + font-size: 20px; + color: #163586; + font-family: inherit; + font-weight: normal; + } + &__separator { + padding: 0; + font-size: 22px; + color: #163586; + } + } } &__total { // padding: 0 $edge-size floor($edge-size/2); diff --git a/src/subpage/pages/trade/detail.js b/src/subpage/pages/trade/detail.js index 712be04..d4194c6 100755 --- a/src/subpage/pages/trade/detail.js +++ b/src/subpage/pages/trade/detail.js @@ -169,16 +169,20 @@ export default class TradeDetail extends Component { point_use: 'point_use', mobile: 'mobile', dada: ({ dada }) => { - console.log('dada') - console.log(dada) return dada }, receiver_city: 'receiver_city', receiver_district: 'receiver_district', receiver_address: 'receiver_address', status_desc: 'order_status_msg', - delivery_code: 'delivery_code', - delivery_name: 'delivery_corp_name', + delivery_code: ({ order_delivery = {} }) => { + const { delivery_code, delivery_corp, delivery_corp_name, delivery_id } = order_delivery.list?.[0] || {} + return delivery_code + }, + delivery_name: ({ order_delivery = {} }) => { + const { delivery_code, delivery_corp, delivery_corp_name, delivery_id } = order_delivery.list?.[0] || {} + return delivery_corp_name + }, delivery_type: 'delivery_type', delivery_status: 'delivery_status', pay_status: 'pay_status', @@ -222,8 +226,13 @@ export default class TradeDetail extends Component { market_fee: ({ market_fee }) => market_fee / 100, item_fee_new: ({ item_fee_new }) => item_fee_new / 100, promotion_discount: ({ promotion_discount }) => promotion_discount / 100, - ziti_info: 'ziti_info' + ziti_info: 'ziti_info', + timer: ({ auto_cancel_seconds }) => auto_cancel_seconds > 0 ? this.calcTimer(auto_cancel_seconds) : null }) + const delivery = data.order_delivery?.list?.[0] || {} + info.delivery_corp_name = delivery.delivery_corp_name + info.delivery_corp = delivery.delivery_corp + info.delivery_code = delivery.delivery_code const ziti = pickBy(data.distributor, { store_name: 'store_name', @@ -486,6 +495,7 @@ export default class TradeDetail extends Component { if (flag) { Taro.showLoading({ title: '' }) let { delivery_type, delivery_id, order_type, tid: order_id } = this.state.info + console.log("🚀 ~ TradeDetail ~ delivery_type, delivery_id, order_type, tid: order_id:", delivery_type, delivery_id, order_type, order_id) let list = [] if (delivery_type !== 'new') { list = await api.trade.deliveryInfoNew({ delivery_id }) @@ -494,7 +504,7 @@ export default class TradeDetail extends Component { } const nList = pickBy(list, { title: 'AcceptStation', - content: ({ AcceptTime }) => [AcceptTime] + content: ({ AcceptTime }) => AcceptTime ? AcceptTime.substring(5, 16) : '' }) this.setState({ deliveryList: nList @@ -690,15 +700,14 @@ export default class TradeDetail extends Component { showQRcode, pickup_code, distributor, - showDeliveryModal + showDeliveryModal, + deliveryList } = this.state if (!info) { - return + return } - console.log('==tradeInfo==>', tradeInfo) - //订单未支付 const NOT_PAY = tradeInfo && tradeInfo.tradeState === 'NOTPAY' @@ -935,14 +944,14 @@ export default class TradeDetail extends Component { {!this.isPointitemGood() && {info.receiver_mobile}} - <> + {!!info.delivery_code && <> 物流信息 this.handleClickDelivery(true)}>查看详情 - 物流单号:{info.receiver_name} - 物流公司:{info.receiver_name} - + 物流单号:{info.delivery_code} + 物流公司:{info.delivery_corp_name} + } 支付方式 @@ -956,19 +965,21 @@ export default class TradeDetail extends Component { 订单金额 - {transformTextByPoint(this.isPointitemGood(), info.item_fee_new, info.item_point)} + + {/* {transformTextByPoint(this.isPointitemGood(), info.item_fee_new, info.item_point)} */ console.log(transformTextByPoint(this.isPointitemGood(), info.item_fee_new, info.item_point), '-------')} 优惠金额 {/* 促销 + 优惠券 */} - {`¥${parseFloat(info.promotion_discount + info.coupon_discount).toFixed(2)}`} + + {/* {`¥${parseFloat(info.promotion_discount + info.coupon_discount).toFixed(2)}`} */} 运费 {info.freight_type !== 'point' - ? `¥${info.freight_fee}` + ? : `${info.freight_fee * 100}${this.props.pointName}`} @@ -1211,16 +1222,16 @@ export default class TradeDetail extends Component { // !VERSION_IN_PURCHASE && // !this.isPointitemGood() && ( // 先禁止掉!!! - // info.can_apply_aftersales === 1 && ( - // - // 申请售后 - // - // ) + info.can_apply_aftersales === 1 && ( + + 申请售后 + + ) } { // 继续购物 先禁止掉!!! @@ -1261,7 +1272,7 @@ export default class TradeDetail extends Component { ) } - { + {/* { // 联系客服 (info.status === 'TRADE_SUCCESS' || (info.receipt_type === 'dada' && info.dada.dada_status === 9)) && @@ -1288,7 +1299,7 @@ export default class TradeDetail extends Component { )} ) - } + } */} )} @@ -1315,29 +1326,21 @@ export default class TradeDetail extends Component { - 物流信息 + 物流信息 - {'顺丰快递' || info.receiver_name}:{'SF000000000000' || info.receiver_phone} + {info.delivery_corp_name}:{info.delivery_code} - + {deliveryList.map((item, index) => - 02-01 12:00 + {item.content} - 测试--快件达[上海长宁兆丰店] + {item.title} - - - - 02-01 14:00 - - - 测试--快件达[上海长宁xx店] - - + )} diff --git a/src/subpage/pages/trade/detail.scss b/src/subpage/pages/trade/detail.scss index 172f7c2..7276adb 100755 --- a/src/subpage/pages/trade/detail.scss +++ b/src/subpage/pages/trade/detail.scss @@ -457,7 +457,7 @@ $paddingBottom: 100px; width: 100%; height: 100px; // bottom: $edge-margin; - bottom: 30px; + bottom: 0; background: #fff; display: flex; justify-content: space-evenly; @@ -516,6 +516,7 @@ $paddingBottom: 100px; position: initial; transform: inherit; margin: 0 20px; + margin-bottom: 80px; width: calc(100% - 40px); } } @@ -744,17 +745,17 @@ $paddingBottom: 100px; .receiver_item { display: flex; box-sizing: border-box; - font-style: 20px; + font-size: 20px; &:not(:last-child) { margin-bottom: 30px; } &_left { width: 190px; - font-style: 20px; + font-size: 20px; } &_right { flex: 1; - font-style: 20px; + font-size: 20px; } } } diff --git a/src/subpage/pages/trade/invoice-info.js b/src/subpage/pages/trade/invoice-info.js index 233bd87..e4b6655 100755 --- a/src/subpage/pages/trade/invoice-info.js +++ b/src/subpage/pages/trade/invoice-info.js @@ -5,7 +5,8 @@ import { Loading, SpPage, SpPrice, SpCheckboxNew } from '@/components' import api from '@/api' import { classNames, navigateTo } from '@/utils' import { AtModal, AtIcon } from 'taro-ui' -// import { log, pickBy, resolveOrderStatus, authSetting } from '@/utils' +import { log, pickBy, resolveOrderStatus, authSetting } from '@/utils' +import doc from '@/doc' import './invoice-info.scss' import { useImmer } from 'use-immer' @@ -82,6 +83,41 @@ function InvoiceInfo (props) { draft.visible = false }) } + const handleInvoiceClick = () => { + authSetting('invoiceTitle', async () => { + const res = await Taro.chooseInvoiceTitle() + if (res.errMsg === 'chooseInvoiceTitle:ok') { + log.debug('[invoice] info:', res) + const { + type, + content, + company_address, + bankname, + bankaccount, + company_phone, + registration_number + } = pickBy(res, doc.checkout.INVOICE_TITLE) + + let invoice_parmas = { + invoice_type: 'normal', + invoice_content: { + title: type == 0 ? 'unit' : 'individual', + content, + company_address, + registration_number, + bankname, + bankaccount, + company_phone + } + } + console.log("🚀 ~ invoice_parmas:", invoice_parmas) + // setState((draft) => { + // draft.invoiceTitle = content + // draft.paramsInfo = { ...paramsInfo, ...invoice_parmas } + // }) + } + }) + } return @@ -93,7 +129,7 @@ function InvoiceInfo (props) { {showDetail ? 查看 - : 一键授权微信发票} + : 一键授权微信发票} {showDetail && diff --git a/src/subpage/pages/trade/invoice-list.js b/src/subpage/pages/trade/invoice-list.js index 9b56692..cf088c7 100755 --- a/src/subpage/pages/trade/invoice-list.js +++ b/src/subpage/pages/trade/invoice-list.js @@ -45,7 +45,7 @@ export default class InvoiceList extends Component { tid: 'order_id', status_desc: 'order_status_msg', status: ({ order_status }) => resolveOrderStatus(order_status), - totalItems: ({ items }) => items.reduce((acc, item) => +item.num + acc, 0), + totalItems: ({ items }) => items?.reduce((acc, item) => +item.num + acc, 0), payment: ({ total_fee }) => (total_fee / 100).toFixed(2), pay_type: 'pay_type', point: 'point', diff --git a/src/subpage/pages/trade/list.js b/src/subpage/pages/trade/list.js index 9580410..379bbd4 100755 --- a/src/subpage/pages/trade/list.js +++ b/src/subpage/pages/trade/list.js @@ -1,10 +1,10 @@ import React, { Component } from 'react' import Taro, { getCurrentInstance } from '@tarojs/taro' -import { View, ScrollView } from '@tarojs/components' +import { View, ScrollView, Text } from '@tarojs/components' import { connect } from 'react-redux' -import { AtTabs, AtTabsPane } from 'taro-ui' +import { AtTabs, AtTabsPane, AtCurtain } from 'taro-ui' import _mapKeys from 'lodash/mapKeys' -import { Loading, SpNote, SpNavBar, SpPage } from '@/components' +import { Loading, SpNote, SpNavBar, SpPage, SpImage } from '@/components' import api from '@/api' import { withPager } from '@/hocs' import { @@ -15,7 +15,8 @@ import { classNames, isNavbar, getBrowserEnv, - VERSION_PLATFORM + VERSION_PLATFORM, + formatDateTime } from '@/utils' import { Tracker } from '@/service' import TradeItem from './comps/new-item' @@ -44,7 +45,11 @@ export default class TradeList extends Component { evaluate: 1, list: [], rate_status: false, - curItemActionsId: null + curItemActionsId: null, + showDeliveryModal: false, + deliveryList: [], + deliveryName: '', + deliveryCode: '' } } @@ -52,7 +57,8 @@ export default class TradeList extends Component { const { status = 0, evaluate = 1 } = this.$instance.router.params const _tabList = JSON.parse(JSON.stringify(this.state.tabList)) if (evaluate == 1) { - _tabList.push({ title: '待评价', status: '7', is_rate: 0 }) + // _tabList.push({ title: '待评价', status: '7', is_rate: 0 }) + _tabList.push({ title: '已完成', status: '7', is_rate: 0 }) _tabList.push({ title: '售后', status: '---', is_rate: 0 }) } const tabIdx = _tabList.findIndex((tab) => tab.status === status) @@ -80,7 +86,10 @@ export default class TradeList extends Component { onPullDownRefresh = () => { Tracker.dispatch('PAGE_PULL_DOWN_REFRESH') + this.refresh() + } + refresh = () => { Taro.showLoading({ title: '加载中', icon: 'none' @@ -98,6 +107,24 @@ export default class TradeList extends Component { this.hideLayer() } + calcTimer (totalSec) { + let remainingSec = totalSec + const dd = Math.floor(totalSec / 24 / 3600) + remainingSec -= dd * 3600 * 24 + const hh = Math.floor(remainingSec / 3600) + remainingSec -= hh * 3600 + const mm = Math.floor(remainingSec / 60) + remainingSec -= mm * 60 + const ss = Math.floor(remainingSec) + + return { + dd, + hh, + mm, + ss + } + } + async fetch (params) { const { tabList, curTabIdx } = this.state @@ -116,19 +143,39 @@ export default class TradeList extends Component { } ) - const { - list, - pager: { count: total }, - rate_status - } = await api.trade.list(params) + let list = [], + total = 0, + rate_status = false + if (params.status === '---') { + params.aftersales_status = 0 + const { list: _list, total_count: _total } = await api.aftersales.list(params) + list = _list + total = _total + rate_status = true + } else { + const { + list: _list, + pager: { count: _total }, + rate_status: _rate_status + } = await api.trade.list(params) + list = _list + total = _total + rate_status = _rate_status + } let nList = pickBy(list, { tid: 'order_id', status_desc: 'order_status_msg', order_status_des: 'order_status_des', + aftersales_bn: ({ aftersales_bn, aftersales }) => { + return aftersales_bn || aftersales?.aftersales_bn + }, + aftersales_type: ({ aftersales }) => { + return aftersales?.aftersales_type + }, status: ({ order_status }) => resolveOrderStatus(order_status), - totalItems: ({ items }) => items.reduce((acc, item) => +item.num + acc, 0), + totalItems: ({ items }) => items?.reduce((acc, item) => +item.num + acc, 0), // payment: ({ item_fee_new }) => (item_fee_new / 100).toFixed(2), - payment: ({ total_fee }) => (+total_fee / 100).toFixed(2), + payment: ({ total_fee, refund_fee }) => ((+total_fee || refund_fee) / 100).toFixed(2), total_fee: 'total_fee', pay_type: 'pay_type', point: 'point', @@ -138,7 +185,9 @@ export default class TradeList extends Component { type: 'type', is_rate: 'is_rate', dada: 'dada', - create_date: 'create_date', + create_date: ({ create_date, create_time }) => { + return create_date || formatDateTime(create_time * 1000) + }, is_all_delivery: 'is_all_delivery', is_logistics: 'is_split', receipt_type: 'receipt_type', @@ -153,8 +202,8 @@ export default class TradeList extends Component { orders_delivery_id: 'orders_delivery_id', order_type: 'order_type', can_apply_cancel: 'can_apply_cancel', - order: ({ items }) => - pickBy(items, { + order: ({ items, detail }) => + pickBy(items || detail, { order_id: 'order_id', item_id: 'item_id', pic_path: 'pic', @@ -169,7 +218,8 @@ export default class TradeList extends Component { point: 'item_point', num: 'num', order_item_type: 'order_item_type' - }) + }), + timer: ({ auto_cancel_time, create_time }) => auto_cancel_time > parseInt(new Date().getTime() / 1000) ? this.calcTimer(auto_cancel_time - parseInt(new Date().getTime() / 1000)) : null }) log.debug('[trade list] list fetched and processed: ', nList) @@ -206,9 +256,11 @@ export default class TradeList extends Component { } handleClickItem = (trade) => { - const { tid } = trade - + const { tid, aftersales_bn } = trade let url = `/subpage/pages/trade/detail?id=${tid}` + if (aftersales_bn) { + url = `/subpages/trade/after-sale?aftersales_bn=${aftersales_bn}&id=${tid}` + } if (trade.order_class === 'pointsmall') { url += `&type=pointitem` @@ -221,7 +273,7 @@ export default class TradeList extends Component { handleClickItemBtn = async (trade, type) => { console.log(trade) - const { tid } = trade + const { tid, aftersales_bn } = trade let detailUrl = `/subpage/pages/trade/detail?id=${tid}` @@ -249,6 +301,11 @@ export default class TradeList extends Component { url: `/marketing/pages/item/rate?id=${tid}` }) break + case 'aftersales': + Taro.navigateTo({ + url: `/subpages/trade/after-sale?id=${tid}&aftersales_bn=${aftersales_bn || ''}` + }) + break case 'delivery': { let { @@ -261,16 +318,17 @@ export default class TradeList extends Component { tid, order_type } = trade - if (is_all_delivery || delivery_type === 'old') { - Taro.navigateTo({ - url: `/subpage/pages/trade/delivery-info?delivery_id=${orders_delivery_id}&delivery_code=${delivery_code}&delivery_corp=${delivery_corp}&delivery_name=${delivery_corp_name || delivery_corp - }&delivery_type=${delivery_type}&order_type=${order_type}&order_id=${tid}` - }) - } else { - Taro.navigateTo({ - url: `/subpage/pages/trade/split-bagpack?order_type=${order_type}&order_id=${tid}` - }) - } + this.handleClickDelivery(true, trade) + // if (is_all_delivery || delivery_type === 'old') { + // Taro.navigateTo({ + // url: `/subpage/pages/trade/delivery-info?delivery_id=${orders_delivery_id}&delivery_code=${delivery_code}&delivery_corp=${delivery_corp}&delivery_name=${delivery_corp_name || delivery_corp + // }&delivery_type=${delivery_type}&order_type=${order_type}&order_id=${tid}` + // }) + // } else { + // Taro.navigateTo({ + // url: `/subpage/pages/trade/split-bagpack?order_type=${order_type}&order_id=${tid}` + // }) + // } } break default: @@ -280,13 +338,38 @@ export default class TradeList extends Component { } } + handleClickDelivery = async (flag, trade) => { + if (flag) { + Taro.showLoading({ title: '' }) + let { delivery_type, delivery_id, order_type, tid: order_id } = trade + let list = [] + if (delivery_type !== 'new') { + list = await api.trade.deliveryInfoNew({ delivery_id }) + } else { + list = await api.trade.deliveryInfo(order_type, order_id) + } + const nList = pickBy(list, { + title: 'AcceptStation', + content: ({ AcceptTime }) => AcceptTime ? AcceptTime.substring(5, 16) : '' + }) + this.setState({ + deliveryList: nList, + deliveryName: trade.delivery_corp_name, + deliveryCode: trade.delivery_code + }) + } + this.setState({ showDeliveryModal: flag }) + Taro.hideLoading() + // Taro.navigateTo({ + // url: `/subpage/pages/trade/delivery-info?order_type=${this.state.info.order_type}&order_id=${this.state.info.tid}&delivery_code=${this.state.info.delivery_code}&delivery_corp=${this.state.info.delivery_corp}&delivery_name=${this.state.info.delivery_name}` + // }) + } + handleActionClick = (type, item) => { - console.log(type, item) this.hideLayer() } handleActionBtnClick = (item) => { - console.log(item) this.setState({ curItemActionsId: item.tid }) @@ -307,7 +390,12 @@ export default class TradeList extends Component { list = [], page, rateStatus, - evaluate + evaluate, + showDeliveryModal, + deliveryList, + info = {}, + deliveryName, + deliveryCode } = this.state return ( @@ -349,6 +437,7 @@ export default class TradeList extends Component { onClickBtn={this.handleClickItemBtn.bind(this, item)} onActionBtnClick={this.handleActionBtnClick.bind(this, item)} onActionClick={this.handleActionClick.bind(this, item)} + onTimeUp={this.refresh} /> ) })} @@ -360,6 +449,34 @@ export default class TradeList extends Component { )} {!!curItemActionsId && } + { + this.setState({ showDeliveryModal: false }) + }} + > + + + + 物流信息 + + + {deliveryName}:{deliveryCode} + + + {deliveryList.map((item, index) => + + {item.content} + + + {item.title} + + )} + + + ) } diff --git a/src/subpage/pages/trade/list.scss b/src/subpage/pages/trade/list.scss index 41f3b92..71515fd 100755 --- a/src/subpage/pages/trade/list.scss +++ b/src/subpage/pages/trade/list.scss @@ -148,6 +148,75 @@ color: #000; } } + .curtain { + .at-curtain__container { + width: 100%; + padding: 0 30px; + } + .at-curtain__btn-close--bottom { + // display: none; + border: none; + top: 10px; + right: 10px; + left: auto; + &::after, + &::before { + background-color: #000; + } + } + &_content { + width: 100%; + background-color: #fff; + border-radius: 10px; + padding: 100px 46px; + box-sizing: border-box; + &_title { + display: flex; + justify-content: center; + align-items: center; + font-size: 36px; + line-height: 1; + margin-bottom: 80px; + color: #000; + .sp-image { + margin-right: 4px; + } + } + .receiver_name { + font-size: 26px; + color: #000; + margin: 80px 0; + } + &_text { + line-height: 1.4; + height: 650px; + color: #000; + font-size: 26px; + .receiver_item { + display: flex; + box-sizing: border-box; + font-size: 20px; + &:not(:last-child) { + margin-bottom: 30px; + } + &_left { + width: 190px; + font-size: 20px; + } + &_right { + flex: 1; + font-size: 20px; + } + } + } + } + .no-text { + color: #7e7e7e; + font-size: 20rpx; + margin-top: 28rpx; + line-height: 1.4; + } + } } // .trade-item__hd-cont{ diff --git a/src/subpages/member/index.js b/src/subpages/member/index.js index f4519f5..5ea3ab8 100755 --- a/src/subpages/member/index.js +++ b/src/subpages/member/index.js @@ -304,6 +304,15 @@ function MemberIndex (props) { const resAssets = await api.member.memberAssets() const { discount_total_count, fav_total_count, point_total_count } = resAssets + // aftersales: 0 //待处理的售后总数 + // aftersales_pending: 0 //待处理的售后 + // aftersales_processing: 0 //处理中售后 + // normal_not_rate: 3 //待评价 + // normal_notpay_notdelivery: 0 // 未付款未发货 + // normal_payed_daifahuo: 4 // 待发货 + // normal_payed_daishouhuo: 0 // 待收货 + // normal_payed_daiziti: 0 //待自提订单 + // normal_payed_notdelivery: 4 // 已付款未发货 or 已付款已发货 const { aftersales, // 待处理售后 @@ -603,9 +612,9 @@ function MemberIndex (props) { > - {state.waitEvaluateNum > 0 && ( + {state.waitRecevieNum > 0 && ( - {state.waitEvaluateNum} + {state.waitRecevieNum} )} 待收货 @@ -617,15 +626,16 @@ function MemberIndex (props) { > - {state.afterSalesNum > 0 && ( + {state.waitEvaluateNum > 0 && ( - {state.afterSalesNum} + {state.waitEvaluateNum} )} 已完成 - 评价 - + } diff --git a/src/subpages/member/index.scss b/src/subpages/member/index.scss index bc900de..105f8e8 100755 --- a/src/subpages/member/index.scss +++ b/src/subpages/member/index.scss @@ -155,6 +155,7 @@ padding: 30px 16px 50px; .comp-panel { &-bd { + padding: 24px 50px; margin-top: 20px; } .extra { diff --git a/src/subpages/trade/after-sale.js b/src/subpages/trade/after-sale.js index 55d8ceb..4908d0d 100755 --- a/src/subpages/trade/after-sale.js +++ b/src/subpages/trade/after-sale.js @@ -4,16 +4,16 @@ import { useImmer } from "use-immer" import Taro, { getCurrentInstance } from "@tarojs/taro" import api from "@/api" import doc from "@/doc" -import { AtButton, AtInput, AtTextarea } from 'taro-ui' +import { AtButton, AtInput, AtCurtain, AtCountdown } from 'taro-ui' import { SpPage, SpTabs, SpCell, SpCheckbox, SpImage, SpInputNumber, SpFloatLayout, SpUpload, SpPrice, SpHtml, SpOrderItem } from '@/components' -import { View, Text, Picker } from "@tarojs/components" -import { AFTER_SALE_TYPE, REFUND_FEE_TYPE } from '@/consts' -import { pickBy, showToast, classNames, VERSION_STANDARD, VERSION_PLATFORM, JumpGoodDetail } from '@/utils' +import { View, Text, Picker, Input, ScrollView } from "@tarojs/components" +import { AFTER_SALE_TYPE, REFUND_FEE_TYPE, LOGISTICS_CODE } from '@/consts' +import { pickBy, showToast, classNames, VERSION_STANDARD, VERSION_PLATFORM, JumpGoodDetail, copyText } from '@/utils' import "./after-sale.scss" const initialState = { info: null, - curTabIdx: 0, + curTabIdx: 1, tabList: AFTER_SALE_TYPE, reasonIndex: '', reasons: [], @@ -34,15 +34,27 @@ const initialState = { afterSaleDesc: { intro: '', is_open: false - } + }, + afterSaleChecked: {}, + afterSaleTotalNum: 0, + allClicked: false, + afterSaleTotalprice: 0, + loading: true, + isOpened: false, + isAddrOpened: false, + aftersales: null, + expressList: [], + corpIndex: null, + logi_no: '' } function TradeAfterSale (props) { const $instance = getCurrentInstance() + const { aftersales_bn: afterSaleTid } = $instance.router.params const [state, setState] = useImmer(initialState) const pageRef = useRef() const { info, curTabIdx, tabList, reasonIndex, reasons, refundFee, refundPoint, refundType, refundTypeList, description, pic, openRefundType, selectRefundValue, - refundStore, contact, mobile, afterSaleDesc, offlineAftersalesIsOpen, offlineAftersales } = state + refundStore, contact, mobile, afterSaleDesc, offlineAftersalesIsOpen, offlineAftersales, afterSaleTotalNum, allClicked, afterSaleTotalprice, loading, isOpened, isAddrOpened, aftersales, expressList, corpIndex, logi_no } = state useEffect(() => { fetch() @@ -52,6 +64,15 @@ function TradeAfterSale (props) { draft.refundStore = item }) }) + const _expressList = Object.keys(LOGISTICS_CODE).map(key => { + return { + name: LOGISTICS_CODE[key], + code: key + } + }) + setState(draft => { + draft.expressList = _expressList + }) return () => { Taro.eventCenter.off('onEventPickerStore') @@ -70,8 +91,63 @@ function TradeAfterSale (props) { Taro.navigateBack() } + const onSubmitExp = async () => { + const { item_id, orderId: order_id, afterSalesBn: aftersales_bn } = aftersales + const corp_code = expressList[corpIndex]?.code + if (!corp_code) { + showToast('请填写物流公司') + return + } + if (!logi_no) { + showToast('请填写物流单号') + return + } + await api.aftersales.sendback({ + item_id, + order_id, + aftersales_bn, + logi_no, + corp_code + }) + showToast('操作成功') + setTimeout(() => { + // Taro.navigateBack() + fetch() + }, 300) + } + + const onChangeExpress = (e) => { + const { value } = e.detail + setState(draft => { + draft.corpIndex = value + }) + } + + const getLogisticName = () => { + const { name } = expressList[corpIndex] || {} + return name + } + const fetch = async () => { - const { id } = $instance.router.params + const { id, aftersales_bn } = $instance.router.params + if (aftersales_bn) { + const resInfo = await api.aftersales.info({ + aftersales_bn, + // item_id, + // order_id + }) + const _aftersales = pickBy(resInfo, doc.trade.TRADE_AFTER_SALES_ITEM) + console.log("🚀 ~ _aftersales:", _aftersales) + if (_aftersales.sendbackData) { + const { corp_code } = _aftersales.sendbackData + _aftersales.sendbackData.name = LOGISTICS_CODE[corp_code] + } + setState(draft => { + draft.aftersales = _aftersales + draft.afterSaleTotalNum = _aftersales.items.reduce((sum, { num }) => sum + num, 0) + draft.afterSaleTotalprice = _aftersales.items.reduce((sum, { price }) => sum + price, 0) + }) + } const { orderInfo, offline_aftersales_is_open, distributor } = await api.trade.detail(id) const reasons = await api.aftersales.reasonList() const { intro, is_open } = await api.aftersales.remindDetail() @@ -90,17 +166,29 @@ function TradeAfterSale (props) { draft.refundTypeList = REFUND_FEE_TYPE.filter(item => item.value != 'offline') draft.refundType = 'logistics' } + draft.loading = false }) } - const onChangeItemCheck = (item, index, e) => { + const onChangeItemCheck = (item, index, type) => { + // const _info = info + // _info.items[index].checked = e setState(draft => { - draft.info.items[index].checked = e + if (type === 'all') { + draft.allClicked = !allClicked + draft.info.items.map((_item) => { + _item.checked = !allClicked + }) + } else { + draft.info.items[index].checked = !item.checked + } + draft.allClicked = draft.info.items.every((item) => item.checked) + draft.afterSaleTotalNum = draft.info.items.filter((_item) => _item.checked).reduce((sum, { num }) => sum + num, 0) + draft.afterSaleTotalprice = draft.info.items.filter((_item) => _item.checked).reduce((sum, { price }) => sum + price, 0) }) } const onChangeItemNum = (e, index) => { - setState(draft => { draft.info.items[index].refundNum = e }) @@ -147,15 +235,15 @@ function TradeAfterSale (props) { } if (!reasons?.[reasonIndex]) { - return showToast('请选择售后原因') + return showToast('请选择退货原因') } const aftersales_type = tabList[curTabIdx].type const reason = reasons?.[reasonIndex] let params = { - detail: checkedItems.map(({ id: _id, refundNum }) => { + detail: checkedItems.map(({ id: _id, refundNum, num }) => { return { id: _id, - num: refundNum + num: num || refundNum } }), order_id: id, @@ -193,19 +281,29 @@ function TradeAfterSale (props) { await api.aftersales.apply(params) showToast('提交成功') setTimeout(() => { - Taro.redirectTo({ - url: `/subpage/pages/trade/detail?id=${id}` - }) - }, 200) + // Taro.redirectTo({ + // url: `/subpage/pages/trade/detail?id=${id}` + // }) + // fetch() + Taro.navigateBack() + }, 500) } - return - 提交 - + const handleClickCopy = (val) => { + copyText(val) + Taro.showToast({ + title: '复制成功', + icon: 'none' + }) + } + + return + 提交售后申请 + : null } > - + {!afterSaleTid ? 请选择售后类型: -1 ? '#000' : '#a5a5a5' }}> + : aftersales?.progress != 12 ? + 售后单号:{afterSaleTid} + + {['', '售后审核通过,请您发货并填写物流单号', '等待商家确认收货', '已驳回', '已完成', '退款驳回', '退款完成', '已关闭', '商家确认收货,等待审核退款', '退款处理中'][aftersales?.progress || 0]} + + {/* 还剩 */} + setState(draft => { draft.isOpened = true })} style={{ fontSize: '20rpx', borderBottom: '1px solid #000', padding: '0 0 4rpx' }}>全部流程 + + + : null} + + + 退货单号填写 + {aftersales?.hasAftersalesAddress && setState(draft => { draft.isAddrOpened = true })} style={{ fontSize: '20rpx', borderBottom: '1px solid #000', padding: '0 0 4rpx', marginTop: '-10rpx', lineHeight: 0.8 }}>查看退货地址} + + {!aftersales?.hasSendbackData ? + + {`${getLogisticName() || '请选择快递公司'}`} + + + : + {`${aftersales?.sendbackData?.name || ''}`} + } + + + + {!aftersales?.hasSendbackData ? { + setState(draft => { + draft.logi_no = e.detail.value + }) + }}> + : + {`${aftersales?.sendbackData?.logi_no || ''}`}} + + + + {/* 确认上传 */} + handleClickCopy(aftersales?.sendbackData?.logi_no || '')} style={{ fontSize: '20rpx', borderBottom: '1px solid #000', lineHeight: 0.8 }}>复制物流单号 + + {/* { setState(draft => { draft.curTabIdx = e }) }} /> */} - 请选择您要退货的商品 - - { }} /> - + {!afterSaleTid ? <> + 请选择您要退货的商品 + + + + : 已选择的退货商品} { - info?.items.map((item, index) => ( - + (aftersales?.items || info?.items || []).map((item, index) => ( + - - - + {!afterSaleTid && + + } {/* 数量:{item.num} - - + {/* onChangeItemNum(e, index)} - /> + /> */} - + )) } - - 退货原因: - + 退货原因 + {!afterSaleTid ? { @@ -298,16 +450,18 @@ function TradeAfterSale (props) { }} > - {`${reasons?.[reasonIndex] || '请选择退货原因'}`} + {`${reasons?.[reasonIndex] || '请选择退货原因'}`} - + : + {`${aftersales?.reason || reasons?.[reasonIndex] || '请选择退货原因'}`} + } - 退货数量: + 退货数量* - {`${reasons?.[reasonIndex] || '请选择退货数量'}`} + {`${afterSaleTotalNum || '请选择退货数量'}`} @@ -338,7 +492,7 @@ function TradeAfterSale (props) { } - {curTabIdx == 1 && + {/* {curTabIdx == 1 && { setState(draft => { draft.openRefundType = true @@ -377,19 +531,28 @@ function TradeAfterSale (props) { />}> } - } + } */} - 补充描述 - - - { + + 退货商品{afterSaleTotalNum}件 + 退款金额: + + {!afterSaleTid ? + {/* */} + {/* { setState(draft => { draft.description = e }) - }} /> + }} /> */} + { + setState(draft => { + draft.description = e.detail.value + }) + }}> - 备注:{aftersales?.description || description}} + {/* { @@ -397,7 +560,7 @@ function TradeAfterSale (props) { draft.pic = val }) }} - /> + /> */} { @@ -441,6 +604,89 @@ function TradeAfterSale (props) { ))} + + { + setState((draft) => { + draft.isOpened = false + }) + }} + > + + + + 退货流程 + + 提交申请 + + 商家处理 + {/* 还剩 */} + + 商家同意后,请按照给出的退货地址退货,并请记录退货运单 + 如商家拒绝,您可以修改申请后再次发起,商家会重新处理 + 如商家超时未处理,退货申请将达成,请按系统给出的退货地址退货 + 寄回商品 + 商家退款 + 退款成功 + + + 温馨提示 + + BIRKENSTOCK支持七天(从收到商品之日起开始计算)无理由退换货如需退换货,退回货品需不影响二次销售原装鞋盒务必完好(如鞋盒有遗失需补偿20元)。试穿时需将鞋盒内的包装纸垫于脚下,过程中不刻意踩踏后跟如鞋面或鞋底出现脏污、磨损、破损,鞋跟出现折痕等,都将影响商品的二次销售。我们将无法为您提供七天无理由退换货服务,敬请谅解。如果您还有其他问题或需要更多帮助,可及时联系客服,我们将竭诚为您服务(特别提示:仓库不接受到付、平邮、邮政小包。) + + + setState((draft) => { draft.isOpened = false })}>我知道了 + + + { + setState((draft) => { + draft.isAddrOpened = false + }) + }} + > + + + + 退货地址 + + + 收件人 + {aftersales?.afterSalesContact} + + + 联系电话 + {aftersales?.afterSalesMobile} + + + 收件地址 + {aftersales?.afterSalesAddress} + + + 邮编 + {aftersales?.afterSalesZip} + + 复制地址 + + + 温馨提示 + + BIRKENSTOCK支持七天(从收到商品之日起开始计算)无理由退换货如需退换货,退回货品需不影响二次销售原装鞋盒务必完好(如鞋盒有遗失需补偿20元)。试穿时需将鞋盒内的包装纸垫于脚下,过程中不刻意踩踏后跟如鞋面或鞋底出现脏污、磨损、破损,鞋跟出现折痕等,都将影响商品的二次销售。我们将无法为您提供七天无理由退换货服务,敬请谅解。如果您还有其他问题或需要更多帮助,可及时联系客服,我们将竭诚为您服务(特别提示:仓库不接受到付、平邮、邮政小包。) + + + + } diff --git a/src/subpages/trade/after-sale.scss b/src/subpages/trade/after-sale.scss index e9dbdb5..674e6d7 100755 --- a/src/subpages/trade/after-sale.scss +++ b/src/subpages/trade/after-sale.scss @@ -1,6 +1,10 @@ .page-trade-after-sale { + .sp-page-body { + padding-bottom: 50px; + } .after-item { padding: 0 22px; + margin-top: 30px; &.mt-40 { margin-top: 40px; } @@ -11,7 +15,7 @@ margin-bottom: 20px; } .color-hui { - background: #f5f5f5; + color: #00000060; } &-input { box-sizing: border-box; @@ -31,8 +35,27 @@ } } } + .at-countdown { + line-height: 30px; + &__item:last-child { + display: none; + } + &__time-box { + font-size: 20px; + font-family: inherit; + font-weight: normal; + } + &__separator { + padding: 0; + font-size: 22px; + } + } .btn-wrap { - padding: 20px; + padding: 50px; + margin-bottom: 100px; + .at-button__text { + font-size: 36px; + } } .comp-trade-info { margin-top: 20px; @@ -70,8 +93,14 @@ display: flex; padding-left: 54px; box-sizing: border-box; + + .sp-checkbox-new .icon-checkbox-weixuan, + .sp-checkbox-new .icon-checkbox-xuanzhong { + color: #00000090; + font-size: 30px; + } .sp-checkbox-new__label { - font-style: 26px; + font-size: 26px; } } .reason-container { @@ -94,7 +123,11 @@ } .items-container { // padding: 0 32px 20px; - padding: 24px 0; + // padding: 24px 0; + margin-top: 30px; + &:not(:last-child) { + margin-bottom: 10px; + } } .item-box { padding: 30px; @@ -114,6 +147,12 @@ } .item-hd { margin-right: 40px; + + .sp-checkbox-new .icon-checkbox-weixuan, + .sp-checkbox-new .icon-checkbox-xuanzhong { + color: #00000090; + font-size: 30px; + } } .item-bd { flex: 1; @@ -250,13 +289,22 @@ } .desc-container { background-color: #fff; - margin: 24px 16px 0; + margin: 24px 22px 0; padding-bottom: 30px; border-radius: 16px; .desc-content { - margin: 0 32px; + padding: 16px 18px; + border: 2px solid #00000090; + border-radius: 6px; display: flex; overflow: hidden; + .desc-ipt { + font-size: 26px; + } + .input-placeholder { + color: #a5a5a5; + font-size: 26px; + } } .icon-bianji1 { color: #aaaaaa; @@ -272,8 +320,11 @@ .title { font-size: 30px; font-weight: 500; - color: #333; - padding: 28px 32px; + color: #000; + padding: 50px 0 26px; + display: flex; + align-items: center; + justify-content: space-between; } } .sp-upload { @@ -381,4 +432,118 @@ margin-left: 30px; } } + .curtain { + .at-curtain__container { + width: 100%; + padding: 0 30px; + } + .at-curtain__btn-close--bottom { + // display: none; + border: none; + top: 10px; + right: 10px; + left: auto; + &::after, + &::before { + background-color: #000; + } + } + &_content { + width: 100%; + background-color: #fff; + border-radius: 10px; + padding: 100px 44px 50px; + box-sizing: border-box; + &_title { + display: flex; + justify-content: center; + align-items: center; + font-size: 36px; + line-height: 1; + margin-bottom: 80px; + color: #000; + .sp-image { + margin-right: 4px; + } + } + .receiver_name { + font-size: 20px; + color: #000; + &:not(:last-child) { + margin-bottom: 34px; + } + &.active { + color: #163586; + font-size: 26px; + } + } + .op { + opacity: 0.6; + } + .line { + padding: 0 30px; + box-sizing: border-box; + height: 2px; + background: #ccc; + margin-top: -10px; + } + .addr_item { + display: flex; + align-items: center; + font-size: 20px; + margin: 24px 0; + &_left { + width: 150px; + font-size: 20px; + } + &_right { + flex: 1; + font-size: 20px; + } + } + .fuzhi { + font-size: 20px; + margin-top: 50px; + border-bottom: 2px solid #000; + line-height: 0.85; + margin: 0 auto; + margin-top: 56px; + text-align: center; + width: 78px; + } + &_text { + line-height: 1.4; + height: 250px; + color: #000; + font-size: 20px; + padding: 60px 10px; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + &_title { + font-size: 26px; + color: #000; + margin-bottom: 30px; + } + .receiver_item { + display: flex; + box-sizing: border-box; + font-size: 16px; + text-align: center; + line-height: 1.8; + opacity: 0.8; + } + } + .at-button__text { + font-style: 36px; + } + } + .no-text { + color: #7e7e7e; + font-size: 20rpx; + margin-top: 28rpx; + line-height: 1.4; + } + } }