// pages/quality/detail/index.js let wxparse = require("../../../wxParse/wxParse.js"); var util = require("../../../utils/util.js"); const tool = require("../../../utils/tool"); var app = getApp(); Page({ /** * 页面的初始数据 */ data: { appAssetsUrl2: app.appAssetsUrl2, user: {}, popup2: null, detail: {}, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getDetail(options.id); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { this.popup2 = this.selectComponent("#popup2"); }, /** * 生命周期函数--监听页面显示 */ onShow() { this.setData({ user: wx.getStorageSync("USER") || {} }) }, getDetail(id) { app._get(`goods/info/${id}`, {}, (res) => { if (res.code == 0) { this.setData({ detail: res.goods, }); wxparse.wxParse("details", "html", res.goods.details, this, 0); } }); }, wantTo(e) { if (this.data.user && !this.data.user.id) { tool.alert("请先前往个人中心进行登录授权"); return false; } if (this.data.user.memberState == 0 && this.data.detail.memberApply) { tool.alert("您还不是会员,请联系平台客服处理"); return false; } this.popup2.showPopup(); app._post_form( "goodsapply/save", "application/json", { userId: this.data.user.id, goodsId: this.data.detail.id, }, function (res) {} ); }, seeBigCode(e) { let arr = [this.data.detail.qrCode]; wx.previewImage({ urls: arr, // 需要预览的图片http链接列表 }); }, _success(e) { this.popup2.hidePopup(); }, //取消事件 _error(e) { this.popup2.hidePopup(); }, /** * 生命周期函数--监听页面隐藏 */ onHide() {}, /** * 生命周期函数--监听页面卸载 */ onUnload() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom() {}, /** * 用户点击右上角分享 */ onShareAppMessage() {}, });