提交 0a705d4d 编写于 作者: guangjun.yang's avatar guangjun.yang

状态等

商品新接口等
上级 058de8ea
......@@ -3,24 +3,24 @@
<li class="list" v-for="(item, index) in dataList" :key="index">
<section class="item">
<div class="left">
<p class="name" :class="{'status': !item.showStatus}">{{item.couponName}}</p>
<p class="name" :class="{'status': !item.disabled}">{{item.couponName}}</p>
<div class="other">
<p v-if="item.validTimeType == 2" class="time-end" :class="{'status': !item.showStatus}">
<span v-if="item.couponStatus == 1">距离到期仅剩<span class="coupon-pc"> {{item.validTimeSpan}} </span></span>
<p v-if="item.validTimeType == 2" class="time-end" :class="{'status': !item.disabled}">
<span v-if="item.couponStatus == 1">距离到期仅剩<span class="coupon-pc"> {{item.validLeftDays}} </span></span>
<span v-else>领取后{{item.validTimeSpan}}天内有效</span>
</p>
<p v-else class="time-end" :class="{'status': !item.showStatus}">{{parseTime(item.startTime)}}{{parseTime(item.expireTime)}}</p>
<p v-else class="time-end" :class="{'status': !item.disabled}">{{parseTime(item.startTime)}}{{parseTime(item.expireTime)}}</p>
<p v-show="!item.isAll" class="rules">
<span :class="{'status': !item.showStatus}" @click="toggleRules(item)">使用规则</span>
<span :class="{'status': !item.disabled}" @click="toggleRules(item)">使用规则</span>
<img v-if="item.showRules" src="../../images/coupon/arrow-down.png" alt="">
<img v-else src="../../images/coupon/arrow-up.png" alt="">
</p>
<article v-show="!item.showStatus" class="status-wrapper">
<article v-show="!item.disabled" class="status-wrapper">
<img v-if="item.isAll && item.couponStatus == 3" src="../../images/coupon/status-lw.png" alt="">
<img v-if="item.isAll && (item.couponStatus == 4 || item.couponStatus == 5 || item.couponStatus == 6)" src="../../images/coupon/status-sx.png" alt="">
<img v-if="item.isAll && (item.couponStatus == 5 || item.couponStatus == 6)" src="../../images/coupon/status-sx.png" alt="">
<img v-if="!item.isAll && item.couponStatus == 6" src="../../images/coupon/status-sy.png" alt="">
<img v-if="!item.isAll && (item.couponStatus == 3 || item.couponStatus == 4 || item.couponStatus == 5)" src="../../images/coupon/status-gq.png" alt="">
<img v-if="!item.isAll && (item.couponStatus == 3 || item.couponStatus == 5)" src="../../images/coupon/status-gq.png" alt="">
<!-- <img v-else-if="item.couponStatus == 4" src="../../images/coupon/status-gq.png" alt="">
<img v-else-if="item.couponStatus == 5" src="../../images/coupon/status-gq.png" alt="">
......@@ -28,13 +28,13 @@
</article>
</div>
</div>
<div class="right" :class="{'around': !item.showStatus}">
<div class="right" :class="{'around': !item.disabled}">
<div class="top">
<p class="coupon-pc"><span class="symbol">¥</span><span class="price" :class="{'opacity': !item.showStatus}">{{yuan(item.discountAmount)}}</span></p>
<p class="desc" :class="{'opacity': !item.showStatus}">满{{yuan(item.requiredTotalFee)}}元可用</p>
<p class="coupon-pc"><span class="symbol">¥</span><span class="price" :class="{'opacity': !item.disabled}">{{yuan(item.discountAmount)}}</span></p>
<p class="desc" :class="{'opacity': !item.disabled}">满{{yuan(item.requiredTotalFee)}}元可用</p>
</div>
<span v-show="item.showStatus" class="btn coupon-pc" @click="revieveOrUse(item)">{{getBtnText(item)}}</span>
<!-- <span v-show="item.showStatus && !showBtn" class="btn-no">未开始</span> -->
<span v-show="item.disabled && item.couponStatus != 4" class="btn coupon-pc" @click="revieveOrUse(item)">{{getBtnText(item)}}</span>
<span v-show="item.disabled && item.couponStatus == 4" class="btn-no">未开始</span>
</div>
</section>
<section v-show="item.showRules" class="rule-list">
......
......@@ -72,18 +72,6 @@ export default {
type: Boolean,
default: true
},
// currentCoupon: {
// type: Object,
// default: () => {
// return {};
// }
// }
// goodsInfo4Coupon: {
// type: Object,
// default: () => {
// return {};
// }
// }
},
data() {
......@@ -95,7 +83,6 @@ export default {
//
watch: {
isShowCoupon: {
// 处理是否可用
handler(newVal) {
// 如果打开了选择弹框,则重新选中已经选中的项目
if (newVal) {
......@@ -103,12 +90,6 @@ export default {
}
}
},
// 监听当前商品信息,如果价格改变,则要重新计算选择列表是否可用
// goodsInfo4Coupon: {
// handler(goodsInfo) {},
// deep: true
// }
},
computed: {
......
......@@ -152,7 +152,7 @@ export default {
// 是否显示对应的规则
item.showRules = false;
// 是否可用
item.showStatus = item.couponStatus == 0 || item.couponStatus == 1;
item.disabled = item.couponStatus == 0 || item.couponStatus == 1 || item.couponStatus == 4;
newList.push(item);
});
console.log(newList);
......@@ -180,6 +180,18 @@ export default {
// 区分是否是我的优惠券
searchCoupons() {
this.wechatShare(
{
link: this.shareUrl,
title: "优惠券中心",
friendtitle: "优惠券中心",
desc: "优惠券中心",
imgUrl: "https://file.yunqueyi.com/logo.png"
},
() => {
console.log("share success...");
}
);
if(this.fromPage) {
this.getMyCoupons();
} else {
......
......@@ -14,8 +14,8 @@
<p class="title">{{ goods.goodsName }}</p>
<div class="price">
<div class="money">
<span class="yuan">{{ goods.salePrice.yuan }}</span>
<span class="fen">.{{ goods.salePrice.fen }}</span>
<span class="yuan">{{ goods.salePriceNew.yuan }}</span>
<span class="fen">.{{ goods.salePriceNew.fen }}</span>
<span v-if="goods.hasDiscount" class="del">原价: ¥{{ goods.costPriceText }}</span>
</div>
<div class="bought">{{ goods.saledNum }}购买</div>
......@@ -131,6 +131,7 @@ export default {
token: "",
isWeb: window.__isWeb,
goods: {
salePriceNew: {},
salePrice: {}
}, // 商品信息
totalPrice: {}, // 底部价格
......@@ -145,6 +146,7 @@ export default {
isShowCoupon: false, //是否展示激活弹框,
courseUrl: "",
defaultCouponId: "",
needSortAndSelect: true,
};
},
computed: {
......@@ -351,6 +353,7 @@ export default {
// 商品详情接口已经选择了一张, 则使用默认的
if(this.defaultCouponId) {
console.log('in this.defaultCouponId', this.defaultCouponId);
let cCoupon = couponList.find( item => {
return item.couponId == this.defaultCouponId;
});
......@@ -454,7 +457,9 @@ export default {
this.setCurrentCoupon(currentCoupon);
this.getCPText();
this.isShowCoupon = false;
this.needSortAndSelect = false;
// 要重新调用计算价格接口
this.countTotalPrice();
// this.getTotalPrice(currentCoupon);
},
......@@ -474,17 +479,18 @@ export default {
if (res.code == "000000") {
const goods = res.data;
const tabs = [];
let price =
goods.couponPrice || goods.preferentialPrice || goods.costPrice;
let priceNew = goods.preferentialPrice || goods.costPrice;
let price = goods.couponPrice || goods.preferentialPrice || goods.costPrice;
this.goods = goods;
this.defaultCouponId = goods.couponId;
this.defaultCouponId = (goods.couponDTO && goods.couponDTO.couponId) || '';
// 获取到商品后,再获取优惠券
this.getCanUseCoupons({
goodsType: goods.goodsType,
cardType: goods.cardType,
price: price,
price: priceNew,
count: 0
});
goods.salePriceNew = this.formatPrice(priceNew);
goods.salePrice = this.formatPrice(price);
goods.costPriceText = (goods.costPrice / 100).toFixed(2);
goods.hasDiscount = !!(goods.couponPrice || goods.preferentialPrice);
......@@ -551,10 +557,10 @@ export default {
// TODO,要多传优惠券id参数
getTotalPrice(coupon) {
console.log('coupon', coupon);
// const couponId = this.currentCoupon.couponId || 0;
const num = this.curtGoodsNum;
// this.GET(`trade/goods/getPrice/${this.goodsId}/${num}/${couponId}`, {}).then(res => {
this.GET(`trade/goods/getPrice/${this.goodsId}/${num}`, {}).then(res => {
const couponId = this.currentCoupon.couponId || -1;
this.GET(`trade/goods/getPrice/${this.goodsId}/${num}/${couponId}`, {}).then(res => {
if (res.code == "000000") {
const {
couponPrice,
......@@ -570,10 +576,13 @@ export default {
costPriceText: (costPrice / 100).toFixed(2),
savePrice: savePrice ? (savePrice / 100).toFixed(2) : 0
};
this.goodsInfo4Coupon.price = price;
this.goodsInfo4Coupon.price = preferentialPrice || costPrice;
this.setGoodsInfo4Coupon(this.goodsInfo4Coupon);
this.handlerCouponList(this.selectCouponList, price);
this.goodsNum = num;
if(this.needSortAndSelect) {
this.handlerCouponList(this.selectCouponList, preferentialPrice || costPrice);
}
this.needSortAndSelect = true;
} else if (res.code === "200006") {
this.$store.dispatch("logout");
}
......@@ -702,9 +711,15 @@ export default {
if (!id || isSale !== 1) {
return;
}
// 重新使用优惠券
let couponId = this.currentCoupon && this.currentCoupon.couponId || 0;
// if(!couponId) {
// couponId = couponDTO ? couponDTO.couponId : 0;
// }
const orderData = {
couponId: couponId,
// couponId: couponDTO ? couponDTO.couponId : 0,
couponId: couponDTO ? couponDTO.couponId : 0,
goodsId: id,
goodsQuantity: this.goodsNum,
orderSource: 3,
......@@ -713,7 +728,8 @@ export default {
};
console.log("orderData...", orderData);
this.showLoading = true;
this.POST("trade/center/order/createV2", orderData)
// this.POST("trade/center/order/createV2", orderData)
this.POST("trade/center/order/createV4", orderData)
.then(res => {
if (res.code == "000000") {
const orderId = res.data.orderId;
......@@ -756,6 +772,7 @@ export default {
});
});
},
// 微信内支付
goWxPayInner(orderId) {
const data = {
......@@ -799,6 +816,7 @@ export default {
this.showLoading = false;
});
},
// 站外微信支付
goWxPayOut(orderId) {
const data = {
......@@ -825,6 +843,8 @@ export default {
this.showLoading = false;
});
},
// 设置微信重定向URL
getRedirectUrl(orderId) {
let path = `profexam/#/prezult?orderId=${orderId}`;
if (this.projectId) {
......@@ -832,6 +852,7 @@ export default {
}
return getWebPageUrl(path);
},
// 绑定项目和订单的关系(idType=1)
createRelation(projectId, orderId) {
this.POST(`cme/projectCard/correlation/1/${projectId}/${orderId}`, {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册