|
@@ -85,29 +85,29 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import axios from 'axios';
|
|
|
-import qs from 'qs';
|
|
|
-import _ from '@/config';
|
|
|
+import axios from "axios";
|
|
|
+import qs from "qs";
|
|
|
+import _ from "@/config";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
user: {
|
|
|
name: null,
|
|
|
mobile: null,
|
|
|
- address: null,
|
|
|
+ address: null
|
|
|
},
|
|
|
Vcode: {
|
|
|
create: this.createCode(),
|
|
|
enter: null,
|
|
|
sms: {
|
|
|
create: null,
|
|
|
- enter: null,
|
|
|
- },
|
|
|
+ enter: null
|
|
|
+ }
|
|
|
},
|
|
|
code: {
|
|
|
num: null,
|
|
|
- pwd: null,
|
|
|
- },
|
|
|
+ pwd: null
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -115,43 +115,54 @@ export default {
|
|
|
let self = this;
|
|
|
// 验证姓名
|
|
|
if (self.user.name == null) {
|
|
|
- weui.alert('请重新输入姓名!');
|
|
|
+ weui.alert("请重新输入姓名!");
|
|
|
return;
|
|
|
}
|
|
|
// 验证地址
|
|
|
if (self.user.address == null) {
|
|
|
- weui.alert('收货地址不为空!');
|
|
|
+ weui.alert("收货地址不为空!");
|
|
|
return;
|
|
|
}
|
|
|
// 验证手机
|
|
|
if (self.Vcode.sms.create != self.Vcode.sms.enter) {
|
|
|
- weui.alert('手机验证失败,请重新验证!');
|
|
|
+ weui.alert("手机验证失败,请重新验证!");
|
|
|
return;
|
|
|
}
|
|
|
// 验证兑换码
|
|
|
if (self.code.pwd == null) {
|
|
|
- weui.alert('请输入兑换码!');
|
|
|
+ weui.alert("请输入兑换码!");
|
|
|
return;
|
|
|
}
|
|
|
- /* // 验证兑换码密码
|
|
|
+ // 兑换码编号不为空
|
|
|
if (self.code.num == null) {
|
|
|
- weui.alert("请输入兑换码密码!");
|
|
|
+ weui.alert("请输入兑换码编号!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 验证兑换码编号
|
|
|
+ if (isNaN(self.code.num)) {
|
|
|
+ weui.alert("您输入的编号有误,请重新输入!");
|
|
|
return;
|
|
|
- } */
|
|
|
+ }
|
|
|
axios
|
|
|
.get(
|
|
|
`${_.apiPath}/j/JRecord/Record&user_id=${_.userId}&name=${
|
|
|
self.user.name
|
|
|
}&mobile=${self.user.mobile}&address=${self.user.address}&pwd=${
|
|
|
self.code.pwd
|
|
|
- }`,
|
|
|
+ }&coding_num=${self.code.num}`
|
|
|
)
|
|
|
.then(data => {
|
|
|
+ if (!data.data.success) {
|
|
|
+ weui.alert(data.data.message);
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ weui.alert(`您已成功兑换${data.data.data.gift.title}`, function() {
|
|
|
+ // self.$router.push("/");
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
// weui.alert('兑换成功!');
|
|
|
- weui.alert(`您已成功兑换${data.data.data.gift.title}`, function() {
|
|
|
- self.$router.push('/');
|
|
|
- });
|
|
|
- return;
|
|
|
// console.log(data);
|
|
|
// console.log(data.data.data.gift.desc);
|
|
|
// console.log(data.data.data.gift.title);
|
|
@@ -169,22 +180,22 @@ export default {
|
|
|
let self = this;
|
|
|
// 检验手机号码
|
|
|
if (!/^1[34578]\d{9}$/.test(self.user.mobile) || self.user.mobile === 0) {
|
|
|
- weui.alert('输入的手机号码有误,请重新输入');
|
|
|
+ weui.alert("输入的手机号码有误,请重新输入");
|
|
|
return;
|
|
|
}
|
|
|
// 验证码检测
|
|
|
if (self.Vcode.enter == null || self.Vcode.enter != self.Vcode.create) {
|
|
|
- weui.alert('您输入验证码有误,请重新输入');
|
|
|
+ weui.alert("您输入验证码有误,请重新输入");
|
|
|
return;
|
|
|
} else {
|
|
|
axios
|
|
|
.get(
|
|
|
`${_.apiPath}/moonclub/reserve/code&type=2&mobile=${
|
|
|
self.user.mobile
|
|
|
- }`,
|
|
|
+ }`
|
|
|
)
|
|
|
.then(data => {
|
|
|
- weui.alert('短信已发送,请留意查收!');
|
|
|
+ weui.alert("短信已发送,请留意查收!");
|
|
|
self.Vcode.sms.create = data.data.data.code;
|
|
|
console.log(data.data.data.code);
|
|
|
return;
|
|
@@ -192,7 +203,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
createCode() {
|
|
|
- let code = '';
|
|
|
+ let code = "";
|
|
|
let random = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; // 随机数
|
|
|
for (let i = 0; i < 4; i++) {
|
|
|
// 循环操作
|
|
@@ -203,9 +214,9 @@ export default {
|
|
|
},
|
|
|
back() {
|
|
|
console.log(170);
|
|
|
- this.$router.push('/');
|
|
|
- },
|
|
|
- },
|
|
|
+ this.$router.push("/");
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|