Commit e2dfd947 authored by 郭志伟's avatar 郭志伟

Merge branch 'fix/goods' into 'master'

Fix/goods

See merge request !103
parents bc04df4b 97b6c50a
...@@ -46,6 +46,19 @@ export default { ...@@ -46,6 +46,19 @@ export default {
immediate: true, immediate: true,
handler(val) { handler(val) {
this.showAuth = !!this.userInfo.length && val === 2; this.showAuth = !!this.userInfo.length && val === 2;
if (this.showAuth) {
this.$nextTick(() => {
const activeElement = document.activeElement;
if (
activeElement &&
(activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA")
) {
setTimeout(() => {
activeElement.blur();
}, 0);
}
});
}
} }
} }
}, },
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
v-html="content" v-html="content"
></div> ></div>
<!-- iframe --> <!-- iframe -->
<div class="protocol-frame-wrap" v-if="!isPdf && url && scrollRefresh"> <div class="protocol-frame-wrap" v-if="url && scrollRefresh">
<iframe class="protocol-frame" :src="url" frameborder="0" height="100%"></iframe> <iframe class="protocol-frame" :src="url" frameborder="0" height="100%"></iframe>
</div> </div>
<!-- slot --> <!-- slot -->
...@@ -26,9 +26,7 @@ ...@@ -26,9 +26,7 @@
<slot></slot> <slot></slot>
</div> </div>
<!-- content --> <!-- content -->
<div class="protocol-content" v-if="isPdf && scrollRefresh && !$slots.default"> <div class="protocol-content" v-if="scrollRefresh && !$slots.default"></div>
<pdf v-for="(item, index) in pdfNumPages" :key="index" :src="pdfUrl" :page="index + 1" />
</div>
</cr-popup> </cr-popup>
</template> </template>
...@@ -38,7 +36,6 @@ ...@@ -38,7 +36,6 @@
* @param {type} * @param {type}
* @return: * @return:
*/ */
import pdf from "vue-pdf";
const CHANGE_EVENT = "input"; const CHANGE_EVENT = "input";
export default { export default {
name: "PopupWithIframe", name: "PopupWithIframe",
...@@ -57,9 +54,6 @@ export default { ...@@ -57,9 +54,6 @@ export default {
default: "" default: ""
} }
}, },
components: {
pdf
},
watch: { watch: {
value(val) { value(val) {
this.popupShow = val; this.popupShow = val;
...@@ -70,41 +64,17 @@ export default { ...@@ -70,41 +64,17 @@ export default {
popupShow(val) { popupShow(val) {
this.$emit(CHANGE_EVENT, val); this.$emit(CHANGE_EVENT, val);
if (!val) { if (!val) {
this.pdfNumPages = null;
this.pdfUrl = null;
setTimeout(() => { setTimeout(() => {
this.scrollRefresh = false; this.scrollRefresh = false;
}, 300); }, 300);
} }
} }
}, },
computed: {
isPdf() {
const isPdf = this.url.indexOf("pdf") > -1;
isPdf && this.pdfTask();
return isPdf;
}
},
data() { data() {
return { return {
popupShow: false, popupShow: false,
scrollRefresh: true, scrollRefresh: true
pdfUrl: "",
pdfNumPages: null
}; };
},
methods: {
pdfTask() {
this.pdfUrl = pdf.createLoadingTask(this.url);
this.pdfUrl.promise
.then(pdf => {
this.pdfNumPages = pdf.numPages;
console.error(pdf);
})
.catch(err => {
console.error(err);
});
}
} }
}; };
</script> </script>
......
...@@ -222,7 +222,7 @@ export default { ...@@ -222,7 +222,7 @@ export default {
this.updateRemain(); this.updateRemain();
}, },
methods: { methods: {
...mapActions(["setIsShowLogin"]), ...mapActions(["setIsShowLogin", "setIsPayWait"]),
checkLogin() { checkLogin() {
if (!this.isLogin) { if (!this.isLogin) {
this.setIsShowLogin(true); this.setIsShowLogin(true);
...@@ -241,6 +241,7 @@ export default { ...@@ -241,6 +241,7 @@ export default {
} }
}, },
async generateOrder() { async generateOrder() {
this.setIsPayWait(true);
const res = await create(); const res = await create();
if (res) { if (res) {
this.consultantOrderNo = res.consultantOrderNo; this.consultantOrderNo = res.consultantOrderNo;
...@@ -249,18 +250,19 @@ export default { ...@@ -249,18 +250,19 @@ export default {
} }
}, },
async goPay() { async goPay() {
this.setIsPayWait(true);
try { try {
const res = await goPay({ tradeType: this.tradeType, openId: this.openId }); const res = await goPay({ tradeType: this.tradeType, openId: this.openId });
if (res) { if (res) {
payByWay(this.tradeType, res.payInfo).then(() => { payByWay(this.tradeType, res.payInfo).then(() => {
setTimeout(() => { setTimeout(() => {
this.$parent.getOrderInfo(); this.$parent.getOrderInfo(true);
}, 1000); }, 1000);
}); });
} }
} catch (error) { } catch (error) {
setTimeout(() => { setTimeout(() => {
this.$parent.getOrderInfo(); this.$parent.getOrderInfo(true);
}, 1000); }, 1000);
} }
} }
......
...@@ -17,9 +17,9 @@ import Buy from "./Buy"; ...@@ -17,9 +17,9 @@ import Buy from "./Buy";
import Success from "./Success"; import Success from "./Success";
import Question from "./Question"; import Question from "./Question";
import Exclusive from "./Exclusive"; import Exclusive from "./Exclusive";
import { mapState } from "vuex"; import { mapState, mapActions } from "vuex";
import localStorage from "@/service/localStorage"; import localStorage from "@/service/localStorage";
import { getCulOrder } from "@/api/consultant"; import { getCulOrder, getPayState } from "@/api/consultant";
export default { export default {
name: "Consultant", name: "Consultant",
components: { components: {
...@@ -60,16 +60,33 @@ export default { ...@@ -60,16 +60,33 @@ export default {
this.getOrderInfo(); this.getOrderInfo();
}, },
methods: { methods: {
...mapActions(["setIsPayWait"]),
// 1-待支付,3-支付成功,4-问卷收集完成,方案配置中,5-方案配置完成, -1 -支付失败订单关闭,-2 -支付超过1小时订单关闭,-3 -订单关闭 // 1-待支付,3-支付成功,4-问卷收集完成,方案配置中,5-方案配置完成, -1 -支付失败订单关闭,-2 -支付超过1小时订单关闭,-3 -订单关闭
async getOrderInfo() { async getOrderInfo(checkPayState = false) {
if (!this.isLogin) return; if (!this.isLogin) return;
this.showQuestion = false; this.showQuestion = false;
const res = await getCulOrder(); const res = await getCulOrder();
if (res) { if (res) {
this.orderInfo = res; this.orderInfo = res;
if (checkPayState && res.state < 3) {
this.getPayState();
} else {
this.setIsPayWait(false);
}
this.$forceUpdate(); this.$forceUpdate();
} }
}, },
async getPayState() {
const res = await getPayState();
if (res.state === 2) {
setTimeout(() => {
this.getPayState();
}, 3000);
} else {
this.setIsPayWait(false);
this.getOrderInfo();
}
},
changeQuestion() { changeQuestion() {
this.showQuestion = true; this.showQuestion = true;
}, },
......
...@@ -231,14 +231,18 @@ export default { ...@@ -231,14 +231,18 @@ export default {
return; return;
} }
if (localStorage.get("mongoToken")) { if (localStorage.get("mongoToken")) {
this.$refs.insureForm.getFamilyList_I().then(() => { this.$refs.insureForm.getFamilyList(true).then(() => {
this.getIsRead(); setTimeout(() => {
this.getIsRead();
}, 500);
}); });
} else { } else {
const { selfPhone, selfCode } = this.formData; const { selfPhone, selfCode } = this.formData;
this.login(selfPhone, selfCode).then(() => { this.login(selfPhone, selfCode).then(() => {
this.$refs.insureForm.getFamilyList_I().then(() => { this.$refs.insureForm.getFamilyList(true).then(() => {
this.getIsRead(); setTimeout(() => {
this.getIsRead();
}, 500);
}); });
}); });
} }
......
...@@ -291,14 +291,18 @@ export default { ...@@ -291,14 +291,18 @@ export default {
return; return;
} }
if (localStorage.get("mongoToken")) { if (localStorage.get("mongoToken")) {
this.$refs.insureForm.getFamilyList_I().then(() => { this.$refs.insureForm.getFamilyList(true).then(() => {
this.getIsRead(); setTimeout(() => {
this.getIsRead();
}, 500);
}); });
} else { } else {
const { selfPhone, selfCode } = this.formData; const { selfPhone, selfCode } = this.formData;
this.login(selfPhone, selfCode).then(() => { this.login(selfPhone, selfCode).then(() => {
this.$refs.insureForm.getFamilyList_I().then(() => { this.$refs.insureForm.getFamilyList(true).then(() => {
this.getIsRead(); setTimeout(() => {
this.getIsRead();
}, 500);
}); });
}); });
} }
......
...@@ -225,15 +225,19 @@ export default { ...@@ -225,15 +225,19 @@ export default {
} }
if (localStorage.get("mongoToken")) { if (localStorage.get("mongoToken")) {
socialSecurityCache = this.formData.socialSecurity; socialSecurityCache = this.formData.socialSecurity;
this.$refs.insureForm.getFamilyList_I().then(() => { this.$refs.insureForm.getFamilyList(true).then(() => {
this.getIsRead(); setTimeout(() => {
this.getIsRead();
}, 500);
}); });
} else { } else {
socialSecurityCache = this.formData.socialSecurity; socialSecurityCache = this.formData.socialSecurity;
const { selfPhone, selfCode } = this.formData; const { selfPhone, selfCode } = this.formData;
this.login(selfPhone, selfCode).then(() => { this.login(selfPhone, selfCode).then(() => {
this.$refs.insureForm.getFamilyList_I().then(() => { this.$refs.insureForm.getFamilyList(true).then(() => {
this.getIsRead(); setTimeout(() => {
this.getIsRead();
}, 500);
}); });
}); });
} }
......
...@@ -262,11 +262,18 @@ export default { ...@@ -262,11 +262,18 @@ export default {
handler(val) { handler(val) {
if (val === 4 && this.userInfo.phoneNoMask === "点击登录") { if (val === 4 && this.userInfo.phoneNoMask === "点击登录") {
const xyqbUserInfo = localStorage.get("xyqbUserInfo"); const xyqbUserInfo = localStorage.get("xyqbUserInfo");
this.formData.selfName = xyqbUserInfo.nameMask; const { nameMask, idNoMask, phoneNoMask } = xyqbUserInfo;
this.formData.selfIdNo = xyqbUserInfo.idNoMask; if (nameMask) {
this.formData.selfPhone = xyqbUserInfo.phoneNoMask; this.formData.selfName = nameMask;
}
if (idNoMask) {
this.formData.selfIdNo = idNoMask;
}
if (phoneNoMask) {
this.formData.selfPhone = phoneNoMask;
}
this.xyqbAuthState = localStorage.get("xyqbAuthState"); this.xyqbAuthState = localStorage.get("xyqbAuthState");
this.selfInfoReadonly = true; this.selfInfoReadonly = nameMask && idNoMask && phoneNoMask;
this.$forceUpdate(); this.$forceUpdate();
} }
} }
...@@ -335,7 +342,7 @@ export default { ...@@ -335,7 +342,7 @@ export default {
}; };
this.onRelationCancel(); this.onRelationCancel();
}, },
relationChange(relation = this.formData.relation) { relationChange(relation = this.formData.relation, validSelf = false) {
this.familyList.forEach(item => { this.familyList.forEach(item => {
const { const {
relation, relation,
...@@ -357,6 +364,7 @@ export default { ...@@ -357,6 +364,7 @@ export default {
this.selfInfoReadonly = true; this.selfInfoReadonly = true;
} }
}); });
if (validSelf) return;
let userArray = this.familyList.filter(item => item.relation === +relation); let userArray = this.familyList.filter(item => item.relation === +relation);
let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", ""]; let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", ""];
if ( if (
...@@ -414,56 +422,54 @@ export default { ...@@ -414,56 +422,54 @@ export default {
} }
} }
}, },
async getFamilyList() { getFamilyList(reset = false) {
this.mongoToken = localStorage.get("mongoToken"); return new Promise(resolve => {
if (!this.mongoToken) return; this.mongoToken = localStorage.get("mongoToken");
this.setUserInfo(); if (!this.mongoToken) return;
const res = await getFamilyList(); this.setUserInfo();
if (res) { getFamilyList().then(res => {
this.familyList = res; if (res) {
if (this.hasAutoSaveData(this.autoSaveKey)) { this.familyList = res;
this.getSaveInfoHandler(this.autoSaveKey, AUTO_SAVE_TARGET); if (this.hasAutoSaveData(this.autoSaveKey) && !reset) {
if (this.formData.relation) { this.getSaveInfoHandler(this.autoSaveKey, AUTO_SAVE_TARGET);
const userArray = this.familyList.filter( if (this.formData.relation) {
item => item.relation === +this.formData.relation const userArray = this.familyList.filter(
); item => item.relation === +this.formData.relation
this.relationList = userArray.length > 1 ? userArray : []; );
} else { this.relationList = userArray.length > 1 ? userArray : [];
this.formData.relation = "1"; } else {
} this.formData.relation = "1";
if (!this.formData.selfName) { }
const selfInfo = this.familyList.find(item => item.relation === 1); if (!this.formData.selfName) {
this.selfInfoReadonly = !!selfInfo; const selfInfo = this.familyList.find(item => item.relation === 1);
if (selfInfo) { this.selfInfoReadonly = !!selfInfo;
const { if (selfInfo) {
idNoMask: selfIdNo, const {
nameMask: selfName, idNoMask: selfIdNo,
socialSecurity, nameMask: selfName,
userInfoSecId: selfSecId socialSecurity,
} = selfInfo; userInfoSecId: selfSecId
this.formData = { } = selfInfo;
...this.formData, this.formData = {
...{ ...this.formData,
selfName, ...{
selfIdNo, selfName,
selfSecId, selfIdNo,
selfSocialSecurity: socialSecurity ? "1" : "0" selfSecId,
selfSocialSecurity: socialSecurity ? "1" : "0"
}
};
} }
}; } else {
this.selfInfoReadonly = true;
}
} else {
let relation = this.formData.relation || "1";
(this.showAuthXyqb || this.mongoToken) && this.relationChange(relation, reset);
} }
} else {
this.selfInfoReadonly = true;
} }
} else { resolve();
let relation = this.formData.relation || "1"; });
(this.showAuthXyqb || this.mongoToken) && this.relationChange(relation);
}
}
},
getFamilyList_I() {
return new Promise(resolve => {
this.getFamilyList();
resolve();
}); });
}, },
// TODO 倒计时未回显 // TODO 倒计时未回显
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
overflow: scroll; overflow: scroll;
margin: 0 -15px; margin: 0 -15px;
height: 72vh; height: calc(100vh - 182px);
} }
} }
&-btns { &-btns {
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
} }
} }
&-frame { &-frame {
height: 72vh; height: calc(100vh - 182px);
width: 100%; width: 100%;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment