first commit
This commit is contained in:
1
衣莎项目/源码/YiShaXiYi/user/couponExchange/.pydio
Normal file
1
衣莎项目/源码/YiShaXiYi/user/couponExchange/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
657b5295-fa97-441b-a4f5-2e98f1e3f2d4
|
||||
139
衣莎项目/源码/YiShaXiYi/user/couponExchange/couponExchange.js
Normal file
139
衣莎项目/源码/YiShaXiYi/user/couponExchange/couponExchange.js
Normal file
@@ -0,0 +1,139 @@
|
||||
// user/couponExchange/couponExchange.js
|
||||
const app = getApp();
|
||||
const regeneratorRuntime = app.loadAsync()
|
||||
const util = app.loadUtils("util")
|
||||
const model = app.loadModel("index")
|
||||
const http = app.loadHttp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
system: app.globalData.system, //设备相关信息
|
||||
pageTitle: "使用优惠券", //头部标题
|
||||
isBack: true,//显示返回
|
||||
isLoading: true,//加载显示关闭
|
||||
page: 1,//当前页
|
||||
isPage: false,//数据不足10条时变为true
|
||||
couponList: [],//优惠券列表
|
||||
isTips: false,//领取优惠券弹窗
|
||||
changeCoupon: {},//当前选择并换的优惠券信息
|
||||
userInfo: {},//个人信息
|
||||
},
|
||||
// 获取用户信息
|
||||
userInfo() {
|
||||
this.setData({
|
||||
userInfo: app.globalData.userInfo
|
||||
})
|
||||
},
|
||||
// 积分兑换卡券列表
|
||||
async exchangeCList() {
|
||||
let data = {
|
||||
page: this.data.page,
|
||||
limit: 10
|
||||
}
|
||||
let res = await http.http.request1({ url: `${http.api.exchangeCList}`, method: 'POST', data: data })
|
||||
let rel = res.data.data.list
|
||||
let couponList = this.data.couponList
|
||||
if (rel.length < 10) {
|
||||
this.setData({
|
||||
isPage: true
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
couponList: [...couponList, ...rel],
|
||||
isLoading: false
|
||||
})
|
||||
},
|
||||
// 兑换
|
||||
async confirmSub() {
|
||||
let res = await http.http.request2({ url: `${http.api.jfExchange}`, method: 'POST', data: { card_id: this.data.changeCoupon.id } })
|
||||
if (res.data.status == 1) {
|
||||
this.closeTips1()
|
||||
wx.showToast({
|
||||
title: '兑换成功',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
},
|
||||
// 打开弹窗
|
||||
openTips1(e) {
|
||||
let item = e.currentTarget.dataset.item
|
||||
this.setData({
|
||||
isTips: true,
|
||||
changeCoupon: item
|
||||
})
|
||||
},
|
||||
// 关闭弹窗
|
||||
closeTips1() {
|
||||
this.setData({
|
||||
isTips: false
|
||||
})
|
||||
},
|
||||
goUrl(e) {
|
||||
let url = e.currentTarget.dataset.url
|
||||
wx.navigateTo({
|
||||
url: url
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.exchangeCList()
|
||||
this.userInfo()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
if (!this.data.isPage) {
|
||||
this.exchangeCList()
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
69
衣莎项目/源码/YiShaXiYi/user/couponExchange/couponExchange.wxml
Normal file
69
衣莎项目/源码/YiShaXiYi/user/couponExchange/couponExchange.wxml
Normal file
@@ -0,0 +1,69 @@
|
||||
<!-- 头部 -->
|
||||
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
|
||||
<!-- user/couponExchange/couponExchange.wxml -->
|
||||
<view class="couponExchange">
|
||||
<view class="coup_bac"></view>
|
||||
<view class="coup_record flex-con2">
|
||||
<image class="icon_jf" src="/static/img/icon/jf.png" />
|
||||
<view class="coup_record_p1 ml10">我的积分</view>
|
||||
<view class="coup_record_p2 ml20">{{userInfo.integral}}</view>
|
||||
<view class="flex1 coup_record_p3 flex-con5" data-url="/user/parIncome/parIncome?index=1" bind:tap="goUrl">
|
||||
<span>积分记录</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coup_List">
|
||||
<view class="coup_row">
|
||||
<view class="coup_tit">积分换券</view>
|
||||
<view wx:if="{{couponList.length > 0}}" class="list_row" wx:for="{{couponList}}" wx:key>
|
||||
<view class="coup_list_row mt30">
|
||||
<image src="/static/img/jf-list.png" />
|
||||
<view class="coup_list_row_a flex-con2">
|
||||
<view class="coup_list_row_mon">
|
||||
<view class="mon_span">
|
||||
¥
|
||||
<span>{{item.coupon_price}}</span>
|
||||
</view>
|
||||
<view>门槛:{{item.use_min_price}}</view>
|
||||
</view>
|
||||
<view class="flex1">
|
||||
<view class="cuop_p1 mb10">{{item.title}}</view>
|
||||
<view class="cuop_p2 mb5">{{item.jf}}积分兑换</view>
|
||||
<view class="cuop_p2">2019-08-01 至 2019-08-31</view>
|
||||
</view>
|
||||
<button class="cuop_btn" data-item="{{item}}" catchtap="openTips1">
|
||||
立即兑换
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{couponList.length <= 0}}" class="empty flex-con3">
|
||||
<view>
|
||||
<image class="empty_img" src="/static/img/icon/order-konw-icon.png" />
|
||||
<view class="mt20">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 领取优惠券弹窗 -->
|
||||
<!-- 反洗 -->
|
||||
<view wx:if="{{isTips}}" class="backwash_tips flex-con3 tips">
|
||||
<view>
|
||||
<view class="tips_cen">
|
||||
<view class="tips_cen_tit">
|
||||
本次兑换将消耗
|
||||
<span>{{changeCoupon.jf}}</span>
|
||||
积分
|
||||
</view>
|
||||
<view class="mt20 tips_cen_tit1">确认后积分将无法返还</view>
|
||||
<view class="tips_cen_sub" catchtap="confirmSub">立即兑换</view>
|
||||
</view>
|
||||
<view class="tips_img" catchtap="closeTips1">
|
||||
<image src="/static/img/icon/colse_tips.png" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 加载动画 -->
|
||||
<loading-prog isLoading="{{isLoading}}"></loading-prog>
|
||||
<!-- toasta提示 -->
|
||||
<i-toast id="toast" />
|
||||
213
衣莎项目/源码/YiShaXiYi/user/couponExchange/couponExchange.wxss
Normal file
213
衣莎项目/源码/YiShaXiYi/user/couponExchange/couponExchange.wxss
Normal file
@@ -0,0 +1,213 @@
|
||||
/* user/couponExchange/couponExchange.wxss */
|
||||
|
||||
.couponExchange {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.coup_bac {
|
||||
width: 100%;
|
||||
height: 275rpx;
|
||||
background-color: #343434;
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.coup_record {
|
||||
height: 184rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
.icon_jf {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.coup_record_p1 {
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.coup_record_p2 {
|
||||
font-family: PingFang-SC-Bold;
|
||||
font-size: 45rpx;
|
||||
font-weight: 600;
|
||||
font-stretch: normal;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.coup_record_p3 {
|
||||
text-align: right;
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
color: #fdaf44;
|
||||
height: 100%;
|
||||
}
|
||||
/* 列表样式 */
|
||||
|
||||
.coup_List {
|
||||
width: 100%;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
.coup_row {
|
||||
background-color: #fff;
|
||||
border-radius: 30rpx;
|
||||
padding: 38rpx 25rpx;
|
||||
}
|
||||
|
||||
.coup_tit {
|
||||
font-family: PingFang-SC-Bold;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
font-stretch: normal;
|
||||
letter-spacing: 0px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.coup_list_row {
|
||||
position: relative;
|
||||
height: 183rpx;
|
||||
}
|
||||
|
||||
.coup_list_row image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.coup_list_row_a {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.coup_list_row_mon {
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 18rpx;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
color: #fff;
|
||||
width: 180rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mon_span {
|
||||
font-size: 25rpx;
|
||||
}
|
||||
|
||||
.mon_span span {
|
||||
font-size: 35rpx;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.cuop_p1 {
|
||||
font-family: PingFang-SC-Bold;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
font-stretch: normal;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.cuop_p2 {
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 20rpx;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.cuop_btn {
|
||||
width: 160rpx;
|
||||
height: 65rpx;
|
||||
line-height: 65rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 33rpx;
|
||||
margin-right: 20rpx;
|
||||
text-align: center;
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
color: #1dbf69;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 弹出层 */
|
||||
|
||||
.tips {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.tips_cen {
|
||||
width: 600rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 10rpx;
|
||||
padding-top: 58rpx;
|
||||
padding-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.tips_cen_tit {
|
||||
text-align: center;
|
||||
font-family: PingFang-SC-Bold;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
font-stretch: normal;
|
||||
letter-spacing: 0px;
|
||||
color: #000000;
|
||||
}
|
||||
.tips_cen_tit span {
|
||||
color: #fdaf44;
|
||||
}
|
||||
.tips_cen_tit1 {
|
||||
text-align: center;
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
letter-spacing: 0px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.tips_cen_sub {
|
||||
margin: 45rpx auto 0;
|
||||
width: 550rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
background-color: #36d96c;
|
||||
border-radius: 40rpx;
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tips_img {
|
||||
margin-top: 50rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tips_img image {
|
||||
width: 69rpx;
|
||||
height: 69rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user