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/index/index",
"pages/poster/poster",
"pages/payresult/payresult",
"pages/printlastorder/printlastorder",
"pages/poster/poster",
"pages/home/home",
"pages/poster/poster",
"pages/waitoperate/waitoperate",
......
......@@ -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_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";
......
......@@ -1057,4 +1057,108 @@
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
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 @@
<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 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="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="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>
<view class="homeBodyView" style="height:100%;">
<swiper indicator-dots="{{true}}">
......@@ -301,6 +298,47 @@
</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 class="printLastOrderPage">
......
var api = require("../../utils/api.js");
import { API_SCAN } from '../../const/apiurl'
import { ACTION_GOODS } from '../../const/actioncmd'
import { ACTION_MEMBER } from '../../const/actioncmd'
import { ACTION_GO_BALANCE } from '../../const/actioncmd'
import { ACTION_REQUEST_GOOD_INFO } from '../../const/actioncmd'
import { ACTION_PRINT_RESULT } from '../../const/actioncmd'
import { ACTION_REPRINT } from '../../const/actioncmd'
import { ACTION_GO_SCAN } from '../../const/actioncmd'
import { ACTION_ON_PAY_SUCCESS } 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 {
ACTION_USE_COUPON,ACTION_GOODS,ACTION_MEMBER,
ACTION_GO_BALANCE,ACTION_REQUEST_GOOD_INFO,ACTION_PRINT_RESULT,
ACTION_REPRINT,ACTION_GO_SCAN,ACTION_ON_PAY_SUCCESS,
ACTION_ON_PAY_FAILED,ACTION_GO_HOME,ACTION_GET_ACCOUNT,
ACTION_DIRECT_PAYMENT,ACTION_CONVERT_COUPON,ACTION_LOGIN_OK,
ACTION_REFUND,ACTION_REFUND_SUCCESS,ACTION_REFUND_FAILED,
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'
......@@ -32,6 +21,7 @@ Page({
"payresult": false,
"operateResult": false,
"printlastorder": false,
"poster": false
},
// 前屏是否完成登录
isFrontScreenLoginOK: false,
......@@ -98,18 +88,19 @@ Page({
recheckBlock: false,//屏蔽取消操作,防止在实际已经进行了接口请求时还能取消,使得流程混乱
recheckShow: false,
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) {
var pageShowTemp = {
"home": false,
"landscan": false,
"waitoperate": false,
"payresult": false,
"operateResult": false,
"printlastorder": false
};
var pageShowTemp = { ...this.data.pageShow };
//遍历pageShow
for (var key in pageShowTemp) {
if (key == pageName) {
......@@ -259,6 +250,23 @@ Page({
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){
//优惠券
let coupon = res.data
......@@ -367,7 +375,20 @@ Page({
* 海报
*/
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({
} else if (this.data.scene == 1) {
this.sendGoodsInfoToFront(result)
} else if (this.data.scene == 2) {
if(result.length !=11){
if (result.length != 11) {
return;//键盘不给消失
}
this.sendMemberLogin(result);
......@@ -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 @@
position: absolute;
}
.topView {
.posterTopView {
position: absolute;
top: 0rpx;
width: 100%;
......@@ -29,7 +29,7 @@
padding-right: 19rpx;
}
.titleText {
.posterTitleText {
position: absolute;
line-height: 60rpx;
height: 100%;
......
......@@ -11,13 +11,13 @@
</block>
</view>
<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>
<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 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>
</view>
</block>
......@@ -26,9 +26,9 @@
</scroll-view>
</view>
<!--topTitle-->
<view class="topView" onTap="onPosterPageBack">
<view class="posterTopView" onTap="onPosterPageBack">
<!--title-->
<view class="titleText">
<view class="posterTitleText">
<text>海报</text>
</view>
<!--返回键-->
......
Page({
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() {
let context = this;
this.setData({
posterList: context.requestPosterList()
});
// let context = this;
// this.setData({
// posterList: context.requestPosterList()
// });
},
onPosterItemClicked(event) {
......@@ -32,14 +37,10 @@ Page({
requestPosterList() {
//just test
return [
{ url: "", selected: true },
{ url: "", selected: false },
{ url: "", selected: false },
{ url: "", selected: false },
{ url: "", selected: false },
{ url: "", selected: false },
{ url: "", selected: false },
{ url: "", selected: false },
{ 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 }
];
},
......
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