Bläddra i källkod

[积分兑换][接口调试]

tags/湖南版5.1.4
刘晖 6 år sedan
förälder
incheckning
280123a710
12 ändrade filer med 420 tillägg och 28 borttagningar
  1. +1
    -0
      app.json
  2. +1
    -1
      pages/integralmall/integcoupondetail/index.js
  3. +98
    -0
      pages/integralmall/integraHistory/index.js
  4. +5
    -0
      pages/integralmall/integraHistory/index.json
  5. +28
    -0
      pages/integralmall/integraHistory/index.wxml
  6. +119
    -0
      pages/integralmall/integraHistory/index.wxss
  7. +3
    -1
      pages/integralmall/payIntegcouponStatus/index.js
  8. +3
    -3
      pages/integralmall/payIntegcouponStatus/index.wxml
  9. +3
    -0
      pages/integralmall/payIntegcouponStatus/index.wxss
  10. +153
    -20
      pages/integralmall/payIntegcoupondetail/index.js
  11. +5
    -2
      pages/main/index.js
  12. +1
    -1
      pages/main/index.wxml

+ 1
- 0
app.json Visa fil

@@ -1,6 +1,7 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/integralmall/integraHistory/index",
"pages/integralmall/payIntegcouponStatus/index", "pages/integralmall/payIntegcouponStatus/index",
"pages/integralmall/payIntegcoupondetail/index", "pages/integralmall/payIntegcoupondetail/index",
"pages/joinFrDpell/index", "pages/joinFrDpell/index",


+ 1
- 1
pages/integralmall/integcoupondetail/index.js Visa fil

@@ -61,7 +61,7 @@ Page({
formId: e.detail.formId formId: e.detail.formId
}) })
wx.navigateTo({ wx.navigateTo({
url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + this.data.couponChannelId,
url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + this.data.couponChannelId + '&couponId=' + this.data.couponId,
}) })
}, },
// 时间格式化输出,如11:03 25:19 每1s都会调用一次 // 时间格式化输出,如11:03 25:19 每1s都会调用一次


+ 98
- 0
pages/integralmall/integraHistory/index.js Visa fil

