123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- import {
- ApiModel
- } from "../../../utils/api";
- const _Http = new ApiModel();
- const handleList = require("../../../utils/processingData");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- recommendationList: [], //推荐列表
- particulars: {}, //详情
- ceiling: false, //是否吸顶
- Heitop: 0, //吸顶高度
- },
- /**
- * 生命周期函数--监听页面加载
- */
- 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 => {
- console.log(res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- let checkdate = res.data[0].checkdate;
- if (checkdate != '' && checkdate != null && checkdate != undefined) res.data[0].checkdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
- const particulars = handleList.imageType(res.data[0], "default");
- this.setData({
- particulars
- })
- });
- /* 获取推荐列表 */
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.supplyanddemand.supplyanddemand",
- "method": "query_supplyanddemandList",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": 1,
- "pageSize": 10,
- "where": {}
- }
- }).then(res => {
- console.log("查询列表", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- const data = handleList.checkdate(res.data)
- const recommendationList = handleList.imageType(data, "default");
- this.setData({
- recommendationList
- })
- })
- },
- /* 跳转商品详情页 */
- 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() {
- },
- /* 一键联系 */
- toLinkUp(e) {
- const {
- tsupplyanddemandid,
- tenterprise_userid
- } = e.currentTarget.dataset.item;
- if (tenterprise_userid == wx.getStorageSync('userData').userid) return;
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.supplyanddemand.supplyanddemand",
- "method": "OpenImDialog",
- "content": {
- "tsupplyanddemandid": tsupplyanddemandid
- }
- }).then(res => {
- console.log("创建聊天", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- wx.navigateTo({
- url: '/pages/chatRoom/dialogbox?id=' + res.data[0].timdialogid,
- })
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- })
|