Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YPPos
Project
Project
Details
Activity
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
朱世闯
YPPos
Commits
973caaaf
Commit
973caaaf
authored
Jun 25, 2022
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增会员登录注册,并使用优惠券
parent
36362ce6
Hide whitespace changes
Inline
Side-by-side
Showing
64 changed files
with
2144 additions
and
174 deletions
+2144
-174
misc.xml
.idea/misc.xml
+33
-1
build.gradle
app/build.gradle
+2
-2
output-metadata.json
app/release/output-metadata.json
+3
-3
yppos_v100018-1.00.018-release-2022-06-24.apk
app/release/yppos_v100018-1.00.018-release-2022-06-24.apk
+0
-0
ApiService.kt
app/src/main/java/com/ypsx/yppos/http/ApiService.kt
+20
-3
CouponInfoResponse.kt
.../java/com/ypsx/yppos/http/data/bean/CouponInfoResponse.kt
+10
-0
CouponResponse.kt
...main/java/com/ypsx/yppos/http/data/bean/CouponResponse.kt
+10
-0
InsertOrderProductDTO.kt
...va/com/ypsx/yppos/http/data/bean/InsertOrderProductDTO.kt
+5
-3
MemberInfoResponse.kt
.../java/com/ypsx/yppos/http/data/bean/MemberInfoResponse.kt
+14
-0
OrderDetailsResponse.kt
...ava/com/ypsx/yppos/http/data/bean/OrderDetailsResponse.kt
+3
-0
PayAmountBean.kt
.../main/java/com/ypsx/yppos/http/data/bean/PayAmountBean.kt
+5
-3
ProductItemPromotionResponse.kt
...ypsx/yppos/http/data/bean/ProductItemPromotionResponse.kt
+3
-1
ProductPromotionsResponse.kt
...om/ypsx/yppos/http/data/bean/ProductPromotionsResponse.kt
+3
-2
AgeGroupEnum.kt
...main/java/com/ypsx/yppos/http/data/entity/AgeGroupEnum.kt
+12
-0
CancelCouponRequest.kt
...a/com/ypsx/yppos/http/data/request/CancelCouponRequest.kt
+10
-0
ConfirmRequest.kt
...n/java/com/ypsx/yppos/http/data/request/ConfirmRequest.kt
+7
-0
InsertOrderRequest.kt
...va/com/ypsx/yppos/http/data/request/InsertOrderRequest.kt
+2
-3
ProductPromotionRequest.kt
...m/ypsx/yppos/http/data/request/ProductPromotionRequest.kt
+4
-0
RegisterMemberRequest.kt
...com/ypsx/yppos/http/data/request/RegisterMemberRequest.kt
+9
-0
PosDatabase.kt
...src/main/java/com/ypsx/yppos/room/database/PosDatabase.kt
+34
-3
PosBuy.kt
app/src/main/java/com/ypsx/yppos/room/entity/PosBuy.kt
+7
-3
PosBuyPart.kt
app/src/main/java/com/ypsx/yppos/room/entity/PosBuyPart.kt
+2
-0
PosBuyPayment.kt
...src/main/java/com/ypsx/yppos/room/entity/PosBuyPayment.kt
+3
-2
PosBuyRepository.kt
...n/java/com/ypsx/yppos/room/repository/PosBuyRepository.kt
+18
-2
MainActivity.kt
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
+227
-104
OrderProductAdapter.kt
...ain/java/com/ypsx/yppos/ui/adapter/OrderProductAdapter.kt
+26
-3
ChooseAgeGroupPopupWindow.kt
...java/com/ypsx/yppos/ui/popup/ChooseAgeGroupPopupWindow.kt
+48
-0
GenderChoosePopupWindow.kt
...n/java/com/ypsx/yppos/ui/popup/GenderChoosePopupWindow.kt
+53
-0
MemberLoginPopupWindow.kt
...in/java/com/ypsx/yppos/ui/popup/MemberLoginPopupWindow.kt
+60
-0
MemberRegisterPopupWindow.kt
...java/com/ypsx/yppos/ui/popup/MemberRegisterPopupWindow.kt
+115
-0
MessageTipsPopupWindow.kt
...in/java/com/ypsx/yppos/ui/popup/MessageTipsPopupWindow.kt
+52
-0
OfferDetailsPopupWindow.kt
...n/java/com/ypsx/yppos/ui/popup/OfferDetailsPopupWindow.kt
+3
-1
OrderPayAmountPopupWindow.kt
...java/com/ypsx/yppos/ui/popup/OrderPayAmountPopupWindow.kt
+12
-1
ScanCouponPopupWindow.kt
...ain/java/com/ypsx/yppos/ui/popup/ScanCouponPopupWindow.kt
+89
-0
PrintUtils.kt
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
+109
-5
StringUtils.kt
app/src/main/java/com/ypsx/yppos/utils/StringUtils.kt
+8
-0
RequestMainViewModel.kt
.../com/ypsx/yppos/viewmodel/request/RequestMainViewModel.kt
+111
-20
MainViewModel.kt
...main/java/com/ypsx/yppos/viewmodel/state/MainViewModel.kt
+28
-0
MemberRegisterViewModel.kt
...com/ypsx/yppos/viewmodel/state/MemberRegisterViewModel.kt
+18
-0
MessageTipsViewModel.kt
...va/com/ypsx/yppos/viewmodel/state/MessageTipsViewModel.kt
+13
-0
OfferDetailsViewModel.kt
...a/com/ypsx/yppos/viewmodel/state/OfferDetailsViewModel.kt
+2
-0
OrderPayAmountViewModel.kt
...com/ypsx/yppos/viewmodel/state/OrderPayAmountViewModel.kt
+3
-0
bg_available_coupons.xml
app/src/main/res/drawable/bg_available_coupons.xml
+6
-0
bg_choose_dialog.xml
app/src/main/res/drawable/bg_choose_dialog.xml
+5
-0
bg_member.xml
app/src/main/res/drawable/bg_member.xml
+4
-0
bg_phone.xml
app/src/main/res/drawable/bg_phone.xml
+6
-0
ic_choose_down.xml
app/src/main/res/drawable/ic_choose_down.xml
+12
-0
ic_yp_member.xml
app/src/main/res/drawable/ic_yp_member.xml
+41
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+84
-6
item_pos_product.xml
app/src/main/res/layout/item_pos_product.xml
+3
-1
popup_choose_age_group.xml
app/src/main/res/layout/popup_choose_age_group.xml
+148
-0
popup_gender_choose.xml
app/src/main/res/layout/popup_gender_choose.xml
+123
-0
popup_member_login.xml
app/src/main/res/layout/popup_member_login.xml
+105
-0
popup_member_register.xml
app/src/main/res/layout/popup_member_register.xml
+199
-0
popup_message_tips.xml
app/src/main/res/layout/popup_message_tips.xml
+52
-0
popup_offer_details.xml
app/src/main/res/layout/popup_offer_details.xml
+34
-1
popup_order_pay_amount.xml
app/src/main/res/layout/popup_order_pay_amount.xml
+43
-1
popup_scan_coupon.xml
app/src/main/res/layout/popup_scan_coupon.xml
+69
-0
ic_main_logo.png
app/src/main/res/mipmap-hdpi/ic_main_logo.png
+0
-0
ic_main_logo.png
app/src/main/res/mipmap-mdpi/ic_main_logo.png
+0
-0
ic_main_logo.png
app/src/main/res/mipmap-xhdpi/ic_main_logo.png
+0
-0
ic_main_logo.png
app/src/main/res/mipmap-xxhdpi/ic_main_logo.png
+0
-0
ic_main_logo.png
app/src/main/res/mipmap-xxxhdpi/ic_main_logo.png
+0
-0
strings.xml
app/src/main/res/values/strings.xml
+14
-0
No files found.
.idea/misc.xml
View file @
973caaaf
...
@@ -3,22 +3,54 @@
...
@@ -3,22 +3,54 @@
<component
name=
"DesignSurface"
>
<component
name=
"DesignSurface"
>
<option
name=
"filePathToZoomLevelMap"
>
<option
name=
"filePathToZoomLevelMap"
>
<map>
<map>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_available_coupons.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_cancel_bg.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_cancel_bg.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_choose_dialog.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_dialog.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_dialog.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_dotted_line.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_item_count.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_item_product.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_loading.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_login.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_member.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_offer.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_pay_amount.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_pay_amount_check.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_phone.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_popup_offer_details.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_popup_offer_details.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_popup_pay.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_popup_settings_bottom.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_popup_settings_top.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_receive_payment.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_search.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_shadow.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/btn_cancel_bg.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/btn_confirm_bg.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/btn_confirm_bg.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/edit_bg.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/edit_bg.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/ic_chose_down.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/ic_discount_down.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/ic_popup_close.xml"
value=
"0.283"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/ic_print_receipt.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/ic_print_receipt.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/ic_synchronize_products.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/drawable/ic_synchronize_products.xml"
value=
"0.3508682328907048"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_login.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_login.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_main.xml"
value=
"0.
1634712411705348
3"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_main.xml"
value=
"0.
3
3"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_register.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_register.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/item_pos_product.xml"
value=
"0.5"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/item_pos_product.xml"
value=
"0.5"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_cash_pay.xml"
value=
"0.33"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_cash_pay.xml"
value=
"0.33"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_cash_pay_success.xml"
value=
"0.33"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_cash_pay_success.xml"
value=
"0.33"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_change_quantity.xml"
value=
"0.4703703703703704"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_change_quantity.xml"
value=
"0.4703703703703704"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_choose_age_group.xml"
value=
"0.2740036231884058"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_gender_choose.xml"
value=
"0.2740036231884058"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_member_login.xml"
value=
"0.2740036231884058"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_member_register.xml"
value=
"0.25"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_message.xml"
value=
"0.2740036231884058"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_message_tips.xml"
value=
"0.2740036231884058"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_offer_details.xml"
value=
"0.1"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_order_pay_amount.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_order_pay_amount.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_pay_amount.xml"
value=
"0.2740036231884058"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_pay_failed.xml"
value=
"0.2318840579710145"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_pay_success.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_pay_success.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_scan_coupon.xml"
value=
"0.2740036231884058"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_settings.xml"
value=
"0.16347124117053483"
/>
<entry
key=
"..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_settings.xml"
value=
"0.16347124117053483"
/>
</map>
</map>
</option>
</option>
...
...
app/build.gradle
View file @
973caaaf
...
@@ -15,8 +15,8 @@ android {
...
@@ -15,8 +15,8 @@ android {
applicationId
"com.ypsx.yppos"
applicationId
"com.ypsx.yppos"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
30
targetSdkVersion
30
versionCode
10001
7
versionCode
10001
8
versionName
"1.00.01
7
"
versionName
"1.00.01
8
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
}
...
...
app/release/output-metadata.json
View file @
973caaaf
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
{
{
"type"
:
"SINGLE"
,
"type"
:
"SINGLE"
,
"filters"
:
[],
"filters"
:
[],
"versionCode"
:
10001
7
,
"versionCode"
:
10001
8
,
"versionName"
:
"1.00.01
7
"
,
"versionName"
:
"1.00.01
8
"
,
"outputFile"
:
"yppos_v10001
7-1.00.017-release-2021-12-28
.apk"
"outputFile"
:
"yppos_v10001
8-1.00.018-release-2022-06-24
.apk"
}
}
]
]
}
}
\ No newline at end of file
app/release/yppos_v10001
7-1.00.017-release-2021-12-28
.apk
→
app/release/yppos_v10001
8-1.00.018-release-2022-06-24
.apk
View file @
973caaaf
No preview for this file type
app/src/main/java/com/ypsx/yppos/http/ApiService.kt
View file @
973caaaf
...
@@ -46,7 +46,7 @@ interface ApiService {
...
@@ -46,7 +46,7 @@ interface ApiService {
suspend
fun
posKickOff
(
@Body
request
:
KickoffRequest
):
ApiResponse
<
String
?
>
suspend
fun
posKickOff
(
@Body
request
:
KickoffRequest
):
ApiResponse
<
String
?
>
@POST
(
"/api/sys/user/refreshToken"
)
@POST
(
"/api/sys/user/refreshToken"
)
fun
refreshToken
(
@Body
request
:
RefreshTokenRequest
):
ApiResponse
<
RefreshTokenResponse
>
fun
refreshToken
(
@Body
request
:
RefreshTokenRequest
):
ApiResponse
<
RefreshTokenResponse
>
/**
/**
* 根据POS机Id查询POS机配置详情
* 根据POS机Id查询POS机配置详情
...
@@ -60,7 +60,7 @@ interface ApiService {
...
@@ -60,7 +60,7 @@ interface ApiService {
@GET
(
"newretail/api/mall/product/store/incrementDownload"
)
@GET
(
"newretail/api/mall/product/store/incrementDownload"
)
suspend
fun
getProductList
(
suspend
fun
getProductList
(
@Query
(
"storeId"
)
storeId
:
String
,
@Query
(
"storeId"
)
storeId
:
String
,
@Query
(
"updateTimeBigger"
)
updateTimeBigger
:
String
?
=
""
@Query
(
"updateTimeBigger"
)
updateTimeBigger
:
String
?
=
""
):
ApiResponse
<
List
<
PosProduct
>>
):
ApiResponse
<
List
<
PosProduct
>>
/**
/**
...
@@ -85,7 +85,6 @@ interface ApiService {
...
@@ -85,7 +85,6 @@ interface ApiService {
:
ApiResponse
<
List
<
SimplePosCommandResponse
>>
:
ApiResponse
<
List
<
SimplePosCommandResponse
>>
/**
/**
* 回复POS机命令,标记已收到命令,准备执行
* 回复POS机命令,标记已收到命令,准备执行
*/
*/
...
@@ -136,4 +135,22 @@ interface ApiService {
...
@@ -136,4 +135,22 @@ interface ApiService {
@GET
(
"newretail/api/sys/options/query"
)
@GET
(
"newretail/api/sys/options/query"
)
suspend
fun
getOptionsByKeys
(
@Query
(
"keys"
)
keys
:
String
=
CacheUtil
.
getAliYunKey
()):
ApiResponse
<
List
<
OptionsResponse
>>
suspend
fun
getOptionsByKeys
(
@Query
(
"keys"
)
keys
:
String
=
CacheUtil
.
getAliYunKey
()):
ApiResponse
<
List
<
OptionsResponse
>>
/**
* 根据手机号获取会员信息
*/
@GET
(
"newretail/api/mall/member/getMemberByMobile"
)
suspend
fun
getMemberByMobile
(
@Query
(
"mobile"
)
mobile
:
String
):
ApiResponse
<
MemberInfoResponse
?
>
/**
* 会员建档
*/
@POST
(
"newretail/api/mall/member/registerMember"
)
suspend
fun
registerMember
(
@Body
request
:
RegisterMemberRequest
):
ApiResponse
<
MemberInfoResponse
>
/**
* 释放优惠券
*/
@POST
(
"newretail/api/mall/promotion/cancelCoupon"
)
suspend
fun
cancelCoupon
(
@Body
request
:
CancelCouponRequest
):
ApiResponse
<
String
>
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/http/data/bean/CouponInfoResponse.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.http.data.bean
data class
CouponInfoResponse
(
var
fee
:
Int
=
0
,
var
mediaType
:
String
,
var
name
:
String
,
var
owner
:
String
,
var
userCouponCode
:
String
,
var
userCouponId
:
String
)
app/src/main/java/com/ypsx/yppos/http/data/bean/CouponResponse.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.http.data.bean
data class
CouponResponse
(
var
canUseCoupon
:
Boolean
,
var
canUseSkuId
:
List
<
String
>,
var
coupon
:
CouponInfoResponse
,
var
reason
:
String
,
)
app/src/main/java/com/ypsx/yppos/http/data/bean/InsertOrderProductDTO.kt
View file @
973caaaf
...
@@ -17,7 +17,7 @@ data class InsertOrderProductDTO(
...
@@ -17,7 +17,7 @@ data class InsertOrderProductDTO(
//是否虚拟商品
//是否虚拟商品
var
isVirtual
:
Boolean
=
false
,
var
isVirtual
:
Boolean
=
false
,
//会员价
//会员价
var
memberPrice
:
Double
=
0.0
,
var
memberPrice
:
Double
?
,
//商品名称
//商品名称
var
name
:
String
,
var
name
:
String
,
var
payApportionAmount
:
Double
=
0.0
,
var
payApportionAmount
:
Double
=
0.0
,
...
@@ -25,7 +25,7 @@ data class InsertOrderProductDTO(
...
@@ -25,7 +25,7 @@ data class InsertOrderProductDTO(
var
price
:
Double
,
var
price
:
Double
,
var
quantity
:
Double
,
var
quantity
:
Double
,
var
priceType
:
String
,
var
priceType
:
String
,
var
mnemonicCode
:
String
,
var
mnemonicCode
:
String
,
var
productId
:
String
,
var
productId
:
String
,
var
productNumber
:
String
,
var
productNumber
:
String
,
var
settlementPrice
:
Double
=
0.0
,
var
settlementPrice
:
Double
=
0.0
,
...
@@ -38,7 +38,9 @@ data class InsertOrderProductDTO(
...
@@ -38,7 +38,9 @@ data class InsertOrderProductDTO(
var
merchantItemId
:
String
?
=
null
,
var
merchantItemId
:
String
?
=
null
,
//称重码
//称重码
var
weightCode
:
String
?
=
null
,
var
weightCode
:
String
?
=
null
,
var
isPromotion
:
Boolean
=
false
var
isPromotion
:
Boolean
=
false
,
var
couponDivideTotal
:
Double
=
0.0
,
var
discountCouponPrice
:
Double
?
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/MemberInfoResponse.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.http.data.bean
data class
MemberInfoResponse
(
val
mobile
:
String
,
val
userId
:
String
,
val
nickName
:
String
,
val
birthday
:
String
,
val
avatar
:
String
=
""
,
//用户可用积分
val
point
:
String
=
""
,
//即将到期积分
val
aboutToExpirePoint
:
String
=
""
)
app/src/main/java/com/ypsx/yppos/http/data/bean/OrderDetailsResponse.kt
View file @
973caaaf
...
@@ -28,6 +28,9 @@ data class OrderDetailsResponse(
...
@@ -28,6 +28,9 @@ data class OrderDetailsResponse(
var
mobile
:
String
?
=
null
,
var
mobile
:
String
?
=
null
,
var
memberId
:
String
?
=
null
,
var
memberId
:
String
?
=
null
,
var
payments
:
List
<
PosBuyPayment
>,
var
payments
:
List
<
PosBuyPayment
>,
var
coupon
:
CouponInfoResponse
?,
var
userCouponFee
:
Double
?,
var
userCouponCode
:
String
?,
var
activitys
:
List
<
OrderActivityResponse
>?=
null
,
var
activitys
:
List
<
OrderActivityResponse
>?=
null
,
var
deleteProducts
:
List
<
PosBuyPart
>,
var
deleteProducts
:
List
<
PosBuyPart
>,
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/PayAmountBean.kt
View file @
973caaaf
...
@@ -7,7 +7,9 @@ data class PayAmountBean(
...
@@ -7,7 +7,9 @@ data class PayAmountBean(
var
discountTime
:
Double
=
0.0
,
//分时促销
var
discountTime
:
Double
=
0.0
,
//分时促销
var
discountSpecial
:
Double
=
0.0
,
//特价促销
var
discountSpecial
:
Double
=
0.0
,
//特价促销
var
amount
:
Double
=
0.0
,
//总价值
var
amount
:
Double
=
0.0
,
//总价值
var
listNum
:
Int
=
0
var
listNum
:
Int
=
0
,
var
discountMember
:
Double
=
0.0
,
//会员优惠
var
discountCoupon
:
Double
=
0.0
,
var
coupon
:
CouponInfoResponse
?
=
null
,
var
isFinal
:
Boolean
=
false
)
)
app/src/main/java/com/ypsx/yppos/http/data/bean/ProductItemPromotionResponse.kt
View file @
973caaaf
...
@@ -5,6 +5,8 @@ data class ProductItemPromotionResponse(
...
@@ -5,6 +5,8 @@ data class ProductItemPromotionResponse(
var
productId
:
String
,
var
productId
:
String
,
//价格成交类型,MEMBER_TYPE为会员价,SALE_TYPE为售价,UNRECOGNIZED_TYPE为未知类型
//价格成交类型,MEMBER_TYPE为会员价,SALE_TYPE为售价,UNRECOGNIZED_TYPE为未知类型
var
priceType
:
String
,
var
priceType
:
String
,
//优惠券的优惠金额
var
couponDivideTotal
:
Double
,
//原售价
//原售价
var
price
:
Double
,
var
price
:
Double
,
...
@@ -13,7 +15,7 @@ data class ProductItemPromotionResponse(
...
@@ -13,7 +15,7 @@ data class ProductItemPromotionResponse(
//商品级总优惠金额
//商品级总优惠金额
var
discountTotal
:
Double
,
var
discountTotal
:
Double
,
//会员价
//会员价
var
memberPrice
:
Double
,
var
memberPrice
:
Double
?
,
//商家商品Id
//商家商品Id
var
merchantItemId
:
String
?=
null
,
var
merchantItemId
:
String
?=
null
,
//商品行平摊实付金额, 退货时退货金额不能大于该值
//商品行平摊实付金额, 退货时退货金额不能大于该值
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/ProductPromotionsResponse.kt
View file @
973caaaf
...
@@ -3,8 +3,9 @@ package com.ypsx.yppos.http.data.bean
...
@@ -3,8 +3,9 @@ package com.ypsx.yppos.http.data.bean
data class
ProductPromotionsResponse
(
data class
ProductPromotionsResponse
(
var
orderNo
:
String
,
var
orderNo
:
String
,
var
shopId
:
String
,
var
shopId
:
String
,
var
orderPromotions
:
List
<
OrderActivityResponse
>?=
null
,
var
orderPromotions
:
List
<
OrderActivityResponse
>?
=
null
,
var
productPromotions
:
List
<
ProductItemPromotionResponse
>
var
productPromotions
:
List
<
ProductItemPromotionResponse
>,
var
coupon
:
CouponResponse
?
=
null
)
)
app/src/main/java/com/ypsx/yppos/http/data/entity/AgeGroupEnum.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.http.data.entity
enum
class
AgeGroupEnum
{
//小于30岁:
UNDER_30
,
//30-50岁:
BETWEEN_30_50
,
// 大于50:
ABOVE_50
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/http/data/request/CancelCouponRequest.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.http.data.request
import
com.ypsx.yppos.http.data.bean.CouponInfoResponse
data class
CancelCouponRequest
(
var
shopId
:
String
,
var
memberId
:
String
,
var
orderNo
:
String
,
var
unlockUserCoupon
:
CouponInfoResponse
)
app/src/main/java/com/ypsx/yppos/http/data/request/ConfirmRequest.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.http.data.request
data class
ConfirmRequest
(
var
isFinal
:
Boolean
=
false
,
var
userCouponCode
:
String
=
""
)
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/http/data/request/InsertOrderRequest.kt
View file @
973caaaf
package
com.ypsx.yppos.http.data.request
package
com.ypsx.yppos.http.data.request
import
com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import
com.ypsx.yppos.http.data.bean.*
import
com.ypsx.yppos.http.data.bean.OrderActivityResponse
import
com.ypsx.yppos.http.data.bean.OrderPayment
data class
InsertOrderRequest
(
data class
InsertOrderRequest
(
var
activitys
:
List
<
OrderActivityResponse
>?
=
null
,
var
activitys
:
List
<
OrderActivityResponse
>?
=
null
,
var
coupon
:
CouponInfoResponse
?=
null
,
var
createTime
:
String
,
var
createTime
:
String
,
var
creatorId
:
String
,
var
creatorId
:
String
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/request/ProductPromotionRequest.kt
View file @
973caaaf
...
@@ -8,6 +8,10 @@ data class ProductPromotionRequest(
...
@@ -8,6 +8,10 @@ data class ProductPromotionRequest(
//订单号
//订单号
var
orderNo
:
String
,
var
orderNo
:
String
,
var
memberId
:
String
=
""
,
var
confirm
:
ConfirmRequest
,
var
products
:
ArrayList
<
ProductItem
>
=
arrayListOf
()
var
products
:
ArrayList
<
ProductItem
>
=
arrayListOf
()
)
)
app/src/main/java/com/ypsx/yppos/http/data/request/RegisterMemberRequest.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.http.data.request
data class
RegisterMemberRequest
(
var
ageGroup
:
String
,
//会员性别 0 未知、1 男、2 女
var
gender
:
Int
,
var
mobile
:
String
,
var
shopId
:
String
)
app/src/main/java/com/ypsx/yppos/room/database/PosDatabase.kt
View file @
973caaaf
...
@@ -4,12 +4,16 @@ import android.content.Context
...
@@ -4,12 +4,16 @@ import android.content.Context
import
androidx.room.Database
import
androidx.room.Database
import
androidx.room.Room
import
androidx.room.Room
import
androidx.room.RoomDatabase
import
androidx.room.RoomDatabase
import
androidx.room.migration.Migration
import
androidx.sqlite.db.SupportSQLiteDatabase
import
com.ypsx.yppos.room.dao.*
import
com.ypsx.yppos.room.dao.*
import
com.ypsx.yppos.room.entity.*
import
com.ypsx.yppos.room.entity.*
const
val
name
:
String
=
"yp_pos.db"
const
val
name
:
String
=
"yp_pos.db"
@Database
(
@Database
(
entities
=
[
PosConfig
::
class
,
PosProduct
::
class
,
entities
=
[
PosConfig
::
class
,
PosProduct
::
class
,
PosBuy
::
class
,
PosBuyPart
::
class
,
PosBuyPayment
::
class
],
version
=
1
,
exportSchema
=
false
PosBuy
::
class
,
PosBuyPart
::
class
,
PosBuyPayment
::
class
],
version
=
3
,
exportSchema
=
false
)
)
abstract
class
PosDatabase
:
RoomDatabase
()
{
abstract
class
PosDatabase
:
RoomDatabase
()
{
...
@@ -37,7 +41,9 @@ abstract class PosDatabase : RoomDatabase() {
...
@@ -37,7 +41,9 @@ abstract class PosDatabase : RoomDatabase() {
context
.
applicationContext
,
context
.
applicationContext
,
PosDatabase
::
class
.
java
,
PosDatabase
::
class
.
java
,
name
name
).
allowMainThreadQueries
().
build
()
).
allowMainThreadQueries
()
.
addMigrations
(
MIGRATION_1_2
,
MIGRATION_2_3
)
.
build
()
INSTANCE
=
instance
INSTANCE
=
instance
return
instance
return
instance
}
}
...
@@ -46,5 +52,30 @@ abstract class PosDatabase : RoomDatabase() {
...
@@ -46,5 +52,30 @@ abstract class PosDatabase : RoomDatabase() {
fun
clearAllTables
()
{
fun
clearAllTables
()
{
INSTANCE
?.
clearAllTables
()
INSTANCE
?.
clearAllTables
()
}
}
var
MIGRATION_1_2
=
object
:
Migration
(
1
,
2
)
{
override
fun
migrate
(
database
:
SupportSQLiteDatabase
)
{
database
.
execSQL
(
"ALTER TABLE POS_Buy ADD COLUMN `userCouponCode` TEXT;"
)
database
.
execSQL
(
"ALTER TABLE POS_Buy ADD COLUMN `userCouponFee` REAL;"
)
}
}
var
MIGRATION_2_3
=
object
:
Migration
(
2
,
3
)
{
override
fun
migrate
(
database
:
SupportSQLiteDatabase
)
{
database
.
execSQL
(
"ALTER TABLE POS_Buy ADD COLUMN `memberPoint` TEXT;"
)
database
.
execSQL
(
"ALTER TABLE POS_BuyPart ADD COLUMN `memberPrice` REAL NOT NULL default 0;"
)
database
.
execSQL
(
"ALTER TABLE POS_BuyPart ADD COLUMN `priceType` TEXT NOT NULL default '';"
)
}
}
var
MIGRATION_3_4
=
object
:
Migration
(
3
,
4
)
{
override
fun
migrate
(
database
:
SupportSQLiteDatabase
)
{
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/room/entity/PosBuy.kt
View file @
973caaaf
...
@@ -18,8 +18,8 @@ data class PosBuy(
...
@@ -18,8 +18,8 @@ data class PosBuy(
var
promotionOnSaleTotal
:
Double
=
0.00
,
var
promotionOnSaleTotal
:
Double
=
0.00
,
var
totalAmount
:
Double
=
0.00
,
var
totalAmount
:
Double
=
0.00
,
var
roundPrice
:
Double
=
0.00
,
var
roundPrice
:
Double
=
0.00
,
var
type
:
String
,
var
type
:
String
,
var
buyNumber
:
String
,
var
buyNumber
:
String
,
var
remark
:
String
?
=
null
,
var
remark
:
String
?
=
null
,
var
einvoiceQrcodeUrl
:
String
=
""
,
var
einvoiceQrcodeUrl
:
String
=
""
,
...
@@ -31,5 +31,9 @@ data class PosBuy(
...
@@ -31,5 +31,9 @@ data class PosBuy(
var
creatorName
:
String
?
=
null
,
var
creatorName
:
String
?
=
null
,
var
activitys
:
String
?
=
null
,
var
activitys
:
String
?
=
null
,
var
mobile
:
String
?
=
null
,
var
mobile
:
String
?
=
null
,
var
memberId
:
String
?
=
null
var
memberId
:
String
?
=
null
,
var
userCouponFee
:
Double
?
=
0.0
,
var
userCouponCode
:
String
?
=
""
,
var
memberPoint
:
String
?
)
)
app/src/main/java/com/ypsx/yppos/room/entity/PosBuyPart.kt
View file @
973caaaf
...
@@ -39,10 +39,12 @@ data class PosBuyPart(
...
@@ -39,10 +39,12 @@ data class PosBuyPart(
var
style
:
String
?
=
null
,
var
style
:
String
?
=
null
,
var
pluLevel
:
String
?
=
null
,
var
pluLevel
:
String
?
=
null
,
var
activityType
:
String
?
=
null
,
var
activityType
:
String
?
=
null
,
var
priceType
:
String
,
var
payApportionAmount
:
Double
=
0.00
,
var
payApportionAmount
:
Double
=
0.00
,
var
activityPrice
:
Double
=
0.00
,
var
activityPrice
:
Double
=
0.00
,
var
price
:
Double
=
0.00
,
var
price
:
Double
=
0.00
,
var
memberPrice
:
Double
=
0.00
,
var
settlementPrice
:
Double
=
0.00
,
var
settlementPrice
:
Double
=
0.00
,
var
discountTotal
:
Double
=
0.00
,
var
discountTotal
:
Double
=
0.00
,
var
discountPrice
:
Double
=
0.00
,
var
discountPrice
:
Double
=
0.00
,
...
...
app/src/main/java/com/ypsx/yppos/room/entity/PosBuyPayment.kt
View file @
973caaaf
...
@@ -31,8 +31,9 @@ data class PosBuyPayment(
...
@@ -31,8 +31,9 @@ data class PosBuyPayment(
var
realPayMethod
:
String
?
=
null
,
var
realPayMethod
:
String
?
=
null
,
var
realPayFlowNo
:
String
?
=
null
,
var
realPayFlowNo
:
String
?
=
null
,
var
payFlowNo
:
String
,
var
payFlowNo
:
String
,
var
status
:
String
,
var
status
:
String
,
// var openId: String,
// var openId: String,
var
openId
:
String
?
=
null
,
var
openId
:
String
?
=
null
,
)
)
app/src/main/java/com/ypsx/yppos/room/repository/PosBuyRepository.kt
View file @
973caaaf
package
com.ypsx.yppos.room.repository
package
com.ypsx.yppos.room.repository
import
android.text.TextUtils
import
com.ypsx.base.base.appContext
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.toJson
import
com.ypsx.base.ext.util.toJson
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
...
@@ -12,6 +13,7 @@ import com.ypsx.yppos.room.entity.PosBuyPart
...
@@ -12,6 +13,7 @@ import com.ypsx.yppos.room.entity.PosBuyPart
import
com.ypsx.yppos.room.entity.PosBuyPayment
import
com.ypsx.yppos.room.entity.PosBuyPayment
import
com.ypsx.base.util.dXLog
import
com.ypsx.base.util.dXLog
import
com.ypsx.base.util.eXLog
import
com.ypsx.base.util.eXLog
import
com.ypsx.yppos.utils.DateUtil
class
PosBuyRepository
{
class
PosBuyRepository
{
...
@@ -35,7 +37,7 @@ class PosBuyRepository {
...
@@ -35,7 +37,7 @@ class PosBuyRepository {
return
PosDatabase
.
getDatabase
(
appContext
).
posBuyPaymentDao
()
return
PosDatabase
.
getDatabase
(
appContext
).
posBuyPaymentDao
()
}
}
fun
savePosBuy
(
orderResponse
:
OrderDetailsResponse
,
authCode
:
String
)
{
fun
savePosBuy
(
orderResponse
:
OrderDetailsResponse
,
authCode
:
String
,
memberPoint
:
String
)
{
orderResponse
.
toString
().
eXLog
()
orderResponse
.
toString
().
eXLog
()
val
isEmpty
=
orderResponse
.
activitys
?.
isEmpty
()
?:
true
val
isEmpty
=
orderResponse
.
activitys
?.
isEmpty
()
?:
true
val
activitys
=
if
(
isEmpty
)
""
else
orderResponse
.
activitys
.
toJson
()
val
activitys
=
if
(
isEmpty
)
""
else
orderResponse
.
activitys
.
toJson
()
...
@@ -61,11 +63,23 @@ class PosBuyRepository {
...
@@ -61,11 +63,23 @@ class PosBuyRepository {
activitys
=
activitys
,
activitys
=
activitys
,
type
=
orderResponse
.
type
,
type
=
orderResponse
.
type
,
mobile
=
orderResponse
.
mobile
,
mobile
=
orderResponse
.
mobile
,
memberId
=
orderResponse
.
memberId
memberId
=
orderResponse
.
memberId
,
userCouponCode
=
orderResponse
.
userCouponCode
,
userCouponFee
=
orderResponse
.
userCouponFee
,
memberPoint
=
memberPoint
)
)
getPosBuyDao
().
insert
(
posBuy
)
getPosBuyDao
().
insert
(
posBuy
)
for
(
payment
in
orderResponse
.
payments
)
{
for
(
payment
in
orderResponse
.
payments
)
{
payment
.
payCode
=
authCode
payment
.
payCode
=
authCode
if
(
TextUtils
.
isEmpty
(
payment
.
payFlowNo
))
{
payment
.
payFlowNo
=
""
}
if
(
TextUtils
.
isEmpty
(
payment
.
payTime
))
{
payment
.
payTime
=
DateUtil
.
getTodayDateTime
()
}
payment
.
toJson
().
dXLog
()
payment
.
toJson
().
dXLog
()
getPosBuyPaymentDao
().
insert
(
payment
)
getPosBuyPaymentDao
().
insert
(
payment
)
}
}
...
@@ -89,6 +103,7 @@ class PosBuyRepository {
...
@@ -89,6 +103,7 @@ class PosBuyRepository {
name
=
product
.
paymentProductName
,
name
=
product
.
paymentProductName
,
price
=
product
.
price
,
price
=
product
.
price
,
activityPrice
=
product
.
activityPrice
,
activityPrice
=
product
.
activityPrice
,
memberPrice
=
product
.
memberPrice
,
activitys
=
activity
,
activitys
=
activity
,
eaQty
=
0
,
eaQty
=
0
,
spec
=
product
.
spec
,
spec
=
product
.
spec
,
...
@@ -96,6 +111,7 @@ class PosBuyRepository {
...
@@ -96,6 +111,7 @@ class PosBuyRepository {
style
=
product
.
style
,
style
=
product
.
style
,
pluLevel
=
product
.
pluLevel
,
pluLevel
=
product
.
pluLevel
,
activityType
=
activityType
,
activityType
=
activityType
,
priceType
=
product
.
priceType
,
productNumber
=
product
.
productNumber
,
productNumber
=
product
.
productNumber
,
isVirtual
=
product
.
isVirtual
,
isVirtual
=
product
.
isVirtual
,
discountTotal
=
product
.
discountTotal
,
discountTotal
=
product
.
discountTotal
,
...
...
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
View file @
973caaaf
...
@@ -4,8 +4,10 @@ import android.device.ScanManager
...
@@ -4,8 +4,10 @@ import android.device.ScanManager
import
android.os.Bundle
import
android.os.Bundle
import
android.os.Process.killProcess
import
android.os.Process.killProcess
import
android.os.Process.myPid
import
android.os.Process.myPid
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.KeyEvent.KEYCODE_DEL
import
android.view.View
import
android.view.View
import
android.view.inputmethod.EditorInfo
import
android.view.inputmethod.EditorInfo
import
android.widget.TextView
import
android.widget.TextView
...
@@ -18,9 +20,12 @@ import com.ypsx.common.app.base.BaseActivity
...
@@ -18,9 +20,12 @@ import com.ypsx.common.app.base.BaseActivity
import
com.ypsx.common.app.ext.hideKeyboard
import
com.ypsx.common.app.ext.hideKeyboard
import
com.ypsx.yppos.R
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.ActivityMainBinding
import
com.ypsx.yppos.databinding.ActivityMainBinding
import
com.ypsx.yppos.http.data.bean.CouponInfoResponse
import
com.ypsx.yppos.http.data.bean.CouponResponse
import
com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import
com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import
com.ypsx.yppos.http.data.bean.OrderActivityResponse
import
com.ypsx.yppos.http.data.bean.OrderActivityResponse
import
com.ypsx.yppos.http.data.entity.PosPayMethod
import
com.ypsx.yppos.http.data.entity.PosPayMethod
import
com.ypsx.yppos.http.data.request.ConfirmRequest
import
com.ypsx.yppos.http.data.request.ProductItem
import
com.ypsx.yppos.http.data.request.ProductItem
import
com.ypsx.yppos.http.data.request.ProductPromotionRequest
import
com.ypsx.yppos.http.data.request.ProductPromotionRequest
import
com.ypsx.yppos.jobs.LogService
import
com.ypsx.yppos.jobs.LogService
...
@@ -33,11 +38,9 @@ import com.ypsx.yppos.utils.scan.ScanGunKeyEventHelper
...
@@ -33,11 +38,9 @@ import com.ypsx.yppos.utils.scan.ScanGunKeyEventHelper
import
com.ypsx.yppos.viewmodel.request.RequestMainViewModel
import
com.ypsx.yppos.viewmodel.request.RequestMainViewModel
import
com.ypsx.yppos.viewmodel.state.MainViewModel
import
com.ypsx.yppos.viewmodel.state.MainViewModel
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.activity_main.*
import
razerdp.basepopup.BasePopupWindow.
*
import
razerdp.basepopup.BasePopupWindow.
OnDismissListener
import
java.math.BigDecimal
import
java.math.BigDecimal
import
java.math.RoundingMode
import
java.math.RoundingMode
import
java.util.*
import
kotlin.collections.ArrayList
import
kotlin.system.exitProcess
import
kotlin.system.exitProcess
...
@@ -59,6 +62,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -59,6 +62,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
var
paySuccessPopWindow
:
PaySuccessPopWindow
?
=
null
var
paySuccessPopWindow
:
PaySuccessPopWindow
?
=
null
var
payFailedPopWindow
:
PayFailedPopWindow
?
=
null
var
payFailedPopWindow
:
PayFailedPopWindow
?
=
null
var
coupon
:
CouponInfoResponse
?
=
null
val
realName
:
String
=
CacheUtil
.
getRealName
()
val
realName
:
String
=
CacheUtil
.
getRealName
()
private
lateinit
var
tvListNum
:
TextView
private
lateinit
var
tvListNum
:
TextView
...
@@ -81,6 +88,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -81,6 +88,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
scanGunKeyEventHelper
?.
onDestroy
()
LogService
.
stop
(
this
)
LogService
.
stop
(
this
)
SyncProductService
.
stop
(
this
)
SyncProductService
.
stop
(
this
)
super
.
onDestroy
()
super
.
onDestroy
()
...
@@ -141,6 +149,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -141,6 +149,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
var
arrayList
=
ArrayList
<
InsertOrderProductDTO
>()
var
arrayList
=
ArrayList
<
InsertOrderProductDTO
>()
arrayList
.
addAll
(
data
)
arrayList
.
addAll
(
data
)
arrayList
.
addAll
(
posBuyPartsDeleted
)
arrayList
.
addAll
(
posBuyPartsDeleted
)
var
memberId
=
mViewModel
.
memberId
.
get
()
var
memberMobile
=
mViewModel
.
memberMobile
.
get
()
var
memberPoint
=
mViewModel
.
memberPoint
.
get
()
"$realName 付款方式:${payMethod.name} 支付码:$barcode"
.
dXLog
()
"$realName 付款方式:${payMethod.name} 支付码:$barcode"
.
dXLog
()
requestMainViewModel
.
createOrder
(
requestMainViewModel
.
createOrder
(
...
@@ -151,7 +162,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -151,7 +162,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
discountTotal
.
toDouble
(),
discountTotal
.
toDouble
(),
arrayList
,
arrayList
,
payMethod
,
payMethod
,
barcode
barcode
,
0.0
,
0.0
,
memberId
,
memberMobile
,
memberPoint
,
coupon
)
)
}
else
{
}
else
{
searchKey
(
barcode
)
searchKey
(
barcode
)
...
@@ -197,7 +209,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -197,7 +209,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
tvListNum
.
text
=
"购买商品列表(0)"
tvListNum
.
text
=
"购买商品列表(0)"
orderProductAdapter
.
addHeaderView
(
viewHeader
)
orderProductAdapter
.
addHeaderView
(
viewHeader
)
orderProductAdapter
.
run
{
orderProductAdapter
.
run
{
addChildClickViewIds
(
R
.
id
.
rl_item_delete
,
R
.
id
.
tv_count_add
,
R
.
id
.
tv_count_reduce
,
R
.
id
.
tv_count
)
addChildClickViewIds
(
R
.
id
.
rl_item_delete
,
R
.
id
.
tv_count_add
,
R
.
id
.
tv_count_reduce
,
R
.
id
.
tv_count
)
setOnItemChildClickListener
{
adapter
,
view
,
position
->
setOnItemChildClickListener
{
adapter
,
view
,
position
->
when
(
view
.
id
)
{
when
(
view
.
id
)
{
R
.
id
.
rl_item_delete
->
{
R
.
id
.
rl_item_delete
->
{
...
@@ -239,7 +256,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -239,7 +256,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
R
.
id
.
tv_count_add
->
{
R
.
id
.
tv_count_add
->
{
var
insertOrderProductDTO
=
orderProductAdapter
.
data
[
position
]
var
insertOrderProductDTO
=
orderProductAdapter
.
data
[
position
]
if
(
insertOrderProductDTO
.
quantity
>=
999
)
{
if
(
insertOrderProductDTO
.
quantity
>=
999
)
{
"重量/数量不能在加了"
.
toastSign
()
"重量/数量不能在加了"
.
toastSign
()
return
@setOnItemChildClickListener
return
@setOnItemChildClickListener
}
}
...
@@ -287,12 +304,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -287,12 +304,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
requestMainViewModel
.
request
(
productPromotionRequest
)
requestMainViewModel
.
request
(
productPromotionRequest
)
}
}
R
.
id
.
tv_count
->
{
R
.
id
.
tv_count
->
{
var
insertOrderProductDTO
=
orderProductAdapter
.
data
[
position
]
var
insertOrderProductDTO
=
orderProductAdapter
.
data
[
position
]
var
changeQuantityPopupWindow
=
ChangeQuantityPopupWindow
(
this
@MainActivity
)
var
changeQuantityPopupWindow
=
ChangeQuantityPopupWindow
(
this
@MainActivity
)
changeQuantityPopupWindow
.
showPopupWindow
()
changeQuantityPopupWindow
.
showPopupWindow
()
changeQuantityPopupWindow
.
setOrderProduct
(
insertOrderProductDTO
)
changeQuantityPopupWindow
.
setOrderProduct
(
insertOrderProductDTO
)
changeQuantityPopupWindow
.
setOnChangeClick
(
object
:
OnChangeClick
{
changeQuantityPopupWindow
.
setOnChangeClick
(
object
:
OnChangeClick
{
override
fun
cancel
()
{
override
fun
cancel
()
{
}
}
...
@@ -319,7 +336,6 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -319,7 +336,6 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
})
})
}
}
...
@@ -331,7 +347,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -331,7 +347,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
scanGunKeyEventHelper
?.
setOnBarCodeCatchListener
(
this
)
scanGunKeyEventHelper
?.
setOnBarCodeCatchListener
(
this
)
productPromotionRequest
=
ProductPromotionRequest
(
productPromotionRequest
=
ProductPromotionRequest
(
mViewModel
.
shopId
.
get
(),
mViewModel
.
shopId
.
get
(),
mViewModel
.
orderNo
.
get
()
mViewModel
.
orderNo
.
get
(),
mViewModel
.
memberId
.
get
(),
ConfirmRequest
()
)
)
et_search_content
.
setOnFocusChangeListener
{
v
,
hasFocus
->
et_search_content
.
setOnFocusChangeListener
{
v
,
hasFocus
->
if
(
hasFocus
)
{
if
(
hasFocus
)
{
...
@@ -352,6 +370,16 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -352,6 +370,16 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
inner
class
ProxyClick
{
inner
class
ProxyClick
{
fun
toLoginMember
()
{
var
memberLoginPopupWindow
=
MemberLoginPopupWindow
(
this
@MainActivity
)
memberLoginPopupWindow
.
showPopupWindow
()
memberLoginPopupWindow
.
setMemberLoginClick
{
it
.
dXLog
()
requestMainViewModel
.
getMemberByMobile
(
it
)
}
}
fun
settings
()
{
fun
settings
()
{
// mViewModel.orderNo.get().dXLog()
// mViewModel.orderNo.get().dXLog()
if
(
settingsPopupWindow
==
null
)
{
if
(
settingsPopupWindow
==
null
)
{
...
@@ -373,6 +401,24 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -373,6 +401,24 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
fun
onCoupon
()
{
if
(
orderProductAdapter
.
data
.
size
>
0
)
{
val
scanCouponPopupWindow
=
ScanCouponPopupWindow
(
this
@MainActivity
,
scanGunKeyEventHelper
!!
)
scanCouponPopupWindow
.
showPopupWindow
()
scanCouponPopupWindow
.
setScanCouponClick
{
scanCouponPopupWindow
.
dismiss
()
productPromotionRequest
.
confirm
=
ConfirmRequest
(
true
,
it
)
requestMainViewModel
.
request
(
productPromotionRequest
)
}
}
else
{
val
messageDialog
=
MessageTipsPopupWindow
(
this
@MainActivity
)
messageDialog
.
showPopupWindow
()
messageDialog
.
setData
(
"请先商品过机再核销优惠券"
,
"我知道了"
)
}
}
//关闭提示
//关闭提示
fun
tips
()
{
fun
tips
()
{
"${realName}关闭提示"
.
dXLog
()
"${realName}关闭提示"
.
dXLog
()
...
@@ -387,10 +433,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -387,10 +433,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
mViewModel
.
discount
.
get
(),
mViewModel
.
discount
.
get
(),
mViewModel
.
discountSpecial
.
get
(),
mViewModel
.
discountSpecial
.
get
(),
mViewModel
.
discountMoney
.
get
(),
mViewModel
.
discountMoney
.
get
(),
mViewModel
.
discountTime
.
get
()
mViewModel
.
discountTime
.
get
(),
mViewModel
.
discountMember
.
get
()
)
)
iv_arrow
.
setImageResource
(
R
.
drawable
.
ic_discount_down
)
iv_arrow
.
setImageResource
(
R
.
drawable
.
ic_discount_down
)
offerDetailsPopupWindow
.
onDismissListener
=
object
:
offerDetailsPopupWindow
.
onDismissListener
=
object
:
OnDismissListener
()
{
OnDismissListener
()
{
override
fun
onDismiss
()
{
override
fun
onDismiss
()
{
...
@@ -401,82 +447,104 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -401,82 +447,104 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
fun
payAmount
()
{
fun
payAmount
()
{
val
payment
=
mViewModel
.
payAmount
.
get
()
var
memberId
=
mViewModel
.
memberId
.
get
()
val
orderNo
=
mViewModel
.
orderNo
.
get
()
if
(!
TextUtils
.
isEmpty
(
memberId
))
{
val
orderPayAmountPopupWindow
=
OrderPayAmountPopupWindow
(
this
@MainActivity
)
productPromotionRequest
.
confirm
=
ConfirmRequest
(
true
,
""
)
orderPayAmountPopupWindow
.
showPopupWindow
()
requestMainViewModel
.
request
(
productPromotionRequest
)
orderPayAmountPopupWindow
.
setData
(
orderNo
,
payment
)
}
else
{
orderPayAmountPopupWindow
.
setPayClick
{
it
->
payAmountPopup
()
orderPayAmountPopupWindow
.
dismiss
()
}
if
(
it
==
PosPayMethod
.
CASHPAY
)
{
}
val
cashRoundMode
=
mViewModel
.
cashRoundMode
.
get
()
}
val
rawData
=
BigDecimal
(
payment
)
val
scale
=
rawData
.
setScale
(
1
,
if
(
cashRoundMode
==
0
)
RoundingMode
.
HALF_UP
else
RoundingMode
.
DOWN
)
if
(
scale
.
toDouble
()
<
0.1
)
{
"现金收款金额不能小于0.1元"
.
toastFailed
()
return
@setPayClick
}
val
cashPayPopupWindow
=
CashPayPopupWindow
(
this
@MainActivity
)
private
fun
payAmountPopup
()
{
cashPayPopupWindow
.
showPopupWindow
()
val
payment
=
mViewModel
.
payAmount
.
get
()
cashPayPopupWindow
.
setData
(
it
,
payment
,
cashRoundMode
)
val
orderNo
=
mViewModel
.
orderNo
.
get
()
cashPayPopupWindow
.
setCashPayClick
{
payMethod
,
receivablesMoney
,
roundMoney
,
changeMoney
,
payMoney
->
val
discountCoupon
=
mViewModel
.
discountCoupon
.
get
()
cashPayPopupWindow
.
dismiss
()
val
orderPayAmountPopupWindow
=
OrderPayAmountPopupWindow
(
this
@MainActivity
)
var
orderNo
=
mViewModel
.
orderNo
.
get
()
orderPayAmountPopupWindow
.
showPopupWindow
()
var
totalAmount
=
mViewModel
.
payAmount
.
get
()
orderPayAmountPopupWindow
.
setData
(
orderNo
,
payment
,
discountCoupon
)
var
payAmount
=
mViewModel
.
payAmount
.
get
()
orderPayAmountPopupWindow
.
setPayClick
{
it
->
var
promotionOnSaleTotal
=
mViewModel
.
discountSpecial
.
get
()
orderPayAmountPopupWindow
.
dismiss
()
var
discountTotal
=
mViewModel
.
discountMoney
.
get
()
if
(
it
==
PosPayMethod
.
CASHPAY
)
{
var
data
=
orderProductAdapter
.
data
val
cashRoundMode
=
mViewModel
.
cashRoundMode
.
get
()
var
arrayList
=
ArrayList
<
InsertOrderProductDTO
>()
val
rawData
=
BigDecimal
(
payment
)
arrayList
.
addAll
(
data
)
val
scale
=
rawData
.
setScale
(
arrayList
.
addAll
(
posBuyPartsDeleted
)
1
,
"$realName 付款方式:${payMethod.name} "
.
dXLog
()
if
(
cashRoundMode
==
0
)
RoundingMode
.
HALF_UP
else
RoundingMode
.
DOWN
requestMainViewModel
.
createOrder
(
)
orderNo
,
if
(
scale
.
toDouble
()
<
0.1
)
{
totalAmount
.
toDouble
(),
"现金收款金额不能小于0.1元"
.
toastFailed
()
payAmount
.
toDouble
(),
return
@setPayClick
promotionOnSaleTotal
.
toDouble
(),
}
discountTotal
.
toDouble
(),
arrayList
,
payMethod
,
""
,
roundMoney
,
changeMoney
)
}
}
else
{
val
cashPayPopupWindow
=
CashPayPopupWindow
(
this
@MainActivity
)
payAmountPopupWindow
=
PayAmountPopupWindow
(
this
@MainActivity
)
cashPayPopupWindow
.
showPopupWindow
()
payAmountPopupWindow
?.
showPopupWindow
()
cashPayPopupWindow
.
setData
(
it
,
payment
,
cashRoundMode
)
payAmountPopupWindow
?.
setData
(
it
,
payment
)
cashPayPopupWindow
.
setCashPayClick
{
payMethod
,
receivablesMoney
,
roundMoney
,
changeMoney
,
payMoney
->
payAmountPopupWindow
?.
onDismissListener
=
object
:
cashPayPopupWindow
.
dismiss
()
OnDismissListener
()
{
var
orderNo
=
mViewModel
.
orderNo
.
get
()
override
fun
onDismiss
()
{
var
totalAmount
=
mViewModel
.
payAmount
.
get
()
payAmountPopupWindow
=
null
var
payAmount
=
mViewModel
.
payAmount
.
get
()
}
var
promotionOnSaleTotal
=
mViewModel
.
discountSpecial
.
get
()
}
var
discountTotal
=
mViewModel
.
discountMoney
.
get
()
payAmountPopupWindow
?.
setKeyEventListener
{
event
->
var
data
=
orderProductAdapter
.
data
scanGunKeyEventHelper
?.
analysisKeyEvent
(
event
)
var
arrayList
=
ArrayList
<
InsertOrderProductDTO
>()
return
@setKeyEventListener
true
arrayList
.
addAll
(
data
)
arrayList
.
addAll
(
posBuyPartsDeleted
)
var
memberId
=
mViewModel
.
memberId
.
get
()
var
memberMobile
=
mViewModel
.
memberMobile
.
get
()
var
memberPoint
=
mViewModel
.
memberPoint
.
get
()
"$realName 付款方式:${payMethod.name} "
.
dXLog
()
requestMainViewModel
.
createOrder
(
orderNo
,
totalAmount
.
toDouble
(),
payAmount
.
toDouble
(),
promotionOnSaleTotal
.
toDouble
(),
discountTotal
.
toDouble
(),
arrayList
,
payMethod
,
""
,
roundMoney
,
changeMoney
,
memberId
,
memberMobile
,
memberPoint
,
coupon
)
}
}
else
{
payAmountPopupWindow
=
PayAmountPopupWindow
(
this
@MainActivity
)
payAmountPopupWindow
?.
showPopupWindow
()
payAmountPopupWindow
?.
setData
(
it
,
payment
)
payAmountPopupWindow
?.
onDismissListener
=
object
:
OnDismissListener
()
{
override
fun
onDismiss
()
{
payAmountPopupWindow
=
null
}
}
payAmountPopupWindow
?.
setFinishClick
{
}
payAmountPopupWindow
?.
dismiss
()
payAmountPopupWindow
?.
setKeyEventListener
{
event
->
"${realName}支付超时"
.
dXLog
()
scanGunKeyEventHelper
?.
analysisKeyEvent
(
event
)
val
messageDialog
=
MessagePopupWindow
(
this
@MainActivity
)
return
@setKeyEventListener
true
messageDialog
.
showPopupWindow
()
}
messageDialog
.
setData
(
"支付超时"
,
"请确认是否支付成功"
,
gone
=
false
)
payAmountPopupWindow
?.
setFinishClick
{
messageDialog
.
setMessageClick
{
payAmountPopupWindow
?.
dismiss
()
messageDialog
.
dismiss
()
"${realName}支付超时"
.
dXLog
()
mViewModel
.
resetOrderNo
()
val
messageDialog
=
MessagePopupWindow
(
this
@MainActivity
)
productPromotionRequest
.
orderNo
=
mViewModel
.
orderNo
.
get
()
messageDialog
.
showPopupWindow
()
"${realName}点击我知道了,并重置小票号:${productPromotionRequest.orderNo}"
.
dXLog
()
messageDialog
.
setData
(
"支付超时"
,
"请确认是否支付成功"
,
gone
=
false
)
}
messageDialog
.
setMessageClick
{
messageDialog
.
dismiss
()
mViewModel
.
resetOrderNo
()
productPromotionRequest
.
orderNo
=
mViewModel
.
orderNo
.
get
()
"${realName}点击我知道了,并重置小票号:${productPromotionRequest.orderNo}"
.
dXLog
()
}
}
}
}
}
}
}
}
orderPayAmountPopupWindow
.
setCancelPayAction
{
if
(
coupon
==
null
)
{
return
@setCancelPayAction
}
val
memberId
=
mViewModel
.
memberId
.
get
()
val
shopId
=
mViewModel
.
shopId
.
get
()
requestMainViewModel
.
cancelCoupon
(
shopId
,
memberId
,
orderNo
,
coupon
!!
)
}
}
}
private
fun
searchKey
(
searchContent
:
String
)
{
private
fun
searchKey
(
searchContent
:
String
)
{
...
@@ -500,7 +568,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -500,7 +568,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
override
fun
createObserver
()
{
override
fun
createObserver
()
{
requestMainViewModel
.
productItemData
.
observe
(
this
,
{
requestMainViewModel
.
productItemData
.
observe
(
this
)
{
productPromotionRequest
.
products
.
clear
()
productPromotionRequest
.
products
.
clear
()
if
(
orderProductAdapter
.
data
.
size
>
0
)
{
if
(
orderProductAdapter
.
data
.
size
>
0
)
{
val
data
=
orderProductAdapter
.
data
val
data
=
orderProductAdapter
.
data
...
@@ -517,12 +585,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -517,12 +585,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
et_search_content
.
text
?.
clear
()
et_search_content
.
text
?.
clear
()
productPromotionRequest
.
products
.
add
(
it
)
productPromotionRequest
.
products
.
add
(
it
)
requestMainViewModel
.
request
(
productPromotionRequest
)
requestMainViewModel
.
request
(
productPromotionRequest
)
}
)
}
requestMainViewModel
.
productPromotionsResponse
.
observe
(
this
,
{
// requestMainViewModel.productPromotionsResponse.observe(this)
{
requestMainViewModel
.
queryAllIn
(
it
)
////
requestMainViewModel.queryAllIn(it)
})
// }
requestMainViewModel
.
posBuyPartList
.
observe
(
this
,
{
requestMainViewModel
.
posBuyPartList
.
observe
(
this
)
{
val
recyclerShow
=
mViewModel
.
recyclerShow
.
get
()
val
recyclerShow
=
mViewModel
.
recyclerShow
.
get
()
if
(!
recyclerShow
)
{
if
(!
recyclerShow
)
{
mViewModel
.
recyclerShow
.
set
(
true
)
mViewModel
.
recyclerShow
.
set
(
true
)
...
@@ -533,16 +601,22 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -533,16 +601,22 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
RecyclerViewUtil
.
smoothMoveToPosition
(
mDatabind
.
recyclerView
,
size
-
1
)
RecyclerViewUtil
.
smoothMoveToPosition
(
mDatabind
.
recyclerView
,
size
-
1
)
// mDatabind.recyclerView.smoothScrollToPosition()
// mDatabind.recyclerView.smoothScrollToPosition()
}
)
}
requestMainViewModel
.
payState
.
observe
(
this
,
{
requestMainViewModel
.
payState
.
observe
(
this
)
{
if
(
it
.
isSuccess
)
{
if
(
it
.
isSuccess
)
{
val
orderId
=
it
.
data
?.
orderId
val
orderId
=
it
.
data
?.
orderId
val
total
=
it
.
data
?.
total
val
total
=
it
.
data
?.
total
var
authCode
=
it
.
data
?.
authCode
var
authCode
=
it
.
data
?.
authCode
var
memberPoint
=
mViewModel
.
memberPoint
.
get
()
if
(
payAmountPopupWindow
!=
null
&&
payAmountPopupWindow
!!
.
isShowing
&&
payAmountPopupWindow
!!
.
timeIsStart
())
{
if
(
payAmountPopupWindow
!=
null
&&
payAmountPopupWindow
!!
.
isShowing
&&
payAmountPopupWindow
!!
.
timeIsStart
())
{
payAmountPopupWindow
?.
setShowTimer
()
payAmountPopupWindow
?.
setShowTimer
()
requestMainViewModel
.
getStateByOrderId
(
orderId
!!
,
total
!!
,
authCode
!!
)
requestMainViewModel
.
getStateByOrderId
(
orderId
!!
,
total
!!
,
authCode
!!
,
memberPoint
)
}
}
//支付成功后,
//支付成功后,
// 获取支付状态
// 获取支付状态
...
@@ -551,21 +625,28 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -551,21 +625,28 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
it
.
errorMsg
.
toast
()
it
.
errorMsg
.
toast
()
}
}
}
)
}
requestMainViewModel
.
payAmountBean
.
observe
(
this
,
{
requestMainViewModel
.
payAmountBean
.
observe
(
this
)
{
mViewModel
.
discountMoney
.
set
(
it
.
discountMoney
.
toString
())
mViewModel
.
discountMoney
.
set
(
it
.
discountMoney
.
toString
())
mViewModel
.
discountTime
.
set
(
it
.
discountTime
.
toString
())
mViewModel
.
discountTime
.
set
(
it
.
discountTime
.
toString
())
mViewModel
.
discountSpecial
.
set
(
it
.
discountSpecial
.
toString
())
mViewModel
.
discountSpecial
.
set
(
it
.
discountSpecial
.
toString
())
mViewModel
.
discount
.
set
(
it
.
discountTotal
.
toString
())
mViewModel
.
discount
.
set
(
it
.
discountTotal
.
toString
())
mViewModel
.
payAmount
.
set
(
it
.
payApportionAmount
.
toString
())
mViewModel
.
payAmount
.
set
(
it
.
payApportionAmount
.
toString
())
mViewModel
.
discountMember
.
set
(
it
.
discountMember
.
toString
())
mViewModel
.
discountCoupon
.
set
(
it
.
discountCoupon
.
toString
())
mViewModel
.
amount
.
set
(
it
.
amount
)
mViewModel
.
amount
.
set
(
it
.
amount
)
// mViewModel.productsNum.set(it.listNum)
// mViewModel.productsNum.set(it.listNum)
tvListNum
.
text
=
"购买商品列表(${it.listNum})"
tvListNum
.
text
=
"购买商品列表(${it.listNum})"
})
requestMainViewModel
.
paySuccessState
.
observe
(
this
,
{
if
(
it
.
isFinal
)
{
coupon
=
it
.
coupon
payAmountPopup
()
}
}
requestMainViewModel
.
paySuccessState
.
observe
(
this
)
{
if
(
payAmountPopupWindow
!=
null
)
{
if
(
payAmountPopupWindow
!=
null
)
{
payAmountPopupWindow
!!
.
dismiss
()
payAmountPopupWindow
!!
.
dismiss
()
}
}
...
@@ -600,9 +681,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -600,9 +681,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
})
})
}
}
}
)
}
requestMainViewModel
.
paySuccessStateCash
.
observe
(
this
,
{
requestMainViewModel
.
paySuccessStateCash
.
observe
(
this
)
{
val
payAmount
=
val
payAmount
=
BigDecimal
(
it
.
data
!!
.
payAmount
).
minus
(
BigDecimal
.
valueOf
(
it
.
data
!!
.
roundPrice
))
BigDecimal
(
it
.
data
!!
.
payAmount
).
minus
(
BigDecimal
.
valueOf
(
it
.
data
!!
.
roundPrice
))
.
plus
(
.
plus
(
...
@@ -616,20 +697,20 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -616,20 +697,20 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
paySuccessView
()
paySuccessView
()
}
}
}
}
}
)
}
requestMainViewModel
.
syncProductsState
.
observe
(
this
,
{
requestMainViewModel
.
syncProductsState
.
observe
(
this
)
{
dismissLoading
()
dismissLoading
()
if
(!
it
.
isSuccess
)
{
if
(!
it
.
isSuccess
)
{
it
.
errorMsg
.
toastFailed
()
it
.
errorMsg
.
toastFailed
()
}
}
}
)
}
requestMainViewModel
.
posProduct
.
observe
(
this
,
{
requestMainViewModel
.
posProduct
.
observe
(
this
)
{
val
changeQuantityPopupWindow
=
ChangeQuantityPopupWindow
(
this
)
val
changeQuantityPopupWindow
=
ChangeQuantityPopupWindow
(
this
)
changeQuantityPopupWindow
.
showPopupWindow
()
changeQuantityPopupWindow
.
showPopupWindow
()
changeQuantityPopupWindow
.
setPosProduct
(
it
)
changeQuantityPopupWindow
.
setPosProduct
(
it
)
changeQuantityPopupWindow
.
setOnChangeClick
(
object
:
OnChangeClick
{
changeQuantityPopupWindow
.
setOnChangeClick
(
object
:
OnChangeClick
{
override
fun
cancel
()
{
override
fun
cancel
()
{
et_search_content
.
text
?.
clear
()
et_search_content
.
text
?.
clear
()
}
}
...
@@ -645,7 +726,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -645,7 +726,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
posProduct
.
spec
.
toDouble
(),
posProduct
.
spec
.
toDouble
(),
posProduct
.
sellPrice
posProduct
.
sellPrice
)
)
requestMainViewModel
.
addPluRelation
(
""
,
posProduct
.
id
)
requestMainViewModel
.
addPluRelation
(
""
,
posProduct
.
id
)
productPromotionRequest
.
products
.
clear
()
productPromotionRequest
.
products
.
clear
()
if
(
orderProductAdapter
.
data
.
size
>
0
)
{
if
(
orderProductAdapter
.
data
.
size
>
0
)
{
val
data
=
orderProductAdapter
.
data
val
data
=
orderProductAdapter
.
data
...
@@ -665,9 +746,45 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -665,9 +746,45 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
}
}
})
})
})
}
requestMainViewModel
.
memberInfoState
.
observe
(
this
)
{
if
(
it
.
isSuccess
)
{
var
data
=
it
.
data
mDatabind
.
vm
?.
memberMobile
?.
set
(
data
?.
mobile
)
mDatabind
.
vm
?.
memberId
?.
set
(
data
?.
userId
)
mDatabind
.
vm
?.
memberShow
?.
set
(
true
)
mDatabind
.
vm
?.
memberPoint
?.
set
(
data
?.
point
)
mDatabind
.
vm
?.
memberMobileInfo
?.
set
(
"会员信息:${data?.mobile}"
)
productPromotionRequest
.
memberId
=
mDatabind
.
vm
?.
memberId
!!
.
get
()
"会员登录成功"
.
toast
()
if
(
orderProductAdapter
.
data
.
size
>
0
)
{
requestMainViewModel
.
request
(
productPromotionRequest
)
}
}
else
{
//it.errorMsg = 手机号
var
memberRegisterPopupWindow
=
MemberRegisterPopupWindow
(
this
)
memberRegisterPopupWindow
.
showPopupWindow
()
memberRegisterPopupWindow
.
setMobile
(
it
.
errorMsg
)
memberRegisterPopupWindow
.
setRegisterMemberClick
{
mobile
,
gender
,
ageGroup
->
requestMainViewModel
.
registerMember
(
mobile
,
gender
,
ageGroup
,
shopId
=
mViewModel
.
shopId
.
get
()
)
}
}
}
requestMainViewModel
.
cancelCouponState
.
observe
(
this
)
{
if
(
it
.
isSuccess
)
{
productPromotionRequest
.
confirm
.
isFinal
=
false
productPromotionRequest
.
confirm
.
userCouponCode
=
""
coupon
=
null
requestMainViewModel
.
request
(
productPromotionRequest
)
}
}
}
}
private
fun
paySuccessView
()
{
private
fun
paySuccessView
()
{
...
@@ -675,6 +792,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -675,6 +792,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
mViewModel
.
resetAmount
()
mViewModel
.
resetAmount
()
productPromotionRequest
.
orderNo
=
mViewModel
.
orderNo
.
get
()
productPromotionRequest
.
orderNo
=
mViewModel
.
orderNo
.
get
()
productPromotionRequest
.
products
.
clear
()
productPromotionRequest
.
products
.
clear
()
productPromotionRequest
.
memberId
=
""
productPromotionRequest
.
confirm
.
isFinal
=
false
productPromotionRequest
.
confirm
.
userCouponCode
=
""
coupon
=
null
posBuyPartsDeleted
.
clear
()
posBuyPartsDeleted
.
clear
()
mViewModel
.
recyclerShow
.
set
(
false
)
mViewModel
.
recyclerShow
.
set
(
false
)
orderProductAdapter
.
data
.
clear
()
orderProductAdapter
.
data
.
clear
()
...
...
app/src/main/java/com/ypsx/yppos/ui/adapter/OrderProductAdapter.kt
View file @
973caaaf
package
com.ypsx.yppos.ui.adapter
package
com.ypsx.yppos.ui.adapter
import
android.graphics.Color
import
android.graphics.Color
import
android.text.SpannableString
import
android.text.SpannableStringBuilder
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.text.Spanned
import
android.text.style.ImageSpan
import
android.widget.TextView
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.ypsx.base.ext.util.dp2px
import
com.ypsx.yppos.R
import
com.ypsx.yppos.R
import
com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import
com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import
com.ypsx.yppos.http.data.entity.PosProductStyle
import
com.ypsx.yppos.http.data.entity.PosProductStyle
...
@@ -22,10 +26,10 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
...
@@ -22,10 +26,10 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
item
.
run
{
item
.
run
{
when
(
style
)
{
when
(
style
)
{
PosProductStyle
.
SINGLE
.
name
->
holder
.
setText
(
R
.
id
.
tv_barCode
,
"条码:$barCode"
)
PosProductStyle
.
SINGLE
.
name
->
holder
.
setText
(
R
.
id
.
tv_barCode
,
"条码:$barCode"
)
PosProductStyle
.
WEIGHT
.
name
->
{
PosProductStyle
.
WEIGHT
.
name
->
{
if
(
weightCode
.
isNullOrEmpty
())
{
if
(
weightCode
.
isNullOrEmpty
())
{
holder
.
setText
(
R
.
id
.
tv_barCode
,
"PLU:$mnemonicCode"
)
holder
.
setText
(
R
.
id
.
tv_barCode
,
"PLU:$mnemonicCode"
)
}
else
{
}
else
{
holder
.
setText
(
R
.
id
.
tv_barCode
,
"PLU:$weightCode"
)
holder
.
setText
(
R
.
id
.
tv_barCode
,
"PLU:$weightCode"
)
}
}
}
}
...
@@ -43,7 +47,26 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
...
@@ -43,7 +47,26 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
ssb
.
setSpan
(
roundBackgroundColorSpan
,
0
,
2
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
ssb
.
setSpan
(
roundBackgroundColorSpan
,
0
,
2
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
holder
.
setText
(
R
.
id
.
tv_name
,
ssb
)
holder
.
setText
(
R
.
id
.
tv_name
,
ssb
)
}
else
{
}
else
{
holder
.
setText
(
R
.
id
.
tv_name
,
name
)
if
(
priceType
==
"MEMBER_TYPE"
)
{
// val view = holder.getView<TextView>(R.id.tv_name)
var
drawable
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
ic_yp_member
,
null
)
drawable
.
setBounds
(
0
,
0
,
context
.
dp2px
(
16
),
context
.
dp2px
(
16
))
// view.setCompoundDrawables(
// drawable,
// null, null, null
// );
// view.compoundDrawablePadding = context.dp2px(5)
val
ssb
=
SpannableStringBuilder
(
"1 $name"
)
ssb
.
setSpan
(
ImageSpan
(
drawable
),
0
,
1
,
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
holder
.
setText
(
R
.
id
.
tv_name
,
ssb
)
}
else
{
holder
.
setText
(
R
.
id
.
tv_name
,
name
)
}
}
}
holder
.
setText
(
R
.
id
.
tv_price
,
"¥$price/$unit"
)
holder
.
setText
(
R
.
id
.
tv_price
,
"¥$price/$unit"
)
holder
.
setText
(
R
.
id
.
tv_amount
,
"$amount"
)
holder
.
setText
(
R
.
id
.
tv_amount
,
"$amount"
)
...
...
app/src/main/java/com/ypsx/yppos/ui/popup/ChooseAgeGroupPopupWindow.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.ui.popup
import
android.content.Context
import
android.view.Gravity
import
android.view.View
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupChooseAgeGroupBinding
import
com.ypsx.yppos.http.data.entity.AgeGroupEnum
import
razerdp.basepopup.BasePopupWindow
class
ChooseAgeGroupPopupWindow
(
context
:
Context
)
:
BasePopupWindow
(
context
)
{
var
binding
:
PopupChooseAgeGroupBinding
?
=
null
private
var
chooseAgeGroupAction
:
(
ageGroup
:
AgeGroupEnum
)
->
Unit
=
{
}
init
{
setContentView
(
R
.
layout
.
popup_choose_age_group
)
popupGravity
=
Gravity
.
BOTTOM
setPriority
(
Priority
.
HIGH
)
setOverlayMask
(
true
)
isOutSideTouchable
=
true
setOutSideDismiss
(
true
)
setBackPressEnable
(
false
)
}
override
fun
onViewCreated
(
contentView
:
View
)
{
binding
=
PopupChooseAgeGroupBinding
.
bind
(
contentView
)
binding
?.
click
=
ProxyClick
()
}
inner
class
ProxyClick
{
fun
choose
(
ageGroup
:
AgeGroupEnum
)
{
dismiss
()
chooseAgeGroupAction
.
invoke
(
ageGroup
)
}
fun
cancel
()
{
dismiss
()
}
}
fun
setChooseAgeGroupClick
(
chooseAgeGroupAction
:
(
ageGroup
:
AgeGroupEnum
)
->
Unit
)
{
this
.
chooseAgeGroupAction
=
chooseAgeGroupAction
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/ui/popup/GenderChoosePopupWindow.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.ui.popup
import
android.content.Context
import
android.view.Gravity
import
android.view.View
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupGenderChooseBinding
import
com.ypsx.yppos.databinding.PopupMemberLoginBinding
import
com.ypsx.yppos.databinding.PopupMemberRegisterBinding
import
razerdp.basepopup.BasePopupWindow
/**
* 性别选择
*/
class
GenderChoosePopupWindow
(
context
:
Context
)
:
BasePopupWindow
(
context
)
{
var
binding
:
PopupGenderChooseBinding
?=
null
private
var
chooseGenderAction
:
(
gender
:
Int
)
->
Unit
=
{
}
init
{
setContentView
(
R
.
layout
.
popup_gender_choose
)
popupGravity
=
Gravity
.
BOTTOM
setPriority
(
Priority
.
HIGH
)
setOverlayMask
(
true
)
isOutSideTouchable
=
true
setOutSideDismiss
(
true
)
setBackPressEnable
(
false
)
}
override
fun
onViewCreated
(
contentView
:
View
)
{
binding
=
PopupGenderChooseBinding
.
bind
(
contentView
)
binding
?.
click
=
ProxyClick
()
}
inner
class
ProxyClick
{
fun
choose
(
gender
:
Int
)
{
dismiss
()
chooseGenderAction
.
invoke
(
gender
)
}
fun
cancel
()
{
dismiss
()
}
}
fun
setChooseGenderClick
(
chooseGenderAction
:
(
gender
:
Int
)
->
Unit
)
{
this
.
chooseGenderAction
=
chooseGenderAction
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/ui/popup/MemberLoginPopupWindow.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.ui.popup
import
android.content.Context
import
android.text.TextUtils
import
android.view.Gravity
import
android.view.View
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.base.util.RegexUtils
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupMemberLoginBinding
import
com.ypsx.yppos.databinding.PopupMessageBinding
import
com.ypsx.yppos.utils.toast
import
com.ypsx.yppos.viewmodel.state.MessageViewModel
import
razerdp.basepopup.BasePopupWindow
class
MemberLoginPopupWindow
(
context
:
Context
?)
:
BasePopupWindow
(
context
)
{
var
binding
:
PopupMemberLoginBinding
?=
null
private
var
memberLoginAction
:
(
phone
:
String
)
->
Unit
=
{
}
init
{
setContentView
(
R
.
layout
.
popup_member_login
)
width
=
appContext
.
screenWidth
/
4
*
3
popupGravity
=
Gravity
.
CENTER
isOutSideTouchable
=
false
setOutSideDismiss
(
false
)
setBackPressEnable
(
false
)
}
override
fun
onViewCreated
(
contentView
:
View
)
{
binding
=
PopupMemberLoginBinding
.
bind
(
contentView
)
binding
?.
click
=
ProxyClick
()
setAutoShowKeyboard
(
binding
?.
etMemberPhone
,
true
)
}
inner
class
ProxyClick
{
fun
cancel
()
{
dismiss
()
}
fun
sure
()
{
val
phone
=
binding
?.
etMemberPhone
?.
text
.
toString
()
if
(
TextUtils
.
isEmpty
(
phone
))
{
"手机号不能为空!"
.
toast
()
return
}
if
(!
RegexUtils
.
isMobileSimple
(
phone
))
{
"手机号不符合规则"
.
toast
()
return
}
dismiss
()
memberLoginAction
.
invoke
(
phone
)
}
}
fun
setMemberLoginClick
(
memberLoginAction
:
(
phone
:
String
)
->
Unit
)
{
this
.
memberLoginAction
=
memberLoginAction
}
}
app/src/main/java/com/ypsx/yppos/ui/popup/MemberRegisterPopupWindow.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.ui.popup
import
android.content.Context
import
android.text.TextUtils
import
android.view.Gravity
import
android.view.View
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupMemberRegisterBinding
import
com.ypsx.yppos.http.data.entity.AgeGroupEnum
import
com.ypsx.yppos.utils.toast
import
com.ypsx.yppos.viewmodel.state.MemberRegisterViewModel
import
razerdp.basepopup.BasePopupWindow
class
MemberRegisterPopupWindow
(
context
:
Context
?)
:
BasePopupWindow
(
context
)
{
var
binding
:
PopupMemberRegisterBinding
?
=
null
private
lateinit
var
mobile
:
String
private
var
registerMemberAction
:
(
mobile
:
String
,
gender
:
Int
,
ageGroup
:
String
)
->
Unit
=
{
mobile
,
gender
,
ageGroup
->
{}
}
init
{
setContentView
(
R
.
layout
.
popup_member_register
)
width
=
appContext
.
screenWidth
/
4
*
3
popupGravity
=
Gravity
.
CENTER
setPriority
(
Priority
.
LOW
)
isOutSideTouchable
=
false
setOutSideDismiss
(
false
)
setBackPressEnable
(
false
)
}
override
fun
onViewCreated
(
contentView
:
View
)
{
binding
=
PopupMemberRegisterBinding
.
bind
(
contentView
)
binding
?.
vm
=
MemberRegisterViewModel
()
binding
?.
click
=
ProxyClick
()
binding
?.
tvGender
?.
keyListener
=
null
binding
?.
tvAge
?.
keyListener
=
null
}
fun
setMobile
(
mobile
:
String
)
{
this
.
mobile
=
mobile
binding
?.
vm
?.
memberMobile
?.
set
(
mobile
)
}
inner
class
ProxyClick
{
fun
chooseGender
()
{
val
genderChoosePopupWindow
=
GenderChoosePopupWindow
(
context
)
genderChoosePopupWindow
.
showPopupWindow
()
genderChoosePopupWindow
.
setChooseGenderClick
{
binding
?.
vm
?.
memberGenderEnum
?.
set
(
it
)
when
(
it
)
{
1
->
binding
?.
vm
?.
memberGender
?.
set
(
context
.
resources
.
getString
(
R
.
string
.
gender_male
))
2
->
binding
?.
vm
?.
memberGender
?.
set
(
context
.
resources
.
getString
(
R
.
string
.
gender_female
))
else
->
binding
?.
vm
?.
memberGender
?.
set
(
context
.
resources
.
getString
(
R
.
string
.
gender_male
))
}
}
}
fun
chooseAge
()
{
val
chooseAgeGroupPopupWindow
=
ChooseAgeGroupPopupWindow
(
context
)
chooseAgeGroupPopupWindow
.
showPopupWindow
()
chooseAgeGroupPopupWindow
.
setChooseAgeGroupClick
{
binding
?.
vm
?.
memberAgeEnum
?.
set
(
it
.
name
)
when
(
it
)
{
AgeGroupEnum
.
UNDER_30
->
binding
?.
vm
?.
memberAge
?.
set
(
context
.
resources
.
getString
(
R
.
string
.
age_under_30
)
)
AgeGroupEnum
.
BETWEEN_30_50
->
binding
?.
vm
?.
memberAge
?.
set
(
context
.
resources
.
getString
(
R
.
string
.
age_between_30_50
)
)
AgeGroupEnum
.
ABOVE_50
->
binding
?.
vm
?.
memberAge
?.
set
(
context
.
resources
.
getString
(
R
.
string
.
age_above_50
)
)
}
}
}
fun
cancel
()
{
dismiss
()
}
fun
sure
()
{
val
memberGender
=
binding
?.
vm
?.
memberGenderEnum
?.
get
()
if
(
memberGender
==
0
)
{
context
.
resources
.
getString
(
R
.
string
.
choose_gender
).
toast
()
return
}
val
memberAgeGroup
=
binding
?.
vm
?.
memberAgeEnum
?.
get
()
if
(
TextUtils
.
isEmpty
(
memberAgeGroup
))
{
context
.
resources
.
getString
(
R
.
string
.
choose_age
).
toast
()
return
}
registerMemberAction
.
invoke
(
mobile
,
memberGender
!!
,
memberAgeGroup
!!
)
}
}
fun
setRegisterMemberClick
(
registerMemberAction
:
(
mobile
:
String
,
gender
:
Int
,
ageGroup
:
String
)
->
Unit
)
{
this
.
registerMemberAction
=
registerMemberAction
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/ui/popup/MessageTipsPopupWindow.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.ui.popup
import
android.content.Context
import
android.view.Gravity
import
android.view.View
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupMessageBinding
import
com.ypsx.yppos.databinding.PopupMessageTipsBinding
import
com.ypsx.yppos.viewmodel.state.MessageTipsViewModel
import
com.ypsx.yppos.viewmodel.state.MessageViewModel
import
razerdp.basepopup.BasePopupWindow
class
MessageTipsPopupWindow
(
context
:
Context
)
:
BasePopupWindow
(
context
)
{
var
binding
:
PopupMessageTipsBinding
?=
null
init
{
setContentView
(
R
.
layout
.
popup_message_tips
)
width
=
appContext
.
screenWidth
/
4
*
3
popupGravity
=
Gravity
.
CENTER
isOutSideTouchable
=
false
setOutSideDismiss
(
false
)
setBackPressEnable
(
false
)
}
override
fun
onViewCreated
(
contentView
:
View
)
{
binding
=
PopupMessageTipsBinding
.
bind
(
contentView
)
binding
?.
vm
=
MessageTipsViewModel
()
binding
?.
click
=
ProxyClick
()
}
fun
setData
(
content
:
String
,
sure
:
String
=
"确定"
,
)
{
binding
?.
apply
{
vm
?.
content
?.
set
(
content
)
vm
?.
sure
?.
set
(
sure
)
}
}
inner
class
ProxyClick
{
fun
know
()
{
dismiss
()
}
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/ui/popup/OfferDetailsPopupWindow.kt
View file @
973caaaf
...
@@ -50,12 +50,14 @@ class OfferDetailsPopupWindow(context: Context?) : BasePopupWindow(context) {
...
@@ -50,12 +50,14 @@ class OfferDetailsPopupWindow(context: Context?) : BasePopupWindow(context) {
discount
:
String
,
discount
:
String
,
discountSpecial
:
String
,
discountSpecial
:
String
,
discountMoney
:
String
,
discountMoney
:
String
,
discountTime
:
String
discountTime
:
String
,
discountMember
:
String
)
{
)
{
bind
.
vm
!!
.
discount
.
set
(
"¥$discount"
)
bind
.
vm
!!
.
discount
.
set
(
"¥$discount"
)
bind
.
vm
!!
.
discountSpecial
.
set
(
"-¥$discountSpecial"
)
bind
.
vm
!!
.
discountSpecial
.
set
(
"-¥$discountSpecial"
)
bind
.
vm
!!
.
discountMoney
.
set
(
"-¥$discountMoney"
)
bind
.
vm
!!
.
discountMoney
.
set
(
"-¥$discountMoney"
)
bind
.
vm
!!
.
discountTime
.
set
(
"-¥$discountTime"
)
bind
.
vm
!!
.
discountTime
.
set
(
"-¥$discountTime"
)
bind
.
vm
!!
.
discountMember
.
set
(
"-¥$discountMember"
)
}
}
override
fun
showPopupWindow
()
{
override
fun
showPopupWindow
()
{
...
...
app/src/main/java/com/ypsx/yppos/ui/popup/OrderPayAmountPopupWindow.kt
View file @
973caaaf
...
@@ -22,6 +22,9 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -22,6 +22,9 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
private
var
payAction
:
(
item
:
PosPayMethod
)
->
Unit
=
private
var
payAction
:
(
item
:
PosPayMethod
)
->
Unit
=
{
_
:
PosPayMethod
->
}
{
_
:
PosPayMethod
->
}
private
var
cancelPayAction
:()->
Unit
=
{
}
init
{
init
{
setContentView
(
R
.
layout
.
popup_order_pay_amount
)
setContentView
(
R
.
layout
.
popup_order_pay_amount
)
setAlignBackgroundGravity
(
Gravity
.
BOTTOM
)
setAlignBackgroundGravity
(
Gravity
.
BOTTOM
)
...
@@ -70,18 +73,26 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -70,18 +73,26 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
.
toDismiss
()
.
toDismiss
()
}
}
fun
setData
(
orderNo
:
String
,
amount
:
String
)
{
fun
setData
(
orderNo
:
String
,
amount
:
String
,
discountCoupon
:
String
)
{
bind
?.
vm
?.
orderNo
?.
set
(
orderNo
)
bind
?.
vm
?.
orderNo
?.
set
(
orderNo
)
bind
?.
vm
?.
payAmount
?.
set
(
amount
)
bind
?.
vm
?.
payAmount
?.
set
(
amount
)
bind
?.
vm
?.
discountCoupon
?.
set
(
"-¥$discountCoupon"
)
}
}
fun
setPayClick
(
payAction
:
(
item
:
PosPayMethod
)
->
Unit
)
{
fun
setPayClick
(
payAction
:
(
item
:
PosPayMethod
)
->
Unit
)
{
this
.
payAction
=
payAction
this
.
payAction
=
payAction
}
}
fun
setCancelPayAction
(
cancelPayAction
:
()
->
Unit
)
{
this
.
cancelPayAction
=
cancelPayAction
}
inner
class
ProxyClick
{
inner
class
ProxyClick
{
fun
close
()
{
fun
close
()
{
//关闭时,取消优惠券,并刷新列表
dismiss
()
dismiss
()
cancelPayAction
.
invoke
()
}
}
fun
pay
()
{
fun
pay
()
{
...
...
app/src/main/java/com/ypsx/yppos/ui/popup/ScanCouponPopupWindow.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.ui.popup
import
android.content.Context
import
android.text.TextUtils
import
android.util.Log
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.view.inputmethod.EditorInfo
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.hideSoftKeyboard
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.base.util.dXLog
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupScanCouponBinding
import
com.ypsx.yppos.utils.scan.ScanGunKeyEventHelper
import
razerdp.basepopup.BasePopupWindow
class
ScanCouponPopupWindow
(
context
:
Context
,
scanGunKeyEventHelper
:
ScanGunKeyEventHelper
)
:
BasePopupWindow
(
context
),
ScanGunKeyEventHelper
.
OnScanSuccessListener
{
var
binding
:
PopupScanCouponBinding
?
=
null
lateinit
var
scanGunKeyEventHelper
:
ScanGunKeyEventHelper
private
var
scanCouponAction
:
(
couponCode
:
String
)
->
Unit
=
{
}
init
{
setContentView
(
R
.
layout
.
popup_scan_coupon
)
width
=
appContext
.
screenWidth
/
4
*
3
popupGravity
=
Gravity
.
CENTER
isOutSideTouchable
=
true
setOutSideDismiss
(
true
)
setBackPressEnable
(
false
)
setAutoShowKeyboard
(
false
)
this
.
scanGunKeyEventHelper
=
scanGunKeyEventHelper
}
fun
setCouponCode
(
code
:
String
)
{
binding
?.
etCouponCode
?.
setText
(
code
)
}
override
fun
onViewCreated
(
contentView
:
View
)
{
binding
=
PopupScanCouponBinding
.
bind
(
contentView
)
binding
?.
etCouponCode
?.
setOnEditorActionListener
{
v
,
actionId
,
event
->
if
(
actionId
==
EditorInfo
.
IME_ACTION_DONE
)
{
val
textString
=
binding
?.
etCouponCode
?.
text
?.
toString
()
if
(!
TextUtils
.
isEmpty
(
textString
))
{
hideSoftKeyboard
(
context
)
scanCouponAction
.
invoke
(
textString
!!
)
}
}
return
@setOnEditorActionListener
false
}
binding
?.
etCouponCode
?.
setOnFocusChangeListener
{
v
,
hasFocus
->
if
(
hasFocus
)
{
scanGunKeyEventHelper
.
setOnBarCodeCatchListener
(
null
)
}
else
{
scanGunKeyEventHelper
.
setOnBarCodeCatchListener
(
this
)
}
}
// binding?.etCouponCode?.setOnKeyListener { v, keyCode, event ->
// "${event.action} $keyCode".dXLog()
// if (event.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_DEL) {
// val textString = binding?.etCouponCode?.text?.toString()
// textString?.dXLog()
// if (textString!!.isNotEmpty()) {
// val newText = textString.substring(0, textString.length)
// binding?.etCouponCode?.setText(newText)
// binding?.etCouponCode?.setSelection(newText.length)
// }
// }
// return@setOnKeyListener false
//
// }
}
fun
setScanCouponClick
(
scanCouponAction
:
(
couponCode
:
String
)
->
Unit
)
{
this
.
scanCouponAction
=
scanCouponAction
}
override
fun
onScanSuccess
(
barcode
:
String
)
{
Log
.
i
(
"barcode"
,
barcode
+
""
)
if
(
barcode
.
isNotEmpty
())
{
binding
?.
etCouponCode
?.
setText
(
barcode
)
scanCouponAction
.
invoke
(
barcode
)
}
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
View file @
973caaaf
package
com.ypsx.yppos.utils
package
com.ypsx.yppos.utils
import
android.device.PrinterManager
import
android.device.PrinterManager
import
android.text.TextUtils
import
com.blankj.utilcode.util.GsonUtils
import
com.blankj.utilcode.util.GsonUtils
import
com.blankj.utilcode.util.Utils.runOnUiThread
import
com.blankj.utilcode.util.Utils.runOnUiThread
import
com.elvishew.xlog.XLog
import
com.elvishew.xlog.XLog
...
@@ -47,7 +48,7 @@ object PrintUtils {
...
@@ -47,7 +48,7 @@ object PrintUtils {
}
}
fun
print
(
posConfig
:
PosConfig
,
orderResponse
:
OrderDetailsResponse
)
{
fun
print
(
posConfig
:
PosConfig
,
orderResponse
:
OrderDetailsResponse
,
memberPoint
:
String
)
{
val
fontSize
=
24
val
fontSize
=
24
val
fontStyle
=
0
x0000
val
fontStyle
=
0
x0000
val
fontBold
=
0
x0001
val
fontBold
=
0
x0001
...
@@ -138,6 +139,8 @@ object PrintUtils {
...
@@ -138,6 +139,8 @@ object PrintUtils {
var
discountTime
=
0.0
//分时
var
discountTime
=
0.0
//分时
var
discountSpecial
=
0.0
//特价
var
discountSpecial
=
0.0
//特价
var
discountMoney
=
0.0
//满减
var
discountMoney
=
0.0
//满减
var
discountMember
=
0.0
//会员优惠
var
discountCoupon
=
orderResponse
.
userCouponFee
//优惠券优惠金额
orderResponse
.
activitys
?.
forEach
{
item
->
orderResponse
.
activitys
?.
forEach
{
item
->
discountMoney
+=
item
.
discountMoney
discountMoney
+=
item
.
discountMoney
...
@@ -155,6 +158,11 @@ object PrintUtils {
...
@@ -155,6 +158,11 @@ object PrintUtils {
discountSpecial
+=
discountMoney
discountSpecial
+=
discountMoney
}
}
}
}
if
(
product
.
priceType
==
"MEMBER_TYPE"
)
{
discountMember
=
discountMoney
.
plus
((
product
.
price
.
minus
(
product
.
memberPrice
)).
times
(
product
.
quantity
))
}
}
}
}
}
var
isPromotion
=
false
var
isPromotion
=
false
...
@@ -255,13 +263,58 @@ object PrintUtils {
...
@@ -255,13 +263,58 @@ object PrintUtils {
0
0
)
)
if
(!
TextUtils
.
isEmpty
(
orderResponse
.
mobile
)){
height
+=
printerManager
.
drawTextEx
(
"会员卡号:${orderResponse.mobile}"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
height
+=
printerManager
.
drawTextEx
(
"上次累计积分:${memberPoint}"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
if
(
discountMember
!=
0.0
)
{
height
+=
printerManager
.
drawTextEx
(
"会员折扣优惠:${discountMember}"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
}
}
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
tag1
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontBold
,
0
tag1
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontBold
,
0
)
)
var
payAmount
=
orderResponse
.
payAmount
+
discountMember
+
discountCoupon
!!
payAmount
.
toString
().
dXLog
()
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
getAmountCenterSpace
(
getAmountCenterSpace
(
"应付款:${
orderResponse.
payAmount}"
,
"应付款:${payAmount}"
,
"数量:${buyNum}"
"数量:${buyNum}"
),
),
0
,
0
,
...
@@ -603,6 +656,9 @@ object PrintUtils {
...
@@ -603,6 +656,9 @@ object PrintUtils {
var
discountTime
=
0.0
//分时
var
discountTime
=
0.0
//分时
var
discountSpecial
=
0.0
//特价
var
discountSpecial
=
0.0
//特价
var
discountMoney
=
0.0
//满减
var
discountMoney
=
0.0
//满减
var
discountMember
=
0.0
//会员优惠
var
discountCoupon
=
posBuy
.
userCouponFee
//优惠券优惠金额
var
list
:
List
<
OrderActivityResponse
>?
=
null
var
list
:
List
<
OrderActivityResponse
>?
=
null
if
(
posBuy
.
activitys
!=
null
&&
posBuy
.
activitys
!=
""
)
{
if
(
posBuy
.
activitys
!=
null
&&
posBuy
.
activitys
!=
""
)
{
list
=
list
=
...
@@ -663,6 +719,11 @@ object PrintUtils {
...
@@ -663,6 +719,11 @@ object PrintUtils {
}
}
}
}
if
(
product
.
priceType
==
"MEMBER_TYPE"
)
{
discountMember
=
discountMoney
.
plus
((
product
.
price
.
minus
(
product
.
memberPrice
)).
times
(
product
.
quantity
))
}
//
//
var
name
=
if
(
discountMoney
>
0.0
&&
isPromotion
)
{
var
name
=
if
(
discountMoney
>
0.0
&&
isPromotion
)
{
...
@@ -753,13 +814,56 @@ object PrintUtils {
...
@@ -753,13 +814,56 @@ object PrintUtils {
0
0
)
)
if
(!
TextUtils
.
isEmpty
(
posBuy
.
mobile
)){
height
+=
printerManager
.
drawTextEx
(
"会员卡号:${posBuy.mobile}"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
height
+=
printerManager
.
drawTextEx
(
"上次累计积分:${posBuy.memberPoint}"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
if
(
discountMember
!=
0.0
)
{
height
+=
printerManager
.
drawTextEx
(
"会员折扣优惠:${discountMember}"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
}
}
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
tag1
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontBold
,
0
tag1
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontBold
,
0
)
)
var
payAmount
=
posBuy
.
totalAmount
+
discountMember
+
discountCoupon
!!
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
getAmountCenterSpace
(
getAmountCenterSpace
(
"应付款:${p
osBuy.total
Amount}"
,
"应付款:${p
ay
Amount}"
,
"数量:${buyNum}"
"数量:${buyNum}"
),
),
0
,
0
,
...
...
app/src/main/java/com/ypsx/yppos/utils/StringUtils.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.utils
object
StringUtils
{
public
fun
getMemberMobile
(
mobile
:
String
):
String
{
return
"会员信息:$mobile"
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/viewmodel/request/RequestMainViewModel.kt
View file @
973caaaf
...
@@ -45,6 +45,8 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -45,6 +45,8 @@ class RequestMainViewModel : BaseViewModel() {
val
paySuccessState
=
MutableLiveData
<
UpdateUiState
<
String
>>()
val
paySuccessState
=
MutableLiveData
<
UpdateUiState
<
String
>>()
val
paySuccessStateCash
=
MutableLiveData
<
UpdateUiState
<
CashPaySuccess
>>()
val
paySuccessStateCash
=
MutableLiveData
<
UpdateUiState
<
CashPaySuccess
>>()
val
memberInfoState
=
MutableLiveData
<
UpdateUiState
<
MemberInfoResponse
>>();
val
cancelCouponState
=
MutableLiveData
<
UpdateUiState
<
String
>>();
val
syncProductsState
=
MutableLiveData
<
UpdateUiState
<
String
>>()
val
syncProductsState
=
MutableLiveData
<
UpdateUiState
<
String
>>()
...
@@ -111,7 +113,12 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -111,7 +113,12 @@ class RequestMainViewModel : BaseViewModel() {
when
{
when
{
it
.
mnemonicCode
.
isEmpty
()
->
{
it
.
mnemonicCode
.
isEmpty
()
->
{
val
productItem
=
val
productItem
=
ProductItem
(
it
.
merchantItemId
!!
,
it
.
id
,
it
.
spec
.
toDouble
(),
it
.
sellPrice
)
ProductItem
(
it
.
merchantItemId
!!
,
it
.
id
,
it
.
spec
.
toDouble
(),
it
.
sellPrice
)
productItem
.
toJson
().
dXLog
()
productItem
.
toJson
().
dXLog
()
productItemData
.
postValue
(
productItem
)
productItemData
.
postValue
(
productItem
)
}
}
...
@@ -121,7 +128,12 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -121,7 +128,12 @@ class RequestMainViewModel : BaseViewModel() {
}
}
else
->
{
else
->
{
val
productItem
=
val
productItem
=
ProductItem
(
it
.
merchantItemId
!!
,
it
.
id
,
it
.
spec
.
toDouble
(),
it
.
sellPrice
)
ProductItem
(
it
.
merchantItemId
!!
,
it
.
id
,
it
.
spec
.
toDouble
(),
it
.
sellPrice
)
productItem
.
toJson
().
dXLog
()
productItem
.
toJson
().
dXLog
()
productItemData
.
postValue
(
productItem
)
productItemData
.
postValue
(
productItem
)
}
}
...
@@ -147,7 +159,8 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -147,7 +159,8 @@ class RequestMainViewModel : BaseViewModel() {
fun
request
(
request
:
ProductPromotionRequest
)
{
fun
request
(
request
:
ProductPromotionRequest
)
{
request
({
apiService
.
getProductPromotions
(
request
)
},
{
request
({
apiService
.
getProductPromotions
(
request
)
},
{
"操作成功"
.
toastSuccess
()
"操作成功"
.
toastSuccess
()
productPromotionsResponse
.
postValue
(
it
)
queryAllIn
(
it
,
request
.
confirm
)
// productPromotionsResponse.postValue(it)
},
{
},
{
it
.
errorMsg
.
toastFailed
()
it
.
errorMsg
.
toastFailed
()
orderPromotions
=
null
orderPromotions
=
null
...
@@ -185,7 +198,6 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -185,7 +198,6 @@ class RequestMainViewModel : BaseViewModel() {
amountTotal
=
BigDecimalUtils
.
forPlus
(
amountTotal
.
plus
(
amount
))
amountTotal
=
BigDecimalUtils
.
forPlus
(
amountTotal
.
plus
(
amount
))
var
weightCode
=
""
var
weightCode
=
""
if
(
pluList
.
size
>
index
)
{
if
(
pluList
.
size
>
index
)
{
weightCode
=
weightCode
=
if
(
pluList
[
index
].
id
==
posProduct
?.
id
)
pluList
[
index
].
plu
else
""
if
(
pluList
[
index
].
id
==
posProduct
?.
id
)
pluList
[
index
].
plu
else
""
...
@@ -213,7 +225,7 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -213,7 +225,7 @@ class RequestMainViewModel : BaseViewModel() {
pluLevel
=
posProduct
.
pluLevel
,
pluLevel
=
posProduct
.
pluLevel
,
merchantItemId
=
posProduct
.
merchantItemId
,
merchantItemId
=
posProduct
.
merchantItemId
,
productNumber
=
posProduct
.
productNumber
,
productNumber
=
posProduct
.
productNumber
,
mnemonicCode
=
posProduct
.
mnemonicCode
mnemonicCode
=
posProduct
.
mnemonicCode
,
discountCouponPrice
=
0.0
)
)
posBuyPart
.
toJson
().
dXLog
()
posBuyPart
.
toJson
().
dXLog
()
list
.
add
(
posBuyPart
)
list
.
add
(
posBuyPart
)
...
@@ -229,7 +241,7 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -229,7 +241,7 @@ class RequestMainViewModel : BaseViewModel() {
})
})
}
}
fun
queryAllIn
(
productPromotionsResponse
:
ProductPromotionsResponse
)
{
fun
queryAllIn
(
productPromotionsResponse
:
ProductPromotionsResponse
,
confirm
:
ConfirmRequest
)
{
orderPromotions
=
productPromotionsResponse
.
orderPromotions
orderPromotions
=
productPromotionsResponse
.
orderPromotions
var
discountTotal
=
0.0
var
discountTotal
=
0.0
...
@@ -237,6 +249,8 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -237,6 +249,8 @@ class RequestMainViewModel : BaseViewModel() {
var
discountMoney
=
0.0
//满减促销
var
discountMoney
=
0.0
//满减促销
var
discountTime
=
0.0
//分时促销
var
discountTime
=
0.0
//分时促销
var
discountSpecial
=
0.0
//特价促销
var
discountSpecial
=
0.0
//特价促销
var
discountMember
=
0.0
//会员优惠
var
discountCoupon
=
0.0
//优惠券优惠金额
var
amount
=
0.0
//总价值
var
amount
=
0.0
//总价值
productPromotionsResponse
.
orderPromotions
?.
forEach
{
item
->
productPromotionsResponse
.
orderPromotions
?.
forEach
{
item
->
...
@@ -254,8 +268,13 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -254,8 +268,13 @@ class RequestMainViewModel : BaseViewModel() {
}
}
}
}
}
}
if
(
item
.
priceType
==
"MEMBER_TYPE"
)
{
discountMember
=
discountMoney
.
plus
((
item
.
price
.
minus
(
item
.
memberPrice
!!
)).
times
(
item
.
quantity
))
}
discountCoupon
=
discountCoupon
.
plus
(
item
.
couponDivideTotal
)
}
}
discountTotal
=
discountMoney
+
discountSpecial
+
discountTime
discountTotal
=
discountMoney
+
discountSpecial
+
discountTime
+
discountMember
val
productPromotions
=
productPromotionsResponse
.
productPromotions
val
productPromotions
=
productPromotionsResponse
.
productPromotions
val
list
=
ArrayList
<
String
>(
productPromotions
.
size
)
val
list
=
ArrayList
<
String
>(
productPromotions
.
size
)
...
@@ -312,7 +331,7 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -312,7 +331,7 @@ class RequestMainViewModel : BaseViewModel() {
amount
=
product
.
payApportionAmount
?:
0.0
,
amount
=
product
.
payApportionAmount
?:
0.0
,
discountTotal
=
product
.
discountTotal
?:
0.0
,
discountTotal
=
product
.
discountTotal
?:
0.0
,
discountPrice
=
product
.
discountTotal
.
div
(
product
.
quantity
),
discountPrice
=
product
.
discountTotal
.
div
(
product
.
quantity
),
memberPrice
=
product
.
memberPrice
?:
0.0
,
memberPrice
=
product
.
memberPrice
,
barCode
=
posProduct
?.
barCode
!!
,
barCode
=
posProduct
?.
barCode
!!
,
cardNumber
=
null
,
cardNumber
=
null
,
conversionRatio
=
posProduct
.
conversionRatio
,
conversionRatio
=
posProduct
.
conversionRatio
,
...
@@ -333,7 +352,13 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -333,7 +352,13 @@ class RequestMainViewModel : BaseViewModel() {
payApportionAmount
=
product
.
payApportionAmount
,
payApportionAmount
=
product
.
payApportionAmount
,
isPromotion
=
isPromotion
,
isPromotion
=
isPromotion
,
isVirtual
=
posProduct
.
isVirtual
,
isVirtual
=
posProduct
.
isVirtual
,
mnemonicCode
=
posProduct
.
mnemonicCode
mnemonicCode
=
posProduct
.
mnemonicCode
,
couponDivideTotal
=
product
.
couponDivideTotal
,
discountCouponPrice
=
if
(
product
.
priceType
==
"MEMBER_TYPE"
){
product
.
memberPrice
?.
minus
(
product
.
payApportionAmount
)
}
else
{
product
.
price
.
minus
(
product
.
payApportionAmount
)
}
)
)
posBuyPart
.
toJson
().
dXLog
()
posBuyPart
.
toJson
().
dXLog
()
list
.
add
(
posBuyPart
)
list
.
add
(
posBuyPart
)
...
@@ -348,7 +373,11 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -348,7 +373,11 @@ class RequestMainViewModel : BaseViewModel() {
BigDecimalUtils
.
forPlus
(
discountTime
),
BigDecimalUtils
.
forPlus
(
discountTime
),
BigDecimalUtils
.
forPlus
(
discountSpecial
),
BigDecimalUtils
.
forPlus
(
discountSpecial
),
BigDecimalUtils
.
forPlus
(
amount
),
BigDecimalUtils
.
forPlus
(
amount
),
listNum
listNum
,
BigDecimalUtils
.
forPlus
(
discountMember
),
BigDecimalUtils
.
forPlus
(
discountCoupon
),
productPromotionsResponse
.
coupon
?.
coupon
,
isFinal
=
confirm
.
isFinal
)
)
)
)
})
})
...
@@ -366,7 +395,12 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -366,7 +395,12 @@ class RequestMainViewModel : BaseViewModel() {
productList
:
List
<
InsertOrderProductDTO
>,
productList
:
List
<
InsertOrderProductDTO
>,
payMethod
:
PosPayMethod
,
payMethod
:
PosPayMethod
,
barcode
:
String
,
barcode
:
String
,
roundMoney
:
Double
=
0.0
,
changeMoney
:
Double
=
0.0
roundMoney
:
Double
=
0.0
,
changeMoney
:
Double
=
0.0
,
memberId
:
String
,
memberMobile
:
String
,
memberPoint
:
String
,
couponResponse
:
CouponInfoResponse
?
)
{
)
{
val
status
=
when
(
payMethod
)
{
val
status
=
when
(
payMethod
)
{
PosPayMethod
.
CASHPAY
->
"FINISHED"
PosPayMethod
.
CASHPAY
->
"FINISHED"
...
@@ -377,13 +411,14 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -377,13 +411,14 @@ class RequestMainViewModel : BaseViewModel() {
val
insertOrderRequest
=
InsertOrderRequest
(
val
insertOrderRequest
=
InsertOrderRequest
(
activitys
=
orderPromotions
,
activitys
=
orderPromotions
,
couponResponse
,
createTime
=
dataTime
,
createTime
=
dataTime
,
creatorId
=
loginResponse
!!
.
loginUser
.
username
?:
""
,
creatorId
=
loginResponse
!!
.
loginUser
.
username
?:
""
,
creatorName
=
loginResponse
.
loginUser
.
realName
?:
""
,
creatorName
=
loginResponse
.
loginUser
.
realName
?:
""
,
orderNo
=
orderNo
,
orderNo
=
orderNo
,
einvoiceQrcodeUrl
=
""
,
einvoiceQrcodeUrl
=
""
,
memberId
=
""
,
memberId
=
memberId
,
mobile
=
""
,
mobile
=
memberMobile
,
posId
=
posConfig
?.
id
?:
""
,
posId
=
posConfig
?.
id
?:
""
,
storeId
=
posConfig
?.
storeId
?:
""
,
storeId
=
posConfig
?.
storeId
?:
""
,
status
=
status
,
status
=
status
,
...
@@ -408,7 +443,7 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -408,7 +443,7 @@ class RequestMainViewModel : BaseViewModel() {
HttpRequestCoroutine
.
createOrder
(
insertOrderRequest
,
barcode
,
payMethod
)
HttpRequestCoroutine
.
createOrder
(
insertOrderRequest
,
barcode
,
payMethod
)
},
{
},
{
if
(
it
.
payMethod
==
PosPayMethod
.
CASHPAY
.
name
)
{
if
(
it
.
payMethod
==
PosPayMethod
.
CASHPAY
.
name
)
{
getOrderDetailById
(
it
.
orderId
,
""
)
getOrderDetailById
(
it
.
orderId
,
""
,
memberPoint
)
val
cashPaySuccess
=
CashPaySuccess
(
payAmount
,
changeMoney
,
roundMoney
,
orderNo
)
val
cashPaySuccess
=
CashPaySuccess
(
payAmount
,
changeMoney
,
roundMoney
,
orderNo
)
val
uiState
=
UpdateUiState
(
isSuccess
=
true
,
cashPaySuccess
)
val
uiState
=
UpdateUiState
(
isSuccess
=
true
,
cashPaySuccess
)
paySuccessStateCash
.
postValue
(
uiState
)
paySuccessStateCash
.
postValue
(
uiState
)
...
@@ -425,9 +460,14 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -425,9 +460,14 @@ class RequestMainViewModel : BaseViewModel() {
/**
/**
* 每隔2s轮询一次,获取支付订单状态
* 每隔2s轮询一次,获取支付订单状态
*/
*/
fun
getStateByOrderId
(
orderId
:
String
,
totalAmount
:
Double
,
authCode
:
String
)
{
fun
getStateByOrderId
(
orderId
:
String
,
totalAmount
:
Double
,
authCode
:
String
,
memberPoint
:
String
)
{
request
({
HttpRequestCoroutine
.
getOrderStatusById
(
orderId
)
},
{
request
({
HttpRequestCoroutine
.
getOrderStatusById
(
orderId
)
},
{
getOrderDetailById
(
orderId
,
authCode
)
getOrderDetailById
(
orderId
,
authCode
,
memberPoint
)
val
uiState
=
UpdateUiState
(
isSuccess
=
true
,
totalAmount
.
toString
())
val
uiState
=
UpdateUiState
(
isSuccess
=
true
,
totalAmount
.
toString
())
paySuccessState
.
postValue
(
uiState
)
paySuccessState
.
postValue
(
uiState
)
},
{
},
{
...
@@ -444,15 +484,19 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -444,15 +484,19 @@ class RequestMainViewModel : BaseViewModel() {
/**
/**
* 获取订单详情,并保存数据库打印小票
* 获取订单详情,并保存数据库打印小票
*/
*/
private
fun
getOrderDetailById
(
orderId
:
String
,
authCode
:
String
)
{
private
fun
getOrderDetailById
(
orderId
:
String
,
authCode
:
String
,
memberPoint
:
String
)
{
request
({
apiService
.
getOrderDetailById
(
orderId
)
},
{
request
({
apiService
.
getOrderDetailById
(
orderId
)
},
{
"${CacheUtil.getRealName()}付款成功,保存数据库并打印"
.
dXLog
()
"${CacheUtil.getRealName()}付款成功,保存数据库并打印"
.
dXLog
()
pluList
.
clear
()
pluList
.
clear
()
launch
({
launch
({
val
currentTimeMillis
=
System
.
currentTimeMillis
()
val
currentTimeMillis
=
System
.
currentTimeMillis
()
PrintUtils
.
print
(
posConfig
!!
,
i
t
)
// PrintUtils.print(posConfig!!, it,memberPoin
t)
PosBuyRepository
.
getInstance
().
savePosBuy
(
it
,
authCode
)
PosBuyRepository
.
getInstance
().
savePosBuy
(
it
,
authCode
,
memberPoint
)
"打印和保存数据库使用耗时::${System.currentTimeMillis()
-
currentTimeMillis}"
.
dXLog
()
"打印和保存数据库使用耗时::${System.currentTimeMillis()
-
currentTimeMillis}"
.
dXLog
()
},
{
},
{
"打印完成"
.
dXLog
()
"打印完成"
.
dXLog
()
"打印完成"
.
toastSuccess
()
"打印完成"
.
toastSuccess
()
...
@@ -490,5 +534,52 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -490,5 +534,52 @@ class RequestMainViewModel : BaseViewModel() {
})
})
}
}
/**
* 根据手机号获取会员信息
*/
fun
getMemberByMobile
(
mobile
:
String
)
{
requestNoCheck
({
apiService
.
getMemberByMobile
(
mobile
)
},
{
val
uiState
=
UpdateUiState
(
isSuccess
=
it
.
isSuccess
(),
it
.
data
,
mobile
)
memberInfoState
.
value
=
uiState
})
}
/**
* 注册会员
*/
fun
registerMember
(
mobile
:
String
,
gender
:
Int
,
ageGroup
:
String
,
shopId
:
String
)
{
request
({
apiService
.
registerMember
(
RegisterMemberRequest
(
ageGroup
,
gender
,
mobile
,
shopId
)
)
},
{
val
uiState
=
UpdateUiState
(
isSuccess
=
true
,
it
,
mobile
)
memberInfoState
.
value
=
uiState
},
{
it
.
errorMsg
.
toast
()
})
}
/**
* 释放优惠券
*/
fun
cancelCoupon
(
shopId
:
String
,
memberId
:
String
,
orderNo
:
String
,
couponResponse
:
CouponInfoResponse
)
{
val
cancelCouponRequest
=
CancelCouponRequest
(
shopId
,
memberId
,
orderNo
,
couponResponse
)
requestNoCheck
({
apiService
.
cancelCoupon
(
cancelCouponRequest
)
},
{
val
uiState
=
UpdateUiState
(
it
.
isSuccess
(),
""
,
it
.
getResponseMsg
())
cancelCouponState
.
value
=
uiState
})
}
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/viewmodel/state/MainViewModel.kt
View file @
973caaaf
package
com.ypsx.yppos.viewmodel.state
package
com.ypsx.yppos.viewmodel.state
import
android.view.View
import
android.view.View
import
androidx.databinding.BaseObservable
import
androidx.databinding.ObservableField
import
androidx.databinding.ObservableInt
import
androidx.databinding.ObservableInt
import
androidx.databinding.ObservableShort
import
com.ypsx.base.base.viewmodel.BaseViewModel
import
com.ypsx.base.base.viewmodel.BaseViewModel
import
com.ypsx.base.callback.databind.BooleanObservableField
import
com.ypsx.base.callback.databind.BooleanObservableField
import
com.ypsx.base.callback.databind.DoubleObservableField
import
com.ypsx.base.callback.databind.DoubleObservableField
...
@@ -29,6 +32,9 @@ class MainViewModel : BaseViewModel() {
...
@@ -29,6 +32,9 @@ class MainViewModel : BaseViewModel() {
var
payAmount
=
StringObservableField
(
"0.00"
)
var
payAmount
=
StringObservableField
(
"0.00"
)
var
discount
=
StringObservableField
(
"0.00"
)
var
discount
=
StringObservableField
(
"0.00"
)
var
discountMember
=
StringObservableField
(
"0.00"
)
var
discountCoupon
=
StringObservableField
(
"0.00"
)
// var productsNum = IntObservableField(0)
// var productsNum = IntObservableField(0)
...
@@ -42,6 +48,14 @@ class MainViewModel : BaseViewModel() {
...
@@ -42,6 +48,14 @@ class MainViewModel : BaseViewModel() {
var
cashRoundMode
=
IntObservableField
(
0
)
var
cashRoundMode
=
IntObservableField
(
0
)
/**
* 会员信息是否显示
*/
var
memberShow
=
BooleanObservableField
(
false
)
var
memberMobile
=
StringObservableField
(
""
)
var
memberPoint
=
StringObservableField
(
""
)
init
{
init
{
...
@@ -81,6 +95,20 @@ class MainViewModel : BaseViewModel() {
...
@@ -81,6 +95,20 @@ class MainViewModel : BaseViewModel() {
}
}
}
}
var
memberVisible
=
object
:
ObservableInt
(
recyclerShow
,
memberShow
)
{
override
fun
get
():
Int
{
return
if
(
recyclerShow
.
get
()
&&
memberShow
.
get
())
{
View
.
VISIBLE
}
else
{
View
.
GONE
}
}
}
var
memberMobileInfo
=
StringObservableField
(
memberMobile
.
get
())
private
fun
getRandom
():
Int
{
private
fun
getRandom
():
Int
{
val
max
=
9
val
max
=
9
val
min
=
0
val
min
=
0
...
...
app/src/main/java/com/ypsx/yppos/viewmodel/state/MemberRegisterViewModel.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.viewmodel.state
import
com.ypsx.base.base.viewmodel.BaseViewModel
import
com.ypsx.base.callback.databind.IntObservableField
import
com.ypsx.base.callback.databind.StringObservableField
class
MemberRegisterViewModel
:
BaseViewModel
()
{
var
memberMobile
=
StringObservableField
(
""
)
//性别 会员性别 0 未知、1 男、2 女
var
memberGender
=
StringObservableField
(
""
)
var
memberGenderEnum
=
IntObservableField
(
0
)
//年龄 UNKNOWN_AGE_GROUP, 小于30岁: UNDER_30, 30-50岁: BETWEEN_30_50, 大于50: ABOVE_50
var
memberAge
=
StringObservableField
(
""
)
var
memberAgeEnum
=
StringObservableField
(
""
)
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/viewmodel/state/MessageTipsViewModel.kt
0 → 100644
View file @
973caaaf
package
com.ypsx.yppos.viewmodel.state
import
com.ypsx.base.base.viewmodel.BaseViewModel
import
com.ypsx.base.callback.databind.BooleanObservableField
import
com.ypsx.base.callback.databind.StringObservableField
class
MessageTipsViewModel
:
BaseViewModel
()
{
var
content
=
StringObservableField
()
var
sure
=
StringObservableField
(
"确定"
)
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/viewmodel/state/OfferDetailsViewModel.kt
View file @
973caaaf
...
@@ -9,4 +9,6 @@ class OfferDetailsViewModel : BaseViewModel() {
...
@@ -9,4 +9,6 @@ class OfferDetailsViewModel : BaseViewModel() {
var
discountSpecial
=
StringObservableField
(
"0.00"
)
//特价促销
var
discountSpecial
=
StringObservableField
(
"0.00"
)
//特价促销
var
discount
=
StringObservableField
(
"0.00"
)
var
discount
=
StringObservableField
(
"0.00"
)
var
discountMember
=
StringObservableField
(
"0.00"
)
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/viewmodel/state/OrderPayAmountViewModel.kt
View file @
973caaaf
...
@@ -16,6 +16,9 @@ class OrderPayAmountViewModel : BaseViewModel() {
...
@@ -16,6 +16,9 @@ class OrderPayAmountViewModel : BaseViewModel() {
var
payAmount
=
StringObservableField
()
var
payAmount
=
StringObservableField
()
var
discountCoupon
=
StringObservableField
()
var
scanOffline
=
BooleanObservableField
(
false
)
var
scanOffline
=
BooleanObservableField
(
false
)
var
scanCardPay
=
BooleanObservableField
(
false
)
var
scanCardPay
=
BooleanObservableField
(
false
)
...
...
app/src/main/res/drawable/bg_available_coupons.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<stroke
android:width=
"1dp"
android:color=
"#ffa14eff"
/>
<solid
android:color=
"#fff6efff"
/>
<corners
android:radius=
"16dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_choose_dialog.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"6dp"
/>
<solid
android:color=
"@color/white"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_member.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<gradient
android:type=
"linear"
android:useLevel=
"true"
android:startColor=
"#fffef5d7"
android:endColor=
"#ffffedb8"
android:angle=
"135"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_phone.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#fff8f8f8"
/>
<corners
android:radius=
"6dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/ic_choose_down.xml
0 → 100644
View file @
973caaaf
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"38dp"
android:height=
"24dp"
android:viewportWidth=
"38"
android:viewportHeight=
"24"
>
<path
android:pathData=
"M18.9527,18.28L6.849,6.1763C6.2775,5.6047 5.3492,5.6047 4.7777,6.1763C4.2062,6.7478 4.2062,7.676 4.7777,8.2476L17.8498,21.3196C18.1519,21.6217 18.556,21.7673 18.9527,21.7455C19.3495,21.7637 19.7536,21.6217 20.0557,21.3196L33.1278,8.2512C33.6993,7.6797 33.6993,6.7514 33.1278,6.1799C32.5563,5.6084 31.628,5.6084 31.0565,6.1799L18.9527,18.28Z"
android:strokeWidth=
"1"
android:fillColor=
"#333333"
android:fillType=
"nonZero"
android:strokeColor=
"#00000000"
/>
</vector>
app/src/main/res/drawable/ic_yp_member.xml
0 → 100644
View file @
973caaaf
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:aapt=
"http://schemas.android.com/aapt"
android:width=
"36dp"
android:height=
"36dp"
android:viewportWidth=
"36"
android:viewportHeight=
"36"
>
<path
android:pathData=
"M4,0L32,0A4,4 0,0 1,36 4L36,32A4,4 0,0 1,32 36L4,36A4,4 0,0 1,0 32L0,4A4,4 0,0 1,4 0z"
android:strokeWidth=
"1"
android:fillType=
"evenOdd"
android:strokeColor=
"#00000000"
>
<aapt:attr
name=
"android:fillColor"
>
<gradient
android:startY=
"0"
android:startX=
"-1.2986879E-16"
android:endY=
"36"
android:endX=
"36"
android:type=
"linear"
>
<item
android:offset=
"0"
android:color=
"#FF414446"
/>
<item
android:offset=
"1"
android:color=
"#FF060707"
/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData=
"M11.727,7.875C12.5283,7.9355 13.092,8.3313 13.4181,9.0622C13.435,9.0925 13.4866,9.2731 13.5729,9.6039L16.875,28.125L11.8325,28.125C10.8716,27.9576 10.2783,27.3749 10.0525,26.3768C9.8267,25.3787 8.7258,19.2115 6.75,7.875L11.727,7.875ZM25.7416,7.8763L25.9307,7.877C25.9572,7.8771 25.9857,7.8772 26.0159,7.8772L28.1362,7.8772C28.2146,7.8772 28.2949,7.8771 28.3771,7.877L29.1666,7.8763C29.2599,7.8762 29.355,7.8761 29.452,7.876L30.375,7.875L18.1341,27L16.875,18.5586L22.9153,9.4904C23.65,8.4679 24.56,7.9294 25.6453,7.875L25.7009,7.876C25.7126,7.8761 25.7262,7.8762 25.7416,7.8763Z"
android:strokeWidth=
"1"
android:fillType=
"nonZero"
android:strokeColor=
"#00000000"
>
<aapt:attr
name=
"android:fillColor"
>
<gradient
android:startY=
"7.875"
android:startX=
"18.5625"
android:endY=
"28.125"
android:endX=
"18.5625"
android:type=
"linear"
>
<item
android:offset=
"0"
android:color=
"#FFF4CDA4"
/>
<item
android:offset=
"1"
android:color=
"#FFDDAE7B"
/>
</gradient>
</aapt:attr>
</path>
</vector>
app/src/main/res/layout/activity_main.xml
View file @
973caaaf
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
<variable
<variable
name=
"vm"
name=
"vm"
type=
"com.ypsx.yppos.viewmodel.state.MainViewModel"
/>
type=
"com.ypsx.yppos.viewmodel.state.MainViewModel"
/>
</data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
...
@@ -28,6 +29,17 @@
...
@@ -28,6 +29,17 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_member"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_marginEnd=
"10dp"
android:onClick=
"@{()->click.toLoginMember()}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/iv_settings"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_yp_member"
/>
<TextView
<TextView
android:id=
"@+id/tv_store_name"
android:id=
"@+id/tv_store_name"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
...
@@ -45,12 +57,12 @@
...
@@ -45,12 +57,12 @@
android:id=
"@+id/iv_settings"
android:id=
"@+id/iv_settings"
android:layout_width=
"30dp"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:layout_margin
End
=
"10dp"
android:layout_margin
Horizontal
=
"10dp"
android:onClick=
"@{()->click.settings()}"
android:onClick=
"@{()->click.settings()}"
app:srcCompat=
"@drawable/ic_main_settings"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_main_settings"
/>
<TextView
<TextView
android:id=
"@+id/textView13"
android:id=
"@+id/textView13"
...
@@ -93,8 +105,7 @@
...
@@ -93,8 +105,7 @@
<androidx.appcompat.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"20dp"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
app:srcCompat=
"@drawable/ic_main_search"
app:srcCompat=
"@drawable/ic_main_search"
/>
/>
<androidx.appcompat.widget.AppCompatEditText
<androidx.appcompat.widget.AppCompatEditText
android:id=
"@+id/et_search_content"
android:id=
"@+id/et_search_content"
...
@@ -136,6 +147,7 @@
...
@@ -136,6 +147,7 @@
android:id=
"@+id/constraintLayout2"
android:id=
"@+id/constraintLayout2"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:background=
"#F8F8F8"
android:orientation=
"vertical"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
@@ -182,12 +194,53 @@
...
@@ -182,12 +194,53 @@
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_marginHorizontal=
"10dp"
android:layout_marginVertical=
"10dp"
android:background=
"@drawable/bg_item_product"
>
<ImageView
android:id=
"@+id/ivMainLogo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"15dp"
android:src=
"@mipmap/ic_main_logo"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"5dp"
android:layout_toEndOf=
"@id/ivMainLogo"
android:text=
"@string/yp_fresh"
android:textColor=
"@color/black_333"
android:textSize=
"14sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:paddingHorizontal=
"12.5dp"
android:background=
"@drawable/bg_available_coupons"
android:paddingVertical=
"8dp"
android:text=
"可用优惠券"
android:onClick=
"@{()->click.onCoupon()}"
android:textColor=
"#ffa14eff"
android:textSize=
"13sp"
/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recyclerView"
android:id=
"@+id/recyclerView"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:background=
"#F8F8F8"
android:visibility=
"@{vm.recyclerVisible}"
/>
android:visibility=
"@{vm.recyclerVisible}"
/>
<View
<View
...
@@ -196,6 +249,31 @@
...
@@ -196,6 +249,31 @@
android:background=
"@drawable/bg_shadow"
android:background=
"@drawable/bg_shadow"
android:visibility=
"@{vm.recyclerVisible}"
/>
android:visibility=
"@{vm.recyclerVisible}"
/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"match_parent"
android:layout_height=
"34dp"
android:background=
"@drawable/bg_member"
android:orientation=
"horizontal"
android:visibility=
"@{vm.memberVisible}"
>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"10dp"
app:srcCompat=
"@drawable/ic_yp_member"
/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"5dp"
android:text=
"@{vm.memberMobileInfo}"
android:textColor=
"#474245"
android:textSize=
"14sp"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
<androidx.appcompat.widget.LinearLayoutCompat
android:id=
"@+id/ll_amount"
android:id=
"@+id/ll_amount"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/item_pos_product.xml
View file @
973caaaf
...
@@ -97,12 +97,14 @@
...
@@ -97,12 +97,14 @@
android:textColor=
"#FF5949"
android:textColor=
"#FF5949"
android:textSize=
"24sp"
/>
android:textSize=
"24sp"
/>
</LinearLayout>
</LinearLayout>
<TextView
<TextView
android:id=
"@+id/tv_name"
android:id=
"@+id/tv_name"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_toStartOf=
"@id/ll_price"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_toStartOf=
"@id/ll_price"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:gravity=
"start"
android:lines=
"2"
android:lines=
"2"
android:maxLines=
"2"
android:maxLines=
"2"
android:textColor=
"#474245"
android:textColor=
"#474245"
...
...
app/src/main/res/layout/popup_choose_age_group.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"click"
type=
"com.ypsx.yppos.ui.popup.ChooseAgeGroupPopupWindow.ProxyClick"
/>
<import
type=
"com.ypsx.yppos.http.data.entity.AgeGroupEnum"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_choose"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"15dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/bg_choose_dialog"
app:layout_constraintBottom_toTopOf=
"@id/cl_cancel"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvChooseAge"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingTop=
"17.5dp"
android:paddingBottom=
"15dp"
android:text=
"@string/choose_age"
android:textColor=
"@color/black_333"
android:textSize=
"16sp"
app:layout_constraintBottom_toTopOf=
"@id/view1"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<View
android:id=
"@+id/view1"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
app:layout_constraintBottom_toTopOf=
"@id/tvUnder_30"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvChooseAge"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvUnder_30"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingVertical=
"15dp"
android:text=
"@string/age_under_30"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
android:onClick=
"@{() -> click.choose(AgeGroupEnum.UNDER_30)}"
app:layout_constraintBottom_toTopOf=
"@id/view2"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/view1"
/>
<View
android:id=
"@+id/view2"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
app:layout_constraintBottom_toTopOf=
"@id/tvAgeBetween_30_50"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvUnder_30"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvAgeBetween_30_50"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingVertical=
"15dp"
android:text=
"@string/age_between_30_50"
android:onClick=
"@{() -> click.choose(AgeGroupEnum.BETWEEN_30_50)}"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
app:layout_constraintBottom_toTopOf=
"@id/view3"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/view2"
/>
<View
android:id=
"@+id/view3"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
app:layout_constraintBottom_toTopOf=
"@id/tvAgeAbove_50"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvAgeBetween_30_50"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvAgeAbove_50"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingVertical=
"15dp"
android:text=
"@string/age_above_50"
android:onClick=
"@{() -> click.choose(AgeGroupEnum.ABOVE_50)}"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/view3"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_cancel"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"15dp"
android:layout_marginBottom=
"20dp"
android:background=
"@drawable/bg_choose_dialog"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"match_parent"
android:layout_height=
"55dp"
android:gravity=
"center"
android:text=
"@string/cancel"
android:textColor=
"@color/black_333"
android:textSize=
"16sp"
android:onClick=
"@{() -> click.cancel()}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/popup_gender_choose.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"click"
type=
"com.ypsx.yppos.ui.popup.GenderChoosePopupWindow.ProxyClick"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_choose"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"15dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/bg_choose_dialog"
app:layout_constraintBottom_toTopOf=
"@id/cl_cancel"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvChooseGender"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingTop=
"17.5dp"
android:paddingBottom=
"15dp"
android:text=
"@string/choose_gender"
android:textColor=
"@color/black_333"
android:textSize=
"16sp"
app:layout_constraintBottom_toTopOf=
"@id/view1"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<View
android:id=
"@+id/view1"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
app:layout_constraintBottom_toTopOf=
"@id/tvGenderMale"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvChooseGender"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvGenderMale"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingVertical=
"15dp"
android:text=
"@string/gender_male"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
android:onClick=
"@{() -> click.choose(1)}"
app:layout_constraintBottom_toTopOf=
"@id/view2"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/view1"
/>
<View
android:id=
"@+id/view2"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
app:layout_constraintBottom_toTopOf=
"@id/tvGenderFemale"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvGenderMale"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvGenderFemale"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingVertical=
"15dp"
android:text=
"@string/gender_female"
android:onClick=
"@{() -> click.choose(2)}"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/view2"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_cancel"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"15dp"
android:layout_marginBottom=
"20dp"
android:background=
"@drawable/bg_choose_dialog"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"match_parent"
android:layout_height=
"55dp"
android:gravity=
"center"
android:text=
"@string/cancel"
android:textColor=
"@color/black_333"
android:textSize=
"16sp"
android:onClick=
"@{() -> click.cancel()}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/popup_member_login.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"click"
type=
"com.ypsx.yppos.ui.popup.MemberLoginPopupWindow.ProxyClick"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:background=
"@drawable/bg_dialog"
android:layout_height=
"wrap_content"
>
<TextView
android:id=
"@+id/tv_member_login"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/member_login"
android:textColor=
"@color/black_333"
android:textSize=
"18sp"
android:gravity=
"center"
android:layout_marginTop=
"25dp"
android:layout_marginBottom=
"25dp"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/etMemberPhone"
app:layout_constraintStart_toStartOf=
"parent"
/>
<EditText
android:id=
"@+id/etMemberPhone"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_phone"
android:digits=
"0123456789"
android:hint=
"输入手机号或扫描会员码"
android:imeOptions=
"actionDone"
android:inputType=
"phone"
android:lines=
"1"
android:maxLength=
"11"
android:padding=
"10dp"
android:textColor=
"#333333"
android:textColorHint=
"#999999"
android:textSize=
"15sp"
android:layout_marginBottom=
"40dp"
android:layout_marginHorizontal=
"20dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/view4"
app:layout_constraintTop_toBottomOf=
"@+id/tv_member_login"
/>
<View
android:id=
"@+id/view4"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/linearLayout4"
app:layout_constraintTop_toBottomOf=
"@+id/etMemberPhone"
/>
<LinearLayout
android:id=
"@+id/linearLayout4"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/view4"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_cancel"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:gravity=
"center"
android:onClick=
"@{()->click.cancel()}"
android:text=
"@string/cancel"
android:textColor=
"#a6000000"
android:textSize=
"17sp"
/>
<View
android:id=
"@+id/view_line"
android:layout_width=
"0.5dp"
android:layout_height=
"match_parent"
android:background=
"#eeeeee"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_Sure"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:gravity=
"center"
android:onClick=
"@{()->click.sure()}"
android:text=
"@string/sure"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/popup_member_register.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"click"
type=
"com.ypsx.yppos.ui.popup.MemberRegisterPopupWindow.ProxyClick"
/>
<variable
name=
"vm"
type=
"com.ypsx.yppos.viewmodel.state.MemberRegisterViewModel"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_dialog"
>
<TextView
android:id=
"@+id/tv_member_register"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"25dp"
android:layout_marginBottom=
"25dp"
android:gravity=
"center"
android:text=
"@string/member_register"
android:textColor=
"@color/black_333"
android:textSize=
"18sp"
app:layout_constraintBottom_toTopOf=
"@id/tvMemberMobile"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvMemberMobile"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"20dp"
android:layout_marginBottom=
"7.5dp"
android:background=
"@drawable/bg_phone"
android:lines=
"1"
android:maxLength=
"11"
android:padding=
"10dp"
android:text=
"@{vm.memberMobile}"
android:textColor=
"#999999"
android:textColorHint=
"#999999"
android:textSize=
"15sp"
app:layout_constraintBottom_toTopOf=
"@id/cl_choose_gender"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_member_register"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_choose_gender"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"20dp"
android:layout_marginVertical=
"7.5dp"
android:background=
"@drawable/bg_phone"
android:padding=
"10dp"
android:onClick=
"@{()->click.chooseGender()}"
app:layout_constraintBottom_toTopOf=
"@id/cl_choose_age"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvMemberMobile"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvGender"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:gravity=
"start"
android:background=
"@android:color/transparent"
android:hint=
"@string/choose_gender"
android:textColor=
"#333333"
android:textColorHint=
"#999999"
android:textSize=
"15sp"
android:focusable=
"false"
android:cursorVisible=
"false"
android:focusableInTouchMode=
"false"
android:text=
"@{vm.memberGender}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_down_1"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_down_1"
android:layout_width=
"19dp"
android:layout_height=
"12dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/tvGender"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_choose_down"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_choose_age"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"20dp"
android:layout_marginTop=
"7.5dp"
android:layout_marginBottom=
"20dp"
android:background=
"@drawable/bg_phone"
android:padding=
"10dp"
android:onClick=
"@{()->click.chooseAge()}"
app:layout_constraintBottom_toTopOf=
"@id/view4"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/cl_choose_gender"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tvAge"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:gravity=
"start"
android:hint=
"@string/choose_age"
android:background=
"@android:color/transparent"
android:textColor=
"#333333"
android:textColorHint=
"#999999"
android:textSize=
"15sp"
android:focusable=
"false"
android:cursorVisible=
"false"
android:focusableInTouchMode=
"false"
android:text=
"@{vm.memberAge}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_down_2"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_down_2"
android:layout_width=
"19dp"
android:layout_height=
"12dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/tvAge"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_choose_down"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id=
"@+id/view4"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
app:layout_constraintBottom_toTopOf=
"@id/linearLayout4"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/cl_choose_age"
/>
<LinearLayout
android:id=
"@+id/linearLayout4"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:orientation=
"horizontal"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/view4"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_cancel"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:gravity=
"center"
android:onClick=
"@{()->click.cancel()}"
android:text=
"@string/cancel"
android:textColor=
"#a6000000"
android:textSize=
"17sp"
/>
<View
android:id=
"@+id/view_line"
android:layout_width=
"0.5dp"
android:layout_height=
"match_parent"
android:background=
"#eeeeee"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_Sure"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:gravity=
"center"
android:onClick=
"@{()->click.sure()}"
android:text=
"@string/sure"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/popup_message_tips.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<variable
name=
"vm"
type=
"com.ypsx.yppos.viewmodel.state.MessageTipsViewModel"
/>
<variable
name=
"click"
type=
"com.ypsx.yppos.ui.popup.MessageTipsPopupWindow.ProxyClick"
/>
</data>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_dialog"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"39dp"
android:gravity=
"center_horizontal"
android:paddingLeft=
"8dp"
android:paddingRight=
"8dp"
android:text=
"@{vm.content}"
android:textColor=
"@color/black_333"
android:textSize=
"16sp"
tools:text=
"是否取消当前商品"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#eeeeee"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_Sure"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:gravity=
"center"
android:onClick=
"@{()->click.know()}"
android:text=
"@{vm.sure}"
android:textColor=
"#A14EFF"
android:textSize=
"17sp"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
</layout>
\ No newline at end of file
app/src/main/res/layout/popup_offer_details.xml
View file @
973caaaf
...
@@ -132,6 +132,39 @@
...
@@ -132,6 +132,39 @@
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/relativeLayout4"
android:layout_width=
"0dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"10dp"
android:layout_marginTop=
"5dp"
android:layout_marginEnd=
"10dp"
android:layout_marginBottom=
"5dp"
android:background=
"@drawable/bg_offer"
android:padding=
"10dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/relativeLayout3"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:text=
"@string/member_price_discount"
android:textColor=
"@color/black_333"
android:textSize=
"16sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:text=
"@{vm.discountMember}"
android:textColor=
"@color/black_333"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
</RelativeLayout>
<RelativeLayout
<RelativeLayout
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
@@ -142,7 +175,7 @@
...
@@ -142,7 +175,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/relativeLayout
3
"
>
app:layout_constraintTop_toBottomOf=
"@+id/relativeLayout
4
"
>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
app/src/main/res/layout/popup_order_pay_amount.xml
View file @
973caaaf
...
@@ -72,6 +72,48 @@
...
@@ -72,6 +72,48 @@
/>
/>
</LinearLayout>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_10"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"@dimen/dp_10"
android:background=
"@drawable/bg_pay_amount_check"
android:paddingStart=
"15dp"
android:paddingTop=
"@dimen/dp_10"
android:paddingEnd=
"15dp"
android:paddingBottom=
"@dimen/dp_10"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/constraintLayout3"
app:layout_constraintTop_toBottomOf=
"@+id/ll_pay_amount"
>
<TextView
android:id=
"@+id/tv_use_coupon_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/use_coupon"
android:textColor=
"#ff4d4d4d"
android:textSize=
"16sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_use_coupon"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"@{vm.discountCoupon}"
android:textColor=
"@color/red"
android:textSize=
"16sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"-¥22.00"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/constraintLayout3"
android:id=
"@+id/constraintLayout3"
...
@@ -88,7 +130,7 @@
...
@@ -88,7 +130,7 @@
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/constraintLayout4"
app:layout_constraintBottom_toTopOf=
"@id/constraintLayout4"
app:layout_constraintTop_toBottomOf=
"@+id/
ll_pay_amount
"
>
app:layout_constraintTop_toBottomOf=
"@+id/
cl_3
"
>
<TextView
<TextView
android:id=
"@+id/tv_orderNo_name"
android:id=
"@+id/tv_orderNo_name"
...
...
app/src/main/res/layout/popup_scan_coupon.xml
0 → 100644
View file @
973caaaf
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_dialog"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_scan_coupon_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"10dp"
android:layout_marginTop=
"25dp"
android:gravity=
"center"
android:text=
"请扫描优惠券券码"
android:textColor=
"@color/black_333"
android:textSize=
"18sp"
app:layout_constraintBottom_toTopOf=
"@id/tv_scan_coupon_tips"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_scan_coupon_tips"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"10dp"
android:layout_marginTop=
"10dp"
android:gravity=
"center"
android:text=
"使用优惠券后将直接进入结算,\n确保商品已添加完成"
android:textColor=
"#ff999999"
android:textSize=
"15sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_scan_coupon_title"
/>
<EditText
android:id=
"@+id/etCouponCode"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"20dp"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"25dp"
android:background=
"@drawable/bg_phone"
android:digits=
"0123456789"
android:hint=
"请扫码优惠券券码"
android:imeOptions=
"actionDone"
android:inputType=
"number"
android:lines=
"1"
android:maxLength=
"20"
android:padding=
"10dp"
android:textColor=
"#333333"
android:textColorHint=
"#999999"
android:textSize=
"15sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_scan_coupon_tips"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/mipmap-hdpi/ic_main_logo.png
0 → 100644
View file @
973caaaf
4.03 KB
app/src/main/res/mipmap-mdpi/ic_main_logo.png
0 → 100644
View file @
973caaaf
2.14 KB
app/src/main/res/mipmap-xhdpi/ic_main_logo.png
0 → 100644
View file @
973caaaf
5.73 KB
app/src/main/res/mipmap-xxhdpi/ic_main_logo.png
0 → 100644
View file @
973caaaf
11 KB
app/src/main/res/mipmap-xxxhdpi/ic_main_logo.png
0 → 100644
View file @
973caaaf
16.4 KB
app/src/main/res/values/strings.xml
View file @
973caaaf
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
<string
name=
"promotional_special_offers"
>
促销特价优惠:
</string>
<string
name=
"promotional_special_offers"
>
促销特价优惠:
</string>
<string
name=
"full_discount"
>
满减优惠:
</string>
<string
name=
"full_discount"
>
满减优惠:
</string>
<string
name=
"time_sharing_discount"
>
分时折扣优惠:
</string>
<string
name=
"time_sharing_discount"
>
分时折扣优惠:
</string>
<string
name=
"member_price_discount"
>
会员价优惠:
</string>
<string
name=
"total_discount_amount"
>
总优惠金额:
</string>
<string
name=
"total_discount_amount"
>
总优惠金额:
</string>
<string
name=
"checkout_counter"
>
收银台
</string>
<string
name=
"checkout_counter"
>
收银台
</string>
<string
name=
"order_no"
>
小票流水号
</string>
<string
name=
"order_no"
>
小票流水号
</string>
...
@@ -41,4 +42,17 @@
...
@@ -41,4 +42,17 @@
<string
name=
"return_cashier"
>
返回收银
</string>
<string
name=
"return_cashier"
>
返回收银
</string>
<string
name=
"pay_again"
>
重新支付
</string>
<string
name=
"pay_again"
>
重新支付
</string>
<string
name=
"close"
>
关闭
</string>
<string
name=
"close"
>
关闭
</string>
<string
name=
"sure"
>
确定
</string>
<string
name=
"cancel"
>
取消
</string>
<string
name=
"member_login"
>
会员登录
</string>
<string
name=
"member_register"
>
会员注册
</string>
<string
name=
"choose_age"
>
请选择年龄
</string>
<string
name=
"choose_gender"
>
请选择性别
</string>
<string
name=
"gender_male"
>
男
</string>
<string
name=
"gender_female"
>
女
</string>
<string
name=
"age_under_30"
>
30岁以下
</string>
<string
name=
"age_between_30_50"
>
30岁-50岁
</string>
<string
name=
"age_above_50"
>
50岁以上
</string>
<string
name=
"yp_fresh"
>
谊品生鲜
</string>
<string
name=
"use_coupon"
>
使用优惠券优惠
</string>
</resources>
</resources>
\ No newline at end of file
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