merge(custom): m

This commit is contained in:
jerry
2025-09-01 17:06:47 +08:00
7 changed files with 66 additions and 19 deletions

1
.env
View File

@@ -13,4 +13,5 @@ APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
APP_DIANWU_URL=https://demo-ecshopx-dianwu.shopex123.com
APP_MERCHANT_URL=
APP_ADAPAY=
APP_VUE_SAAS=

View File

@@ -47,6 +47,12 @@ class AtInputNumber extends AtComponent {
})
}
componentDidUpdate(prevProps) {
if (prevProps.value !== this.state.localValue) {
this.setState({ localValue: this.props.value })
}
}
handleClick(clickType) {
const { disabled, value, min, max, step } = this.props
const lowThanMin = clickType === 'minus' && value <= min
@@ -65,7 +71,7 @@ class AtInputNumber extends AtComponent {
errorValue
})
}
return
// return
}
const deltaValue = clickType === 'minus' ? -step : step
let newValue = addNum(value, deltaValue)
@@ -103,21 +109,25 @@ class AtInputNumber extends AtComponent {
const { value } = e.target
const { disabled } = this.props
if (disabled) return
console.log(`handleInput`, `value: ${value}, localValue: ${this.state.localValue}`)
this.setState({
localValue: value
})
// console.log('handleInput', value)
// this.setState({
// localValue: value
// })
// this.props.onChange(newValue, e, ...arg)
// return newValue
}
handleBlur = (e, ...arg) => {
const { value } = e.target
const newValue = this.handleValue(value)
console.log(`handleBlur newValue: ${newValue}, value: ${value}`)
console.log('handleInput', newValue)
this.setState({
localValue: newValue
})
this.props.onChange(newValue, e, ...arg)
}
// handleBlur = (...arg) => this.props.onBlur(...arg)
handleError = (errorValue) => {
if (!this.props.onErrorInput) {
@@ -129,8 +139,20 @@ class AtInputNumber extends AtComponent {
render() {
const { customStyle, className, width, disabled, value, type, min, max, size } = this.props
const inputStyle = {
width: width ? `${Taro.pxTransform(width)}` : ''
}
const inputValue = this.handleValue(this.state.localValue)
console.log(
'inputValue',
inputValue,
'localValue',
this.state.localValue,
'max',
max,
'inputValue >= parseInt(max)',
inputValue >= parseInt(max)
)
const rootCls = classNames(
'sp-input-number',
'at-input-number',

View File

@@ -71,11 +71,10 @@ function SpSkuSelect(props) {
}
// 防止列表页遗留其他商品信息
if (info && info.nospec) {
specItemed()
setState((draft) => {
draft.curItem = null
draft.skuText = ''
draft.minNum = specItemed()
draft.num = specItemed()
})
}
@@ -87,7 +86,7 @@ function SpSkuSelect(props) {
}, [info])
useEffect(() => {
if (!open && refreshs) {
if (!open) {
setState((draft) => {
draft.num = 1
})
@@ -121,6 +120,7 @@ function SpSkuSelect(props) {
if (info.specItems.length > 0 && val.length > 0) {
//多规格动态获取起订量
const newval = val.length == 1 ? val[0] : val.join('-')
console.log('newval:', newval, val, info.specItems)
info.specItems.forEach((item) => {
if (item.customSpecId == newval) {
setState((draft) => {
@@ -134,6 +134,9 @@ function SpSkuSelect(props) {
//单规格
return info.startNum
} else {
setState((draft) => {
draft.minNum = 1
})
return 1
}
}

View File

@@ -243,6 +243,7 @@ export const GOODS_INFO = {
specItems: ({ spec_items, is_point }) => {
return pickBy(spec_items, {
approveStatus: 'approve_status',
customSpecId: 'custom_spec_id',
specItem: ({ item_spec }) => {
return pickBy(item_spec, {
specId: 'spec_value_id',
@@ -254,6 +255,7 @@ export const GOODS_INFO = {
})
},
itemId: 'item_id',
startNum: 'start_num', // 起订量
store: 'store',
limitNum: 'limit_num',
// price: ({ price }) => price / 100,

View File

@@ -179,16 +179,28 @@ export default (props = {}) => {
const wxpayjsPay = async (params, orderInfo) => {
// const $instance = getCurrentInstance()
const { order_id, code } = router.params
if (!code) {
// 微信客户端code授权
const loc = window.location
// const url = `${loc.protocol}//${loc.host}/pages/cart/cashier-result?order_id=${orderId}`
const url = `${loc.protocol}//${loc.host}/pages/cart/cashier-weapp?order_id=${orderId}&source=${source}`
let { redirect_url } = await api.wx.getredirecturl({ url })
window.location.href = redirect_url
}
const { open_id } = await api.wx.getOpenid({ code })
const { pay_channel } = params
const { pay_type, order_type = 'normal' } = orderInfo
const config = await api.cashier.getPayment({
let query = {
pay_type,
pay_channel,
order_id,
order_type,
open_id
})
}
if (params.source) {
query.source = params.source
}
const config = await api.cashier.getPayment(query)
const { appId, timeStamp, nonceStr, signType, paySign } = config
WeixinJSBridge.invoke(
'getBrandWCPayRequest',

View File

@@ -28,21 +28,21 @@ function CashierWeApp(props) {
const { price, order_id, create_time, params, orderInfo } = state
const { cashierPayment } = usePayment()
const { source } = $instance.router.params
useEffect(() => {
const { order_id } = $instance.router.params
const { order_id, source } = $instance.router.params
if (order_id) {
fetch()
}
}, [])
const fetch = async () => {
const { order_id, code } = $instance.router.params
const { order_id, code, source } = $instance.router.params
if (isWxWeb && !code) {
// 微信客户端code授权
const loc = window.location
// const url = `${loc.protocol}//${loc.host}/pages/cart/cashier-result?order_id=${orderId}`
const url = `${loc.protocol}//${loc.host}/pages/cart/cashier-weapp?order_id=${order_id}`
const url = `${loc.protocol}//${loc.host}/pages/cart/cashier-weapp?order_id=${order_id}&source=${source}`
let { redirect_url } = await api.wx.getredirecturl({ url })
window.location.href = redirect_url
}
@@ -51,7 +51,7 @@ function CashierWeApp(props) {
orderDetail.orderInfo
const params = {
activityType: activity_type,
pay_channel: isWeixin ? 'wx_lite' : pay_channel,
pay_channel: isWeixin ? 'wx_lite' : pay_channel == 'wx_qr' ? 'wx_pub' : pay_channel,
pay_type: pay_type
}
const orderInfo = {
@@ -80,7 +80,12 @@ function CashierWeApp(props) {
}
const handlePay = async () => {
cashierPayment(params, orderInfo)
const { source } = $instance.router.params
let _params = { ...params }
if (source) {
_params.source = source
}
cashierPayment(_params, orderInfo)
}
return (
<View className='cashier-weapp'>

View File

@@ -349,7 +349,9 @@ function CartCheckout(props) {
if (
params.pay_type == 'wxpayjs' ||
(params.pay_type == 'adapay' && params.pay_channel == 'wx_pub' && isWxWeb)
((params.pay_type == 'bspay' || params.pay_type == 'adapay') &&
params.pay_channel == 'wx_pub' &&
isWxWeb)
) {
// 微信客户端code授权
const loc = window.location