|
|
@@ -8,25 +8,50 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- showBtn: -1,//选中下标
|
|
|
- pattern: false,//显示方式选择
|
|
|
- dropDownList:false,//显示下拉菜单
|
|
|
- methodsList:['上游','下游','双向合作'],
|
|
|
- addvalue:""
|
|
|
+ requestList: [], //请求列表
|
|
|
+ showBtn: -1, //选中下标
|
|
|
+ pattern: false, //显示方式选择
|
|
|
+ dropDownList: false, //显示下拉菜单
|
|
|
+ methodsList: ['上游', '下游', '双向合作'],
|
|
|
+ addvalue: ""
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
-
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.tagents.tagents",
|
|
|
+ "method": "query_cooperation",
|
|
|
+ "content": {
|
|
|
+ "getdatafromdbanyway": true,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "ftype": "",
|
|
|
+ "fstatus": "申请"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.msg != "成功") return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ requestList: res.data
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
- onChange({detail}){
|
|
|
+ onChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
this.setData({
|
|
|
- addvalue:detail
|
|
|
+ addvalue: detail
|
|
|
})
|
|
|
},
|
|
|
- onClick(){
|
|
|
+ onClick() {
|
|
|
_Http.basic({
|
|
|
"accesstoken": wx.getStorageSync('userData').token,
|
|
|
"classname": "customer.tagents.tagents",
|
|
|
@@ -35,7 +60,7 @@ Page({
|
|
|
"tcooperationagentsid": "27303",
|
|
|
"ftype": "1"
|
|
|
}
|
|
|
- }).then(res=>{
|
|
|
+ }).then(res => {
|
|
|
console.log(res)
|
|
|
})
|
|
|
},
|
|
|
@@ -46,41 +71,78 @@ Page({
|
|
|
onReady: function () {
|
|
|
|
|
|
},
|
|
|
- modeSelect(e){
|
|
|
- const { index } = e.target.dataset;
|
|
|
- const content=(this.data.methodsList[index]=='双向合作')?'是否确定***作为您的'+this.data.methodsList[index]+'伙伴':'是否确定***作为您的'+this.data.methodsList[index]+'合作伙伴';
|
|
|
+ modeSelect(e) {
|
|
|
+ const {
|
|
|
+ index
|
|
|
+ } = e.target.dataset,
|
|
|
+ i = this.data.showBtn,
|
|
|
+ that = this;
|
|
|
+ const content = (this.data.methodsList[index] == '双向合作') ? '是否确定将“' + this.data.requestList[i].fagentname + '”作为您的“' + this.data.methodsList[index] + '”伙伴' : '是否确定将“' + this.data.requestList[i].fagentname + '”作为您的“' + this.data.methodsList[index] + '合作”伙伴';
|
|
|
+ let ftype = Number;
|
|
|
+ switch (this.data.methodsList[index]) {
|
|
|
+ case "上游":
|
|
|
+ ftype = 1;
|
|
|
+ break;
|
|
|
+ case "下游":
|
|
|
+ ftype = 2;
|
|
|
+ break;
|
|
|
+ case "双向合作":
|
|
|
+ ftype = 3;
|
|
|
+ break;
|
|
|
+ }
|
|
|
wx.showModal({
|
|
|
title: '提示',
|
|
|
content: content,
|
|
|
success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('确定')
|
|
|
- } else {
|
|
|
- console.log('取消')
|
|
|
- }
|
|
|
+ if (res.confirm) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.tagents.tagents",
|
|
|
+ "method": "cooperation",
|
|
|
+ "content": {
|
|
|
+ "tcooperationagentsid": that.data.requestList[i].tcooperationagentsid,
|
|
|
+ "ftype": ftype
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ wx.showToast({
|
|
|
+ title: '合作成功!',
|
|
|
+ })
|
|
|
+ let requestList = that.data.requestList;
|
|
|
+ requestList.splice(i, 1);
|
|
|
+ that.setData({
|
|
|
+ requestList
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('取消')
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
+ })
|
|
|
},
|
|
|
/* 选择 */
|
|
|
showBtnIndex(e) {
|
|
|
const {
|
|
|
index
|
|
|
} = e.currentTarget.dataset;
|
|
|
- if(index==this.data.showBtn) return;
|
|
|
+ if (index == this.data.showBtn) return;
|
|
|
this.setData({
|
|
|
pattern: false,
|
|
|
showBtn: index,
|
|
|
})
|
|
|
},
|
|
|
/* 选择合作方式 */
|
|
|
- chooseCooperationMode(){
|
|
|
+ chooseCooperationMode() {
|
|
|
this.setData({
|
|
|
- dropDownList:!this.data.dropDownList
|
|
|
+ dropDownList: !this.data.dropDownList
|
|
|
})
|
|
|
},
|
|
|
- hiddenDropDown(){
|
|
|
+ hiddenDropDown() {
|
|
|
this.setData({
|
|
|
- dropDownList:false
|
|
|
+ dropDownList: false
|
|
|
})
|
|
|
},
|
|
|
/* 同意 */
|
|
|
@@ -89,6 +151,40 @@ Page({
|
|
|
pattern: true
|
|
|
})
|
|
|
},
|
|
|
+ /* 拒绝 */
|
|
|
+ refuse(e) {
|
|
|
+ const {
|
|
|
+ index
|
|
|
+ } = e.currentTarget.dataset,
|
|
|
+ that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: '是否确定拒绝“' + this.data.requestList[index].fbrand + '”的合作请求',
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.tagents.tagents",
|
|
|
+ "method": "delete_cooperation",
|
|
|
+ "content": {
|
|
|
+ "tcooperationagentsid": that.data.requestList[index].tcooperationagentsid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ let requestList = that.data.requestList;
|
|
|
+ requestList.splice(index, 1)
|
|
|
+ that.setData({
|
|
|
+ requestList
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|