Commit 07da486f authored by honghy's avatar honghy

短信功能实作

parent 92f6670d
<template> <template>
<el-button :disabled="leftTime > 0 && leftTime < 60" @click="send">{{ text }}</el-button> <el-dropdown @command="send" :disabled="leftTime > 0 && leftTime < 60">
<el-button type="primary">
{{ text }}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="1">SMS</el-dropdown-item>
<el-dropdown-item command="2">WhatsApp</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
<script> <script>
import { getCode } from '@/api/user' import { getCode } from '@/api/user'
...@@ -29,9 +37,10 @@ export default { ...@@ -29,9 +37,10 @@ export default {
if (this.timeout)clearTimeout(this.timeout) if (this.timeout)clearTimeout(this.timeout)
}, },
methods: { methods: {
send() { send(messageType) {
if (this.loading || (this.leftTime > 0 && this.leftTime < 60)) return false if (this.loading || (this.leftTime > 0 && this.leftTime < 60)) return false
this.loading = true this.loading = true
this.form['messageType'] = messageType
getCode(this.form).then(() => { getCode(this.form).then(() => {
this.$message({ this.$message({
message: this.$t('common.success'), message: this.$t('common.success'),
......
...@@ -120,7 +120,14 @@ ...@@ -120,7 +120,14 @@
auto-complete="new-password" auto-complete="new-password"
/> />
<!-- <el-button type="success">获取验证码</el-button> --> <!-- <el-button type="success">获取验证码</el-button> -->
<send-sms-code :order-id="detail.orderId" scene="5" /> <send-sms-code :form="{
orderId: detail.orderId,
nodeValue: 'delivery-verification-sms',
isTransport: 0,
transportId: 0,
isOrders: 0,
}"
/>
</el-form-item> </el-form-item>
<el-form-item v-if="!isSuccess&&radio==1" :label="$t('setting.controlPassword')" prop="controlPassword"> <el-form-item v-if="!isSuccess&&radio==1" :label="$t('setting.controlPassword')" prop="controlPassword">
<el-input <el-input
......
<template> <template>
<el-button :disabled="leftTime > 0 && leftTime < 60" @click="send">{{ text }}</el-button> <el-dropdown @command="send" :disabled="leftTime > 0 && leftTime < 60">
<el-button type="primary">
{{ text }}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="1">SMS</el-dropdown-item>
<el-dropdown-item command="2">WhatsApp</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
<script> <script>
import { sendSmsCode } from '@/api/order' import { sendSmsCode } from '@/api/order'
export default { export default {
props: { props: {
orderId: [String, Number], form: Object
scene: [String, Number]
}, },
data() { data() {
return { return {
...@@ -30,13 +37,11 @@ export default { ...@@ -30,13 +37,11 @@ export default {
if (this.timeout)clearTimeout(this.timeout) if (this.timeout)clearTimeout(this.timeout)
}, },
methods: { methods: {
send() { send(messageType) {
if (this.loading || (this.leftTime > 0 && this.leftTime < 60)) return false if (this.loading || (this.leftTime > 0 && this.leftTime < 60)) return false
this.loading = true this.loading = true
sendSmsCode({ this.form['messageType'] = messageType
orderId: this.orderId, sendSmsCode(this.form).then(res => {
scene: this.scene
}).then(res => {
this.$message.success(this.$t('sendSmsCode.success')) this.$message.success(this.$t('sendSmsCode.success'))
this.countDown() this.countDown()
}).finally(res => { }).finally(res => {
......
<template> <template>
<!-- 更换手机号弹窗 --> <!-- 更换手机号弹窗 -->
<el-dialog :title="$t('setting.setControlPassword')" visible width="500px" append-to-body :close-on-click-modal="false" :before-close="cancel"> <el-dialog :title="$t('setting.setControlPassword')" visible width="580px" append-to-body :close-on-click-modal="false" :before-close="cancel">
<el-form ref="changePhoneForm" :model="form" label-width="120px"> <el-form ref="changePhoneForm" :model="form" label-width="120px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24"> <el-col :span="24">
...@@ -23,7 +23,14 @@ ...@@ -23,7 +23,14 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<jd-send-code :form="{ mobile: loginUser.mobile, scene: 3, areaCode: loginUser.areaCode }" /> <jd-send-code :form="{
mobile: loginUser.mobile,
nodeValue: 'user-sms-reset-password',
isTransport: 0,
transportId: 0,
isOrders: 0,
areaCode: loginUser.areaCode
}" />
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
......
...@@ -31,7 +31,14 @@ ...@@ -31,7 +31,14 @@
</el-form-item> </el-form-item>
<el-form-item v-if="radio==0" :label="$t('release.code')" prop="code"> <el-form-item v-if="radio==0" :label="$t('release.code')" prop="code">
<el-input v-model.number="form.code" type="number"> <el-input v-model.number="form.code" type="number">
<send-sms-code slot="append" :order-id="orderId" scene="4" /> <send-sms-code slot="append" :form="{
orderId: orderId,
nodeValue: 'transfer-control-goods',
isTransport: 0,
transportId: 0,
isOrders: 0,
}"
/>
</el-input></el-form-item> </el-input></el-form-item>
<el-form-item v-if="radio==1" :label="$t('setting.controlPassword')" prop="controlPassword"> <el-form-item v-if="radio==1" :label="$t('setting.controlPassword')" prop="controlPassword">
<el-input <el-input
......
...@@ -1245,13 +1245,14 @@ ...@@ -1245,13 +1245,14 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<!-- <el-button type="primary" @click="changePhoneCode">{{ $t('setting.getCode') }}</el-button> --> <!-- <el-button type="primary" @click="changePhoneCode">{{ $t('setting.getCode') }}</el-button> -->
<jd-send-code <jd-send-code :form="{
:form="{
mobile: changePhoneForm.mobile, mobile: changePhoneForm.mobile,
scene: 2, nodeValue: 'user-sms-update-mobile',
areaCode: changePhoneForm.areaCode, isTransport: 0,
}" transportId: 0,
/> isOrders: 0,
areaCode: changePhoneForm.areaCode
}" />
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
......
...@@ -49,14 +49,15 @@ ...@@ -49,14 +49,15 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-button <el-dropdown @command="getValidaCode" :disabled="disabled">
:loading="loading" <el-button type="primary">
type="primary" {{ getCode }}<i class="el-icon-arrow-down el-icon--right"></i>
:disabled="disabled" </el-button>
round <el-dropdown-menu slot="dropdown">
@click.native.prevent="getValidaCode" <el-dropdown-item command="1">SMS</el-dropdown-item>
>{{ getCode }}</el-button <el-dropdown-item command="2">WhatsApp</el-dropdown-item>
> </el-dropdown-menu>
</el-dropdown>
</el-col> </el-col>
</el-row> </el-row>
...@@ -140,12 +141,16 @@ export default { ...@@ -140,12 +141,16 @@ export default {
// window.removeEventListener('storage', this.afterQRScan) // window.removeEventListener('storage', this.afterQRScan)
}, },
methods: { methods: {
getValidaCode() { getValidaCode(messageType) {
var data = { var data = {
mobile: this.loginForm.mobile, mobile: this.loginForm.mobile,
scene: 1, nodeValue: 'user-sms-reg',
areaCode: this.loginForm.areaCode, areaCode: this.loginForm.areaCode,
}; isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: messageType
}
getCode(data).then(() => { getCode(data).then(() => {
var countDown = window.setInterval(() => { var countDown = window.setInterval(() => {
if (this.count < 1) { if (this.count < 1) {
......
...@@ -202,13 +202,15 @@ ...@@ -202,13 +202,15 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-button <el-dropdown @command="getValidaCode" :disabled="disabled">
:loading="loading" <el-button type="primary">
type="primary" {{ getCode }}<i class="el-icon-arrow-down el-icon--right"></i>
style="width: 100%; margin-bottom: 30px" </el-button>
:disabled="disabled" <el-dropdown-menu slot="dropdown">
@click.native.prevent="getValidaCode" <el-dropdown-item command="1">SMS</el-dropdown-item>
>{{ getCode }}</el-button> <el-dropdown-item command="2">WhatsApp</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item prop="password" :label="$t('registered.password')"> <el-form-item prop="password" :label="$t('registered.password')">
...@@ -384,11 +386,15 @@ export default { ...@@ -384,11 +386,15 @@ export default {
this.$i18n.locale = lang this.$i18n.locale = lang
this.$store.dispatch('app/setLanguage', lang) this.$store.dispatch('app/setLanguage', lang)
}, },
getValidaCode() { getValidaCode(messageType) {
var data = { var data = {
mobile: this.registeredForm.mobile, mobile: this.registeredForm.mobile,
scene: 0, nodeValue: 'user-sms-reg',
areaCode: this.registeredForm.areaCode areaCode: this.registeredForm.areaCode,
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: messageType
} }
getCode(data).then(() => { getCode(data).then(() => {
var countDown = window.setInterval(() => { var countDown = window.setInterval(() => {
......
...@@ -110,13 +110,15 @@ ...@@ -110,13 +110,15 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-button <el-dropdown @command="getValidaCode" :disabled="disabled">
:loading="loading" <el-button type="primary">
type="primary" {{ getCode }}<i class="el-icon-arrow-down el-icon--right"></i>
style="width:100%;margin-bottom:30px;" </el-button>
:disabled="disabled" <el-dropdown-menu slot="dropdown">
@click.native.prevent="getValidaCode" <el-dropdown-item command="1">SMS</el-dropdown-item>
>{{ getCode }}</el-button> <el-dropdown-item command="2">WhatsApp</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item prop="password" :label="$t('registered.password')"> <el-form-item prop="password" :label="$t('registered.password')">
...@@ -228,8 +230,16 @@ export default { ...@@ -228,8 +230,16 @@ export default {
this.$i18n.locale = lang this.$i18n.locale = lang
this.$store.dispatch('app/setLanguage', lang) this.$store.dispatch('app/setLanguage', lang)
}, },
getValidaCode() { getValidaCode(messageType) {
var data = { mobile: this.registeredForm.mobile, scene: 3, areaCode: this.registeredForm.areaCode } var data = {
mobile: this.registeredForm.mobile,
nodeValue: 'user-sms-reset-password',
areaCode: this.registeredForm.areaCode,
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: messageType
}
getCode(data).then(() => { getCode(data).then(() => {
var countDown = window.setInterval(() => { var countDown = window.setInterval(() => {
if (this.count < 1) { if (this.count < 1) {
......
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