Pārlūkot izejas kodu

[券详情二维码亮度去掉][修改]:券详情二维码亮度去掉

tags/2.3.0
meo pirms 6 gadiem
vecāks
revīzija
8eac199833
8 mainītis faili ar 255 papildinājumiem un 232 dzēšanām
  1. +44
    -46
      pages/couponorder/detail/index.js
  2. +8
    -9
      pages/couponorder/index/index.js
  3. +30
    -19
      pages/index/coupons/index.js
  4. +125
    -117
      pages/index/index.js
  5. +8
    -9
      pages/order/detail/index.js
  6. +1
    -1
      pages/order/index/index.js
  7. +36
    -30
      pages/orderquanma/index.js
  8. +3
    -1
      pages/passCar/couponList/couponList.wxss

+ 44
- 46
pages/couponorder/detail/index.js Parādīt failu

@@ -1,13 +1,13 @@
const util = require("../../../utils/util");
const config = require("../../../config/config.js");
const Http = require("../../../utils/HttpBasics");
let app = getApp();
//券详情页面
Page({
data: {
code: "",
data: {
salePrice:null,
salePrice: null,
price: null,
usePrice: null
},
@@ -17,14 +17,12 @@ Page({
//存储计时器
setInter: "",
staticGamedata: {},
showIf:false,
showIf: false,
},
onUnload: function() {
onUnload:function(){
console.log("onUnload");
let that = this;
clearInterval(that.data.setInter);
wx.setScreenBrightness({
value: that.data.sight,
})
},
gotogame: function () {
let that = this;
@@ -50,31 +48,30 @@ Page({
staticGamedata: res.data
})
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
},
onLoad: function(options) {
// onShow(options) {
// setTimeout(function () {
// wx.setScreenBrightness({
// value: 0.7,
// })
// }, 200)
// },
onLoad: function (options) {
let that = this;
setTimeout(function() {
wx.setScreenBrightness({
value: 0.7,
})
}, 200),
that.setData({
sight: options.sight,
code: options.quancode,
couponorderstatus: options.couponorderstatus
});


that.setData({
code: options.quancode,
couponorderstatus: options.couponorderstatus
});
//获得优惠券的详情
that.data.setInter = setInterval(function() {
that.data.setInter = setInterval(function () {
if (
options.quancode &&
that.data.couponorderstatus == 0
@@ -85,6 +82,7 @@ Page({
couponOrderId: options.quancode
}
}).then(res => {
console.log(res);
that.setData({
couponorderstatus: res.data.couponOrderStatus,
data: res.data
@@ -108,14 +106,14 @@ Page({
createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss")
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
}
}, 2000);

@@ -140,16 +138,16 @@ Page({
util.barcode("barcode", options.quancode, 510, 100);
util.qrcode("qrcode", options.quancode, 350, 350);
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
},
phone: function() {
phone: function () {
let that = this;
if (that.data.data.merchantLinkPhone) {
wx.makePhoneCall({


+ 8
- 9
pages/couponorder/index/index.js Parādīt failu

@@ -1,6 +1,7 @@
const util = require("../../../utils/util.js");
const config = require("../../../config/config.js");
const Http = require("../../../utils/HttpBasics");
let app = getApp();
Page({
data: {
tabs: [{
@@ -40,14 +41,12 @@ Page({
})
wx.hideTabBarRedDot({
index:2
}),
wx.getScreenBrightness({
success:function(res){
that.setData({
sight:res.value
})
}
});
})
// wx.getScreenBrightness({
// success:function(res){
// app.globalData.sight = res.value;
// }
// });
},
//点击跳转到券详情页面
gotouse: function (e) {
@@ -58,7 +57,7 @@ Page({
}
wx.navigateTo({
url: `/pages/couponorder/detail/index?quancode=${
e.currentTarget.dataset.quancode}&couponorderstatus=${mystatus}&sight=${this.data.sight}`
e.currentTarget.dataset.quancode}&couponorderstatus=${mystatus}`
});
},
getList(key, pageNum) {


+ 30
- 19
pages/index/coupons/index.js Parādīt failu

@@ -8,7 +8,7 @@ Component({
* 组件的属性列表
*/
properties: {
loading: {
loading: {
type: Boolean,
value: ''
},
@@ -33,7 +33,7 @@ Component({
pageNum: 1, // 设置加载的第几次,默认是第一次
pageSize: 10, //返回数据的个数
searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏
allow_load: true // 是否允许继续加载标识 默认 true 允许,false 加载完成
allow_load: true, // 是否允许继续加载标识 默认 true 允许,false 加载完成
},
/**
* 组件的方法列表
@@ -51,7 +51,6 @@ Component({
detail
}) {
let that = this;

// 切换tab时重新初始化下list 和 allow_load
that.setData({
current_scroll: detail.key,
@@ -70,11 +69,23 @@ Component({
this.triggerEvent("myevent", myEventDetail);
},

getList(key, pageNum) {
getList(key, pageNum, from) {
var that = this;
console.log("pageNum------>"+pageNum);
/**
* from==refresh
* 表示是从下拉刷新进来的
*/
app.couponListCallback = token => {
Http.setToken(token);
// 券list获取
if (from == 'refresh') {
that.setData({
allow_load: true,
list: [],
})
console.log(that.data.list);
}
if (that.data.allow_load) {
that.setData({
loading: true,
@@ -103,28 +114,28 @@ Component({
/**
* 加载完成
*/
if (pageNum >= res.data.pages) {
if(res.data.pages == 0||res.data.pages == 1){
if (res.data.pages == 0 || res.data.pages == 1) {
that.setData({
allow_load: true,
loading: false,
content: ""
});
}else{
}
else {
that.setData({
allow_load: false,
loading: true,
content: "——— 再拉裤子就掉了啦 ———"
content: "——— 再拉裤子就掉了啦 ———",
});
}
}
}
if (pageNum == 1) {
that.setData({
list: [],
})
}
var tmpArr = that.data.list;
tmpArr.push.apply(tmpArr, res.data.list);
that.setData({
@@ -144,7 +155,7 @@ Component({
loading: false,
})
}, 1400);
}
}
else {
that.setData({
loading: true,
@@ -180,14 +191,14 @@ Component({
tabs: res.data.list
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
};
if (app.globalData.token && app.globalData.token != null) {
app.businessListCallback(app.globalData.token);


+ 125
- 117
pages/index/index.js Parādīt failu

@@ -6,94 +6,94 @@ Page({
data: {
market: app.globalData.market,
list: [],
loading:true,
loading: true,
swiperCurrent: 0,
title:'',
desc:'',
title: null,
desc: null,
scrollTop: 0,
showGame:false,
gamedata:{},
couponId:'',//游戏返回时传回的字段
played:false,//从游戏页面跳回首页返回true
showGame: false,
gamedata: {},
couponId: '',//游戏返回时传回的字段
played: false,//从游戏页面跳回首页返回true
havePlayEd: app.globalData.havePlayEd,
staticGamedata:{},
showIf:false,
staticGamedata: {},
showIf: false,
page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载
},
swiperChange: function(e) {
swiperChange: function (e) {
this.setData({
swiperCurrent: e.detail.current
});
},
gotogame:function(){
let that = this;
Http.post({
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
gotogame: function () {
let that = this;
Http.post({
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId
};
if (that.data.couponChannelId == null) {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId
};
if (that.data.couponChannelId == null) {
var data = {
couponId: "" + that.data.couponId
};
}
wx.navigateTo({
url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
})
})
.catch(err => {
if (err.code == 11005) {
// 用户手机未授权
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
});
} else {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
}
}
wx.navigateTo({
url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
})
})
.catch(err => {
if (err.code == 11005) {
// 用户手机未授权
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
});
} else {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
}
})
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onLoad: function(options) {
if(options.played=="true"){
onLoad: function (options) {
if (options.played == "true") {
this.setData({
played:true
played: true
})
}
var that = this;
if (decodeURIComponent(options.scene)=="undefined"){
if (decodeURIComponent(options.scene) == "undefined") {
that.setData({
scene: 0
});
}else{
} else {
that.setData({
scene: decodeURIComponent(options.scene)
});
}
app.getLocation();
if (options.couponChannelId && options.couponId){
if (options.couponChannelId && options.couponId) {
that.userLogin(options.couponChannelId, options.couponId);
}else{
} else {
that.userLogin()
}
Http.get({
@@ -102,67 +102,57 @@ Page({
appId: config.weapp.AppId,
}
})
.then(res=>{
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
desc: weapNote.firstpage.desc,
title: weapNote.firstpage.title
})
})
.catch(err => {
console.log(err);
if (err.errMsg == '请求超时,请检查您的网络设置!') {
.then(res => {
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
loading: false,
loadingtext: "请求超时,请检查您的网络设置!"
desc: weapNote.firstpage.desc,
title: weapNote.firstpage.title
})
}
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
})
.catch(err => {
console.log(err);
if (err.errMsg == '请求超时,请检查您的网络设置!') {
that.setData({
loading: false,
loadingtext: "请求超时,请检查您的网络设置!"
})
}
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
});
});
},
onShow:function(){
onShow: function () {
this.setData({
havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd:false
havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false
})
let num = wx.getStorageSync('couponNum');
if (num =='couponNum'){
if (num == 'couponNum') {
wx.showTabBarRedDot({
index: 2
})
};
},
/**
* 下拉刷新
*
* @param {code,page}
* 子组件向父组件传值
*/
onPullDownRefresh: function(e) {
let that = this;
that.userLogin();
if (that.data.code == 0 || that.data.code == undefined) {
that.selectComponent("#lists").getList(0, 1);
wx.stopPullDownRefresh();
} else {
that.selectComponent("#lists").getList(that.data.code, 1);
wx.stopPullDownRefresh();
};
},

onGetCode: function(e) {
//子组件传递给父组件的值
onGetCode: function (e) {
this.setData({
code: e.detail.val,
page: e.detail.pageNum
page: e.detail.pageNum,
});
console.log(e.detail.val)
console.log(e.detail.pageNum)
},

/**
* 用户登录
*/
userLogin: function (couponChannelId,couponId) {
userLogin: function (couponChannelId, couponId) {
var that = this;
// 登录
wx.login({
@@ -195,13 +185,12 @@ Page({
};
}
Http.post({
url: config.api.login,
data: usrdata
})
url: config.api.login,
data: usrdata
})
.then(res => {
app.globalData.token = res.data.token;
if (res.data.token){

that.getGameOne(res.data.token)
that.getStaticGame(res.data.token)
}
@@ -226,7 +215,7 @@ Page({
}
});
},
checkuerstatus(couponChannelId, couponId){
checkuerstatus(couponChannelId, couponId) {
Http.post({
url: config.api.checkUserStatus,
data: {}
@@ -249,16 +238,16 @@ Page({
wx.redirectTo({
url: '/pages/getuserinfo/index'
});
}
}
}
});
},
getStaticGame(token){
getStaticGame(token) {
let _this = this;
Http.get({
url: config.api.getGame,
data: {
triggleAction:2,
triggleAction: 2,
token: token
}
}).then(res => {
@@ -275,8 +264,8 @@ Page({
console.log(err)
})
},
getGameOne:function(token){
let _this=this;
getGameOne: function (token) {
let _this = this;
Http.get({
url: config.api.getGame,
data:{
@@ -284,13 +273,13 @@ Page({
token: token
}
}).then(res => {
if (res.data.id){
if (res.data.id) {
_this.setData({
showGame: true
})
}
_this.setData({
gamedata:res.data
gamedata: res.data
})
})
.catch(err => {
@@ -300,7 +289,7 @@ Page({
/**
* banner
*/
getBannerlist: function() {
getBannerlist: function () {
let that = this;
Http.get({
url: config.api.bannerlist,
@@ -318,7 +307,7 @@ Page({
/**
* 检查用户是否有车
*/
checkUserCarStatus: function() {
checkUserCarStatus: function () {
var that = this;
Http.get({
url: config.api.userCarCount,
@@ -336,7 +325,7 @@ Page({
/**
* car共同登录
*/
userCarLogin: function() {
userCarLogin: function () {
var that = this;
if (!app.globalData.carLogin) {
// 共同登录
@@ -357,7 +346,7 @@ Page({
/**
* 获取用户信息
*/
getUserInfo: function() {
getUserInfo: function () {
// 获取用户信息
wx.getSetting({
success: res => {
@@ -372,13 +361,32 @@ Page({
}
});
},
//下拉加载更多
onReachBottom: function() {
/**
* 刷新
*/
onPullDownRefresh: function (e) {
let that = this;
that.userLogin();
that.setData({
page:1
})
if (that.data.code == 0 || that.data.code == undefined) {
that.selectComponent("#lists").getList(0, 1, "refresh");
wx.stopPullDownRefresh();
} else {
that.selectComponent("#lists").getList(that.data.code, 1, "refresh");
wx.stopPullDownRefresh();
};
},
//加载更多
onReachBottom: function () {
let that = this;
that.data.page++;
that.setData({
page: that.data.page
});
console.log("加载更多页数"+that.data.page);
console.log("加载更多key"+that.data.code);
//父组件获得子组件的方法
//如果code == 0
if (that.data.code == 0 || that.data.code == undefined) {
@@ -388,11 +396,11 @@ Page({
}
},
// 用户点击右上角分享
onShareAppMessage: function() {
onShareAppMessage: function () {
return {
title: this.data.title,
desc: this.data.desc,
success: function(res) {
success: function (res) {
wx.showToast({
title: "分享成功",
duration: 1000,


+ 8
- 9
pages/order/detail/index.js Parādīt failu

@@ -34,7 +34,7 @@ Page({
e.currentTarget.dataset.subtitle
}&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${
e.currentTarget.dataset.couponorderstatus
}&sight=${that.data.sight}`
}`
});
} else {
wx.navigateTo({
@@ -44,7 +44,7 @@ Page({
e.currentTarget.dataset.subtitle
}&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${
that.data.mystatus
}&sight=${that.data.sight}`
}`
});
}
},
@@ -212,13 +212,12 @@ Page({
*/
onShow: function () {
let that = this;
wx.getScreenBrightness({
success: function (res) {
that.setData({
sight: res.value
})
}
});
// wx.getScreenBrightness({
// success: function (res) {
// app.globalData.sight=res.value;
// console.log(app.globalData.sight);
// }
// });
},

/**


+ 1
- 1
pages/order/index/index.js Parādīt failu

@@ -160,5 +160,5 @@ Page({
page: that.data.page
});
that.getList(that.data.current_scroll, that.data.page);
}
},
});

+ 36
- 30
pages/orderquanma/index.js Parādīt failu

@@ -1,23 +1,18 @@
let util = require("../../utils/util");
let Http = require("../../utils/HttpBasics");
let config = require("../../config/config.js");
let app = getApp();
Page({
data: {
code: "",
//存储计时器
setInter: ""
},
onLoad: function(options) {
onLoad: function (options) {
let that = this;
setTimeout(function () {
wx.setScreenBrightness({
value: 0.7,
})
}, 200),
util.barcode("barcode", options.quancode, 500, 100);
util.qrcode("qrcode", options.quancode, 350, 350);
that.setData({
sight: options.sight,
code: options.quancode,
title: options.title,
subtitle: options.subtitle,
@@ -27,7 +22,7 @@ Page({
/**
* 如果没有核销
*/
that.data.setInter = setInterval(function() {
that.data.setInter = setInterval(function () {
if (that.data.couponorderstatus == 0) {
Http.get({
url: config.api.getStatus,
@@ -35,6 +30,7 @@ Page({
couponOrderId: options.quancode
}
}).then(res => {
console.log(res);
that.setData({
couponorderstatus: res.data.CouponOrderStatus
});
@@ -48,17 +44,16 @@ Page({
prevPage.setData({
mystatus: res.data.CouponOrderStatus
});
}
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
}
}, 2000);

@@ -77,14 +72,14 @@ Page({
couponorderstatus: res.data.CouponOrderStatus
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
}
/**
* couponorderstatus
@@ -92,11 +87,22 @@ Page({
* 1 已经核销成功
*/
},
onUnload: function() {
// onShow(options) {
// console.log("屏幕的亮度")
// setTimeout(function () {
// wx.setScreenBrightness({
// value: 1,
// })
// }, 200)
// },
onUnload: function () {
let that = this;
clearInterval(that.data.setInter);
wx.setScreenBrightness({
value: that.data.sight,
})
}
},
// onHide:function(){
// console.log(app.globalData.sight)
// wx.setScreenBrightness({
// value: app.globalData.sight,
// })
// }
});

+ 3
- 1
pages/passCar/couponList/couponList.wxss Parādīt failu

@@ -165,9 +165,11 @@
.nocoupon button {
background: #00c0ff;
color: #fff;
font-style: 30rpx;
font-size: 36rpx;
width: 100%;
border-radius: 60rpx;
height: 88rpx;
line-height: 88rpx;
}
.loading {


Notiek ielāde…
Atcelt
Saglabāt