Commit eeca550a authored by 潘永坪's avatar 潘永坪

券接口修改

parent 3055ff3e
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
</view> </view>
</view> </view>
<!-- -----------------------------有可用优惠券,并且未选中----------------------------------------------------- --> <!-- -----------------------------有可用优惠券,并且未选中----------------------------------------------------- -->
<!-- <view class="topCoupon" v-if="couponData.usableCouponList&&couponData.usableCouponList.length>0&&chooseCouponObj==''" @click="showCoupon()"> <view class="topCoupon" v-if="couponData.masterSlaveCouponList&&couponData.masterSlaveCouponList.length>0&&chooseCouponObj==''" @click="showCoupon()">
<view class="couponLeft"> <view class="couponLeft">
<text></text> <text></text>
<text>{{couponData.usableCouponList[0].couponName}}</text> <text>{{couponData.masterSlaveCouponList[0].couponName}}</text>
</view> </view>
<view class="couponRight"> <view class="couponRight">
<text>未选优惠券</text> <text>未选优惠券</text>
<text class="iconfont icon-you" style="font-size:32rpx;"></text> <text class="iconfont icon-you" style="font-size:32rpx;"></text>
</view> </view>
</view> --> </view>
<!-- -----------------------------有可用优惠券----------------------------------------------------- --> <!-- -----------------------------有可用优惠券----------------------------------------------------- -->
<!-- <view class="topCoupon" v-if="chooseCouponObj!=''" @click="showCoupon()"> <view class="topCoupon" v-if="chooseCouponObj!=''" @click="showCoupon()">
<view class="couponLeft"> <view class="couponLeft">
<text></text> <text></text>
<text>{{chooseCouponObj.couponName}}</text> <text>{{chooseCouponObj.couponName}}</text>
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
<view class="couponRight"> <view class="couponRight">
<text>-</text> <text>-</text>
<text>{{chooseCouponObj.savedMoney.toFixed(2)}}</text> <text>{{parseFloat(savedMoney.toFixed(2))}}</text>
<text class="iconfont icon-you" style="font-size:32rpx;"></text> <text class="iconfont icon-you" style="font-size:32rpx;"></text>
</view> </view>
</view> --> </view>
<!-- -----------------------------------------------可用优惠券条件--------------------------------------- --> <!-- -----------------------------------------------可用优惠券条件--------------------------------------- -->
<!-- <view class="topCoupon" v-if="ableConpon!=''" @click="showCoupon()"> <view class="topCoupon" v-if="ableConpon!=''" @click="showCoupon()">
<view class="couponLeft"> <view class="couponLeft">
<text></text> <text></text>
<text>{{ableConpon.couponName}}</text> <text>{{ableConpon.couponName}}</text>
...@@ -51,20 +51,6 @@ ...@@ -51,20 +51,6 @@
<text>{{ableConpon.couponRule}}</text> <text>{{ableConpon.couponRule}}</text>
<text class="iconfont icon-you" style="font-size:32rpx;"></text> <text class="iconfont icon-you" style="font-size:32rpx;"></text>
</view> </view>
</view> -->
<view class="topCoupon" v-if="chooseCouponObj">
<view class="couponLeft">
<text></text>
<text>{{chooseCouponObj.couponName}}</text>
</view>
<view class="couponRight">
<text style="font-weight: bold;">
<text style="font-size:26rpx;font-weight:400;"></text>
{{parseFloat(savedMoney.toFixed(2))}}
</text>
</view>
</view> </view>
</view> </view>
...@@ -90,7 +76,7 @@ ...@@ -90,7 +76,7 @@
</view> </view>
</view> </view>
<!-------------------------------------------券弹窗------------------------------> <!-------------------------------------------券弹窗------------------------------>
<!-- <orderCoupon :couponData="couponData" ref="orderCoupon" @couponChoose="couponChoose" :chooseCouponObj="chooseCouponObj"></orderCoupon> --> <orderCoupon :couponData="couponData" ref="orderCoupon" @couponChoose="couponChoose" :chooseCouponObj="chooseCouponObj"></orderCoupon>
</view> </view>
</template> </template>
...@@ -285,6 +271,11 @@ ...@@ -285,6 +271,11 @@
}, },
couponChoose(data) { //---------------------------------------------------------------子组件券选择之后触发的事件 couponChoose(data) { //---------------------------------------------------------------子组件券选择之后触发的事件
this.chooseCouponObj = data this.chooseCouponObj = data
if(this.chooseCouponObj.slaveList.length>0){
this.savedMoney=this.chooseCouponObj.slaveList[0].savedMoney
}else{
this.savedMoney=this.chooseCouponObj.savedMoney
}
}, },
showCoupon() { //---------------------------------------------------------------------展示券列表 showCoupon() { //---------------------------------------------------------------------展示券列表
this.$refs.orderCoupon.showCoupon() this.$refs.orderCoupon.showCoupon()
...@@ -340,34 +331,34 @@ ...@@ -340,34 +331,34 @@
openid:this.openid openid:this.openid
} }
this.$request("wechatUser/myPage/usableCouponList",data).then((res) => { this.$request("wechatUser/myPage/usableCouponList",data).then((res) => {
if (res.code == "00") { if (res.data.code == "00") {
this.chooseCouponObj=res.data.masterSlaveCouponList[0] this.couponData = res.data.data
if(this.chooseCouponObj.slaveList.length>0){ let masterSlaveCouponList=res.data.data.masterSlaveCouponList
this.savedMoney=this.chooseCouponObj.slaveList[0].savedMoney if (masterSlaveCouponList.length>0) {
}else{ masterSlaveCouponList.forEach((item) => { //获取最优券
this.savedMoney=this.chooseCouponObj.savedMoney savedMoneyList.push(item.savedMoney)
} })
// this.couponData = res.data let maxMoney = Math.max.apply(null, savedMoneyList)
// if (res.data.usableCouponList.length > 0) { let index = masterSlaveCouponList.findIndex((item) => {
// res.data.usableCouponList.forEach((item) => { //获取最优券 return maxMoney == item.savedMoney
// savedMoneyList.push(item.savedMoney) })
// }) if(index>-1){
// let maxMoney = Math.max.apply(null, savedMoneyList) this.chooseCouponObj = masterSlaveCouponList[index]
// let index = res.data.usableCouponList.findIndex((item) => { }
// return maxMoney == item.savedMoney if(this.chooseCouponObj.slaveList.length>0){
// }) this.savedMoney=this.chooseCouponObj.slaveList[0].savedMoney
// if(index>-1){ }else{
// this.chooseCouponObj = res.data.usableCouponList[index] this.savedMoney=this.chooseCouponObj.savedMoney
// } }
// } else { } else {
// if (res.data.unusableCouponList.length > 0) { if (res.data.data.unusableCouponList.length > 0) {
// res.data.unusableCouponList.forEach((item, i) => { //没有可用优惠券,有达到条件可以用的优惠券,先显示条件,达到条件时显示可用优惠券 res.data.data.unusableCouponList.forEach((item, i) => { //没有可用优惠券,有达到条件可以用的优惠券,先显示条件,达到条件时显示可用优惠券
// if (item.isProduct == 1) { if (item.isProduct == 1) {
// this.ableConpon = item this.ableConpon = item
// } }
// }) })
// } }
// } }
} }
}) })
}, },
...@@ -381,15 +372,27 @@ ...@@ -381,15 +372,27 @@
} }
let couponList = [] let couponList = []
if (this.chooseCouponObj != '') { if (this.chooseCouponObj != '') {
couponList = [ //券列表 if(this.chooseCouponObj.slaveList.length>0){//有从卷取值从卷,没有从卷取值主劵
{ couponList=[//券列表
couponId: this.chooseCouponObj.couponId, //券id {
couponPrice: this.chooseCouponObj.savedMoney, //券价格 couponId:this.chooseCouponObj.slaveList[0].couponId,//券id
isMerchant: this.chooseCouponObj.createSource, //是否是商户的券 couponPrice:this.chooseCouponObj.slaveList[0].savedMoney,//券价格
myCouponId: this.chooseCouponObj.id, //领取人编号 isMerchant:this.chooseCouponObj.slaveList[0].createSource,//是否是商户的券
couponType:this.chooseCouponObj.couponType//券类型 myCouponId:this.chooseCouponObj.slaveList[0].id,//领取人编号
} couponType:this.chooseCouponObj.slaveList[0].couponType//券类型
] }
]
}else{
couponList=[
{
couponId:this.chooseCouponObj.couponId,//券id
couponPrice:this.chooseCouponObj.savedMoney,//券价格
isMerchant:this.chooseCouponObj.createSource,//是否是商户的券
myCouponId:this.chooseCouponObj.id,//领取人编号
couponType:this.chooseCouponObj.couponType//券类型
}
]
}
} }
let data = { let data = {
companyId: this.companyId, companyId: this.companyId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment