|
|
@@ -13,8 +13,10 @@ Page({
|
|
|
dropDownList: false,
|
|
|
methodsList: ['上游', '下游', '双向合作'],
|
|
|
showType: '',
|
|
|
+ seIndex: null, //合作方式
|
|
|
throttle: true, //截流
|
|
|
fisadministrator: null,
|
|
|
+ isCancel: false, //是否取消合作
|
|
|
},
|
|
|
/* 遮罩层点击关闭 */
|
|
|
closeTheDropDown() {
|
|
|
@@ -43,6 +45,7 @@ Page({
|
|
|
this.setData({
|
|
|
partnerDetails: data,
|
|
|
showType,
|
|
|
+ seIndex: data.ftype,
|
|
|
fisadministrator: (wx.getStorageSync('userData').fisadministrator == 1) ? false : true,
|
|
|
})
|
|
|
},
|
|
|
@@ -59,28 +62,12 @@ Page({
|
|
|
content: "是否更改与“" + this.data.partnerDetails.fbrand + "”合作方式为" + name,
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": wx.getStorageSync('userData').token,
|
|
|
- "classname": "customer.tagents.tagents",
|
|
|
- "method": "update_cooperation",
|
|
|
- "content": {
|
|
|
- "tcooperationagentsid": that.data.partnerDetails.tcooperationagentsid,
|
|
|
- "ftype": index + 1
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- wx.showToast({
|
|
|
- title: '修改成功'
|
|
|
- });
|
|
|
- that.setData({
|
|
|
- showType: name,
|
|
|
- "partnerDetails.ftype": index + 1
|
|
|
- })
|
|
|
+ that.setData({
|
|
|
+ showType: name,
|
|
|
+ seIndex: index + 1
|
|
|
})
|
|
|
}
|
|
|
+ that.closeTheDropDown();
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -111,32 +98,16 @@ Page({
|
|
|
success: function (res) {
|
|
|
if (res.confirm) {
|
|
|
that.setData({
|
|
|
- checked: detail
|
|
|
+ checked: detail,
|
|
|
+ isCancel: true
|
|
|
});
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": wx.getStorageSync('userData').token,
|
|
|
- "classname": "customer.tagents.tagents",
|
|
|
- "method": "delete_cooperation",
|
|
|
- "content": {
|
|
|
- "tcooperationagentsid": that.data.partnerDetails.tcooperationagentsid
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "error"
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1,
|
|
|
- })
|
|
|
- }, 500);
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
that.setData({
|
|
|
- checked: detail
|
|
|
+ checked: detail,
|
|
|
+ isCancel: false
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
@@ -152,18 +123,64 @@ Page({
|
|
|
/* 提交 */
|
|
|
submit() {
|
|
|
this.closeTheDropDown()
|
|
|
+ /* 截流 */
|
|
|
if (!this.data.throttle) return;
|
|
|
this.setData({
|
|
|
throttle: false
|
|
|
});
|
|
|
- wx.showToast({
|
|
|
- title: '保存成功'
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1,
|
|
|
+ /* 取消合作 */
|
|
|
+ if (this.data.isCancel) return _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.tagents.tagents",
|
|
|
+ "method": "delete_cooperation",
|
|
|
+ "content": {
|
|
|
+ "tcooperationagentsid": this.data.partnerDetails.tcooperationagentsid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "error"
|
|
|
})
|
|
|
- }, 500);
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ })
|
|
|
+ }, 500);
|
|
|
+ })
|
|
|
+ /* 发送修改请求 */
|
|
|
+ if (this.data.seIndex != this.data.partnerDetails.ftype) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.tagents.tagents",
|
|
|
+ "method": "update_cooperation",
|
|
|
+ "content": {
|
|
|
+ "tcooperationagentsid": this.data.partnerDetails.tcooperationagentsid,
|
|
|
+ "ftype": this.data.seIndex
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ wx.showToast({
|
|
|
+ title: '修改成功'
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ })
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '保存成功'
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ })
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|