Commit aaf0d433 authored by jiangjiantao's avatar jiangjiantao

Merge branch 'dev-1.0' of…

Merge branch 'dev-1.0' of https://gitlab.infra.miyatech.com/pengguangpu/doublescreen-back into dev-1.0
parents 46dfe51f fc55a09d
{ {
"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,12 @@ export const ACTION_REFUND_FAILED = "ACTION_REFUND_FAILED"; ...@@ -55,6 +55,12 @@ 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";
//使用优惠券 //使用优惠券
export const ACTION_USE_COUPON = "ACTION_USE_COUPON"; export const ACTION_USE_COUPON = "ACTION_USE_COUPON";
......
...@@ -1057,4 +1057,108 @@ ...@@ -1057,4 +1057,108 @@
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
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}}">
...@@ -301,6 +298,47 @@ ...@@ -301,6 +298,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">
......
var api = require("../../utils/api.js"); var api = require("../../utils/api.js");
import { API_SCAN } from '../../const/apiurl' import {
import { ACTION_GOODS } from '../../const/actioncmd' ACTION_USE_COUPON,ACTION_GOODS,ACTION_MEMBER,
import { ACTION_MEMBER } from '../../const/actioncmd' ACTION_GO_BALANCE,ACTION_REQUEST_GOOD_INFO,ACTION_PRINT_RESULT,
import { ACTION_GO_BALANCE } from '../../const/actioncmd' ACTION_REPRINT,ACTION_GO_SCAN,ACTION_ON_PAY_SUCCESS,
import { ACTION_REQUEST_GOOD_INFO } from '../../const/actioncmd' ACTION_ON_PAY_FAILED,ACTION_GO_HOME,ACTION_GET_ACCOUNT,
import { ACTION_PRINT_RESULT } from '../../const/actioncmd' ACTION_DIRECT_PAYMENT,ACTION_CONVERT_COUPON,ACTION_LOGIN_OK,
import { ACTION_REPRINT } from '../../const/actioncmd' ACTION_REFUND,ACTION_REFUND_SUCCESS,ACTION_REFUND_FAILED,
import { ACTION_GO_SCAN } from '../../const/actioncmd' ACTION_PRINT_LAST_ORDER, ACTION_GET_CUR_AD, ACTION_SEND_SEL_AD,
import { ACTION_ON_PAY_SUCCESS } from '../../const/actioncmd' } from '../../const/actioncmd'
import { ACTION_ON_PAY_FAILED } from '../../const/actioncmd'
import { ACTION_GO_HOME } from '../../const/actioncmd'
import { ACTION_GET_ACCOUNT } from '../../const/actioncmd'
import { ACTION_DIRECT_PAYMENT } from '../../const/actioncmd'
import { ACTION_CONVERT_COUPON } from '../../const/actioncmd'
import { ACTION_LOGIN_OK } from '../../const/actioncmd'
import { ACTION_REFUND } from '../../const/actioncmd'
import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd'
import { ACTION_REFUND_FAILED } from '../../const/actioncmd'
import { ACTION_PRINT_LAST_ORDER } from '../../const/actioncmd'
import { ACTION_USE_COUPON } 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'
...@@ -32,6 +21,7 @@ Page({ ...@@ -32,6 +21,7 @@ Page({
"payresult": false, "payresult": false,
"operateResult": false, "operateResult": false,
"printlastorder": false, "printlastorder": false,
"poster": false
}, },
// 前屏是否完成登录 // 前屏是否完成登录
isFrontScreenLoginOK: false, isFrontScreenLoginOK: false,
...@@ -98,18 +88,19 @@ Page({ ...@@ -98,18 +88,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) {
...@@ -259,6 +250,23 @@ Page({ ...@@ -259,6 +250,23 @@ Page({
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');
}else if(res.action == ACTION_USE_COUPON){ }else if(res.action == ACTION_USE_COUPON){
//优惠券 //优惠券
let coupon = res.data let coupon = res.data
...@@ -367,7 +375,20 @@ Page({ ...@@ -367,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));
},
});
}, },
/** /**
...@@ -582,7 +603,7 @@ Page({ ...@@ -582,7 +603,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);
...@@ -1036,6 +1057,54 @@ Page({ ...@@ -1036,6 +1057,54 @@ 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));
//回首页
this.goPage('home');
}
}); });
...@@ -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