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