123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- import {
- ApiModel
- } from "../../../utils/api";
- const _Http = new ApiModel();
- const handleList = require("../../../utils/processingData");
- let shareTime = null;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- detalis: {}, //详情数据
- shareObj: null,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- const item = JSON.parse(options.item);
- console.log("供需信息", item)
- this.setData({
- detalis: item
- });
- /* 获取推荐列表 */
- _Http.basic({
- "classname": "publicmethod.homepage.homepage",
- "method": "query_supplyanddemandList",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": 1,
- "pageSize": 10,
- "siteid": "BWJ",
- "where": {
- "ftype": "",
- "fissupply": "0",
- "fstatus": "待对接"
- }
- }
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- const data = handleList.getYTD(res.data);
- this.setData({
- productList: data
- });
- });
- /* 浏览计数 */
- if (item.tenterprise_userid != wx.getStorageSync('userData').userid) _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.supplyanddemand.supplyanddemand",
- "method": "query_supplyanddemandMain",
- "content": {
- "tsupplyanddemandid": item.tsupplyanddemandid
- }
- }, false).then(res => {
- if (res.msg != '成功') _Http.basic({
- "classname": "publicmethod.homepage.homepage",
- "method": "query_supplyanddemandMain",
- "content": {
- "tsupplyanddemandid": item.tsupplyanddemandid,
- "tagentsid": item.tagentsid
- }
- })
- })
- },
- /* 电话联系 */
- callUp(e) {
- wx.makePhoneCall({
- phoneNumber: e.currentTarget.dataset.phone
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /* 回调 */
- shareCallBack({
- detail
- }) {
- this.setData({
- shareObj: detail
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage(e) {
- const that = this;
- if (e.from == 'button') {
- const promise = new Promise(resolve => {
- shareTime = setInterval(() => {
- if (that.data.shareObj != null) {
- let str = JSON.stringify(that.data.shareObj),
- obj = JSON.parse(str);
- that.setData({
- shareObj: null
- })
- clearInterval(shareTime);
- resolve({
- title: obj.ftitle,
- path: '/pages/tabbar-pages/home/sdDetalis?item=' + str,
- imageUrl: obj.attinfos.length >= 1 ? obj.attinfos[0].fobsurl : '',
- success: function (res) {
- if (res.errMsg == 'shareAppMessage:ok') {
- wx.showToast({
- title: '分享成功',
- })
- }
- },
- })
- }
- }, 300)
- })
- return {
- title: '自定义转发标题',
- path: '/page/user?id=123',
- promise
- }
- /* */
- } else {
- let obj = this.data.detalis,
- str = JSON.stringify(obj);
- return {
- title: obj.ftitle,
- path: '/pages/tabbar-pages/home/sdDetalis?item=' + str,
- imageUrl: obj.attinfos.length >= 1 ? obj.attinfos[0].fobsurl : '',
- success: function (res) {
- if (res.errMsg == 'shareAppMessage:ok') {
- wx.showToast({
- title: '分享成功',
- })
- }
- },
- }
- }
- }
- })
|