Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-back
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-back
Commits
28abb413
Commit
28abb413
authored
Jun 28, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对首页的按钮加了loading和互斥逻辑
parent
d79d95af
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
2 deletions
+56
-2
index.js
pages/index/index.js
+56
-2
No files found.
pages/index/index.js
View file @
28abb413
...
...
@@ -162,7 +162,6 @@ Page({
onLoad
(
query
)
{
console
.
info
(
a
);
// 页面加载
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
},
...
...
@@ -507,6 +506,9 @@ Page({
/**首页相关 */
/**立即收款 */
onHomeCashierImmediatelyClicked
:
throttle
(
2000
,
function
()
{
if
(
this
.
showLoading
==
true
)
{
return
}
this
.
setData
({
scene
:
3
,
flowType
:
FLOW_DIRECT_PAYMENT
})
}),
...
...
@@ -515,6 +517,10 @@ Page({
* 兑换
*/
onHomeExchangeClicked
:
throttle
(
2000
,
function
()
{
if
(
this
.
showLoading
==
true
)
{
return
}
this
.
setData
({
convertCouponState
:
1
})
this
.
sendConvertCouponToFront
(
1
)
}),
...
...
@@ -524,6 +530,10 @@ Page({
*/
onHomePosterClicked
:
throttle
(
2000
,
function
()
{
//发送指令至前屏,获取当前正在显示的广告页面
if
(
this
.
showLoading
==
true
)
{
return
}
this
.
showLoading
();
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
frontScreenAppId
,
data
:
{
...
...
@@ -531,9 +541,11 @@ Page({
data
:
null
},
success
:
(
res
)
=>
{
this
.
hideLoading
()
console
.
log
(
"sendBuddyMessage success:"
+
JSON
.
stringify
(
res
));
},
fail
:
(
res
)
=>
{
this
.
hideLoading
()
console
.
log
(
"sendBuddyMessage fail:"
+
JSON
.
stringify
(
res
));
},
});
...
...
@@ -543,6 +555,9 @@ Page({
* 退款
*/
onHomeRefundClicked
:
throttle
(
2000
,
function
()
{
if
(
this
.
showLoading
){
return
}
this
.
setData
({
flowType
:
FLOW_REFUND
,
scene
:
4
...
...
@@ -557,6 +572,9 @@ Page({
if
(
this
.
data
.
printEnabled
!=
true
)
{
return
;
}
if
(
this
.
showLoading
){
return
}
let
context
=
this
;
//发送指令至前屏
//通知前屏重新打印
...
...
@@ -568,11 +586,13 @@ Page({
data
:
null
},
success
:
(
res
)
=>
{
context
.
hideLoading
()
console
.
info
(
`onHomePrintLastOrderClicked sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
//跳转至打印上一单页面
context
.
goPage
(
'printlastorder'
);
},
fail
:
(
res
)
=>
{
context
.
hideLoading
()
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
context
.
showToast
(
"发送指令失败"
);
}
...
...
@@ -583,6 +603,10 @@ Page({
* 核验
*/
onHomeVerifyClicked
:
throttle
(
2000
,
function
()
{
if
(
this
.
showLoading
){
return
}
this
.
showLoading
()
this
.
setData
({
flowType
:
FLOW_VERIFY
,
})
...
...
@@ -593,6 +617,7 @@ Page({
waitOperateCancelText
:
"关闭"
,
waitOperateHideLeft
:
true
,
})
let
context
=
this
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
frontScreenAppId
,
...
...
@@ -601,9 +626,11 @@ Page({
data
:
null
},
success
:
(
res
)
=>
{
context
.
hideLoading
()
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
},
fail
:
(
res
)
=>
{
context
.
hideLoading
()
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
...
...
@@ -613,6 +640,10 @@ Page({
* 提货
*/
onHomePickUpGoodsClicked
:
throttle
(
2000
,
function
()
{
if
(
this
.
showLoading
){
return
}
this
.
showLoading
()
let
context
=
this
;
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
frontScreenAppId
,
...
...
@@ -621,10 +652,12 @@ Page({
data
:
1
},
success
:
(
sres
)
=>
{
context
.
hideLoading
()
context
.
setData
({
pickGoodsState
:
1
})
console
.
log
(
"提货通知前屏 成功 ===》"
+
JSON
.
stringify
(
sres
));
},
fail
:
(
fres
)
=>
{
context
.
hideLoading
()
console
.
log
(
"提货通知前屏 失败 ===》 "
+
JSON
.
stringify
(
fres
));
}
})
...
...
@@ -632,6 +665,10 @@ Page({
/**日结 */
onHomeDayCheckClicked
:
throttle
(
2000
,
function
()
{
if
(
this
.
showLoading
){
return
}
this
.
showLoading
()
//发送打印日结订单到前屏
let
context
=
this
;
my
.
ix
.
sendBuddyMessage
({
...
...
@@ -642,11 +679,13 @@ Page({
data
:
null
},
success
:
(
res
)
=>
{
context
.
hideLoading
()
context
.
showToast
(
'已发送日结打印请求...'
);
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
},
fail
:
(
res
)
=>
{
context
.
hideLoading
()
context
.
showToast
(
'发送失败'
);
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
...
...
@@ -737,6 +776,10 @@ Page({
//跳转到收银页面
sendGoToCollections
:
throttle
(
2000
,
function
()
{
if
(
this
.
showLoading
==
true
)
{
return
}
this
.
showLoading
();
//首先清除数据
this
.
setData
({
totalQuantity
:
0
,
...
...
@@ -760,6 +803,7 @@ Page({
target
:
getApp
().
globalData
.
frontScreenAppId
,
data
:
commonRequest
,
success
:
(
res
)
=>
{
context
.
hideLoading
()
context
.
setData
({
flowType
:
FLOW_COLLECTIONS
})
...
...
@@ -767,6 +811,7 @@ Page({
console
.
log
(
"发送收银事件到前屏小程序 成功 ===》"
+
JSON
.
stringify
(
res
));
},
fail
:
(
res
)
=>
{
context
.
hideLoading
()
context
.
setData
({
flowType
:
FLOW_IDLE
})
...
...
@@ -785,6 +830,7 @@ Page({
action
:
ACTION_DIRECT_PAYMENT
,
data
:
payment
};
this
.
showLoading
()
let
context
=
this
;
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
frontScreenAppId
,
...
...
@@ -792,6 +838,7 @@ Page({
success
:
(
res
)
=>
{
console
.
log
(
"发送直接收款事件到前屏小程序 成功 ===》"
+
JSON
.
stringify
(
res
));
//直接收款
context
.
hideLoading
()
context
.
clearGood
();
if
(
payment
!=
null
)
{
context
.
setData
({
...
...
@@ -807,6 +854,7 @@ Page({
context
.
goPage
(
'waitoperate'
);
},
fail
:
(
res
)
=>
{
context
.
hideLoading
()
console
.
log
(
"发送收款事件到前屏小程序 失败 ===》 "
+
JSON
.
stringify
(
res
));
context
.
showToast
(
"操作失败"
);
},
...
...
@@ -853,7 +901,6 @@ Page({
//把手输条码发生到前屏
sendGoodsInfoToFront
(
barcode
)
{
let
context
=
this
;
this
.
showLoading
();
var
commonRequest
=
{
action
:
ACTION_REQUEST_GOOD_INFO
,
data
:
barcode
...
...
@@ -1137,6 +1184,7 @@ Page({
//发生兑换券到前屏
sendConvertCouponToFront
(
res
)
{
let
context
=
this
;
context
.
showLoading
()
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
frontScreenAppId
,
data
:
{
...
...
@@ -1144,9 +1192,11 @@ Page({
data
:
res
},
success
:
(
sres
)
=>
{
context
.
hideLoading
()
console
.
log
(
"兑换券通知前屏 成功 ===》"
+
JSON
.
stringify
(
sres
));
},
fail
:
(
fres
)
=>
{
context
.
hideLoading
()
console
.
log
(
"兑换券通知前屏 失败 ===》 "
+
JSON
.
stringify
(
fres
));
}
})
...
...
@@ -1186,6 +1236,8 @@ Page({
object
.
refundAmount
=
amount
;
}
this
.
showLoading
()
this
.
goPage
(
'waitoperate'
);
this
.
setData
({
waitOperateMoneyRemind
:
"应退款:"
,
...
...
@@ -1207,10 +1259,12 @@ Page({
data
:
refundAmount
},
success
:
(
res
)
=>
{
context
.
hideLoading
()
//成功发送则
console
.
log
(
"发送退款金额到前屏小程序成功 ===》"
+
JSON
.
stringify
(
res
));
},
fail
:
(
res
)
=>
{
context
.
hideLoading
()
context
.
showToast
(
"操作失败"
);
}
})
...
...
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