|
|
|
@ -1,7 +1,8 @@ |
|
|
|
// xtends//vip/index.js
|
|
|
|
import Scene from '../../index/scene' |
|
|
|
import { getMemberList, buyMemberInfo } from "../../../api/saas" |
|
|
|
import { getFactoryLicence, getMemberList, buyMemberInfo } from "../../../api/saas" |
|
|
|
import util from '../../../utils/util' |
|
|
|
const event = require('../../../utils/event.js') |
|
|
|
const app = getApp() |
|
|
|
|
|
|
|
Scene({ |
|
|
|
@ -10,7 +11,9 @@ Scene({ |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
factoryName: '', |
|
|
|
memberList: [{"id":"49606500024333519","days":30,"bidPrice":1.00,"realPrice":1.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"yitianhuiyuanqntest","iosBidPrice":1.00,"iosRealPrice":1.00},{"id":"481107395657994240","days":5,"bidPrice":1.00,"realPrice":0.01,"icon":null,"title":"天","sellStrategy":"twoForOneAtFirstTime","iosId":null,"iosBidPrice":0.00,"iosRealPrice":0.00},{"id":"483353095548571648","days":30,"bidPrice":2000.00,"realPrice":1000.00,"icon":null,"title":"天","sellStrategy":"twoForOneAtFirstTime","iosId":"ztb_vip_30_01","iosBidPrice":1998.00,"iosRealPrice":998.00},{"id":"483353355918381056","days":90,"bidPrice":4000.00,"realPrice":2000.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"ztb_vip_90","iosBidPrice":3998.00,"iosRealPrice":1998.00},{"id":"483353702984454144","days":180,"bidPrice":6000.00,"realPrice":3000.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"ztb_vip_180","iosBidPrice":5898.00,"iosRealPrice":2998.00},{"id":"483354024398163968","days":365,"bidPrice":10000.00,"realPrice":5000.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"ztb_vip_365","iosBidPrice":9998.00,"iosRealPrice":4998.00},{"id":"496065000243335168","days":30,"bidPrice":1000.00,"realPrice":500.00,"icon":null,"title":"天(限时)","sellStrategy":"common","iosId":"ztb_vip_30_02","iosBidPrice":998.00,"iosRealPrice":488.00}], |
|
|
|
expirationTime: null, |
|
|
|
isExpiration: null, |
|
|
|
memberList: [], |
|
|
|
divIndexId: '49606500024333519', |
|
|
|
}, |
|
|
|
/** |
|
|
|
@ -18,15 +21,37 @@ Scene({ |
|
|
|
*/ |
|
|
|
onLoad: function (options) { |
|
|
|
wx.showLoading({ title: '加载中', mask: true }) |
|
|
|
if(util.isEmpty(app.userInfo.expirationTime)){ |
|
|
|
getFactoryLicence().then(result => { |
|
|
|
app.userInfo.expirationTime = result.expirationTime.substring(0, 10) |
|
|
|
app.userInfo.isExpiration = result.isExpiration |
|
|
|
this.setData({ expirationTime:app.userInfo.expirationTime, isExpiration: result.isExpiration }) |
|
|
|
}) |
|
|
|
} |
|
|
|
getMemberList().then(res => { |
|
|
|
var memberList = res.data.records |
|
|
|
wx.hideLoading() |
|
|
|
this.setData({ factoryName: app.userInfo.factoryName, memberList: res.data, divIndexId:res.data[0].id }) |
|
|
|
this.setData({ factoryName: app.userInfo.factoryName, |
|
|
|
memberList, divIndexId: memberList[0].id, |
|
|
|
expirationTime: app.userInfo.expirationTime, |
|
|
|
isExpiration: app.userInfo.isExpiration |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
wx.hideLoading() |
|
|
|
this.setData({factoryName: app.userInfo.factoryName}) |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
}) |
|
|
|
event.on('EventMessage', this, this.onEvent) |
|
|
|
}, |
|
|
|
onEvent: function(message){ |
|
|
|
if (message.what == 300) { |
|
|
|
getFactoryLicence().then(result => { |
|
|
|
app.userInfo.expirationTime = result.data.expirationTime.substring(0, 10) |
|
|
|
app.userInfo.isExpiration = result.data.isExpiration |
|
|
|
this.setData({ expirationTime: app.userInfo.expirationTime, isExpiration: result.data.isExpiration }) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
onGridTap:function(e){ |
|
|
|
var index = e.currentTarget.dataset.index |
|
|
|
this.setData({ divIndexId: this.data.memberList[index].id }) |
|
|
|
@ -35,10 +60,13 @@ Scene({ |
|
|
|
wx.showLoading({ title: '处理中', mask: true }) |
|
|
|
buyMemberInfo({ memberExpenseId: this.data.divIndexId }).then(res => { |
|
|
|
wx.hideLoading() |
|
|
|
wx.navigateTo({ url: '/pages/ztbvip/payment/index?type=2&orderId=' + res.data.orderId }) |
|
|
|
wx.navigateTo({ url: '/pages/ztbvip/payment/index?type=2&orderId=' + res.data.tradeOrderId }) |
|
|
|
}).catch(err => { |
|
|
|
wx.hideLoading() |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
onUnload: function(){ |
|
|
|
event.remove('EventMessage', this) |
|
|
|
} |
|
|
|
}) |