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

状态等

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