first commit
This commit is contained in:
1
衣莎项目/源码/YiShaXiYi/user/couponCard/.pydio
Normal file
1
衣莎项目/源码/YiShaXiYi/user/couponCard/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
58377994-11dc-4934-8296-7d34c01a2c4e
|
||||
124
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.js
Normal file
124
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.js
Normal file
@@ -0,0 +1,124 @@
|
||||
// user/couponCard/couponCard.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,//显示返回
|
||||
isEnv: true,//红包选中状态
|
||||
couponList: [],//数据列表
|
||||
total_price: 0,//订单金额
|
||||
},
|
||||
|
||||
// 不使用红包
|
||||
async noEnv() {
|
||||
this.setData({
|
||||
isEnv: !this.data.isEnv
|
||||
})
|
||||
let coupon = {}
|
||||
await model.storage.setStorage("coupon", coupon)
|
||||
wx.navigateBack({
|
||||
|
||||
})
|
||||
},
|
||||
// 选中红包
|
||||
async selectEnv(e) {
|
||||
let item = e.currentTarget.dataset.item
|
||||
let coupon = {
|
||||
id: item.id,
|
||||
price: item.coupon_price
|
||||
}
|
||||
await model.storage.setStorage("coupon", coupon)
|
||||
wx.navigateBack({
|
||||
|
||||
})
|
||||
},
|
||||
// 显示隐藏内容
|
||||
isShow(e) {
|
||||
let index = e.currentTarget.dataset.index
|
||||
let list = this.data.couponList
|
||||
list[index].show = !list[index].show
|
||||
this.setData({
|
||||
couponList: list
|
||||
})
|
||||
},
|
||||
// 获取可用优惠券
|
||||
async getCoupon() {
|
||||
let res = await http.http.request2({ url: `${http.api.userCoupon}`, method: "POST", data: { total_price: this.data.total_price, status: 1 } })
|
||||
if (res.data.data.length > 0) {
|
||||
res.data.data.map((v, i) => {
|
||||
res.data.data[i].show = true
|
||||
res.data.data[i].end_time = util.formatTime(v.end_time, 'Y-M-D h:m:s')
|
||||
})
|
||||
this.setData({
|
||||
couponList: res.data.data
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
total_price:options.price
|
||||
})
|
||||
this.getCoupon()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
7
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.json
Normal file
7
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"wux-cell-group": "../../extend/wux/dist/cell-group/index",
|
||||
"wux-cell": "../../extend/wux/dist/cell/index"
|
||||
}
|
||||
}
|
||||
42
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.wxml
Normal file
42
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.wxml
Normal file
@@ -0,0 +1,42 @@
|
||||
<!-- 头部 -->
|
||||
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
|
||||
<!-- user/couponCard/couponCard.wxml -->
|
||||
<view class="couponCard">
|
||||
<view class="no_coupon mt20">
|
||||
<wux-cell-group>
|
||||
<wux-cell bind:tap="noEnv" title="不使用红包" rightUrl="{{ isEnv ? '/static/img/icon/wxPay1.png' : '/static/img/icon/wxPay2.png' }}"></wux-cell>
|
||||
</wux-cell-group>
|
||||
</view>
|
||||
<view class="coupon">
|
||||
<view class="coupon_list mt30" wx:for="{{couponList}}" wx:key="{{index}}" data-item="{{item}}" bind:tap="selectEnv">
|
||||
<view class="coupon_list_l">
|
||||
<view>
|
||||
¥
|
||||
<span>{{item.coupon_price}}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coupon_list_r">
|
||||
<view>
|
||||
<view class="coupon_list_r_top">
|
||||
{{item.coupon_title}}
|
||||
<!-- <span class="ml40">即将过期</span> -->
|
||||
</view>
|
||||
<view class="coupon_list_r_p mt10">满{{item.use_min_price}}元可用</view>
|
||||
<view class="coupon_list_r_p">有效期至:{{item.end_time}}</view>
|
||||
<view class="coupon_list_r_p mt10">线上、线下洗衣通用</view>
|
||||
<!-- <view class="coupon_list_r_p {{ item.show ? 'clamp1' : '' }}" data-index="{{index}}" bind:tap="isShow">
|
||||
上装、下装、皮质类、箱包类、下装、皮质类、箱包类、其他
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="coupon_list_b">
|
||||
<!-- <span data-index="{{index}}" bind:tap="isShow">
|
||||
<image class="{{ item.show ? '' : 'rotate' }}" src="/static/img/icon/qwfgqfqf.png" />
|
||||
</span> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- toasta提示 -->
|
||||
<i-toast id="toast" />
|
||||
65
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.wxss
Normal file
65
衣莎项目/源码/YiShaXiYi/user/couponCard/couponCard.wxss
Normal file
@@ -0,0 +1,65 @@
|
||||
/* user/couponCard/couponCard.wxss */
|
||||
|
||||
.coupon{
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.coupon_list{
|
||||
background: #ffffff;
|
||||
padding: 50rpx 0;
|
||||
border-left: 4rpx solid #1dbf53;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
.coupon_list_l{
|
||||
display: inline-block;
|
||||
padding: 0 34rpx;
|
||||
font-size: 32rpx;
|
||||
color: #1dbf53;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
.coupon_list_l span{
|
||||
font-size: 60rpx;
|
||||
}
|
||||
.coupon_list_r{
|
||||
display: inline-block;
|
||||
flex: 1;
|
||||
/* padding-right: 55rpx; */
|
||||
}
|
||||
.coupon_list_b{
|
||||
height: 100%;
|
||||
width: 80rpx;
|
||||
position: relative;
|
||||
}
|
||||
.coupon_list_b span{
|
||||
position: absolute;
|
||||
top: 173rpx;
|
||||
left: 0;
|
||||
}
|
||||
.coupon_list_b span image{
|
||||
width: 21px;
|
||||
height: 10px;
|
||||
}
|
||||
.coupon_list_r_top{
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.coupon_list_r_top span{
|
||||
width: 105rpx;
|
||||
height: 32rpx;
|
||||
background-color: #fff1f0;
|
||||
border-radius: 5rpx;
|
||||
font-size: 20rpx;
|
||||
color: #ff4026;
|
||||
text-align: center;
|
||||
line-height: 32rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
.coupon_list_r_p{
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.rotate{
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
Reference in New Issue
Block a user