diff --git a/src/api/req-dianwu.js b/src/api/req-dianwu.js index aec21b2..7048bc0 100755 --- a/src/api/req-dianwu.js +++ b/src/api/req-dianwu.js @@ -14,7 +14,7 @@ import { SG_DIANWU_TOKEN } from '@/consts' import log from '@/utils/log' import { HTTP_STATUS } from './consts' -function addQuery(url, query) { +function addQuery (url, query) { return url + (url.indexOf('?') >= 0 ? '&' : '?') + query } @@ -49,16 +49,16 @@ class RequestQueue { this.isRunning = false } - push(req) { + push (req) { this.requestList.push(req) } - destroy() { + destroy () { this.isRunning = false this.requestList = [] } - run() { + run () { this.isRunning = true const next = async () => { const req = this.requestList.shift() @@ -82,7 +82,7 @@ class API { this.requestQueue = new RequestQueue() } - setOptions(opts) { + setOptions (opts) { let { baseURL = '/' } = opts if (!/\/$/.test(baseURL)) { baseURL = baseURL + '/' @@ -102,7 +102,7 @@ class API { this.options = options } - errorToast(data) { + errorToast (data) { let errMsg = data.message || (data.data && data.data.message) || '操作失败,请稍后重试' if (errMsg.length > 11) { @@ -117,11 +117,11 @@ class API { }, 200) } - getReqUrl(url) { + getReqUrl (url) { return /^http/.test(url) ? url : `${this.baseURL}${url.replace(/^\//, '')}` } - handleLogout() { + handleLogout () { this.requestQueue.destroy() this.isRefreshingToken = false // S.logout() @@ -148,7 +148,7 @@ class API { }, 300) } - intereptorReq(params) { + intereptorReq (params) { const { url, data, header = {}, method = 'GET' } = params const { company_id, appid } = this.options const methodIsGet = method.toLowerCase() === 'get' @@ -202,7 +202,7 @@ class API { return config } - intereptorRes(res) { + intereptorRes (res) { const { data, statusCode, config } = res const { showError = true } = config if (statusCode == HTTP_STATUS.SUCCESS) { @@ -241,7 +241,7 @@ class API { return Promise.reject(this.reqError(res, `API error: ${statusCode}`)) } - async refreshToken() { + async refreshToken () { this.isRefreshingToken = true // const token = S.getAuthToken() const token = Taro.getStorageSync(SG_DIANWU_TOKEN) @@ -284,7 +284,7 @@ class API { * @return {Object} 请求返回的数据 * @memberof API */ - async makeReq(config = {}, intereptorRes, intereptorReq) { + async makeReq (config = {}, intereptorRes, intereptorReq) { const { showLoading } = config const options = intereptorReq ? intereptorReq(config) : this.intereptorReq(config) @@ -301,7 +301,7 @@ class API { const token = Taro.getStorageSync(SG_DIANWU_TOKEN) if ( res.statusCode === HTTP_STATUS.UNAUTHORIZED && - (res.data.data && res.data.data.status_code) === HTTP_STATUS.TOKEN_NEEDS_REFRESH && token + (res.data?.data && res.data.data?.status_code) === HTTP_STATUS.TOKEN_NEEDS_REFRESH && token // S.getAuthToken() ) { // token失效时重造请求,并刷新token @@ -328,7 +328,7 @@ class API { return ret } - pendingReq(config, intereptorRes, intereptorReq, isSend) { + pendingReq (config, intereptorRes, intereptorReq, isSend) { return new Promise((resolve) => { const pendingReq = async () => { // 仅加入队列一次 @@ -344,7 +344,7 @@ class API { }) } - get(url, data, config) { + get (url, data, config) { return this.makeReq({ ...config, url, @@ -353,14 +353,14 @@ class API { }) } - reqError(res, msg = '') { + reqError (res, msg = '') { const errMsg = (res.data && res.data?.data?.message) || msg const err = new Error(errMsg) err.res = res return err } - post(url, data, config) { + post (url, data, config) { return this.makeReq({ ...config, url, @@ -369,7 +369,7 @@ class API { }) } - put(url, data, config) { + put (url, data, config) { return this.makeReq({ ...config, url, @@ -378,7 +378,7 @@ class API { }) } - delete(url, data, config) { + delete (url, data, config) { return this.makeReq({ ...config, url, diff --git a/src/api/req.js b/src/api/req.js index dfc8532..01e125f 100755 --- a/src/api/req.js +++ b/src/api/req.js @@ -13,7 +13,7 @@ import { import log from '@/utils/log' import { HTTP_STATUS } from './consts' -function addQuery(url, query) { +function addQuery (url, query) { return url + (url.indexOf('?') >= 0 ? '&' : '?') + query } @@ -41,7 +41,7 @@ const request = (() => { } // 支付宝小程序,请求失败时,需要额外处理 - if(isAlipay){ + if (isAlipay) { return async (...args) => { let res try { @@ -65,16 +65,16 @@ class RequestQueue { this.isRunning = false } - push(req) { + push (req) { this.requestList.push(req) } - destroy() { + destroy () { this.isRunning = false this.requestList = [] } - run() { + run () { this.isRunning = true const next = async () => { const req = this.requestList.shift() @@ -98,7 +98,7 @@ class API { this.requestQueue = new RequestQueue() } - setOptions(opts) { + setOptions (opts) { let { baseURL = '/' } = opts if (!/\/$/.test(baseURL)) { baseURL = baseURL + '/' @@ -118,7 +118,7 @@ class API { this.options = options } - errorToast(data) { + errorToast (data) { let errMsg = data.message || (data.data && data.data.message) || '操作失败,请稍后重试' if (errMsg.length > 11) { @@ -133,11 +133,11 @@ class API { }, 200) } - getReqUrl(url) { + getReqUrl (url) { return /^http/.test(url) ? url : `${this.baseURL}${url.replace(/^\//, '')}` } - handleLogout() { + handleLogout () { this.requestQueue.destroy() this.isRefreshingToken = false S.logout() @@ -151,19 +151,19 @@ class API { url = '/subpages/merchant/login' } else if (isGoodsShelves()) { url = '/subpages/guide/index' - } else if (VERSION_IN_PURCHASE){ + } else if (VERSION_IN_PURCHASE) { url = `/subpages/purchase/member` } else { url = `/subpages/member/index` } - if(path != url) { + if (path != url) { url = url + `?redirect_url=${encodeURIComponent(fullPath)}` Taro.redirectTo({ url }) } }, 300) } - intereptorReq(params) { + intereptorReq (params) { const { url, data, header = {}, method = 'GET' } = params const { company_id, appid } = this.options const methodIsGet = method.toLowerCase() === 'get' @@ -216,11 +216,11 @@ class API { return config } - intereptorRes(res) { + intereptorRes (res) { const { data, statusCode, config } = res const { showError = true } = config if (statusCode == HTTP_STATUS.SUCCESS) { - const { status_code } = data.data + const { status_code } = data.data || {} if (!status_code) { return data.data } else { @@ -255,10 +255,10 @@ class API { return Promise.reject(this.reqError(res, `API error: ${statusCode}`)) } - async refreshToken() { + async refreshToken () { this.isRefreshingToken = true const token = S.getAuthToken() - console.log('refreshToken',66); + console.log('refreshToken', 66) try { await this.makeReq( { @@ -298,7 +298,7 @@ class API { * @return {Object} 请求返回的数据 * @memberof API */ - async makeReq(config = {}, intereptorRes, intereptorReq) { + async makeReq (config = {}, intereptorRes, intereptorReq) { const { showLoading } = config const options = intereptorReq ? intereptorReq(config) : this.intereptorReq(config) @@ -342,7 +342,7 @@ class API { return ret } - pendingReq(config, intereptorRes, intereptorReq, isSend) { + pendingReq (config, intereptorRes, intereptorReq, isSend) { return new Promise((resolve) => { const pendingReq = async () => { // 仅加入队列一次 @@ -358,7 +358,7 @@ class API { }) } - get(url, data, config) { + get (url, data, config) { return this.makeReq({ ...config, url, @@ -367,14 +367,14 @@ class API { }) } - reqError(res, msg = '') { + reqError (res, msg = '') { const errMsg = (res.data && res.data?.data?.message) || msg const err = new Error(errMsg) err.res = res return err } - post(url, data, config) { + post (url, data, config) { return this.makeReq({ ...config, url, @@ -383,7 +383,7 @@ class API { }) } - put(url, data, config) { + put (url, data, config) { return this.makeReq({ ...config, url, @@ -392,7 +392,7 @@ class API { }) } - delete(url, data, config) { + delete (url, data, config) { return this.makeReq({ ...config, url, diff --git a/src/api/shop.js b/src/api/shop.js index 641fa88..abf6c9c 100755 --- a/src/api/shop.js +++ b/src/api/shop.js @@ -87,7 +87,7 @@ export function getShopTemplate (params) { /** * @function 店铺首页模版配置 */ - export function getStoreShopTemplate (params) { +export function getStoreShopTemplate (params) { return req.get(`/pagestemplate/shopDetail`, { template_name: 'yykweishop', weapp_pages: 'index', @@ -102,6 +102,11 @@ export function getMapKeyDetail (params) { } // 获取小程序价格配置 -export function getAppGoodsPriceSetting() { +export function getAppGoodsPriceSetting () { return req.get('/setting/itemPrice') -} \ No newline at end of file +} + +// 获取首页轮播图 +export function homeSwiperList (params) { + return req.get('/xiudibanner', params) +} diff --git a/src/app.config.js b/src/app.config.js index 69443b3..34138e3 100755 --- a/src/app.config.js +++ b/src/app.config.js @@ -275,6 +275,8 @@ const config = { 'pages/trade/refund-detail', //售后申请提交结果页面 'pages/trade/refund-sendback', //售后填写物流公司页面 'pages/trade/invoice-list', //发票管理 + 'pages/trade/invoice-info', //发票信息 + 'pages/trade/invoice-record', //发票列表 // 'pages/cashier/index', //收银台页面 // 'pages/cashier/cashier-result', //支付结果页面 'pages/qrcode-buy', //二维码购买页 diff --git a/src/components/address/address.scss b/src/components/address/address.scss index 58a0ee6..46df248 100755 --- a/src/components/address/address.scss +++ b/src/components/address/address.scss @@ -9,7 +9,21 @@ .address { display: flex; align-items: center; - padding: 24px 16px; + padding: 24px 28px; + .dz-addr { + font-size: 40px; + color: #000; + line-height: 1; + margin-bottom: 20px; + display: flex; + justify-content: space-between; + align-items: center; + .bj { + font-size: 26px; + line-height: 1; + padding: 18px 20px; + } + } } // choose-address &__bd { @@ -28,16 +42,17 @@ } .user-info-trade { color: #666; - font-size: 28px; + font-size: 26px; .name { - margin-right: $edge-margin; + margin-right: 8px; } } .address-detail { - color: #222; - font-weight: bold; - font-size: 32px; - padding: 24px 0; + color: #666; + // font-weight: bold; + font-size: 26px; + // padding: 24px 0; + padding-top: 6px; } .address-area { color: #666; diff --git a/src/components/address/choose-address.js b/src/components/address/choose-address.js index 504610b..d4a3fa3 100755 --- a/src/components/address/choose-address.js +++ b/src/components/address/choose-address.js @@ -17,10 +17,10 @@ import './address.scss' ) export default class AddressChoose extends Component { static defaultProps = { - onClickBack: () => {} + onClickBack: () => { } } - constructor (props) { + constructor(props) { super(props) this.state = {} @@ -45,25 +45,31 @@ export default class AddressChoose extends Component { return ( - + {isObjectsValue(isAddress) ? ( - + {/* {isAddress.is_def && 默认} {isAddress.province} {isAddress.city} {isAddress.county} + */} + + 收货地址 + 编辑 - {isAddress.adrdetail} {isAddress.username} {isAddress.telephone} + {isAddress.province} + {isAddress.city} + {isAddress.county}{isAddress.adrdetail} - + {/* */} ) : ( +请选择收货地址 diff --git a/src/components/search-bar/index.scss b/src/components/search-bar/index.scss index 1524e37..8f640cd 100755 --- a/src/components/search-bar/index.scss +++ b/src/components/search-bar/index.scss @@ -5,7 +5,7 @@ box-sizing: border-box; &__focus { height: 100vh; - z-index: 10; + z-index: 99; position: absolute; top: 0; left: 0; @@ -14,6 +14,7 @@ padding: 16px 28px; background: #fff; box-sizing: border-box; + overflow: hidden; &.without-dialog { height: auto; } diff --git a/src/components/sp-checkbox/index.scss b/src/components/sp-checkbox/index.scss index 5b34e0e..8ade6b7 100755 --- a/src/components/sp-checkbox/index.scss +++ b/src/components/sp-checkbox/index.scss @@ -6,8 +6,25 @@ margin-left: 10px; } .icon-my { - transition: all 0.2s ease-in-out; + transition: all 0.3s ease-in-out; } + @keyframes scale { + 0% { + transform: scale(0.1); + } + 50% { + transform: scale(1.5); + } + 100% { + transform: scale(1); + } + } + // .icon-checkbox-weixuan { + // animation: scale 0.5s reverse forwards; + // } + // .icon-checkbox-xuanzhong { + // animation: scale 0.5s forwards; + // } .icon-checkbox-xuanzhong, .icon-roundcheckfill { font-size: 40px; diff --git a/src/components/sp-default/index.js b/src/components/sp-default/index.js index 8faffe3..912e721 100755 --- a/src/components/sp-default/index.js +++ b/src/components/sp-default/index.js @@ -7,7 +7,7 @@ import './index.scss' const TYPES = { // cart: 'empty_cart.png' - cart: 'index/logo.png' + cart: 'cart/logo-hui.png' } function SpDefault (props) { diff --git a/src/components/sp-filter-bar-new/index.js b/src/components/sp-filter-bar-new/index.js index 766327a..34edfc0 100755 --- a/src/components/sp-filter-bar-new/index.js +++ b/src/components/sp-filter-bar-new/index.js @@ -16,9 +16,9 @@ export default class SpFilterBar extends Component { sort: {}, current: 0, list: [ - { text: '推荐', val: '0' }, - { text: '上架时间', val: '3' }, - { text: '价格低-高', val: '1' }, + // { text: '推荐', val: '0' }, + { text: '上架时间', val: '6' }, //更新时间降序 + { text: '价格低-高', val: '3' }, { text: '价格高-低', val: '2' }, ] } @@ -31,6 +31,7 @@ export default class SpFilterBar extends Component { curIdx: current, sortOrder: 1, value: '0', + sortVal: '0', showFilter: false } } @@ -54,19 +55,18 @@ export default class SpFilterBar extends Component { }) } - handleConfirm = (val, index) => { - console.log("🚀 ~ SpFilterBar ~ val:", val, index) + handleConfirm = ({ val }, index) => { // this.setState({ // value: val // }) - // this.props.onChange({ - // current: val - // }) + this.props.onChange({ + current: val + }) } render () { const { list = [], className, custom, color, num } = this.props - const { sortOrder, curIdx, value, showFilter } = this.state + const { sortOrder, curIdx, value, showFilter, sortVal } = this.state return ( @@ -95,7 +95,7 @@ export default class SpFilterBar extends Component { - }> + }> 排序 diff --git a/src/components/sp-goods-cell/index.js b/src/components/sp-goods-cell/index.js index 604b1b1..91c1447 100755 --- a/src/components/sp-goods-cell/index.js +++ b/src/components/sp-goods-cell/index.js @@ -7,13 +7,29 @@ import { GOODS_TYPE } from '@/consts' import { VERSION_IN_PURCHASE } from '@/utils' import './index.scss' -function SpGoodsCell(props) { +function SpGoodsCell (props) { const { info, onSelectSku } = props const { userInfo = {}, vipInfo = {} } = useSelector((state) => state.user) if (!info) { return null } + const desc = info.itemSpecDesc + 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) { + } + } + const handleClick = () => { onSelectSku && onSelectSku(info) } @@ -45,89 +61,91 @@ function SpGoodsCell(props) { // console.log('isNaN(memberPrice):', info.orderItemType) return ( - - - - - - - {info.itemName} + <> + + + - - - {/* 多规格商品 */} - {!info.nospec && ( - - {onSelectSku && ( - - {info.specText || '选择规格'} - - - )} - {!onSelectSku && info.itemSpecDesc} + + + {info.itemName} + + + + {/* 多规格商品 */} + {!info.nospec && ( + + {onSelectSku && ( + + {desc_info || info.specText || '选择规格'} + + + )} + {!onSelectSku && (desc_info || info.itemSpecDesc)} + + )} + + + + {!isNaN(memberPrice) && !VERSION_IN_PURCHASE && ( + + {vipInfo?.isVip ? vipInfo?.grade_name : userInfo?.gradeInfo?.grade_name} )} - - - - {!isNaN(memberPrice) && !VERSION_IN_PURCHASE && ( - - {vipInfo?.isVip ? vipInfo?.grade_name : userInfo?.gradeInfo?.grade_name} - - )} - {info?.orderItemType && info?.orderItemType != 'normal' && ( - {GOODS_TYPE[info.orderItemType]} - )} - {info.discount_info?.map((sp, idx) => { - if (sp.type != 'coupon_discount' && sp.type != 'member_price') { - return ( - - {sp.info} - - ) - } - })} - {cusActivity?.map((el) => { - let limitTxt = '' - let limitNum = '' - if (el?.activity_type == 'limited_buy') { - limitNum = el?.limit - if (el?.day == 0) { - limitTxt = `限购${limitNum}件` - } else { - limitTxt = `每${el?.day}天,限购${limitNum}件` - } - } - { - /* else if (el?.activity_type == 'seckill' || el?.activity_type == 'limited_time_sale') { - limitNum = el?.limit - limitTxt = `(限购${limitNum}件)` - } else if (el?.activity_type == 'member_tag_targeted_promotion') { - limitTxt = '专属优惠' - } */ - } - return {limitTxt} - })} - {/* {limitTxt && {limitTxt}} */} - - - - {isPoint && } - {!isPoint && } - {info.marketPrice > 0 && ( - + {info?.orderItemType && info?.orderItemType != 'normal' && ( + {GOODS_TYPE[info.orderItemType]} )} + {info.discount_info?.map((sp, idx) => { + if (sp.type != 'coupon_discount' && sp.type != 'member_price') { + return ( + + {sp.info} + + ) + } + })} + {cusActivity?.map((el) => { + let limitTxt = '' + let limitNum = '' + if (el?.activity_type == 'limited_buy') { + limitNum = el?.limit + if (el?.day == 0) { + limitTxt = `限购${limitNum}件` + } else { + limitTxt = `每${el?.day}天,限购${limitNum}件` + } + } + { + /* else if (el?.activity_type == 'seckill' || el?.activity_type == 'limited_time_sale') { + limitNum = el?.limit + limitTxt = `(限购${limitNum}件)` + } else if (el?.activity_type == 'member_tag_targeted_promotion') { + limitTxt = '专属优惠' + } */ + } + return {limitTxt} + })} + {/* {limitTxt && {limitTxt}} */} + - {info.num && x {info.num}} + {info.num && 数量:{info.num}} + - + + {isPoint && } + {!isPoint && } + {info.marketPrice > 0 && ( + + )} + + ) } diff --git a/src/components/sp-goods-cell/index.scss b/src/components/sp-goods-cell/index.scss index cecebb6..07ddae0 100755 --- a/src/components/sp-goods-cell/index.scss +++ b/src/components/sp-goods-cell/index.scss @@ -1,12 +1,17 @@ .sp-goods-cell { display: flex; .goods-item-hd { - margin-right: 24px; + margin-right: 60px; } .goods-item-bd { flex: 1; + // flex-direction: column; + // display: flex; + // justify-content: space-between; .goods-title { max-width: 400px; + font-size: 20px; + color: #000; @include multi-ellipsis(2); } .item-bd { @@ -16,13 +21,15 @@ justify-content: space-between; .goods-sku { - background: #f5f5f5; - height: 46px; - line-height: 46px; - padding: 0 2px; - color: #666; + // background: #f5f5f5; + // height: 46px; + // line-height: 46px; + // padding: 0 2px; + color: #333; display: inline-block; max-width: 400px; + font-size: 20px; + padding: 26px 0; @include text-overflow(); } } @@ -30,6 +37,8 @@ .item-ft { display: flex; justify-content: space-between; + font-size: 20px; + line-height: 1; .price-gp { display: flex; align-items: flex-end; @@ -43,7 +52,7 @@ .spec-text { display: flex; align-items: center; - font-size: 26px; + font-size: 20px; color: #222; .icon-qianwang-01 { font-size: 16px; diff --git a/src/components/sp-goods-item/index.js b/src/components/sp-goods-item/index.js index 08e3d4e..b44a4d8 100755 --- a/src/components/sp-goods-item/index.js +++ b/src/components/sp-goods-item/index.js @@ -4,6 +4,7 @@ import Taro, { getCurrentInstance } from '@tarojs/taro' import { View, Text, Image, ScrollView } from '@tarojs/components' import { SpImage, SpPoint, SpPrice, SpVipLabel } from '@/components' import { fetchUserFavs, addUserFav, deleteUserFav } from '@/store/slices/user' +import throttle from 'lodash/throttle' import qs from 'qs' import api from '@/api' import S from '@/spx' @@ -45,6 +46,12 @@ function SpGoodsItem (props) { const [info, setInfo] = useState(props.info || null) const [current, setCurrent] = useState(0) const [move, setMove] = useState(0) + const [selColorItem, setSelColorItem] = useState({}) + + const setSelColor = (index, item) => { + setCurrent(index) + setSelColorItem(item) + } const handleFavClick = async (e) => { e.stopPropagation() @@ -65,16 +72,16 @@ function SpGoodsItem (props) { } const handleClick = () => { - const { itemId, distributorId, card_id, code, user_card_id, point } = info + const { itemId, item_id, distributorId, distributor_id, card_id, code, user_card_id, point } = info if (onClick) { onClick() return } - let query = { id: itemId } - if (typeof distributorId != 'undefined') { + let query = { id: itemId || item_id } + if (typeof distributorId != 'undefined' || typeof distributor_id != 'undefined') { query = { ...query, - dtid: distributorId + dtid: distributorId || distributor_id } } if (card_id) { @@ -85,8 +92,9 @@ function SpGoodsItem (props) { user_card_id } } - - const url = `${!!point ? '/subpages/pointshop/espier-detail' : '/pages/item/espier-detail'}?${qs.stringify(query)}` + query.idx = current + // const url = `${!!point ? '/subpages/pointshop/espier-detail' : '/pages/item/espier-detail'}?${qs.stringify(query)}` + const url = `${'/pages/item/espier-detail'}?${qs.stringify(query)}` Taro.navigateTo({ url }) @@ -96,17 +104,38 @@ function SpGoodsItem (props) { return null } - const colors = [{ color: '#000' }, { color: '#fff' }, { color: 'skyblue' }, { color: 'purple' }] + const colors = [{ color_value: '#000' }, { color_value: '#fff' }, { color_value: 'skyblue' }, { color_value: 'purple' }] - // console.log( "favs:", favs ); const isFaved = favs.findIndex((item) => item.item_id == info.itemId) > -1 const isShowStore = !hideStore && VERSION_PLATFORM && info.distributor_info && !Array.isArray(info.distributor_info) + + let left = false + const handleLeft = () => { + if (left) return + left = true + setMove(move > 1 ? move - 1 : 0) + setTimeout(() => { + left = false + }, 800) + } + + let right = false + const i = (info.spec_images || colors).length + const handleRight = () => { + if (right) return + right = true + setMove(move < i - 2 ? move + 1 : move) + setTimeout(() => { + right = false + }, 1000) + } return ( - - NEW + + {info.tagList.map((item, index) => {item.tag_name})} + {/* NEW */} {/* {renderBrand && {renderBrand}} */} @@ -124,26 +153,26 @@ function SpGoodsItem (props) { )} - {info.brief} - {info.itemName} + {info.item_name || info.itemName} + {info.brief} {showSalePrice && <> ¥ {info.activityPrice || info.price} e.stopPropagation()}> - setMove(move > 1 ? move - 1 : 0)}> + { - console.log(e.detail.scrollLeft / 32) + // console.log(e.detail.scrollLeft / 32) // setMove(Math.floor(e.detail.scrollLeft / 32)) }} scrollLeft={move * 32} scrollX scrollWithAnimation className='color-box' showScrollbar={false}> - {(info.colors || colors).map((item, index) => ( - setCurrent(index)}> - + {(info.spec_images || colors).map((item, index) => ( + setSelColor(index, item)} key={`color__${index}`}> + ))} - setMove(move < (info.colors || colors).length - 2 ? move + 1 : move)}> + } @@ -159,13 +188,13 @@ function SpGoodsItem (props) { )} - + {false && {/* 商品价格、积分 */} - {info.point && ( + {/* {info.point && ( - )} + )} */} {!info.point && showPrice && ( @@ -225,10 +254,10 @@ function SpGoodsItem (props) { /> )} */} - + } {isShowStore && ( - onStoreClick(info)}> + onStoreClick(info, current)}> = max @@ -104,14 +104,14 @@ class AtInputNumber extends AtComponent { this.props.onErrorInput(errorValue) } - render() { + render () { const { customStyle, className, width, disabled, value, type, min, max, size } = this.props const inputStyle = { width: width ? `${Taro.pxTransform(width)}` : '' } const inputValue = this.handleValue(value) - console.log('inputValue', inputValue, max, inputValue >= parseInt(max)) + // console.log('inputValue', inputValue, max, inputValue >= parseInt(max)) const rootCls = classNames( 'sp-input-number', 'at-input-number', @@ -161,8 +161,8 @@ AtInputNumber.defaultProps = { max: 100, step: 1, size: '', - onChange: () => {}, - onBlur: () => {} + onChange: () => { }, + onBlur: () => { } } export default AtInputNumber diff --git a/src/components/sp-login/index.scss b/src/components/sp-login/index.scss index d0178f5..502b735 100755 --- a/src/components/sp-login/index.scss +++ b/src/components/sp-login/index.scss @@ -99,4 +99,118 @@ padding: 0 50px 50px; } } + .curtain { + .at-curtain__container { + width: 100%; + padding: 0 30px; + } + .at-curtain__btn-close--bottom { + display: none; + } + &.show { + opacity: 1; + visibility: visible; + } + &.hide { + opacity: 0; + visibility: hidden; + } + &_mask { + display: flex; + position: relative; + width: 100%; + height: 100%; + // padding: 100px 30px; + justify-content: center; + align-items: center; + box-sizing: border-box; + opacity: 1; + } + &_content { + width: 100%; + background-color: #fff; + border-radius: 10px; + padding: 60px 46px 30px; + box-sizing: border-box; + &_title { + display: flex; + justify-content: center; + align-items: center; + font-size: 34px; + line-height: 1; + margin-bottom: 80px; + color: #000; + .sp-image { + margin-right: 4px; + } + } + &_text { + font-size: 26px; + line-height: 2; + max-height: 620px; + color: #000; + } + .agreement-list { + display: inline-block; + } + .agreement-name { + color: #14287e; + padding: 0px 2px; + // font-size: 26px; + } + } + .btn-wrap { + position: relative; + } + .btn { + margin-top: 40px; + margin-bottom: 30px; + } + .no-btn { + display: flex; + justify-content: center; + margin: 0 auto; + padding: 0 32rpx; + height: 80rpx; + color: #222; + font-size: 32rpx; + line-height: 78rpx; + text-align: center; + border-radius: 8rpx; + border: 1px solid #000; + box-sizing: border-box; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .no-text { + color: #7e7e7e; + font-size: 20rpx; + margin-top: 28rpx; + line-height: 1.4; + } + @keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + } + .btn-cantact { + background: transparent; + // background: skyblue; + padding: 0; + position: absolute; + top: 0; + left: 0; + border: none; + width: 600px; + height: 80px; + z-index: 10; + &:after { + border-width: 0; + } + } } diff --git a/src/components/sp-login/index.weapp.js b/src/components/sp-login/index.weapp.js index abc77cc..cd1cdeb 100755 --- a/src/components/sp-login/index.weapp.js +++ b/src/components/sp-login/index.weapp.js @@ -1,6 +1,6 @@ import Taro from '@tarojs/taro' import React, { useEffect, useState, useCallback, useRef, useImperativeHandle } from 'react' -import { View, Text, Button } from '@tarojs/components' +import { View, Text, Button, ScrollView } from '@tarojs/components' import { AtButton, AtCurtain } from 'taro-ui' import { useImmer } from 'use-immer' import S from '@/spx' @@ -19,7 +19,7 @@ const initialState = { privacyName: '', agreeMentChecked: false } -function SpLogin(props, ref) { +function SpLogin (props, ref) { const { children, className, onChange, newUser = false } = props const { isLogin, login, setToken, checkPolicyChange } = useLogin({ policyUpdateHook: (isUpdate) => { @@ -203,12 +203,13 @@ function SpLogin(props, ref) { {/* 授权登录 */} { setLoginModal(false) }} > - + {/* {nickname} @@ -232,6 +233,45 @@ function SpLogin(props, ref) { 登录 } + */} + + + + 隐私政策 + + + 亲爱的用户,感谢您使用Birkenstock微信小程序!为了加强对您个人信息的保护,我们根据最新法律的要求制定/更新了 + + 《{registerName}》和 + 《{privacyName}》 + ,我们将基于合法以及正当必要的原则,按照本政策的规定向您提供各项服务 + + 本政策旨在向您说明休迪贸易 (上海)有限公司及其在中国大陆境内的线上线下门店如何收集、使用、传输和保护您的个人信息 + 通过《隐私政策》,我们向您主要说明: + + + 1.您在使用Birkenstock微信小程序时,可以选择浏览模式,也可以选择注册/登录成为Birkenstock微信小程序用户 + + + 2为了向你提供Birkenstock微信小程序的其本服条,我们将基于合法以及正当必要的原则,按照本政策的规定向您提供各项服务 + + + + {isNewUser && { + setLoginModal(false) + handleBindPhone(e) + }}> + 同意并继续 + } + {!isNewUser && + 同意并继续 + } + + setLoginModal(false)}>不同意 + + *如果您不同意Birkenstock隐私政策,您可继续浏览小程序,但您无法使用购物结算功能 + diff --git a/src/components/sp-order-item/index.js b/src/components/sp-order-item/index.js index d894f30..3ef39bd 100755 --- a/src/components/sp-order-item/index.js +++ b/src/components/sp-order-item/index.js @@ -54,9 +54,8 @@ function SpOrderItem (props) { } } - const img = info.pic_path ? info.pic_path : Array.isArray(info.pics) ? info.pics[0] : info.pics - - // console.log('order item info:', info) + const img = info.pic || info.pic_path ? info.pic_path : Array.isArray(info.pics) ? info.pics[0] : info.pics + const title = info.title || info.item_name return ( @@ -72,7 +71,7 @@ function SpOrderItem (props) { {info.order_item_type === 'gift' && ( 赠品 )} - {info.title} + {title} {showDesc && info.item_spec_desc && ( {info.item_spec_desc} diff --git a/src/components/sp-page/index.js b/src/components/sp-page/index.js index cc61115..02a3789 100755 --- a/src/components/sp-page/index.js +++ b/src/components/sp-page/index.js @@ -255,7 +255,7 @@ function SpPage (props, ref) { } renderTitle = showCustomNavigation && showNavLogo ? : undefined - const navigationBarTitleText = getCurrentInstance().page?.config?.navigationBarTitleText + const navigationBarTitleText = props.navigationBarTitleText || getCurrentInstance().page?.config?.navigationBarTitleText return ( { } + const handlerChange = (value) => { + // setState((draft) => { + // draft.value = value + // }) + } const onPickerCancel = () => { setState((draft) => { @@ -43,7 +47,7 @@ function SpPicker (props) { // const pickerConfirm = () => { } return ( - + { @@ -91,7 +95,7 @@ function SpPicker (props) { value={value} fields='minute' onPickerCancel={onPickerCancel} - // change={handlerChange} + onChange={handlerChange} handleConfirm={pickerConfirm} /> ) : null} @@ -127,4 +131,4 @@ SpPicker.options = { addGlobalClass: true } -export default SpPicker +export default React.memo(SpPicker) diff --git a/src/components/sp-picker/picker-select.js b/src/components/sp-picker/picker-select.js index 541395e..06a2740 100755 --- a/src/components/sp-picker/picker-select.js +++ b/src/components/sp-picker/picker-select.js @@ -12,13 +12,14 @@ const initialState = { markMultiDateTime: false } function PickerDateTime (props) { - const { handleConfirm, onPickerCancel } = props + const { handleConfirm, onPickerCancel, list = [] } = props const dateTime = [ { mode: 'year', unit: '年' }, { mode: 'month', unit: '月' }, { mode: 'day', unit: '日' }, ] - const [state, setState] = useAsyncCallback({ source: props.list || [], value: props.value || '' }) + // const [state, setState] = useAsyncCallback({ source: props.list || [], value: props.value || '' }) + const [state, setState] = useImmer({ source: list, value: props.value }) const { source, value } = state // useEffect(() => { // // const { dateTime, start } = this.props @@ -45,30 +46,30 @@ function PickerDateTime (props) { (draft) => { draft.value = e.detail.value }, - ({ source, value }) => { - // const res = [] - // for (let i = 0; i < source.length; i++) { - // let time = '', - // token = '' - // // source[i].item.length为可选项的列数 - // for (let j = 0; j < source[i].item.length; j++) { - // const select = source[i].item[j][value[i][j]] - // time += (select === '今天' ? dayjs().format('M月D日') : select) + '-' - // // 对于二维数组取i、j;对于一维数组取j - // const item = markMultiDateTime ? dateTime[i][j] : dateTime[j] - // token += (item.format || getToken(item.mode)) + '-' - // } - // res.push(dayjs(time, token)[mode]()) - // } - // return markMultiDateTime ? res : res[0] - // const res = source.map((item, index) => item[value[index]]) - // const cur = getDayjs() - // const source2 = dateTime && format(dateTime, dayjs(start)) - // console.log('source2:', source2) - } + // ({ source, value }) => { + // const res = [] + // for (let i = 0; i < source.length; i++) { + // let time = '', + // token = '' + // // source[i].item.length为可选项的列数 + // for (let j = 0; j < source[i].item.length; j++) { + // const select = source[i].item[j][value[i][j]] + // time += (select === '今天' ? dayjs().format('M月D日') : select) + '-' + // // 对于二维数组取i、j;对于一维数组取j + // const item = markMultiDateTime ? dateTime[i][j] : dateTime[j] + // token += (item.format || getToken(item.mode)) + '-' + // } + // res.push(dayjs(time, token)[mode]()) + // } + // return markMultiDateTime ? res : res[0] + // const res = source.map((item, index) => item[value[index]]) + // const cur = getDayjs() + // const source2 = dateTime && format(dateTime, dayjs(start)) + // console.log('source2:', source2) + // } ) } - + console.log(value) return ( { onPickerCancel() - handleConfirm(source[value[0]], value[0]) + setTimeout(() => { + handleConfirm(source[value[0]], value[0]) + }, 100) }}>确定 ) @@ -95,4 +98,4 @@ PickerDateTime.options = { addGlobalClass: true } -export default PickerDateTime +export default React.memo(PickerDateTime) diff --git a/src/components/sp-sku-select-new/index.js b/src/components/sp-sku-select-new/index.js index 21c660d..2c124a5 100755 --- a/src/components/sp-sku-select-new/index.js +++ b/src/components/sp-sku-select-new/index.js @@ -45,7 +45,8 @@ function SpSkuSelect (props, ref) { onClose = () => { }, onChange = () => { }, type, - hideInputNumber = false + hideInputNumber = false, + onChangeImg } = props // console.log('SpSkuSelect:info', info) // const [state, setState] = useImmer(initialState) @@ -76,7 +77,7 @@ function SpSkuSelect (props, ref) { calcDisabled(selection) } - const calcDisabled = (selection) => { + const calcDisabled = (selection, i = 0) => { const disabledSet = new Set() const makeReg = (sel, row, val) => { const tSel = sel.slice() @@ -126,7 +127,7 @@ function SpSkuSelect (props, ref) { draft.skuText = skuText }) - onChange(skuText, curItem) + onChange(skuText, curItem, i) } // calcDisabled(initSelection) @@ -134,6 +135,7 @@ function SpSkuSelect (props, ref) { // console.log('disabledSet:', disabledSet) const handleSelectSku = ({ specId }, idx) => { + console.log("🚀 ~ { specId }, idx:", specId, idx) if (disabledSet.has(specId)) return setState( (draft) => { @@ -141,7 +143,7 @@ function SpSkuSelect (props, ref) { draft.curImage = 1 }, (row) => { - calcDisabled(row.selection) + calcDisabled(row.selection, idx) } ) } @@ -154,6 +156,7 @@ function SpSkuSelect (props, ref) { img = specImgs[0] } } + onChangeImg && onChangeImg(img) // console.log('img:', img) return img } @@ -238,7 +241,8 @@ function SpSkuSelect (props, ref) { return { fastBuy, addToCart, - getImgs + getImgs, + handleSelectSku } }) diff --git a/src/doc/goods.js b/src/doc/goods.js index 5119f49..5fb4147 100755 --- a/src/doc/goods.js +++ b/src/doc/goods.js @@ -89,9 +89,10 @@ export const ITEM_LIST_GOODS = { memberPrice: ({ member_price }) => member_price / 100, // 当前会员等级价 vipPrice: ({ vip_price }) => vip_price / 100, // vip价格 svipPrice: ({ svip_price }) => svip_price / 100, // svip价格 - + spec_images: 'spec_images', // is_fav: ({ item_id }) => Boolean(favs[item_id]), - store: 'store' + store: 'store', + tagList: 'tagList' } export const ITEM_LIST_POINT_GOODS = { @@ -233,6 +234,7 @@ export const GOODS_INFO = { }) }, intro: 'intro', + introList: 'intro_list', distributorInfo: ({ distributor_info }) => { return pickBy(distributor_info, { distributorId: 'distributor_id', diff --git a/src/hooks/useLogin.js b/src/hooks/useLogin.js index d4be31f..65c7ef6 100755 --- a/src/hooks/useLogin.js +++ b/src/hooks/useLogin.js @@ -5,12 +5,12 @@ import dayjs from 'dayjs' import { updateUserInfo, fetchUserFavs, clearUserInfo } from '@/store/slices/user' import { updateCount, clearCart } from '@/store/slices/cart' import api from '@/api' -import { isWeixin, showToast, entryLaunch,isAlipay,alipayAutoLogin } from '@/utils' +import { isWeixin, showToast, entryLaunch, isAlipay, alipayAutoLogin } from '@/utils' import S from '@/spx' import { SG_POLICY } from '@/consts/localstorage' export default (props = {}) => { - const { autoLogin = false, policyUpdateHook = () => {} } = props + const { autoLogin = false, policyUpdateHook = () => { } } = props const [isLogin, setIsLogin] = useState(false) const [isNewUser, setIsNewUser] = useState(false) const dispatch = useDispatch() @@ -40,28 +40,39 @@ export default (props = {}) => { // 隐私协议 // const checkResult = await checkPolicyChange() // if (checkResult) { - Taro.showLoading({ title: '' }) - const { code } = await getCode() + Taro.showLoading({ title: '' }) + let code + try { + const { code: _code } = await getCode() + code = _code + } catch (error) { + Taro.hideLoading() + } - try { - const { token } = await getToken(code) + try { + if (!code) { Taro.hideLoading() - setToken(token) - } catch (e) { setIsNewUser(true) - Taro.hideLoading() - console.error('[hooks useLogin] auto login is failed: ', e) - throw new Error(e) + return } + const { token } = await getToken(code) + Taro.hideLoading() + setToken(token) + } catch (e) { + Taro.hideLoading() + setIsNewUser(true) + console.error('[hooks useLogin] auto login is failed: ', e) + // throw new Error(e) + } // } } } const getCode = async () => { - if(isWeixin){ + if (isWeixin) { return await Taro.login() } - if(isAlipay){ + if (isAlipay) { return await alipayAutoLogin() } } @@ -79,7 +90,7 @@ export default (props = {}) => { const setToken = async (token) => { const { redirect_url } = $instance.router.params - console.log('redirect_url',redirect_url) + console.log('redirect_url', redirect_url) S.setAuthToken(token) setIsLogin(true) await getUserInfo() diff --git a/src/pages/cart/comps/comp-deliver.js b/src/pages/cart/comps/comp-deliver.js index 03cd0b4..710279a 100755 --- a/src/pages/cart/comps/comp-deliver.js +++ b/src/pages/cart/comps/comp-deliver.js @@ -34,7 +34,7 @@ const initialState = { activeTimeId: '' } -function CompDeliver(props, ref) { +function CompDeliver (props, ref) { const { address = {}, distributor_id, @@ -250,7 +250,7 @@ function CompDeliver(props, ref) { return ( - + {/* 0 && 'switch-tab')}> {deliveryList.map((item) => { if (distributorInfo[item.key]) { @@ -266,7 +266,7 @@ function CompDeliver(props, ref) { } })} - + */} {/** 普通快递 */} {receiptType === 'logistics' && } {/** 同城配 */} diff --git a/src/pages/cart/comps/comp-deliver.scss b/src/pages/cart/comps/comp-deliver.scss index 26f99eb..fd20f3c 100755 --- a/src/pages/cart/comps/comp-deliver.scss +++ b/src/pages/cart/comps/comp-deliver.scss @@ -1,8 +1,8 @@ .page-comp-deliver { width: 100%; - background: #fff; - padding: 10px 0px; - box-shadow: 0px 2px 10px 0px #eae7e0; + background: #f7f7f7; + // padding: 10px 0px; + // box-shadow: 0px 2px 10px 0px #eae7e0; .switch-box { display: flex; justify-content: flex-end; diff --git a/src/pages/cart/comps/comp-goodsitem.js b/src/pages/cart/comps/comp-goodsitem.js index 2c6f357..3c9b394 100755 --- a/src/pages/cart/comps/comp-goodsitem.js +++ b/src/pages/cart/comps/comp-goodsitem.js @@ -47,7 +47,6 @@ function CompGoodsItem (props) { } const { price, activity_price, member_price, package_price } = info - console.log("🚀 ~ info:", info) let _price if (!isNaN(activity_price)) { _price = activity_price diff --git a/src/pages/cart/const/index.js b/src/pages/cart/const/index.js index 1a039bf..e7cef5e 100755 --- a/src/pages/cart/const/index.js +++ b/src/pages/cart/const/index.js @@ -55,7 +55,8 @@ export const initialState = { isNeedPackage: false, // 是否需要打包 openCashier: false, isPointOpenModal: false, - routerParams: {} + routerParams: {}, + orderTtems: [] } export const deliveryList = [ diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index d0e1cae..c5df826 100755 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -31,7 +31,8 @@ import { isEmpty, VERSION_STANDARD, VERSION_B2C, - VERSION_PLATFORM + VERSION_PLATFORM, + JumpGoodDetail } from '@/utils' import { useAsyncCallback, useLogin, usePayment, useDebounce } from '@/hooks' import { PAYMENT_TYPE, TRANSFORM_PAYTYPE } from '@/consts' @@ -51,7 +52,7 @@ import CompPointUse from './comps/comp-pointuse' import './espier-checkout.scss' -function CartCheckout(props) { +function CartCheckout (props) { const $instance = getCurrentInstance() const { isLogin, isNewUser, getUserInfoAuth } = useLogin({ autoLogin: true @@ -103,7 +104,8 @@ function CartCheckout(props) { openCashier, buildingNumber, houseNumber, // 房号 - routerParams // 路由参数 + routerParams, // 路由参数 + orderTtems } = state const { @@ -193,7 +195,7 @@ function CartCheckout(props) { return } - if(!payType) { + if (!payType) { showToast('请选择支付方式') return } @@ -622,6 +624,7 @@ function CartCheckout(props) { /* 处理限购活动,添加到对应的items里---结束 */ setState((draft) => { draft.detailInfo = pickBy(items, doc.checkout.CHECKOUT_GOODS_ITEM) + draft.orderTtems = items draft.totalInfo = total_info draft.paramsInfo = { ...paramsInfo, ...cus_parmas } draft.pointInfo = point_info @@ -811,17 +814,17 @@ function CartCheckout(props) { return ( - {`共${totalInfo.items_count}件商品 总计:`} - + {/* {`共${totalInfo.items_count}件商品 总计:`} */} + 订单总计 + - 提交订单 + 立即结算 ) @@ -833,17 +836,64 @@ function CartCheckout(props) { - 商品清单 ({totalInfo.items_count}) + 订单商品 + {/* ({totalInfo.items_count}) */} {detailInfo.map((item, idx) => ( + {/* { + if (info.order_class == 'pointsmall') { + Taro.navigateTo({ + url: `/subpages/pointshop/espier-detail?id=${item.good_id}` + }) + } else { + JumpGoodDetail(item.good_id, item.distributor_id) + } + }} + /> */} + ))} + + + + 订单金额 + + {/* {`¥${parseFloat(totalInfo.item_fee_new / 100).toFixed(2)}`} */} + {/* + {totalInfo.item_fee_new} + {transformTextByPoint(this.isPointitemGood(), info.item_fee_new, info.item_point)} + */} + + + 优惠金额 + {/* 促销 + 优惠券 */} + {`¥${parseFloat(totalInfo.promotion_discount + totalInfo.coupon_discount).toFixed(2)}`} + + + 运费 + + {totalInfo.freight_type !== 'point' + ? `¥${totalInfo.freight_fee}` + : `${totalInfo.freight_fee * 100}${this.props.pointName}`} + + + + + + 订单总计 + + - + {/* - + */} ) } - console.log(couponInfo, 'couponInfo', coupon) - console.log('invoiceTitle', invoiceTitle) - console.log('payChannel', payChannel) + // console.log(couponInfo, 'couponInfo', coupon) + // console.log('invoiceTitle', invoiceTitle) + // console.log('payChannel', payChannel) const couponText = couponInfo ? couponInfo.title : '' // couponInfo.type === 'member' // ? '会员折扣' @@ -935,7 +985,7 @@ function CartCheckout(props) { {renderGoodsComp()} - {type !== 'limited_time_sale' && type !== 'group' && type !== 'seckill' && !bargain_id && ( + {/* {type !== 'limited_time_sale' && type !== 'group' && type !== 'seckill' && !bargain_id && ( - )} - {isWeixin && !bargain_id && totalInfo.invoice_status && ( + )} */} + {/* {isWeixin && !bargain_id && totalInfo.invoice_status && ( } /> - )} + )} */} {packInfo.is_open && ( )} - + {false && } /> )} - + } */} - + 购物车还是空的 快去挑选自己喜欢的宝贝吧~ { }}> diff --git a/src/pages/category/comps/comp-series.js b/src/pages/category/comps/comp-series.js index d1dd776..a2ef5c4 100755 --- a/src/pages/category/comps/comp-series.js +++ b/src/pages/category/comps/comp-series.js @@ -61,7 +61,7 @@ const CompSeries = (props) => { const renderCategoryChildHandler = (item = selChild) => { return ( - + {/* handleCustomClick(item.category_id) */} handleClickItem(item)}> 探索全部 diff --git a/src/pages/category/comps/comp-series.scss b/src/pages/category/comps/comp-series.scss index 91c4e13..137aceb 100755 --- a/src/pages/category/comps/comp-series.scss +++ b/src/pages/category/comps/comp-series.scss @@ -97,7 +97,10 @@ .new { width: 100%; } + .group-box { + } .group { + animation: fadeInAnimation 0.2s ease-in-out; position: relative; width: 100%; color: #fff; @@ -183,3 +186,12 @@ } } } + +@keyframes fadeInAnimation { + from { + opacity: 0; + } + to { + opacity: 1; + } +} diff --git a/src/pages/home/index.scss b/src/pages/home/index.scss index 495ecda..4f487bc 100755 --- a/src/pages/home/index.scss +++ b/src/pages/home/index.scss @@ -3,6 +3,9 @@ } page { .sp-page { + .sp-loading { + margin-top: 100px; + } // &.has-navbar { // padding-top: 0 !important; // } @@ -69,6 +72,7 @@ page { height: calc(100vh - #{$page-ipx-footer-height} - var(--status-bar-height)); // 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)); } @@ -152,7 +156,7 @@ page { .shop-box { height: 520px; width: 100%; - padding: 30px 50px 40px; + padding: 30px 50px 20px; box-sizing: border-box; // background-color: aquamarine; transition: height 0.2s linear 0.2s; @@ -164,6 +168,7 @@ page { display: inline-block; width: 310px; margin-right: 30px; + // animation: fadeInAnimation 0.35s ease-in; &:last-child { margin-right: 0; } @@ -231,3 +236,11 @@ page { } } } +@keyframes fadeInAnimation { + from { + opacity: 0; + } + to { + opacity: 1; + } +} diff --git a/src/pages/index.js b/src/pages/index.js index cdecd71..2063dce 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -57,6 +57,7 @@ const initialState = { fixedTop: false, filterWgts: [], isShowHomeHeader: false, + swiperList: [], list: [ { type: 'image', @@ -100,7 +101,8 @@ const initialState = { goods_id: 6, pic: 'https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/image/1/2024/01/15/46fe6ca52277038e39ee2c026a4af3c90XruENsSSAhRiz0HPI3PjR8XQNVgbxHb' }, - ] + ], + goodList: [] } function Home () { @@ -119,7 +121,7 @@ function Home () { const { location } = useSelector((state) => state.user) const { setNavigationBarTitle } = useNavigation() - const { wgts, loading, searchComp, pageData, fixedTop, filterWgts, isShowHomeHeader, isUpOperation, showRecommend, shopList } = state + const { wgts, loading, searchComp, pageData, fixedTop, filterWgts, isShowHomeHeader, isUpOperation, showRecommend, shopList, swiperList, goodList } = state const dispatch = useDispatch() @@ -127,6 +129,7 @@ function Home () { if (initState) { init() setNavigationBarTitle(appName) + getSwiperList() } }, [initState]) @@ -168,8 +171,6 @@ function Home () { if (dtid && !('dtid' in params)) { params = Object.assign(params, { dtid }) } - - console.log('useShareTimeline params:', params) return { title: title, imageUrl: imageUrl, @@ -187,6 +188,33 @@ function Home () { } } + const getSwiperList = async () => { + const res = await api.shop.homeSwiperList({ page: 1, pageSize: 999 }) + const list = res?.list?.map((item) => { + return { + type: item.type || 'image', + src: item.pic, + goods: (item.goods_info_detail || []).map((ite) => { + return { + itemName: ite.item_name, + price: ite.price, + goods_id: ite.item_id, + itemId: ite.item_id, + pic: ite.pics?.[0], + brief: ite.brief, + price: ite.price, + spec_images: ite.spec_images || [], + tagList: ite.tagList || [] + } + }) + } + }) || [] + setState((draft) => { + draft.swiperList = list + draft.goodList = list[0].goods || [] + }) + } + const fetchWgts = async () => { setState((draft) => { draft.wgts = [] @@ -302,8 +330,10 @@ function Home () { } } const onSwiperChange = (e) => { + const { current } = e.detail setState((draft) => { - draft.currentIndex = e.detail.current + draft.currentIndex = current + draft.goodList = swiperList[current].goods || [] }) } @@ -314,6 +344,7 @@ function Home () { }) } + return ( - {state.list.map((item, index) => ( + {state.swiperList.map((item, index) => ( {item.type === "image" && ( {!isUpOperation && - {state.list.map((_, index) => ( + {swiperList.map((_, index) => ( ))} } @@ -433,9 +464,9 @@ function Home () { } - {isUpOperation && - {shopList.map((item, idx) => ( - + {isUpOperation && + {goodList.map((item, idx) => ( + {} } = props - console.log(info) +function CompCouponList (props) { + const { info, onClick = () => { } } = props const onChangeLogin = () => { Taro.navigateTo({ url: `/subpage/pages/vip/vipgrades?grade_name=${info.vipgrade_name}` diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 84ea10b..5503fb0 100755 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -97,6 +97,12 @@ const initialState = { showSaleTotal: false, showSku: true, isOpen: false, + historyList: [], + historyTotal: 0, + selSkuImg: '', + swiperList: [], + selColorIdx: 0, + introList: [] } function EspierDetail (props) { @@ -137,7 +143,12 @@ function EspierDetail (props) { recommendList, showSaleTotal, showSku, - isOpen + isOpen, + historyList, + selSkuImg, + swiperList, + selColorIdx, + introList } = state useEffect(() => { @@ -154,8 +165,8 @@ function EspierDetail (props) { useEffect(() => { if (id) { fetch() - getPackageList() - getEvaluationList() + // getPackageList() + // getEvaluationList() } }, [id]) @@ -216,15 +227,16 @@ function EspierDetail (props) { } const init = async () => { - const { type, id, dtid } = await entryLaunch.getRouteParams() - console.log("🚀 ~ type, id, dtid :", type, id, dtid) + const pams = await entryLaunch.getRouteParams() + const { type, id, dtid, idx = 0 } = pams setState((draft) => { draft.id = id draft.type = type draft.dtid = dtid + draft.selColorIdx = +idx }) if (S.getAuthToken()) { - await dispatch(fetchUserFavs()) + dispatch(fetchUserFavs()) } } @@ -244,21 +256,29 @@ function EspierDetail (props) { draft.defaultMsg = '商品已下架' }) } + if (selColorIdx != 0) { + const spec_values = data.itemSpecDesc?.[0]?.spec_values || [] + if (spec_values.length) { + const item = spec_values[selColorIdx] + setTimeout(() => { + skuSelectRef.current?.handleSelectSku({ specId: item.spec_value_id, specValueId: item.spec_value_id }, selColorIdx) + }, 100) + } + } } catch (e) { setState((draft) => { draft.isDefault = true draft.defaultMsg = e.res.data.data.message }) - console.log(e.res) } } // 是否订阅 const { user_id: subscribe = false } = await api.user.isSubscribeGoods(id, { distributor_id: dtid }) - setNavigationBarTitle(data?.itemName) + // setNavigationBarTitle(data?.itemName) - console.log(ACTIVITY_LIST[data.activityType]) + // console.log(ACTIVITY_LIST[data.activityType]) if (ACTIVITY_LIST[data.activityType]) { Taro.setNavigationBarColor({ frontColor: '#ffffff', @@ -269,11 +289,18 @@ function EspierDetail (props) { } }) } + console.log("🚀 ~ data.introList:", data.introList) setState((draft) => { draft.info = { ...data, - subscribe + subscribe, } + draft.introList = (data.introList || []).map((item) => { + return { + ...item, + isOpen: false + } + }) draft.promotionActivity = data.promotionActivity }) @@ -298,6 +325,15 @@ function EspierDetail (props) { if (openRecommend == 1) { getRecommendList() // 猜你喜欢 } + + api.member.itemHistorySave(data.itemId) + + const res = await api.member.itemHistory() + setState((draft) => { + draft.historyList = res.list.filter((item) => item.item_id !== data.itemId).map((item) => ({ ...item.itemData, pic: item.itemData.pics?.[0] || '' })) + draft.historyTotal = res.total_count + }) + } const getRecommendList = async () => { @@ -376,6 +412,12 @@ function EspierDetail (props) { }) } + const onChangeImg = (img) => { + setState((draft) => { + draft.selSkuImg = img || '' + }) + } + return ( - {console.log('info', info)} - {info.imgs.map((img, idx) => ( + {(info.imgs || swiperList).map((img, idx) => ( {false && ( )} diff --git a/src/pages/item/espier-detail.scss b/src/pages/item/espier-detail.scss index c89fc1f..2628d20 100755 --- a/src/pages/item/espier-detail.scss +++ b/src/pages/item/espier-detail.scss @@ -3,7 +3,7 @@ position: relative; } .goods-swiper { - height: 900px; + // height: 900px; } .video-container { position: absolute; @@ -128,10 +128,10 @@ border-bottom: 1px solid #9e9e9e80; position: sticky; z-index: 2; - top: -1px; + top: 0px; left: 0; right: 0; - width: 100%; + padding-bottom: 2px; background-color: #fff; .desc-title { font-size: 26px; diff --git a/src/pages/item/list.js b/src/pages/item/list.js index 9cfa78a..e8e22ee 100755 --- a/src/pages/item/list.js +++ b/src/pages/item/list.js @@ -151,7 +151,6 @@ function ItemList () { const fetch = async ({ pageIndex, pageSize }) => { // card_id: 兑换券id // const { cat_id, main_cat_id, tag_id, card_id } = $instance.router.params - console.log(shopInfo) let params = { page: pageIndex, pageSize, @@ -161,19 +160,23 @@ function ItemList () { item_type: 'normal', is_point: 'false', tag_id, - card_id + card_id, + goodsSort: 6 } - if (curFilterIdx == 1) { - // 销量 - params['goodsSort'] = 1 - } else if (curFilterIdx == 2) { - // 价格升序 - params['goodsSort'] = 3 - } else if (curFilterIdx == 3) { - // 价格降序 - params['goodsSort'] = 2 + if (curFilterIdx) { + params['goodsSort'] = curFilterIdx } + // if (curFilterIdx == 1) { + // // 销量 + // params['goodsSort'] = 1 + // } else if (curFilterIdx == 2) { + // // 价格升序 + // params['goodsSort'] = 3 + // } else if (curFilterIdx == 3) { + // // 价格降序 + // params['goodsSort'] = 2 + // } if (curTagIdx) { params['tag_id'] = curTagIdx @@ -200,6 +203,7 @@ function ItemList () { 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) => { if (index % 2 == 0) { @@ -282,7 +286,7 @@ function ItemList () { } const handleFilterChange = async (e) => { - await setState((draft) => { + setState((draft) => { draft.leftList = [] draft.rightList = [] draft.curFilterIdx = e.current || 0 @@ -315,8 +319,9 @@ function ItemList () { goodsRef.current.reset() } - const handleClickStore = (item) => { - const url = `/subpages/store/index?id=${item.distributor_info.distributor_id}` + const handleClickStore = (item, idx) => { + // console.log("🚀 ~ item, idx:", item, idx) + const url = `/subpages/store/index?id=${item.distributor_info?.distributor_id}&idx=${idx}` Taro.navigateTo({ url }) @@ -329,7 +334,9 @@ function ItemList () { 'has-tagbar': tagList.length > 0 })} > - + {/* 兑换券选择店铺 */} {VERSION_STANDARD && card_id && ( )} (price/100).toFixed(2), price: ({ price, item_price }) => ((price || item_price) / 100).toFixed(2), // is_fav: ({ item_id }) => this.hasFav(item_id) @@ -128,7 +129,8 @@ export default class ItemFav extends Component { summary: 'summary', head_portrait: 'head_portrait', author: 'author', - item_type: 'item_type' + item_type: 'item_type', + fav_num: 'fav_num', }) total = res.total_count break @@ -353,8 +355,9 @@ export default class ItemFav extends Component { })} )} - {page.isLoading ? 正在加载... : null} - {!page.isLoading && !page.hasNext && !list.length && ( + {/* {page.isLoading ? 正在加载... : null} */} + {/* !page.isLoading && */} + {!page.hasNext && !list.length && ( 暂无数据~ )} diff --git a/src/pages/member/item-fav.scss b/src/pages/member/item-fav.scss index bc37415..1c12021 100755 --- a/src/pages/member/item-fav.scss +++ b/src/pages/member/item-fav.scss @@ -36,6 +36,15 @@ width: 40px; height: 42px; } + .icon-delete, + .icon-share { + &::before { + content: ' '; + display: block; + width: 18px; + height: 18px; + } + } .icon-share .option__text { background: url('../../assets/fenxiang-icon.png') no-repeat; background-size: 100% 100%; diff --git a/src/pages/recommend/list.config.js b/src/pages/recommend/list.config.js index eff87a1..bce635d 100755 --- a/src/pages/recommend/list.config.js +++ b/src/pages/recommend/list.config.js @@ -1,3 +1,3 @@ export default { - navigationBarTitleText: '文章' + navigationBarTitleText: '' } diff --git a/src/pages/recommend/list.js b/src/pages/recommend/list.js index ef63efd..90e60c7 100755 --- a/src/pages/recommend/list.js +++ b/src/pages/recommend/list.js @@ -48,7 +48,7 @@ export default class RecommendList extends Component { } } - componentDidMount() { + componentDidMount () { api.wx.shareSetting({ shareindex: 'planting' }).then((res) => { this.setState({ shareInfo: res @@ -56,7 +56,7 @@ export default class RecommendList extends Component { }) } - componentDidShow() { + componentDidShow () { const params = this.$instance.router.params if (params) { const { id, name } = params @@ -81,7 +81,7 @@ export default class RecommendList extends Component { // this.praiseNum() } - onShareAppMessage() { + onShareAppMessage () { const res = this.state.shareInfo const { userId } = Taro.getStorageSync('userinfo') const query = userId ? `/pages/recommend/list?uid=${userId}` : '/pages/recommend/list' @@ -92,7 +92,7 @@ export default class RecommendList extends Component { } } - onShareTimeline() { + onShareTimeline () { const res = this.state.shareInfo const { userId } = Taro.getStorageSync('userinfo') const query = userId ? `uid=${userId}` : '' @@ -103,7 +103,7 @@ export default class RecommendList extends Component { } } - async fetch(params) { + async fetch (params) { const { page_no: page, page_size: pageSize } = params const { columnList, areaList } = this.state let { selectColumn } = this.state @@ -349,11 +349,11 @@ export default class RecommendList extends Component { }) this.setState({ paramsList, - selectParams, + selectParams, }) this.resetColumn() } - + this.resetPage() this.setState( { @@ -365,15 +365,15 @@ export default class RecommendList extends Component { ) } - resetColumn(){ + resetColumn () { this.setState({ - selectColumn : Object.assign({}, { id: '', name: '全部', isChooseColumn: true }), - columnList : this.state.columnList.map((d,idx)=>{ + selectColumn: Object.assign({}, { id: '', name: '全部', isChooseColumn: true }), + columnList: this.state.columnList.map((d, idx) => { d.isChooseColumn = idx == 0 ? true : false return d }) }) - } + } // 选定开户地区 handleClickPicker = () => { @@ -529,7 +529,7 @@ export default class RecommendList extends Component { }) } - render() { + render () { const { list, showBackToTop, @@ -549,7 +549,7 @@ export default class RecommendList extends Component { let address = info.province + info.city return ( - }> + } className='has-nav' title="鞋床故事"> + className='zoom-btn icon-close iconfont' + onClick={this.handleRegionRefresh.bind(this)} + > // x ) : ( '' diff --git a/src/pages/recommend/list.scss b/src/pages/recommend/list.scss index 00b4bb8..cc0e9f4 100755 --- a/src/pages/recommend/list.scss +++ b/src/pages/recommend/list.scss @@ -1,8 +1,10 @@ -@import "../../style/imports"; - +@import '../../style/imports'; +.loading { + margin-top: 60px; +} .page-recommend-list { /* #ifdef alipay */ - .filter-bar{ + .filter-bar { position: absolute; width: 100%; z-index: 9999; @@ -12,14 +14,14 @@ .recommend-list { &__toolbar { position: fixed; - top: 0; + top: 0; left: 0; width: 100%; z-index: $z-index-level-4; background: #fff; box-shadow: $box-shadow; padding-top: 10px; - .icon-periscope{ + .icon-periscope { color: #ccc; display: inline-block; } @@ -31,7 +33,7 @@ /* #ifdef alipay */ padding: 20px 0; /* #endif */ - &__focus{ + &__focus { .at-search-bar { padding-right: 30px !important; } @@ -65,32 +67,36 @@ } &__tabs { display: flex; - + .filter-bar__item { flex: 1; justify-content: center; text-align: center; color: #666666; font-size: 26px; - .icon-menu,.icon-periscope { + .icon-menu, + .icon-periscope { color: #ccc; display: inline-block; font-size: 28px; - } - &.region-picker{ - display: flex; - line-height: 75rpx; - } - .icon-close{ - line-height: 75px; - } + } + &.region-picker { + display: flex; + line-height: 75rpx; + } + .icon-close { + line-height: 75px; + } } .filter-bar__item-active { color: $color-brand-primary; } } &__scroll { - @include page-scroll($tabs-height + $searchbar-height + $navigate-height + 10, $tabbar-height + floor($edge-margin / 2)); + @include page-scroll( + $tabs-height + $searchbar-height + $navigate-height + 10, + $tabbar-height + floor($edge-margin / 2) + ); top: 155px; } &__type-grid { @@ -163,16 +169,16 @@ } } } - .region-picker{ - display: flex; + .region-picker { + display: flex; justify-content: center; align-items: center; - line-height: 75rpx; - .icon-close{ + line-height: 75rpx; + .icon-close { margin-left: 10px; - line-height: 75px; - } - } + line-height: 75px; + } + } .sp-float-layout { .icon-guanbi { line-height: 1; diff --git a/src/subpage/pages/trade/detail.scss b/src/subpage/pages/trade/detail.scss index a62a1c9..75cde07 100755 --- a/src/subpage/pages/trade/detail.scss +++ b/src/subpage/pages/trade/detail.scss @@ -428,7 +428,7 @@ $paddingBottom: 100px; .left, .right { font-size: 20px; - color: #5b5b5b80; + color: #5b5b5b; line-height: 1; } } diff --git a/src/subpage/pages/trade/invoice-info.config.js b/src/subpage/pages/trade/invoice-info.config.js new file mode 100755 index 0000000..f925b93 --- /dev/null +++ b/src/subpage/pages/trade/invoice-info.config.js @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '开票信息', + navigationStyle: 'custom', +} diff --git a/src/subpage/pages/trade/invoice-info.js b/src/subpage/pages/trade/invoice-info.js new file mode 100755 index 0000000..233bd87 --- /dev/null +++ b/src/subpage/pages/trade/invoice-info.js @@ -0,0 +1,218 @@ +import Taro, { getCurrentInstance } from '@tarojs/taro' +import { View, Text, ScrollView, Input } from '@tarojs/components' +import _mapKeys from 'lodash/mapKeys' +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 './invoice-info.scss' +import { useImmer } from 'use-immer' + +const initState = { + formList: [ + { + name: '抬头类型', + type: 'checkbox', + key: 'invoice_title', + required: true, + }, + { + name: '发票抬头', + type: 'input', + key: 'invoice_title', + placeholder: '请填写抬头名称(必填)', + required: true, + }, + { + name: '邮箱地址', + type: 'input', + key: 'email', + placeholder: '用于接收电子发票(必填)', + required: true, + }, + { + name: '注册地址', + type: 'input', + key: 'addr', + placeholder: '(选填)', + }, + { + name: '注册电话', + type: 'input', + key: 'tel', + placeholder: '(选填)', + }, + { + name: '开户银行', + type: 'input', + key: 'yh', + placeholder: '(选填)', + }, + { + name: '银行账号', + type: 'input', + key: 'zh', + placeholder: '(选填)', + }, + ], + form: {}, + showModal: false, + visible: false, + showDetail: false +} +function InvoiceInfo (props) { + const [state, setState] = useImmer(initState) + const { formList, form, showModal, visible, showDetail } = state + + const onChangeItemCheck = () => { + + } + + const hadnleInput = (val, item) => { + const { key } = item + setState((draft) => { + draft.form[key] = val + }) + } + + const onPickerCancel = () => { + setState((draft) => { + draft.visible = false + }) + } + + return + + {showDetail && 共{0}张发票,含{1}个订单} + + 发票类型 + + 电子发票 + {showDetail ? + 查看 + + : 一键授权微信发票} + + + {showDetail && + 发票状态 + + 已申请 + + } + + 发票金额 + + ¥9999 + + + {formList.map((item) => + {item.name} + {showDetail ? {form[item.key] || '测试'} : <>{item.type === 'checkbox' && + + onChangeItemCheck()} > + 个人/非企业单位 + + + + + 企业 + + + } + {item.type === 'input' && hadnleInput(e.target.value, item)} className='ipt' placeholderClass='ipt-placeholder' placeholder={item.placeholder}>}} + )} + {!showDetail && + 温馨提示 + + 1、应国家税务总局要求,您若开具增值税普通发票,须同时提供 + 企业抬头及纳税人识别号,否则发票将无法用于企业报销; + + 2、发票将由订单所属城市的公司为您开具; + + 3、配合国家税务总局推进全面数字化的电子发票,部分城市已转 + 为全电发票,发票处理时长为1-3个工作日,请耐心等待。 + + } + + + setState((draft) => { + draft.visible = true + })} className={classNames("btn", { "btn-disabled": true })}>提交申请 + + + + + + + {showDetail ? '确定邮箱地址' : '开具电子发票'} + + + + {!showDetail && <> + + 发票类型 + 电子发票 + + + 抬头类型 + 电子发票 + + + 发票抬头 + 电子发票 + + } + + 邮箱地址 + 电子发票 + + setState((draft) => { + draft.visible = false + draft.showModal = true + })} className={classNames("btn", { "notop": showDetail })}>提交申请 + + + + + 已超重开发票时限 + 不可操作重开发票 + + + setState((draft) => { + draft.showModal = false + })} + onCancel={() => setState((draft) => { + draft.showModal = false + })} + onConfirm={() => { + setState((draft) => { + draft.showModal = false + }) + navigateTo('/subpage/pages/trade/invoice-record') + }} + content='发票申请提交成功' + /> + +} + +export default InvoiceInfo diff --git a/src/subpage/pages/trade/invoice-info.scss b/src/subpage/pages/trade/invoice-info.scss new file mode 100755 index 0000000..2ce3a1c --- /dev/null +++ b/src/subpage/pages/trade/invoice-info.scss @@ -0,0 +1,241 @@ +@import '@/style/imports'; + +.page-invoice-info { + .info-bd { + margin: 10px 50px 60px; + padding-top: 10px; + &-tips { + color: #8e8e8e; + font-size: 20px; + text-align: center; + margin-bottom: 12px; + } + } + .info-item { + display: flex; + align-items: center; + color: #808080; + background: #e5e5e5; + border-radius: 6px; + margin-bottom: 2px; + padding-right: 40px; + box-sizing: border-box; + .tit { + color: #808080; + font-size: 26px; + line-height: 1; + padding: 28px 50px 28px 30px; + box-sizing: border-box; + } + .content { + display: flex; + flex: 1; + justify-content: space-between; + align-items: center; + font-size: 26px; + line-height: 1; + color: #000; + &-item { + display: flex; + align-items: center; + color: #808080; + font-size: 26px; + min-width: 120px; + .sp-checkbox-new__label { + font-size: 26px; + } + } + .sq { + font-size: 20px; + line-height: 1; + border-bottom: 1px solid #000; + } + .flex { + display: flex; + align-items: center; + .ck { + font-size: 26px; + color: #163586; + margin-right: 2px; + } + } + } + .ipt { + display: flex; + flex: 1; + font-size: 26px; + line-height: 1; + color: #000; + padding-right: 40px; + box-sizing: border-box; + &-placeholder { + color: #808080; + } + } + } + .tips { + padding: 60px 40px 40px; + view, + text { + font-size: 20px; + color: #999; + } + } + .bottom { + position: fixed; + bottom: 90px; + left: 0; + right: 0; + width: 100%; + .btn { + &-disabled { + background: #666; + } + } + } + .at-modal { + &__overlay { + background-color: rgba(0, 0, 0, 0.6); + } + &__container { + width: 560px; + border-radius: 10px; + } + &__header { + display: none; + } + &__content { + padding: 70px 80px 50px; + text-align: center; + min-height: auto; + display: flex; + .content-simple { + font-size: 30px; + } + } + .at-modal__footer--simple .at-modal__action > button:last-child:nth-child(2) { + color: #222; + } + } + .sp-picker { + .mask { + position: fixed; + z-index: 2; + top: 0; + right: 0; + left: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + visibility: hidden; + opacity: 0; + transition: all 0.3s ease; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + color: #fff; + &.visible { + visibility: visible; + opacity: 1; + } + } + &-cnt { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + transition: all 0.3s ease-in-out; + transform: translateY(100%); + z-index: 13; + background-color: #fff; + border-radius: 30rpx 30rpx 0 0; + &.visible { + transform: translateY(0); + } + } + &-hd { + padding: 30px 50px; + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: none; + position: relative; + font-size: 26px; + .center { + margin: auto; + } + .at-icon-close { + padding: 20px 30px; + position: absolute; + right: 20px; + } + } + &-bd { + padding-bottom: 90px; + &-item { + display: flex; + align-items: center; + border-bottom: none; + padding: 0 90px; + view { + color: #000; + font-size: 26px; + line-height: 1; + } + .tit { + padding: 28px 50px 28px 30px; + box-sizing: border-box; + } + .content { + display: flex; + flex: 1; + color: #000; + } + } + .btn { + margin-top: 60px; + } + } + } + .btn { + margin: 0 50px; + display: flex; + height: 80px; + align-items: center; + justify-content: center; + font-size: 32px; + line-height: 1; + background: #000; + color: #fff; + border-radius: 6px; + &.notop { + margin-top: 10px; + } + } + .toast { + position: fixed; + z-index: 2; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + opacity: 0; + visibility: hidden; + transition: all 0.3s ease; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + width: 400px; + height: 120px; + background: #666; + color: #fff; + border-radius: 10px; + view { + font-size: 30px; + } + &.visible { + visibility: visible; + opacity: 1; + } + } +} diff --git a/src/subpage/pages/trade/invoice-list.js b/src/subpage/pages/trade/invoice-list.js index 722ac0d..3c03529 100755 --- a/src/subpage/pages/trade/invoice-list.js +++ b/src/subpage/pages/trade/invoice-list.js @@ -2,11 +2,11 @@ import React, { Component } from 'react' import Taro, { getCurrentInstance } from '@tarojs/taro' import { View, Text, ScrollView } from '@tarojs/components' import _mapKeys from 'lodash/mapKeys' -import { Loading, SpNote, SpPage } from '@/components' +import { Loading, SpNote, SpPage, SpPrice, SpCheckboxNew } from '@/components' import api from '@/api' import { withPager, withLogin } from '@/hocs' import { log, pickBy, resolveOrderStatus, authSetting } from '@/utils' -import TradeItem from './comps/item' +// import TradeItem from './comps/item' import './invoice-list.scss' @@ -65,7 +65,7 @@ export default class InvoiceList extends Component { log.debug('[trade list] list fetched and processed: ', nList) this.setState({ - list: [...this.state.list, ...nList] + list: [...this.state.list, ...nList, {}, {}, {}, {}, {}, {}, {}, {}] }) return { total } @@ -127,6 +127,9 @@ export default class InvoiceList extends Component { ) } } + onChangeItemCheck = (item) => { + console.log(item, 'ckeck点击') + } render () { const { list, page } = this.state @@ -136,23 +139,52 @@ export default class InvoiceList extends Component { {/* */} - {list.map((item) => { + {list.map((item, idx) => { return ( - - 已开票 + // + // 已开票 + // + // } + // /> + + + + {idx + 1}开票金额: + - } - /> + 订单编号:{item.tid} + 下单时间:{item.create_date} + + ) })} + {!page.isLoading && list?.length && + + 已选{1}个订单,共计 + + + 开票金额以实际为准 + + + + 本页全选 + 下一步 + + } {/*下载*/} {page.isLoading && 正在加载...} {!page.isLoading && !page.hasNext && !list.length && ( - 赶快去添加吧~ + 已完成订单为空~ )} diff --git a/src/subpage/pages/trade/invoice-list.scss b/src/subpage/pages/trade/invoice-list.scss index 835d0e9..61f2053 100755 --- a/src/subpage/pages/trade/invoice-list.scss +++ b/src/subpage/pages/trade/invoice-list.scss @@ -4,10 +4,92 @@ .page-invoice-list { .trade-list { &__scroll { - @include page-scroll($tabs-height + $navigate-height + 10px, 0); + // @include page-scroll($tabs-height + $navigate-height + 10px, 0); + @include page-scroll(var(--nav-height), 140px); + padding-top: 20px; + padding-bottom: 210px; + } + } + .invoice-item { + margin: 20px; + margin-top: 0; + padding: 50px 30px; + box-sizing: border-box; + background: #f7f7f7; + border-radius: 6px; + display: flex; + align-items: center; + .right { + display: flex; + flex-direction: column; + margin-left: 10px; + &-item { + color: #000; + margin-bottom: 20px; + line-height: 1; + } + &-item:last-child { + margin-bottom: 0; + } + } + } + .bottom { + position: fixed; + bottom: 0; + left: 0; + right: 0; + width: 100%; + &-line { + width: 100%; + padding: 16px 36px 16px 50px; + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + background: #999; + color: #fff; + .left { + display: flex; + align-items: center; + font-size: 20px; + line-height: 1; + .sp-price__symbol, + .sp-price__int { + color: #fff; + margin-right: 0 !important; + } + } + .right { + font-size: 20px; + line-height: 1; + } + } + &-wrap { + width: 100%; + padding: 10px 36px 50px 50px; + display: flex; + align-items: center; + box-sizing: border-box; + background: #fff; + } + &-txt { + margin-left: 20px; + line-height: 1; + } + &-btn { + margin-left: auto; + display: flex; + width: 300px; + height: 80px; + align-items: center; + justify-content: center; + font-size: 32px; + line-height: 1; + background: #000; + color: #fff; + border-radius: 6px; } } - .trade-item { &__ft { flex: 1; diff --git a/src/subpage/pages/trade/invoice-record.config.js b/src/subpage/pages/trade/invoice-record.config.js new file mode 100755 index 0000000..f674678 --- /dev/null +++ b/src/subpage/pages/trade/invoice-record.config.js @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: ' ', + navigationStyle: 'custom', +} diff --git a/src/subpage/pages/trade/invoice-record.js b/src/subpage/pages/trade/invoice-record.js new file mode 100755 index 0000000..d1cd1da --- /dev/null +++ b/src/subpage/pages/trade/invoice-record.js @@ -0,0 +1,163 @@ +import React, { Component } from 'react' +import Taro, { getCurrentInstance } from '@tarojs/taro' +import { View, Text, ScrollView } from '@tarojs/components' +import _mapKeys from 'lodash/mapKeys' +import { Loading, SpNote, SpPage, SpPrice, SpCheckboxNew } from '@/components' +import api from '@/api' +import { withPager, withLogin } from '@/hocs' +import { log, pickBy, resolveOrderStatus, authSetting } from '@/utils' +import { AtIcon } from 'taro-ui' + +import './invoice-record.scss' + +@withPager +@withLogin() +export default class InvoiceList extends Component { + constructor(props) { + super(props) + + this.state = { + ...this.state, + list: [] + } + } + + componentDidMount () { + this.nextPage() + } + + componentWillUnmount () { } + + async fetch (params) { + params = _mapKeys( + { + ...params + }, + function (val, key) { + if (key === 'page_no') return 'page' + if (key === 'page_size') return 'pageSize' + return key + } + ) + + const { list, total_count: total } = await api.trade.involiceList(params) + let nList = pickBy(list, { + tid: 'order_id', + status_desc: 'order_status_msg', + status: ({ order_status }) => resolveOrderStatus(order_status), + totalItems: ({ items }) => items.reduce((acc, item) => +item.num + acc, 0), + payment: ({ total_fee }) => (total_fee / 100).toFixed(2), + pay_type: 'pay_type', + point: 'point', + create_date: 'create_date', + order: ({ items }) => + pickBy(items, { + order_id: 'order_id', + item_id: 'item_id', + pic_path: 'pic', + title: 'item_name', + price: ({ item_fee }) => (+item_fee / 100).toFixed(2), + point: 'item_point', + num: 'num' + }) + }) + + log.debug('[trade list] list fetched and processed: ', nList) + + this.setState({ + list: [...this.state.list, ...nList, {}, {}, {}, {}, {}, {}, {}, {}] + }) + + return { total } + } + + handleClickItem = (trade) => { + const { tid } = trade + + Taro.navigateTo({ + url: `/subpage/pages/trade/detail?id=${tid}` + }) + } + + handleClickItemBtn = async (type, trade) => { + const params = { ...trade } + // console.log(trade, 84) + switch (type) { + case 'add-card': + await Taro.addCard(params) + break + case 'open-card': + await Taro.openCard(params) + break + } + } + + handleClickBtn = async (type) => { + if (type === 'add-card') { + const showErr = (title = '下载失败') => { + return Taro.showToast({ + icon: 'none', + title + }) + } + authSetting( + 'writePhotosAlbum', + async () => { + const { tempFilePath } = await Taro.downloadFile({ + url: 'http://mmbiz.qpic.cn/mmbiz_png/1nDJByqmW2drJSibeWL0bEib2rj4OxG6ep2Y8VggMzP2pSSHVGNW3eIEy9BUiaMfxD4MrWUQ2oVaNEZs4VfQg8tSw/0?wx_fmt=png' + }) + + try { + await Taro.saveImageToPhotosAlbum({ + filePath: tempFilePath + }) + Taro.showToast({ + icon: 'success', + title: '成功保存照片' + }) + } catch (e) { + console.log(e) + } + + // this.handleClickLayer() + }, + () => { + showErr() + } + ) + } + } + onChangeItemCheck = (item) => { + console.log(item, 'ckeck点击') + } + + render () { + const { list, page } = this.state + + return ( + + + {list.map((item, idx) => { + return ( + + + {idx + 1}发票金额: + + + 发票类型:电子发票 + 抬头类型:{item.create_date} + 申请时间:{item.create_date || '2023-12-18 10:10'} + + + 已申请 + + + + ) + })} + {page.isLoading && 正在加载...} + + + ) + } +} diff --git a/src/subpage/pages/trade/invoice-record.scss b/src/subpage/pages/trade/invoice-record.scss new file mode 100755 index 0000000..f4679ca --- /dev/null +++ b/src/subpage/pages/trade/invoice-record.scss @@ -0,0 +1,113 @@ +@import '@/style/imports'; + +.page-invoice-info { + .trade-list { + &__scroll { + // @include page-scroll($tabs-height + $navigate-height + 10px, 0); + @include page-scroll(var(--nav-height), 140px); + padding-top: 20px; + padding-bottom: 210px; + } + } + .invoice-item { + margin: 0 20px 10px; + padding: 46px 36px 46px 50px; + box-sizing: border-box; + background: #f7f7f7; + border-radius: 6px; + display: flex; + align-items: center; + justify-content: space-between; + .right { + display: flex; + flex-direction: column; + margin-left: 10px; + &-item { + color: #000; + margin-bottom: 20px; + line-height: 1; + } + &-item:last-child { + margin-bottom: 0; + } + } + .status { + color: #888; + display: flex; + align-items: center; + .txt { + margin-right: 20px; + } + } + } + .bottom { + position: fixed; + bottom: 0; + left: 0; + right: 0; + width: 100%; + &-line { + width: 100%; + padding: 16px 36px 16px 50px; + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + background: #999; + color: #fff; + .left { + display: flex; + align-items: center; + font-size: 20px; + line-height: 1; + .sp-price__symbol, + .sp-price__int { + color: #fff; + margin-right: 0 !important; + } + } + .right { + font-size: 20px; + line-height: 1; + } + } + &-wrap { + width: 100%; + padding: 10px 36px 50px 50px; + display: flex; + align-items: center; + box-sizing: border-box; + background: #fff; + } + &-txt { + margin-left: 20px; + line-height: 1; + } + &-btn { + margin-left: auto; + display: flex; + width: 300px; + height: 80px; + align-items: center; + justify-content: center; + font-size: 32px; + line-height: 1; + background: #000; + color: #fff; + border-radius: 6px; + } + } + .trade-item { + &__ft { + flex: 1; + display: flex; + align-items: top; + justify-content: flex-end; + } + &__status { + font-size: $font-size-small; + color: #c1c1c1; + line-height: 40px; + } + } +} diff --git a/src/subpage/pages/trade/list.js b/src/subpage/pages/trade/list.js index e3fb789..c8e5b95 100755 --- a/src/subpage/pages/trade/list.js +++ b/src/subpage/pages/trade/list.js @@ -352,7 +352,7 @@ export default class TradeList extends Component { })} {page.isLoading && 正在加载...} {!page.isLoading && !page.hasNext && !list.length && ( - + 您的{curTabIdx != '0' ? tabList[curTabIdx].title : ''}订单为空 )} diff --git a/src/subpage/pages/trade/list.scss b/src/subpage/pages/trade/list.scss index f253850..41f3b92 100755 --- a/src/subpage/pages/trade/list.scss +++ b/src/subpage/pages/trade/list.scss @@ -23,7 +23,8 @@ } .trade-list { &__scroll { - @include page-scroll($navigate-height-h5, $edge-margin); + // @include page-scroll($navigate-height-h5, $edge-margin); + @include page-scroll(var(--nav-height), 40px); } } } diff --git a/src/subpages/auth/reg-rule.config.js b/src/subpages/auth/reg-rule.config.js index b1c6ea4..f674678 100755 --- a/src/subpages/auth/reg-rule.config.js +++ b/src/subpages/auth/reg-rule.config.js @@ -1 +1,4 @@ -export default {} +export default { + navigationBarTitleText: ' ', + navigationStyle: 'custom', +} diff --git a/src/subpages/auth/reg-rule.js b/src/subpages/auth/reg-rule.js index 603fe3d..e79e941 100755 --- a/src/subpages/auth/reg-rule.js +++ b/src/subpages/auth/reg-rule.js @@ -18,11 +18,11 @@ export default class RegRule extends Component { } } - componentDidMount() { + componentDidMount () { this.fetch() } - async fetch() { + async fetch () { let data = '' let navBarTitle = '协议' const { type } = this.$instance.router.params @@ -65,14 +65,16 @@ export default class RegRule extends Component { }) } - render() { + render () { const { info, title } = this.state return ( - - {info && ( - - )} - + + + {info && ( + + )} + + ) } } diff --git a/src/subpages/auth/reg-rule.scss b/src/subpages/auth/reg-rule.scss index 14e72ba..867dd18 100755 --- a/src/subpages/auth/reg-rule.scss +++ b/src/subpages/auth/reg-rule.scss @@ -2,5 +2,5 @@ padding: 30px; background: #fff; box-sizing: border-box; - height: 100vh; + height: calc(100vh - var(--nav-height) - 40px); } diff --git a/src/subpages/member/index.js b/src/subpages/member/index.js index f4bc09a..5aa3123 100755 --- a/src/subpages/member/index.js +++ b/src/subpages/member/index.js @@ -108,7 +108,7 @@ function MemberIndex (props) { // console.log('===>getCurrentPages==>', getCurrentPages(), getCurrentInstance()) const $instance = getCurrentInstance() const { isLogin, isNewUser, login, getUserInfoAuth } = useLogin({ - autoLogin: true, + autoLogin: false, // policyUpdateHook: (isUpdate) => { // // isUpdate && setPolicyModal(true) // if (isUpdate) { @@ -457,11 +457,13 @@ function MemberIndex (props) { > - + + + @@ -705,15 +707,15 @@ function MemberIndex (props) { - {state.isOpen && setState((draft) => { draft.isOpen = false })}> - - - + {state.isOpen && setState((draft) => { draft.isOpen = false })}> + + + 隐私政策 + scrollWithAnimation className="curtain-block_content_text" showScrollbar={false} enhanced> 亲爱的用户,感谢您使用Birkenstock微信小程序!为了加强对您个人信息的保护,我们根据最新法律的要求制定/更新了《隐私政策》,我们将基于合法以及正当必要的原则,按照本政策的规定向您提供各项服务 本政策旨在向您说明休迪贸易 (上海)有限公司及其在中国大陆境内的线上线下门店如何收集、使用、传输和保护您的个人信息 通过《隐私政策》,我们向您主要说明: diff --git a/src/subpages/member/index.scss b/src/subpages/member/index.scss index 547709f..bc900de 100755 --- a/src/subpages/member/index.scss +++ b/src/subpages/member/index.scss @@ -16,9 +16,10 @@ } .usericon { border: 4px solid #fff; + // border: none; width: 110px; height: 110px; - border-radius: 50px; + border-radius: 50%; margin-right: 20px; overflow: hidden; } @@ -322,7 +323,7 @@ } } } - .curtain { + .curtain-block { display: block; position: fixed; top: 0; diff --git a/src/subpages/member/user-info.js b/src/subpages/member/user-info.js index 2bd64b7..13f53f7 100755 --- a/src/subpages/member/user-info.js +++ b/src/subpages/member/user-info.js @@ -1,5 +1,5 @@ import React, { useEffect, useRef } from 'react' -import { useSelector } from 'react-redux' +import { useSelector, useDispatch } from 'react-redux' import { useImmer } from 'use-immer' import Taro from '@tarojs/taro' import { AtButton } from 'taro-ui' @@ -10,6 +10,7 @@ import { SG_POLICY } from '@/consts' import { classNames, showToast, formatTime, isWeixin, isWeb, pickBy } from '@/utils' import imgUploader from '@/utils/upload' import { View, Input, Picker, Button, Text, Checkbox } from '@tarojs/components' +import { updateUserInfo } from '@/store/slices/user' import './user-info.scss' const initialState = { @@ -30,6 +31,7 @@ const initialState = { function MemberUserInfo () { const [state, setState] = useImmer(initialState) + const dispatch = useDispatch() const { formItems, formUserInfo, @@ -49,7 +51,6 @@ function MemberUserInfo () { useEffect(() => { getFormItem() - fetchData() }, []) useEffect(() => { @@ -68,30 +69,32 @@ function MemberUserInfo () { label: 'label', children: 'children' }) - let arrProvice = [] - let arrCity = [] - let arrCounty = [] - _nList.map((item, index) => { - arrProvice.push(item.label) - if (index === 0) { - item.children.map((c_item, c_index) => { - arrCity.push(c_item.label) - if (c_index === 0) { - c_item.children.map((cny_item) => { - arrCounty.push(cny_item.label) - }) - } - }) - } - }) - setState((draft) => { - draft.nList = _nList - draft.areaList = [arrProvice, arrCity, arrCounty] - // draft.multiIndex = [0, 0, 0] - }) + // let arrProvice = [] + // let arrCity = [] + // let arrCounty = [] + // _nList.map((item, index) => { + // arrProvice.push(item.label) + // if (index === 0) { + // item.children.map((c_item, c_index) => { + // arrCity.push(c_item.label) + // if (c_index === 0) { + // c_item.children.map((cny_item) => { + // arrCounty.push(cny_item.label) + // }) + // } + // }) + // } + // }) + // setState((draft) => { + // draft.nList = _nList + // draft.areaList = [arrProvice, arrCity, arrCounty] + // // draft.multiIndex = [0, 0, 0] + // }) + return _nList } const getFormItem = async () => { + const _areaList = await fetchData() const data = await api.user.regParam({ is_edite_page: true }) @@ -111,7 +114,6 @@ function MemberUserInfo () { } Object.keys(data).forEach((key, i) => { const value = custom_data[key] || userInfo[key] - console.log("🚀 ~ key:", key, formSort[key]) if (data[key].is_open) { // if (key !== 'mobile' && key !== 'username') { // } @@ -132,10 +134,52 @@ function MemberUserInfo () { } }) _formItems.push({ name: "居住城市", required_message: "请输入居住城市", key: "city", element_type: "area", field_type: 7, placeholder: "请选择居住城市", range: [], sort: 999 }) - console.log("🚀 ~ _formItems:", _formItems) + const { life_province, life_city, life_county } = userInfo + _formUserInfo.life_province = life_province + _formUserInfo.life_city = life_city + _formUserInfo.life_county = life_county + // _formUserInfo.multiIndex = userInfo.multiIndex || [0, 0, 0] + let _multiIndex = [0, 0, 0] + let arrProvice = [] + let arrCity = [] + let arrCounty = [] + _areaList.forEach((item, index) => { + arrProvice.push(item.label) + if (life_province && life_city && life_county) { + if (item.label === life_province) { + _multiIndex[0] = index + item.children.map((s_item, sIndex) => { + arrCity.push(s_item.label) + if (s_item.label === life_city) { + _multiIndex[1] = sIndex + s_item.children.map((th_item, thIndex) => { + arrCounty.push(th_item.label) + if (th_item.label === life_county) { + _multiIndex[2] = thIndex + } + }) + } + }) + } + } else { + if (index === 0) { + item.children.map((c_item, c_index) => { + arrCity.push(c_item.label) + if (c_index === 0) { + c_item.children.map((cny_item) => { + arrCounty.push(cny_item.label) + }) + } + }) + } + } + }) setState((draft) => { + draft.nList = _areaList draft.formItems = _formItems.sort((a, b) => a.sort - b.sort) draft.formUserInfo = _formUserInfo + draft.areaList = [arrProvice, arrCity, arrCounty] + draft.multiIndex = _multiIndex }) } @@ -186,12 +230,14 @@ function MemberUserInfo () { } const renderDatePicker = ({ key, required_message }) => { + const disabled = key === 'birthday' && !userInfo.birthday_can_edit return ( - + {formUserInfo[key] || required_message} @@ -278,9 +324,11 @@ function MemberUserInfo () { }) } }) + const { province: life_province, city: life_city, county: life_county } = _info setState((draft) => { draft.multiIndex = e.detail.value draft.info = _info + draft.formUserInfo = { ...draft.formUserInfo, life_province, life_city, life_county, multiIndex } }) } @@ -342,7 +390,7 @@ function MemberUserInfo () { value={multiIndex} range={areaList} > - + 0 ? '#000' : '#a5a5a5' }}> {info.address_id ? ( `${info.province}-${info.city}-${info.county}` ) : ( @@ -380,16 +428,19 @@ function MemberUserInfo () { const { avatar, username } = formUserInfo await api.member.updateMemberInfo({ username, - avatar + avatar, + ...formUserInfo }) await api.member.setMemberInfo({ - ...formUserInfo + ...formUserInfo, }) showToast('修改成功') await getUserInfo(true) + let memberRes = await api.member.memberInfo() + dispatch(updateUserInfo(memberRes)) setTimeout(() => { Taro.navigateBack() - }, 200) + }, 300) } const handleLogOff = async () => { @@ -469,7 +520,7 @@ function MemberUserInfo () { if (isWeixin) { return ( ) } else { @@ -513,7 +564,7 @@ function MemberUserInfo () { onInput={onChangeUsername} onConfirm={onChangeUsername} /> : renderFormItem(item)} - {(item.element_type === 'select' || item.element_type === 'date') && } + {(item.element_type === 'select' || item.element_type === 'date') && } )}