修复店铺和平台优惠券同时选择时,显示问题

master
paulGao 2022-01-21 19:02:06 +08:00
parent 68e25cb0b3
commit 4dea906e23
2 changed files with 211 additions and 63 deletions

View File

@ -1,12 +1,22 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<u-tabs :list="list" :is-scroll="false" :active-color="lightColor" :current="current" @change="(i)=>{current = i}"> <u-tabs
:list="list"
:is-scroll="false"
:active-color="lightColor"
:current="current"
@change="
(i) => {
current = i;
}
"
>
</u-tabs> </u-tabs>
<div class="empty" v-if="couponsList.length <= 0"> <div class="empty" v-if="couponsList.length <= 0">
<u-empty text="暂无优惠券" mode="coupon"></u-empty> <u-empty text="暂无优惠券" mode="coupon"></u-empty>
</div> </div>
<view class="coupon-item" v-for="(item, index) in couponsList" :key="index" > <view class="coupon-item" v-for="(item, index) in couponsList" :key="index">
<view class="left"> <view class="left">
<view class="wave-line"> <view class="wave-line">
<view class="wave" v-for="(item, index) in 12" :key="index"></view> <view class="wave" v-for="(item, index) in 12" :key="index"></view>
@ -26,15 +36,27 @@
<view v-if="item.scopeType"> <view v-if="item.scopeType">
<span v-if="item.scopeType == 'ALL' && item.id == 'platform'"></span> <span v-if="item.scopeType == 'ALL' && item.id == 'platform'"></span>
<span v-if="item.scopeType == 'PORTION_CATEGORY'"></span> <span v-if="item.scopeType == 'PORTION_CATEGORY'"></span>
<view v-else>{{ item.storeName == 'platform' ? '' :item.storeName+'' }}使</view> <view v-else
>{{
item.storeName == "platform" ? "全平台" : item.storeName + "店铺"
}}使用</view
>
</view> </view>
<view class="reason" v-if="item.reason">{{item.reason}}</view> <view class="reason" v-if="item.reason">{{ item.reason }}</view>
<view class="end-time">有效期至:{{item.endTime}}</view> <view class="end-time">有效期至:{{ item.endTime }}</view>
</view> </view>
<view class="receive" v-if="current ==0" @click="clickWay(item)"> <view
class="receive"
v-if="current == 0 && !routerVal.selectedCoupon.includes(item.id)"
@click="clickWay(item)"
>
<text>立即</text><br /> <text>立即</text><br />
<text>使用</text> <text>使用</text>
</view> </view>
<view class="used" v-else @click="clickWay(item)">
<text>取消</text><br />
<text>使用</text>
</view>
<view class="bg-quan"></view> <view class="bg-quan"></view>
</view> </view>
</view> </view>
@ -69,9 +91,8 @@ export default {
routerVal: "", // routerVal: "", //
}; };
}, },
onLoad(options){ onLoad(options) {
this.routerVal = options this.routerVal = options;
}, },
watch: { watch: {
current(val) { current(val) {
@ -84,6 +105,7 @@ export default {
mounted() { mounted() {
this.init(); this.init();
console.log(this.routerVal);
}, },
methods: { methods: {
@ -99,7 +121,7 @@ export default {
clickWay(coupon) { clickWay(coupon) {
useCoupon({ useCoupon({
memberCouponId: coupon.id, memberCouponId: coupon.id,
used: true, used: !this.routerVal.selectedCoupon.includes(coupon.id),
way: this.routerVal.way, way: this.routerVal.way,
}).then((res) => { }).then((res) => {
if (res.data.success) { if (res.data.success) {
@ -216,7 +238,7 @@ export default {
> view:nth-child(1) { > view:nth-child(1) {
color: #666666; color: #666666;
margin-left: 20rpx; margin-left: 20rpx;
> view:nth-child(1) { > view:nth-child(1) {
color: #ff6262; color: #ff6262;
font-size: 30rpx; font-size: 30rpx;
@ -237,6 +259,20 @@ export default {
z-index: 2; z-index: 2;
} }
.used {
color: #ffffff;
background-color: black;
border-radius: 50%;
width: 86rpx;
height: 86rpx;
text-align: center;
margin-right: 30rpx;
vertical-align: middle;
padding-top: 8rpx;
position: relative;
z-index: 2;
}
.bg-quan { .bg-quan {
width: 244rpx; width: 244rpx;
height: 244rpx; height: 244rpx;

View File

@ -11,8 +11,12 @@
<div class="flex flex-a-c"> <div class="flex flex-a-c">
<span class="default" v-if="address.isDefault"></span> <span class="default" v-if="address.isDefault"></span>
<div class="address-list" v-if="address.consigneeAddressPath.length != 0"> <div class="address-list" v-if="address.consigneeAddressPath.length != 0">
<span class="address-item" v-for="(item,index) in address.consigneeAddressPath" :key="index"> <span
{{item}} class="address-item"
v-for="(item, index) in address.consigneeAddressPath"
:key="index"
>
{{ item }}
</span> </span>
</div> </div>
</div> </div>
@ -38,23 +42,46 @@
<view class="group-box" v-if="isAssemble"> <view class="group-box" v-if="isAssemble">
<view class="group-title"> <view class="group-title">
<span v-if="pintuanFlage"></span> <span v-if="pintuanFlage"></span>
<span v-else><span>{{routerVal.parentOrder.toBeGroupedNum }}</span>人的团购买</span> <span v-else
>为你加入仅差<span>{{ routerVal.parentOrder.toBeGroupedNum }}</span
>人的团购买</span
>
</view> </view>
<view class="group"> <view class="group">
<view> <view>
<u-image borderRadius="50%" shape="square" class="head-img" width="81rpx" height="81rpx" <u-image
:src="masterWay.face || '/static/missing-face.png'"></u-image> borderRadius="50%"
shape="square"
class="head-img"
width="81rpx"
height="81rpx"
:src="masterWay.face || '/static/missing-face.png'"
></u-image>
<view class="btn-one">团长</view> <view class="btn-one">团长</view>
</view> </view>
<view class="line"> </view> <view class="line"> </view>
<view> <view>
<!-- 如果有最后一名显示最后一名没有最后一名显示等待参团 --> <!-- 如果有最后一名显示最后一名没有最后一名显示等待参团 -->
<u-image class="head-img" v-if="endWay.face" :src="endWay.face" borderRadius="50%" shape="square" <u-image
width="81rpx" height="81rpx"> class="head-img"
v-if="endWay.face"
:src="endWay.face"
borderRadius="50%"
shape="square"
width="81rpx"
height="81rpx"
>
<view slot="loading"></view> <view slot="loading"></view>
</u-image> </u-image>
<u-image class="head-img" borderRadius="50%" shape="square" v-else width="81rpx" height="81rpx" <u-image
:src="endWay.face || '/static/missing-face.png'"></u-image> class="head-img"
borderRadius="50%"
shape="square"
v-else
width="81rpx"
height="81rpx"
:src="endWay.face || '/static/missing-face.png'"
></u-image>
<view class="wait">{{ endWay.nickname || "等待参团" }}</view> <view class="wait">{{ endWay.nickname || "等待参团" }}</view>
</view> </view>
@ -68,43 +95,88 @@
<span>{{ item.storeName }}</span> <span>{{ item.storeName }}</span>
</div> </div>
</div> </div>
<div class="promotionNotice">{{ item.promotionNotice || '' }}</div> <div class="promotionNotice">{{ item.promotionNotice || "" }}</div>
<div class="flex goods-item" v-for="(val, i) in item.skuList" :key="i"> <div class="flex goods-item" v-for="(val, i) in item.skuList" :key="i">
<div class="goods-image" <div
@click="navigateTo('/pages/product/goods?id=' + val.goodsSku.id+'&goodsId='+val.goodsSku.goodsId)" :span="3"> class="goods-image"
<u-image borderRadius="10rpx" width="200rpx" height="200rpx" :src="val.goodsSku.thumbnail" alt /> @click="
navigateTo(
'/pages/product/goods?id=' +
val.goodsSku.id +
'&goodsId=' +
val.goodsSku.goodsId
)
"
:span="3"
>
<u-image
borderRadius="10rpx"
width="200rpx"
height="200rpx"
:src="val.goodsSku.thumbnail"
alt
/>
</div> </div>
<div @click="navigateTo('/pages/product/goods?id=' + val.goodsSku.id+'&goodsId='+val.goodsSku.goodsId)" <div
class="goods-detail"> @click="
navigateTo(
'/pages/product/goods?id=' +
val.goodsSku.id +
'&goodsId=' +
val.goodsSku.goodsId
)
"
class="goods-detail"
>
<div class="flex"> <div class="flex">
<p class="goods-name">{{ val.goodsSku.goodsName }}</p> <p class="goods-name">{{ val.goodsSku.goodsName }}</p>
<span class="nums">x{{ val.num }}</span> <span class="nums">x{{ val.num }}</span>
</div> </div>
<p class="goods-prices"> <p class="goods-prices">
<span></span> <span></span>
<span class="goods-price">{{formatPrice(val.goodsSku.price)[0]}}</span> <span class="goods-price">{{ formatPrice(val.goodsSku.price)[0] }}</span>
<span>.{{formatPrice(val.goodsSku.price)[1] }}</span> <span>.{{ formatPrice(val.goodsSku.price)[1] }}</span>
</p> </p>
</div> </div>
</div> </div>
<u-row> <u-row>
<u-col :offset="0" :span="4">发票信息</u-col> <u-col :offset="0" :span="4">发票信息</u-col>
<u-col :span="8" class="tipsColor" textAlign="right" @click.native="invoice()"> <u-col :span="8" class="tipsColor" textAlign="right" @click.native="invoice()">
<span v-if="receiptList">{{receiptList.receiptTitle}} - {{receiptList.receiptContent}}</span> <span v-if="receiptList"
>{{ receiptList.receiptTitle }} - {{ receiptList.receiptContent }}</span
>
<span v-else></span> <span v-else></span>
</u-col> </u-col>
</u-row> </u-row>
<u-row> <u-row>
<u-col v-if="orderMessage.cartTypeEnum != 'VIRTUAL'" :offset="0" :span="9" @click="shippingFlag = true"> <u-col
v-if="orderMessage.cartTypeEnum != 'VIRTUAL'"
:offset="0"
:span="9"
@click="shippingFlag = true"
>配送
</u-col> </u-col>
<u-col v-if="orderMessage.cartTypeEnum != 'VIRTUAL'" :span="3" textAlign="right" @click="shippingFlag = true"> <u-col
{{shippingMethod.find(e=>{ return e.value == shippingText; }).label }} v-if="orderMessage.cartTypeEnum != 'VIRTUAL'"
:span="3"
textAlign="right"
@click="shippingFlag = true"
>
{{
shippingMethod.find((e) => {
return e.value == shippingText;
}).label
}}
</u-col> </u-col>
</u-row> </u-row>
<u-row> <u-row>
<u-col :offset="0" :span="4" class="tl" style="text-align: left">备注信息</u-col> <u-col :offset="0" :span="4" class="tl" style="text-align: left">备注信息</u-col>
<u-col :span="8" textAlign="right"> <u-col :span="8" textAlign="right">
<u-input style="text-align:right;" class="uinput" v-model="remarkVal[index].remark" /> <u-input
style="text-align: right"
class="uinput"
v-model="remarkVal[index].remark"
/>
</u-col> </u-col>
</u-row> </u-row>
</div> </div>
@ -125,20 +197,31 @@
<div> <div>
<u-row> <u-row>
<u-col v-if="orderMessage.cartTypeEnum != 'VIRTUAL'" :span="7"></u-col> <u-col v-if="orderMessage.cartTypeEnum != 'VIRTUAL'" :span="7"></u-col>
<u-col v-if="orderMessage.cartTypeEnum != 'VIRTUAL'" :span="5" class="tr tipsColor" textAlign="right"> <u-col
v-if="orderMessage.cartTypeEnum != 'VIRTUAL'"
:span="5"
class="tr tipsColor"
textAlign="right"
>
<span v-if="orderMessage.priceDetailDTO.freightPrice == 0"></span> <span v-if="orderMessage.priceDetailDTO.freightPrice == 0"></span>
<span v-else>{{ <span v-else
orderMessage.priceDetailDTO.freightPrice | unitPrice >{{ orderMessage.priceDetailDTO.freightPrice | unitPrice }}</span
}}</span> >
</u-col> </u-col>
</u-row> </u-row>
</div> </div>
<u-row> <u-row>
<u-col :offset="0" :span="9" @click="GET_Discount()"></u-col> <u-col :offset="0" :span="9" @click="GET_Discount()"></u-col>
<u-col :span="3" v-if="orderMessage.priceDetailDTO && orderMessage.priceDetailDTO.couponPrice" textAlign="right" <u-col
@click="GET_Discount()"> :span="3"
<span class="main-color">-{{orderMessage.priceDetailDTO.couponPrice | unitPrice}}</span> v-if="orderMessage.priceDetailDTO && orderMessage.priceDetailDTO.couponPrice"
textAlign="right"
@click="GET_Discount()"
>
<span class="main-color"
>-{{ orderMessage.priceDetailDTO.couponPrice | unitPrice }}</span
>
</u-col> </u-col>
<!-- orderMessage.priceDetailDTO.couponPrice | unitPrice --> <!-- orderMessage.priceDetailDTO.couponPrice | unitPrice -->
<u-col :span="3" v-else textAlign="right" @click="GET_Discount()"> <u-col :span="3" v-else textAlign="right" @click="GET_Discount()">
@ -149,8 +232,15 @@
<div> <div>
<u-row> <u-row>
<u-col :span="9">优惠金额</u-col> <u-col :span="9">优惠金额</u-col>
<u-col :span="3" textAlign="right" v-if=" orderMessage.priceDetailDTO.couponPrice"> <u-col
<span class="main-color"> -{{ orderMessage.priceDetailDTO.couponPrice | unitPrice }}</span></u-col> :span="3"
textAlign="right"
v-if="orderMessage.priceDetailDTO.couponPrice"
>
<span class="main-color">
-{{ orderMessage.priceDetailDTO.couponPrice | unitPrice }}</span
></u-col
>
<u-col :span="3" textAlign="right" v-else>0.00</u-col> <u-col :span="3" textAlign="right" v-else>0.00</u-col>
</u-row> </u-row>
</div> </div>
@ -158,18 +248,23 @@
<u-row> <u-row>
<u-col :span="6">活动优惠</u-col> <u-col :span="6">活动优惠</u-col>
<u-col :span="6" class="tr tipsColor" textAlign="right"> <u-col :span="6" class="tr tipsColor" textAlign="right">
<span <span v-if="orderMessage.priceDetailDTO.discountPrice"
v-if="orderMessage.priceDetailDTO.discountPrice">-{{orderMessage.priceDetailDTO.discountPrice | unitPrice}}</span> >-{{ orderMessage.priceDetailDTO.discountPrice | unitPrice }}</span
>
<span v-else>0.00</span> <span v-else>0.00</span>
</u-col> </u-col>
</u-row> </u-row>
</div> </div>
</div> </div>
<!-- 配送地区没有提示 --> <!-- 配送地区没有提示 -->
<div class="notSupportFreight" v-if="notSupportFreight.length !=0"> <div class="notSupportFreight" v-if="notSupportFreight.length != 0">
<u-notice-bar style="width:100%" :volume-icon="false" mode="horizontal" :list="notSupportFreightGoodsList"> <u-notice-bar
style="width: 100%"
:volume-icon="false"
mode="horizontal"
:list="notSupportFreightGoodsList"
>
</u-notice-bar> </u-notice-bar>
</div> </div>
@ -179,11 +274,17 @@
<div class="tabbar-left"> <div class="tabbar-left">
<div v-if="!orderMessage.priceDetailDTO.payPoint" class="number"> <div v-if="!orderMessage.priceDetailDTO.payPoint" class="number">
<span>¥</span> <span>¥</span>
<span class="price">{{ formatPrice(orderMessage.priceDetailDTO.flowPrice)[0] }}</span> <span class="price">{{
<span>.{{formatPrice(orderMessage.priceDetailDTO.flowPrice)[1] }} </span> formatPrice(orderMessage.priceDetailDTO.flowPrice)[0]
}}</span>
<span>.{{ formatPrice(orderMessage.priceDetailDTO.flowPrice)[1] }} </span>
</div> </div>
<span v-else class="number"><span <span v-else class="number"
style="margin-right:10rpx;">{{orderMessage.priceDetailDTO.payPoint | unitPrice }}</span>积分</span> ><span style="margin-right: 10rpx">{{
orderMessage.priceDetailDTO.payPoint | unitPrice
}}</span
>积分</span
>
</div> </div>
<div class="navRiv" @click="createTradeFun()"> <div class="navRiv" @click="createTradeFun()">
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
@ -192,7 +293,6 @@
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<div class="tabbar-right">微信支付</div> <div class="tabbar-right">微信支付</div>
<!-- #endif --> <!-- #endif -->
</div> </div>
</div> </div>
</div> </div>
@ -348,9 +448,7 @@ export default {
this.navigateTo( this.navigateTo(
`/pages/mine/address/address?from=cart&way=${ `/pages/mine/address/address?from=cart&way=${
this.routerVal.way this.routerVal.way
}&parentOrder=${encodeURIComponent( }&parentOrder=${encodeURIComponent(JSON.stringify(this.routerVal.parentOrder))}`
JSON.stringify(this.routerVal.parentOrder)
)}`
); );
}, },
@ -378,6 +476,18 @@ export default {
// id,id // id,id
let store = []; let store = [];
let skus = []; let skus = [];
let selectedCoupon = [];
if (this.orderMessage.platformCoupon)
selectedCoupon.push(this.orderMessage.platformCoupon.memberCoupon.id);
if (
this.orderMessage.storeCoupons &&
Object.keys(this.orderMessage.storeCoupons)[0]
) {
let storeMemberCouponsId = Object.keys(this.orderMessage.storeCoupons)[0];
let storeCouponId = this.orderMessage.storeCoupons[storeMemberCouponsId]
.memberCoupon.id;
selectedCoupon.push(storeCouponId);
}
this.orderMessage.cartList.forEach((item) => { this.orderMessage.cartList.forEach((item) => {
item.skuList.forEach((sku) => { item.skuList.forEach((sku) => {
store.push(sku.storeId); store.push(sku.storeId);
@ -391,7 +501,7 @@ export default {
data: this.orderMessage.priceDetailDTO.goodsPrice, data: this.orderMessage.priceDetailDTO.goodsPrice,
}); });
this.navigateTo( this.navigateTo(
`/pages/cart/coupon/index?way=${this.routerVal.way}&storeId=${store}&skuId=${skus}` `/pages/cart/coupon/index?way=${this.routerVal.way}&storeId=${store}&skuId=${skus}&selectedCoupon=${selectedCoupon}`
); );
}, },
@ -498,8 +608,9 @@ export default {
// //
API_Address.getAddressDefault().then((res) => { API_Address.getAddressDefault().then((res) => {
if (res.data.result) { if (res.data.result) {
res.data.result.consigneeAddressPath = res.data.result.consigneeAddressPath = res.data.result.consigneeAddressPath.split(
res.data.result.consigneeAddressPath.split(","); ","
);
this.address = res.data.result; this.address = res.data.result;
} }
}); });
@ -507,7 +618,7 @@ export default {
// //
getOrderList() { getOrderList() {
this.notSupportFreight = [] this.notSupportFreight = [];
// //
API_Trade.getCheckoutParams(this.routerVal.way).then((res) => { API_Trade.getCheckoutParams(this.routerVal.way).then((res) => {
if (res.data.result.skuList.length <= 0) { if (res.data.result.skuList.length <= 0) {
@ -534,8 +645,9 @@ export default {
this.getUserAddress(); this.getUserAddress();
} else { } else {
this.address = res.data.result.memberAddress; this.address = res.data.result.memberAddress;
res.data.result.memberAddress.consigneeAddressPath = res.data.result.memberAddress.consigneeAddressPath = res.data.result.memberAddress.consigneeAddressPath.split(
res.data.result.memberAddress.consigneeAddressPath.split(","); ","
);
} }
if ( if (
@ -581,7 +693,7 @@ page {
.nums { .nums {
flex: 2; flex: 2;
color: $light-color; color: $light-color;
text-align: center; text-align: center;
} }
.wait { .wait {
@ -825,7 +937,7 @@ page {
font-size: 24rpx; font-size: 24rpx;
border-radius: 8rpx; border-radius: 8rpx;
padding: 0rpx 12rpx; padding: 0rpx 12rpx;
color: #fff; color: #fff;
margin-right: 20rpx; margin-right: 20rpx;
} }
.address-box { .address-box {