Commit 7ab9e485 authored by pengguangpu's avatar pengguangpu

本地写死广告页配置;

parent 4b25e081
...@@ -56,4 +56,10 @@ export const ACTION_LOGIN_OK = "ACTION_LOGIN_OK"; ...@@ -56,4 +56,10 @@ export const ACTION_LOGIN_OK = "ACTION_LOGIN_OK";
export const ACTION_PRINT_LAST_ORDER = "ACTION_PRINT_LAST_ORDER"; export const ACTION_PRINT_LAST_ORDER = "ACTION_PRINT_LAST_ORDER";
//使用优惠券 //使用优惠券
export const ACTION_USE_COUPON = "ACTION_USE_COUPON"; export const ACTION_USE_COUPON = "ACTION_USE_COUPON";
\ No newline at end of file
//获取当前显示的广告图片
export const ACTION_GET_CUR_AD = "ACTION_GET_CUR_AD";
//发送选中的广告url给前屏
export const ACTION_SEND_SEL_AD = "ACTION_SEND_SEL_AD";
\ No newline at end of file
...@@ -7,13 +7,16 @@ page{ ...@@ -7,13 +7,16 @@ page{
} }
.bg{ .bg{
position:absolute; position:fixed;
width:100%; width:100%;
height:100%; height:100%;
left:0rpx; left:0rpx;
top:0rpx; top:0rpx;
background:url(/images/bg_home.png) no-repeat fixed top; bottom:0rpx;
/* background:url(/images/bg_home.png) no-repeat fixed top; */
background-size:100% 100%; background-size:100% 100%;
/* border: 2px solid red; */
box-sizing: border-box;
} }
.container{ .container{
......
<view class="page" > <view class="page" >
<view class="bg" onTap="homeTap"/> <view class="bg" onTap="homeTap">
<image mode="scaleToFill" style="width:100%;height:100%;" src="{{adUrl}}"/>
</view>
<!-- 弹窗 --> <!-- 弹窗 -->
<scandialog displayDialog="{{scanDialogDisplay}}" <scandialog displayDialog="{{scanDialogDisplay}}"
......
var api = require("../../utils/api.js"); var api = require("../../utils/api.js");
import { Page } from '../../utils/scan'; import { Page } from '../../utils/scan';
//API
import { API_USE_COUPON } from '../../const/apiurl' import { API_USE_COUPON } from '../../const/apiurl'
import { API_REFUND } from '../../const/apiurl' import { API_REFUND } from '../../const/apiurl'
import { ACTION_GO_SCAN } from '../../const/actioncmd' //ACTION
import { ACTION_GET_ACCOUNT } from '../../const/actioncmd' import {
import { ACTION_DIRECT_PAYMENT } from '../../const/actioncmd' ACTION_GO_SCAN, ACTION_GET_CUR_AD, ACTION_SEND_SEL_AD,
import { ACTION_CONVERT_COUPON } from '../../const/actioncmd' ACTION_GET_ACCOUNT, ACTION_DIRECT_PAYMENT, ACTION_CONVERT_COUPON,
import { ACTION_GO_HOME } from '../../const/actioncmd' ACTION_GO_HOME, ACTION_REFUND, ACTION_REFUND_FAILED,
import { ACTION_REFUND } from '../../const/actioncmd' ACTION_REFUND_SUCCESS, ACTION_PRINT_LAST_ORDER
import { ACTION_REFUND_FAILED } from '../../const/actioncmd' } from '../../const/actioncmd'
import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd'
import { ACTION_PRINT_LAST_ORDER } from '../../const/actioncmd'
Page({ Page({
...@@ -24,6 +23,7 @@ Page({ ...@@ -24,6 +23,7 @@ Page({
dialogResultSuccessText: "恭喜您!兑换成功", dialogResultSuccessText: "恭喜您!兑换成功",
dialogResultFailureRemind: "兑换码未识别", dialogResultFailureRemind: "兑换码未识别",
dialogResultFailureText: "兑换失败,请稍后重试!", dialogResultFailureText: "兑换失败,请稍后重试!",
adUrl: "/images/img_ad1.png"
}, },
onLoad() { onLoad() {
...@@ -167,11 +167,39 @@ Page({ ...@@ -167,11 +167,39 @@ Page({
} }
//去打印 //去打印
context.printLastOrder(printLastOrder_goodsList, printLastOrder_paySuccessResp) context.printLastOrder(printLastOrder_goodsList, printLastOrder_paySuccessResp)
} else if (res.action == ACTION_GET_CUR_AD) {
//返回当前选中广告
context.returnCurShowAd();
} else if (res.action == ACTION_SEND_SEL_AD) {
var selectAdUrl = res.data;
//改变当前的广告显示
context.setData({
adUrl: selectAdUrl
});
} }
} }
}); });
}, },
/**返回当前选中广告 */
returnCurShowAd() {
let context = this;
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_GET_CUR_AD,
data: context.data.adUrl
},
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
},
/**打印上一单 */ /**打印上一单 */
printLastOrder(printLastOrder_goodsList, printLastOrder_paySuccessResp) { printLastOrder(printLastOrder_goodsList, printLastOrder_paySuccessResp) {
var printLastOrder_orderPriceFen = printLastOrder_paySuccessResp.tradeAmount; var printLastOrder_orderPriceFen = printLastOrder_paySuccessResp.tradeAmount;
...@@ -282,7 +310,7 @@ Page({ ...@@ -282,7 +310,7 @@ Page({
//核销券 //核销券
verifyCoupon(code) { verifyCoupon(code) {
this.setData({ scanDialogDisplay: 2 }) this.setData({ scanDialogDisplay: 2 })
var commonRequest = {}; var commonRequest = {};
......
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