|
@@ -4,6 +4,9 @@ var vm = new Vue({
|
|
|
data: function () {
|
|
|
return {
|
|
|
sessKey: '$data-data-pack-recharge',
|
|
|
+ userInfo: {
|
|
|
+ phone: ''
|
|
|
+ },
|
|
|
priceInfo: {},
|
|
|
price: {
|
|
|
before: 0, // 优惠前价格
|
|
@@ -74,6 +77,14 @@ var vm = new Vue({
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ // 手机号校验是否通过
|
|
|
+ validatorPhonePass: function () {
|
|
|
+ var phone = this.userInfo.phone
|
|
|
+ if (!phone) return true
|
|
|
+ return /^1\d{10}$/.test(phone)
|
|
|
+ },
|
|
|
+ },
|
|
|
watch: {
|
|
|
'charge.count': function () {
|
|
|
this.sortPrice()
|
|
@@ -82,11 +93,15 @@ var vm = new Vue({
|
|
|
specActive: function () {
|
|
|
this.sortPrice()
|
|
|
this.calcPrice()
|
|
|
- }
|
|
|
+ },
|
|
|
+ validatorPhonePass: function () {
|
|
|
+ this.checkStatus()
|
|
|
+ },
|
|
|
},
|
|
|
created: function () {
|
|
|
var restore = this.restoreState()
|
|
|
if (!restore) {
|
|
|
+ this.getUserInfo()
|
|
|
this.getGoodsList()
|
|
|
}
|
|
|
},
|
|
@@ -143,6 +158,18 @@ var vm = new Vue({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ getUserInfo: function () {
|
|
|
+ var _this = this
|
|
|
+ $.ajax({
|
|
|
+ url: '/jypay/user/getAccountInfo?t=' + Date.now(),
|
|
|
+ type: 'GET',
|
|
|
+ success: function (res) {
|
|
|
+ if (res && res.error_code === 0) {
|
|
|
+ Object.assign(_this.userInfo, res.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 根据请求返回值初始化页面参数
|
|
|
initPageInfo: function () {
|
|
|
var info = this.priceInfo
|
|
@@ -246,12 +273,18 @@ var vm = new Vue({
|
|
|
},
|
|
|
checkSubmitStatus: function (checkStatus) {
|
|
|
this.bottomConf.checkboxStatus = checkStatus
|
|
|
- return checkStatus
|
|
|
+ return checkStatus && this.validatorPhonePass
|
|
|
},
|
|
|
// 保证mounted之后执行
|
|
|
checkConfirmButtonDisabled: function () {
|
|
|
this.$refs.couponRef.submitStatus = !this.bottomConf.checkboxStatus
|
|
|
},
|
|
|
+ // 调用此方法,即可检测当前页面表单是否满足条件(可计算出提交按钮是否可用)
|
|
|
+ checkStatus: function () {
|
|
|
+ // 此处取反,因为在调用couponRef.chooseCheckbox时候,会对checkbox再次取反
|
|
|
+ this.bottomConf.checkboxStatus = !this.bottomConf.checkboxStatus
|
|
|
+ this.$refs.couponRef.chooseCheckbox()
|
|
|
+ },
|
|
|
readEvent: function () {
|
|
|
this.savePageState()
|
|
|
if (utils.isWeiXinBrowser) {
|
|
@@ -272,7 +305,8 @@ var vm = new Vue({
|
|
|
var packId = this.getPickId()
|
|
|
var data = {
|
|
|
packId: packId,
|
|
|
- lotteryId: this.$refs.couponRef.coupon.userLotteryId
|
|
|
+ lotteryId: this.$refs.couponRef.coupon.userLotteryId,
|
|
|
+ order_phone: this.userInfo.phone
|
|
|
}
|
|
|
$.ajax({
|
|
|
url: '/subscribepay/dataExportPack/createOrder',
|
|
@@ -306,6 +340,7 @@ var vm = new Vue({
|
|
|
if ($data) {
|
|
|
$data = JSON.parse($data)
|
|
|
Object.assign(this.priceInfo, $data.priceInfo)
|
|
|
+ Object.assign(this.userInfo, $data.userInfo)
|
|
|
Object.assign(this.price, $data.price)
|
|
|
this.specActive = $data.specActive
|
|
|
Object.assign(this.charge, $data.charge)
|
|
@@ -320,6 +355,7 @@ var vm = new Vue({
|
|
|
savePageState: function () {
|
|
|
var data = {
|
|
|
priceInfo: this.priceInfo,
|
|
|
+ userInfo: this.userInfo,
|
|
|
price: this.price,
|
|
|
specActive: this.specActive,
|
|
|
charge: this.charge,
|