Commit 3f673085 authored by honghy's avatar honghy

短信功能实作

parent 45d1838c
......@@ -36,7 +36,9 @@
<view class="login-vp">
<input class="vp-input" v-model="code" type="number" :placeholder="$lang.lang.notices.code">
<view class="login-code" v-if="leftTime < 60">{{leftTime}}S</view>
<view class="login-code" v-else @click="sendCode">{{$lang.lang.editEmail.getCode}}</view>
<picker class="login-code" :range="smsName" @change="sendCode" v-else>
<view class="uni-input">{{ $lang.lang.editEmail.getCode }}</view>
</picker>
</view>
</view>
<view class="login-vp login-v">
......@@ -78,7 +80,10 @@
areaName: [],
leftTime: 60,
oldMobile:'',
userInfo:{}
userInfo:{},
smsName: ['SMS','WhatsApp'],
smsData: [1,2],
smsIndex: 0
}
},
onLoad() {
......@@ -95,27 +100,6 @@
})
},
ismobile(code,mobile){
this.$request.get('/app-api/param/validator/mobile',{code:code,mobile:mobile}).then(res => {
if(res.code==0){
this.$request.post('/app-api/member/send-sms-code', {areaCode: this.areaData[this.areaIndexs], mobile: this.mobile, scene: 2}).then(res => {
if(res.code == 0){
this.countDown()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
})
}
})
}else{
uni.showToast({
title: this.$lang.lang.notices.nophone,
icon: 'error',
})
}
})
},
Country () {
let that = this
that.$request.get('/app-api/ecw/country/list-all').then(res => {
......@@ -131,7 +115,7 @@
}
})
},
sendCode () {
sendCode (e) {
if(this.mobile == ''){
return uni.showToast({
title: this.$lang.lang.notices.phone,
......@@ -141,7 +125,35 @@
if (this.leftTime < 60) {
return false
}
this.ismobile(this.areaData[this.areaIndexs],this.mobile)
var data = {
mobile: this.mobile,
nodeValue: 'user-sms-update-mobile',
areaCode: this.areaData[this.areaIndexs],
code: this.areaData[this.areaIndexs],
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
this.$request.get('/app-api/param/validator/mobile',data).then(res => {
if(res.code==0){
this.$request.post('/app-api/member/send-sms-code', data).then(res => {
if(res.code == 0){
this.countDown()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
})
}
})
}else{
uni.showToast({
title: this.$lang.lang.notices.nophone,
icon: 'error',
})
}
})
},
countDown() {
this.leftTime--
......
......@@ -20,7 +20,9 @@
<view class="items-vw">
<input type="number" v-model="FormData.code" :placeholder="$lang.lang.notices.code">
<text class="code" v-if="leftTime < 60">{{leftTime}}S</text>
<text class="code" @click="sendCode" v-else>{{$lang.lang.forget.code}}</text>
<picker class="code" :range="smsName" @change="sendCode" v-else>
<view class="uni-input">{{ $lang.lang.forget.code }}</view>
</picker>
</view>
</view>
<view class="item">
......@@ -67,7 +69,10 @@
code: this.$lang.lang.notices.code,
password: this.$lang.lang.notices.newPsd,
passworded: this.$lang.lang.notices.nextPsd,
}
},
smsName: ['SMS','WhatsApp'],
smsData: [1,2],
smsIndex: 0
}
},
onLoad() {
......@@ -122,7 +127,7 @@
}
})
},
sendCode () {
sendCode (e) {
if(this.FormData.mobile == ''){
return uni.showToast({
title: this.$lang.lang.notices.phone,
......@@ -132,7 +137,16 @@
if (this.leftTime < 60) {
return false
}
this.$request.post('/app-api/member/send-sms-code', {areaCode: this.areaData[this.areaIndex], mobile: this.FormData.mobile, scene: 3}).then(res => {
var data = {
mobile: this.FormData.mobile,
nodeValue: 'user-sms-reset-password',
areaCode: this.areaData[this.areaIndex],
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
this.$request.post('/app-api/member/send-sms-code', data).then(res => {
if(res.code == 0){
this.countDown()
} else {
......
......@@ -88,7 +88,9 @@
:placeholder="$lang.lang.notices.code"
/>
<text class="code" v-if="leftTime < 60">{{ leftTime }}S</text>
<text class="code" @click="sendCode" v-else>{{ $lang.lang.login.code }}</text>
<picker class="code" :range="smsName" @change="sendCode" v-else>
<view class="uni-input">{{ $lang.lang.login.code }}</view>
</picker>
</view>
</view>
</view>
......@@ -174,7 +176,10 @@ export default {
forceUpdate: 0,
showdownLine: false,
downloadNum: 0, //下载百分比
totalSize: 0 //下载总量
totalSize: 0 ,//下载总量
smsName: ['SMS','WhatsApp'],
smsData: [1,2],
smsIndex: 0
}
},
onLoad() {
......@@ -275,7 +280,7 @@ export default {
}
})
},
sendCode() {
sendCode(e) {
if (this.mobile == '') {
return uni.showToast({
title: this.$lang.lang.notices.phone,
......@@ -285,12 +290,17 @@ export default {
if (this.leftTime < 60) {
return false
}
var data = {
mobile: this.mobile,
nodeValue: 'user-sms-login',
areaCode: this.areaData[this.areaIndex],
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
this.$request
.post('/app-api/member/send-sms-code', {
areaCode: this.areaData[this.areaIndex],
mobile: this.mobile,
scene: 1
})
.post('/app-api/member/send-sms-code', data)
.then((res) => {
if (res.code == 0) {
this.countDown()
......
......@@ -274,7 +274,9 @@
<view class="corder-tab1-item" v-if="controlType==1">
<input class="vp-input" autocomplete="off" v-model="lendingFrom.code" type="code" :placeholder="$lang.lang.notices.code">
<view class="code" v-if="leftTime < 60">{{leftTime}}S</view>
<view class="code" @click="sendCode" v-else>{{$lang.lang.order.getCode}}</view>
<picker class="code" :range="smsName" @change="sendCode" v-else>
<view class="uni-input">{{ $lang.lang.order.getCode }}</view>
</picker>
</view>
<view class="corder-tab1-item" v-if="controlType==2">
<text>{{$lang.lang.site.controlPsd}}<span class="redcolor">*</span></text>
......@@ -355,7 +357,9 @@
<view class="corder-tab1-item" v-if="controlType==1">
<input class="vp-input" autocomplete="off" v-model="transferFrom.code" type="code" :placeholder="$lang.lang.notices.code">
<view class="code" v-if="leftTimes < 60">{{leftTimes}}S</view>
<view class="code" @click="sendTransCode" v-else>{{$lang.lang.order.getCode}}</view>
<picker class="code" :range="smsName" @change="sendTransCode" v-else>
<view class="uni-input">{{ $lang.lang.order.getCode }}</view>
</picker>
</view>
<view class="corder-tab1-item" v-if="controlType==2">
<text>{{$lang.lang.site.controlPsd}}<span class="redcolor">*</span></text>
......@@ -509,7 +513,10 @@
controlLogData:[],
controlType:1,//放货方式
transType:[],
loading:false
loading:false,
smsName: ['SMS','WhatsApp'],
smsData: [1,2],
smsIndex: 0
}
},
onLoad() {
......@@ -790,15 +797,19 @@
}
})
},
sendTransCode(){
sendTransCode(e){
if (this.leftTimes < 60) {
return false
}
var params = {
orderId:this.selectOrder.orderId,
scene: 4
var data = {
nodeValue: 'transfer-control-goods',
orderId: this.selectOrder.orderId,
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
this.$request.post('/app-api/order/order-cargo-control/send-sms-code', params).then(res => {
this.$request.post('/app-api/order/order-cargo-control/send-sms-code', data).then(res => {
if(res.code == 0){
this.countDowns()
} else {
......@@ -817,15 +828,20 @@
this.leftTimes = 60
}
},
sendCode () {
sendCode (e) {
if (this.leftTime < 60) {
return false
}
var params = {
orderId:this.selectOrder.orderId,
scene: 5
var data = {
nodeValue: 'delivery-verification-sms',
orderId: this.selectOrder.orderId,
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
this.$request.post('/app-api/order/order-cargo-control/send-sms-code', params).then(res => {
this.$request.post('/app-api/order/order-cargo-control/send-sms-code', data).then(res => {
if(res.code == 0){
this.countDown()
} else {
......
......@@ -80,9 +80,11 @@
<view class="main-footer">
<view class="mobile">{{ mobile }}</view>
<input class="inp" :placeholder="integral.codePlaceloader" v-model="code" />
<view class="btn" @click="handleCode">{{
codeTime == 0 ? integral.code : integral.codeTimeText(codeTime)
}}</view>
<text class="code" v-if="codeTime >0">{{ integral.codeTimeText(codeTime) }}</text>
<picker class="code" :range="smsName" @change="handleCode" v-else>
<view class="uni-input">{{ integral.code }}</view>
</picker>
</view>
</view>
</view>
......@@ -210,7 +212,9 @@ export default {
code: '',
// 验证码倒计时
codeTime: 0,
mobile: ''
mobile: '',
smsName: ['SMS','WhatsApp'],
smsData: [1,2],
}
},
onLoad(route) {
......@@ -274,7 +278,7 @@ export default {
}
},
// 获取验证码
async handleCode() {
async handleCode(e) {
if (this.codeTime > 0) return
this.codeTime = 60
this.timer = setInterval(() => {
......@@ -284,10 +288,16 @@ export default {
}
}, 1000)
try {
const memberId = this.$store.getters.id
await this.$request.post('/app-api/reward/redeem/send-sms-code', {
memberId
})
var data = {
memberId: this.$store.getters.id,
nodeValue: 'user-sms-redeem-reward',
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
await this.$request.post('/app-api/reward/redeem/send-sms-code', data)
} catch (error) {}
},
// 打开弹出层
......
......@@ -57,9 +57,9 @@
:placeholder="$lang.lang.notices.code"
/>
<view class="login-code" v-if="leftTime < 60">{{ leftTime }}S</view>
<view class="login-code" v-else @click="sendCode">{{
$lang.lang.login.code
}}</view>
<picker class="login-code" :range="smsName" @change="sendCode" v-else>
<view class="uni-input">{{ $lang.lang.login.code }}</view>
</picker>
</view>
</view>
<view class="login-v">
......@@ -147,6 +147,9 @@ export default {
areaName: [],
leftTime: 60,
referralCode: "",
smsName: ['SMS','WhatsApp'],
smsData: [1,2],
smsIndex: 0
};
},
onLoad() {
......@@ -187,36 +190,7 @@ export default {
areaChange(e) {
this.areaIndex = e.detail.value;
},
ismobile(code, mobile) {
this.$request
.get("/app-api/param/validator/mobile", { code: code, mobile: mobile })
.then((res) => {
if (res.code == 0) {
this.$request
.post("/app-api/member/send-sms-code", {
areaCode: this.areaData[this.areaIndex],
mobile: this.mobile,
scene: 0,
})
.then((res) => {
if (res.code == 0) {
this.countDown();
} else {
uni.showToast({
title: res.msg || "error",
icon: "none",
});
}
});
} else {
uni.showToast({
title: this.$lang.lang.notices.nophone,
icon: "error",
});
}
});
},
sendCode() {
sendCode(e) {
if (this.mobile == "") {
return uni.showToast({
title: this.$lang.lang.notices.phone,
......@@ -226,7 +200,40 @@ export default {
if (this.leftTime < 60) {
return false;
}
this.ismobile(this.areaData[this.areaIndex], this.mobile);
var data = {
mobile: this.mobile,
nodeValue: 'user-sms-reg',
areaCode: this.areaData[this.areaIndex],
code: this.areaData[this.areaIndex],
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
this.$request
.get("/app-api/param/validator/mobile", data)
.then((res) => {
if (res.code == 0) {
this.$request
.post("/app-api/member/send-sms-code", data)
.then((res) => {
if (res.code == 0) {
this.countDown();
} else {
uni.showToast({
title: res.msg || "error",
icon: "none",
});
}
});
} else {
uni.showToast({
title: this.$lang.lang.notices.nophone,
icon: "error",
});
}
});
},
countDown() {
this.leftTime--;
......
......@@ -19,7 +19,9 @@
<view class="login-vp">
<input class="vp-input" autocomplete="off" v-model="code" type="number" :placeholder="$lang.lang.notices.code">
<view class="login-code" v-if="leftTime < 60">{{leftTime}}S</view>
<view class="login-code" v-else @click="sendCode">{{$lang.lang.editEmail.getCode}}</view>
<picker class="login-code" :range="smsName" @change="sendCode" v-else>
<view class="uni-input">{{ $lang.lang.editEmail.code }}</view>
</picker>
</view>
</view>
<view class="login-vp login-v">
......@@ -55,7 +57,10 @@
leftTime: 60,
password:'',
password2:'',
userInfo:''
userInfo:'',
smsName: ['SMS','WhatsApp'],
smsData: [1,2],
smsIndex: 0
}
},
onLoad() {
......@@ -70,27 +75,6 @@
}
})
},
ismobile(mobile){
this.$request.get('/app-api/param/validator/mobile',{code:this.userInfo.areaCode,mobile:this.userInfo.mobile}).then(res => {
if(res.code==0){
this.$request.post('/app-api/member/send-sms-code', {areaCode: this.userInfo.areaCode, mobile: this.userInfo.mobile, scene:3}).then(res => {
if(res.code == 0){
this.countDown()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
})
}
})
}else{
uni.showToast({
title: this.$lang.lang.notices.nophone,
icon: 'error',
})
}
})
},
Country () {
let that = this
that.$request.get('/app-api/ecw/country/list-all').then(res => {
......@@ -106,11 +90,39 @@
}
})
},
sendCode () {
sendCode (e) {
if (this.leftTime < 60) {
return false
}
this.ismobile(this.userInfo.mobile)
var data = {
mobile: this.userInfo.mobile,
nodeValue: 'user-sms-reset-password',
areaCode: this.userInfo.areaCode,
code: this.userInfo.areaCode,
isTransport: 0,
transportId: 0,
isOrders: 0,
messageType: this.smsData[e.detail.value]
}
this.$request.get('/app-api/param/validator/mobile',data).then(res => {
if(res.code==0){
this.$request.post('/app-api/member/send-sms-code', data).then(res => {
if(res.code == 0){
this.countDown()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
})
}
})
}else{
uni.showToast({
title: this.$lang.lang.notices.nophone,
icon: 'error',
})
}
})
},
countDown() {
this.leftTime--
......
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