Commit 8474e4eb by Lays-lzq

feat: 修复已知问题

parent 0bec2a75
......@@ -11,7 +11,8 @@
<div class="top-btn" @click="submit">提交</div>
</div>
<div class="form" :class="{error: isError}">
<van-field v-model="form.name" label-width="60" label="联系人" placeholder="请输入联系人" @focus="isError = false"/>
<van-field v-if="lotteryInfo.premise && lotteryInfo.premise.includes('name')" v-model="form.name" label-width="60" label="联系人" placeholder="请输入联系人" @focus="isError = false"/>
<template v-if="lotteryInfo.premise && lotteryInfo.premise.includes('phone')">
<van-field v-model="form.phone" label-width="60" label="手机号" placeholder="请输入联系电话" @focus="isError = false"/>
<van-field v-model="form.code" label-width="60" label="验证码" placeholder="请输入验证码" @focus="isError = false">
<span slot="button" class="code" @click="sendCode">
......@@ -19,6 +20,8 @@
<span v-else>{{ time }}s后重发</span>
</span>
</van-field>
</template>
<template v-if="lotteryInfo.premise && lotteryInfo.premise.includes('address')">
<van-field v-model="form.address" label-width="60" label="收货地址" readonly placeholder="请选择省市区" @focus="isError = false" @click="select" >
<van-icon slot="button" name="location" />
</van-field>
......@@ -34,6 +37,7 @@
show-word-limit
@focus="isError = false"
/>
</template>
</div>
<van-popup
v-model="isShowAdd"
......@@ -50,10 +54,10 @@
import {
savePremise,
setSendSmsCode,
// setValidSmsCode
setValidSmsCode
} from '@/api/modules/lottery'
import { areaList } from '@vant/area-data';
import { mapActions } from 'vuex'
import { mapGetters, mapActions } from 'vuex'
export default {
name: 'ConfigPopup',
......@@ -80,6 +84,10 @@ export default {
}
},
computed: {
...mapGetters({
uin: 'users/uin',
lotteryInfo: 'lottery/lotteryInfo'
}),
visible: {
get() {
return this.value
......@@ -138,30 +146,53 @@ export default {
})
},
submit() {
// const { uin } = this.$route.query
const { name, phone, code, address } = this.form
if (!name || !phone || !code || !address) {
const { uin } = this.$route.query
const { name, phone, code, address, detail } = this.form
if (this.lotteryInfo.premise.includes('name')) {
if (!name) {
this.isError = true
return 0
}
}
if (this.lotteryInfo.premise.includes('address')) {
if (!address || !detail) {
this.isError = true
return 0
}
// setValidSmsCode({ uin, phone, code }).then((res) => {
// const { code, errorCode, errorMessage } = res
// if (code === 200 && errorCode === 0) {
// // this.$toast('验证成功')
}
if (this.lotteryInfo.premise.includes('phone')) {
if (!phone || !code) {
this.isError = true
return 0
}
setValidSmsCode({ uin, phone, code }).then((res) => {
const { code, errorCode, errorMessage } = res
if (code === 200 && errorCode === 0) {
this.$toast('验证成功')
this.save()
} else {
this.$toast(errorMessage)
}
})
}else {
this.save()
// } else {
// this.$toast(errorMessage)
// }
// })
}
},
save() {
const { id, uin } = this.$route.query
const params = {
id,
uin,
name: this.form.name,
phone: this.form.phone,
address: this.form.address + this.form.detail
}
if (this.lotteryInfo.premise.includes('name')) {
params.name = this.form.name
}
if (this.lotteryInfo.premise.includes('phone')) {
params.phone = this.form.phone
}
if (this.lotteryInfo.premise.includes('address')) {
params.address = this.form.address + this.form.detail
}
savePremise(params).then(res => {
const { code, errorCode, errorMessage } = res
......
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 sign in to comment