Commit 1197924a by 高淑倩

init_applet

parents
{"undefined::component2":false,"undefined::_enableAutoPush":false,"undefined::_appIdList":[],"undefined::uploadTime":"","undefined::packageSize":0,"tinyType":"alipay","tinyCnName":"支付宝","tinyProjectType":"alipay-mini","alipay:alipay-mini:tinyIcon":"https://gw.alipayobjects.com/zos/rmsportal/rcwFIauzePpMqlTzzanK.svg","alipay:alipay-mini:auditLink":null,"alipay:alipay-mini:whiteListLink":null,"alipay:alipay-mini:createLink":null,"alipay:alipay-mini:component2":true,"alipay:alipay-mini:_enableAutoPush":true,"alipay:alipay-mini:_appIdList":[{"appid":"2019071665852502","name":"daqian_01"}],"alipay:alipay-mini:uploadTime":"","alipay:alipay-mini:packageSize":0,"alipay:alipay-mini:MockStore":{"reLoginErr":false},"alipay:alipay-mini:_appId":"2019071665852502","alipay:alipay-mini:_appName":"daqian_01","alipay:alipay-mini:remoteVersion":"0.0.0","alipay:alipay-mini:currentVersion":"0.0.1","alipay:alipay-mini:whiteList":[],"alipay:alipay-mini:h5WhiteList":[],"alipay:alipay-mini:appLogo":"https://appstoreisvpic.alipayobjects.com/prod/eebdb2f7-2747-499e-9a22-2b89664d7739.png","alipay:alipay-mini:userAuthorization":["userInfo"],"isSimulatorOpen":true,"isNotFirstToggleSimulator":true,"compilerList":[{"title":"普通编译","query":"","page":""},{"title":"积分商城","page":"pages/IntegralMall/IntegralMall"},{"title":"我的消费","page":"pages/mySpend/mySpend"},{"title":"动态子页面_pageId","page":"subPackage/page/pages/subPage/subPage"}],"compilerIndex":0}
{"tabs":["file:///f%3A/code/7-Eleven/src_output/component/authorization-modal/authorization-modal.js","file:///f%3A/code/7-Eleven/src_output/component/authorization-modal/authorization-modal.axml","file:///f%3A/code/7-Eleven/src_output/utils/util.js","file:///f%3A/code/7-Eleven/src_output/app.js"],"current":"file:///f%3A/code/7-Eleven/src_output/app.js"}
const g = typeof global !== 'undefined' ? global : self;
g.appXAppJson = {
"app": {
"$homepage": "pages/userCenter/userCenter"
}
};
if(!self.Map || !self.Set) {
importScripts('https://gw.alipayobjects.com/as/g/appx_release/deps/1.0.0/es6-set-map.js');
}
\ No newline at end of file
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('../../component/authorization-modal/authorization-modal');
require('../../component/imageSwiper/imageSwiper');
require('../../component/personCenter/personCenter');
require('../../component/picNav/picNav');
require('../../component/bottom/bottom');
require('../../component/noMore/noMore');
require('../../component/picNavServe/picNavServe');
require('../../component/table/table');
require('../../component/exchange-coupon-modal/exchange-coupon-modal');
require('../../pages/userCenter/userCenter');
require('../../pages/mySpend/mySpend');
require('../../pages/memberOfOwn/memberOfOwn');
require('../../pages/memberRules/memberRules');
require('../../pages/integralWater/integralWater');
require('../../pages/deliveryService/deliveryService');
require('../../pages/coupons/coupons');
require('../../pages/couponDetail/couponDetail');
require('../../pages/couponCodeDetail/couponCodeDetail');
require('../../pages/consumptionDetails/consumptionDetails');
require('../../pages/IntegralMall/IntegralMall');
require('../../pages/integralMallDetail/integralMallDetail');
require('../../pages/activateCard/activateCardCallback');
require('../../subPackage/page/pages/subPage/subPage');
require('../../subPackage/page/pages/h5/h5page');
if(!self.__appxInited) {
self.__appxInited = 1;
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
var AFAppX = self.AFAppX;
self.getCurrentPages = AFAppX.getCurrentPages;
self.getApp = AFAppX.getApp;
self.Page = AFAppX.Page;
self.App = AFAppX.App;
self.my = AFAppX.bridge || AFAppX.abridge;
self.abridge = self.my;
self.Component = AFAppX.WorkerComponent || function(){};
self.$global = AFAppX.$global;
if(AFAppX.compilerConfig){ AFAppX.compilerConfig.component2 = true; }
function success() {
require('../../app');
require('../../component/authorization-modal/authorization-modal');
require('../../component/imageSwiper/imageSwiper');
require('../../component/personCenter/personCenter');
require('../../component/picNav/picNav');
require('../../component/bottom/bottom');
require('../../component/noMore/noMore');
require('../../component/picNavServe/picNavServe');
require('../../component/table/table');
require('../../component/exchange-coupon-modal/exchange-coupon-modal');
require('../../pages/userCenter/userCenter');
require('../../pages/mySpend/mySpend');
require('../../pages/memberOfOwn/memberOfOwn');
require('../../pages/memberRules/memberRules');
require('../../pages/integralWater/integralWater');
require('../../pages/deliveryService/deliveryService');
require('../../pages/coupons/coupons');
require('../../pages/couponDetail/couponDetail');
require('../../pages/couponCodeDetail/couponCodeDetail');
require('../../pages/consumptionDetails/consumptionDetails');
require('../../pages/IntegralMall/IntegralMall');
require('../../pages/integralMallDetail/integralMallDetail');
require('../../pages/activateCard/activateCardCallback');
require('../../subPackage/page/pages/subPage/subPage');
require('../../subPackage/page/pages/h5/h5page');
}
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
}
\ No newline at end of file
const g = typeof global !== 'undefined' ? global : self;
g.appXAppJson = {
"app": {
"$homepage": "pages/userCenter/userCenter"
}
};
if(!self.Map || !self.Set) {
importScripts('https://gw.alipayobjects.com/as/g/appx_release/deps/1.0.0/es6-set-map.js');
}
importScripts(`https://appx/af-appx.worker.min.js`);
if(AFAppX.registerApp) {
AFAppX.registerApp({
appJSON: appXAppJson,
});
}
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('../../component/authorization-modal/authorization-modal');
require('../../component/imageSwiper/imageSwiper');
require('../../component/personCenter/personCenter');
require('../../component/picNav/picNav');
require('../../component/bottom/bottom');
require('../../component/noMore/noMore');
require('../../component/picNavServe/picNavServe');
require('../../component/table/table');
require('../../component/exchange-coupon-modal/exchange-coupon-modal');
require('../../pages/userCenter/userCenter');
require('../../pages/mySpend/mySpend');
require('../../pages/memberOfOwn/memberOfOwn');
require('../../pages/memberRules/memberRules');
require('../../pages/integralWater/integralWater');
require('../../pages/deliveryService/deliveryService');
require('../../pages/coupons/coupons');
require('../../pages/couponDetail/couponDetail');
require('../../pages/couponCodeDetail/couponCodeDetail');
require('../../pages/consumptionDetails/consumptionDetails');
require('../../pages/IntegralMall/IntegralMall');
require('../../pages/integralMallDetail/integralMallDetail');
require('../../pages/activateCard/activateCardCallback');
require('../../subPackage/page/pages/subPage/subPage');
require('../../subPackage/page/pages/h5/h5page');
if(!self.__appxInited) {
self.__appxInited = 1;
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('./importScripts$');
var AFAppX = self.AFAppX;
self.getCurrentPages = AFAppX.getCurrentPages;
self.getApp = AFAppX.getApp;
self.Page = AFAppX.Page;
self.App = AFAppX.App;
self.my = AFAppX.bridge || AFAppX.abridge;
self.abridge = self.my;
self.Component = AFAppX.WorkerComponent || function(){};
self.$global = AFAppX.$global;
if(AFAppX.compilerConfig){ AFAppX.compilerConfig.component2 = true; }
function success() {
require('../../app');
require('../../component/authorization-modal/authorization-modal');
require('../../component/imageSwiper/imageSwiper');
require('../../component/personCenter/personCenter');
require('../../component/picNav/picNav');
require('../../component/bottom/bottom');
require('../../component/noMore/noMore');
require('../../component/picNavServe/picNavServe');
require('../../component/table/table');
require('../../component/exchange-coupon-modal/exchange-coupon-modal');
require('../../pages/userCenter/userCenter');
require('../../pages/mySpend/mySpend');
require('../../pages/memberOfOwn/memberOfOwn');
require('../../pages/memberRules/memberRules');
require('../../pages/integralWater/integralWater');
require('../../pages/deliveryService/deliveryService');
require('../../pages/coupons/coupons');
require('../../pages/couponDetail/couponDetail');
require('../../pages/couponCodeDetail/couponCodeDetail');
require('../../pages/consumptionDetails/consumptionDetails');
require('../../pages/IntegralMall/IntegralMall');
require('../../pages/integralMallDetail/integralMallDetail');
require('../../pages/activateCard/activateCardCallback');
require('../../subPackage/page/pages/subPage/subPage');
require('../../subPackage/page/pages/h5/h5page');
}
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
}
\ No newline at end of file
function success(){
require('../../../../component/authorization-modal/authorization-modal');
require('../../../../component/imageSwiper/imageSwiper');
require('../../../../component/personCenter/personCenter');
require('../../../../component/picNav/picNav');
require('../../../../component/bottom/bottom');
require('../../../../subPackage/page/pages/subPage/subPage');
require('../../../../subPackage/page/pages/h5/h5page');
}
self.bootstrapSubPackage('subPackage/page', {success});
\ No newline at end of file
function success(){
require('../../../../component/authorization-modal/authorization-modal');
require('../../../../component/imageSwiper/imageSwiper');
require('../../../../component/personCenter/personCenter');
require('../../../../component/picNav/picNav');
require('../../../../component/bottom/bottom');
require('../../../../subPackage/page/pages/subPage/subPage');
require('../../../../subPackage/page/pages/h5/h5page');
}
self.bootstrapSubPackage('subPackage/page', {success});
\ No newline at end of file
{"files":["f:\\code\\7-Eleven\\src_output\\utils\\util.js","f:\\code\\7-Eleven\\src_output\\component\\authorization-modal\\authorization-modal.js","f:\\code\\7-Eleven\\src_output\\pages\\userCenter\\userCenter.js","f:\\code\\7-Eleven\\src_output\\utils\\wxService.js","f:\\code\\7-Eleven\\src_output\\app.js","f:\\code\\7-Eleven\\src_output\\component\\authorization-modal\\authorization-modal.axml","f:\\code\\7-Eleven\\src_output\\component\\bottom\\bottom.axml","f:\\code\\7-Eleven\\src_output\\component\\bottom\\bottom.acss","f:\\code\\7-Eleven\\src_output\\component\\bottom\\bottom.js","f:\\code\\7-Eleven\\src_output\\utils\\common.js","f:\\code\\7-Eleven\\src_output\\subPackage\\page\\pages\\h5\\h5page.js","f:\\code\\7-Eleven\\src_output\\subPackage\\page\\pages\\h5\\h5page.axml","f:\\code\\7-Eleven\\src_output\\subPackage\\page\\pages\\h5\\h5page.json","f:\\code\\7-Eleven\\src_output\\component\\imageSwiper\\imageSwiper.js","f:\\code\\7-Eleven\\src_output\\component\\imageSwiper\\imageSwiper.axml","f:\\code\\7-Eleven\\src_output\\component\\imageSwiper\\imageSwiper.acss","f:\\code\\7-Eleven\\src_output\\subPackage\\page\\pages\\subPage\\subPage.js","f:\\code\\7-Eleven\\src_output\\pages\\mySpend\\mySpend.js","f:\\code\\7-Eleven\\src_output\\pages\\mySpend\\mySpend.axml","f:\\code\\7-Eleven\\src_output\\pages\\mySpend\\mySpend.acss","f:\\code\\7-Eleven\\src_output\\pages\\IntegralMall\\IntegralMall.acss","f:\\code\\7-Eleven\\src_output\\app.json","f:\\code\\7-Eleven\\src_output\\pages\\IntegralMall\\IntegralMall.json","f:\\code\\7-Eleven\\src_output\\pages\\IntegralMall\\IntegralMall.axml","f:\\code\\7-Eleven\\src_output\\pages\\coupons\\coupons.acss","f:\\code\\7-Eleven\\src_output\\component\\picNav\\picNav.js","f:\\code\\7-Eleven\\src_output\\utils\\Http.js","f:\\code\\7-Eleven\\src_output\\component\\noMore\\noMore.js","f:\\code\\7-Eleven\\src_output\\component\\authorization-modal\\authorization-modal.acss","f:\\code\\7-Eleven\\src_output\\pages\\userCenter\\userCenter.axml","f:\\code\\7-Eleven\\src_output\\pages\\userCenter\\userCenter.acss","f:\\code\\7-Eleven\\src_output\\component\\picNav\\picNav.axml","f:\\code\\7-Eleven\\src_output\\codeUtils\\qrcode.js","f:\\code\\7-Eleven\\src_output\\utils\\renderPage.js","f:\\code\\7-Eleven\\src_output\\lib\\bluebird.js","f:\\code\\7-Eleven\\src_output\\codeUtils\\barcode.js","f:\\code\\7-Eleven\\src_output\\component\\picNav\\picNav.acss","f:\\code\\7-Eleven\\src_output\\pages\\deliveryService\\deliveryService.js","f:\\code\\7-Eleven\\src_output\\component\\personCenter\\personCenter.axml","f:\\code\\7-Eleven\\src_output\\component\\personCenter\\personCenter.json","f:\\code\\7-Eleven\\src_output\\component\\personCenter\\personCenter.js","f:\\code\\7-Eleven\\src_output\\component\\imageSwiper\\imageSwiper.json","f:\\code\\7-Eleven\\src_output\\pages\\userCenter\\userCenter.json"]}
const wx2my = require('../wx2my');
const Behavior = require('../Behavior');
const Promise = require('../lib/bluebird');
const envInfo = require('../config/index').envInfo;
class Http {
constructor() {
this.state = 'loaded';
this.token = '';
this.app = null;
}
request({
url,
data,
header,
method,
dataType,
responseType,
channel,
success,
fail,
complete
}) {
let path = '';
if (channel) {
path = channel + url;
} else {
path = envInfo.ctx + url;
}
if (/^http/gi.test(url)) {
path = url;
}
const that = this;
this.state = 'loading';
return new Promise(function (resolve, reject) {
wx2my.request({
url: path,
data,
header,
method,
dataType,
responseType,
success: function (data, statusCode, header) {
if (success) {
resolve(data);
} else {
resolve(data);
}
},
fail: function (data, statusCode, header) {
if (fail) {
reject(data);
} else {
reject(data);
}
},
complete: function (data) {
that.state = 'loaded';
if (complete) {
reject(data);
} else {
reject(data);
} // complete ? complete.apply(this, arguments) : reject(data)
}
});
}).then(this.checkStatus).then(this.intercept).then(data => {
if (success) {
success(data);
}
return Promise.resolve(data);
}, data => {
if (fail) {
fail(data);
}
return Promise.reject(data);
}).catch(this.fail);
}
get(url, parmas) {
return this.request({
url,
method: 'GET',
header: {
'buyer-token': this.getToken()
},
data: parmas
});
}
post(url, parmas, channel) {
return this.request({
url,
method: 'POST',
header: {
'buyer-token': this.getToken()
},
data: parmas,
channel: channel
});
}
checkStatus(resp) {
let status = resp.statusCode;
if (status >= 200 && status < 300) {
// return resp;
return Promise.resolve(resp);
} else {
// var error = new Error(`status: ${resp.statusCode}`)
// error.response = resp
// return Promise.reject(resp.statusCode)
return Promise.reject({
state: resp.data.result,
msg: resp.data.desc
});
}
}
intercept(res) {
if (res.data && res.data.code === 401) {
let baseUserInfo = wx2my.getStorageSync('_baseUserInfo');
if (!baseUserInfo || baseUserInfo.isMember !== '1') {
return Promise.reject({
state: 401,
msg: '登录过期'
});
} else {
return Promise.reject({
state: 402,
msg: 'token失效'
});
}
} else {
return Promise.resolve(res);
}
}
fail(error) {
if (/timeout/.test(error.errMsg)) {
wx2my.showModal({
title: '网络不给力',
content: '请求数据超时'
});
}
if (error.msg && error.msg != '该用户尚未登录') {
setTimeout(() => {
wx2my.showToast({
title: `${error.msg}`,
icon: 'none',
duration: 2500
});
});
}
console.log(JSON.stringify(error));
return Promise.reject(error);
}
getApp() {
if (!this.app) {
this.app = getApp();
}
return this.app;
}
getToken() {
// if (!this.token) {
// const token = wx.getStorageSync('token')
// this.token = token
// }
return wx2my.getStorageSync('token') || '';
}
}
export default Http;
\ No newline at end of file
<!--component/bottom/bottom.axml fontColor 1 浅色 2 深色-->
<view
class="footer-content"
style="{{bottom.bgImgUrl ? 'background-image: url('+ baseImgUrl +''+ bottom.bgImgUrl +');' : 'background-color: ' + bottom.color + ';'}}"
data-link="{{bottom.link}}"
data-appid="{{bottom.link.appid}}"
data-item="{{bottom}}"
data-path="{{bottom.link.url}}"
catchTouchStart="touchStart"
catchTouchEnd="touchEnd"
>
<text class="footer-arrow" style="color:{{bottom.fontColor == 1 ? '#FFF' : '#000'}};"><<</text>
<text class="footer-text" style="color:{{bottom.fontColor == 1 ? '#FFF' : '#000'}};">{{bottom.title}}</text>
</view>
<authorization-modal isAuthorization="{{isAuthorization}}"/>
\ No newline at end of file
<!--component/bottom/bottom.axml fontColor 1 浅色 2 深色-->
<view
class="footer-content"
style="{{bottom.bgImgUrl ? 'background-image: url('+ baseImgUrl +''+ bottom.bgImgUrl +');' : 'background-color: ' + bottom.color + ';'}}"
data-link="{{bottom.link}}"
data-appid="{{bottom.link.appid}}"
data-item="{{bottom}}"
data-path="{{bottom.link.url}}"
catchTouchStart="touchStart"
catchTouchEnd="touchEnd"
>
<text class="footer-arrow" style="color:{{bottom.fontColor == 1 ? '#FFF' : '#000'}};"><<</text>
<text class="footer-text" style="color:{{bottom.fontColor == 1 ? '#FFF' : '#000'}};">{{bottom.title}}</text>
</view>
<authorization-modal isAuthorization="{{isAuthorization}}"/>
\ No newline at end of file
// pages/userCenter.js
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
const app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
let renderPage = null; // 渲染页面数据对象(安全渲染)
let handlerDataOnPage = null;
let config = require('../../configScreen/configScreen');
const logger = utils.logger;
wxService.page({
/**
* 页面的初始数据
*/
data: {
pages: [],
render: null,
// 渲染页面数据对象(安全渲染)
renderPageOver: false,
// 渲染页面结束
integralNum: 0,
couponNum: 0,
// isAllScreen: fullSucreen.isAllScreen
isAllScreen: config.isAllScreen,
token: '',
isAuthorization: false,
pageId: 3,
baseUserInfo: null,
// cardMember: null,
pageBackgroundColor: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
this.setData({
pages: [],
groupLoadState: 'complete',
// 活动分组加载标志
homeApiLoading: true,
render: null,
// 渲染页面数据对象(安全渲染)
isLastPage: false,
// 页面段落加载完成
renderPageOver: false,
// 渲染页面结束
// isAuthorization: true,
outoHeigth: 500
}, () => {// this.loadMore()
});
handlerDataOnPage = new utils.HandlerDataOnPage();
renderPage = require('../../utils/renderPage').getRenderPage();
handlerDataOnPage.init(this, 'pages');
this.initPage(this.data.pageId);
},
/**
* 监听子组件事件
* */
updatePage(ev) {
const {
pageId
} = ev.detail; // this.setData({
// pages: [],
// pageId
// },()=>{
// this.initPage(pageId)
// })
wxService.router(`/subPackage/page/pages/subPage/subPage`).search({
pageId
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 取会员卡号
const baseUserInfo = wx2my.getStorageSync('_baseUserInfo');
const cardMember = wx2my.getStorageSync('_cardMember'); // 登录接口返回err
const reLoginErrFlag = wx2my.getStorageSync('reLoginErr');
if (baseUserInfo && !reLoginErrFlag) {
this.setData({
token: wx2my.getStorageSync('token'),
baseUserInfo,
cardMember,
isAuthorization: false
}, () => {
// 积分数量
this.getMemberPointInfo(); // 优惠券数量
this.getMemberCouponInfo();
});
} else if (!baseUserInfo && reLoginErrFlag) {
this.setData({
isAuthorization: true
});
} else {
this.setData({
isAuthorization: true
});
} // if (baseUserInfo){
// this.setData({
// token: wx.getStorageSync('token'),
// baseUserInfo,
// // cardMember,
// isAuthorization: false
// })
// // 积分数量
// this.getMemberPointInfo()
// // 优惠券数量
// this.getMemberCouponInfo()
// } else {
// this.setData({
// isAuthorization: true
// })
// }
// 获取手机信息
wxService.getSystemInfo().then(res => {
this.setData({
outoHeigth: res.windowHeight
});
});
},
// 查询积分信息
getMemberPointInfo() {
wx2my.showLoading({
title: '加载中'
});
wxService.get(`/member/memberPoint/getMyPointInfo`).then(res => {
if (res) {
const {
result,
data
} = res.data;
if (result == 0) {
wx2my.hideLoading();
this.setData({
integralNum: data && data.point || 0
});
}
}
});
},
// 查询优惠券数量
getMemberCouponInfo() {
wx2my.showLoading({
title: '加载中'
});
wxService.post(`/coupon/coupon/memberCouponCount`).then(res => {
if (res) {
const {
result,
data
} = res && res.data;
if (result == 0) {
wx2my.hideLoading();
this.setData({
couponNum: data && data[1] || 0
});
}
} else {
wx2my.showToast({
title: '请求失败',
icon: 'none'
});
}
});
},
// page 信息
initPage(pageId) {
this.setData({
products: []
});
wx2my.showLoading({
title: '加载中'
}); // wxService.post(`/merchant/modelPage/getDetailById?pageId=${pageId}&brandId=${app.globalData.brandId}`).then(res => {
wxService.post(`/merchant/modelPage/mainSetting?brandId=${app.globalData.brandId}`).then(res => {
if (!res) return false;
const {
result,
data
} = res.data;
if (result == 0) {
this.setData({
pageBackgroundColor: data.page.backgroundColor || 0
}); // 动态设置title
wx2my.setNavigationBarTitle({
title: data.page.title
}); // 段落
const products = data.paragraphs;
const filterResult = products.map((res, index) => {
return {
...res,
index
};
}).filter(item => {// wx.hideLoading()
});
const render = renderPage.initPaging(filterResult).initRenderData(products);
this.data.render = render;
const renderData = render.next();
this.data.renderPageOver = renderData.done;
this.renderPageFunc({
products: renderData.value
});
}
}).finally(() => {
wx2my.hideLoading();
});
},
/**
* 渲染数据(合并之前的数据)
* @param products 数组数据
* @param isLastPage
* @param now
*/
renderPageFunc({
products
}) {
let productData = handlerDataOnPage.handlerArray(products);
logger.log('productData.keysNum', productData.keysNum(), productData);
this.setData({
...productData
}, () => {
wx2my.hideLoading();
});
}
});
\ No newline at end of file
<!--pages/userCenter.axml-->
<view class="page-integral-mall" style="padding-bottom: 40rpx">
<view class="empty-wrap" a:if="{{!integralCouponList.length}}">
<view class="empty-info">
<image class="empty-img" src="/assets/imgs/empty-coupon.png"></image>
<view class="empty-text">没有任何卡劵</view>
</view>
</view>
<view class="integral-vip-rules" a:if="{{integralCouponList.length}}" onTap="handleGoMemberRulesRules">会员规则</view>
<view class="coupon-wrap" a:if="{{integralCouponList.length}}">
<view class="coupon-list" a:for="{{integralCouponList}}" a:for-item="item" a:for-index="k" a:key="{{k}}" data-id="{{item.id}}" onTap="goCouponDetail">
<view class="coupon-item">
<view class="coupon-img">
<image a:if="{{item.thumbnail}}" src="{{item.thumbnail}}"></image>
<image a:else src="/assets/imgs/qr-code.png"></image>
</view>
<view class="coupon-info">
<view class="coupon-time fs-24">{{item.point}}积分</view>
<view class="coupon-name fs-28">{{item.title}}</view>
<view class="coupon-desc fs-24">查看详情 >>></view>
</view>
<view class="coupon-code fs-24" data-id="{{item.id}}" data-point="{{item.point}}" catchTap="exchange">立即兑换</view>
</view>
</view>
</view>
<exchange-coupon-modal exchangeId="{{exchangeId}}" exchangePoint="{{exchangePoint}}" isExchange="{{isExchange}}" />
<!--<no-more wx:if="{{noMore}}"/>-->
</view>
\ No newline at end of file
const wx2my = require('../wx2my');
const Behavior = require('../Behavior');
const wxService = require('./wxService');
const moment = require('../lib/moment.min');
const Promise = require('../lib/bluebird');
const _ = require('../lib/underscore.min');
const envInfo = require('../config/index').envInfo;
const formatTime = date => {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':');
};
/* 获取当前页url */
function getCurrentPageUrl() {
var pages = getCurrentPages(); // 获取加载的页面
var currentPage = pages[pages.length - 1]; // 获取当前页面的对象
var url = currentPage.route; // 当前页面url
return url;
}
/* 获取当前页带参数的url */
function getCurrentPageUrlWithArgs() {
var pages = getCurrentPages(); // 获取加载的页面
var currentPage = pages[pages.length - 1]; // 获取当前页面的对象
var url = currentPage.route; // 当前页面url
var options = currentPage.options; // 如果要获取url中所带的参数可以查看options
/**
* 拼接url的参数
*/
var urlWithArgs = url + '?';
for (var key in options) {
var value = options[key];
urlWithArgs += key + '=' + value + '&';
}
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1);
return urlWithArgs;
}
/**
* 获取当前帐号信息
*/
function getAccountInfo() {
let accountInfo = my.getAccountInfoSync();
return accountInfo;
}
/**
* 图片宽高比
*/
function imageUtil(e) {
var imageSize = {};
var originalWidth = e.detail.width; //图片原始宽
var originalHeight = e.detail.height; //图片原始高
var originalScale = originalHeight / originalWidth; //图片高宽比
//获取屏幕宽高
wx2my.getSystemInfo({
success: function(res) {
// var windowWidth = res.windowWidth/2;
var windowWidth = (res.windowWidth - 15) / 2;
var windowHeight = res.windowHeight / 2;
var windowscale = windowHeight / windowWidth; //屏幕高宽比
if (originalScale < windowscale) {
//图片高宽比小于屏幕高宽比
//图片缩放后的宽为屏幕宽
imageSize.imageWidth = windowWidth;
imageSize.imageHeight = windowWidth * originalHeight / originalWidth;
} else {
//图片高宽比大于屏幕高宽比
//图片缩放后的高为屏幕高
imageSize.imageHeight = originalHeight * windowWidth / originalWidth;
imageSize.imageWidth = windowWidth;
}
}
});
return imageSize;
}
/**
* 判断用户滑动
* 左滑还是右滑
*/
function getTouchData(endX, endY, startX, startY) {
let turn = "";
if (endX - startX > 50 && Math.abs(endY - startY) < 50) {
//右滑
turn = "right";
} else if (endX - startX < -50 && Math.abs(endY - startY) < 50) {
//左滑
turn = "left";
}
return turn;
}
/**
* view宽高比
*/
function aspectRatio(h, w) {
let viewStyle = {};
let originalScale = h / w;
wxService.getSystemInfo().then(res => {
let windowscale = res.windowHeight / res.windowWidth;
if (originalScale < windowscale) {
viewStyle.width = res.windowWidth;
viewStyle.height = res.windowWidth * h / w;
} else {
viewStyle.width = res.windowHeight * w / h;
viewStyle.height = res.windowHeight;
}
});
return viewStyle;
}
/**
* 全面屏
*/
// function checkFullSucreen () {
// const self = this
// wxService.getSystemInfo().then(res => {
// debugger
// if ((res.screenHeight - res.windowHeight - res.statusBarHeight - 32) > 72) {
//      // 处理相关逻辑
// self.globalData.isFullSucreen = true
// // setGlobalData('fullScreen', true)
// }
// })
// }
/**
* 解析 url 参数
*/
function parseUrl(query) {
var result = []; // var query = url.split("?")[1];
var queryArr = query.split("&");
queryArr.forEach(function(item) {
var obj = {};
var value = item.split("=")[0];
var key = item.split("=")[1];
obj[value] = key;
result.push(obj);
});
return result;
}
function getCurrentRouter() {
var pages = getCurrentPages(); // 获取加载的页面
var currentPage = pages[pages.length - 1]; // 获取当前页面的对象
return currentPage;
}
function getNowTime() {
return wxService.getManageDate().getNow();
}
function getAppUserInfo() {
const app = getApp();
if (app.globalData.userInfo) {
return Promise.resolve({
userInfo: app.globalData.userInfo
});
} else {
return Promise.reject('userinfo is null');
}
}
/** 邮箱校验 */
function validateEmail(email) {
let str = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
return str.test(email);
}
/**
* 处理分页数据安全加载,渲染
* 小程序1M的限制
*/
class HandlerDataOnPage {
init(target, originArrName) {
if (target && target.data && originArrName) {
this.target = target.data;
this.OriginArrayName = originArrName;
}
}
handlerArray(dataArray = []) {
const target = this.target;
const arrayName = this.OriginArrayName;
dataArray = dataArray || [];
this.validate();
if (toString.call(dataArray) !== '[object Array]') {
throw new Error('dataArray invaild');
}
let len = target[arrayName].length;
target[arrayName] = target[arrayName].concat(dataArray);
return this.trunObject(dataArray, len);
}
editArray(dataArray = [], startIndex = -1) {
if (startIndex < 0) {
throw new Error('editArray startIndex must > -1');
}
return this.trunObject(dataArray, startIndex);
}
trunObject(dataArray = [], len) {
const arrayName = this.OriginArrayName;
function RenderArray2Object() { }
;
RenderArray2Object.prototype.keysNum = function() {
return Object.keys(this).length;
};
let renderArray2Object = new RenderArray2Object();
for (let i = 0, s = dataArray.length; i < s; i++) {
renderArray2Object[`${arrayName}[${len + i}]`] = dataArray[i];
}
return renderArray2Object;
}
validate() {
const target = this.target;
const arrayName = this.OriginArrayName;
target[arrayName] = target[arrayName] || [];
if (!target) {
throw new Error('target invaild');
}
if (!(target[arrayName] && toString.call(target[arrayName]) === '[object Array]')) {
target[arrayName] = [];
}
}
clearOriginArr() {
const target = this.target;
const arrayName = this.OriginArrayName;
this.validate();
target[arrayName] = [];
}
}
class Logger {
log() {
// if (envInfo.env === 'prod') {
// return
// }
let args = Array.prototype.slice.apply(arguments);
let params = Array.prototype.slice.apply(arguments);
const desc = args.shift();
let tip = `======= ${desc} =======`;
args.forEach(() => {
tip += ',%o';
});
params[0] = tip;
console.log.apply(console, params);
}
} // 通过点击按钮 获取用户信息并登陆注册到crm系统中
function getUserInfoByBtn(userInfo) {
console.log('userInfo', userInfo)
const logger = new Logger();
const app = getApp();
let userInfoObj = {}
userInfoObj.userInfo = userInfo
if (Object.keys(userInfo).length === 1) {
return wxService.Promise.reject(userInfo.errMsg);
}
// logger.log(' wx _userInfo success res --->', userInfo);
// wx2my.setStorageSync('_userInfo', userInfo);
// wx2my.setStorageSync('reLoginErr', false);
// wx2my.showLoading({
// title: '正在加载...',
// icon: 'none',
// mask: true
// });
// return wxService.post(`/member/minaLogin`, {
// code: code,
// wechatInfo: userInfoObj,
// brandId: app.globalData.brandId
// })
return wxService.login().then(res => {
logger.log(' wx getUserInfoByBtn success res --->', res);
return Promise.all([Promise.resolve(userInfo), Promise.resolve(res)]);
}).then(res => {
console.log('res=======', res)
logger.log(' wx _userInfo success res --->', res);
wx2my.setStorageSync('_userInfo', res[0]);
wx2my.setStorageSync('reLoginErr', '----');
wx2my.showLoading({
title: '正在加载...',
icon: 'none',
mask: true
});
return wxService.post(`/member/minaLogin`, {
code: res[1].authCode,
wechatInfo: userInfoObj,
// wechatInfo: res[0],
brandId: app.globalData.brandId
});
}, err => {
return Promise.reject(err);
}).then(response => {
logger.log('getCrmUserInfo response', response);
if (response.data.data.rspCode === -1) {
return Promise.reject(response.data.data);
}
return Promise.resolve(response.data.data);
}).finally(() => {
wx2my.hideLoading();
});
}
const formatNumber = n => {
n = n.toString();
return n[1] ? n : '0' + n;
};
module.exports = {
formatTime,
getCurrentPageUrl,
getCurrentRouter,
getCurrentPageUrlWithArgs,
getNowTime,
getUserInfoByBtn,
moment,
parseUrl,
_,
// _: underscore,
HandlerDataOnPage,
formatTime: formatTime,
getAppUserInfo,
formatNumber: formatNumber,
logger: new Logger(),
getTouchData,
getAccountInfo,
aspectRatio,
imageUtil,
validateEmail // checkFullSucreen
};
\ No newline at end of file
const wx2my = require('../wx2my');
const Behavior = require('../Behavior');
const wxService = require('./wxService');
const moment = require('../lib/moment.min');
const Promise = require('../lib/bluebird');
const _ = require('../lib/underscore.min');
const envInfo = require('../config/index').envInfo;
const formatTime = date => {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':');
};
/* 获取当前页url */
function getCurrentPageUrl() {
var pages = getCurrentPages(); // 获取加载的页面
var currentPage = pages[pages.length - 1]; // 获取当前页面的对象
var url = currentPage.route; // 当前页面url
return url;
}
/* 获取当前页带参数的url */
function getCurrentPageUrlWithArgs() {
var pages = getCurrentPages(); // 获取加载的页面
var currentPage = pages[pages.length - 1]; // 获取当前页面的对象
var url = currentPage.route; // 当前页面url
var options = currentPage.options; // 如果要获取url中所带的参数可以查看options
/**
* 拼接url的参数
*/
var urlWithArgs = url + '?';
for (var key in options) {
var value = options[key];
urlWithArgs += key + '=' + value + '&';
}
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1);
return urlWithArgs;
}
/**
* 获取当前帐号信息
*/
function getAccountInfo() {
let accountInfo = my.getAccountInfoSync();
return accountInfo;
}
/**
* 图片宽高比
*/
function imageUtil(e) {
var imageSize = {};
var originalWidth = e.detail.width; //图片原始宽
var originalHeight = e.detail.height; //图片原始高
var originalScale = originalHeight / originalWidth; //图片高宽比
//获取屏幕宽高
wx2my.getSystemInfo({
success: function(res) {
// var windowWidth = res.windowWidth/2;
var windowWidth = (res.windowWidth - 15) / 2;
var windowHeight = res.windowHeight / 2;
var windowscale = windowHeight / windowWidth; //屏幕高宽比
if (originalScale < windowscale) {
//图片高宽比小于屏幕高宽比
//图片缩放后的宽为屏幕宽
imageSize.imageWidth = windowWidth;
imageSize.imageHeight = windowWidth * originalHeight / originalWidth;
} else {
//图片高宽比大于屏幕高宽比
//图片缩放后的高为屏幕高
imageSize.imageHeight = originalHeight * windowWidth / originalWidth;
imageSize.imageWidth = windowWidth;
}
}
});
return imageSize;
}
/**
* 判断用户滑动
* 左滑还是右滑
*/
function getTouchData(endX, endY, startX, startY) {
let turn = "";
if (endX - startX > 50 && Math.abs(endY - startY) < 50) {
//右滑
turn = "right";
} else if (endX - startX < -50 && Math.abs(endY - startY) < 50) {
//左滑
turn = "left";
}
return turn;
}
/**
* view宽高比
*/
function aspectRatio(h, w) {
let viewStyle = {};
let originalScale = h / w;
wxService.getSystemInfo().then(res => {
let windowscale = res.windowHeight / res.windowWidth;
if (originalScale < windowscale) {
viewStyle.width = res.windowWidth;
viewStyle.height = res.windowWidth * h / w;
} else {
viewStyle.width = res.windowHeight * w / h;
viewStyle.height = res.windowHeight;
}
});
return viewStyle;
}
/**
* 全面屏
*/
// function checkFullSucreen () {
// const self = this
// wxService.getSystemInfo().then(res => {
// debugger
// if ((res.screenHeight - res.windowHeight - res.statusBarHeight - 32) > 72) {
//      // 处理相关逻辑
// self.globalData.isFullSucreen = true
// // setGlobalData('fullScreen', true)
// }
// })
// }
/**
* 解析 url 参数
*/
function parseUrl(query) {
var result = []; // var query = url.split("?")[1];
var queryArr = query.split("&");
queryArr.forEach(function(item) {
var obj = {};
var value = item.split("=")[0];
var key = item.split("=")[1];
obj[value] = key;
result.push(obj);
});
return result;
}
function getCurrentRouter() {
var pages = getCurrentPages(); // 获取加载的页面
var currentPage = pages[pages.length - 1]; // 获取当前页面的对象
return currentPage;
}
function getNowTime() {
return wxService.getManageDate().getNow();
}
function getAppUserInfo() {
const app = getApp();
if (app.globalData.userInfo) {
return Promise.resolve({
userInfo: app.globalData.userInfo
});
} else {
return Promise.reject('userinfo is null');
}
}
/** 邮箱校验 */
function validateEmail(email) {
let str = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
return str.test(email);
}
/**
* 处理分页数据安全加载,渲染
* 小程序1M的限制
*/
class HandlerDataOnPage {
init(target, originArrName) {
if (target && target.data && originArrName) {
this.target = target.data;
this.OriginArrayName = originArrName;
}
}
handlerArray(dataArray = []) {
const target = this.target;
const arrayName = this.OriginArrayName;
dataArray = dataArray || [];
this.validate();
if (toString.call(dataArray) !== '[object Array]') {
throw new Error('dataArray invaild');
}
let len = target[arrayName].length;
target[arrayName] = target[arrayName].concat(dataArray);
return this.trunObject(dataArray, len);
}
editArray(dataArray = [], startIndex = -1) {
if (startIndex < 0) {
throw new Error('editArray startIndex must > -1');
}
return this.trunObject(dataArray, startIndex);
}
trunObject(dataArray = [], len) {
const arrayName = this.OriginArrayName;
function RenderArray2Object() { }
;
RenderArray2Object.prototype.keysNum = function() {
return Object.keys(this).length;
};
let renderArray2Object = new RenderArray2Object();
for (let i = 0, s = dataArray.length; i < s; i++) {
renderArray2Object[`${arrayName}[${len + i}]`] = dataArray[i];
}
return renderArray2Object;
}
validate() {
const target = this.target;
const arrayName = this.OriginArrayName;
target[arrayName] = target[arrayName] || [];
if (!target) {
throw new Error('target invaild');
}
if (!(target[arrayName] && toString.call(target[arrayName]) === '[object Array]')) {
target[arrayName] = [];
}
}
clearOriginArr() {
const target = this.target;
const arrayName = this.OriginArrayName;
this.validate();
target[arrayName] = [];
}
}
class Logger {
log() {
// if (envInfo.env === 'prod') {
// return
// }
let args = Array.prototype.slice.apply(arguments);
let params = Array.prototype.slice.apply(arguments);
const desc = args.shift();
let tip = `======= ${desc} =======`;
args.forEach(() => {
tip += ',%o';
});
params[0] = tip;
console.log.apply(console, params);
}
} // 通过点击按钮 获取用户信息并登陆注册到crm系统中
function getUserInfoByBtn(userInfo) {
console.log('userInfo', userInfo)
const logger = new Logger();
const app = getApp();
let userInfoObj = {}
userInfoObj.userInfo = userInfo
if (Object.keys(userInfo).length === 1) {
return wxService.Promise.reject(userInfo.errMsg);
}
// logger.log(' wx _userInfo success res --->', userInfo);
// wx2my.setStorageSync('_userInfo', userInfo);
// wx2my.setStorageSync('reLoginErr', false);
// wx2my.showLoading({
// title: '正在加载...',
// icon: 'none',
// mask: true
// });
// return wxService.post(`/member/minaLogin`, {
// code: code,
// wechatInfo: userInfoObj,
// brandId: app.globalData.brandId
// })
return wxService.login().then(res => {
logger.log(' wx getUserInfoByBtn success res --->', res);
return Promise.all([Promise.resolve(userInfo), Promise.resolve(res)]);
}).then(res => {
console.log('res=======', res)
logger.log(' wx _userInfo success res --->', res);
wx2my.setStorageSync('_userInfo', res[0]);
wx2my.setStorageSync('reLoginErr', '----');
wx2my.showLoading({
title: '正在加载...',
icon: 'none',
mask: true
});
return wxService.post(`/member/minaLogin`, {
code: res[1].authCode,
wechatInfo: userInfoObj,
// wechatInfo: res[0],
brandId: app.globalData.brandId
});
}, err => {
return Promise.reject(err);
}).then(response => {
logger.log('getCrmUserInfo response', response);
if (response.data.data.rspCode === -1) {
return Promise.reject(response.data.data);
}
return Promise.resolve(response.data.data);
}).finally(() => {
wx2my.hideLoading();
});
}
const formatNumber = n => {
n = n.toString();
return n[1] ? n : '0' + n;
};
module.exports = {
formatTime,
getCurrentPageUrl,
getCurrentRouter,
getCurrentPageUrlWithArgs,
getNowTime,
getUserInfoByBtn,
moment,
parseUrl,
_,
// _: underscore,
HandlerDataOnPage,
formatTime: formatTime,
getAppUserInfo,
formatNumber: formatNumber,
logger: new Logger(),
getTouchData,
getAccountInfo,
aspectRatio,
imageUtil,
validateEmail // checkFullSucreen
};
\ No newline at end of file
<view class="modal" a:if="{{isAuthorization}}">
<view class="modal-mask"></view>
<view class="modal-container" style="top:{{isAuthorizationActiveText ? '12%' : '26%' }};">
<view class="auth-avatar">
<image class="auth-avatar-img" src="/assets/imgs/auth-avatar.png"></image>
</view>
<view class="auth-shop" a:if="{{isAuthorizationActiveText}}">
<view class="auto-old">
<span class="auto-old-num">1. </span>老会员无需领取新会员卡,即可在会员小程序享受全部会员权益。</view>
<view class="auto-old">
<span class="auto-old-num">2. </span>若在领取新会员卡过程中输入新手机号,会造成原会员及积分信息的更替。</view>
<view class="auto-old">
<span class="auto-old-num">3. </span>领取后的新会员卡,将存放在"微信-卡包"。</view>
</view>
<view class="auth-shop" a:else>广东7-Eleven申请获取授权,用于会员服务</view>
<!-- <button
type="primary"
a:if="{{!isAuthorizationActiveText}}"
onTap="handleGetAuthCode"
class="agree"
disabled="{{!checkAll}}"
>同意</button> -->
<button
a:if="{{!isAuthorizationActiveText}}"
class="agree"
open-type="getAuthorize"
onGetAuthorize="onGetAuthorize"
onError="onAuthError"
scope='userInfo'>
同意
</button>
<button
type="primary"
a:else
class="agree"
disabled="{{!checkAll}}"
onTap="handleActiveAgree"
>同意并领取新会员卡</button>
<view class="rule-wrap">
<view class="agree-rule">
<view a:if="{{!isAuthorizationActiveText}}" class="agree-icon">
<!-- WX2MY: {{checkAll ? 'success' : 'circle'}} 类型的 icon 不被支持, 请调整 -->
<!--<icon size="18" type="{{checkAll ? 'success' : 'circle'}}" bindtap="checkAll"></icon>-->
</view>
<view a:if="{{!isAuthorizationActiveText}}">
<text>我已阅读并同意</text>
<text class="rule-text" onTap="handelToMemberRules">《会员规则》</text>
</view>
<!-- <view wx:else><text>我已阅读并同意</text><text class='rule-text' bindtap="handelToMemberRules">《激活领卡规则》</text></view>-->
</view>
</view>
<view class="close" onTap="close">
<image class="close-img" src="/assets/imgs/close.png"></image>
</view>
</view>
</view>
\ No newline at end of file
// Create by wx2my.
module.exports = function Behavior(obj) {
const keyMap = {
properties: 'props',
created: 'onInit',
attached: 'didMount',
detached: 'didUnmount',
};
Object.keys(keyMap).forEach((key) => {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
obj[keyMap[key]] = obj[key];
delete obj[key];
}
});
// if exist lifetimes replace others.
if (obj.lifetimes) {
const keyMap = {
created: 'onInit',
attached: 'didMount',
detached: 'didUnmount',
};
const lifetimesObj = obj.lifetimes;
Object.keys(keyMap).forEach((key) => {
if (Object.prototype.hasOwnProperty.call(lifetimesObj, key)) {
obj[keyMap[key]] = lifetimesObj[key];
}
});
delete obj.lifetimes;
}
return obj;
};
/**app.wxss**/
page {
width: 100%;
box-sizing: border-box;
background-color: #f2f4f7;
font-size: 30rpx;
font-family:"iconfont-711" !important;
}
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
const wx2my = require('./wx2my');
const Behavior = require('./Behavior');
// app.js
import { cEvent } from './utils/event.js';
const Promise = require('./lib/bluebird');
var utils = require('./utils/util.js');
var commonFunc = require('./utils/common.js');
var wxService = require('./utils/wxService');
let config = require('./configScreen/configScreen');
const envInfo = require('./config/index').envInfo;
App({
onLaunch: function (e) {
// 默认 false
wx2my.setStorageSync('reLoginErr', false);
},
onShow: function (options = {}) {
console.log('app-onshow', options);
const baseUserInfo = wx2my.getStorageSync('_baseUserInfo');
if (options.referrerInfo.extraData != null) {
const {
activate_ticket,
card_id,
code,
errCode,
wx_activate_after_submit_url
} = options.referrerInfo.extraData;
let urlData = wx_activate_after_submit_url.split("?");
let url = urlData[0];
let parmas = urlData[1]; // encodeURIComponent
// decodeURIComponent
wxService.router(`${url}`).search({
activate_ticket: encodeURIComponent(activate_ticket),
card_id,
code,
errCode,
wx_activate_after_submit_url: parmas
}); // 激活成功 变更 _baseUserInfo
baseUserInfo.wechatCardId = card_id;
baseUserInfo.wechatCode = code;
wx2my.setStorageSync('_baseUserInfo', baseUserInfo);
}
// 711_授权字体 支付宝不支持
// wx2my.loadFontFace({
// family: 'iconfont-711',
// source: 'url("https://cdn-alyun.bigaka.com/group1/M00/00/01/Cv6CDl0nE9aAdG45AC7AStq8LfA180.TTF")',
// success: function (res) {
// console.log(res.status); // loaded
// },
// fail: function (res) {
// console.log(res.status); // error
// }
// });
},
onHide: function () {
this.globalData.loginFirst = false;
},
getUserInfo() {
return new Promise((resolve, reject) => {
const _baseUserInfo = wx2my.getStorageSync('_baseUserInfo');
if (_baseUserInfo) {
resolve(_baseUserInfo);
} else {
reject('_baseUserInfo is null');
}
});
},
checkFullSucreen() {
const self = this;
wxService.getSystemInfo().then(res => {
if (res.screenHeight - res.windowHeight - res.statusBarHeight - 32 > 72) {
// 处理相关逻辑
self.globalData.isFullSucreen = true; // setGlobalData('fullScreen', true)
}
});
},
globalData: {
userInfo: null,
userBaseInfo: null,
// openid
systemInfo: wx2my.getSystemInfoSync(),
ctx: envInfo.ctx,
openCard: false,
userNo: null,
storeId: '',
storeName: '',
loginFirst: false,
imageUrl: envInfo.imgCtx,
//图片地址
isFullSucreen: false,
// 当前设备是否为 FullSucreen
commonFunc: commonFunc,
// brandId: 2711,
// brandId: 2005,
brandId: 1001 // brandId: 1002,
}
});
\ No newline at end of file
{
"pages": [
"pages/userCenter/userCenter",
"pages/mySpend/mySpend",
"pages/memberOfOwn/memberOfOwn",
"pages/memberRules/memberRules",
"pages/integralWater/integralWater",
"pages/deliveryService/deliveryService",
"pages/coupons/coupons",
"pages/couponDetail/couponDetail",
"pages/couponCodeDetail/couponCodeDetail",
"pages/consumptionDetails/consumptionDetails",
"pages/IntegralMall/IntegralMall",
"pages/integralMallDetail/integralMallDetail",
"pages/activateCard/activateCardCallback"
],
"subPackages": [
{
"root": "subPackage/page",
"pages": [
"pages/subPage/subPage",
"pages/h5/h5page"
]
}
],
"window": {
"defaultTitle": "WeChat",
"titleBarColor": "#fff"
}
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
const wx2my = require('../wx2my');
const Behavior = require('../Behavior');
var barcode = require('./barcode');
var qrcode = require('./qrcode');
function convert_length(length) {
return Math.round(wx2my.getSystemInfoSync().windowWidth * length / 750);
}
function barc(id, code, width, height) {
barcode.code128(wx2my.createCanvasContext(id), code, convert_length(width), convert_length(height));
}
function qrc(id, code, width, height) {
qrcode.api.draw(code, {
ctx: wx2my.createCanvasContext(id),
width: convert_length(width),
height: convert_length(height)
});
}
module.exports = {
barcode: barc,
qrcode: qrc
};
\ No newline at end of file
/* component/authorization-modal/authorization-modal.wxss */
.modal {
position: absolute;
right: 0;
left: 0;
bottom: 0;
top: 0;
background-color: transparent;
}
.auto-old {
display: flex;
padding-bottom: 10rpx;
}
.auto-old-num {
display: inline-block;
width: 60rpx;
}
.modal-mask {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.6);
opacity: 1;
z-index: 3;
}
.modal-container {
position: fixed;
left: 96rpx;
/* top: 262rpx; */
/* top: 18%; */
background-color: #fff;
width: 570rpx;
min-height: 450rpx;
z-index: 4;
border-radius: 20rpx;
}
.auth-avatar{
width: 126rpx;
height: 126rpx;
/* margin: 120rpx auto 92rpx; */
margin: 60rpx auto 60rpx;
}
.auth-avatar-img{
width: 126rpx;
height: 126rpx;
}
.auth-shop{
width: 400rpx;
margin: 0 auto;
font-size: 30rpx;
color: #333333;
}
.agree{
color: #fff;
width: 416rpx;
height: 88rpx;
line-height: 88rpx;
font-size: 30rpx;
background-color: #05c35b !important;
margin: 50rpx auto 32rpx;
}
.agree-rule{
font-size: 22rpx;
color: #666666;
display: flex;
padding-bottom: 50rpx;
}
.agree-icon{
margin-right: 10rpx;
}
.rule-text{
color: #05c35b;
}
.rule-wrap{
margin-left: 76rpx;
}
.close-img{
width: 58rpx;
height: 58rpx;
position: absolute;
bottom: -120rpx;
left: 265rpx;
}
<view class="modal" a:if="{{isAuthorization}}">
<view class="modal-mask"></view>
<view class="modal-container" style="top:{{isAuthorizationActiveText ? '12%' : '26%' }};">
<view class="auth-avatar">
<image class="auth-avatar-img" src="/assets/imgs/auth-avatar.png"></image>
</view>
<view class="auth-shop" a:if="{{isAuthorizationActiveText}}">
<view class="auto-old">
<span class="auto-old-num">1. </span>老会员无需领取新会员卡,即可在会员小程序享受全部会员权益。</view>
<view class="auto-old">
<span class="auto-old-num">2. </span>若在领取新会员卡过程中输入新手机号,会造成原会员及积分信息的更替。</view>
<view class="auto-old">
<span class="auto-old-num">3. </span>领取后的新会员卡,将存放在"微信-卡包"。</view>
</view>
<view class="auth-shop" a:else>广东7-Eleven申请获取授权,用于会员服务</view>
<!-- <button
type="primary"
a:if="{{!isAuthorizationActiveText}}"
onTap="handleGetAuthCode"
class="agree"
disabled="{{!checkAll}}"
>同意</button> -->
<button
a:if="{{!isAuthorizationActiveText}}"
class="agree"
open-type="getAuthorize"
onGetAuthorize="onGetAuthorize"
onError="onAuthError"
scope='userInfo'>
同意
</button>
<button
type="primary"
a:else
class="agree"
disabled="{{!checkAll}}"
onTap="handleActiveAgree"
>同意并领取新会员卡</button>
<view class="rule-wrap">
<view class="agree-rule">
<view a:if="{{!isAuthorizationActiveText}}" class="agree-icon">
<!-- WX2MY: {{checkAll ? 'success' : 'circle'}} 类型的 icon 不被支持, 请调整 -->
<!--<icon size="18" type="{{checkAll ? 'success' : 'circle'}}" bindtap="checkAll"></icon>-->
</view>
<view a:if="{{!isAuthorizationActiveText}}">
<text>我已阅读并同意</text>
<text class="rule-text" onTap="handelToMemberRules">《会员规则》</text>
</view>
<!-- <view wx:else><text>我已阅读并同意</text><text class='rule-text' bindtap="handelToMemberRules">《激活领卡规则》</text></view>-->
</view>
</view>
<view class="close" onTap="close">
<image class="close-img" src="/assets/imgs/close.png"></image>
</view>
</view>
</view>
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
const app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
Component({
/**
* 组件的属性列表
*/
props: {
isAuthorizationActiveText: '',
isAuthorizationType: 2
},
/**
* 组件的初始数据
*/
data: {
couponNum: '2',
userInfo: {},
hasUserInfo: false,
env: envInfo.env,
checkAll: true
},
/**
* 组件的方法列表
*/
methods: {
checkAll() {
this.setData({
checkAll: !this.data.checkAll
});
},
handelToMemberRules() {
wxService.router(`/pages/memberRules/memberRules?type=${this.data.isAuthorizationType}`);
},
//再想想
close() {
this.setData({
isAuthorization: false
});
},
//立即兑换
query() { },
_getUserInfo(res = {}) {
this.setData({
isAuthorization: false
});
const userInfo = res.detail || {};
if (res.detail.userInfo) {
utils.getUserInfoByBtn(userInfo).then((data = {}) => {
const {
token
} = data;
wx2my.setStorageSync('_accreditUserInfo', userInfo);
wx2my.hideNavigationBarLoading();
if (token) {
wx2my.setStorageSync('token', token);
} else {
wx2my.setStorageSync('token', '');
}
wx2my.setStorageSync('_baseUserInfo', data); // 存储用户开卡状态
// wx.setStorageSync('memberActivateStatus', data.memberActivateStatus)
this.setUserInfo();
}).catch(err => {
if (err) {
wx2my.showToast({
title: `会员系统异常请稍后重试!`,
icon: 'none'
});
}
});
} else {
this.setData({
isAuthorization: false
});
}
},
onGetAuthorize(res) {
this.setData({
isAuthorization: false
});
// 获取会员基础信息
my.getOpenUserInfo({
fail: (res) => {
},
success: (res) => {
let userInfo = JSON.parse(res.response).response // 以下方的报文格式解析两层 response
if (userInfo) {
utils.getUserInfoByBtn(userInfo).then((data = {}) => {
const {
token
} = data;
wx2my.setStorageSync('_accreditUserInfo', userInfo);
wx2my.hideNavigationBarLoading();
if (token) {
wx2my.setStorageSync('token', token);
} else {
wx2my.setStorageSync('token', '');
}
wx2my.setStorageSync('_baseUserInfo', data); // 存储用户开卡状态
// this.setUserInfo();
}).catch(err => {
if (err) {
wx2my.showToast({
title: `会员系统异常请稍后重试!`,
icon: 'none'
});
}
});
} else {
this.setData({
isAuthorization: false
});
}
}
});
},
handleGetAuthCode() {
this.setData({
isAuthorization: false
});
my.getAuthCode({
scopes: 'auth_user',
success: (res) => {
console.log('res', res,res.authCode)
my.getAuthUserInfo({
success: (userInfo) => {
console.log('userInfo', userInfo)
if (userInfo) {
utils.getUserInfoByBtn(userInfo, res.authCode).then((data = {}) => {
console.log('data', data)
})
}
// my.alert({
// content: userInfo.nickName
// });
// my.alert({
// content: userInfo.avatar
// });
}
});
},
});
},
handleActiveAgree() {
// 子组件触发父组件 去开卡
wxService.nextTick(() => {
this.props.onActiveTocard({
detail: true
});
});
this.setData({
isAuthorization: false
});
},
setUserInfo() {
// 判断有无开卡
// const {memberActivateStatus} = wx.getStorageSync('_baseUserInfo')
const userInfo = wx2my.getStorageSync('_baseUserInfo'); // 新用户去激活领卡
if (userInfo && userInfo.member && !userInfo.member.mobile) {
wxService.openCard();
return false;
}
const urls = getCurrentPages();
setTimeout(() => {
const item = urls[0].options;
if (item.route) {
try {
const options = JSON.parse(item.options);
wxService.router(`/${item.route}`).search(options).replace();
} catch (e) {
wxService.router('/pages/userCenter/userCenter').replace();
}
} else {
wxService.router('/pages/userCenter/userCenter').replace();
}
}, 200);
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* component/bottom/bottom.wxss */
.footer-content{
text-align: center;
line-height: 100rpx;
position: fixed;
margin-top:20rpx;
bottom: 0;
width:100%;
background-size:100% 100%;
}
.footer-arrow {
position: absolute;
left: 50rpx;
color: #ffffff;
}
.footer-text{
color: #ffffff;
font-size: 32rpx;
font-weight: 700;
letter-spacing:2rpx;
}
\ No newline at end of file
<!--component/bottom/bottom.axml fontColor 1 浅色 2 深色-->
<view
class="footer-content"
style="{{bottom.bgImgUrl ? 'background-image: url('+ baseImgUrl +''+ bottom.bgImgUrl +');' : 'background-color: ' + bottom.color + ';'}}"
data-link="{{bottom.link}}"
data-appid="{{bottom.link.appid}}"
data-item="{{bottom}}"
data-path="{{bottom.link.url}}"
catchTouchStart="touchStart"
catchTouchEnd="touchEnd"
>
<text class="footer-arrow" style="color:{{bottom.fontColor == 1 ? '#FFF' : '#000'}};"><<</text>
<text class="footer-text" style="color:{{bottom.fontColor == 1 ? '#FFF' : '#000'}};">{{bottom.title}}</text>
</view>
<authorization-modal isAuthorization="{{isAuthorization}}"/>
\ No newline at end of file
// component/bottom/bottom.js
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
var app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
Component({
/**
* 组件的属性列表
*/
data: {
bottom: {
type: Object,
value: {}
}
},
didMount() {
this.setData({
baseImgUrl: app.globalData.imageUrl
});
},
/**
* 组件的初始数据
*/
data: {
startX: 0,
startY: 0,
isAuthorization: false,
baseUrl: '#02bb70',
baseImgUrl: ''
},
/**
* 组件的方法列表
*/
methods: {
touchStart(e) {
this.setData({
startX: e.changedTouches[0].clientX,
startY: e.changedTouches[0].clientY
});
},
touchEnd(e) {
let x = e.changedTouches[0].clientX;
let y = e.changedTouches[0].clientY; // endX, endY, startX, startY
const {
startX,
startY
} = this.data;
let isTouchLeft = utils.getTouchData(x, y, startX, startY); // 触发左划事件
if (isTouchLeft == 'left') {
const {
appid,
path,
link,
item
} = e.currentTarget.dataset;
// 更改数据问题
let currentClickType = app.globalData.commonFunc.getLink(item.link.type, item);
const userInfo = wx2my.getStorageSync('_baseUserInfo'); // type==1 外部 不用弹 没有登录弹
if (link.type == 1) {
// 触发父组件更新页面 外部小程序
this.setData({
isAuthorization: false
});
return false;
} else if (!userInfo) {
this.setData({
isAuthorization: true
});
return false;
} else if (userInfo && userInfo.member && !userInfo.member.mobile) {
wxService.openCard();
return false;
} // wxService.openCard()
if (link.type == 2) {
// 触发父组件更新页面
wxService.nextTick(() => {
this.triggerEvent('updatePage', {
pageId: currentClickType.url
});
});
} else if (link.type == 3) {
// 预览
wx2my.previewImage({
current: `${app.globalData.imageUrl}/${currentClickType.imageUrl}`,
// 当前显示图片的http链接
urls: [`${app.globalData.imageUrl}/${currentClickType.link.url}`] // 需要预览的图片http链接列表
});
} else if (link.type == 4) {
wxService.router(`${currentClickType}`);
} else if (link.type == 5) {
if (currentClickType == 1) {
// wxService.openCardList()
wxService.openCard();
} else if (currentClickType == 2) {
wxService.openCard();
}
} else if (link.type == 6) {
wxService.router(`${currentClickType}`);
}
}
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {
"authorization-modal": "./../../component/authorization-modal/authorization-modal"
}
}
\ No newline at end of file
.modal {
position: absolute;
right: 0;
left: 0;
bottom: 0;
top: 0;
background-color: transparent;
}
button::after {
border: 0;
}
.modal-mask {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.6);
opacity: 1;
z-index: 3;
}
.num {
color: rgb(255, 152, 0);
padding-right:10rpx;
}
.modal-container {
position: fixed;
left: 96rpx;
top: 30%;
background-color: #fff;
width: 558rpx;
height: 400rpx;
z-index: 4;
border-radius: 20rpx;
}
.modal-header{
padding: 38rpx 56rpx;
border-radius: 20rpx;
background-color: rgb(227, 223, 223);
}
.modal-title{
font-size: 32rpx;
font-weight: bold;
}
.modal-close {
position: absolute;
top: 40rpx;
right: 40rpx;
}
.modal-close>image {
width: 32rpx;
height: 32rpx;
}
.modal-content {
margin: 0 auto;
width: 432rpx;
}
.modal-desc{
font-size: 28rpx;
display: flex;
justify-content: center;
line-height:158rpx;
}
.modal-bottom {
text-align: center;
display: flex;
}
.cancel,.query{
display: inline-block;
width: 180rpx;
font-size: 26rpx;
}
.query {
background-color: rgb(2, 187, 112);
color: #fff;
}
.cancel{
color: rgb(2, 187, 112);
background-color: #fff;
border: 1px solid rgb(2, 187, 112);
}
.coupon-number{
float: right;
}
.coupon-number .redus .add{
display: inline-block;
}
.coupon-number .num-ipt{
display: inline-block;
vertical-align: middle;
width: 60rpx;
border: 1px solid #999999;
margin: 0 20rpx;
border-radius: 20rpx;
padding: 0 20rpx;
text-align: center;
}
<!--component/exchange-coupon-modal/exchange-coupon-modal.axml-->
<view class="modal" a:if="{{isExchange}}">
<view class="modal-mask"></view>
<view class="modal-container">
<view class="modal-header">
<view class="modal-title">确认要兑换该优惠券吗?</view>
</view>
<view class="modal-content">
<view class="modal-desc">
<view>
<text class="num">{{exchangePoint}}</text>积分</view>
<!-- <view class='coupon-number'>
<view class="redus" catchtap="minusNum">-</view>
<input class="num-ipt" type="number" catchtap bindblur="blurNum" bindinput="inputNum" value="{{couponNum}}"></input>
<view class="add" catchtap="addNum">+</view>
</view>-->
</view>
<view class="modal-bottom">
<button class="cancel" onTap="cancel">再想想</button>
<button class="query" onTap="handelRedeemNow">立即兑换</button>
</view>
</view>
</view>
</view>
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// component/exchange-coupon-modal/exchange-coupon-modal.js
var app = getApp();
const wxService = require('../../utils/wxService');
const envInfo = require('../../config/index').envInfo;
Component({
/**
* 组件的属性列表
*/
props: {
isExchange: false,
exchangePoint: 0,
exchangeId: ''
},
/**
* 组件的初始数据
*/
data: {
couponNum: '1'
},
/**
* 组件的方法列表
*/
methods: {
minusNum() {
let number = this.data.couponNum;
if (this.data.couponNum > 1) {
number--;
this.setData({
couponNum: number
});
} else {
wx2my.showToast({
title: '数量不能为0',
icon: 'none'
});
}
},
addNum() {
let number = this.data.couponNum;
if (this.data.couponNum < 500) {
number++;
this.setData({
couponNum: number
});
} else {
wx2my.showToast({
title: '数量不能超过库存',
icon: 'none'
});
}
},
// 再想想
cancel() {
this.setData({
isExchange: false
});
},
// 立即兑换
handelRedeemNow() {
wx2my.showLoading({
title: '加载中'
});
const params = {
activateId: this.data.exchangeId
};
wxService.post(`/coupon/pointsRedemptionCouponSetting/exchange`, this.data.exchangeId).then(res => {
if (res) {
if (res.data.result == 0) {
wx2my.hideLoading();
wx2my.showToast({
title: '兑换成功',
icon: 'success'
});
this.setData({
isExchange: false
});
}
} else {
this.setData({
isExchange: false
});
}
}).catch(err => {
console.log('err', err);
});
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* component/imageSwiper/imageSwiper.wxss */
.image-swiper{
height: 420rpx;
}
.swiper-item{
border-radius: 10rpx;
height: 374rpx;
}
.slide-image {
width: 100%;
height: 100%;
border-radius:7rpx;
}
\ No newline at end of file
<!--component/imageSwiper/imageSwiper.axml-->
<swiper
indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}"
interval="{{interval}}"
duration="{{duration}}"
circular="{{circular}}"
class="image-swiper"
>
<block a:for="{{imageData}}" a:key="{{item}}">
<swiper-item class="swiper-item">
<image
a:if="{{baseImgUrl}}"
src="{{baseImgUrl}}{{item.imageUrl}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
onTap="preview"
class="slide-image"
/>
</swiper-item>
</block>
</swiper>
<authorization-modal isAuthorization="{{isAuthorization}}"/>
\ No newline at end of file
// component/imageSwiper/imageSwiper.js
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
var app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
Component({
/**
* 组件的属性列表
*/
props: {
imageData: []
},
didMount() {
this.setData({
baseImgUrl: app.globalData.imageUrl
});
},
/**
* 组件的初始数据
*/
data: {
imgUrls: [],
indicatorDots: false,
autoplay: true,
circular: true,
interval: 5000,
duration: 1000,
isAuthorization: false,
// false 不显示 true 显示
baseImgUrl: ''
},
/**
* 组件的方法列表
*/
methods: {
preview(e) {
const {
appid,
path,
link,
item
} = e.currentTarget.dataset; // 获取当前帐号信息
const userInfo = wx2my.getStorageSync('_baseUserInfo');
let currentClickType = app.globalData.commonFunc.getLink(item.link.type, item);
console.log('0000', link.type, currentClickType )
if (link.type == 1) {
// 触发父组件更新页面 外部小程序
this.setData({
isAuthorization: false
});
return false;
} else if (!userInfo) {
this.setData({
isAuthorization: true
});
return false;
} else if (userInfo && userInfo.member && !userInfo.member.mobile) {
wxService.openCard();
return false;
}
if (link.type == 2) {
// 触发父组件更新页面
wxService.nextTick(() => {
this.props.onUpdatePage({
detail: {
pageId: currentClickType.url
}
});
});
} else if (link.type == 3) {
// 预览
wx2my.previewImage({
current: `${app.globalData.imageUrl}/${currentClickType.imageUrl}`,
// 当前显示图片的http链接
urls: [`${app.globalData.imageUrl}/${currentClickType.link.url}`] // 需要预览的图片http链接列表
});
} else if (link.type == 4) {
wxService.router(`${currentClickType}`);
} else if (link.type == 5) {
if (currentClickType == 1) {
// wxService.openCardList()
wxService.openCard();
} else if (currentClickType == 2) {
wxService.openCard();
}
} else if (link.type == 6) {
wxService.router(`${currentClickType}`);
}
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {
"authorization-modal": "./../../component/authorization-modal/authorization-modal"
}
}
\ No newline at end of file
/* component/noMore.wxss */
.detail-list-bottom {
text-align: center;
font-size: 21rpx;
color: #bfbfbf;
/* margin-top: 45rpx; */
}
\ No newline at end of file
<!--component/noMore.axml-->
<view class="detail-list-bottom">-已经到底啦-</view>
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// component/noMore.js
Component({
/**
* 页面的初始数据
*/
data: {},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* component/personCenter/personCenter.wxss */
@import './../../base/base.acss';
.user-content{
height: 92rpx;
padding: 28rpx 35rpx 0 50rpx;
box-sizing: border-box;
}
.activation-content{
/* position: relative; */
width: 690rpx;
height: 166rpx;
margin: 18rpx 0;
border-radius: 7rpx;
box-shadow: 0 0 40rpx 1rpx #ccc;
}
.person-num {
margin-bottom: 20rpx;
}
.person-detail {
margin-top: 10rpx;
}
.point-desc{
font-size: 20rpx;
color: #666666;
}
.point-number{
font-size: 30rpx;
font-weight: bold;
color: #333333;
margin-bottom: 15rpx;
letter-spacing: 1.5rpx;
}
.activation-bg{
border-radius: 10rpx;
box-shadow: 0 0 10px #ccc ;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.user-avatar{
width: 100rpx;
height: 100rpx;
overflow:hidden;
border-radius: 50%;
display: inline-block;
margin-right: 46rpx;
}
.user-name-content{
display: inline-block;
}
.user-name{
margin-bottom: 15rpx;
}
.icon-edit{
width: 28rpx;
height: 28rpx;
vertical-align: middle;
margin-left: 34rpx;
color: #fff;
}
.user-id{
color: #666666;
font-size: 24rpx;
}
.person-right {
border-right: 1px solid #c8c9c9;
}
.point, .person-right{
padding:0 0 5rpx 0;
box-sizing:border-box;
}
.no-active-img {
width: 100%;
height: 100% !important;
border-radius:15rpx;
}
.userinfo-nickname,.user-id {
color: #fff;
}
.user-info {
/* position: relative; */
display: flex;
}
.user-name-content {
/* position: absolute;
top: 11rpx; */
/* padding-top: 10rpx; */
}
.member-unActive{
margin: 18rpx 0;
color: #FFF;
text-align: center;
height: 200rpx;
line-height: 200rpx;
border-radius: 15rpx;
font-size: 36rpx;
font-weight: 700;
letter-spacing: 5rpx;
cursor: pointer;
}
.member-unActive-bgc {
background-color: #02bb70;
}
.un-active-btn{
/* font-family:"iconfont-711" !important; */
}
.user-info{
position: relative;
}
.qr-code{
position: absolute;
right: 0;
top: 6rpx;
}
.qr-code>image{
width: 100rpx;
height: 100rpx;
}
\ No newline at end of file
<!--component/personCenter/personCenter.axml-->
<view
a:if="{{!currentMobile}}"
class="member-unActive {{personCenter.noactiveBackgroundImageUrl ?'':'member-unActive-bgc'}}"
onTap="handleTtoActiveMemebr"
>
<image
a:if="{{baseImgUrl}}"
src="{{baseImgUrl}}{{personCenter.noactiveBackgroundImageUrl}}"
class="no-active-img"
mode="widthFix"
></image>
</view>
<view
a:if="{{currentMobile}}"
catchTap="handleToMemberOfOwn"
class="activation-content activation-bg {{true ? 'user-content' : ''}}"
style="{{personData.backgroundImageUrl ? 'background-image: url('+ baseImgUrl +''+ personData.backgroundImageUrl +');' : 'background-color: ' + baseUrl + ';'}}"
>
<view class="user-info" a:if="{{currentMobile}}">
<view class="user-avatar">
<open-data type="userAvatarUrl"></open-data>
</view>
<view class="user-name-content">
<view class="user-name">
<!-- 1 浅色 2 黑色-->
<open-data
type="userNickName"
style="color:{{personCenter.fontColor == 2? '#000' : '#fff'}};"
class="userinfo-nickname"
lang="zh_CN"
></open-data>
</view>
<view class="user-id" style="color:{{personCenter.fontColor == 2? '#000' : '#fff'}};">{{memberCardNo}}</view>
</view>
<view class="qr-code pr">
<image src="/assets/imgs/711_11.png"></image>
</view>
</view>
</view>
<view class="df tc person-num" a:if="{{currentMobile}}">
<view
class="df-1 point person-right"
onTap="toBonusDetails"
a:if="{{personCenter.bonus == 0}}"
>
<view class="point-number" style="color:{{personCenter.fontColor}};">{{integralNum}}</view>
<view class="point-desc" style="color:{{personCenter.fontColor}};">积分</view>
</view>
<view
class="df-1 point"
onTap="toCouponList"
a:if="{{personCenter.coupon == 0}}"
>
<view class="point-number" style="color:{{personCenter.fontColor}};">{{couponNum}}</view>
<view class="point-desc" style="color:{{personCenter.fontColor}};">优惠券</view>
</view>
</view>
<authorization-modal isAuthorization="{{isAuthorization}}"/>
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// component/personCenter/personCenter.js
var app = getApp();
const wxService = require('../../utils/wxService');
const envInfo = require('../../config/index').envInfo;
Component({
props: {
personData: {},
integralNum: 0,
baseUserInfo: {},
couponNum: 0,
token: null
},
/**
* 页面的初始数据
*/
data: {
personCenter: {},
memberCardNo: "",
memberActivateStatus: false,
integralNum: 0,
couponNum: 0,
// baseUrl: '/assets/imgs/060610.png',
baseUrl: '#02bb70',
isAuthorization: false,
_token: '',
currentMobile: '',
baseImgUrl: '',
storgeUserInfo: wx2my.getStorageSync('_baseUserInfo')
},
observers: {
'**': function (e) {// 每次 setData 都触发
}
},
didMount() {
this.setData({
personCenter: this.props.personData,
baseImgUrl: app.globalData.imageUrl
});
},
methods: {
_userInfoChange(newVal, oldVal) {
if (newVal !== oldVal) {
this.setData({
memberActivateStatus: newVal && newVal.memberActivateStatus || false,
memberCardNo: newVal && newVal.memberCardNo || '',
currentMobile: newVal && newVal.member && newVal.member.mobile || ''
});
}
},
handleToMemberOfOwn() {
wxService.router(`/pages/memberOfOwn/memberOfOwn`);
},
toBonusDetails() {
wxService.router(`/pages/integralWater/integralWater`);
},
toCouponList() {
wxService.router(`/pages/coupons/coupons`);
},
handleTtoActiveMemebr() {
if (wx2my.getStorageSync('_baseUserInfo')) {
wxService.openCard();
} else {
this.setData({
isAuthorization: true
});
}
},
handleGoWxCard() {
wxService.openCard();
}
},
detached() {
this._userInfoChange = null;
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {
"authorization-modal": "./../../component/authorization-modal/authorization-modal"
}
}
\ No newline at end of file
/* component/picNav/picNav.wxss */
/* .pic-nav {
display: flex;
overflow: hidden;
padding: 0;
margin: 0;
box-sizing:content-box;
} */
.pic-nav {
display: flex;
padding: 0;
margin: 0;
overflow: hidden;
box-sizing: border-box;
flex-direction: row;
align-items: center;
}
.pic-img {
display: block;
/* vertical-align: top; */
/* float: left; */
}
<!--component/picNav/picNav.axml-->
<view class="pic-nav">
<view
a:for="{{picNav}}"
a:for-index="index"
a:for-item="item"
class="nav-block"
style="width: {{imagewidth}}px;height: {{imageheight}}px;"
>
<image
a:if="{{baseImgUrl}}"
class="pic-img"
style="width: {{imagewidth}}px;height: {{imageheight}}px;"
src="{{baseImgUrl}}{{item.imageUrl}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
onLoad="imageLoad"
onTap="preview"
/>
</view>
</view>
<authorization-modal
isAuthorization="{{isAuthorization}}"
onActiveTocard="activeTocard"
isAuthorizationType="{{isAuthorizationType}}"
isAuthorizationActiveText="{{isAuthorizationActiveText}}"
/>
\ No newline at end of file
// component/picNav/picNav.js
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
var app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
Component({
/**
* 组件的属性列表
*/
props: {
picNav: []
},
didMount() {
this.setData({
picNav: this.props.picNav,
baseImgUrl: app.globalData.imageUrl
});
},
/**
* 组件的初始数据
*/
data: {
imagewidth: 0,
imageheight: 0,
isAuthorization: false,
isAuthorizationActiveText: '',
isAuthorizationType: 2,
baseImgUrl: ''
},
/**
* 组件的方法列表
*/
methods: {
imageLoad(e) {
let imageSize = utils.imageUtil(e);
this.setData({
},()=> {
this.setData({
imagewidth: imageSize.imageWidth,
imageheight: imageSize.imageHeight
})
});
},
preview(e) {
const {
appid,
path,
link,
item
} = e.currentTarget.dataset;
const {
memberActivateStatus
} = wx2my.getStorageSync('_baseUserInfo');
const userInfo = wx2my.getStorageSync('_baseUserInfo'); // 2019.06.14
let currentClickType = app.globalData.commonFunc.getLink(item.link.type, item);
if (link.type == 1) {
// 触发父组件更新页面 外部小程序
this.setData({
isAuthorization: false
});
return false;
} else if (!userInfo) {
// userInfo 不存在 授权弹框
this.setData({
isAuthorization: true
});
return false;
}
if (link.type == 2) {
// 触发父组件更新页面 内部子页面
wxService.nextTick(() => {
this.props.onUpdatePage({
detail: {
pageId: currentClickType.url
}
});
});
} else if (link.type == 3) {
// 预览
wx2my.previewImage({
current: `${app.globalData.imageUrl}/${currentClickType.imageUrl}`,
// 当前显示图片的http链接
urls: [`${app.globalData.imageUrl}/${currentClickType.link.url}`] // 需要预览的图片http链接列表
});
} else if (link.type == 4) {
// 内部固定功能
wxService.router(`${currentClickType}`);
} else if (link.type == 5) {
// 微信卡券 -- 卡包/领卡
if (currentClickType == 1) {
wxService.openCard();
} else if (currentClickType == 2) {
// wxService.openCard()
if (userInfo && userInfo.member && userInfo.member.mobile && !userInfo.memberActivateStatus) {
// 手机号存在 但未激活 跳转激活领卡页面 老用户
this.setData({
isAuthorizationActiveText: '新激活领卡',
isAuthorization: true,
isAuthorizationType: 3
}, () => {
return false;
});
} else {
wxService.openCard();
}
}
} else if (link.type == 6) {
wxService.router(`${currentClickType}`);
}
},
activeTocard(e) {
if (e.detail) {
wxService.openCard();
}
}
}
});
\ No newline at end of file
{
"component": true,
"onReachBottomDistance": 0,
"usingComponents": {
"authorization-modal": "./../../component/authorization-modal/authorization-modal"
}
}
\ No newline at end of file
/* component/picNav/picNav.wxss */
.pic-nav {
display: flex;
padding: 10rpx 20rpx;
}
.pic-item {
flex: 1;
height: 200rpx;
border-radius:10rpx;
}
.pic-img {
height: 100%;
width: 100%;
}
\ No newline at end of file
<!--component/picNav/picNav.axml-->
<view class="pic-nav">
<block
a:for="{{picNav}}"
a:key="{{index}}"
a:for-item="item"
class="pic-content"
>
<view class="pic-item">
<image
a:if="{{baseImgUrl}}"
class="pic-img"
src="{{baseImgUrl}}{{item.imageUrl}}"
data-current-url="{{item.imageUrl}}"
data-url="{{item.link.url}}"
onTap="preview"
mode="scaleToFill"
/>
</view>
</block>
</view>
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// component/picNav/picNav.js
var app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
Component({
/**
* 组件的属性列表
*/
props: {
picNav: []
},
didMount() {
this.setData({
baseImgUrl: app.globalData.imageUrl
});
},
/**
* 组件的初始数据
*/
data: {
baseImgUrl: ''
},
/**
* 组件的方法列表
*/
methods: {
preview(e) {
const {
url,
currentUrl
} = e.currentTarget.dataset;
wx2my.previewImage({
current: `${app.globalData.imageUrl}/${currentUrl}`,
// 当前显示图片的http链接
urls: [`${app.globalData.imageUrl}/${url}`] // 需要预览的图片http链接列表
});
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
var utils = require('../../wxs/utils.wxs');
function hanlderIntegralPrice(product) {
var integarlGoods, singleGoods, maxIntegarlPrice, minPrice, maxPrice, prices, minIntegarlPrice;
integarlGoods = product.exchange_credits > 0;
singleGoods = product.minSkuPrice === product.maxSkuPrice;
minPrice = utils.numberFormat(product.minSkuPrice / 100) || 0;
maxPrice = utils.numberFormat(product.maxSkuPrice / 100) || 0;
prices = '';
if (integarlGoods) {
minIntegarlPrice = utils.numberFormat(product.exchange_credits * product.integral_role / 100 - product.minSkuPrice / 100) || 0;
maxIntegarlPrice = utils.numberFormat(product.exchange_credits * product.integral_role / 100 - product.maxSkuPrice / 100) || 0;
prices = minIntegarlPrice * 1 < 0 ? product.exchange_credits + '积分+¥' + Math.abs(minIntegarlPrice) : product.exchange_credits + '积分';
} else if (singleGoods && !integarlGoods) {
prices = maxPrice;
} else {
prices = ['¥', minPrice, '-', maxPrice].join('');
}
return prices;
}
module.exports = {
hanlderIntegralPrice: hanlderIntegralPrice
};
\ No newline at end of file
.table{
display: table;
border-collapse: collapse;
font-size: 28rpx;
color: #333333;
text-align: left;
vertical-align: middle;
width: 100%;
}
.table .tr{
display: table-row;
height: 70rpx;
vertical-align: middle;
line-height: 70rpx;
}
.table .thead{
display: table-header-group;
}
.table .thead .tr{
height: 100rpx;
color: #9d9d9d;
font-size: 28rpx;
line-height: 100rpx;
}
.table .tbody{
display: table-row-group;
}
.table .tr .th,.table .tr .td{
display: table-cell;
}
.table .tr .th:first-child {
width: 100rpx;
padding: 0rpx 30rpx 0 0;
}
.table .tr .th:last-child {
padding-left: 10rpx;
box-sizing: border-box;
}
.table .tr .td:last-child{
text-align: right;
}
\ No newline at end of file
<import-sjs from="./handler.sjs" name="tools"/>
<import-sjs from="../../wxs/utils.sjs" name="utils"/>
<!--components/table/table.axml-->
<view class="table">
<view class="thead">
<view class="tr">
<view
class="th"
a:for="{{tableThemes}}"
a:key="{{index}}"
>{{item}}</view>
</view>
</view>
<view class="tbody">
<view
class="tr"
a:for="{{tableItems}}"
a:for-item="item"
a:for-index="k"
a:key="{{k}}"
>
<view class="td">{{item.productCount}}</view>
<view class="td">{{item.productName}}</view>
<view class="td">{{utils.numberFormat(item.productMoney / 100)}}</view>
</view>
</view>
</view>
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
var app = getApp();
const wxService = require('../../utils/wxService');
const envInfo = require('../../config/index').envInfo;
Component({
/**
* 组件的属性列表
*/
props: {
tableThemes: {},
tableItems: []
},
didMount() {},
/**
* 组件的初始数据
*/
data: {
someData: {}
},
methods: {
// 这里是一个自定义方法
customMethod() {}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
const wx2my = require('../wx2my');
const Behavior = require('../Behavior');
const PROJECT_ENV = 'dev'; // 生产 prod, 开发 dev, 测试 test, 预生产 pre
const needMock = ''; //
// appid_dev_wx wxc3b64b09b1d3dfc2
// appid_test_wx wx857ea77f4f7f4f34
// appid_pre_711 wx358b56af62edbde1
// appid_prod_711 wx700028bf32a3be66 上传生产注意 首页配置接口!!!!!!!!!!!!!!!!!!!!!!
// 1 2 3 步!!!!!!!!!!!!!!!!!!!!!! prod appid brandId
// const devCtx = 'http://111.231.86.64'
const devCtx = 'http://buyer.devapi.bigaka.net'; // 开发环境
const testCtx = 'https://crm-b.bigaka.net/api'; // 发测试时解开此注释
const preCtx = 'https://crm-b.bigaka.com/api'; // 发预生产时解开此注释
const prodCtx = 'https://crm-b.bigaka.com/api'; // 发生产时解开此注释
const devImgCtx = 'http://testimg3.bigaka.com'; // 开发环境图片地址
const testImgCtx = 'http://testimg3.bigaka.com'; // 测试环境图片地址
const preImgCtx = 'http://testimg3.bigaka.com'; // 预生产环境图片地址
const prodImgCtx = 'http://testimg3.bigaka.com'; // 预生产环境图片地址
// const prodImgCtx = 'https://img3.bigaka.com' // 生产环境图片地址
const config = {
dev: devCtx,
test: testCtx,
pre: preCtx,
prod: prodCtx
};
const imgConfig = {
dev: devImgCtx,
test: testImgCtx,
pre: preImgCtx,
prod: prodImgCtx
};
const envInfo = (() => {
return {
ctx: config[PROJECT_ENV],
env: PROJECT_ENV,
imgCtx: imgConfig[PROJECT_ENV]
};
})();
module.exports = {
envInfo
};
\ No newline at end of file
const wx2my = require('../wx2my');
const Behavior = require('../Behavior');
module.exports = {
pixelRate: 0.5,
//px与rpx换算关系
platform: 'ios',
//操作平台 用于适配胶囊高度
capsuleHeight: 40,
//胶囊高度
statusBarHeight: 20,
//手机顶部状态栏高度
titleHeight: 136,
//整个导航头高度
systemHeight: 0,
//手机屏幕高度
isAllScreen: false,
//是否是全面屏手机
isHighHead: false //是否是刘海屏手机
};
\ No newline at end of file
This diff is collapsed. Click to expand it.
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"wxbarcode": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wxbarcode/-/wxbarcode-1.0.2.tgz",
"integrity": "sha1-zgLjSP8AYwHZIBd21sn1rZATFLU="
}
}
}
\ No newline at end of file
/* pages/userCenter.wxss */
@import './../../base/base.acss';
.integral-vip-rules{
width: 140rpx;
height:35rpx;
line-height: 35rpx;
text-align: center;
color: rgb(64, 205, 147);
font-size: 28rpx;
font-weight: 700;
border: 4rpx solid rgb(64, 205, 147);
padding: 5rpx 8rpx;
border-radius: 50rpx;
margin-top: 25rpx;
float: right;
margin-right: 20rpx;
}
.empty-wrap{
display: flex;
justify-content: center;
align-items: center;
padding-top: 100px;
}
.empty-img{
width: 197rpx;
height: 176rpx;
margin-bottom: 48rpx;
}
.empty-text{
text-align: center;
color: #cccccc;
font-size: 28rpx;
}
/* 卡劵列表 */
.coupon-wrap{
padding: 20rpx;
clear: both;
}
.coupon-list{
margin-bottom: 20rpx;
}
.coupon-item {
display: flex;
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsgAAADRCAYAAADR7UQMAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACddJREFUeNrs3X+IpHUdwPHv3awz+sR4F7eWjuZZik9koMlKRWn7R/0jxJ1/iIqQlv4hEajQP/4RnUhEUHQQhH8onoJQRORh+UcFKRIRLbpHZj6ScudjK/5YvPPJJ2e5aZvv7AztXet5M3u3zD7zesHD3o+dhf3wzM57vvudZ7YsLy+HE9jdP67oHpcHmCz3do896/was93jD0YJwBh5qv/4tC5X/flHbz9TvLp9M33j5ze2Hf3EWTveuiQ55zfnNc6+776Lrz201udNneBBfV/32OkcYoKdijv9RcYIwJj50qn4IpstjqN/to9MdY9znz788m1nT535jUPvvb3/kctuvu74z9u6xm33hJUVL3HMpJsdk68BAKfa7vXc+Nsv7r9hsw/gnaPvbXn0tbnds3M/ee07Lz2x80SBvLd7fNc5Az2XrzNwt6/3BxAAjGMgP/fua9+ryiCePvzyub98/cDf3y+Q46DudL7AMfas87bbjBCAMXRLWHmN2dDi6vHvFrOLqzSMrHzjrN0HHnz2+ECOK137nCvwf+I+rb0j3O5WTzgBGHOPhSFfbxO3Ijzx1vMPVXEYj7/53BWDrSNbVz2YW+mCtd055BPIeH96yNgAGHNx3+2T4SRfUH7PP379xbgVIa62VnUgg60jW/qXeZsPLuMGH+RA97ir/8NkLfEHTFxt3mVUAGwiR/qPX/E4fPx/xlXjF8s3H/7t4gvXxBe2VX0YnS//eMsgkJedG3DSDvUj+WD/7/HXU7OeZAJQAfu7x/wNf304Pq6F19vvpAf+tfDRSQjjgW997Oq7YyDHDdrPOh8AAIhqv797Yr/3m8+beSzuQd7uNAAAgBDa/zn64a3GAAAA/yOQAQBAIMP6lGUZsiwLeZ4bBgBUzJQRwPA6nU4oisIgAKCCrCADAIBABgAAgQwAAAIZAACG4UV6MIIkSUKapqFWqxkGAAhkIIZxs9k0CACoIFssAABAIAMAgEAGAACBDAAAAhlOs8FbTZdlaRgAIJCBGMZZloU8zw0DAAQyAAAIZAAAEMgAACCQAQBAIAPDGLzVdJIkhgEAFTNlBDC8GMZpmhoEAFSQFWQAABDIAAAgkAEAQCADAIBABgAAgQwbpyzLkGVZyPPcMACgYlzmDUbQ6XRCURQGAQAVZAUZAAAEMgAACGQAABDIAAAwDC/SgxHU6/XQarV6HwEAgQwTr9Fo9AIZAKgeWywAAEAgAwCAQAYAAIEMAAACGQAABDJsnKIowtzcXMiyzDAAQCADAIBABgAAgQwAAAIZAAAEMgAAEE0ZAQyv2WyGmZkZgwCACrKCDAAAAhkAAAQyAAAIZAAAEMgAADAiV7GAEbTb7bC4uBjq9XqYnp42EACoECvIMIKlpaWwsLDQi2QAQCADAIBABgAAgQwAAAIZAAAml6tYwAji1StarVbvIwAgkGHiNRqNXiADANVjiwUAAAhkAAAQyAAAIJABAEAgAwCAQIaNUxRFmJubC1mWGQYACGQAABDIAAAgkAEAQCADAIBABgAAoikjgOElSRLSNA21Ws0wAEAgAzGMm82mQQBABdliAQAAAhkAAAQyAAAIZAAAEMhwmnU6nVAURSjL0jAAQCADMYyzLAt5nhsGAAhkAAAQyAAAIJABAEAgAwCAQAaGMXir6SRJDAMAKmbKCGB4MYzTNDUIAKggK8gAACCQAQBAIAMAgEAGAACBDAAAAhk2TlmWIcuykOe5YQBAxbjMG4yg0+mEoigMAgAqyAoyAAAIZAAAEMgAACCQAQBgGF6kByNIkiSkaRpqtZphAIBABmIYN5tNgwCACrLFAgAABDIAAAhkAAAQyAAAIJDhNBu81XRZloYBAAIZiGGcZVnI89wwAEAgAwCAQAYAAIEMAAACGQAABDIAABBNGQEMr9lshpmZGYMAgAqyggwAAAIZAAAEMgAACGQAABDIAAAwIlexgBG02+2wuLgY6vV6mJ6eNhAAqBAryDCCpaWlsLCw0ItkAEAgAwCAQAYAAIEMAAACGQAAJperWMAI4tUrWq1W7yMAIJBh4jUajV4gAwDVY4sFAAAIZAAAEMgAACCQAQBAIAMAgECGjVMURZibmwtZlhkGAAhkAAAQyAAAIJABAEAgAwCAQAYAAKIpI4DhNZvNMDMzYxAAUEFWkAEAQCADAIBABgAAgQwAAAIZAABG5CoWMIJ2ux0WFxdDvV4P09PTBgIAFWIFGUawtLQUFhYWepEMAAhkAAAQyAAAIJABAEAgAwCAQAaGUKvVQrPZDEmSGAYAVIzLvMEIYhinaWoQAFBBVpABAEAgAwCAQAYAAIEMAAACGQAABDJsnLIsQ5ZlIc9zwwCAinGZNxhBp9MJRVEYBABUkBVkAAAQyAAAIJABAEAgAwDAMLxID0aQJElI0zTUajXDAACBDMQwbjabBgEAFWSLBQAACGQAABDIAAAgkAEAQCDDaTZ4q+myLA0DAAQyEMM4y7KQ57lhAIBABgAAgQwAAAIZAAAEMgAACGRgGIO3mk6SxDAAoGKmjACGF8M4TVODAIAKsoIMAAACGQAABDIAAAhkAAAQyAAAIJBh45RlGbIsC3meGwYAVIzLvMEIOp1OKIrCIACggqwgAwCAQAYAAIEMAAACGQAAhuFFejCCer0eWq1W7yMAIJBh4jUajV4gAwDVY4sFAAAIZAAAWFvcYnHQGGBoR7rHfP/PF3WPnUYCQEUcuLJ5wc53O0uNrHzjrEn75neckfxpy/Lycvzz4e6xzfkAH+jh7rF3VRyHVZF8a/e4y30JgE3oqe6xr38c45sv/OL7fznyyh3PFK9un4RB3H3h7I2DQH6se+xybsD7P5vuB/D8B3ze9v4PF/cnADZNE4aVxZ8T+trfHv3V428+t+udo+9tqeogzm9sO/rK1XvOGOxB3uvcgBPG8exJxHEUfxuzO6ysNAPAuPvMyXbgI5fdfN1trc/ddPbUmctVHcbnt3/8j/HjIJCfDCtL68CxjvTj+PCQt7u1H9YAMK7iyvH8MDf44aW7fv7Vcz69v4rDiOF/aXLOLasDefCAfsS5Ase4a4Q4Xn2fAoBxFBdGR9pBEFeSr2xecLhqA7np3Ct/cN/F1x46PpAPhpWVMpEMK+J9Yd86bj8f/GYGgPG0nse3cNW2C++v0jC+3vrsgz/95PX3DP6+dY0H9BjJh5w30Hvx6jh8DQAYq8e41TG5mcVtFTGOH/jUjbev/ve13igkRvIV3ePeYDWZyXbwFHyNeWMEYMzEhdB1b5FIk4/8ezOH8Vd2pC/dccEXrjk+jqPBZd5OZLZ/wCQ+u15v4F4U7EUGYLwcDOvcYhHd/vzPHig67Us22zcf3whkxxkfun+w33gt/xVgAJby87DGApohAAAAAElFTkSuQmCC")
}
.coupon-img {
padding: 15rpx;
box-sizing: border-box;
}
.coupon-img image{
width: 172rpx;
height: 172rpx;
}
.coupon-info{
padding: 42rpx 39rpx;
box-sizing: border-box;
}
.coupon-name{
color:#333;
}
.coupon-time{
color:#fc921e;
margin-bottom: 18rpx;
font-size: 26rpx;
}
.coupon-desc{
color:#999;
margin-top: 11rpx;
width: 360rpx;
font-size: 24rpx;
}
.coupon-code{
color: #ffffff;
word-wrap: break-word;
font-weight: bold;
margin: 0 10rpx;
padding: 35rpx 20rpx;
box-sizing: content-box;
width: 40rpx;
line-height: 35rpx;
}
.invalid-coupon{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0,0,0,0.5);
z-index:3;
border-radius: 7rpx;
}
.invalid-img{
position: absolute;
width: 147rpx;
height: 147rpx;
right: 81rpx;
top: 31rpx;
z-index: 4;
}
<!--pages/userCenter.axml-->
<view class="page-integral-mall" style="padding-bottom: 40rpx">
<view class="empty-wrap" a:if="{{!integralCouponList.length}}">
<view class="empty-info">
<image class="empty-img" src="/assets/imgs/empty-coupon.png"></image>
<view class="empty-text">没有任何卡劵</view>
</view>
</view>
<view class="integral-vip-rules" a:if="{{integralCouponList.length}}" onTap="handleGoMemberRulesRules">会员规则</view>
<view class="coupon-wrap" a:if="{{integralCouponList.length}}">
<view class="coupon-list" a:for="{{integralCouponList}}" a:for-item="item" a:for-index="k" a:key="{{k}}" data-id="{{item.id}}" onTap="goCouponDetail">
<view class="coupon-item">
<view class="coupon-img">
<image a:if="{{item.thumbnail}}" src="{{item.thumbnail}}"></image>
<image a:else src="/assets/imgs/qr-code.png"></image>
</view>
<view class="coupon-info">
<view class="coupon-time fs-24">{{item.point}}积分</view>
<view class="coupon-name fs-28">{{item.title}}</view>
<view class="coupon-desc fs-24">查看详情 >>></view>
</view>
<view class="coupon-code fs-24" data-id="{{item.id}}" data-point="{{item.point}}" catchTap="exchange">立即兑换</view>
</view>
</view>
</view>
<exchange-coupon-modal exchangeId="{{exchangeId}}" exchangePoint="{{exchangePoint}}" isExchange="{{isExchange}}" />
<!--<no-more wx:if="{{noMore}}"/>-->
</view>
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// pages/userCenter.js
const app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
wxService.page({
/**
* 页面的初始数据
*/
data: {
pageNo: 1,
pageSize: 10,
query: '',
totalPages: 0,
integralCouponList: [],
// 积分兑换优惠券列表
noMore: false,
isExchange: false,
exchangeId: '',
exchangePoint: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.initIntegralCouponList();
},
// 积分兑换优惠券列表
initIntegralCouponList() {
wx2my.showLoading({
title: '加载中'
}); // wxService.get(`/coupon/pointsRedemptionCouponSetting/findPage?pageNo=${pageNo}&pageSize=${pageSize}&query=${this.data.query}`).then(res => {
// const {result,data} = res.data
// if(result == 0){
// wx.hideLoading()
// this.setData({
// integralCouponList: this.data.pageNo == 1? [...data.content]: [...this.data.integralCouponList,...data.content],
// totalPages: data.totalPages
// })
// }
// }).finally(() => {
// wx.hideLoading();
// })
// 查询所有生效中的活动
wxService.get(`/coupon/pointsRedemptionCouponSetting/getAllValid`).then(res => {
if (res) {
const {
result,
data
} = res.data;
if (result == 0) {
wx2my.hideLoading();
this.setData({
integralCouponList: data.reverse()
});
}
}
}).finally(() => {
wx2my.hideLoading();
});
},
//立即兑换
exchange(e) {
const {
id,
point
} = e.currentTarget.dataset;
this.setData({
isExchange: true,
exchangeId: id,
exchangePoint: point
});
},
// 点击跳转至会员规则页
handleGoMemberRulesRules() {
wxService.router(`/pages/memberRules/memberRules?type=2`);
},
goCouponDetail(e) {
const {
id
} = e.currentTarget.dataset;
wxService.router(`/pages/integralMallDetail/integralMallDetail?id=${id}`);
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {// if (this.data.pageNo < this.data.totalPages) {
// this.setData({
// pageNo: this.data.pageNo + 1,
// pageSize: 10,
// noMore: true
// })
// this.initIntegralCouponList(this.data.pageNo, this.data.pageSize)
// } else {
// this.setData({
// noMore: true
// })
// }
}
});
\ No newline at end of file
{
"usingComponents": {
"no-more": "/component/noMore/noMore",
"exchange-coupon-modal": "/component/exchange-coupon-modal/exchange-coupon-modal"
},
"defaultTitle": "积分商城",
"pullRefresh": true
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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