|
- // pages/spellGroup/mySpellGroup/index.js
- var config = require("../../../config/config.js");
- const Http = require("../../../utils/HttpBasics");
- const imgurl = require("../../../utils/imgurl");
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- couponChannelId:'',
- couponId:'',
- detailData:[],
- spellData:null
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- couponChannelId: options.couponChannelId,
- couponId: options.couponId
- })
- this.getDetail(options.couponChannelId);
- this.getOneSpell(options.couponId)
- },
- /**
- * 获取一个拼团信息
- */
- getOneSpell(couponId){
- let that = this;
- Http.get({
- url: config.api.queryRemainOne,
- data: {
- couponId: couponId
- }
- }).then(res => {
- if(res.data){
- that.setData({
- spellData: res.data
- });
- }
- });
- },
- /**
- * 获取券详情信息
- */
- getDetail(couponChannelId){
- let that = this;
- Http.get({
- url: config.api.couponDetail,
- data: {
- couponChannelId: couponChannelId
- }
- }).then(res => {
- let data = res.data;
- data.price = (data.price / 100).toFixed(2)
- data.salePrice = (data.salePrice / 100).toFixed(2)
- that.setData({
- detailData: data
- });
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
- })
|