Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
web-ci-test
Commits
b265fa28
提交
b265fa28
authored
7月 06, 2023
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:租赁规格等级标签显示
上级
c642cb7e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
17 行删除
+41
-17
index.tsx
api/index.tsx
+22
-13
[id].page.tsx
pages/equipmentLeasing/detail/[id].page.tsx
+19
-4
没有找到文件。
api/index.tsx
浏览文件 @
b265fa28
import
request
,
{
Response
}
from
'~/api/request'
;
import
config
from
'./config'
;
export
interface
RegionResp
{
...
...
@@ -26,6 +27,14 @@ export interface UserInfoResp {
companyAuthStatus
:
number
;
token
:
string
;
cooperationTagId
:
number
|
null
;
cooperationTagVOS
:
{
createTime
:
string
;
id
:
number
;
tagDescription
:
string
;
tagImg
:
string
;
tagName
:
string
;
tagRequire
:
string
;
}[];
}
export
interface
TestAppletLoginResp
{
...
...
@@ -38,13 +47,13 @@ export interface TestAppletLoginResp {
}
export
default
{
//获取区域数据
//
获取区域数据
region
:
():
Promise
<
Response
<
Array
<
RegionResp
>>>
=>
{
return
request
(
'/pms/webDevice/getSecondDistrictInfo'
);
},
//测试-小程序unionId登录-注册
//
测试-小程序unionId登录-注册
testAppletLogin
:
():
Promise
<
Response
<
TestAppletLoginResp
>>
=>
{
le
t
params
=
new
URLSearchParams
();
cons
t
params
=
new
URLSearchParams
();
params
.
append
(
'unionId'
,
'oQZEd5hy0Qrwaj10BGtP8xq8vH--s88888'
);
return
request
(
'/userapp/auth/testAppletLogin'
,
...
...
@@ -58,32 +67,32 @@ export default {
},
);
},
//生成小程序码
//
生成小程序码
getAppletQRCode
:
(
params
:
{
randomLoginCode
:
string
})
=>
{
return
request
(
'/userapp/wx/getAppletQRCode'
,
'get'
,
{
page
:
'page-identity/identity-empower/index'
,
scene
:
'randomLoginCode='
+
params
.
randomLoginCode
,
scene
:
`randomLoginCode=
${
params
.
randomLoginCode
}
`
,
});
},
//查询登录信息
//
查询登录信息
getLoginInfo
:
(
params
:
{
randomLoginCode
:
string
})
=>
{
return
request
(
'/userapp/temp-auth/getLoginInfo'
,
'get'
,
params
,
{
hideError
:
true
,
//隐藏错误提示
hideError
:
true
,
//
隐藏错误提示
});
},
//获取用户基本信息
//
获取用户基本信息
userInfo
:
():
Promise
<
Response
<
UserInfoResp
>>
=>
{
return
request
(
'/userapp/user-account/info'
,
'get'
);
},
//图片上传地址
//
图片上传地址
imgOss
:
()
=>
{
return
config
.
baseUrl
+
'/pms/upload/imgOss'
;
return
`
${
config
.
baseUrl
}
/pms/upload/imgOss`
;
},
//文件上传地址
//
文件上传地址
fileUpload
:
()
=>
{
return
config
.
baseUrl
+
'/pms/upload/breakpoint'
;
return
`
${
config
.
baseUrl
}
/pms/upload/breakpoint`
;
},
//宣传中心
//
宣传中心
listBannerImg
:
(
moduleCode
:
string
,
):
Promise
<
...
...
pages/equipmentLeasing/detail/[id].page.tsx
浏览文件 @
b265fa28
...
...
@@ -15,7 +15,6 @@ import {
}
from
'antd'
;
import
{
RangePickerProps
}
from
'antd/es/date-picker'
;
import
dayjs
from
'dayjs'
;
import
moment
from
'moment'
;
import
Image
from
'next/image'
;
import
{
useRouter
}
from
'next/router'
;
...
...
@@ -40,6 +39,7 @@ export interface ShopDetail {
export
default
function
EquipmentLeasingDetail
()
{
const
router
=
useRouter
();
// 全局上下文
const
{
userInfo
,
setNeedLogin
}
=
useContext
(
UserContext
);
const
[
id
,
setId
]
=
useState
<
number
|
null
>
(
null
);
...
...
@@ -93,6 +93,7 @@ export default function EquipmentLeasingDetail() {
const
Id
=
wareSkuList
?.
filter
((
item
)
=>
item
.
id
===
form
.
getFieldValue
(
'id'
))[
0
].
productSpec
;
if
(
Id
)
{
api
.
GoodsPriceDetail
({
leaseTerm
:
tag
,
productSpecId
:
Id
}).
then
((
res
)
=>
{
// console.log('discount --->', res.result);
setDiscount
(
res
.
result
);
});
}
...
...
@@ -190,6 +191,7 @@ export default function EquipmentLeasingDetail() {
formDate.resetFields();
};
// 规格点击事件
const handleChange = (tag: number, checked: boolean) => {
if (checked) {
const nextWareSkuList = checked ? tag : wareSkuList?.filter((t) => t.id !== tag)[0].id;
...
...
@@ -234,7 +236,20 @@ export default function EquipmentLeasingDetail() {
};
const disabledDate: RangePickerProps['disabledDate'] = (current) => {
return current && current < moment().endOf('day');
return current && current < dayjs().endOf('day');
};
// 生成价格
const getSpecPrice = () => {
const tagList = userInfo?.cooperationTagVOS?.map((i: { id: number }) => i.id) || [0];
// console.log('tagList --->', discount?.specPrice);
return (
tagList
.map((i: number) => discount?.specPrice.find((k) => k.cooperationTag === i))
// @ts-ignore
?.sort((a, b) => a.price - b.price)
?.at(0)?.price || 0
);
};
return (
...
...
@@ -343,7 +358,7 @@ export default function EquipmentLeasingDetail() {
<div className='right'>
<div className='top'>
<span className='tag'>¥</span>
<span className='money'>{
discount?.specPrice[0]?.price
|| 0}</span>
<span className='money'>{
getSpecPrice()
|| 0}</span>
<span className='unit'>/天</span>
</div>
<div className='bottom'>渠道免押金</div>
...
...
@@ -450,7 +465,7 @@ export default function EquipmentLeasingDetail() {
<div className='label'>租金合计</div>
<div className='price'>
<div className='left'>
¥{
discount?.specPrice[0]?.price
! * days! * form.getFieldValue('num') || 0}
¥{
getSpecPrice()
! * days! * form.getFieldValue('num') || 0}
</div>
{/* <div className="right">(日均175)</div> */}
</div>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论