提交 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,
......
...@@ -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);
...@@ -284,7 +299,6 @@ export default { ...@@ -284,7 +299,6 @@ export default {
} else { } else {
this.getUserInfo(); this.getUserInfo();
} }
}, },
methods: { methods: {
...mapActions([ ...mapActions([
...@@ -314,8 +328,11 @@ export default { ...@@ -314,8 +328,11 @@ 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,
cardType,
amount: price
}).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
params.count = (res.data || []).length; params.count = (res.data || []).length;
this.setGoodsInfo4Coupon(params); this.setGoodsInfo4Coupon(params);
...@@ -327,11 +344,9 @@ export default { ...@@ -327,11 +344,9 @@ export default {
this.setCurrentCoupon({}); this.setCurrentCoupon({});
this.setSelectCouponList([]); 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,13 +668,35 @@ export default { ...@@ -647,13 +668,35 @@ 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;
...@@ -671,7 +714,7 @@ export default { ...@@ -671,7 +714,7 @@ export default {
} }
// 重新使用优惠券 // 重新使用优惠券
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,
...@@ -696,7 +739,12 @@ export default { ...@@ -696,7 +739,12 @@ export default {
// } // }
// 在站外,则调用站外支付 // 在站外,则调用站外支付
console.log("this.isWeb ... isWechat - 2 this.orderId", this.isWeb, isWechat, this.orderId); console.log(
"this.isWeb ... isWechat - 2 this.orderId",
this.isWeb,
isWechat,
this.orderId
);
if (this.isWeb) { if (this.isWeb) {
console.log("in web..."); console.log("in web...");
if (isWechat) { if (isWechat) {
...@@ -726,7 +774,6 @@ export default { ...@@ -726,7 +774,6 @@ export default {
.catch(() => { .catch(() => {
this.showLoading = false; 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(
`cme/projectCard/correlation/${idType}/${projectId}/${orderId}`,
{
channel: channel channel: channel
}).then(res => { }
).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
// //
} else { } else {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册