Commit 07da486f authored by honghy's avatar honghy

短信功能实作

parent 92f6670d
<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>
<script>
import { getCode } from '@/api/user'
......@@ -29,9 +37,10 @@ export default {
if (this.timeout)clearTimeout(this.timeout)
},
methods: {
send() {
send(messageType) {
if (this.loading || (this.leftTime > 0 && this.leftTime < 60)) return false
this.loading = true
this.form['messageType'] = messageType
getCode(this.form).then(() => {
this.$message({
message: this.$t('common.success'),
......
......@@ -120,7 +120,14 @@
auto-complete="new-password"
/>
<!-- <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 v-if="!isSuccess&&radio==1" :label="$t('setting.controlPassword')" prop="controlPassword">
<el-input
......
<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>
<script>
import { sendSmsCode } from '@/api/order'
export default {
props: {
orderId: [String, Number],
scene: [String, Number]
form: Object
},
data() {
return {
......@@ -30,13 +37,11 @@ export default {
if (this.timeout)clearTimeout(this.timeout)
},
methods: {
send() {
send(messageType) {
if (this.loading || (this.leftTime > 0 && this.leftTime < 60)) return false
this.loading = true
sendSmsCode({
orderId: this.orderId,
scene: this.scene
}).then(res => {
this.form['messageType'] = messageType
sendSmsCode(this.form).then(res => {
this.$message.success(this.$t('sendSmsCode.success'))
this.countDown()
}).finally(res => {
......
<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-row :gutter="20">
<el-col :span="24">
......@@ -23,7 +23,14 @@
</el-form-item>
</el-col>
<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-row>
</el-form>
......
......@@ -31,7 +31,14 @@
</el-form-item>
<el-form-item v-if="radio==0" :label="$t('release.code')" prop="code">
<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-form-item v-if="radio==1" :label="$t('setting.controlPassword')" prop="controlPassword">
<el-input
......
......@@ -1245,13 +1245,14 @@
</el-col>
<el-col :span="6">
<!-- <el-button type="primary" @click="changePhoneCode">{{ $t('setting.getCode') }}</el-button> -->
<jd-send-code
:form="{
<jd-send-code :form="{
mobile: changePhoneForm.mobile,
scene: 2,
areaCode: changePhoneForm.areaCode,
}"
/>
nodeValue: 'user-sms-update-mobile',
isTransport: 0,
transportId: 0,
isOrders: 0,
areaCode: changePhoneForm.areaCode
}" />
</el-col>
</el-row>
</el-form>
......
......@@ -49,14 +49,15 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-button
:loading="loading"
type="primary"
:disabled="disabled"
round
@click.native.prevent="getValidaCode"
>{{ getCode }}</el-button
>
<el-dropdown @command="getValidaCode" :disabled="disabled">
<el-button type="primary">
{{ getCode }}<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>
</el-col>
</el-row>
......@@ -140,12 +141,16 @@ export default {
// window.removeEventListener('storage', this.afterQRScan)
},
methods: {
getValidaCode() {
getValidaCode(messageType) {
var data = {
mobile: this.loginForm.mobile,
scene: 1,
nodeValue: 'user-sms-reg',
areaCode: this.loginForm.areaCode,
};
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: messageType
}
getCode(data).then(() => {
var countDown = window.setInterval(() => {
if (this.count < 1) {
......
......@@ -202,13 +202,15 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-button
:loading="loading"
type="primary"
style="width: 100%; margin-bottom: 30px"
:disabled="disabled"
@click.native.prevent="getValidaCode"
>{{ getCode }}</el-button>
<el-dropdown @command="getValidaCode" :disabled="disabled">
<el-button type="primary">
{{ getCode }}<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>
</el-col>
</el-row>
<el-form-item prop="password" :label="$t('registered.password')">
......@@ -384,11 +386,15 @@ export default {
this.$i18n.locale = lang
this.$store.dispatch('app/setLanguage', lang)
},
getValidaCode() {
getValidaCode(messageType) {
var data = {
mobile: this.registeredForm.mobile,
scene: 0,
areaCode: this.registeredForm.areaCode
nodeValue: 'user-sms-reg',
areaCode: this.registeredForm.areaCode,
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: messageType
}
getCode(data).then(() => {
var countDown = window.setInterval(() => {
......
......@@ -110,13 +110,15 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-button
:loading="loading"
type="primary"
style="width:100%;margin-bottom:30px;"
:disabled="disabled"
@click.native.prevent="getValidaCode"
>{{ getCode }}</el-button>
<el-dropdown @command="getValidaCode" :disabled="disabled">
<el-button type="primary">
{{ getCode }}<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>
</el-col>
</el-row>
<el-form-item prop="password" :label="$t('registered.password')">
......@@ -228,8 +230,16 @@ export default {
this.$i18n.locale = lang
this.$store.dispatch('app/setLanguage', lang)
},
getValidaCode() {
var data = { mobile: this.registeredForm.mobile, scene: 3, areaCode: this.registeredForm.areaCode }
getValidaCode(messageType) {
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(() => {
var countDown = window.setInterval(() => {
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