Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-front
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengguangpu
doublescreen-front
Commits
97e347c7
Commit
97e347c7
authored
Mar 04, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改金额失真问题
parent
60adba16
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
balance.js
pages/balance/balance.js
+1
-1
scan.js
pages/scan/scan.js
+23
-23
No files found.
pages/balance/balance.js
View file @
97e347c7
...
@@ -62,7 +62,7 @@ Page({
...
@@ -62,7 +62,7 @@ Page({
if
(
totalPrice
!=
null
)
{
if
(
totalPrice
!=
null
)
{
this
.
setData
({
this
.
setData
({
payPrice
:
totalPrice
-
totalDisc
,
payPrice
:
payUtils
.
fen2Yuan
(
payUtils
.
yuan2Fen
(
totalPrice
)
-
payUtils
.
yuan2Fen
(
totalDisc
))
,
totalPrice
:
totalPrice
,
totalPrice
:
totalPrice
,
couponPrice
:
totalDisc
,
couponPrice
:
totalDisc
,
})
})
...
...
pages/scan/scan.js
View file @
97e347c7
...
@@ -31,7 +31,7 @@ Page({
...
@@ -31,7 +31,7 @@ Page({
dialogResultFailureText
:
"录入失败,请稍后重试!"
,
dialogResultFailureText
:
"录入失败,请稍后重试!"
,
},
},
onReady
()
{
onReady
()
{
if
(
my
.
canIUse
(
'hideBackHome'
))
{
if
(
my
.
canIUse
(
'hideBackHome'
))
{
my
.
hideBackHome
();
my
.
hideBackHome
();
}
}
...
@@ -62,11 +62,11 @@ Page({
...
@@ -62,11 +62,11 @@ Page({
})
})
}
else
if
(
res
.
action
==
ACTION_MEMBER
)
{
}
else
if
(
res
.
action
==
ACTION_MEMBER
)
{
let
showPhone
=
res
.
data
.
substring
(
0
,
3
)
+
"****"
+
res
.
data
.
substring
(
7
,
11
)
let
showPhone
=
res
.
data
.
substring
(
0
,
3
)
+
"****"
+
res
.
data
.
substring
(
7
,
11
)
context
.
setData
({
context
.
setData
({
memberPhone
:
res
.
data
,
memberPhone
:
res
.
data
,
showMemberPhone
:
showPhone
,
showMemberPhone
:
showPhone
,
memberPoint
:
2130
memberPoint
:
2130
})
})
}
}
else
if
(
res
.
action
==
ACTION_GO_BALANCE
)
{
else
if
(
res
.
action
==
ACTION_GO_BALANCE
)
{
...
@@ -80,11 +80,11 @@ Page({
...
@@ -80,11 +80,11 @@ Page({
my
.
reLaunch
({
my
.
reLaunch
({
url
:
"/pages/home/home"
,
url
:
"/pages/home/home"
,
});
});
}
else
if
(
res
.
action
==
ACTION_USE_COUPON
)
{
}
else
if
(
res
.
action
==
ACTION_USE_COUPON
)
{
//优惠券
//优惠券
context
.
setData
({
context
.
setData
({
scanDialogDisplay
:
res
.
data
.
discCouponState
,
scanDialogDisplay
:
res
.
data
.
discCouponState
,
totalDisc
:
res
.
data
.
discCouponPrice
totalDisc
:
res
.
data
.
discCouponPrice
});
});
if
(
res
.
data
.
discCouponState
==
1
)
{
if
(
res
.
data
.
discCouponState
==
1
)
{
...
@@ -96,7 +96,7 @@ Page({
...
@@ -96,7 +96,7 @@ Page({
}
}
});
});
}
}
}
}
}
}
...
@@ -112,7 +112,7 @@ Page({
...
@@ -112,7 +112,7 @@ Page({
onKeyPress
(
r
)
{
onKeyPress
(
r
)
{
if
(
this
.
data
.
scanDialogDisplay
!=
0
)
{
if
(
this
.
data
.
scanDialogDisplay
!=
0
)
{
this
.
useCoupon
(
r
);
this
.
useCoupon
(
r
);
return
return
}
}
console
.
log
(
"scan onKeyPress==>"
+
r
);
console
.
log
(
"scan onKeyPress==>"
+
r
);
this
.
getGoodInfoByBarcode
(
r
);
this
.
getGoodInfoByBarcode
(
r
);
...
@@ -122,28 +122,28 @@ Page({
...
@@ -122,28 +122,28 @@ Page({
useCoupon
(
code
)
{
useCoupon
(
code
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
this
.
setData
({
scanDialogDisplay
:
2
})
setTimeout
(()
=>
{
setTimeout
(()
=>
{
let
totalDiscTemp
=
this
.
data
.
totalDisc
+
Math
.
round
(
Math
.
random
()
*
4
)
+
1
;
let
totalDiscTemp
=
this
.
data
.
totalDisc
+
Math
.
round
(
Math
.
random
()
*
4
)
+
1
;
//超额
//超额
if
(
totalDiscTemp
>
this
.
data
.
totalPrice
)
{
if
(
totalDiscTemp
>
this
.
data
.
totalPrice
)
{
let
req
=
{}
let
req
=
{}
req
.
discCouponMsg
=
"超额优惠券"
req
.
discCouponMsg
=
"超额优惠券"
req
.
discCouponState
=
4
;
req
.
discCouponState
=
4
;
this
.
useCouponCallback
(
ACTION_USE_COUPON
,
req
)
this
.
useCouponCallback
(
ACTION_USE_COUPON
,
req
)
return
return
}
}
let
req
=
{}
let
req
=
{}
req
.
discCouponPrice
=
totalDiscTemp
;
req
.
discCouponPrice
=
totalDiscTemp
;
req
.
discCouponState
=
3
;
req
.
discCouponState
=
3
;
this
.
useCouponCallback
(
ACTION_USE_COUPON
,
req
)
this
.
useCouponCallback
(
ACTION_USE_COUPON
,
req
)
},
700
);
},
700
);
},
},
//用券回调
//用券回调
useCouponCallback
(
action
,
result
)
{
useCouponCallback
(
action
,
result
)
{
let
context
=
this
;
let
context
=
this
;
my
.
ix
.
sendBuddyMessage
({
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
backScreenAppId
,
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
data
:
{
...
@@ -153,7 +153,7 @@ Page({
...
@@ -153,7 +153,7 @@ Page({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
//用券成功
//用券成功
if
(
result
.
discCouponState
==
3
)
{
if
(
result
.
discCouponState
==
3
)
{
//模拟数据 1 - 5 随机整数
//模拟数据 1 - 5 随机整数
context
.
setData
({
scanDialogDisplay
:
0
,
totalDisc
:
result
.
discCouponPrice
})
context
.
setData
({
scanDialogDisplay
:
0
,
totalDisc
:
result
.
discCouponPrice
})
my
.
showToast
({
my
.
showToast
({
...
@@ -165,13 +165,13 @@ Page({
...
@@ -165,13 +165,13 @@ Page({
},
},
});
});
//用券失败
//用券失败
}
else
if
(
result
.
discCouponState
==
4
)
{
}
else
if
(
result
.
discCouponState
==
4
)
{
context
.
setData
({
scanDialogDisplay
:
4
})
context
.
setData
({
scanDialogDisplay
:
4
})
}
}
},
},
fail
:
(
res
)
=>
{
fail
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
context
.
useCouponCallback
(
action
,
result
)
context
.
useCouponCallback
(
action
,
result
)
}
}
});
});
},
},
...
@@ -232,9 +232,9 @@ Page({
...
@@ -232,9 +232,9 @@ Page({
//价格 分转元
//价格 分转元
goodinfo
.
quantity
=
1
;
goodinfo
.
quantity
=
1
;
goodinfo
.
price
=
goodinfo
.
price
goodinfo
.
price
=
goodinfo
.
price
goodinfo
.
salePrice
=
goodinfo
.
salePrice
goodinfo
.
salePrice
=
goodinfo
.
salePrice
goodinfo
.
discnt
=
goodinfo
.
discnt
goodinfo
.
discnt
=
goodinfo
.
discnt
//总数量
//总数量
let
totalQuantityTemp
=
0
let
totalQuantityTemp
=
0
...
...
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