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

兑换弹框修改等

上级 140cc6b6
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}, },
methods: { methods: {
changeClick(){ changeClick(){
this.$emit("changeClick","去兑换") this.$emit("changeClick")
}, },
gotoBuy() { gotoBuy() {
this.$emit("gotoBuy"); this.$emit("gotoBuy");
......
...@@ -15,15 +15,19 @@ ...@@ -15,15 +15,19 @@
<span>激活码用于兑换课程,您可以从订单详情或已购买到实体卡查看激活码密码。激活码一旦兑换,不可退回。</span> <span>激活码用于兑换课程,您可以从订单详情或已购买到实体卡查看激活码密码。激活码一旦兑换,不可退回。</span>
</div> </div>
</article> </article>
<article class="code"> <section class="input-wrapper">
<van-field <article class="code">
v-model="activationCode" <van-field
border maxlength="23"
clearable v-model="activationCode"
label="激活码" clearable
placeholder="请输入激活码" label="激活码"
/> placeholder="请输入激活码"
</article> />
</article>
<span class="error">{{errorMsg}}</span>
</section>
<article class="bottom"> <article class="bottom">
<van-button @click="confirm" size="large" round color="#449284">确认兑换</van-button> <van-button @click="confirm" size="large" round color="#449284">确认兑换</van-button>
</article> </article>
...@@ -45,19 +49,37 @@ export default { ...@@ -45,19 +49,37 @@ export default {
// }, // },
data() { data() {
return { return {
activationCode: "" activationCode: "",
errorMsg: '请输入激活码'
}; };
}, },
watch: {
activationCode(val) {
if(!val) {
this.errorMsg = '请输入激活码';
} else {
this.errorMsg = '';
}
this.$nextTick(() => {
this.activationCode = val.replace(/\s/g,'').replace(/.....(?!$)/g,'$& ');
});
}
},
methods: { methods: {
cancle() { cancle() {
console.log('cancle'); console.log('cancle');
this.$emit("cancle"); this.$emit("cancle");
}, },
confirm() { confirm() {
// 时行校验
console.log('confirm'); console.log('confirm');
this.$emit("confirm", this.activationCode); if(!this.activationCode || this.activationCode.length != 23) return;
} let aCode = JSON.stringify(this.activationCode);
this.$emit("confirm", aCode.replace(/\s/g,''));
},
// bankCardKeyup() {
// this.id_card = val.replace(/\s/g,'').replace(/....(?!$)/g,'$& ');
// this.activationCode = this.activationCode.replace(/\s/g,'').replace(/(\.{4})(?=\.)/g, '$1 ');
// }
} }
}; };
</script> </script>
...@@ -104,11 +126,24 @@ export default { ...@@ -104,11 +126,24 @@ export default {
color: #979899; color: #979899;
} }
} }
.code { .input-wrapper {
display: flex; position: relative;
padding: px2rem(20px) 0; .code {
padding-top: 0; display: flex;
flex-direction: column;
padding: px2rem(20px) 0;
padding-top: 0;
}
.error {
position: absolute;
top: px2rem(64px);
left: px2rem(70px);
display: inline-block;
color: red;
font-size: px2rem(12px);
}
} }
.bottom { .bottom {
display: flex; display: flex;
margin-bottom: px2rem(40px); margin-bottom: px2rem(40px);
......
...@@ -112,7 +112,6 @@ ...@@ -112,7 +112,6 @@
} }
.bind-cart-wrapper .van-field__control { .bind-cart-wrapper .van-field__control {
border-radius: px2rem(4px); border-radius: px2rem(4px);
border: 1px solid #C7C8C9; border: 1px solid #C7C8C9;
padding: px2rem(7px); padding: px2rem(7px);
......
...@@ -3,18 +3,27 @@ ...@@ -3,18 +3,27 @@
<CommonNavbar <CommonNavbar
:bgColor="bgColor" :bgColor="bgColor"
v-show="showNavBar" v-show="showNavBar"
title="" title
:isFixNavbar="isFixNavbar" :isFixNavbar="isFixNavbar"
borderStyle="0px solid #fff" borderStyle="0px solid #fff"
></CommonNavbar> ></CommonNavbar>
<img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-1.png"><img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-2.png"><img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-3.png"><img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-4.png"><img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-5.png"><img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-6.png"><img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-7.png"> <img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-1.png" />
<ExjumperButton <img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-2.png" />
@btnClick="isBuy(1)" <img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-3.png" />
btnText="立即学习" <img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-4.png" />
type="primary"></ExjumperButton> <img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-5.png" />
<img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-6.png" />
<img class="img" src="https://file.yunqueyi.com/h5/images/tinified/I-detail-7.png" />
<ExjumperButton @btnClick="isBuy(1)" btnText="立即学习" type="primary"></ExjumperButton>
<!-- <img @click="isBuy(1)" class="img" src="https://file.yunqueyi.com/h5/images/tinified/i-detail-8.png"> --> <!-- <img @click="isBuy(1)" class="img" src="https://file.yunqueyi.com/h5/images/tinified/i-detail-8.png"> -->
<CardPopup :cardInfo="cardInfo" :isShow="isShowPopup" @clickOverlay="clickOverlay" @cancle="jumpToCardList" @confirm="confirm"></CardPopup> <CardPopup
:cardInfo="cardInfo"
:isShow="isShowPopup"
@clickOverlay="clickOverlay"
@cancle="jumpToCardList"
@confirm="confirm"
></CardPopup>
<Loading v-if="showLoading" /> <Loading v-if="showLoading" />
</section> </section>
</template> </template>
...@@ -23,24 +32,24 @@ import ExjumperButton from "@/components/cme/exjumper-button"; ...@@ -23,24 +32,24 @@ import ExjumperButton from "@/components/cme/exjumper-button";
import CommonNavbar from "@/components/common/common-navbar"; import CommonNavbar from "@/components/common/common-navbar";
import CardPopup from "@/components/cme/card-popup"; import CardPopup from "@/components/cme/card-popup";
import Loading from "@/components/common/common-loading"; import Loading from "@/components/common/common-loading";
import { Toast } from 'vant'; import { Toast } from "vant";
export default { export default {
data() { data() {
return { return {
bgColor: "#fff", bgColor: "#fff",
bgColor: 'none', bgColor: "none",
showNavBar: true, showNavBar: true,
isShowPopup: false, isShowPopup: false,
isFixNavbar: true, isFixNavbar: true,
oneLevelUrl: '', oneLevelUrl: "",
provinceId: 0, provinceId: 0,
organizationId: 0, organizationId: 0,
cardInfo: { cardInfo: {
id: 0 id: 0
}, },
cmeToken: '', cmeToken: "",
showLoading: false, showLoading: false
} };
}, },
components: { components: {
CommonNavbar, CommonNavbar,
...@@ -55,18 +64,21 @@ export default { ...@@ -55,18 +64,21 @@ export default {
// _this.showLoading = false; // _this.showLoading = false;
param.setEntry = true; param.setEntry = true;
_this.getProvinceIdByPosition(param); _this.getProvinceIdByPosition(param);
} };
this.oneLevelUrl = decodeURIComponent(this.$route.query && this.$route.query.oneLevelUrl || ''); this.oneLevelUrl = decodeURIComponent(
this.provinceId = this.$route.query && this.$route.query.provinceId || 0; (this.$route.query && this.$route.query.oneLevelUrl) || ""
this.organizationId = this.$route.query && this.$route.query.organizationId || 0; );
this.cmeToken = this.$route.query && this.$route.query.cmeToken || ''; this.provinceId = (this.$route.query && this.$route.query.provinceId) || 0;
this.organizationId =
(this.$route.query && this.$route.query.organizationId) || 0;
this.cmeToken = (this.$route.query && this.$route.query.cmeToken) || "";
// this.getProvinceIdByPosition(); // this.getProvinceIdByPosition();
}, },
methods: { methods: {
// 点击弹层 // 点击弹层
clickOverlay() { clickOverlay() {
console.log('clickOverlay'); console.log("clickOverlay");
this.isShowPopup = false; this.isShowPopup = false;
}, },
...@@ -79,13 +91,13 @@ export default { ...@@ -79,13 +91,13 @@ export default {
let param = { let param = {
cardType: cardType, cardType: cardType,
token: this.cmeToken, token: this.cmeToken,
setEntry: true, setEntry: true
} };
this.GET("trade/storage/card/isBuy", param).then(res => { this.GET("trade/storage/card/isBuy", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
// 如果购买过,则直接跳转到中华医学会页面 // 如果购买过,则直接跳转到中华医学会页面
if(res.data) { if (res.data) {
this.jumpToCardList(); this.jumpToCardList();
} else { } else {
this.preJumper(); this.preJumper();
} }
...@@ -93,12 +105,12 @@ export default { ...@@ -93,12 +105,12 @@ export default {
// else { // else {
// Toast(res.message); // Toast(res.message);
// } // }
}); });
}, },
// 跳转前判断是否有机构,否则使用定位信息 // 跳转前判断是否有机构,否则使用定位信息
preJumper() { preJumper() {
if(this.organizationId != 0 && this.provinceId != 0) { if (this.organizationId != 0 && this.provinceId != 0) {
this.getCardInfoByProvinceId(this.provinceId); this.getCardInfoByProvinceId(this.provinceId);
} else { } else {
this.getPositionData(); this.getPositionData();
...@@ -107,7 +119,7 @@ export default { ...@@ -107,7 +119,7 @@ export default {
// 获取地理位置信息 // 获取地理位置信息
getPositionData() { getPositionData() {
console.log('getPositionData'); console.log("getPositionData");
rocNative.getPositionData({ rocNative.getPositionData({
__funcName: "__getPositionData" __funcName: "__getPositionData"
}); });
...@@ -116,30 +128,32 @@ export default { ...@@ -116,30 +128,32 @@ export default {
// 根据省ID,获取学习卡信息 // 根据省ID,获取学习卡信息
getCardInfoByProvinceId(provinceId) { getCardInfoByProvinceId(provinceId) {
let param = { let param = {
"area": provinceId + '', area: provinceId + "",
"cardType": 1, cardType: 1,
"pageNum": 1, pageNum: 1,
"pageSize": 1 pageSize: 1
} };
this.POST("trade/goods/cardList", param).then(res => { this.POST("trade/goods/cardList", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
this.showLoading = false; this.showLoading = false;
this.isShowPopup = true; this.isShowPopup = true;
this.cardInfo = res.data && res.data[0] || {id: 0} ; this.cardInfo = (res.data && res.data[0]) || { id: 0 };
} }
}); });
}, },
// 根据位置信息获取省ID // 根据位置信息获取省ID
getProvinceIdByPosition(param) { getProvinceIdByPosition(param) {
param.setEntry = true; param.setEntry = true;
this.POST("aggregate/cme/convertLocationToProvinceId", param).then(res => { this.POST("aggregate/cme/convertLocationToProvinceId", param).then(
if (res.code == "000000") { res => {
this.getCardInfoByProvinceId(res.data || 0); if (res.code == "000000") {
} else { this.getCardInfoByProvinceId(res.data || 0);
this.getCardInfoByProvinceId(0); } else {
this.getCardInfoByProvinceId(0);
}
} }
}); );
}, },
// 跳转到原生的购买页面 // 跳转到原生的购买页面
...@@ -148,7 +162,8 @@ export default { ...@@ -148,7 +162,8 @@ export default {
let paramList = [ let paramList = [
{ {
key: "className", key: "className",
value: "com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC", value:
"com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
type: 4, type: 4,
seqNo: 1 seqNo: 1
}, },
...@@ -189,24 +204,24 @@ export default { ...@@ -189,24 +204,24 @@ export default {
// 此字段不配置,则用原来的逻辑 // 此字段不配置,则用原来的逻辑
{ {
key: "needCache", key: "needCache",
value: '1', // 0不缓存,其它值都做缓存 value: "1", // 0不缓存,其它值都做缓存
type: 4, type: 4,
seqNo: 1 seqNo: 1
}, }
] ];
rocNative.dispatchEventByModuleCode({ rocNative.dispatchEventByModuleCode({
modeCode: "M300", modeCode: "M300",
jsonString: paramList jsonString: paramList
}); });
} }
} }
}, }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../style/mixin"; @import "../style/mixin";
.cd-wrapper { .cd-wrapper {
background: #F8F9FA; background: #f8f9fa;
padding-bottom: 80px; padding-bottom: 80px;
.img { .img {
margin-top: -15px; margin-top: -15px;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册