| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 | import {    ApiModel} from "../../../utils/api";const _Http = new ApiModel();const handleList = require("../../../utils/processingData");Page({    /**     * 页面的初始数据     */    data: {        recommendationList: [], //推荐列表        particulars: {}, //详情    },    /**     * 生命周期函数--监听页面加载     */    onLoad: function (options) {        let method = "query_supplyanddemandMain";        if (options.type == 2) method = "query_mysupplyanddemandMain";        _Http.basic({            "accesstoken": wx.getStorageSync('userData').token,            "classname": "customer.supplyanddemand.supplyanddemand",            "method": method,            "content": {                "tsupplyanddemandid": options.tsupplyanddemandid            }        }).then(res => {            let checkdate = res.data[0].checkdate;            res.data[0].checkdate = checkdate.slice(0, checkdate.lastIndexOf('.'));            this.setData({                particulars: res.data[0]            })        });        /* 获取推荐列表 */        _Http.basic({            "accesstoken": wx.getStorageSync('userData').token,            "classname": "customer.supplyanddemand.supplyanddemand",            "method": "query_supplyanddemandList",            "content": {                "getdatafromdbanyway": true,                "pageNumber": 1,                "pageSize": 10,                "where": {}            }        }).then(res => {            const data = handleList.checkdate(res.data)            const productList = handleList.listOrdering(data);            this.setData({                recommendationList: productList            })        })    },    /* 跳转商品详情页 */    jumpForDetails(e) {        const {            index        } = e.currentTarget.dataset,            id = this.data.recommendationList[index].tsupplyanddemandid;        wx.navigateTo({            url: '/pages/tabbar-pages/supplyAndDemand/particulars?tsupplyanddemandid=' + id,        })    },    /* 预览图片 */    previewImage(e) {        let imageList = this.data.particulars.attinfos,            urls = [];        for (let i = 0; i < imageList.length; i++) {            urls.push(imageList[i].fobsurl)        }        const {            index        } = e.currentTarget.dataset        wx.previewImage({            urls: urls,            current: index        })    },    /* 阻止冒泡 */    stop() {    },    /* 一键联系 */    contact() {        console.log('一键联系')    },    /**     * 生命周期函数--监听页面初次渲染完成     */    onReady: function () {    },    /**     * 生命周期函数--监听页面显示     */    onShow: function () {    },    /**     * 生命周期函数--监听页面隐藏     */    onHide: function () {    },    /**     * 生命周期函数--监听页面卸载     */    onUnload: function () {    },    /**     * 页面相关事件处理函数--监听用户下拉动作     */    onPullDownRefresh: function () {    },    /**     * 页面上拉触底事件的处理函数     */    onReachBottom: function () {    },    /**     * 用户点击右上角分享     */    onShareAppMessage: function () {    }})
 |