123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- // 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() {},
- });
|