Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
0b9a2c06
Commit
0b9a2c06
authored
Aug 27, 2021
by
chengkun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券数据对接
parent
87b0b658
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
56 deletions
+18
-56
build.gradle
Components/BUserOrder/build.gradle
+1
-1
VoncherAdapter.kt
.../com/yidian/shenghuoquan/border/adapter/VoncherAdapter.kt
+6
-6
CounponDto.kt
...ain/java/com/yidian/shenghuoquan/border/dto/CounponDto.kt
+0
-44
OrderDetailDto.kt
...java/com/yidian/shenghuoquan/border/dto/OrderDetailDto.kt
+1
-1
VoucherActivity.kt
...java/com/yidian/shenghuoquan/border/ui/VoucherActivity.kt
+10
-4
No files found.
Components/BUserOrder/build.gradle
View file @
0b9a2c06
...
...
@@ -16,7 +16,7 @@ android {
defaultConfig
{
if
(
rootProject
.
ext
.
android
.
isApplication
)
{
applicationId
"com.yidian.shenghuoquan.border"
applicationId
"com.yidian.shenghuoquan.b
user
order"
}
minSdkVersion
build_versions
.
minSdkVersion
targetSdkVersion
build_versions
.
targetSdkVersion
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/border/adapter/VoncherAdapter.kt
View file @
0b9a2c06
...
...
@@ -7,9 +7,9 @@ import android.view.ViewGroup
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
com.yidian.shenghuoquan.border.R
import
com.yidian.shenghuoquan.border.dto.Coupon
1
import
com.yidian.shenghuoquan.border.dto.Coupon
Dto
class
VoncherAdapter
(
var
context
:
Context
,
var
voncherList
:
List
<
Coupon
1
>)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
class
VoncherAdapter
(
var
context
:
Context
,
var
voncherList
:
List
<
Coupon
Dto
>)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
var
view
:
View
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
border_voncher_item
,
parent
,
false
)
var
holder
=
MyViewHoder
(
view
)
...
...
@@ -28,11 +28,11 @@ class VoncherAdapter(var context: Context, var voncherList:List<Coupon1>) : Recy
}
private
fun
mapDataToHoder
(
data
:
Coupon
1
,
holder
:
MyViewHoder
,
position
:
Int
)
{
private
fun
mapDataToHoder
(
data
:
Coupon
Dto
,
holder
:
MyViewHoder
,
position
:
Int
)
{
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_voncher_name
).
text
=
data
.
name
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_voncher_amount
).
text
=
data
.
coupon_amount
.
toString
()
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_start_end_time
).
text
=
"${data.start
_time} ${data.end_t
ime}"
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_voncher_type
).
text
=
"${data.
typ
e}"
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_voncher_amount
).
text
=
data
.
amount
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_start_end_time
).
text
=
"${data.start
Time} ${data.endT
ime}"
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_voncher_type
).
text
=
"${data.
scopeUs
e}"
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_voncher_desc
).
text
=
data
.
desc
}
}
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/border/dto/CounponDto.kt
deleted
100644 → 0
View file @
87b0b658
package
com.yidian.shenghuoquan.border.dto
import
android.os.Parcelable
import
com.google.gson.annotations.SerializedName
import
kotlinx.parcelize.Parcelize
data class
CounponDto
(
val
coupon_list
:
List
<
Coupon1
>
)
@Parcelize
data class
Coupon1
(
@SerializedName
(
"amount"
)
val
amount
:
String
,
@SerializedName
(
"counpon_amount"
)
val
coupon_amount
:
Int
,
@SerializedName
(
"coupon_id"
)
val
coupon_id
:
String
,
@SerializedName
(
"desc"
)
val
desc
:
String
,
@SerializedName
(
"end_time"
)
val
end_time
:
String
,
@SerializedName
(
"id"
)
val
id
:
String
,
@SerializedName
(
"jump_url"
)
val
jump_url
:
String
,
@SerializedName
(
"name"
)
val
name
:
String
,
@SerializedName
(
"start_time"
)
val
start_time
:
String
,
@SerializedName
(
"status"
)
val
status
:
Int
,
@SerializedName
(
"thumbnail"
)
val
thumbnail
:
String
,
@SerializedName
(
"type"
)
val
type
:
Int
,
@SerializedName
(
"use_activity_type"
)
val
use_activity_type
:
Int
,
@SerializedName
(
"use_amount_min"
)
val
use_amount_min
:
Int
,
@SerializedName
(
"use_amount_type"
)
val
use_amount_type
:
Int
,
@SerializedName
(
"use_shop_type"
)
val
use_shop_type
:
Int
)
:
Parcelable
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/border/dto/OrderDetailDto.kt
View file @
0b9a2c06
...
...
@@ -22,7 +22,7 @@ data class OrderDetailDto(
@SerializedName
(
"comment"
)
// 订单备注
val
comment
:
String
,
@SerializedName
(
"coupon_list"
)
// 优惠券信息
val
couponList
:
List
<
Coupon
1
>,
val
couponList
:
List
<
Coupon
Dto
>,
@SerializedName
(
"create_time"
)
val
createTime
:
String
,
@SerializedName
(
"discount_fee"
)
// 优惠金额
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/border/ui/VoucherActivity.kt
View file @
0b9a2c06
...
...
@@ -2,16 +2,19 @@ package com.yidian.shenghuoquan.border.ui
import
androidx.activity.viewModels
import
com.google.gson.Gson
import
com.yidian.bcommon.constant.IntentConstants
import
com.yidian.bcommon.constant.IntentConstants.KEY_EXTRA_COUPON_LIST
import
com.yidian.bcommon.constant.XRouterPathConstants
import
com.yidian.bcommon.constant.XRouterPathConstants.Companion.CHOOSE_VOUCHER_ACTIVITY
import
com.yidian.bcommon.extensions.initTitleBar
import
com.yidian.bcommon.mvvm.BaseMvvmActivity
import
com.yidian.news.ui.SystemBarUtils
import
com.yidian.shenghuoquan.border.R
import
com.yidian.shenghuoquan.border.adapter.VoncherAdapter
import
com.yidian.shenghuoquan.border.dto.CounponDto
import
com.yidian.shenghuoquan.border.utils.SpaceItemDecoration
import
com.yidian.shenghuoquan.border.viewmodel.VoncherViewModel
import
com.yidian.shenghuoquan.border.databinding.BorderActivityVoncherBinding
import
com.yidian.shenghuoquan.border.dto.CouponDto
import
com.yidian.xpage.XPageViewProtocol
class
VoucherActivity
:
BaseMvvmActivity
<
BorderActivityVoncherBinding
,
VoncherViewModel
>(),
XPageViewProtocol
{
...
...
@@ -36,8 +39,11 @@ class VoucherActivity : BaseMvvmActivity<BorderActivityVoncherBinding, VoncherVi
private
fun
initRecycleView
()
{
val
spacingInPixels
=
resources
.
getDimensionPixelSize
(
R
.
dimen
.
dp10
)
binding
.
rcvVoncherList
.
addItemDecoration
(
SpaceItemDecoration
(
spacingInPixels
))
val
voucherObj
=
Gson
().
fromJson
<
CounponDto
>(
HardCode
.
VoncherList
,
CounponDto
::
class
.
java
)
listAdapter
=
VoncherAdapter
(
this
,
voucherObj
.
coupon_list
)
binding
.
rcvVoncherList
.
adapter
=
listAdapter
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
?.
let
{
params
->
(
params
as
HashMap
<*,
*>).
let
{
listAdapter
=
VoncherAdapter
(
this
,
params
[
IntentConstants
.
KEY_EXTRA_COUPON_LIST
]
as
List
<
CouponDto
>)
binding
.
rcvVoncherList
.
adapter
=
listAdapter
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment