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
4996a488
Commit
4996a488
authored
Feb 25, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
da16d384
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
14 deletions
+56
-14
balance.js
pages/balance/balance.js
+18
-6
home.js
pages/home/home.js
+38
-8
No files found.
pages/balance/balance.js
View file @
4996a488
...
@@ -13,7 +13,6 @@ Page({
...
@@ -13,7 +13,6 @@ Page({
qrPayShow
:
false
,
qrPayShow
:
false
,
list
:
[],
list
:
[],
orderNo
:
""
,
orderNo
:
""
,
isCashierClosed
:
false
,
isPaying
:
false
,
isPaying
:
false
,
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -54,7 +53,13 @@ Page({
...
@@ -54,7 +53,13 @@ Page({
}
}
});
});
var
speechContent
=
totalPrice
+
"元 请刷脸或扫码支付"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
},
},
...
@@ -125,7 +130,6 @@ Page({
...
@@ -125,7 +130,6 @@ Page({
if
(
res
.
codeType
==
"F"
)
{
if
(
res
.
codeType
==
"F"
)
{
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
}
else
{
}
else
{
this
.
data
.
isCashierClosed
=
true
;
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
}
}
},
fail
:
(
res
)
=>
{
},
fail
:
(
res
)
=>
{
...
@@ -142,7 +146,6 @@ Page({
...
@@ -142,7 +146,6 @@ Page({
if
(
res
.
bizType
==
'RESULT_CLOSED'
||
res
.
status
==
"RESULT_CLOSE"
)
{
if
(
res
.
bizType
==
'RESULT_CLOSED'
||
res
.
status
==
"RESULT_CLOSE"
)
{
console
.
log
(
"收银台关闭"
);
console
.
log
(
"收银台关闭"
);
this
.
data
.
isCashierClosed
=
true
;
//关闭监听
//关闭监听
my
.
ix
.
offCashierEventReceive
();
my
.
ix
.
offCashierEventReceive
();
if
(
this
.
data
.
isPaying
==
true
)
{
if
(
this
.
data
.
isPaying
==
true
)
{
...
@@ -192,7 +195,17 @@ Page({
...
@@ -192,7 +195,17 @@ Page({
if
(
res
.
resultCode
==
1
)
{
if
(
res
.
resultCode
==
1
)
{
//成功
//成功
console
.
log
(
"支付回调成功,跳转 "
);
console
.
log
(
"支付回调成功,跳转 "
);
// if(data.isCashierClosed == true){
if
(
res
.
data
.
tradeAmount
!=
null
)
{
var
speechContent
=
"成功支付"
+
res
.
data
.
tradeAmount
+
"元"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
}
my
.
ix
.
offCashierEventReceive
();
my
.
ix
.
offCashierEventReceive
();
this
.
saveData
(
this
.
data
.
list
,
res
.
data
);
this
.
saveData
(
this
.
data
.
list
,
res
.
data
);
my
.
redirectTo
({
my
.
redirectTo
({
...
@@ -214,7 +227,6 @@ Page({
...
@@ -214,7 +227,6 @@ Page({
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
}
});
});
// }
}
else
{
}
else
{
console
.
log
(
"支付回调失败,toast提示 "
);
console
.
log
(
"支付回调失败,toast提示 "
);
my
.
ix
.
offCashierEventReceive
();
my
.
ix
.
offCashierEventReceive
();
...
...
pages/home/home.js
View file @
4996a488
...
@@ -104,8 +104,16 @@ Page({
...
@@ -104,8 +104,16 @@ Page({
dialogResultSuccessText
:
"恭喜您!兑换成功"
,
dialogResultSuccessText
:
"恭喜您!兑换成功"
,
dialogResultFailureRemind
:
"兑换码未识别"
,
dialogResultFailureRemind
:
"兑换码未识别"
,
dialogResultFailureText
:
"兑换失败,请稍后重试!"
,
dialogResultFailureText
:
"兑换失败,请稍后重试!"
,
})
});
if
(
res
.
data
!=
0
)
{
var
speechContent
=
"请扫描兑换码"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
}
}
else
if
(
res
.
action
==
ACTION_REFUND
)
{
}
else
if
(
res
.
action
==
ACTION_REFUND
)
{
//显示弹窗
//显示弹窗
context
.
setData
({
context
.
setData
({
...
@@ -119,7 +127,12 @@ Page({
...
@@ -119,7 +127,12 @@ Page({
dialogResultFailureText
:
"退款失败!无效的订单码"
,
dialogResultFailureText
:
"退款失败!无效的订单码"
,
});
});
console
.
log
(
"ACTION_REFUND"
);
console
.
log
(
"ACTION_REFUND"
);
var
speechContent
=
"请扫描订单编码"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
//home界面收到,则返回界面上
//home界面收到,则返回界面上
context
.
setData
({
context
.
setData
({
...
@@ -269,13 +282,22 @@ Page({
...
@@ -269,13 +282,22 @@ Page({
//核销券
//核销券
verifyCoupon
(
code
)
{
verifyCoupon
(
code
)
{
//语音提示已识别
var
speechContent
=
"兑换码已识别"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
this
.
setData
({
scanDialogDisplay
:
2
})
this
.
setData
({
scanDialogDisplay
:
2
})
var
commonRequest
=
{};
var
commonRequest
=
{};
commonRequest
.
state
=
2
commonRequest
.
state
=
2
this
.
sendConvertCouponToBack
(
commonRequest
)
this
.
sendConvertCouponToBack
(
commonRequest
)
var
couponRequest
=
api
.
createCommonRequest
();
var
couponRequest
=
api
.
createCommonRequest
();
couponRequest
.
couponCode
=
code
;
couponRequest
.
couponCode
=
code
;
console
.
log
(
"
核销券
的请求 ==>"
+
JSON
.
stringify
(
couponRequest
));
console
.
log
(
"
兑换码
的请求 ==>"
+
JSON
.
stringify
(
couponRequest
));
let
context
=
this
;
let
context
=
this
;
my
.
request
({
my
.
request
({
url
:
getApp
().
globalData
.
BASE_URL
+
API_USE_COUPON
,
url
:
getApp
().
globalData
.
BASE_URL
+
API_USE_COUPON
,
...
@@ -284,20 +306,20 @@ Page({
...
@@ -284,20 +306,20 @@ Page({
timeout
:
30000
,
timeout
:
30000
,
data
:
couponRequest
,
data
:
couponRequest
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
"
核销券
成功 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"
兑换
成功 ==>"
+
JSON
.
stringify
(
res
));
if
(
res
.
data
.
success
!=
true
)
{
if
(
res
.
data
.
success
!=
true
)
{
var
commonRequest
=
{};
var
commonRequest
=
{};
commonRequest
.
state
=
4
commonRequest
.
state
=
4
commonRequest
.
msg
=
res
.
data
.
errorMsg
commonRequest
.
msg
=
res
.
data
.
errorMsg
context
.
sendConvertCouponToBack
(
commonRequest
)
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"
核销券
失败 ==>"
+
res
.
data
.
errorMsg
);
console
.
log
(
"
兑换
失败 ==>"
+
res
.
data
.
errorMsg
);
}
else
{
}
else
{
var
commonRequest
=
{};
var
commonRequest
=
{};
commonRequest
.
state
=
3
commonRequest
.
state
=
3
context
.
sendConvertCouponToBack
(
commonRequest
)
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
3
})
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"
核销券
成功 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"
兑换
成功 ==>"
+
JSON
.
stringify
(
res
));
}
}
},
},
fail
:
(
res
)
=>
{
fail
:
(
res
)
=>
{
...
@@ -306,7 +328,7 @@ Page({
...
@@ -306,7 +328,7 @@ Page({
commonRequest
.
msg
=
"网络异常"
commonRequest
.
msg
=
"网络异常"
context
.
sendConvertCouponToBack
(
commonRequest
)
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"
核销券
失败 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"
兑换
失败 ==>"
+
JSON
.
stringify
(
res
));
my
.
showToast
({
my
.
showToast
({
type
:
'exception'
,
type
:
'exception'
,
content
:
api
.
decodeErrorMessage
(
res
.
error
),
content
:
api
.
decodeErrorMessage
(
res
.
error
),
...
@@ -320,6 +342,7 @@ Page({
...
@@ -320,6 +342,7 @@ Page({
//退款
//退款
refund
(
barcode
)
{
refund
(
barcode
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
this
.
setData
({
scanDialogDisplay
:
2
})
var
request
=
api
.
createCommonRequest
();
var
request
=
api
.
createCommonRequest
();
request
.
tradeNo
=
barcode
;
request
.
tradeNo
=
barcode
;
...
@@ -340,6 +363,13 @@ Page({
...
@@ -340,6 +363,13 @@ Page({
}
}
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
message
);
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
message
);
}
else
{
}
else
{
var
speechContent
=
"退款成功"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
this
.
setData
({
scanDialogDisplay
:
3
})
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"退款成功 ==>"
+
JSON
.
stringify
(
res
.
data
));
console
.
log
(
"退款成功 ==>"
+
JSON
.
stringify
(
res
.
data
));
this
.
refundCallback
(
ACTION_REFUND_SUCCESS
,
res
.
data
.
data
);
this
.
refundCallback
(
ACTION_REFUND_SUCCESS
,
res
.
data
.
data
);
...
...
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