Browse Source

优惠券

master
shaojing 2 years ago
parent
commit
1e9381784c
  1. 2
      app.js
  2. 1
      pages/info/postProductInfo/index.js
  3. 1
      pages/info/sceneProductInfo/index.js
  4. 9
      pages/order/components/coupon/index.wxml
  5. 5
      pages/order/coupon/index.wxml
  6. 12
      pages/order/coupon/index.wxss
  7. 16
      pages/order/postOrder/index.js
  8. 20
      pages/order/postOrder/index.wxml
  9. 44
      pages/order/scene/index.js
  10. 2
      pages/order/scene/index.wxml
  11. 1
      pages/user/cartlist/list.js
  12. 9
      pages/user/coupon/index.wxml

2
app.js

@ -21,7 +21,7 @@ App({
unique_key: "wechatxcx" unique_key: "wechatxcx"
}).then(res => { }).then(res => {
let data = JSON.parse(res.data); let data = JSON.parse(res.data);
data.isTest = data.isTest138? true : false; data.isTest = data.isTest139? true : false;
this.globalData.configJson = data this.globalData.configJson = data
}).then(() => { }).then(() => {
// 获取ui配置文件 // 获取ui配置文件

1
pages/info/postProductInfo/index.js

@ -336,6 +336,7 @@ Page({
}]; }];
app.globalData.postProduct = product; app.globalData.postProduct = product;
app.globalData.retailId = this.data.retailId; app.globalData.retailId = this.data.retailId;
app.globalData.listName = null
wx.navigateTo({ wx.navigateTo({
url: '/pages/order/postOrder/index', url: '/pages/order/postOrder/index',
}) })

1
pages/info/sceneProductInfo/index.js

