123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- // pages/subCardDetails/subCardDetails.js
- import {
- get,
- post
- } from '../../../utils/http.js'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- pageData: {},
- recommendList: [],
- descList: [],
- id: 0,
- store_id: 0,
- storeId: '',
- btnDisabled:false //功能完毕按钮失效
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.setData({
- id: options.id,
- store_id: options.store_id,
- storeId: wx.getStorageSync('store_id'),
- })
- // 查询次卡详情
- this.cardDetails()
- },
- // 查询次卡详情
- cardDetails(){
- let { id } = this.data
- get('v2/api/user/card/info',{
- id
- },(res) => {
- console.log(res);
- this.setData({
- pageData: res.data
- })
- // 查询次卡推荐商品
- this.cardRecommend()
- })
- },
- // 查询次卡推荐商品
- cardRecommend(){
- let { storeId } = this.data
- get('v2/api/card/recommend',{
- card_id: this.data.pageData.card_id,
- store_id:storeId
- },(res) => {
- console.log(res,'cardRecommend')
- this.setData({
- recommendList: res.data.list
- })
- })
- },
- // 跳转到项目详情
- jumpProject(e){
- let {total_num,used_num} = e.currentTarget.dataset.project
- if(total_num-used_num==0){
- return
- }
- let project_id = e.currentTarget.dataset.project.project_id
- wx.navigateTo({
- url: `/pages/projectDetail/projectDetail?source=project&id=${project_id}&store_id=${this.data.storeId}`,
- })
- },
- // 跳转美妆产品
- jumpBeautyMakeup(e){
- let id = e.currentTarget.dataset.id
- wx.navigateTo({
- url: `/pages/projectDetail/projectDetail?source=goods&id=${id}&store_id=${this.data.storeId}`,
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|