Commit 3f673085 authored by honghy's avatar honghy

短信功能实作

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