Commit 468cc91e authored by gaodapeng's avatar gaodapeng

增加了loading

parent ab951129
......@@ -306,7 +306,7 @@
.shopcart-list-hidden {
height: 0;
width:0;
width: 0;
}
/* 顶部空白 */
......@@ -1308,6 +1308,78 @@
margin-right: 6rpx;
}
/* loading样式 */
.loadingLayout {
text-align: center;
width: 100%;
height: 100%;
position: absolute;
top: 0rpx;
/* border: 2px solid red; */
align-items: center;
align-content: center;
box-sizing: border-box;
white-space: nowrap;
display: flex;
background: rgba(0, 0, 0, 0.5);
}
.loading {
box-sizing: border-box;
/* border: 2px solid red; */
float: left;
position: relative;
padding-left: 15rpx;
padding-right: 15rpx;
padding-top: 14rpx;
padding-bottom: 14rpx;
background: rgba(255, 255, 255, 1);
border-radius: 5rpx;
margin: 0 auto;
font-size: 19rpx;
color: white;
}
.loadingIcon {
position: relative;
width: 92rpx;
height: 92rpx;
margin: 0 auto;
-webkit-animation: loadingAnim .8s linear infinite;
animation: loadingAnim .8s linear infinite
}
.loadingText {
position: absolute;
width: 92rpx;
font-size: 19rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
top: 44rpx;
text-align: center;
color: rgba(0, 0, 0, 0.85);
line-height: 30rpx;
}
@keyframes loadingAnim {
0% {
-webkit-transform: rotate(0deg);
}
25% {
-webkit-transform: rotate(90deg);
}
50% {
-webkit-transform: rotate(180deg);
}
75% {
-webkit-transform: rotate(270deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
/* 吐司样式 */
.toastLayout {
......
......@@ -221,7 +221,6 @@
</view>
</view>
</view>
<view class="land-scan-top">
<button class="land-scan-top-member-login" size="default" type="ghost" catchTap="onMemberTap" a:if="{{memberPhoneShown == ''}}">会员登录</button>
<view class="land-scan-member" hidden="{{memberPhoneShown == ''}}">会员,{{memberPhoneShown}}</view>
......@@ -231,7 +230,6 @@
<text class="go-home-text">首页</text>
</view>
</view>
</view>
<!-- 扫描优惠券 -->
<view class="page-coupon" a:if="{{discCouponState != 0 && discCouponState != 3 }}">
......@@ -556,6 +554,13 @@
</view>
</view>
</view>
<!-- -->
<view class="loadingLayout" hidden="{{!showLoading}}">
<view class="loading">
<image mode="aspectFit" src="/images/icon_dialog_loading.png" class="loadingIcon"/>
<view class="loadingText">加载中</view>
</view>
</view>
<!--全局吐司-->
<view class="toastLayout" hidden="{{!isShowToast}}">
<view class="toast">
......
......@@ -20,6 +20,7 @@ Page({
//吐司显示
isShowToast: false,
toastText: "------",
showLoading: false,
pageShow: {
"home": true,
"landscan": false,
......@@ -234,7 +235,7 @@ Page({
})
} else if (res.action == ACTION_GOODS) {
//商品信息同步
my.hideLoading();
this.hideLoading();
let viewGoodsInfo = res.data
if (viewGoodsInfo.goods != null && viewGoodsInfo.goods.length > 0) {
context.setData({
......@@ -453,8 +454,16 @@ Page({
},
showLoading() {
this.setData({ showLoading: true })
},
hideLoading() {
this.setData({ showLoading: false })
},
//回到首页
goHome: throttle(2000, function(){
goHome: throttle(2000, function () {
console.log("goHome");
let context = this;
my.ix.sendBuddyMessage({
......@@ -497,7 +506,7 @@ Page({
/**首页相关 */
/**立即收款 */
onHomeCashierImmediatelyClicked: throttle(2000, function(){
onHomeCashierImmediatelyClicked: throttle(2000, function () {
this.setData({ scene: 3, flowType: FLOW_DIRECT_PAYMENT })
}),
......@@ -505,7 +514,7 @@ Page({
/**
* 兑换
*/
onHomeExchangeClicked: throttle(2000, function(){
onHomeExchangeClicked: throttle(2000, function () {
this.setData({ convertCouponState: 1 })
this.sendConvertCouponToFront(1)
}),
......@@ -513,7 +522,7 @@ Page({
/**
* 海报
*/
onHomePosterClicked: throttle(2000, function(){
onHomePosterClicked: throttle(2000, function () {
//发送指令至前屏,获取当前正在显示的广告页面
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
......@@ -533,7 +542,7 @@ Page({
/**
* 退款
*/
onHomeRefundClicked: throttle(2000, function(){
onHomeRefundClicked: throttle(2000, function () {
this.setData({
flowType: FLOW_REFUND,
scene: 4
......@@ -544,7 +553,7 @@ Page({
/**
* 打印上一单
*/
onHomePrintLastOrderClicked: throttle(2000, function(){
onHomePrintLastOrderClicked: throttle(2000, function () {
if (this.data.printEnabled != true) {
return;
}
......@@ -573,7 +582,7 @@ Page({
/**
* 核验
*/
onHomeVerifyClicked: throttle(2000, function(){
onHomeVerifyClicked: throttle(2000, function () {
this.setData({
flowType: FLOW_VERIFY,
})
......@@ -603,7 +612,7 @@ Page({
/**
* 提货
*/
onHomePickUpGoodsClicked: throttle(2000, function(){
onHomePickUpGoodsClicked: throttle(2000, function () {
let context = this;
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
......@@ -622,7 +631,7 @@ Page({
}),
/**日结 */
onHomeDayCheckClicked: throttle(2000, function(){
onHomeDayCheckClicked: throttle(2000, function () {
//发送打印日结订单到前屏
let context = this;
my.ix.sendBuddyMessage({
......@@ -645,14 +654,14 @@ Page({
}),
/**关于系统(实际上是关于应用) */
onHomeAboutAppClicked: throttle(2000, function(){
onHomeAboutAppClicked: throttle(2000, function () {
this.goPage("aboutsystem");
}),
/**
* 系统设置
*/
onHomeSysSettingClicked: throttle(2000, function(){
onHomeSysSettingClicked: throttle(2000, function () {
this.showToast("请在前屏操作");
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
......@@ -673,7 +682,7 @@ Page({
/**
* 应用设置
*/
onHomeAppSettingClicked: throttle(2000, function(){
onHomeAppSettingClicked: throttle(2000, function () {
this.goPage("appsetting");
}),
......@@ -684,7 +693,7 @@ Page({
//跳转至结算页
this.goPage('waitoperate');
},
onReprint: throttle(2000, function(){
onReprint: throttle(2000, function () {
if (this.data.printEnabled != true) {
return;
}
......@@ -725,10 +734,8 @@ Page({
},
//跳转到收银页面
sendGoToCollections: throttle(2000, function(){
sendGoToCollections: throttle(2000, function () {
//首先清除数据
this.setData({
......@@ -846,7 +853,7 @@ Page({
//把手输条码发生到前屏
sendGoodsInfoToFront(barcode) {
let context = this;
my.showLoading({});
this.showLoading();
var commonRequest = {
action: ACTION_REQUEST_GOOD_INFO,
data: barcode
......@@ -859,7 +866,7 @@ Page({
},
fail: (res) => {
console.log("发送商品条码到前屏小程序 失败 ===》 " + JSON.stringify(res));
my.hideLoading();
this.hideLoading();
context.showToast("操作失败");
}
})
......@@ -884,13 +891,13 @@ Page({
//清空商品信息
clearGood: throttle(2000, function(e){
clearGood: throttle(2000, function (e) {
this.setData({ goods: [], discCouponPrice: 0 })
this.calculation([]);
}),
//删除商品
deleteGood: throttle(2000, function(e){
deleteGood: throttle(2000, function (e) {
let barcode = e.target.id;
let lastgoods = this.data.goods;
let newGoods = []
......@@ -904,7 +911,7 @@ Page({
}),
//减少商品
decreaseGood: throttle(2000, function(e){
decreaseGood: throttle(2000, function (e) {
let barcode = e.target.id;
let lastgoods = this.data.goods;
......@@ -925,7 +932,7 @@ Page({
}),
//增加商品
increaseGood: throttle(2000, function(e){
increaseGood: throttle(2000, function (e) {
console.log(e);
let barcode = e.target.id;
let lastgoods = this.data.goods;
......@@ -993,7 +1000,7 @@ Page({
},
//跳转到结算等待页
goPay: throttle(2000, function(e){
goPay: throttle(2000, function (e) {
//购物车不能为空
if (this.data.goods.length == 0) {
this.showToast("等待收银员录入商品", 3000)
......@@ -1031,7 +1038,7 @@ Page({
});
}),
waitOperateBack: throttle(2000, function(){
waitOperateBack: throttle(2000, function () {
//直接返回到扫码页面,并且通知前屏返回
if (this.data.flowType == FLOW_REFUND) {
this.operateResultClose();
......@@ -1058,7 +1065,7 @@ Page({
}),
//等待操作页,取消付款/收款等按钮
waitOperateCancel: throttle(2000, function(){
waitOperateCancel: throttle(2000, function () {
//todo 是否需要加上当接口在请求时,则屏蔽取消按钮的操作?
console.log("取消操作等待页");
......@@ -1084,7 +1091,7 @@ Page({
}),
//提货关闭
pickGoodsClose: throttle(2000, function(e){
pickGoodsClose: throttle(2000, function (e) {
let context = this;
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
......@@ -1102,7 +1109,7 @@ Page({
})
}),
//兑换券界面关闭
convertCouponClose: throttle(2000, function(e){
convertCouponClose: throttle(2000, function (e) {
this.setData({ convertCouponState: 0 })
this.sendConvertCouponToFront(0)
}),
......@@ -1146,12 +1153,12 @@ Page({
},
//用券返回
couponBack: throttle(2000, function(e){
couponBack: throttle(2000, function (e) {
this.setData({ discCouponState: 0 })
this.sendDiscCouponToFront(0)
}),
//使用券
useCoupon: throttle(2000, function(e){
useCoupon: throttle(2000, function (e) {
if (this.data.goods.length == 0) {
this.showToast("请先录入商品")
......@@ -1238,7 +1245,7 @@ Page({
},
onPrintLastOrderBackClicked: throttle(2000, function(e){
onPrintLastOrderBackClicked: throttle(2000, function (e) {
//回首页
this.setData({
printLastOrderIsPrintSuccess: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment