main
王文龙 2024-02-01 10:52:06 +08:00
parent 3621def2f5
commit 82a04ee96f
63 changed files with 1957 additions and 510 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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')
}
}
// 获取首页轮播图
export function homeSwiperList (params) {
return req.get('/xiudibanner', params)
}

View File

@ -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', //二维码购买页

View File

@ -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;

View File

@ -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 (
<View className='address-picker'>
<View className='address' onClick={this.clickTo.bind(this, 'choose')}>
<View className='address'>
{isObjectsValue(isAddress) ? (
<View className='address-picker__bd'>
<View className='address-receive'>
<View className='info-trade'>
<View className='address-area'>
{/* <View className='address-area'>
{isAddress.is_def && <View className='def'>默认</View>}
{isAddress.province}
{isAddress.city}
{isAddress.county}
</View> */}
<View className="dz-addr">
<Text>收货地址</Text>
<Text className='bj' onClick={this.clickTo.bind(this, 'choose')}>编辑</Text>
</View>
<View className='address-detail'>{isAddress.adrdetail}</View>
<View className='user-info-trade'>
<Text className='name'>{isAddress.username}</Text>
<Text>{isAddress.telephone}</Text>
</View>
<View className='address-detail'> {isAddress.province}
{isAddress.city}
{isAddress.county}{isAddress.adrdetail}</View>
</View>
</View>
<View className='sp-cell__ft-icon iconfont icon-arrowRight'></View>
{/* <View className='sp-cell__ft-icon iconfont icon-arrowRight'></View> */}
</View>
) : (
<View className='address-info__bd'>+请选择收货地址</View>

View File

@ -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;
}

View File

@ -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;

View File

@ -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) {

View File

@ -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 (
<View className={classNames('sp-filter-bar', className)}>
@ -95,7 +95,7 @@ export default class SpFilterBar extends Component {
<AtIcon value='menu' size='16' color='#000'></AtIcon>
</View>
</SpPicker>
<SpPicker mode="select" source={list} value={value} pickerConfirm={this.handleConfirm.bind(this)} leftBtnTxt="排序" rightBtnTxt={<AtIcon value="close" size={14} color="#000"></AtIcon>}>
<SpPicker mode="select" source={list} value={sortVal} pickerConfirm={this.handleConfirm.bind(this)} leftBtnTxt="排序" rightBtnTxt={<AtIcon value="close" size={14} color="#000"></AtIcon>}>
<View className="item item-right">
<Text className='text'>排序</Text>
<Image className="img" src={require('@/assets/icon/sort.png')}></Image>

View File

@ -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 (
<View className='sp-goods-cell'>
<View className='goods-item-hd'>
<SpImage mode='aspectFit' src={info.img} width={180} height={180} />
</View>
<View className='goods-item-bd'>
<View className='item-hd'>
<View className='goods-title'>{info.itemName}</View>
<>
<View className='sp-goods-cell'>
<View className='goods-item-hd'>
<SpImage mode='aspectFit' src={info.img} width={150} height={150} />
</View>
<View className='item-bd'>
<View>
{/* 多规格商品 */}
{!info.nospec && (
<View className='goods-sku' onClick={handleClick}>
{onSelectSku && (
<View className='spec-text'>
{info.specText || '选择规格'}
<Text className='iconfont icon-qianwang-01'></Text>
</View>
)}
{!onSelectSku && info.itemSpecDesc}
<View className='goods-item-bd'>
<View className='item-hd'>
<View className='goods-title'>{info.itemName}</View>
</View>
<View className='item-bd'>
<View>
{/* 多规格商品 */}
{!info.nospec && (
<View className='goods-sku' onClick={handleClick}>
{onSelectSku && (
<View className='spec-text'>
{desc_info || info.specText || '选择规格'}
<Text className='iconfont icon-qianwang-01'></Text>
</View>
)}
{!onSelectSku && (desc_info || info.itemSpecDesc)}
</View>
)}
</View>
</View>
<View className='labels-block'>
{!isNaN(memberPrice) && !VERSION_IN_PURCHASE && (
<View className='goods-type'>
{vipInfo?.isVip ? vipInfo?.grade_name : userInfo?.gradeInfo?.grade_name}
</View>
)}
</View>
</View>
<View className='labels-block'>
{!isNaN(memberPrice) && !VERSION_IN_PURCHASE && (
<View className='goods-type'>
{vipInfo?.isVip ? vipInfo?.grade_name : userInfo?.gradeInfo?.grade_name}
</View>
)}
{info?.orderItemType && info?.orderItemType != 'normal' && (
<View className='goods-type'>{GOODS_TYPE[info.orderItemType]}</View>
)}
{info.discount_info?.map((sp, idx) => {
if (sp.type != 'coupon_discount' && sp.type != 'member_price') {
return (
<View className='goods-type' key={`goods-type__${idx}`}>
{sp.info}
</View>
)
}
})}
{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 <View className='goods-type'>{limitTxt}</View>
})}
{/* {limitTxt && <View className='goods-type'>{limitTxt}</View>} */}
</View>
<View className='item-ft'>
<View className='price-gp'>
{isPoint && <SpPoint value={point} />}
{!isPoint && <SpPrice value={_price}></SpPrice>}
{info.marketPrice > 0 && (
<SpPrice
className='market-price'
size={28}
lineThrough
value={info.marketPrice}
></SpPrice>
{info?.orderItemType && info?.orderItemType != 'normal' && (
<View className='goods-type'>{GOODS_TYPE[info.orderItemType]}</View>
)}
{info.discount_info?.map((sp, idx) => {
if (sp.type != 'coupon_discount' && sp.type != 'member_price') {
return (
<View className='goods-type' key={`goods-type__${idx}`}>
{sp.info}
</View>
)
}
})}
{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 <View className='goods-type'>{limitTxt}</View>
})}
{/* {limitTxt && <View className='goods-type'>{limitTxt}</View>} */}
</View>
<View className='item-ft'>
{info.num && <Text className='item-num'>x {info.num}</Text>}
{info.num && <Text className='item-num'>数量{info.num}</Text>}
</View>
</View>
</View>
</View>
<View className='price-gp'>
{isPoint && <SpPoint value={point} />}
{!isPoint && <SpPrice value={_price} noDecimal={false} showSeparator ></SpPrice>}
{info.marketPrice > 0 && (
<SpPrice
className='market-price'
size={32}
lineThrough
value={info.marketPrice}
></SpPrice>
)}
</View>
</>
)
}

View File

@ -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;

View File

@ -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 (
<View className={classNames('sp-goods-item')} onClick={handleClick.bind(this)}>
<View className='goods-item__hd'>
<SpImage lazyLoad src={info.pic} height={height} width={width} mode={"scaleToFill"} />
<View className="new">NEW</View>
<SpImage lazyLoad src={selColorItem.item_image_url?.[0] || info.spec_images?.[0]?.item_image_url?.[0] || info.pic} height={height} width={width} mode={"scaleToFill"} />
{info.tagList.map((item, index) => <View className="new" style={{ borderColor: item.tag_color, color: item.font_color, left: index === 0 ? '20rpx' : index * 30 + 8 + 'rpx' }} key={index + item.item_id}>{item.tag_name}</View>)}
{/* <View className="new" style={{ left: '120rpx' }}>NEW</View> */}
</View>
{/* {renderBrand && <View className='goods-brand-wrap'>{renderBrand}</View>} */}
<View className='goods-item__bd'>
@ -124,26 +153,26 @@ function SpGoodsItem (props) {
)}
<View className='goods-info'>
<View className='goods-desc'>{info.brief}</View>
<View className='goods-title'>{info.itemName}</View>
<View className='goods-desc-text'>{info.item_name || info.itemName}</View>
<View className='goods-title'>{info.brief}</View>
{showSalePrice && <>
<View className="goods-price">
<Text className="symobol">¥</Text>
<Text className="price">{info.activityPrice || info.price}</Text>
</View>
<View className="switch-color" onClick={(e) => e.stopPropagation()}>
<Text className="icon-my icon-arrow" onClick={() => setMove(move > 1 ? move - 1 : 0)}></Text>
<Text className="icon-my icon-arrow" onClick={handleLeft}></Text>
<ScrollView onScroll={(e) => {
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) => (
<View className='color-item' style={{ transfor: `translateX(-${move * 32}px)` }} onClick={() => setCurrent(index)}>
<View className={`color${index == current ? ' active' : ''}`} style={{ backgroundColor: item.color || '#000' }} key={`color__${index}`}></View>
{(info.spec_images || colors).map((item, index) => (
<View className='color-item' style={{ transform: `translateX(-${move * 32}px)` }} onClick={() => setSelColor(index, item)} key={`color__${index}`}>
<View className={`color${index == current ? ' active' : ''}`} style={{ backgroundColor: item.color_value || '#000' }}></View>
</View>
))}
</ScrollView>
<Text className="icon-my icon-arrow-right" onClick={() => setMove(move < (info.colors || colors).length - 2 ? move + 1 : move)}></Text>
<Text className="icon-my icon-arrow-right" onClick={handleRight}></Text>
</View>
</>}
</View>
@ -159,13 +188,13 @@ function SpGoodsItem (props) {
</View>
)}
<View className='bd-block'>
{false && <View className='bd-block'>
{/* 商品价格、积分 */}
{info.point && (
{/* {info.point && (
<View className='goods-point'>
<SpPoint value={info.point} />
</View>
)}
)} */}
{!info.point && showPrice && (
<View className='goods-price'>
@ -225,10 +254,10 @@ function SpGoodsItem (props) {
/>
</View>
)} */}
</View>
</View>}
{isShowStore && (
<View className='goods__store' onClick={() => onStoreClick(info)}>
<View className='goods__store' onClick={() => onStoreClick(info, current)}>
<SpImage
src={info.distributor_info.distributor_info || 'shop_default_logo.png'}
width={60}

View File

@ -2,7 +2,8 @@
background-color: #fff;
// border-radius: 4px;
overflow: hidden;
padding-bottom: 24px;
padding-bottom: 20px;
animation: fadeInAnimation 0.35s ease-in;
// background-color: #222;
.goods-item {
&__hd {
@ -11,6 +12,9 @@
align-items: center;
box-sizing: border-box;
position: relative;
image {
animation: fadeInAnimation 0.35s ease-in;
}
// padding-top: 100%;
// position: relative;
// .sp-image {
@ -39,7 +43,7 @@
}
&__bd {
border-radius: 0;
padding: 10px 16px 0;
padding: 20px 16px 0;
box-sizing: border-box;
.goods-info {
display: flex;
@ -49,7 +53,7 @@
margin: 0 auto;
line-height: 1;
.switch-color {
margin-top: 12px;
margin-top: 10px;
display: flex;
justify-content: center;
align-items: center;
@ -101,16 +105,22 @@
font-size: 16px;
color: #000;
// font-weight: bold;
margin: 12px auto;
padding: 10px 20px;
text-align: center;
width: 100%;
box-sizing: border-box;
line-height: 1;
@include multi-ellipsis(2);
// padding-top: 15px;
// padding: 15px;
}
.goods-desc {
.goods-desc-text {
font-size: 16px;
height: auto;
// color: $color-hint-text;
color: #000;
@include multi-ellipsis(2);
padding: 2px 0;
}
.goods-price {
font-weight: bold;
@ -203,3 +213,11 @@
}
}
}
@keyframes fadeInAnimation {
from {
opacity: 0;
}
to {
opacity: 1;
}
}

View File

@ -8,7 +8,7 @@ import AtComponent from './component'
import './index.scss'
// 实现两数相加并保留小数点后最短尾数
function addNum(num1, num2) {
function addNum (num1, num2) {
let sq1, sq2
try {
sq1 = _toString(num1).split('.')[1].length
@ -25,7 +25,7 @@ function addNum(num1, num2) {
}
// 格式化数字处理01变成1,并且不处理1. 这种情况
function parseValue(num) {
function parseValue (num) {
if (num === '') return '0'
const numStr = _toString(num)
@ -37,7 +37,7 @@ function parseValue(num) {
}
class AtInputNumber extends AtComponent {
handleClick(clickType) {
handleClick (clickType) {
const { disabled, value, min, max, step } = this.props
const lowThanMin = clickType === 'minus' && value <= min
const overThanMax = clickType === 'plus' && value >= 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

View File

@ -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;
}
}
}

View File

@ -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) {
{/* 授权登录 */}
<AtCurtain
className='curtain'
isOpened={loginModal}
onClose={() => {
setLoginModal(false)
}}
>
<View className='login-modal'>
{/* <View className='login-modal'>
<View className='login-modal__hd'>
<SpImage circle src={icon} width={120} height={120} />
<View className='nick-name'>{nickname}</View>
@ -232,6 +233,45 @@ function SpLogin(props, ref) {
登录
</AtButton>}
</View>
</View> */}
<View className="curtain_content">
<View className="curtain_content_title">
<SpImage src={`member/logo-black.png`} height={32} mode='heightFix' isNew />
<View className="">隐私政策</View>
</View>
<ScrollView scrollY
scrollWithAnimation className="curtain_content_text" showScrollbar={false} enhanced>
亲爱的用户,感谢您使用Birkenstock微信小程序!为了加强对您个人信息的保护,我们根据最新法律的要求制定/更新了
<View className="agreement-list">
<Text className='agreement-name' onClick={handleClickPrivacy.bind(this, 'member_register')}>{registerName}</Text>
<Text className='agreement-name' onClick={handleClickPrivacy.bind(this, 'privacy')}>{privacyName}</Text>
</View>,,
<View>
本政策旨在向您说明休迪贸易 (上海)有限公司及其在中国大陆境内的线上线下门店如何收集使用传输和保护您的个人信息
通过隐私政策,我们向您主要说明:
</View>
<View className="">
1.您在使用Birkenstock微信小程序时,可以选择浏览模式,也可以选择注册/登录成为Birkenstock微信小程序用户
</View>
<View className="">
2为了向你提供Birkenstock微信小程序的其本服条,我们将基于合法以及正当必要的原则,按照本政策的规定向您提供各项服务
</View>
</ScrollView>
<View className='btn-wrap'>
{isNewUser && <AtButton className='btn' type='primary' openType="getPhoneNumber" onGetPhoneNumber={(e) => {
setLoginModal(false)
handleBindPhone(e)
}}>
同意并继续
</AtButton>}
{!isNewUser && <AtButton className='btn' type='primary' onClick={handleUserLogin}>
同意并继续
</AtButton>}
</View>
<View className="no-btn" onClick={() => setLoginModal(false)}>不同意</View>
<View className="no-text">
*如果您不同意Birkenstock隐私政策您可继续浏览小程序但您无法使用购物结算功能
</View>
</View>
</AtCurtain>
</View>

View File

@ -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 (
<View className='sp-order-item' onClick={onClick}>
@ -72,7 +71,7 @@ function SpOrderItem (props) {
{info.order_item_type === 'gift' && (
<Text className='sp-order-item__title-tag'>赠品</Text>
)}
{info.title}
{title}
</View>
{showDesc && info.item_spec_desc && (
<Text className='sp-order-item__spec'>{info.item_spec_desc}</Text>

View File

@ -255,7 +255,7 @@ function SpPage (props, ref) {
}
renderTitle = showCustomNavigation && showNavLogo ? <SpImage src={`member/logo-${isBlack ? "black" : "light"}.png`} height={34} mode='heightFix' isNew /> : undefined
const navigationBarTitleText = getCurrentInstance().page?.config?.navigationBarTitleText
const navigationBarTitleText = props.navigationBarTitleText || getCurrentInstance().page?.config?.navigationBarTitleText
return (
<View
className={classNames('custom-navigation', {

View File

@ -26,10 +26,14 @@ const initialState = {
}
function SpPicker (props) {
const { mode, children, leftBtnTxt = '取消', rightBtnTxt = '确定', source = [], value, pickerConfirm, isTop = false } = props
const [state, setState] = useImmer(initialState)
const [state, setState] = useImmer({ ...initialState, value })
const { visible, isOpen, list } = state
const handlerChange = () => { }
const handlerChange = (value) => {
// setState((draft) => {
// draft.value = value
// })
}
const onPickerCancel = () => {
setState((draft) => {
@ -43,7 +47,7 @@ function SpPicker (props) {
// const pickerConfirm = () => { }
return (
<View className='sp-picker'>
<View className='sp-picker' style={{ 'z-index': isTop ? 999 : 10 }}>
<View
className='picker-value'
onClick={() => {
@ -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)

View File

@ -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 (
<View className='picker-custom'>
<PickerView
@ -85,7 +86,9 @@ function PickerDateTime (props) {
</PickerView>
<View className="picker-btn" onClick={() => {
onPickerCancel()
handleConfirm(source[value[0]], value[0])
setTimeout(() => {
handleConfirm(source[value[0]], value[0])
}, 100)
}}>确定</View>
</View>
)
@ -95,4 +98,4 @@ PickerDateTime.options = {
addGlobalClass: true
}
export default PickerDateTime
export default React.memo(PickerDateTime)

View File

@ -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
}
})

View File

@ -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',

View File

@ -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()

View File

@ -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 (
<View className='page-comp-deliver'>
<View className='switch-box'>
{/* <View className='switch-box'>
<View className={classNames(deliveryList.length > 0 && 'switch-tab')}>
{deliveryList.map((item) => {
if (distributorInfo[item.key]) {
@ -266,7 +266,7 @@ function CompDeliver(props, ref) {
}
})}
</View>
</View>
</View> */}
{/** 普通快递 */}
{receiptType === 'logistics' && <AddressChoose isAddress={address} />}
{/** 同城配 */}

View File

@ -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;

View File

@ -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

View File

@ -55,7 +55,8 @@ export const initialState = {
isNeedPackage: false, // 是否需要打包
openCashier: false,
isPointOpenModal: false,
routerParams: {}
routerParams: {},
orderTtems: []
}
export const deliveryList = [

View File

@ -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 (
<View className='checkout-toolbar'>
<View className='checkout-toolbar__total'>
{`${totalInfo.items_count}件商品 总计:`}
<SpPrice unit='cent' className='primary-price' value={totalInfo.total_fee} />
{/* {`共${totalInfo.items_count}件商品 总计:`} */}
<Text className='price-total'>订单总计</Text>
<SpPrice unit='cent' className='primary-price' value={totalInfo.total_fee} showSeparator noDecimal={false} />
</View>
<AtButton
circle
type='primary'
loading={submitLoading}
disabled={orderSubmitDisabled()}
onClick={onSubmitPayChange}
>
提交订单
立即结算
</AtButton>
</View>
)
@ -833,17 +836,64 @@ function CartCheckout(props) {
<View className='cart-checkout__group'>
<View className='cart-group__cont'>
<View className='sp-order-item__idx'>
商品清单 <Text style={{ color: '#222' }}>{totalInfo.items_count}</Text>
订单商品
{/* <Text style={{ color: '#222' }}>{totalInfo.items_count}</Text> */}
</View>
<View className='goods-list'>
{detailInfo.map((item, idx) => (
<View className='sp-order-item__wrap' key={idx}>
<SpGoodsCell info={item} />
{/* <SpOrderItem
key={`${idx}1`}
info={item}
isShowNational
isPointitemGood={false}
onClick={() => {
if (info.order_class == 'pointsmall') {
Taro.navigateTo({
url: `/subpages/pointshop/espier-detail?id=${item.good_id}`
})
} else {
JumpGoodDetail(item.good_id, item.distributor_id)
}
}}
/> */}
</View>
))}
</View>
<View className="gap"></View>
<View className="trade-detail-info-new">
<View className='line'>
<View className='left'>订单金额</View>
<SpPrice unit='cent' size={20} className='right' value={totalInfo.item_fee_new} showSeparator noDecimal={false}></SpPrice>
{/* <View className='right'>{`¥${parseFloat(totalInfo.item_fee_new / 100).toFixed(2)}`}</View> */}
{/* <View className='right'>
{totalInfo.item_fee_new}
{transformTextByPoint(this.isPointitemGood(), info.item_fee_new, info.item_point)}
</View> */}
</View>
<View className='line'>
<View className='left'>优惠金额</View>
{/* 促销 + 优惠券 */}
<View className='right'>{`¥${parseFloat(totalInfo.promotion_discount + totalInfo.coupon_discount).toFixed(2)}`}</View>
</View>
<View className='line'>
<View className='left'>运费</View>
<View className='right'>
{totalInfo.freight_type !== 'point'
? `¥${totalInfo.freight_fee}`
: `${totalInfo.freight_fee * 100}${this.props.pointName}`}
</View>
</View>
</View>
<View className="gap"></View>
<View className="trade-detail-info-bottom">
<View className='left'>订单总计</View>
<SpPrice unit='cent' className='right' value={totalInfo.total_fee} showSeparator noDecimal={false}></SpPrice>
</View>
</View>
<View className='cart-group__cont cus-input'>
{/* <View className='cart-group__cont cus-input'>
<SpCell className='trade-remark' border={false}>
<AtInput
className='trade-remark__input'
@ -853,15 +903,15 @@ function CartCheckout(props) {
maxLength={50}
/>
</SpCell>
</View>
</View> */}
</View>
</View>
)
}
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 && (
<SpCell
isLink
className='cart-checkout__coupons'
@ -943,8 +993,8 @@ function CartCheckout(props) {
onClick={handleCouponsClick}
value={couponText || '请选择'}
/>
)}
{isWeixin && !bargain_id && totalInfo.invoice_status && (
)} */}
{/* {isWeixin && !bargain_id && totalInfo.invoice_status && (
<SpCell
isLink
title='开发票'
@ -962,7 +1012,7 @@ function CartCheckout(props) {
</View>
}
/>
)}
)} */}
{packInfo.is_open && (
<SpCell
@ -1031,7 +1081,7 @@ function CartCheckout(props) {
</View>
)}
<View className='cart-checkout__total'>
{false && <View className='cart-checkout__total'>
<SpCell
className='trade-sub__item'
title='原价:'
@ -1068,7 +1118,7 @@ function CartCheckout(props) {
value={<SpPrice unit='cent' primary value={0 - totalInfo.point_fee} />}
/>
)}
</View>
</View>}
<CompPointUse
isOpened={isPointOpenModal}

View File

@ -1,20 +1,27 @@
$margin24: 24px;
$margin24: 10px;
.page-cart-checkout {
box-sizing: border-box;
overflow-y: auto;
padding: 0px 16px;
padding: 0px 22px;
.checkout-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
align-items: flex-end;
background: #fff;
padding: 0 20px;
height: 100%;
padding: 0 40px 90px 50px;
// height: 100%;
&__total {
white-space: nowrap;
flex: 1;
margin-right: 0;
.at-button {
padding: 0 38px;
}
.price-total {
font-size: 26px;
mask-repeat: 12px;
}
.last_price {
display: inline-block;
.sp-price__append {
@ -57,16 +64,17 @@ $margin24: 24px;
}
.sp-order-item {
position: relative;
padding: 35px 0px;
padding: 35px 24px;
background: #f7f7f7;
&__bd {
flex: 1;
}
&__idx {
color: #666;
height: 36px;
line-height: 36px;
color: #000;
height: 26px;
line-height: 26px;
display: block;
font-size: 30px;
font-size: 26px;
}
&__img {
width: 200px;
@ -119,8 +127,11 @@ $margin24: 24px;
font-size: 24px;
}
.cart-checkout__address {
margin-bottom: $margin24;
margin-top: 24px;
// margin-bottom: $margin24;
// margin-top: 24px;
margin: 10px 0;
border-bottom: 6px;
overflow: hidden;
}
.cart-checkout__coupons {
.sp-cell__value {
@ -134,9 +145,12 @@ $margin24: 24px;
.cart-checkout__pay,
.cart-checkout__total,
.cart-checkout__group {
box-shadow: 0px 2px 10px 0px #eae7e0;
// box-shadow: 0px 2px 10px 0px #eae7e0;
margin: 0 0 $margin24;
padding: 30px 16px;
padding: 30px 24px;
background: #f7f7f7;
border-radius: 6px;
box-sizing: border-box;
}
// .cart-checkout__pay {
@ -184,13 +198,60 @@ $margin24: 24px;
}
.cart-checkout__group {
padding: 24px 16px;
background: #fff;
// padding: 24px 16px;
.cart-group__shop {
padding: 16px $edge-margin;
}
.cart-group__cont {
background: #fff;
// background: #fff;
.price-gp {
text-align: end;
font-weight: bold;
}
.sp-price__decimal {
font-weight: bold;
}
.gap {
padding: 0 54px;
width: calc(100% - 108px);
box-sizing: border-box;
height: 2px;
background: #fff;
margin: 20px auto;
}
.trade-detail-info-new {
padding: 20px 24px;
.line {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
margin-bottom: 18px;
.left,
.right {
font-size: 20px;
color: #5b5b5b;
line-height: 1;
}
}
}
.trade-detail-info-bottom {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 22px 50px;
.left {
font-size: 26px;
}
.right {
font-size: 32px;
}
.left,
.sp-price__symbol,
.sp-price__int {
font-weight: bold;
}
}
}
.cus-input {
.sp-cell {
@ -220,7 +281,8 @@ $margin24: 24px;
margin: 0 0 $margin24;
.sp-cell {
padding: 30px 16px;
box-shadow: 0px 2px 10px 0px #eae7e0;
// box-shadow: 0px 2px 10px 0px #eae7e0;
background: #f7f7f7;
}
.required {
color: #e62424;

View File

@ -464,7 +464,7 @@ function CartIndex () {
去选购
</AtButton>
</SpDefault> */}
<SpImage className='default-img' src='index/logo.png' width={160} isNew />
<SpImage className='default-img' src='cart/logo-hui.png' width={160} isNew />
<View className="empty-box-tit">购物车还是空的</View>
<View className="empty-box-sub-tit">快去挑选自己喜欢的宝贝吧~</View>
<SpLogin onChange={() => { }}>

View File

@ -61,7 +61,7 @@ const CompSeries = (props) => {
const renderCategoryChildHandler = (item = selChild) => {
return (
<View className=''>
<View className='group-box'>
{/* handleCustomClick(item.category_id) */}
<View className='group' key={item.category_id} onClick={() => handleClickItem(item)}>
<View className='group-title'>探索全部

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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 (
<SpPage
className='page-index'
@ -378,7 +409,7 @@ function Home () {
autoplay={!isUpOperation}
onChange={onSwiperChange}
>
{state.list.map((item, index) => (
{state.swiperList.map((item, index) => (
<SwiperItem key={index} className="" style={{ height: "100%" }}>
{item.type === "image" && (
<Image
@ -425,7 +456,7 @@ function Home () {
))}
</Swiper>
{!isUpOperation && <View className='spot-pagination'>
{state.list.map((_, index) => (
{swiperList.map((_, index) => (
<View key={index} className={'spot-pagination-bullet ' + ((state.currentIndex == index) ? 'spot-pagination-bullet-active' : "")} style={{ width: 1 / state.length * 100 + '%' }}></View>
))}
</View>}
@ -433,9 +464,9 @@ function Home () {
<SpChat><SpImage height="62" src='index/kf.png' isShowMenuByLongpress={false} lazyLoad isNew /></SpChat>
</View>}
</View>
{isUpOperation && <ScrollView scrollX scrollWithAnimation showScrollbar={false} scrollLeft={0} className="shop-box">
{shopList.map((item, idx) => (
<View className='goods-item-wrap' key={`goods-item-l__${idx}`}>
{isUpOperation && <ScrollView scrollX scrollWithAnimation showScrollbar={false} scrollLeft={0} className="shop-box fadeIn" >
{goodList.map((item, idx) => (
<View className='goods-item-wrap fadeIn' animation={{ duration: 500, timingFunction: 'ease-in-out', delay: 0 }} key={`goods-item-l__${idx + item.goods_id}`}>
<SpGoodsItem
onStoreClick={handleClickStore}
info={{

View File

@ -128,6 +128,7 @@
}
&__container {
width: 560px;
border-radius: 10px;
}
&__header {
font-size: 40px;

View File

@ -5,9 +5,8 @@ import { View, Text, ScrollView } from '@tarojs/components'
import { SpPrice, SpLogin } from '@/components'
import './comp-couponlist.scss'
function CompCouponList(props) {
const { info, onClick = () => {} } = 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}`

View File

@ -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 (
<SpPage
className='page-item-espierdetail'
@ -431,15 +473,20 @@ function EspierDetail (props) {
className='goods-swiper'
// current={curImgIdx}
onChange={onChangeSwiper}
style={{
height: windowWidth
}}
autoplay
interval={3000}
circular
>
{console.log('info', info)}
{info.imgs.map((img, idx) => (
{(info.imgs || swiperList).map((img, idx) => (
<SwiperItem key={`swiperitem__${idx}`}>
<SpImage
mode='aspectFill'
src={img}
width={windowWidth * 2}
height={900}
height={windowWidth * 2}
></SpImage>
{false && (
<Video
@ -676,15 +723,20 @@ function EspierDetail (props) {
type={selectType}
info={info}
hideInputNumber
onChangeImg={onChangeImg}
onClose={() => {
setState((draft) => {
draft.skuPanelOpen = false
})
}}
onChange={(skuText, curItem) => {
onChange={(skuText, curItem, idx) => {
console.log("🚀 ~ curItem:", curItem, idx)
setState((draft) => {
draft.skuText = skuText
draft.curItem = curItem
// 不切换顶部轮播图
// draft.swiperList = curItem?.specItem?.[idx]?.specImgs
draft.selSkuImg = curItem.specItem?.[0]?.specImgs?.[0]
})
}}
/>
@ -693,7 +745,7 @@ function EspierDetail (props) {
<View className='desc-hd'>
<SpImage
className='sku-image'
src={skuSelectRef.current?.getImgs()}
src={selSkuImg || info?.specItem?.[0]?.specImgs?.[0]}
width={160}
height={160}
mode='aspectFit'
@ -721,75 +773,53 @@ function EspierDetail (props) {
{/* <SpHtml content={info.intro} /> */}
</>
)}
{[{ open: false }, { open: false }, {}, {}, {}, {}, {}, {}].map((item, index) => <View className={classNames('sp-accordion')} key={`item__${index}`}>
{introList.length ? introList.map((item, index) => <View className={classNames('sp-accordion')} key={`item__${index}`}>
<AtAccordion
open={isOpen}
open={item.isOpen}
isAnimation={false}
onClick={() => {
setState((draft) => {
draft.isOpen = !draft.isOpen
// draft.introList[index].isOpen = !draft.introList[index].isOpen
draft.introList = draft.introList.map((v, i) => {
v.isOpen = (i === index)
return v
})
})
}}
title={'标题' + (index + 1)}
title={item.title}
>
<View>内容一</View>
<View>内容二</View>
<View>内容三</View>
<View>内容三</View>
<View>内容三</View>
<View>内容三</View>
{/* <SpHtml content={info.intro} /> */}
<SpHtml content={item.content} />
</AtAccordion>
<View onClick={() => {
setState((draft) => {
draft.isOpen = !draft.isOpen
// draft.introList[index].isOpen = !draft.introList[index].isOpen
draft.introList = draft.introList.map((v, i) => {
v.isOpen = (i === index)
return v
})
})
}}>
{isOpen ? <AtIcon value='subtract' size='16' color='#000' /> :
{item.isOpen ? <AtIcon value='subtract' size='16' color='#000' /> :
<AtIcon value='add' size='16' color='#000' />}
{isOpen ? <></> : <View className="line"></View>}
{item.isOpen ? <></> : <View className="line"></View>}
</View>
</View>)}
<View className='bottom-box'>
</View>) : <View style={{ height: `calc(100% - 380px)` }}></View>}
{historyList.length && <View className='bottom-box'>
<View className="bottom-box-tit">浏览历史</View>
<ScrollView scrollX scrollWithAnimation showScrollbar={true} scrollLeft={0} className="shop-box">
{[
{
brief: "副标题",
itemName: "测试商品1",
price: "1099",
goods_id: 6,
pic: 'https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/image/1/2024/01/15/46fe6ca52277038e39ee2c026a4af3c9xHQuJ96YIcZWtjRS0HBCTzp7dzXIs2pl'
},
{
brief: "副标题",
itemName: "测试商品2",
price: "1099",
goods_id: 6,
pic: 'https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/image/1/2024/01/15/801c18d59d95ea26930fefc43bf66febTQjxb65cpnCqVLaOsYmiHdkDdYqBnXVm'
},
{
brief: "副标题",
itemName: "测试商品3",
price: "1099",
goods_id: 6,
pic: 'https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/image/1/2024/01/15/46fe6ca52277038e39ee2c026a4af3c90XruENsSSAhRiz0HPI3PjR8XQNVgbxHb'
},
].map((item, idx) => (
{historyList.map((item, idx) => (
<View className='goods-item-wrap' key={`goods-item-l__${idx}`}>
<SpGoodsItem
showSalePrice={false}
height={250}
width={250}
onStoreClick={handleClickStore}
info={{
...item
}}
info={item}
/>
</View>
))}
</ScrollView>
</View>
</View>}
</View>
</ScrollView>
)}

View File

@ -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;

View File

@ -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
})}
>
<View className='search-wrap'>
<View className='search-wrap' style={{
'zIndex': isShowSearch ? 999 : 8
}}>
{/* 兑换券选择店铺 */}
{VERSION_STANDARD && card_id && (
<View
@ -345,6 +352,7 @@ function ItemList () {
</View>
)}
<SpSearchBar
className='search-wrap'
keyword={keywords}
placeholder='搜索商品'
isOpened={true}

View File

@ -25,7 +25,7 @@
right: 0;
top: 0;
background: #fff;
z-index: 10;
z-index: 8;
display: flex;
align-items: center;
.store-picker {
@ -41,6 +41,11 @@
}
}
.sp-filter-bar {
position: fixed;
top: 260px;
z-index: 8;
left: 0;
right: 0;
&__item {
background: #f5f5f5;
&:first-child {
@ -62,9 +67,13 @@
.item-list-scroll {
// @include page-scroll($tabs-height + $navigate-height + 10, 0);
@include page-scroll($tabs-height + $navigate-height + 168, $edge-margin);
// /* #ifdef h5 */
// @include page-scroll($searchbar-height + $navigate-height + 16 * 2 + $tabs-height + 10, 0);
// /* #endif */
.sp-note {
margin-bottom: 50px;
}
}
.filter-btn {
font-size: 28px;
@ -90,7 +99,7 @@
.goods-list {
display: flex;
justify-content: space-between;
padding: 30px 50px 50px;
padding: 0px 50px;
.goods-list-wrap {
// width: 345px;
margin-bottom: 28px;

View File

@ -111,6 +111,7 @@ export default class ItemFav extends Component {
item_type: 'item_type',
distributor_id: 'distributor_id',
point: 'point',
fav_num: 'fav_num',
// price: ({ price }) => (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 {
})}
</View>
)}
{page.isLoading ? <Loading>正在加载...</Loading> : null}
{!page.isLoading && !page.hasNext && !list.length && (
{/* {page.isLoading ? <Loading>正在加载...</Loading> : null} */}
{/* !page.isLoading && */}
{!page.hasNext && !list.length && (
<SpNote img='trades_empty.png'>暂无数据~</SpNote>
)}
</ScrollView>

View File

@ -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%;

View File

@ -1,3 +1,3 @@
export default {
navigationBarTitleText: '文章'
navigationBarTitleText: ''
}

View File

@ -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 (
<SpPage renderFooter={<SpTabbar />}>
<SpPage renderFooter={<SpTabbar />} className='has-nav' title="鞋床故事">
<View className='page-recommend-list'>
<View className='recommend-list__toolbar'>
<View
@ -593,9 +593,9 @@ export default class RecommendList extends Component {
{address ? (
<View
className='zoom-btn icon-close iconfont'
onClick={this.handleRegionRefresh.bind(this)}
></View>
className='zoom-btn icon-close iconfont'
onClick={this.handleRegionRefresh.bind(this)}
></View>
// <Text className='icon-close' onClick={this.handleRegionRefresh.bind(this)}>x</Text>
) : (
''

View File

@ -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;

View File

@ -428,7 +428,7 @@ $paddingBottom: 100px;
.left,
.right {
font-size: 20px;
color: #5b5b5b80;
color: #5b5b5b;
line-height: 1;
}
}

View File

@ -0,0 +1,4 @@
export default {
navigationBarTitleText: '开票信息',
navigationStyle: 'custom',
}

View File

@ -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 <SpPage className='page-invoice-info has-navbar' navigationBarTitleText='开票信息'>
<View className="info-bd">
{showDetail && <View className="info-bd-tips">{0}张发票{1}个订单</View>}
<View className="info-item">
<View className="tit">发票类型</View>
<View className="content">
<Text>电子发票</Text>
{showDetail ? <View className='flex'>
<Text className='ck'>查看</Text>
<AtIcon value='chevron-right' size='18' color='#000'></AtIcon>
</View> : <Text className='sq'></Text>}
</View>
</View>
{showDetail && <View className="info-item">
<View className="tit">发票状态</View>
<View className="content">
<Text>已申请</Text>
</View>
</View>}
<View className="info-item">
<View className="tit">发票金额</View>
<View className="content">
<Text>¥9999</Text>
</View>
</View>
{formList.map((item) => <View className="info-item">
<View className="tit">{item.name}</View>
{showDetail ? <View className="content">{form[item.key] || '测试'}</View> : <>{item.type === 'checkbox' && <View className="content">
<View className="content-item">
<SpCheckboxNew checked={form.gr === '1'} onChange={() => onChangeItemCheck()} >
<Text className="">个人/非企业单位</Text>
</SpCheckboxNew>
</View>
<View className="content-item">
<SpCheckboxNew checked={form.gr === '2'} onChange={onChangeItemCheck()} >
<Text className="">企业</Text>
</SpCheckboxNew>
</View>
</View>}
{item.type === 'input' && <Input value={form[item.key]} onInput={(e) => hadnleInput(e.target.value, item)} className='ipt' placeholderClass='ipt-placeholder' placeholder={item.placeholder}></Input>}</>}
</View>)}
{!showDetail && <View className="tips">
<View className="tit">温馨提示</View>
<View className="tit">
1应国家税务总局要求您若开具增值税普通发票须同时提供
企业抬头及纳税人识别号否则发票将无法用于企业报销;
</View>
<View>2发票将由订单所属城市的公司为您开具;</View>
<View>
3配合国家税务总局推进全面数字化的电子发票部分城市已转
为全电发票发票处理时长为1-3个工作日请耐心等待
</View>
</View>}
</View>
<View className={classNames("bottom")}>
<View onClick={() => setState((draft) => {
draft.visible = true
})} className={classNames("btn", { "btn-disabled": true })}>提交申请</View>
</View>
<View className="sp-picker">
<View
className={classNames('mask', {
visible: visible
})}
onTap={onPickerCancel}
catchtouchmove
></View>
<View
className={classNames('sp-picker-cnt', {
visible: visible
})}
>
<View className={classNames('sp-picker-hd')} catchtouchmove>
<Text className='center'>{showDetail ? '确定邮箱地址' : '开具电子发票'}</Text>
<AtIcon onClick={onPickerCancel} value='close' size={14} color='#000' ></AtIcon>
</View>
<View className='sp-picker-bd'>
{!showDetail && <>
<View className='sp-picker-bd-item'>
<View className="tit">发票类型</View>
<View className="content">电子发票</View>
</View>
<View className='sp-picker-bd-item'>
<View className="tit">抬头类型</View>
<View className="content">电子发票</View>
</View>
<View className='sp-picker-bd-item'>
<View className="tit">发票抬头</View>
<View className="content">电子发票</View>
</View>
</>}
<View className='sp-picker-bd-item'>
<View className="tit">邮箱地址</View>
<View className="content">电子发票</View>
</View>
<View onClick={() => setState((draft) => {
draft.visible = false
draft.showModal = true
})} className={classNames("btn", { "notop": showDetail })}>提交申请</View>
</View>
</View>
</View>
<View className={classNames('toast', {
visible: false
})}>
<View>已超重开发票时限</View>
<View>不可操作重开发票</View>
</View>
<AtModal
isOpened={showModal}
title=''
cancelText='关闭'
confirmText='查看记录'
onClose={() => setState((draft) => {
draft.showModal = false
})}
onCancel={() => setState((draft) => {
draft.showModal = false
})}
onConfirm={() => {
setState((draft) => {
draft.showModal = false
})
navigateTo('/subpage/pages/trade/invoice-record')
}}
content='发票申请提交成功'
/>
</SpPage>
}
export default InvoiceInfo

View File

@ -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;
}
}
}

View File

@ -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 {
{/* <SpNavBar title='发票管理' leftIconType='chevron-left' fixed='true' /> */}
<ScrollView scrollY className='trade-list__scroll' onScrollToLower={this.nextPage}>
{list.map((item) => {
{list.map((item, idx) => {
return (
<TradeItem
customFooter
payType={item.pay_type}
key={item.tid}
info={item}
onClick={this.handleClickItem.bind(this, item)}
onClickBtn={this.handleClickItemBtn}
renderFooter={
<View className='trade-item__ft'>
<Text className='trade-item__status'>已开票</Text>
// <TradeItem
// customFooter
// payType={item.pay_type}
// key={item.tid}
// info={item}
// onClick={this.handleClickItem.bind(this, item)}
// onClickBtn={this.handleClickItemBtn}
// renderFooter={
// <View className='trade-item__ft'>
// <Text className='trade-item__status'>已开票</Text>
// </View>
// }
// />
<View className='invoice-item' key={`invoice_item_${idx}`}>
<SpCheckboxNew
checked={item.is_checked}
onChange={this.onChangeItemCheck.bind(this, item)}
/>
<View className="right">
<View className="right-item">{idx + 1}开票金额
<SpPrice size={28} className='total-pirce' value={item.payment / 100} showSeparator noDecimal />
</View>
}
/>
<View className="right-item">订单编号{item.tid}</View>
<View className="right-item">下单时间{item.create_date}</View>
</View>
</View>
)
})}
{!page.isLoading && list?.length && <View className="bottom">
<View className="bottom-line">
<View className="left">已选{1}个订单共计
<SpPrice size={20} className='total-pirce' value={900900 / 100} showSeparator noDecimal />
</View>
<View className="right">开票金额以实际为准</View>
</View>
<View className='bottom-wrap'>
<SpCheckboxNew
checked={false}
onChange={this.onChangeItemCheck.bind(this, {})}
/>
<View className="bottom-txt">本页全选</View>
<View className="bottom-btn">下一步</View>
</View>
</View>}
{/*<AtButton
circle
type='primary'
@ -161,7 +193,7 @@ export default class InvoiceList extends Component {
>下载</AtButton>*/}
{page.isLoading && <Loading>正在加载...</Loading>}
{!page.isLoading && !page.hasNext && !list.length && (
<SpNote img='trades_empty.png'>赶快去添加吧~</SpNote>
<SpNote img='trades_empty.png'>已完成订单为空~</SpNote>
)}
</ScrollView>
</SpPage>

View File

@ -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;

View File

@ -0,0 +1,4 @@
export default {
navigationBarTitleText: ' ',
navigationStyle: 'custom',
}

View File

@ -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 (
<SpPage className='page-invoice-info has-navbar' navigationBarTitleText='发票记录'>
<ScrollView scrollY className='trade-list__scroll' onScrollToLower={this.nextPage}>
{list.map((item, idx) => {
return (
<View className='invoice-item' key={`invoice_item_${idx}`}>
<View className="right">
<View className="right-item">{idx + 1}发票金额
<SpPrice size={28} className='total-pirce' value={item.payment / 100} showSeparator noDecimal />
</View>
<View className="right-item">发票类型电子发票</View>
<View className="right-item">抬头类型{item.create_date}</View>
<View className="right-item">申请时间{item.create_date || '2023-12-18 10:10'}</View>
</View>
<View className="status">
<Text className="txt">已申请</Text>
<AtIcon value='chevron-right' size='18' color='#888'></AtIcon>
</View>
</View>
)
})}
{page.isLoading && <Loading>正在加载...</Loading>}
</ScrollView>
</SpPage>
)
}
}

View File

@ -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;
}
}
}

View File

@ -352,7 +352,7 @@ export default class TradeList extends Component {
})}
{page.isLoading && <Loading>正在加载...</Loading>}
{!page.isLoading && !page.hasNext && !list.length && (
<SpNote isUrl img={`${process.env.APP_IMAGE_CDN_NEW}/index/logo.png`} height={144} width={144}>
<SpNote isUrl img={`${process.env.APP_IMAGE_CDN_NEW}/cart/logo-hui.png`} height={144} width={144}>
您的{curTabIdx != '0' ? tabList[curTabIdx].title : ''}订单为空
</SpNote>
)}

View File

@ -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);
}
}
}

View File

@ -1 +1,4 @@
export default {}
export default {
navigationBarTitleText: ' ',
navigationStyle: 'custom',
}

View File

@ -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 (
<ScrollView enhanced scrollY showScrollbar={false} className='page-auth-reg-rule'>
{info && (
<SpHtml content={info} />
)}
</ScrollView>
<SpPage className="has-navbar" navigationBarTitleText={title}>
<ScrollView enhanced scrollY showScrollbar={false} className='page-auth-reg-rule'>
{info && (
<SpHtml content={info} />
)}
</ScrollView>
</SpPage>
)
}
}

View File

@ -2,5 +2,5 @@
padding: 30px;
background: #fff;
box-sizing: border-box;
height: 100vh;
height: calc(100vh - var(--nav-height) - 40px);
}

View File

@ -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) {
>
<View className='header-hd'>
<View className='header-hd__header' onClick={isLogin && handleClickLink.bind(this, '/subpages/member/user-info')}>
<SpImage
className='usericon'
src={(userInfo && userInfo.avatar) || ''}
width='110'
/>
<SpLogin newUser={isNewUser}>
<SpImage
className='usericon'
src={(userInfo && userInfo.avatar) || `${process.env.APP_IMAGE_CDN_NEW}/member/user-icon.png`}
width='114'
/>
</SpLogin>
</View>
<View className='header-hd__body' onClick={isLogin && handleClickLink.bind(this, '/subpages/member/user-info')}>
<View className='username-wrap'>
@ -705,15 +707,15 @@ function MemberIndex (props) {
</View>
</View>
{state.isOpen && <View className={`${state.isOpen ? 'show ' : 'hide '}` + 'curtain'} onClick={() => setState((draft) => { draft.isOpen = false })}>
<View className="curtain_mask">
<View className="curtain_content">
<View className="curtain_content_title">
{state.isOpen && <View className={`${state.isOpen ? 'show ' : 'hide '}` + 'curtain-block'} onClick={() => setState((draft) => { draft.isOpen = false })}>
<View className="curtain-block_mask">
<View className="curtain-block_content">
<View className="curtain-block_content_title">
<SpImage src={`member/logo-black.png`} height={32} mode='heightFix' isNew />
<View className="">隐私政策</View>
</View>
<ScrollView scrollY
scrollWithAnimation className="curtain_content_text" showScrollbar={false} enhanced>
scrollWithAnimation className="curtain-block_content_text" showScrollbar={false} enhanced>
亲爱的用户,感谢您使用Birkenstock微信小程序!为了加强对您个人信息的保护,我们根据最新法律的要求制定/更新了隐私政策,我们将基于合法以及正当必要的原则,按照本政策的规定向您提供各项服务
本政策旨在向您说明休迪贸易 (上海)有限公司及其在中国大陆境内的线上线下门店如何收集使用传输和保护您的个人信息
通过隐私政策,我们向您主要说明:

View File

@ -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;

View File

@ -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 (
<Picker mode='date' value={formUserInfo[key]} onChange={onChangePicker.bind(this, key)} start='1900-01-01' end={formatTime(new Date())}>
<Picker mode='date' disabled={disabled} value={formUserInfo[key]} onChange={onChangePicker.bind(this, key)} start='1900-01-01' end={formatTime(new Date())}>
<View
className={classNames('picker-value', {
'placeholder': !formUserInfo[key]
})}
style={{ 'color': disabled ? '#a5a5a5' : '#000' }}
>
{formUserInfo[key] || required_message}
</View>
@ -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}
>
<View className='picker'>
<View className='picker' style={{ 'color': multiIndex.length > 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 (
<Button class='avatar-wrapper' open-type='chooseAvatar' onChooseAvatar={onChooseAvatar}>
<SpImage src={formUserInfo.avatar || 'user_icon.png'} width={110} height={110} circle />
<SpImage src={'cart/logo-hui.png'} width={110} height={110} circle isNew />
</Button>
)
} else {
@ -513,7 +564,7 @@ function MemberUserInfo () {
onInput={onChangeUsername}
onConfirm={onChangeUsername}
/> : renderFormItem(item)}
{(item.element_type === 'select' || item.element_type === 'date') && <View className="iconfont icon-arrowRight"></View>}
{(item.element_type === 'select' || item.element_type === 'date') && <View className="iconfont icon-arrowRight" style={{ color: item.key === 'birthday' && !userInfo.birthday_can_edit ? '#a5a5a5' : '#000' }}></View>}
</View>
</View>)}
</View>