Commit 8c378b56 authored by pengguangpu's avatar pengguangpu

整合海报页面;本地写死海报数据;

parent 757ec9df
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/poster/poster",
"pages/payresult/payresult", "pages/payresult/payresult",
"pages/printlastorder/printlastorder", "pages/printlastorder/printlastorder",
"pages/poster/poster",
"pages/home/home", "pages/home/home",
"pages/poster/poster", "pages/poster/poster",
"pages/waitoperate/waitoperate", "pages/waitoperate/waitoperate",
......
...@@ -55,6 +55,13 @@ export const ACTION_REFUND_FAILED = "ACTION_REFUND_FAILED"; ...@@ -55,6 +55,13 @@ export const ACTION_REFUND_FAILED = "ACTION_REFUND_FAILED";
//打印上一单 //打印上一单
export const ACTION_PRINT_LAST_ORDER = "ACTION_PRINT_LAST_ORDER"; export const ACTION_PRINT_LAST_ORDER = "ACTION_PRINT_LAST_ORDER";
//获取当前显示的广告图片
export const ACTION_GET_CUR_AD = "ACTION_GET_CUR_AD";
//发送选中的广告url给前屏
export const ACTION_SEND_SEL_AD = "ACTION_SEND_SEL_AD";
const FLOW_IDLE = "idle"; const FLOW_IDLE = "idle";
const FLOW_COLLECTIONS = "collections";//收款 const FLOW_COLLECTIONS = "collections";//收款
const FLOW_REFUND = "refund";//退款 const FLOW_REFUND = "refund";//退款
......
...@@ -1038,3 +1038,107 @@ ...@@ -1038,3 +1038,107 @@
font-weight: 500; font-weight: 500;
line-height: 60rpx; line-height: 60rpx;
} }
/**
海报页面样式
*/
.posterPage {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
position: absolute;
}
.posterTopView {
position: absolute;
top: 0rpx;
width: 100%;
height: 60rpx;
background: #ffffff;
box-shadow: 0rpx 2rpx 7rpx 0rpx rgba(153, 153, 153, 0.16);
/* border: 2px solid red; */
}
.posterBackButton {
position: absolute;
height: 60rpx;
text-align: center;
align-items: center;
align-content: center;
font-size: 19rpx;
line-height: 60rpx;
/* border: 2px solid red; */
padding-left: 19rpx;
padding-right: 19rpx;
}
.posterTitleText {
position: absolute;
line-height: 60rpx;
height: 100%;
font-size: 22rpx;
font-weight: bold;
text-align: center;
align-items: center;
width: 100%;
align-content: center;
/* border: 2px solid red; */
}
.posterBottomView {
height: 100%;
background: white;
width: 100%;
position: absolute;
display: flex;
flex-direction: row;
/* border: 2px solid red; */
}
.posterScrollView {
white-space: nowrap;
display: flex;
margin-top: 60rpx;
padding-left: 19rpx;
}
.posterScrollViewItem {
flex-shrink: 0;
flex-grow: 0;
width: 180rpx;
height: 100%;
/* border: 1px solid red; */
display: flex;
flex-direction: column;
}
.posterSelected {
margin-top: 7rpx;
border: 2px solid #007AFF;
border-radius: 10rpx;
box-sizing: border-box;
width: 170rpx;
height: 264rpx;
margin: 0 auto;
display: flex;
align-items: center;
align-content: center;
}
.posterNonSelected {
margin-top: 7rpx;
/* border: 2px solid #007AFF; */
/* border-radius: 10rpx; */
width: 170rpx;
height: 263rpx;
margin: 0 auto;
display: flex;
align-items: center;
align-content: center;
}
.posterSelected image{
border-radius: 5rpx;
border: 0rpx solid white;
}
\ No newline at end of file
...@@ -6,10 +6,7 @@ ...@@ -6,10 +6,7 @@
<text style="position:absolute;font-size:19rpx;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:rgba(0,0,0,0.85);line-height:22rpx;left:55rpx;top:19rpx;">{{storeName}}</text> <text style="position:absolute;font-size:19rpx;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:rgba(0,0,0,0.85);line-height:22rpx;left:55rpx;top:19rpx;">{{storeName}}</text>
</view> </view>
<view style="position:absolute;font-size:22rpx;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:rgba(51,51,51,1);line-height:22rpx;left:0rpx;top:19rpx;width:100%;text-align:center;">首页</view> <view style="position:absolute;font-size:22rpx;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:rgba(51,51,51,1);line-height:22rpx;left:0rpx;top:19rpx;width:100%;text-align:center;">首页</view>
<!-- <view style="display:flex;flex-direction:row-reverse;position:absolute;right:19rpx;top:19rpx;width:auto;background:#ffffff;"> <!--<view style="display:flex;flex-direction:row-reverse;position:absolute;right:19rpx;top:19rpx;width:auto;background:#ffffff;"><view style="font-size:19rpx;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:rgba(51,51,51,1);line-height:22rpx;">退出</view><image mode="aspectFit" src="/images/icon_exit.png" style="position:relative;width:19rpx;height:19rpx;margin-right:8rpx;margin-top:1rpx;"/></view> -->
<view style="font-size:19rpx;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:rgba(51,51,51,1);line-height:22rpx;">退出</view>
<image mode="aspectFit" src="/images/icon_exit.png" style="position:relative;width:19rpx;height:19rpx;margin-right:8rpx;margin-top:1rpx;"/>
</view> -->
</view> </view>
<view class="homeBodyView" style="height:100%;"> <view class="homeBodyView" style="height:100%;">
<swiper indicator-dots="{{true}}"> <swiper indicator-dots="{{true}}">
...@@ -281,6 +278,47 @@ ...@@ -281,6 +278,47 @@
</view> </view>
</view> </view>
</view> </view>
<!--海报-->
<view class="posterPage" hidden="!{{pageShow['poster']}}">
<!--下半部分布局-->
<view class="posterBottomView">
<!--横向海报列表-->
<scroll-view class="posterScrollView" scroll-x="{{true}}" style="width: 100%">
<block a:for="{{posterList}}">
<view class="posterScrollViewItem" data-index="{{index}}" onTap="onPosterItemClicked">
<view style="margin:0 auto;color:#007AFF;margin-top:14rpx;height:27rpx;font-size:19rpx;">
<block a:if="{{posterList[index].selected}}">
<text>显示中</text>
</block>
</view>
<view class="{{posterList[index].selected ?'posterSelected':'posterNonSelected'}}">
<image mode="aspectFill" style="width:156rpx;margin:0 auto;height:250rpx;" src="{{posterList[index].url}}"/>
</view>
<block a:if="{{posterList[index].selected}}">
<image mode="aspectFill" style="margin:0 auto;width:22rpx;height:22rpx;margin-top:14rpx;" src="/images/icon_success.png"/>
</block>
<block a:else>
<image mode="aspectFill" style="margin:0 auto;width:22rpx;height:22rpx;margin-top:14rpx;" src="/images/icon_non_select.png"/>
</block>
</view>
</block>
<!--最后一处加上空白间隔view-->
<view style="height:100%;padding-right:19rpx;"></view>
</scroll-view>
</view>
<!--topTitle-->
<view class="posterTopView" onTap="onPosterPageBack">
<!--title-->
<view class="posterTitleText">
<text>海报</text>
</view>
<!--返回键-->
<view class="posterBackButton" onTap="onPosterPageBack">
<image mode="aspectFit" style="width:9rpx;height:18rpx;margin-right:8rpx;" src="/images/icon_back.png"/>
<text>返回</text>
</view>
</view>
</view>
<!--打印上一单--> <!--打印上一单-->
<view hidden="{{!pageShow['printlastorder']}}"> <view hidden="{{!pageShow['printlastorder']}}">
<view class="printLastOrderPage"> <view class="printLastOrderPage">
......
...@@ -17,7 +17,7 @@ import { ACTION_LOGIN_OK } from '../../const/actioncmd' ...@@ -17,7 +17,7 @@ import { ACTION_LOGIN_OK } from '../../const/actioncmd'
import { ACTION_REFUND } from '../../const/actioncmd' import { ACTION_REFUND } from '../../const/actioncmd'
import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd' import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd'
import { ACTION_REFUND_FAILED } from '../../const/actioncmd' import { ACTION_REFUND_FAILED } from '../../const/actioncmd'
import { ACTION_PRINT_LAST_ORDER } from '../../const/actioncmd' import { ACTION_PRINT_LAST_ORDER, ACTION_GET_CUR_AD, ACTION_SEND_SEL_AD } from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND, FLOW_DIRECT_PAYMENT } from '../../const/actioncmd' import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND, FLOW_DIRECT_PAYMENT } from '../../const/actioncmd'
...@@ -31,6 +31,7 @@ Page({ ...@@ -31,6 +31,7 @@ Page({
"payresult": false, "payresult": false,
"operateResult": false, "operateResult": false,
"printlastorder": false, "printlastorder": false,
"poster": false
}, },
// 前屏是否完成登录 // 前屏是否完成登录
isFrontScreenLoginOK: false, isFrontScreenLoginOK: false,
...@@ -95,18 +96,19 @@ Page({ ...@@ -95,18 +96,19 @@ Page({
recheckBlock: false,//屏蔽取消操作,防止在实际已经进行了接口请求时还能取消,使得流程混乱 recheckBlock: false,//屏蔽取消操作,防止在实际已经进行了接口请求时还能取消,使得流程混乱
recheckShow: false, recheckShow: false,
recheckRemind: "确定要取消此收款订单吗?", recheckRemind: "确定要取消此收款订单吗?",
/**海报页面参数 */
posterList: [
{ url: "/images/img_ad1.png", selected: true },
{ url: "/images/img_ad2.png", selected: false },
{ url: "/images/img_ad1.png", selected: false },
{ url: "/images/img_ad2.png", selected: false }
],
}, },
/**跳转页面方法 */ /**跳转页面方法 */
goPage(pageName) { goPage(pageName) {
var pageShowTemp = { var pageShowTemp = { ...this.data.pageShow };
"home": false,
"landscan": false,
"waitoperate": false,
"payresult": false,
"operateResult": false,
"printlastorder": false
};
//遍历pageShow //遍历pageShow
for (var key in pageShowTemp) { for (var key in pageShowTemp) {
if (key == pageName) { if (key == pageName) {
...@@ -240,22 +242,39 @@ Page({ ...@@ -240,22 +242,39 @@ Page({
//打印上一单结果返回 //打印上一单结果返回
//获取到打印结果 //获取到打印结果
var printLastOrderResult = res.data; var printLastOrderResult = res.data;
this.setData({ context.setData({
printLastOrderIsPrinting: false printLastOrderIsPrinting: false
}); });
if (printLastOrderResult.code == 0) { if (printLastOrderResult.code == 0) {
//打印成功 //打印成功
this.setData({ context.setData({
printLastOrderIsPrintSuccess: true, printLastOrderIsPrintSuccess: true,
printLastOrderPrintStatusHint: "打印完成" printLastOrderPrintStatusHint: "打印完成"
}); });
} else { } else {
//打印失败 //打印失败
this.setData({ context.setData({
printLastOrderIsPrintSuccess: false, printLastOrderIsPrintSuccess: false,
printLastOrderPrintStatusHint: "打印失败" printLastOrderPrintStatusHint: "打印失败"
}); });
} }
} else if (res.action == ACTION_GET_CUR_AD) {
//拿到当前显示的图片url
var curAdUrl = res.data;
//重置广告选中数据
var tempPosterList = { ...context.data.posterList };
for (var i = 0; i < tempPosterList.length; i++) {
if (tempPosterList[i].url == curAdUrl) {
tempPosterList[i].selected = true;
} else {
tempPosterList[i].selected = false;
}
}
context.setData({
posterList: tempPosterList
});
//跳转广告页面
context.goPage('poster');
} }
} }
...@@ -356,7 +375,20 @@ Page({ ...@@ -356,7 +375,20 @@ Page({
* 海报 * 海报
*/ */
onHomePosterClicked() { onHomePosterClicked() {
//发送指令至前屏,获取当前正在显示的广告页面
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_GET_CUR_AD,
data: null
},
success: (res) => {
console.log("sendBuddyMessage success:" + JSON.stringify(res));
},
fail: (res) => {
console.log("sendBuddyMessage fail:" + JSON.stringify(res));
},
});
}, },
/** /**
...@@ -569,7 +601,7 @@ Page({ ...@@ -569,7 +601,7 @@ Page({
} else if (this.data.scene == 1) { } else if (this.data.scene == 1) {
this.sendGoodsInfoToFront(result) this.sendGoodsInfoToFront(result)
} else if (this.data.scene == 2) { } else if (this.data.scene == 2) {
if(result.length !=11){ if (result.length != 11) {
return;//键盘不给消失 return;//键盘不给消失
} }
this.sendMemberLogin(result); this.sendMemberLogin(result);
...@@ -995,6 +1027,52 @@ Page({ ...@@ -995,6 +1027,52 @@ Page({
}); });
}, },
/**
* 海报页面逻辑
*/
onPosterItemClicked(event) {
console.log("event==>" + JSON.stringify(event));
//获取点击的index
var index = event.target.dataset.index;
var tempList = [];
tempList = tempList.concat(this.data.posterList);
//遍历改变posterList状态
for (var i = 0; i < tempList.length; i++) {
if (i == index) {
tempList[i].selected = true;
} else {
tempList[i].selected = false;
}
}
let context = this;
//发送指令至前屏
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_SEND_SEL_AD,
data: tempList[index].url
},
success: (res) => {
my.showToast({
content: "设置成功"
});
context.setData({
posterList: tempList
});
console.log("sendBuddyMessage success:" + JSON.stringify(res));
},
fail: (res) => {
my.showToast({
content: "设置失败"
});
console.log("sendBuddyMessage fail:" + JSON.stringify(res));
},
});
},
// 海报返回按钮
onPosterPageBack(event) {
console.log("event==>" + JSON.stringify(event));
}
}); });
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
position: absolute; position: absolute;
} }
.topView { .posterTopView {
position: absolute; position: absolute;
top: 0rpx; top: 0rpx;
width: 100%; width: 100%;
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
padding-right: 19rpx; padding-right: 19rpx;
} }
.titleText { .posterTitleText {
position: absolute; position: absolute;
line-height: 60rpx; line-height: 60rpx;
height: 100%; height: 100%;
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
</block> </block>
</view> </view>
<view class="{{posterList[index].selected ?'posterSelected':'posterNonSelected'}}"> <view class="{{posterList[index].selected ?'posterSelected':'posterNonSelected'}}">
<image mode="aspectFit" style="width:156rpx;margin:0 auto;height:250rpx;" src="/images/bg_poster_demo.png"/> <image mode="aspectFill" style="width:156rpx;margin:0 auto;height:250rpx;" src="{{posterList[index].url}}"/>
</view> </view>
<block a:if="{{posterList[index].selected}}"> <block a:if="{{posterList[index].selected}}">
<image mode="aspectFit" style="margin:0 auto;width:22rpx;height:22rpx;margin-top:14rpx;" src="/images/icon_success.png"/> <image mode="aspectFill" style="margin:0 auto;width:22rpx;height:22rpx;margin-top:14rpx;" src="/images/icon_success.png"/>
</block> </block>
<block a:else> <block a:else>
<image mode="aspectFit" style="margin:0 auto;width:22rpx;height:22rpx;margin-top:14rpx;" src="/images/icon_non_select.png"/> <image mode="aspectFill" style="margin:0 auto;width:22rpx;height:22rpx;margin-top:14rpx;" src="/images/icon_non_select.png"/>
</block> </block>
</view> </view>
</block> </block>
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
</scroll-view> </scroll-view>
</view> </view>
<!--topTitle--> <!--topTitle-->
<view class="topView" onTap="onPosterPageBack"> <view class="posterTopView" onTap="onPosterPageBack">
<!--title--> <!--title-->
<view class="titleText"> <view class="posterTitleText">
<text>海报</text> <text>海报</text>
</view> </view>
<!--返回键--> <!--返回键-->
......
Page({ Page({
data: { data: {
posterList: null posterList: [
{ url: "/images/img_ad1.png", selected: true },
{ url: "/images/img_ad2.png", selected: false },
{ url: "/images/img_ad1.png", selected: false },
{ url: "/images/img_ad2.png", selected: false }
],
}, },
onLoad() { onLoad() {
let context = this; // let context = this;
this.setData({ // this.setData({
posterList: context.requestPosterList() // posterList: context.requestPosterList()
}); // });
}, },
onPosterItemClicked(event) { onPosterItemClicked(event) {
...@@ -32,14 +37,10 @@ Page({ ...@@ -32,14 +37,10 @@ Page({
requestPosterList() { requestPosterList() {
//just test //just test
return [ return [
{ url: "", selected: true }, { url: "/images/img_ad1.png", selected: true },
{ url: "", selected: false }, { url: "/images/img_ad2.png", selected: false },
{ url: "", selected: false }, { url: "/images/img_ad1.png", selected: false },
{ url: "", selected: false }, { url: "/images/img_ad2.png", selected: false }
{ url: "", selected: false },
{ url: "", selected: false },
{ url: "", selected: false },
{ url: "", selected: 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