@@ -0,0 +1,98 @@
var config = require("../../../config/config.js");
var app = getApp();
const Http = require("../../../utils/HttpBasics");
let util = require("../../../utils/util");
const imgurl = require("../../../utils/imgurl");
Page({

/**
* 页面的初始数据
*/
data: {
score: 10,
pageNum: 1,
list: [],
showcontent: false,
loadingUrl: imgurl.loading.url,
bgg: imgurl.bgg.url,
allow_load: true
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {

},
gotorule: function () {
wx.navigateTo({
url: '/pages/grade/grade',
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
let that = this;
that.getScore();
that.record(1, 15);
},
record(pageNum) {
var that = this;
if (that.data.allow_load) {
Http.get({
url: config.api.scoreHistory,
data: {
pageNum: pageNum,
pageSize: 20,
}
}).then(res => {
res.data.list.map(file => {
file.createDate = util.formatTime(
file.createDate,
"yyyy-MM-dd hh:mm:ss"
);
});
if (pageNum >= res.data.pages) {
that.setData({
allow_load: false,
});
}
that.data.list = that.data.list.concat(res.data.list);
that.setData({
list: that.data.list
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
}
},
getScore: function () {
let that = this;
Http.get({
url: config.api.getScore,
data: {}
})
.then(res => {
console.log(res)
that.setData({
score: res.data.score,
levelName: res.data.levelName,
})
})
},
onReachBottom: function () {
var that = this;
that.data.pageNum++;
that.setData({
pageNum: that.data.pageNum
});
that.record(that.data.pageNum);
}
})

+ 5
- 0
pages/integralmall/integraHistory/index.json Visa fil

@@ -0,0 +1,5 @@
{
"navigationBarTitleText": "积分记录",
"enablePullDownRefresh": true,
"usingComponents": {}
}

+ 28
- 0
pages/integralmall/integraHistory/index.wxml Visa fil

@@ -0,0 +1,28 @@
<view class='head'>
<text>当前</text>
<text>{{score}}</text>
<!-- <view class='rule' bindtap='gotorule'>规则</view> -->
<image class='bg' src='{{bgg}}' mode='widthFix'></image>
</view>
<view class=''>
<text class='title'>积分明细</text>
<view class='content clearfix' wx:for="{{list}}" wx:key="{{index}}">
<view class='le'>
<text wx:if="{{item.scoreType==1}}">每日登录</text>
<text wx:if="{{item.scoreType==2}}">消费</text>
<text wx:if="{{item.scoreType==3}}">绑车牌</text>
<text wx:if="{{item.scoreType==4}}">连接WIFI</text>
<text wx:if="{{item.scoreType==5}}">微信用户昵称授权</text>
<text wx:if="{{item.scoreType==6}}">微信用户手机授权</text>
<text wx:if="{{item.scoreType==7}}">完善个人信息</text>
<text wx:if="{{item.scoreType==8}}">会员导入</text>
<text wx:if="{{item.scoreType==9}}">{{item.reason}}</text>
<text>{{item.createDate}}</text>
</view>
<view class='fr'>
<text wx:if="{{item.scoreAmount>0&&item.scoreType==8}}">重置为{{item.scoreAmount}}分</text>
<text wx:if="{{item.scoreAmount>0&&item.scoreType!=8}}">+{{item.scoreAmount}}分</text>
<text wx:if="{{0>=item.scoreAmount}}">{{item.scoreAmount}}分</text>
</view>
</view>
</view>

+ 119
- 0
pages/integralmall/integraHistory/index.wxss Visa fil

@@ -0,0 +1,119 @@
/* pages/czdetail/czdetail.wxss */

.head {
height: 252rpx;
background: #02c0ff;
position: relative;
}

.rule {
position: absolute;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: 124rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
background: #fff;
font-size: 28rpx;
font-weight: 400;
color: rgba(2, 192, 255, 1);
border-bottom-left-radius: 50rpx;
border-top-left-radius: 50rpx;
}

.head text {
display: block;
text-align: center;
color: #fff;
}

.head text:nth-of-type(1) {
font-size: 28rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(255, 255, 255, 1);
}

.head text:nth-of-type(2) {
font-size: 70rpx;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(255, 255, 255, 1);
}

.bg {
position: absolute;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 55rpx;
z-index: 100;
}

.content {
position: relative;
padding: 0 35rpx;
height: 145rpx;
border-bottom: 1px solid #eaeaea;
}

.content>view:nth-of-type(2n+1) text {
display: block;
}

.content>view:nth-of-type(2n+1) text:nth-of-type(1) {
margin-top: 24rpx;
}

.content>view:nth-of-type(2n+1) text:nth-of-type(2) {
margin-top: 10rpx;
font-size: 26rpx;
font-family: PingFang-SC-Bold;
color: rgba(153, 153, 153, 1);
}

.content>view:nth-of-type(2n+1) {
float: left;
width: 60%;
height: 145rpx;
overflow: hidden;
}

.content>view:nth-of-type(2n) {
width: 38%;
float: right;
text-align: right;
height: 145rpx;
line-height: 145rpx;
overflow: hidden;
}

.title {
display: block;
text-align: center;
font-size: 30rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
.fr text{
color: #FF3535;
}
.loading {
text-align: center;
height: 80rpx;
line-height: 80rpx;
font-size: 26rpx;
color: #999;
}

.loading image {
width: 60rpx;
height: 60rpx;
vertical-align: middle;
margin-right: 10rpx;
}

+ 3
- 1
pages/integralmall/payIntegcouponStatus/index.js Visa fil

@@ -17,7 +17,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {

this.setData({
formData:options
})
}, },


/** /**


+ 3
- 3
pages/integralmall/payIntegcouponStatus/index.wxml Visa fil

@@ -2,12 +2,12 @@
<view class='tilte'>兑换成功</view> <view class='tilte'>兑换成功</view>
<view class='coupon'> <view class='coupon'>
<view class='c-left'> <view class='c-left'>
<image src='{{teljpgUrl}}' mode="widthFix"></image>
<image src='{{formData.coverImg}}' mode="widthFix"></image>
</view> </view>
<view class='c-right'>会员积分兑换2小时停车券</view>
<view class='c-right'>{{'会员积分兑换'+formData.title}}</view>
</view> </view>
<view class='detail-text'>已存入"我的券包"请您查看使用</view> <view class='detail-text'>已存入"我的券包"请您查看使用</view>
<view class='detail-num'>剩余积分:23234</view>
<view class='detail-num'>{{'剩余积分:'+formData.remainingPoints}}</view>
<button class='button01' bindtap='gotoUse'>立即使用</button> <button class='button01' bindtap='gotoUse'>立即使用</button>
<button class='button02' bindtap='gotoIndex'>返回首页</button> <button class='button02' bindtap='gotoIndex'>返回首页</button>
</view> </view>

+ 3
- 0
pages/integralmall/payIntegcouponStatus/index.wxss Visa fil

@@ -23,6 +23,7 @@
height: auto; height: auto;
float: left; float: left;
box-sizing: border-box; box-sizing: border-box;
padding-top: 18rpx;
} }
.c-left image{ .c-left image{
width: 120rpx; width: 120rpx;
@@ -37,12 +38,14 @@
padding-left: 30rpx; padding-left: 30rpx;
line-height: 40rpx; line-height: 40rpx;
margin-top: 30rpx; margin-top: 30rpx;
color:rgba(85,85,85,1);
} }
.detail-num{ .detail-num{
font-size:30rpx; font-size:30rpx;
padding-left: 30rpx; padding-left: 30rpx;
line-height: 40rpx; line-height: 40rpx;
margin-top: 10rpx; margin-top: 10rpx;
color:rgba(85,85,85,1);
} }
.button01{ .button01{
width:710rpx; width:710rpx;


+ 153
- 20
pages/integralmall/payIntegcoupondetail/index.js Visa fil

@@ -59,34 +59,167 @@ Page({
// 关闭来自于左上角的分享 // 关闭来自于左上角的分享
wx.hideShareMenu() wx.hideShareMenu()
}, },
/**
* 发起支付
*/
gotoPay() { gotoPay() {
let that = this;
wx.showLoading({
title: '订单提交中...',
var that = this;
Http.get({
url: config.api.checkPhoneStatus,
data: {}
}) })
//操作人类型 1:C端用户,2:A端会员,3:B端用户,4:A端用户
let param={
cuserId:that.data.userInfo.id,//用户id
operatorType:1,//操作人类型
creditType: 11,//积分类型-积分兑换
spend:this.data.data.credit,//积分数值
couponId: this.data.data.couponId
}
.then(res => {
var data = {
couponChannelId: "" + that.data.paramData.couponChannelId,
couponId: "" + that.data.paramData.couponId
}
/**
* orderSave 下单
*/
return Http.post({
url: config.api.orderSave,
data: data
});
})
.catch(err => {
console.log(err);
that.setData({
showbutton: false,
showbutton1: false
})
if (err.code == 2011) {
wx.showToast({
title: "商户信息没找到",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 2013) {
wx.showToast({
title: "商户信息禁用",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3000) {
wx.showToast({
title: "库存不足",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3001) {
wx.showToast({
title: "超过限购条件",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3002) {
wx.showToast({
title: "订单失败",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3003) {
wx.showToast({
title: "订单不存在",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3004) {
wx.showToast({
title: "订单不存在",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 4003) {
wx.showToast({
title: "卡券已作废",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 11005) {
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index?couponChannelId=" +
that.data.paramData.couponChannelId
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput?couponChannelId=" +
that.data.paramData.couponChannelId
});
} else {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
}
})
.then(res => {
console.log(res)
if (typeof (res) != "undefined") {
let orderId = "" + res.data.id;
that.setData({
orderId: orderId
});
console.log(that.data.type)
// 免费券
that.payOrderUpdate(orderId, "0", 1, '',that);
// that.payOrderUpdate(that.data.orderId, '', 1, '', that);
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
})
} else if (that.data.data.type != "5") {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
})
}
}
})
},
/**
* 支付订单更新
*/
payOrderUpdate: (orderId, payOrderId, status, reason, _this) => {
let that = this;
// 支付成功
Http.post({ Http.post({
url: config.api.addIntegral,
data: param
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
}) })
.then(res => { .then(res => {
wx.hideLoading() wx.hideLoading()
/// End payment --------
wx.navigateTo({
url: '/pages/integralmall/payIntegcouponStatus/index?title=' + _this.data.data.title + '&coverImg=' + _this.data.data.coverImg + '&remainingPoints=' + _this.data.remainingPoints,
})
}) })
.catch(err => { .catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
console.log(err);
if (err.code != 12002) {
setTimeout(function () {
_this.payOrderUpdate(orderId, payOrderId, status, reason, _this);
}, 2000)
}
}) })
}, },
/** /**


+ 5
- 2
pages/main/index.js Visa fil

@@ -124,9 +124,12 @@ Page({
}, },
//跳往个人中心 //跳往个人中心
gotouser:function(){ gotouser:function(){
wx.switchTab({
url: '/pages/user/index',
wx.navigateTo({
url: '/pages/integralmall/integraHistory/index',
}) })
// wx.switchTab({
// url: '/pages/user/index',
// })
}, },
//跳往砍价专场 //跳往砍价专场
gobargain: function () { gobargain: function () {


+ 1
- 1
pages/main/index.wxml Visa fil

@@ -22,7 +22,7 @@
</view> </view>
</view> </view>
<!-- 会员信息 --> <!-- 会员信息 -->
<view class='userinfo'bindtap='gotouser'>
<view class='userinfo' bindtap='gotouser'>
<view class="user-avatar" bindtap='gotograde'> <view class="user-avatar" bindtap='gotograde'>
<open-data class="open" type="userAvatarUrl"></open-data> <open-data class="open" type="userAvatarUrl"></open-data>
</view> </view>


Laddar…
Avbryt
Spara