Browse Source

优惠券还原

master
jiazhipeng 4 months ago
parent
commit
7e41f04797
  1. 46
      pages/order/components/coupon/index.js
  2. 43
      pages/order/coupon/index.wxml
  3. 43
      pages/order/coupon/index.wxss

46
pages/order/components/coupon/index.js

@ -26,11 +26,7 @@ Component({
}) })
} }
} }
}, }
sourceFrom: {
type:String,
value:""
},
}, },
/** /**
@ -67,45 +63,9 @@ Component({
}) })
this.triggerEvent('getNewCoupon',null); this.triggerEvent('getNewCoupon',null);
}else{ }else{
let postList = app.globalData.postProduct || [] commonApi.user_post('coupon/use_max_coupon_list',{
let ticketList = app.globalData.list || []
let signleProduct = app.globalData.product || null
let listData = []
if (this.properties.sourceFrom == 'cart') {
ticketList.forEach(v=>{
listData.push({
sku_id: v.sku.id,
price: v.sku.price,
sell_price: v.sku.price,
num: v.num,
use_date: v.time&&v.time.sale_date?v.time.sale_date:''
})
})
} else {
if (signleProduct) {
listData.push({
sku_id: signleProduct.sku.id,
price: signleProduct.sku.price,
sell_price: signleProduct.sku.price,
num: signleProduct.productNum,
use_date: signleProduct.date&&signleProduct.date.date?signleProduct.date.date:''
})
}
}
postList.forEach(v=>{
listData.push({
sku_id: v.sku.id,
price: v.sku.price,
sell_price: v.sku.price,
num: v.productNum,
})
})
commonApi.user_post('coupon/use_max_coupon_listv2',{
money:this.data.money, money:this.data.money,
sku_ids:this.data.sku, sku_ids:this.data.sku
cart_data: listData
}).then(res=>{ }).then(res=>{
if (app.globalData.couponInfo&&app.globalData.couponInfo.hasOwnProperty('SubCoupon')) { if (app.globalData.couponInfo&&app.globalData.couponInfo.hasOwnProperty('SubCoupon')) {
this.setData({ this.setData({

43
pages/order/coupon/index.wxml

@ -1,9 +1,7 @@
<!--pages/order/coupon/index.wxml--> <!--pages/order/coupon/index.wxml-->
<title title="优惠券"></title> <title title="优惠券"></title>
<view > <view wx:if="{{list.length>0}}">
<view wx:if="{{list.length>0}}" class="coupon-title">可使用红包 <text class="couon-date">{{list.length}}张</text></view> <view class="coupon-item" wx:for="{{list}}">
<view class="coupon-item-box" wx:for="{{list}}">
<view class="coupon-item" >
<view class="money" wx:if="{{item.activity.discount_type == 'pricebreak'}}">{{item.activity.money/100}}</view> <view class="money" wx:if="{{item.activity.discount_type == 'pricebreak'}}">{{item.activity.money/100}}</view>
<view class="money1" wx:else> <view class="money1" wx:else>
{{item.activity.fold}} {{item.activity.fold}}
@ -12,44 +10,11 @@
<view>{{item.activity.name}}</view> <view>{{item.activity.name}}</view>
<view class="couon-date" wx:if="{{item.end_time}}">{{item.end_time}}到期</view> <view class="couon-date" wx:if="{{item.end_time}}">{{item.end_time}}到期</view>
</view> </view>
<view wx:if="{{item.can_use}}" class="iconfont icon-{{item.selected?'gou':'quan'}}" bindtap="selectIt" data-index="{{index}}"></view> <view class="iconfont icon-{{item.selected?'gou':'quan'}}" bindtap="selectIt" data-index="{{index}}"></view>
<view class="couon-date" wx:else>不可用</view>
</view> </view>
<view class="no-reason" wx:if="{{!item.can_use}}">
<view style="color: #D62828;margin-bottom: 8rpx;">不可用原因</view>
<view>{{item.reason}}</view>
</view>
</view>
<view wx:if="{{noUseList.length>0}}" class="coupon-title">不可使用红包 <text class="couon-date">{{noUseList.length}}张</text></view>
<view class="coupon-item-box" wx:for="{{noUseList}}">
<view class="coupon-item" >
<view class="money" wx:if="{{item.activity.discount_type == 'pricebreak'}}">{{item.activity.money/100}}</view>
<view class="money1" wx:else>
{{item.activity.fold}}
</view>
<view class="coupon-info">
<view>{{item.activity.name}}</view>
<view class="couon-date" wx:if="{{item.end_time}}">{{item.end_time}}到期</view>
</view>
<view wx:if="{{item.can_use}}" class="iconfont icon-{{item.selected?'gou':'quan'}}" bindtap="selectIt" data-index="{{index}}"></view>
<view class="couon-date" wx:else>不可用</view>
<view class="cover-no-use" wx:if="{{!item.can_use}}"></view>
</view>
<view class="no-reason" wx:if="{{!item.can_use}}">
<view style="color: #D62828;margin-bottom: 8rpx;">不可用原因</view>
<view>{{item.reason}}</view>
</view>
</view>
<view class="btn" bindtap="submit">确定</view> <view class="btn" bindtap="submit">确定</view>
</view> </view>
<view class="common-empty" wx:if="{{list.length==0&&noUseList.length==0}}" style="z-index:-1;top:0"> <view class="common-empty" wx:if="{{list.length==0}}" style="z-index:-1;top:0">
<image lazy-load mode="widthFix" src="https://static.ticket.sz-trip.com/xcxImages/other/nodata.png"></image> <image lazy-load mode="widthFix" src="https://static.ticket.sz-trip.com/xcxImages/other/nodata.png"></image>
<view>暂无优惠券</view> <view>暂无优惠券</view>
</view> </view>

43
pages/order/coupon/index.wxss

@ -2,27 +2,20 @@
page { page {
background: #f6f6f6; background: #f6f6f6;
} }
.coupon-item-box{
width: 700rpx;
margin: 26rpx auto;
background: white;
border-radius: 7rpx;
box-sizing: border-box;
padding:0 26rpx;
}
.coupon-item { .coupon-item {
width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
position: relative; margin: 26rpx;
background: white;
border-radius: 7rpx;
height: 136rpx; height: 136rpx;
padding-right: 27rpx;
} }
.coupon-item .money { .coupon-item .money {
color: #D62828; color: #D62828;
font-size: 67rpx; font-size: 67rpx;
width: 147rpx; width: 187rpx;
text-align: center; text-align: center;
font-weight: 500; font-weight: 500;
flex-shrink: 0; flex-shrink: 0;
@ -76,29 +69,3 @@ page {
font-weight: 500; font-weight: 500;
text-align: center; text-align: center;
} }
.no-reason{
width: 100%;
border-top: 1px dashed #e0e0e0;
padding: 20rpx 0;
color: #666;
font-size: 24rpx;
box-sizing: border-box;
}
.cover-no-use{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100;
opacity: 0.5;
background: white;
}
.coupon-title{
padding: 26rpx 26rpx 0;
width: 100%;
box-sizing: border-box;
}
Loading…
Cancel
Save