@ -358,6 +358,7 @@ Page({
} else { } else {
app.globalData.postProduct = [] app.globalData.postProduct = []
app.globalData.list = [] app.globalData.list = []
app.globalData.listName = null
if (this.data.skuFlag == 'order') { if (this.data.skuFlag == 'order') {
if (e.currentTarget.dataset.disable === 1) return; if (e.currentTarget.dataset.disable === 1) return;
util.pagePoint({ util.pagePoint({

9
pages/order/components/coupon/index.wxml

@ -2,7 +2,14 @@
<navigator url="/pages/order/coupon/index?money={{money}}&sku={{sku}}" class="box"> <navigator url="/pages/order/coupon/index?money={{money}}&sku={{sku}}" class="box">
<view class="box-title"> <view class="box-title">
<view style="flex:1">优惠券</view> <view style="flex:1">优惠券</view>
<view wx:if="{{coupon}}">-{{coupon.activity.money/100}}</view> <view wx:if="{{coupon}}">
<view wx:if="{{coupon.activity.discount_type == 'pricebreak'}}">
-{{coupon.activity.money/100}}
</view>
<view wx:else>
{{coupon.activity.fold}}折
</view>
</view>
<view class="coupon-btn" wx:else>请选择</view> <view class="coupon-btn" wx:else>请选择</view>
</view> </view>
</navigator> </navigator>

5
pages/order/coupon/index.wxml

@ -2,7 +2,10 @@
<title title="优惠券"></title> <title title="优惠券"></title>
<view wx:if="{{list.length>0}}"> <view wx:if="{{list.length>0}}">
<view class="coupon-item" wx:for="{{list}}"> <view class="coupon-item" wx:for="{{list}}">
<view class="money">{{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>
{{item.activity.fold}}
</view>
<view class="coupon-info"> <view class="coupon-info">
<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>

12
pages/order/coupon/index.wxss

@ -20,10 +20,22 @@ page {
font-weight: 500; font-weight: 500;
flex-shrink: 0; flex-shrink: 0;
} }
.coupon-item .money1 {
color: #D62828;
font-size: 47rpx;
width: 187rpx;
text-align: center;
font-weight: 500;
flex-shrink: 0;
}
.coupon-item .money::before { .coupon-item .money::before {
content: '¥'; content: '¥';
font-size: 30rpx; font-size: 30rpx;
} }
.coupon-item .money1::after {
content: '折';
font-size: 30rpx;
}
.coupon-info { .coupon-info {
flex: 1; flex: 1;
margin-right: 20rpx; margin-right: 20rpx;

16
pages/order/postOrder/index.js

@ -22,7 +22,8 @@ Page({
allowance_price: 0, allowance_price: 0,
showAllowance: false, showAllowance: false,
flag:null, flag:null,
isCar:'single' isCar:'single',
showYhq:null
}, },
/** /**
@ -35,7 +36,8 @@ Page({
gp_id: app.globalData.gp_id || app.globalData.team_id, gp_id: app.globalData.gp_id || app.globalData.team_id,
prizeId: wx.getStorageSync('prizeId'), prizeId: wx.getStorageSync('prizeId'),
flag:options.flag, flag:options.flag,
isCar:options.isCar isCar:options.isCar,
showYhq:app.globalData.listName?false:true
}) })
let price = 0, sku_id = []; let price = 0, sku_id = [];
app.globalData.postProduct.map(item => { app.globalData.postProduct.map(item => {
@ -57,6 +59,16 @@ Page({
} }
console.log(this.data.showPrice) console.log(this.data.showPrice)
}, },
price() {
let allPrice
if (this.data.coupon) {
if (this.data.coupon.discount_type == 'pricebreak') {
return allPrice = this.data.showPrice + this.data.postFee - this.data.coupon.activity.money>0?this.data.showPrice + this.data.postFee - this.data.coupon.activity.money/100:0
} else {
return allPrice = (this.data.showPrice* this.data.coupon.activity.fold)/ 10 + this.data.postFee
}
}
},
changeAllowance: function () { changeAllowance: function () {
this.setData({ this.setData({
showAllowance: !this.data.showAllowance showAllowance: !this.data.showAllowance

20
pages/order/postOrder/index.wxml

@ -47,11 +47,25 @@
</view> </view>
</view> </view>
</view> </view>
<coupon bind:getNewCoupon = 'getNewCoupon' id="coupon" wx:if="{{!kjId && !gp_id && flag!='mix'}}" money="{{showPrice + postFee}}" sku="{{sku_id}}"></coupon> <coupon bind:getNewCoupon = 'getNewCoupon' id="coupon" wx:if="{{!kjId && !gp_id && flag!='mix' && showYhq}}" money="{{showPrice + postFee}}" sku="{{sku_id}}"></coupon>
<view style="height:113rpx"></view> <view style="height:113rpx"></view>
<view class="fixed-bottom" wx:if="{{product}}"> <view class="fixed-bottom" wx:if="{{product}}">
<view class="fixed-price-box" wx:if="{{!prizeId}}"><text>合计:</text><text <view class="fixed-price-box" wx:if="{{!prizeId}}">
class="price">¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}}</text> <view wx:if="{{coupon && showYhq}}">
<view wx:if="{{coupon && coupon.activity.discount_type == 'pricebreak'}}">
<text>合计:</text><text
class="price">¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}}</text>
</view>
<view wx:else>
<text>合计:</text><text
class="price">¥{{((showPrice + postFee)* coupon.activity.fold/10)>0?((showPrice + postFee)* coupon.activity.fold/10)/100:0}}</text>
</view>
</view>
<view wx:else>
<text>合计:</text><text
class="price">¥{{showPrice + postFee>0?(showPrice + postFee)/100:0}}</text>
</view>
</view> </view>
<view class="fixed-price-box" wx:else><text>合计:</text><text class="price">¥{{postFee?(0+postFee)/100:0}}</text></view> <view class="fixed-price-box" wx:else><text>合计:</text><text class="price">¥{{postFee?(0+postFee)/100:0}}</text></view>
<view class="fixed-btn" bindtap="order">下一步</view> <view class="fixed-btn" bindtap="order">下一步</view>

44
pages/order/scene/index.js

@ -44,6 +44,7 @@ Page({
bookingInfoTitle: "", bookingInfoTitle: "",
showDate:false, showDate:false,
showDate2:false, showDate2:false,
showYhq:null
}, },
/** /**
@ -64,9 +65,10 @@ Page({
is_authentication:app.globalData.product.sku.sku_model.is_authentication, is_authentication:app.globalData.product.sku.sku_model.is_authentication,
is_real_name:app.globalData.product.sku.sku_model.is_real_name, is_real_name:app.globalData.product.sku.sku_model.is_real_name,
date: app.globalData.product.date, date: app.globalData.product.date,
time: app.globalData.product.time time: app.globalData.product.time,
showYhq:app.globalData.listName?false:true
}) })
console.log('-------',this.data.date,this.data.time); console.log('-------',this.data.showYhq,this.data.time);
// debugger // debugger
console.log('-------',app.globalData.product.sku.sku_model.is_need_idcard); console.log('-------',app.globalData.product.sku.sku_model.is_need_idcard);
console.log('---是否实名----',app.globalData.product.sku.sku_model.is_authentication); console.log('---是否实名----',app.globalData.product.sku.sku_model.is_authentication);
@ -87,7 +89,7 @@ Page({
} }
this.setData({ this.setData({
product: app.globalData.product, product: app.globalData.product,
singlePrice: app.globalData.product?app.globalData.product.date.price :(this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price) singlePrice: app.globalData.product.date?app.globalData.product.date.price :(this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price)
// singlePrice: this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price // singlePrice: this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price
}) })
console.log(this.data.singlePrice); console.log(this.data.singlePrice);
@ -140,7 +142,17 @@ Page({
// this.setData({ // this.setData({
// singlePrice:app.globalData.product.product.price // singlePrice:app.globalData.product.product.price
// }) // })
let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) let price
if (this.data.coupon) {
if (this.data.coupon.discount_type == 'pricebreak') {
price = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
} else {
price =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
}
} else {
price = this.data.singlePrice * this.data.productNum
}
if (price >0) { if (price >0) {
this.setData({ this.setData({
price:price/100 price:price/100
@ -152,7 +164,17 @@ Page({
} }
// console.log(this.data.singlePrice); // console.log(this.data.singlePrice);
} }
let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) // let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0)
let price
if (this.data.coupon) {
if (this.data.coupon.discount_type == 'pricebreak') {
price = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
} else {
price =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
}
} else {
price = this.data.singlePrice * this.data.productNum
}
if (price >0) { if (price >0) {
this.setData({ this.setData({
price:price/100 price:price/100
@ -261,7 +283,17 @@ Page({
}, },
totalPrice(price) { totalPrice(price) {
let allPrice let allPrice
allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) if (this.data.coupon) {
if (this.data.coupon.discount_type == 'pricebreak') {
allPrice = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
} else {
allPrice =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
}
} else {
allPrice = this.data.singlePrice * this.data.productNum
}
// allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0)
if (allPrice >0) { if (allPrice >0) {
this.setData({ this.setData({
price:allPrice/100, price:allPrice/100,

2
pages/order/scene/index.wxml

@ -70,7 +70,7 @@
</view> </view>
</view> </view>
<coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum'}}" id="coupon" <coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum' && showYhq}}" id="coupon"
money="{{singlePrice * productNum}}" sku="{{product.sku.id}}"></coupon> money="{{singlePrice * productNum}}" sku="{{product.sku.id}}"></coupon>
<!-- <view class="box" wx:if="{{type!='activity' && product && product.isGroup!=1}}"> <!-- <view class="box" wx:if="{{type!='activity' && product && product.isGroup!=1}}">

1
pages/user/cartlist/list.js

@ -231,6 +231,7 @@ Page({
product.push(item) product.push(item)
} }
}) })
app.globalData.listName = 'car'
if (product.length>1) { if (product.length>1) {
this.setData({ this.setData({
showModel:true showModel:true

9
pages/user/coupon/index.wxml

@ -9,7 +9,14 @@
<view class="coupon-item{{index==0?' active':''}}" wx:for="{{list}}" wx:for-index="i"> <view class="coupon-item{{index==0?' active':''}}" wx:for="{{list}}" wx:for-index="i">
<view class="title-box"> <view class="title-box">
<view class="title textOver">{{item.activity.name}}</view> <view class="title textOver">{{item.activity.name}}</view>
<view class="coupon-money">¥<text>{{item.activity.money/100}}</text></view> <view class="coupon-money">
<view wx:if="{{item.activity.discount_type == 'pricebreak'}}">
¥<text>{{item.activity.money/100}}</text>
</view>
<view wx:else>
<text>{{item.activity.fold}}折</text>
</view>
</view>
</view> </view>
<view class="coupon-tip"><text>使用条件:</text>满{{item.activity.mini_money/100}}元</view> <view class="coupon-tip"><text>使用条件:</text>满{{item.activity.mini_money/100}}元</view>
<view class="coupon-tip"><text>有效期:</text>{{item.end_time}} 前使用</view> <view class="coupon-tip"><text>有效期:</text>{{item.end_time}} 前使用</view>

Loading…
Cancel
Save