提交 8654accf 编写于 作者: guangjun.yang's avatar guangjun.yang

弹框:我知道了

上级 c455efc5
...@@ -8,11 +8,11 @@ export const envConfig = { ...@@ -8,11 +8,11 @@ export const envConfig = {
// baseUrl: 'http://10.177.15.180:10202/', // baseUrl: 'http://10.177.15.180:10202/',
// baseUrl: 'http://192.168.140.14:10201/', // baseUrl: 'http://192.168.140.14:10201/',
apiUrl: 'https://dev-api.yunqueyi.com/', apiUrl: 'https://test1-api.yunqueyi.com/',
baseUrl: 'https://dev-sc.yunqueyi.com/', baseUrl: 'https://test1-sc.yunqueyi.com/',
webPageUrl: 'https://dev-phome.yunqueyi.com/', webPageUrl: 'https://test1-phome.yunqueyi.com/',
hactiveUrl: 'https://dev-hactive.yunqueyi.com', hactiveUrl: 'https://test1-hactive.yunqueyi.com',
fileUrl: 'https://dev-www.yunqueyi.com', fileUrl: 'https://test1-www.yunqueyi.com',
appId: 'wx08b383d002c73f26', // 用于微信授权登录 appId: 'wx08b383d002c73f26', // 用于微信授权登录
wxType: 15, // 分享、用户信息对应的appid wxType: 15, // 分享、用户信息对应的appid
tradeType: 4, tradeType: 4,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
:isFixNavbar="isFixNavbar" :isFixNavbar="isFixNavbar"
:shareUrl="shareUrl" :shareUrl="shareUrl"
borderStyle="0px solid #fff" borderStyle="0px solid #fff"
></CommonNavbar> ></CommonNavbar>
<!-- 轮播 --> <!-- 轮播 -->
<div class="swiper-box"> <div class="swiper-box">
<van-swipe :show-indicators="false" @change="onSwiperChange"> <van-swipe :show-indicators="false" @change="onSwiperChange">
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<div <div
class="btn" class="btn"
:class="[goods.isSale === 2 ? 'cannot-buy' : 'can-but']" :class="[goods.isSale === 2 ? 'cannot-buy' : 'can-but']"
@click="createOrder" @click="preCreateOrder"
>{{ goods.isSale === 2 ? '商品已下架' : '确认支付' }}</div> >{{ goods.isSale === 2 ? '商品已下架' : '确认支付' }}</div>
</div> </div>
<Loading v-show="showLoading" /> <Loading v-show="showLoading" />
...@@ -108,6 +108,15 @@ ...@@ -108,6 +108,15 @@
:isShowDialog="isShowDialog" :isShowDialog="isShowDialog"
@handlerAction="handlerAction" @handlerAction="handlerAction"
></CourseDialog> ></CourseDialog>
<ShowCantBuyTips
subContent="您所在的省份暂无法录入该继续医学教育项目学分,请勿购买。"
cancleBtnText="我知道了"
isSingle
needSubContent
:isShowDialog="isShowCantBuyTips"
@handlerAction="isShowCantBuyTips=false"
></ShowCantBuyTips>
</div> </div>
</template> </template>
...@@ -115,6 +124,7 @@ ...@@ -115,6 +124,7 @@
import { Swipe, SwipeItem } from "vant"; import { Swipe, SwipeItem } from "vant";
import Loading from "@/components/common/common-loading"; import Loading from "@/components/common/common-loading";
import CourseDialog from "@/components/course/course-dialog"; import CourseDialog from "@/components/course/course-dialog";
import ShowCantBuyTips from "@/components/course/course-dialog";
import CouponSelectList from "@/components/coupon/component-select-list"; import CouponSelectList from "@/components/coupon/component-select-list";
import CommonNavbar from "@/components/common/common-navbar"; import CommonNavbar from "@/components/common/common-navbar";
...@@ -130,7 +140,7 @@ import { ...@@ -130,7 +140,7 @@ import {
} from "@/utils"; } from "@/utils";
import { mapGetters, mapActions } from "vuex"; import { mapGetters, mapActions } from "vuex";
import { convertToYuan } from "@/utils"; import { convertToYuan } from "@/utils";
import { setCookie, getCookie, delCookie } from '@/utils/index'; import { setCookie, getCookie, delCookie } from "@/utils/index";
const isWechat = isWeiXin(); const isWechat = isWeiXin();
// wxConfig(location.href); // wxConfig(location.href);
...@@ -141,7 +151,8 @@ export default { ...@@ -141,7 +151,8 @@ export default {
Loading, Loading,
CourseDialog, CourseDialog,
CouponSelectList, CouponSelectList,
CommonNavbar CommonNavbar,
ShowCantBuyTips
}, },
data() { data() {
return { return {
...@@ -174,6 +185,7 @@ export default { ...@@ -174,6 +185,7 @@ export default {
// shareTitle: goods.goodsName, // shareTitle: goods.goodsName,
shareTitleInfo: "", shareTitleInfo: "",
isShowShare: true, isShowShare: true,
isShowCantBuyTips: false,
}; };
}, },
computed: { computed: {
...@@ -205,7 +217,7 @@ export default { ...@@ -205,7 +217,7 @@ export default {
} }
}, },
deep: true deep: true
}, }
}, },
created() { created() {
...@@ -264,7 +276,10 @@ export default { ...@@ -264,7 +276,10 @@ export default {
if (this.isWeb) { if (this.isWeb) {
let { token, info } = this.$store.state.user; let { token, info } = this.$store.state.user;
token = token || localStorage.getItem("couponToken") || getCookie("couponToken"); token =
token ||
localStorage.getItem("couponToken") ||
getCookie("couponToken");
this.token = token; this.token = token;
console.log("token && !info.id", !info.id, token); console.log("token && !info.id", !info.id, token);
...@@ -276,7 +291,7 @@ export default { ...@@ -276,7 +291,7 @@ export default {
if (token && !info.id) { if (token && !info.id) {
this.commonCheckToken(() => { this.commonCheckToken(() => {
this.$store.dispatch("getUserInfo"); this.$store.dispatch("getUserInfo");
}); });
return; return;
} }
// 从登陆页面过来时 // 从登陆页面过来时
...@@ -284,7 +299,6 @@ export default { ...@@ -284,7 +299,6 @@ export default {
} else { } else {
this.getUserInfo(); this.getUserInfo();
} }
}, },
methods: { methods: {
...mapActions([ ...mapActions([
...@@ -300,7 +314,7 @@ export default { ...@@ -300,7 +314,7 @@ export default {
// 有且选择了优惠券,则直接显示优惠券的优惠价格 // 有且选择了优惠券,则直接显示优惠券的优惠价格
if (this.currentCoupon.couponId) { if (this.currentCoupon.couponId) {
text = "-¥" + this.yuan(this.currentCoupon.discountAmount); text = "-¥" + this.yuan(this.currentCoupon.discountAmount);
// 如果没有选择优惠券 // 如果没有选择优惠券
} else { } else {
if (this.goodsInfo4Coupon.count) { if (this.goodsInfo4Coupon.count) {
text = this.goodsInfo4Coupon.count + "张优惠券"; text = this.goodsInfo4Coupon.count + "张优惠券";
...@@ -314,24 +328,25 @@ export default { ...@@ -314,24 +328,25 @@ export default {
// 查询我的可用优惠券 // 查询我的可用优惠券
getCanUseCoupons(params) { getCanUseCoupons(params) {
const { goodsType, cardType, price } = params; const { goodsType, cardType, price } = params;
this.GET(`trade/coupon/app/goodsCoupons`, { goodsType, cardType, amount: price }).then( this.GET(`trade/coupon/app/goodsCoupons`, {
res => { goodsType,
if (res.code == "000000") { cardType,
params.count = (res.data || []).length; amount: price
this.setGoodsInfo4Coupon(params); }).then(res => {
this.handlerCouponList(res.data || [], params.price); if (res.code == "000000") {
// 设置优惠券个数 params.count = (res.data || []).length;
} else { this.setGoodsInfo4Coupon(params);
params.count = 0; this.handlerCouponList(res.data || [], params.price);
this.setGoodsInfo4Coupon(params); // 设置优惠券个数
this.setCurrentCoupon({}); } else {
this.setSelectCouponList([]); params.count = 0;
} this.setGoodsInfo4Coupon(params);
this.setCurrentCoupon({});
this.setSelectCouponList([]);
} }
); });
}, },
// 处理数据,并且先排序,再将不可用的放在最后 // 处理数据,并且先排序,再将不可用的放在最后
handlerCouponList(couponList, goodsPrice) { handlerCouponList(couponList, goodsPrice) {
if (!couponList.length) return []; if (!couponList.length) return [];
...@@ -341,12 +356,12 @@ export default { ...@@ -341,12 +356,12 @@ export default {
firstCanCouponIndex = 0, firstCanCouponIndex = 0,
item = {}, item = {},
count = 0; count = 0;
for(let i = 0; i < couponList.length; i ++) { for (let i = 0; i < couponList.length; i++) {
item = couponList[i]; item = couponList[i];
// 要根据商品价格及券适用类型来计算 // 要根据商品价格及券适用类型来计算
item.disabled = !item.enableFlag; item.disabled = !item.enableFlag;
if(!item.disabled) { if (!item.disabled) {
count ++; count++;
} }
// 是否已经选择 // 是否已经选择
item.isChecked = !!item.checkFlag; item.isChecked = !!item.checkFlag;
...@@ -357,7 +372,7 @@ export default { ...@@ -357,7 +372,7 @@ export default {
newList.push(item); newList.push(item);
} }
this.setCurrentCoupon( JSON.parse(JSON.stringify(firstCanCoupon)) || {}); this.setCurrentCoupon(JSON.parse(JSON.stringify(firstCanCoupon)) || {});
this.setSelectCouponList(newList); this.setSelectCouponList(newList);
this.goodsInfo4Coupon.count = count; this.goodsInfo4Coupon.count = count;
this.setGoodsInfo4Coupon(this.goodsInfo4Coupon); this.setGoodsInfo4Coupon(this.goodsInfo4Coupon);
...@@ -427,7 +442,7 @@ export default { ...@@ -427,7 +442,7 @@ export default {
showCouponPopup() { showCouponPopup() {
this.commonCheckToken(() => { this.commonCheckToken(() => {
this.isShowCoupon = true; this.isShowCoupon = true;
}) });
}, },
// 设置当前选中的优惠券 // 设置当前选中的优惠券
...@@ -452,7 +467,7 @@ export default { ...@@ -452,7 +467,7 @@ export default {
// 获取商品信息 // 获取商品信息
getGoodsInfo() { getGoodsInfo() {
if(!this.goodsId) { if (!this.goodsId) {
return; return;
} }
this.commonCheckToken(() => { this.commonCheckToken(() => {
...@@ -461,9 +476,11 @@ export default { ...@@ -461,9 +476,11 @@ export default {
const goods = res.data; const goods = res.data;
const tabs = []; const tabs = [];
let priceNew = goods.preferentialPrice || goods.costPrice; let priceNew = goods.preferentialPrice || goods.costPrice;
let price = goods.couponPrice || goods.preferentialPrice || goods.costPrice; let price =
goods.couponPrice || goods.preferentialPrice || goods.costPrice;
this.goods = goods; this.goods = goods;
this.defaultCouponId = (goods.couponDTO && goods.couponDTO.couponId) || ''; this.defaultCouponId =
(goods.couponDTO && goods.couponDTO.couponId) || "";
// 获取到商品后,再获取优惠券 // 获取到商品后,再获取优惠券
this.getCanUseCoupons({ this.getCanUseCoupons({
goodsType: goods.goodsType, goodsType: goods.goodsType,
...@@ -484,9 +501,10 @@ export default { ...@@ -484,9 +501,10 @@ export default {
100 100
).toFixed(2); ).toFixed(2);
} else { } else {
savePrice = ((goods.costPrice - goods.couponPrice) / 100).toFixed( savePrice = (
2 (goods.costPrice - goods.couponPrice) /
); 100
).toFixed(2);
} }
} }
if (goods.goodsDescWhere) { if (goods.goodsDescWhere) {
...@@ -539,10 +557,13 @@ export default { ...@@ -539,10 +557,13 @@ export default {
getTotalPrice(currentCoupon) { getTotalPrice(currentCoupon) {
const num = this.curtGoodsNum; const num = this.curtGoodsNum;
let couponId = 0; let couponId = 0;
if(currentCoupon) { if (currentCoupon) {
couponId = currentCoupon.couponId || -1; couponId = currentCoupon.couponId || -1;
} }
this.GET(`trade/goods/getPrice/${this.goodsId}/${num}/${couponId}`, {}).then(res => { this.GET(
`trade/goods/getPrice/${this.goodsId}/${num}/${couponId}`,
{}
).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
const { const {
couponPrice, couponPrice,
...@@ -561,7 +582,7 @@ export default { ...@@ -561,7 +582,7 @@ export default {
this.goodsInfo4Coupon.price = preferentialPrice || costPrice; this.goodsInfo4Coupon.price = preferentialPrice || costPrice;
this.setGoodsInfo4Coupon(this.goodsInfo4Coupon); this.setGoodsInfo4Coupon(this.goodsInfo4Coupon);
this.goodsNum = num; this.goodsNum = num;
if(this.needSortAndSelect) { if (this.needSortAndSelect) {
this.getCanUseCoupons(this.goodsInfo4Coupon); this.getCanUseCoupons(this.goodsInfo4Coupon);
// this.handlerCouponList(this.selectCouponList, preferentialPrice || costPrice); // this.handlerCouponList(this.selectCouponList, preferentialPrice || costPrice);
} }
...@@ -647,86 +668,112 @@ export default { ...@@ -647,86 +668,112 @@ export default {
this.isShowDialog = false; this.isShowDialog = false;
}, },
// 判断是否能购买
preCreateOrder() {
this.commonCheckToken(() => {
const { goodsType, cardType } = this.goods;
console.log('goodsType, cardType', goodsType, cardType);
// 只有一类卡才做相应判断
if (goodsType == 2 && cardType == 1) {
this.GET(
`trade/goods/sale/checkProvince?goodsType=${goodsType}&cardType=${cardType}`,
{}
).then(({ data }) => {
if (data == 1) {
this.createOrder();
} else {
this.isShowCantBuyTips = true;
}
});
} else {
this.createOrder();
}
});
},
// 创建订单 // 创建订单
createOrder() { createOrder() {
this.$sendBuriedData({ this.$sendBuriedData({
component_tag: `888#88803` component_tag: `888#88803`
}); });
this.commonCheckToken(() => { // 微信内先去授权
// 微信内先去授权 if (isWechat && !this.wxInfo.openid) {
if (isWechat && !this.wxInfo.openid) { this.isShowDialog = true;
this.isShowDialog = true; return;
return; }
}
// 避免多次支付 // 避免多次支付
if (this.showLoading) { if (this.showLoading) {
return; return;
} }
const { id, couponDTO, isSale } = this.goods; const { id, couponDTO, isSale } = this.goods;
const { preferentialPrice, costPrice } = this.totalPrice; const { preferentialPrice, costPrice } = this.totalPrice;
if (!id || isSale !== 1) { if (!id || isSale !== 1) {
return; return;
} }
// 重新使用优惠券 // 重新使用优惠券
let couponId = this.currentCoupon && this.currentCoupon.couponId || 0; let couponId = (this.currentCoupon && this.currentCoupon.couponId) || 0;
const orderData = { const orderData = {
couponId: couponId, couponId: couponId,
// couponId: couponDTO ? couponDTO.couponId : 0, // couponId: couponDTO ? couponDTO.couponId : 0,
goodsId: id, goodsId: id,
goodsQuantity: this.goodsNum, goodsQuantity: this.goodsNum,
orderSource: 3, orderSource: 3,
preferentialPrice: this.goods.preferentialPrice, preferentialPrice: this.goods.preferentialPrice,
price: this.goods.costPrice price: this.goods.costPrice
}; };
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) 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;
this.orderId = res.data.orderId; this.orderId = res.data.orderId;
// if (isWechat) { // if (isWechat) {
// this.goWxPayInner(orderId); // this.goWxPayInner(orderId);
// } else { // } else {
// this.goWxPayOut(orderId); // this.goWxPayOut(orderId);
// } // }
// 在站外,则调用站外支付 // 在站外,则调用站外支付
console.log("this.isWeb ... isWechat - 2 this.orderId", this.isWeb, isWechat, this.orderId); console.log(
if (this.isWeb) { "this.isWeb ... isWechat - 2 this.orderId",
console.log("in web..."); this.isWeb,
if (isWechat) { isWechat,
this.goWxPayInner(orderId); this.orderId
} else { );
this.goWxPayOut(orderId); if (this.isWeb) {
} console.log("in web...");
if (isWechat) {
this.goWxPayInner(orderId);
} else { } else {
console.log("not in web..."); this.goWxPayOut(orderId);
rocNative.WXpay({
__funcName: "__WXpay",
orderId: String(orderId)
});
}
if (this.projectId) {
this.createRelation(this.projectId, orderId);
} }
} else { } else {
this.$toast(res.message); console.log("not in web...");
this.showLoading = false; rocNative.WXpay({
if (res.code === "200006") { __funcName: "__WXpay",
this.$store.dispatch("logout"); orderId: String(orderId)
} });
} }
})
.catch(() => { if (this.projectId) {
this.createRelation(this.projectId, orderId);
}
} else {
this.$toast(res.message);
this.showLoading = false; this.showLoading = false;
}); if (res.code === "200006") {
}); this.$store.dispatch("logout");
}
}
})
.catch(() => {
this.showLoading = false;
});
}, },
// 微信内支付 // 微信内支付
...@@ -811,17 +858,21 @@ export default { ...@@ -811,17 +858,21 @@ export default {
// 绑定项目和订单的关系(idType=1),这里只判断cardType是否为4 // 绑定项目和订单的关系(idType=1),这里只判断cardType是否为4
createRelation(projectId, orderId) { createRelation(projectId, orderId) {
let idType = 1, channel = 1; let idType = 1,
if(this.goods.cardType == 4) { channel = 1;
if (this.goods.cardType == 4) {
idType = 2; idType = 2;
} }
if(this.isWeb) { if (this.isWeb) {
channel = 3; channel = 3;
} }
let cardType = this.goods.cardType; let cardType = this.goods.cardType;
this.POST(`cme/projectCard/correlation/${idType}/${projectId}/${orderId}`, { this.POST(
channel: channel `cme/projectCard/correlation/${idType}/${projectId}/${orderId}`,
}).then(res => { {
channel: channel
}
).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
// //
} else { } else {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册