福利整改,拉取手机号
This commit is contained in:
@@ -270,7 +270,6 @@ layout("/layouts/platform.html"){
|
||||
formRules: {
|
||||
name: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||
festival: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
provideTime: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
choiceTime: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
provideAddress: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
provideMode: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
|
||||
@@ -32,22 +32,26 @@ const optionSelect = {
|
||||
<div class="info-label">项目名称</div>
|
||||
<div class="info-value">{{ projectInfo.name }}</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="info-item">
|
||||
<div class="info-label">节日信息</div>
|
||||
<div class="info-value">{{ projectInfo.festival }} · {{ projectInfo.year }}年</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="info-item">
|
||||
<div class="info-label">选择时间</div>
|
||||
<div class="info-value">{{ formatTimeRange(projectInfo.choiceTimeStart,
|
||||
projectInfo.choiceTimeEnd) }}
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="info-item">
|
||||
<div class="info-label">发放时间</div>
|
||||
<div class="info-value">{{ formatTimeRange(projectInfo.provideTimeStart,
|
||||
projectInfo.provideTimeEnd) }}
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="info-item">
|
||||
<div class="info-label">发放部门</div>
|
||||
<div class="info-value">{{ projectInfo.provideAddress }}</div>
|
||||
@@ -395,6 +399,9 @@ const optionSelect = {
|
||||
if (!this.isProxySelect && this.$store.state.user && this.$store.state.user.username) {
|
||||
this.$set(this.contactForm, "userName", this.$store.state.user.username)
|
||||
}
|
||||
if (!this.isProxySelect && this.$store.state.user) {
|
||||
this.$set(this.contactForm, "mobile", this.$store.state.user.welfareMobile || this.$store.state.user.mobile || "")
|
||||
}
|
||||
|
||||
this.getProjectInfo()
|
||||
},
|
||||
@@ -444,7 +451,20 @@ const optionSelect = {
|
||||
this.hasSubmittedBefore = this.userSelection.length > 0
|
||||
|
||||
if (this.userSelection && this.userSelection.length > 0) {
|
||||
this.$set(this.contactForm, "mobile", this.userSelection[0]?.mobile || "")
|
||||
const selectionMobile = this.userSelection[0]?.mobile || ""
|
||||
if (!this.isProxySelect && this.$store.state.user) {
|
||||
this.$set(this.contactForm, "mobile", this.$store.state.user.welfareMobile || this.$store.state.user.mobile || selectionMobile)
|
||||
} else if (this.isProxySelect) {
|
||||
// 代选场景通过接口读取目标用户的福利手机号,回调完成前保留历史选择手机号。
|
||||
this.$set(this.contactForm, "mobile", selectionMobile)
|
||||
$.post("/platform/welfare/selection/situation/getMobileByUserId", {userId: this.userId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$set(this.contactForm, "mobile", res.data || selectionMobile)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$set(this.contactForm, "mobile", selectionMobile)
|
||||
}
|
||||
// 已有选择记录时优先回显历史收货人;历史记录为空时保留本人默认值。
|
||||
if (this.userSelection[0]?.userName) {
|
||||
this.$set(this.contactForm, "userName", this.userSelection[0].userName)
|
||||
@@ -455,7 +475,7 @@ const optionSelect = {
|
||||
// 否则使用默认手机号
|
||||
$.post("/platform/welfare/selection/situation/getMobileByUserId", {userId: this.userId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.contactForm.mobile = res.data
|
||||
this.$set(this.contactForm, "mobile", res.data || "")
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -468,7 +488,6 @@ const optionSelect = {
|
||||
// this.contactForm.userName = this.userSelection[0].userName;
|
||||
// this.contactForm.mobile = this.userSelection[0].mobile;
|
||||
this.$set(this.contactForm, "userName", this.userSelection[0].userName)
|
||||
this.$set(this.contactForm, "mobile", this.userSelection[0].mobile)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,6 +574,9 @@ if (this.isSubmitting) return
|
||||
|
||||
if (res.code === 0) {
|
||||
this.showConfirmDialog = false
|
||||
if (!this.isProxySelect && this.$store.state.user) {
|
||||
this.$set(this.$store.state.user, "welfareMobile", this.contactForm.mobile)
|
||||
}
|
||||
this.$message.success("选择成功")
|
||||
this.$emit("refresh")
|
||||
} else {
|
||||
|
||||
@@ -958,20 +958,26 @@ layout("/layouts/platform_h5.html"){
|
||||
this.userSelection = resp.data
|
||||
this.hasSubmittedBefore = this.userSelection.length > 0
|
||||
|
||||
// 如果有用户选择数据,从中获取手机号
|
||||
if (this.userSelection && this.userSelection.length > 0 && this.userSelection[0].mobile) {
|
||||
this.formData.mobile = this.userSelection[0].mobile
|
||||
this.formData.userName = this.userSelection[0].userName
|
||||
const selectionMobile = this.userSelection && this.userSelection.length > 0 ? this.userSelection[0].mobile || "" : ""
|
||||
const userPreferredMobile = this.$store.state.user ? this.$store.state.user.welfareMobile || this.$store.state.user.mobile || "" : ""
|
||||
|
||||
// 福利手机号优先于数据中心手机号,历史选择手机号仅作为兼容兜底。
|
||||
if (this.userSelection && this.userSelection.length > 0) {
|
||||
this.$set(this.formData, "mobile", userPreferredMobile || selectionMobile)
|
||||
this.$set(this.formData, "userName", this.userSelection[0].userName)
|
||||
|
||||
// 获取签名信息(如果有)
|
||||
if (this.userSelection[0].userSign) {
|
||||
this.formData.userSign = this.userSelection[0].userSign
|
||||
this.$set(this.formData, "userSign", this.userSelection[0].userSign)
|
||||
}
|
||||
} else {
|
||||
if (userPreferredMobile) {
|
||||
// 如果没有选择过,优先使用福利手机号,没有时使用数据中心手机号。
|
||||
this.$set(this.formData, "mobile", userPreferredMobile)
|
||||
}
|
||||
if (this.$store.state.user && this.$store.state.user.username) {
|
||||
this.$set(this.formData, "userName", this.$store.state.user.username)
|
||||
}
|
||||
} else if (this.$store.state.user && this.$store.state.user.mobile) {
|
||||
// 如果没有选择过,使用store中的默认手机号
|
||||
this.formData.mobile = this.$store.state.user.mobile
|
||||
}else if (this.$store.state.user && this.$store.state.user.username){
|
||||
this.formData.userName = this.$store.state.user.username
|
||||
}
|
||||
|
||||
// 地址回显
|
||||
@@ -1093,6 +1099,9 @@ layout("/layouts/platform_h5.html"){
|
||||
this.isSubmitting = false
|
||||
|
||||
if (res.code === 0) {
|
||||
if (this.$store.state.user) {
|
||||
this.$set(this.$store.state.user, "welfareMobile", this.formData.mobile)
|
||||
}
|
||||
this.$toast.success("选择成功")
|
||||
setTimeout(() => {
|
||||
this.$pjaxReplace("/platform/h5/welfare/userSelect/success")
|
||||
|
||||
Reference in New Issue
Block a user