Commit 67562292 by 谢中龙

提交代码

parent 9c2b654a
......@@ -115,9 +115,9 @@ App({
imageUrl: envInfo.imgCtx, //图片地址
isFullSucreen: false, // 当前设备是否为 FullSucreen
commonFunc: commonFunc,
brandId: 2711,
// brandId: 2711,
// brandId: 2005,
// brandId: 1001,
// brandId: 1002,
brandId: 1002,
}
})
......@@ -33,6 +33,10 @@ Component({
type: Number,
value: 0,
},
valueCardNum: {
type: Number,
value: 0,
},
token:{
type: String,
observer(newVal){
......@@ -94,6 +98,10 @@ Component({
toCouponList() {
wxService.router(`/pages/coupons/coupons`)
},
//我的超值卡
tapToMyValueCardPage() {
wxService.router(`/subPackage/page/pages/myValueCard/myValueCard`);
},
handleTtoActiveMemebr() {
if (wx.getStorageSync('_baseUserInfo')){
wxService.openCard()
......
......@@ -32,9 +32,13 @@
<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' bindtap="toCouponList" wx:if="{{personCenter.coupon == 0}}">
<view class='df-1 point {{valueCardNum > 0 ? "person-right" : "" }}' bindtap="toCouponList" wx: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 class='df-1 point' bindtap="tapToMyValueCardPage" wx:if="{{valueCardNum > 0}}">
<view class='point-number' style="color:{{personCenter.fontColor}};">{{valueCardNum}}</view>
<view class='point-desc' style="color:{{personCenter.fontColor}};">超值卡</view>
</view>
</view>
<authorization-modal isAuthorization='{{isAuthorization}}'/>
const PROJECT_ENV = 'prod' // 生产 prod, 开发1 dev,开发2 dev2, 测试 test, 预生产 pre
const PROJECT_ENV = 'test' // 生产 prod, 开发1 dev,开发2 dev2, 测试 test, 预生产 pre
const needMock = '' //
// appid_dev_wx wxc3b64b09b1d3dfc2
......
......@@ -19,6 +19,7 @@ wxService.page({
renderPageOver: false, // 渲染页面结束
integralNum: 0,
couponNum: 0,
valueCardNum : 0,
// isAllScreen: fullSucreen.isAllScreen
isAllScreen: config.isAllScreen,
token: '',
......@@ -82,6 +83,7 @@ wxService.page({
}, () => {
// 积分数量
this.getMemberPointInfo()
this.getMyValueCardNum();
// 优惠券数量
this.getMemberCouponInfo()
})
......@@ -152,7 +154,7 @@ wxService.page({
})
// 动态页面
wxService.post(`/merchant/modelPage/mainSetting?brandId=${app.globalData.brandId}`).then(res => {
wxService.post(`/merchant/modelPage/mainSetting/mall?brandId=${app.globalData.brandId}`).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
......@@ -198,6 +200,21 @@ wxService.page({
}
})
},
//查询超值卡数量
getMyValueCardNum() {
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (memberId) {
wxService.post(`/merchant/superValueCard/miniProgram/valiCard/getQuantity?memberId=${memberId}`).then(res => {
if (res) {
let data = res.data.data ? res.data.data : 0;
this.data.valueCardNum = data;
this.setData({
valueCardNum: this.data.valueCardNum
});
}
});
}
},
// 查询优惠券数量
getMemberCouponInfo() {
wx.showLoading({
......
......@@ -10,7 +10,7 @@
<!-- 个人中心 {{pItem.customer}}-->
<view class="pd1530" wx:if="{{pItem.type == 2}}">
<person-center base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
<person-center base-user-info="{{baseUserInfo}}" valueCardNum="{{valueCardNum}}" person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view>
<!-- 图片导航 {{pItem.navigation.images}} pd1530-->
......
......@@ -13,7 +13,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.8.2",
"appid": "wx700028bf32a3be66",
"appid": "wxac09792264c49b5c",
"projectname": "7-11",
"debugOptions": {
"hidedInDevtools": []
......@@ -39,7 +39,7 @@
"list": []
},
"miniprogram": {
"current": 26,
"current": -1,
"list": [
{
"id": -1,
......
......@@ -8,13 +8,12 @@ wxService.page({
* 页面的初始数据
*/
data: {
no : '1212345645645782',
myCardsList : [
{ id: 1, isOpen: false, no: '12314545654545' },
{ id: 1, isOpen: false, no: '45456456456456' },
{ id: 1, isOpen: false, no: '85858582544585' },
{ id: 1, isOpen: false, no: '96335525252525' },
]
no: '',
pageNum: 1,
pageSize: 10,
totalPage: 0,
isNoData: false,
myCardsList: []
},
/**
......@@ -22,6 +21,7 @@ wxService.page({
*/
onLoad: function (options) {
wx.hideShareMenu();
this.getMyValueCardList();
},
/**
......@@ -32,12 +32,111 @@ wxService.page({
},
//barcode 失败回调
canvasIdErrorCallback(e){
canvasIdErrorCallback(e) {
},
//跳转到购买记录
onTapToBuyRecords() {
wx.navigateTo({
url: '/subPackage/page/pages/valueCardRecords/valueCardRecords',
});
},
//跳转到详情
onTapToInfoPage(e) {
let item = e.currentTarget.dataset.item;
wx.navigateTo({
url: '/subPackage/page/pages/myValueCardInfo/myValueCardInfo?id=' + item.id,
});
},
//刷新no
onTapRefreshNo(e) {
let supValCardId = e.currentTarget.dataset.id;
let index = e.currentTarget.dataset.index;
let url = `/merchant/superValueCard/miniProgram/getChangeCode?supValCardId=${supValCardId}`;
wxService.post(url).then(res => {
if (res) {
if (res.data.data) {
let no = res.data.data;
this.data.no = no;
let canvasId = 'barcode' + index;
this.setData({
no: this.data.no
}, () => {
this.generatorBarCode(canvasId);
wx.showToast({
title: '刷新成功!',
});
});
}
else {
wx.showToast({
title: '刷新失败,请重试',
icon: ' none'
})
}
}
});
},
//获取我的超值卡列表
getMyValueCardList(refresh) {
const { member } = wx.getStorageSync('_baseUserInfo');
if (!member) {
wx.showToast({
title: '请先去登录',
icon: 'none'
})
return;
}
wx.showLoading({
title: '加载中..',
});
let memeberId = member.id,
pageNum = this.data.pageNum,
pageSize = this.data.pageSize;
let url = `/merchant/superValueCard/miniProgram/getPageList?memberId=${memeberId}&pageNum=${pageNum}&pageSize=${pageSize}`;
wxService.post(url).then(res => {
if (res) {
let data = res.data.data ? res.data.data : [];
if (data.length == 0 && this.data.pageNum > 1) {
this.data.isNoData = true;
}
else {
this.data.isNoData = false;
}
//buyAwayType 1 现金 2 积分
data.forEach(item => {
item.leftTimes = item.totalTimes - item.usedTimes;
item.isOpen = false;
item.no = item.supValCardCode ? item.supValCardCode : item.supValCardId;
item.id = item.supValCardId;
item.startTime = item.startTime.substring(0, 10);
item.endTime = item.endTime.substring(0, 10);
});
this.data.myCardsList = this.data.myCardsList.concat(data);
this.setData({
myCardsList: this.data.myCardsList,
isNoData: this.data.isNoData
})
}
if (refresh) {
wx.showToast({
title: '刷新成功',
});
wx.stopPullDownRefresh();
}
wx.hideLoading();
});
},
//生成条形码
generatorBarCode(canvasId){
if (this.data.no){
generatorBarCode(canvasId) {
if (this.data.no) {
wxbarcode.barcode(canvasId, this.data.no, 500, 100);
setTimeout(() => {
wxbarcode.barcode(canvasId, this.data.no, 500, 100);
......@@ -45,11 +144,11 @@ wxService.page({
}
},
//展开
onTapShowMoreInfo(e){
onTapShowMoreInfo(e) {
let item = e.currentTarget.dataset.item;
let index = e.currentTarget.dataset.index;
if (item.isOpen){
return ;
if (item.isOpen) {
return;
}
this.data.myCardsList.forEach(item => {
......@@ -69,7 +168,7 @@ wxService.page({
},
//关闭
onTapCloseExtro(e){
onTapCloseExtro(e) {
let index = e.currentTarget.dataset.index;
this.data.myCardsList[index].isOpen = false;
this.data.no = '';
......@@ -83,14 +182,21 @@ wxService.page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
wx.stopPullDownRefresh();
this.data.pageNum = 1;
this.data.myCardsList = [];
this.data.isNoData = false;
this.getMyValueCardList(true);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (!this.data.isNoData) {
this.data.pageNum++;
this.getMyValueCardList();
}
},
})
\ No newline at end of file
......@@ -4,13 +4,13 @@
wx:for="{{myCardsList}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="{{idx}}">
wx:key="*this">
<view class='card-top-info' bindtap='onTapShowMoreInfo' data-item="{{item}}" data-index="{{idx}}">
<image class='bg-image {{item.isOpen ? "expand" : "unexpand"}}'
src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/daogou.jpg'
src='{{item.backGroundUrl}}'
mode='widthFix'></image>
<view class='card-top-info-desc'>
<label>剩3次</label>
<label>剩{{item.leftTimes}}次</label>
<image class='qrcode' src='/assets/imgs/711_11.png' mode='aspectFit'></image>
</view>
</view>
......@@ -18,15 +18,21 @@
<view class='card-info-extro' wx:if="{{item.isOpen}}">
<view class='bar-code'>
<canvas canvas-id="{{'barcode' + idx}}" binderror="canvasIdErrorCallback" />
<view class='no'>{{no}}</view>
<view class='no'>
<text>{{no}}</text>
<view class="refresh" data-id="{{item.supValCardId}}" data-index="{{idx}}" bindtap="onTapRefreshNo">
<image src="/assets/imgs/icon_refresh.png"></image>
刷新
</view>
</view>
</view>
<view class='exp-info'>
<label>使用时间:</label>
<text>2020-01-10 至 2020-08-30</text>
<text>{{item.startTime}} 至 {{item.endTime}}</text>
</view>
<view class='exp-info'>
<label style='color:#76A1D5;'>查看详细使用说明</label>
<image src='/assets/imgs/icon_arrow_right.png' class='arrow-image' mode='aspectFit'></image>
<label style='color:#76A1D5;' data-item="{{item}}" bindtap="onTapToInfoPage">查看详细使用说明</label>
<image data-item="{{item}}" bindtap="onTapToInfoPage" src='/assets/imgs/icon_arrow_right.png' class='arrow-image' mode='aspectFit'></image>
<image class='unexpand-icon'
bindtap='onTapCloseExtro'
data-index="{{idx}}"
......@@ -35,5 +41,8 @@
</view>
</view>
</view>
</view>
<view class='no-more' wx:if="{{isNoData}}">-- 我也是有底线滴 --</view>
<!-- 底部购买记录 -->
<view class="buy-records" bindtap="onTapToBuyRecords">查看购买记录</view>
\ No newline at end of file
......@@ -3,6 +3,7 @@ page{
background: #ffffff;
box-sizing: border-box;
-webkit-box-sizing: border-box;
padding-bottom: 76rpx;
}
view{
......@@ -104,6 +105,26 @@ view{
color: #333333;
font-size: 32rpx;
letter-spacing: 2rpx;
display: flex;
align-items: center;
justify-content: center;
}
.my-value-card-list .my-value-card-item .card-info-extro .bar-code .no .refresh{
color: #76A1D5;
display: flex;
align-items: center;
font-size: 24rpx;
margin-left: 15rpx;
}
.my-value-card-list .my-value-card-item .card-info-extro .bar-code .no .refresh:active{
opacity: 0.7;
}
.my-value-card-list .my-value-card-item .card-info-extro .bar-code .no .refresh image{
width: 30rpx;
height: 30rpx;
}
.my-value-card-list .my-value-card-item .card-info-extro .exp-info{
......@@ -129,3 +150,32 @@ view{
width: 34rpx;
height: 34rpx;
}
.no-more{
width: 100%;
height: auto;
padding: 30rpx 0;
color: #999999;
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: center;
}
.buy-records{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 75rpx;
background: #ff3333;
color: #ffffff;
font-size: 24rpx;
display: flex;
justify-content: center;
align-items: center;
}
.buy-records:active{
opacity: 0.7;
}
\ No newline at end of file
......@@ -8,16 +8,18 @@ wxService.page({
* 页面的初始数据
*/
data: {
no: '1212345645645782',
supValCardId : null,
no: '',
valueCardInfo : {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.supValCardId = options.id;
wx.hideShareMenu();
this.generatorBarCode();
this.getMyValueCardInfo();
},
/**
......@@ -26,13 +28,87 @@ wxService.page({
onShow: function () {
},
//获取我的超值卡详情
getMyValueCardInfo(){
let supValCardId = this.data.supValCardId;
let url = `/merchant/superValueCard/miniProgram/getDetail?supValCardId=${supValCardId}`;
wxService.post(url).then(res => {
if(res){
let obj = res.data.data;
obj.leftTimes = obj.totalTimes - obj.usedTimes;
// obj.
//处理图标显示问题
let arr = [];
for (let i = 0; i < obj.totalTimes; i ++){
let tempObj = {
icon: obj.checkFlagUrl,
};
arr.push(tempObj);
}
for (let j = 0; j < obj.leftTimes ; j ++){
arr[j].icon = obj.noCheckFlagUrl;
}
obj.icons = arr;
obj.startTime = obj.startTime.substring(0, 10);
obj.endTime = obj.endTime.substring(0,10);
if (obj.buyAwayType == 1){
obj.buyPriceText = parseFloat(obj.buyPrice/10/10).toFixed(2);
}
obj.activityDesc = obj.activityDesc ? JSON.parse(obj.activityDesc) : [];
let descArr = JSON.parse(JSON.stringify(obj.activityDesc));
descArr = descArr.filter(item => item.type != 1);
let tempArr = descArr.map(item => {
return item.value;
});
obj.descArr = tempArr;
this.data.valueCardInfo = obj;
this.setData({
valueCardInfo: this.data.valueCardInfo,
no: obj.supValCardCode
},() => {
this.generatorBarCode();
});
}
});
},
//刷新
onTapRefreshNo(){
let supValCardId = this.data.supValCardId;
let url = `/merchant/superValueCard/miniProgram/getChangeCode?supValCardId=${supValCardId}`;
wxService.post(url).then(res => {
if (res) {
if (res.data.data) {
let no = res.data.data;
this.data.no = no;
this.setData({
no: this.data.no,
},() => {
this.generatorBarCode();
wx.showToast({
title: '刷新成功!',
});
})
}
else {
wx.showToast({
title: '刷新失败,请重试',
icon: ' none'
})
}
}
});
},
//生成条形码
generatorBarCode() {
if (this.data.no) {
wxbarcode.barcode('barcode', this.data.no, 570, 100);
wxbarcode.barcode('barcode', this.data.no, 570, 140);
setTimeout(() => {
wxbarcode.barcode('barcode', this.data.no, 570, 100);
wxbarcode.barcode('barcode', this.data.no, 570, 140);
}, 200);
}
},
......
<!--subPackage/page/pages/myValueCardInfo/myValueCardInfo.wxml-->
<view class='my-card-info'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/daogou.jpg' mode='widthFix'></image>
<label>剩3次</label>
<image src='{{valueCardInfo.backGroundUrl}}' mode='widthFix'></image>
<label>剩{{valueCardInfo.leftTimes}}次</label>
</view>
<view class='left-num-container'>
<view class='left-icons'>
<view class='icons'>
<image src='/assets/imgs/point/color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/no_color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/no_color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/no_color.png' mode='aspectFit'></image>
</view>
<view class='icons'>
<image src='/assets/imgs/point/no_color.png' mode='aspectFit'></image>
<!-- 小于5时居中显示 -->
<view class='left-icons limit-5' wx:if="{{valueCardInfo.totalTimes <= 5}}">
<view class='icons'
wx:for="{{valueCardInfo.icons}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="*this">
<image src='{{item.icon}}' mode='aspectFit'></image>
</view>
</view>
<!-- 大于5时左对齐 -->
<view class='left-icons' wx:else>
<view class='icons'
wx:for="{{valueCardInfo.icons}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="*this">
<image src='{{item.icon}}' mode='aspectFit'></image>
</view>
</view>
<view class='bar-code-container'>
<canvas canvas-id="barcode" binderror="canvasIdErrorCallback" />
<view class='no'>{{no}}</view>
<view class='no'>
<text>{{no}}</text>
<view class="refresh" data-id="{{item.supValCardId}}" data-index="{{idx}}" bindtap="onTapRefreshNo">
<image src="/assets/imgs/icon_refresh.png"></image>
刷新
</view>
</view>
</view>
</view>
......@@ -47,23 +42,24 @@
<view class='card-info-body'>
<view class='card-desc-item'>
<view class='lf'>活动时间</view>
<view class='rg'>2020-01-02 至 2020-05-31</view>
<view class='rg'>{{valueCardInfo.startTime}} 至 {{valueCardInfo.endTime}}</view>
</view>
<view class='card-desc-item' wx:if="{{buyType == 1}}">
<view class='card-desc-item' wx:if="{{valueCardInfo.buyAwayType == 1}}">
<view class='lf'>现金支付</view>
<view class='rg'>¥25.00</view>
<view class='rg'>¥{{valueCardInfo.buyPriceText}}</view>
</view>
<view class='card-desc-item' wx:if="{{buyType == 2}}">
<view class='card-desc-item' wx:if="{{valueCardInfo.buyAwayType == 2}}">
<view class='lf'>积分兑换</view>
<view class='rg'>200积分</view>
<view class='rg'>{{valueCardInfo.buyIntegration}}积分</view>
</view>
<view class='card-desc-item'>
<view class='lf'>使用说明</view>
<view class='rg'>
<view class='list-item'> 1) 这个是说明1这个是说明1这个是说明1</view>
<view class='list-item'> 2) 这个是说明2这个是说明2这个是说明2</view>
<view class='list-item'> 3) 这个是说明2这个是说明2这个是说明2</view>
<view class='list-item'> 4) 这个是说明2这个是说明2这个是说明2</view>
<view class='list-item'
wx:for="{{valueCardInfo.descArr}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="*this"> {{idx + 1}}、{{item}}</view>
</view>
</view>
</view>
......@@ -53,6 +53,10 @@ view{
flex-wrap: wrap;
}
.limit-5{
justify-content: center;
}
.left-num-container .left-icons .icons{
flex: 0;
min-width: 20%;
......@@ -80,7 +84,7 @@ view{
}
.left-num-container .bar-code-container canvas{
height: 100rpx;
height: 140rpx;
width: 100%;
}
......@@ -89,6 +93,26 @@ view{
color: #333333;
font-size: 32rpx;
letter-spacing: 2rpx;
display: flex;
align-items: center;
justify-content: center;
}
.left-num-container .bar-code-container .no .refresh{
color: #76A1D5;
display: flex;
align-items: center;
font-size: 24rpx;
margin-left: 15rpx;
}
.left-num-container .bar-code-container .no .refresh:active{
opacity: 0.7;
}
.left-num-container .bar-code-container .no .refresh image{
width: 30rpx;
height: 30rpx;
}
.card-info-body{
......
......@@ -18,6 +18,7 @@ wxService.page({
renderPageOver: false, // 渲染页面结束
integralNum: 0,
couponNum: 0,
valueCardNum: 0,
// isAllScreen: fullSucreen.isAllScreen
isAllScreen: config.isAllScreen,
token:'',
......@@ -75,10 +76,26 @@ wxService.page({
if (wx.getStorageSync('_baseUserInfo')){
// 积分数量
this.getMemberPointInfo()
this.getMyValueCardNum();
// 优惠券数量
this.getMemberCouponInfo()
}
},
//查询超值卡数量
getMyValueCardNum() {
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (memberId) {
wxService.post(`/merchant/superValueCard/miniProgram/valiCard/getQuantity?memberId=${memberId}`).then(res => {
if (res) {
let data = res.data.data ? res.data.data : 0;
this.data.valueCardNum = data;
this.setData({
valueCardNum: this.data.valueCardNum
});
}
});
}
},
// 查询积分信息
getMemberPointInfo(){
wx.showLoading({
......
......@@ -11,7 +11,7 @@
<!-- 个人中心 {{pItem.customer}}-->
<view class="pd1530" wx:if="{{pItem.type == 2}}">
<person-center person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
<person-center person-data="{{pItem.customer}}" valueCardNum="{{valueCardNum}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view>
<!-- 图片导航 {{pItem.navigation.images}} pd1530-->
......
......@@ -7,7 +7,7 @@ wxService.page({
* 页面的初始数据
*/
data: {
cardList: [{ id: 1 }, { id: 2 }, { id: 2 }]
cardList: []
},
/**
......@@ -15,6 +15,7 @@ wxService.page({
*/
onLoad: function (options) {
wx.hideShareMenu();
this.getValueCardList();
},
/**
......@@ -30,20 +31,40 @@ wxService.page({
url: '/subPackage/page/pages/valueCardInfo/valueCardInfo?id=' + item.id,
});
},
//获取有效活动列表
getValueCardList(refresh){
wx.showLoading({
title: '加载中..',
});
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
wx.showNavigationBarLoading();
wxService.post(`/merchant/superValueCardActivity/miniProgram/getPageList`).then(res => {
if(res){
let list = res.data.data ? res.data.data : [];
this.data.cardList = list;
this.setData({
cardList: this.data.cardList
});
}
wx.hideLoading();
if (refresh) {
setTimeout(() => {
wx.showToast({
title: '刷新成功',
});
wx.hideNavigationBarLoading();
wx.stopPullDownRefresh();
},1000);
}, 300);
}
});
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
wx.showNavigationBarLoading();
this.getValueCardList(true);
},
/**
......
......@@ -4,10 +4,10 @@
wx:for="{{cardList}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="{{idx}}"
wx:key="*this"
data-item="{{item}}"
bindtap='onTapToCardInfo'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/daogou.jpg' mode='widthFix'></image>
<image src='{{item.listUrl}}' mode='widthFix'></image>
<view class='card-buy-btn'>立即抢购</view>
</view>
</view>
......
......@@ -7,16 +7,21 @@ wxService.page({
* 页面的初始数据
*/
data: {
checked : false,
showModal : false,
buyType : '2',//现金支付 2 积分兑换
id: null,
checked: false,
showModal: false,
valueCardInfo: {},
buyType: '2',//现金支付 2 积分兑换
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.id = options.id;
wx.hideShareMenu();
this.getValueCardActivityInfo();
},
/**
......@@ -25,39 +30,157 @@ wxService.page({
onShow: function () {
},
//获取活动详情
getValueCardActivityInfo() {
wx.showLoading({
title: '加载中..',
});
wxService.post(`/merchant/superValueCardActivity/miniProgram/getDetail?id=${this.data.id}`).then(res => {
if (res) {
let obj = res.data.data ? res.data.data : null;
if (obj) {
obj.activityDesc = obj.activityDesc ? JSON.parse(obj.activityDesc) : [];
this.data.buyType = obj.payWayType;
obj.acPayMoney = parseFloat(obj.moneyAmount / 10 / 10).toFixed(2);
obj.startTime = obj.startTime.substring(0, 10);
obj.endTime = obj.endTime.substring(0, 10);
//处理说明文本
let descArr = JSON.parse(JSON.stringify(obj.activityDesc));
descArr = descArr.filter(item => item.type != 1);
let tempArr = descArr.map(item => {
return item.value;
});
obj.descArr = tempArr;
this.data.valueCardInfo = obj;
this.setData({
buyType: this.data.buyType,
valueCardInfo: this.data.valueCardInfo
});
}
}
wx.hideLoading();
});
},
//修改选中状态
onTapSwitchChecked(){
onTapSwitchChecked() {
this.data.checked = !this.data.checked;
this.setData({
checked: this.data.checked
});
},
//关闭modal
onTapCloseModal(){
onTapCloseModal() {
this.setData({
showModal : false,
showModal: false,
});
},
//查看rule
onTapViewRule(){
onTapViewRule() {
this.setData({
showModal : true
showModal: true
})
},
//同意并阅读
onTapModalAgree(){
onTapModalAgree() {
this.setData({
showModal: false,
checked : true,
checked: true,
});
},
//立即购买
onTapBuy(){
if(!this.data.checked){
return ;
onTapBuy() {
if (!this.data.checked) {
return;
}
const { member } = wx.getStorageSync('_baseUserInfo');
if (!member) {
wx.showToast({
title: '请先去登录',
icon: 'none'
})
return;
}
let memeberId = member.id,
// storeId = member.storeId;
storeId = '';
let activityId = this.data.id;
let url = '';
if (this.data.buyType == 1) {
url = `/merchant/superValueCard/miniProgram/buy?activityId=${activityId}&memberId=${memeberId}&payType=1&storeId=${storeId}`;
}
else {
url = `/merchant/superValueCard/miniProgram/buy?activityId=${activityId}&memberId=${memeberId}&storeId=${storeId}`;
}
wx.showLoading({
title: '支付中..',
});
wxService.post(url).then(res => {
wx.hideLoading();
if (res.data.result == 0) {
//现金支付
if (this.data.buyType == 1) {
let data = res.data.data ? res.data.data : null;
if (data) {
let wxParams = data.wxParams;
wx.requestPayment({
timeStamp: wxParams.timeStamp,
nonceStr: wxParams.nonceStr,
package: wxParams.package,
signType: wxParams.signType,
paySign: wxParams.paySign,
success: res => {
wx.showToast({
title: '支付成功!',
});
wx.showLoading({
title: '跳转中...',
});
setTimeout(() => {
wx.hideLoading();
wx.navigateTo({
url: '/subPackage/page/pages/myValueCard/myValueCard',
});
}, 500);
},
fail: error => {
wx.showToast({
title: '已取消支付',
icon: 'none'
});
}
})
}
}
else {
wx.showToast({
title: '支付成功!',
});
wx.showLoading({
title: '跳转中...',
});
setTimeout(() => {
wx.hideLoading();
wx.navigateTo({
url: '/subPackage/page/pages/myValueCard/myValueCard',
});
}, 500);
}
}
else {
wx.showToast({
title: '购买失败,请稍后再试!',
icon: 'none'
});
}
});
},
/**
* 页面相关事件处理函数--监听用户下拉动作
......
<!--subPackage/page/pages/valueCardInfo/valueCardInfo.wxml-->
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/daogou.jpg' class='card-info' mode='widthFix'></image>
<image src='{{valueCardInfo.listUrl}}' class='card-info' mode='widthFix'></image>
<view class='card-info-body'>
<view class='card-title'>这是充值卡活动名城这是充值卡活动名城这是充值卡活动名城</view>
<view class='card-title'>{{valueCardInfo.activityName}}</view>
<view class='card-desc-item'>
<view class='lf'>活动时间</view>
<view class='rg'>2020-01-02 至 2020-05-31</view>
<view class='rg'>{{valueCardInfo.startTime}} 至 {{valueCardInfo.endTime}}</view>
</view>
<view class='card-desc-item' wx:if="{{buyType == 1}}">
<view class='lf'>现金支付</view>
<view class='rg'>¥25.00</view>
<view class='rg'>¥{{valueCardInfo.acPayMoney}}</view>
</view>
<view class='card-desc-item' wx:if="{{buyType == 2}}">
<view class='lf'>积分兑换</view>
<view class='rg'>200积分</view>
<view class='rg'>{{valueCardInfo.integrationAmount}}积分</view>
</view>
<view class='card-desc-item'>
<view class='lf'>使用说明</view>
<view class='rg'>
<view class='list-item'> 1) 这个是说明1这个是说明1这个是说明1</view>
<view class='list-item'> 2) 这个是说明2这个是说明2这个是说明2</view>
<view class='list-item'> 3) 这个是说明2这个是说明2这个是说明2</view>
<view class='list-item'> 4) 这个是说明2这个是说明2这个是说明2</view>
<view class='list-item'
wx:for="{{valueCardInfo.descArr}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="*this"
> {{idx+1}}、{{item}}</view>
</view>
</view>
</view>
<!-- 底部 -->
<view class='bottom-buy'>
<view class='lf-info'>
......@@ -35,7 +36,7 @@
</view>
<view class='explain'>
<label> 阅读并同意 </label>
<text bindtap='onTapViewRule'>《广东7-eleven超值卡规则》</text>
<text bindtap='onTapViewRule'>《广东-7Eleven超值卡规则》</text>
</view>
</view>
<view class='rg-button {{checked ? "" : "disabled"}}' bindtap='onTapBuy'>{{buyType == 1 ? "立即购买" : "立即兑换"}}</view>
......@@ -50,35 +51,7 @@
</view>
<view class='modal-body-con'>
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规则超值卡规则超值卡规则
超值卡规则超值卡规则超值卡规
<image src="{{valueCardInfo.ruleUrl}}" mode="widthFix"></image>
</view>
<view class='modal-body-bottom'>
......
......@@ -198,6 +198,10 @@ view{
color: #666666;
}
.rule-modal .modal-body .modal-body-con image{
width: 100%;
}
.rule-modal .modal-body .modal-body-bottom{
flex: 0;
min-height: 120rpx;
......
......@@ -7,7 +7,10 @@ wxService.page({
* 页面的初始数据
*/
data: {
records : [],
pageNum : 1,
pageSize : 10,
isNoMore : false
},
/**
......@@ -15,6 +18,7 @@ wxService.page({
*/
onLoad: function (options) {
wx.hideShareMenu();
this.getBuyRecordsList();
},
/**
......@@ -24,18 +28,72 @@ wxService.page({
},
//获取购买记录
getBuyRecordsList(refresh){
const { memberId } = wx.getStorageSync('_baseUserInfo');
if (!memberId){
return ;
}
let pageNum = this.data.pageNum,
pageSize = this.data.pageSize;
let url = `/merchant/superValueCard/miniProgram/buyRecord/getPageList?memberId=${memberId}&pageNum=${pageNum}&pageSize=${pageSize}`;
wxService.post(url).then(res => {
if(res){
let list = res.data.data ? res.data.data : [];
if (list.length == 0 && this.data.pageNum > 1){
this.data.isNoMore = true;
}
else {
this.data.isNoMore = false;
}
list.forEach(item => {
item.startTime = item.startTime.substring(0, 10);
item.endTime = item.endTime.substring(0,10);
if (item.buyAwayType == 1){
item.buyPriceText = parseFloat(item.buyPrice/10/10).toFixed(2);
}
});
this.data.records = this.data.records.concat(list);
this.setData({
isNoMore: this.data.isNoMore,
records: this.data.records
});
}
if(refresh){
wx.stopPullDownRefresh();
wx.showToast({
title: '刷新成功',
});
}
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
wx.stopPullDownRefresh();
this.data.pageNum = 1;
this.data.records = [];
this.data.isNoMore = false;
this.getBuyRecordsList(true);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (!this.data.isNoMore){
this.data.pageNum ++ ;
this.getBuyRecordsList();
}
},
})
\ No newline at end of file
<!--subPackage/page/pages/valueCardRecords/valueCardRecords.wxml-->
<view class='records-list'>
<view class='records-item'>
<view class='records-list' wx:if="{{records.length != 0}}">
<view class='records-item'
wx:for="{{records}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="*this">
<view class='records-item-lf'>
<view class='records-title'>买10送10券</view>
<view>2019-12-02 16:23:46</view>
<view class='records-title'>{{item.activityName}}</view>
<view class="records-desc">超值卡号:{{item.supValCardId}}</view>
<view class="records-desc">购买时间:{{item.payOrderTime}}</view>
<view class="records-desc">有效时间:{{item.startTime}} 至 {{item.endTime}}</view>
</view>
<view class='records-item-rg'>¥200</view>
<view class='records-item-rg'>
<text wx:if="{{item.buyAwayType == 1}}">¥{{item.buyPriceText}}</text>
<text wx:if="{{item.buyAwayType == 2}}">{{item.buyIntegration}}积分</text>
</view>
<view class='records-item'>
<view class='records-item-lf'>
<view class='records-title'>买10送10券</view>
<view>2019-12-02 16:23:46</view>
</view>
<view class='records-item-rg'>¥200</view>
</view>
<view class='records-item'>
<view class='records-item-lf'>
<view class='records-title'>买10送10券</view>
<view>2019-12-02 16:23:46</view>
</view>
<view class='records-item-rg'>¥200</view>
</view>
<view class='records-item'>
<view class='records-item-lf'>
<view class='records-title'>买10送10券</view>
<view>2019-12-02 16:23:46</view>
</view>
<view class='records-item-rg'>¥200</view>
</view>
</view>
<!-- <view class='no-more'>-- 我也是有底线滴 --</view> -->
<view class="no-data" wx:if="{{records.length == 0}}">暂无购买记录~</view>
<view class='no-more' wx:if="{{isNoMore}}">-- 我也是有底线滴 --</view>
......@@ -3,7 +3,6 @@ page{
background: #ffffff;
box-sizing: border-box;
-webkit-box-sizing: border-box;
padding-bottom: 100rpx;
}
view{
......@@ -23,7 +22,7 @@ view{
padding: 20rpx;
border-bottom: solid 2rpx #eeeeee;
display: flex;
align-items: center;
align-items: flex-start;
font-size: 24rpx;
color: #999999;
}
......@@ -37,6 +36,7 @@ view{
align-items: center;
color: #333333;
font-size: 28rpx;
font-weight: 550;
}
.records-list .records-item .records-item-lf{
......@@ -46,6 +46,13 @@ view{
.records-list .records-item .records-item-lf .records-title{
font-size: 28rpx;
color: #333333;
margin-bottom: 10rpx;
}
.records-desc{
font-size: 24rpx;
color: #999999;
margin-bottom: 4rpx;
}
......@@ -59,3 +66,11 @@ view{
align-items: center;
justify-content: center;
}
.no-data{
padding: 80rpx 0;
display: flex;
justify-content: center;
color: #999999;
font-size: 28rpx;
}
\ No newline at end of file
......@@ -121,9 +121,9 @@ class Http {
url,
method: 'GET',
header: {
// 'tunnel-token': 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD', // 测试
'tunnel-token': 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD', // 测试
// 'tunnel-token' : 'd6db651f8b9c7db4176465accfc1c913843fd9ad328cd5f4fe201d918072c9e8', // 生产 3001
'tunnel-token' : '4c8d641cb2b8a576317ee5f6ead1f36474463041d61fb5d4289364565b0c6c63', // 生产 2711
// 'tunnel-token' : '4c8d641cb2b8a576317ee5f6ead1f36474463041d61fb5d4289364565b0c6c63', // 生产 2711
},
data: parmas
})
......@@ -147,9 +147,9 @@ class Http {
url,
method: 'POST',
header: {
// 'tunnel-token': 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD', // 测试
'tunnel-token': 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD', // 测试
// 'tunnel-token' : 'd6db651f8b9c7db4176465accfc1c913843fd9ad328cd5f4fe201d918072c9e8', // 生产 3001
'tunnel-token' : '4c8d641cb2b8a576317ee5f6ead1f36474463041d61fb5d4289364565b0c6c63', // 生产 2711
// 'tunnel-token' : '4c8d641cb2b8a576317ee5f6ead1f36474463041d61fb5d4289364565b0c6c63', // 生产 2711
},
data: parmas,
channel: channel
......
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