|
@@ -1,4 +1,7 @@
|
|
|
-// pages/chatRoom/create.js
|
|
|
+import {
|
|
|
+ ApiModel
|
|
|
+} from "../../utils/api";
|
|
|
+const _Http = new ApiModel();
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -6,15 +9,73 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
inputValue: '', //群名
|
|
|
- activeNames: ['1']
|
|
|
+ buddyList: [], //好友列表
|
|
|
+ activeNames: [], //折叠面板展开项
|
|
|
+ identity: '全部', //选择身份
|
|
|
+ result: []
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.tagents.tagents",
|
|
|
+ "method": "query_cooperation",
|
|
|
+ "content": {
|
|
|
+ "getdatafromdbanyway": true,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 999,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "ftype": "",
|
|
|
+ "fstatus": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ let activeNames = [];
|
|
|
+ for (let index = 0; index < res.data.length; index++) {
|
|
|
+ this.query_CooperationAgentUsers(res.data[index])
|
|
|
+ activeNames.push(index)
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ activeNames
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
+ /* 商户成员列表 */
|
|
|
+ query_CooperationAgentUsers(data) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.tagents.tagents",
|
|
|
+ "method": "query_CooperationAgentUsers",
|
|
|
+ "content": {
|
|
|
+ "getdatafromdbanyway": true,
|
|
|
+ "tagentsid": data.tcooperationagentsid
|
|
|
+ }
|
|
|
+ }, false).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ data.userList = res.data;
|
|
|
+ let buddyList = this.data.buddyList;
|
|
|
+ buddyList.push(data)
|
|
|
+ this.setData({
|
|
|
+ buddyList
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 职位选择类型 */
|
|
|
+ selectType({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ if (this.data.identity != detail) this.setData({
|
|
|
+ detail
|
|
|
+ });
|
|
|
+ },
|
|
|
/* 编辑群名称 */
|
|
|
nameInput(e) {
|
|
|
const {
|
|
@@ -24,66 +85,89 @@ Page({
|
|
|
inputValue: value
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
/* 折叠面板 */
|
|
|
collapseChange(event) {
|
|
|
this.setData({
|
|
|
activeNames: event.detail,
|
|
|
});
|
|
|
},
|
|
|
+ //多选选中
|
|
|
+ userListCheckboxChange(e) {
|
|
|
+ this.setData({
|
|
|
+ result: e.detail
|
|
|
+ })
|
|
|
+ },
|
|
|
/* 标题选择框 */
|
|
|
titleRadio(e) {
|
|
|
const {
|
|
|
- index
|
|
|
+ index,
|
|
|
+ id
|
|
|
} = e.target.dataset;
|
|
|
- console.log(index)
|
|
|
+ if (!this.data.result.some((value) => value == id)) this.batchChange(index, false);
|
|
|
+ },
|
|
|
+ //批量修改
|
|
|
+ batchChange(index, bool) {
|
|
|
+ let data = this.data.buddyList[index].userList,
|
|
|
+ result = this.data.result;
|
|
|
+ for (let index = 0; index < data.length; index++) {
|
|
|
+ if (bool) {
|
|
|
+ if (!result.some((v) => v == data[index])) result.push(data[index].tenterprise_userid.toString())
|
|
|
+ } else {
|
|
|
+ result = result.filter((value) => value != data[index].tenterprise_userid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ result
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 选择子账号同时选中主账号 */
|
|
|
+ listClick(e) {
|
|
|
+ const index = e.currentTarget.dataset.index,
|
|
|
+ itemId = e.currentTarget.dataset.id,
|
|
|
+ id = e.currentTarget.id;
|
|
|
+ if (index == 0) return;
|
|
|
+ let result = this.data.result;
|
|
|
+ if (!result.some((v) => v == itemId)) return;
|
|
|
+ if (!result.some((value) => value == id)) {
|
|
|
+ result.push(id)
|
|
|
+ this.setData({
|
|
|
+ result
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
- onReady: function () {
|
|
|
-
|
|
|
- },
|
|
|
+ onReady: function () {},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
- onShow: function () {
|
|
|
-
|
|
|
- },
|
|
|
+ onShow: function () {},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
- onHide: function () {
|
|
|
-
|
|
|
- },
|
|
|
+ onHide: function () {},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
- onUnload: function () {
|
|
|
-
|
|
|
- },
|
|
|
+ onUnload: function () {},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
- onPullDownRefresh: function () {
|
|
|
-
|
|
|
- },
|
|
|
+ onPullDownRefresh: function () {},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
- onReachBottom: function () {
|
|
|
-
|
|
|
- },
|
|
|
+ onReachBottom: function () {},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
- onShareAppMessage: function () {
|
|
|
-
|
|
|
- }
|
|
|
+ onShareAppMessage: function () {}
|
|
|
})
|