123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- import {
- ApiModel
- } from "../../utils/api"
- const _Http = new ApiModel();
- let WxParse = require('../../wxParse/wxParse.js');
- let processingData = require('../../utils/processingData.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- storeMsg: [], //用户信息
- showSaleprodclass: [], //显示经营分类
- productList: [], //产品列表
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- /* 获取用户信息 */
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.tagents.tagents",
- "method": "query_cooperationAgentsMain",
- "content": {
- "tagentsid": options.id
- }
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: 'none'
- })
- if (res.data[0].fintroduction != 'null' && res.data[0].fintroduction != '' && res.data[0].fintroduction != undefined) {
- var article = res.data[0].fintroduction;
- var that = this;
- WxParse.wxParse('article', 'html', article, that, 5);
- }
- //处理经营分类
- let showSaleprodclass = '';
- if (res.data[0].saleprodclass != '' && res.data[0].saleprodclass != 'null' && res.data[0].saleprodclass != undefined) {
- for (let i = 0; i < res.data[0].saleprodclass.length; i++) {
- showSaleprodclass += ',' + res.data[0].saleprodclass[i]
- }
- showSaleprodclass = showSaleprodclass.slice(1)
- }
- let data = res.data[0]
- for (let i in data) {
- if (data[i] == '' || data[i] == null || data[i] == undefined || data[i] == []) {
- data[i] = '暂无'
- }
- }
- if (showSaleprodclass == '') showSaleprodclass = '暂无';
- this.setData({
- storeMsg: data,
- showSaleprodclass
- })
- });
- /* 获取产品列表 */
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.products.products",
- "method": "query_cooperationProductsList",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": 1,
- "pageSize": 30,
- "tagentsid": options.id
- }
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: 'none'
- })
- let list = processingData.imageType(res.data, "default")
- let productList = processingData.twoDimensionalArr(list, 6, 5),
- double = '';
- (productList[0].length > 3) ? double = true: double = false;
- this.setData({
- productList,
- double
- })
- })
- },
- toLinkUp() {
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "system.im.imdialog.imdialog",
- "method": "quickcontact",
- "content": {
- "tenterprise_userid": this.data.storeMsg.tenterprise_userid
- }
- }).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 () {
- }
- })
|