| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 | 
							- import {
 
-     ApiModel
 
- } from "../../utils/api";
 
- const _Http = new ApiModel;
 
- Page({
 
-     /**
 
-      * 页面的初始数据
 
-      */
 
-     data: {
 
-         checked: true, //开关
 
-         partnerDetails: {}, //合作详情
 
-         dropDownList: false,
 
-         methodsList: ['上游', '下游', '双向合作'],
 
-         showType: '',
 
-         seIndex: null, //合作方式
 
-         throttle: true, //截流
 
-         fisadministrator: null,
 
-         isCancel: false, //是否取消合作
 
-     },
 
-     /* 遮罩层点击关闭 */
 
-     closeTheDropDown() {
 
-         this.setData({
 
-             dropDownList: false
 
-         })
 
-     },
 
-     /**
 
-      * 生命周期函数--监听页面加载
 
-      */
 
-     onLoad: function (options) {
 
-         const data = JSON.parse(options.data)
 
-         let showType = '';
 
-         switch (data.ftype) {
 
-             case 1:
 
-                 showType = '上游';
 
-                 break;
 
-             case 2:
 
-                 showType = '下游';
 
-                 break;
 
-             case 3:
 
-                 showType = '双向合作';
 
-                 break;
 
-         };
 
-         this.setData({
 
-             partnerDetails: data,
 
-             showType,
 
-             seIndex: data.ftype,
 
-             fisadministrator: (wx.getStorageSync('userData').fisadministrator == 1) ? false : true,
 
-         })
 
-     },
 
-     /* 选择合作方式 */
 
-     modeSelect(e) {
 
-         const {
 
-             name
 
-         } = e.target.dataset, {
 
-                 index
 
-             } = e.target.dataset,
 
-             that = this;
 
-         wx.showModal({
 
-             title: "提示",
 
-             content: "是否更改与“" + this.data.partnerDetails.fbrand + "”合作方式为" + name,
 
-             success(res) {
 
-                 if (res.confirm) {
 
-                     that.setData({
 
-                         showType: name,
 
-                         seIndex: index + 1
 
-                     })
 
-                 }
 
-                 that.closeTheDropDown();
 
-             }
 
-         })
 
-     },
 
-     /* 下拉 */
 
-     dropDown() {
 
-         if (this.data.fisadministrator) return wx.showToast({
 
-             title: '当前账号无权限操作',
 
-             icon: "none"
 
-         });
 
-         this.setData({
 
-             dropDownList: true
 
-         })
 
-     },
 
-     /* 开关 */
 
-     onChange({
 
-         detail
 
-     }) {
 
-         const that = this;
 
-         if (this.data.fisadministrator) return wx.showToast({
 
-             title: '当前账号无权限操作',
 
-             icon: "none"
 
-         });
 
-         this.closeTheDropDown()
 
-         if (this.data.checked) {
 
-             wx.showModal({
 
-                 title: "提示",
 
-                 content: '是否确定取消与“' + this.data.partnerDetails.fbrand + '”的合作关系',
 
-                 success: function (res) {
 
-                     if (res.confirm) {
 
-                         that.setData({
 
-                             checked: detail,
 
-                             isCancel: true
 
-                         });
 
-                     }
 
-                 }
 
-             })
 
-         } else {
 
-             that.setData({
 
-                 checked: detail,
 
-                 isCancel: false
 
-             });
 
-         }
 
-     },
 
-     /* 预览合作商logo */
 
-     previewImg() {
 
-         const urls = [this.data.partnerDetails.attinfos[0].fobsurl]
 
-         this.closeTheDropDown()
 
-         wx.previewImage({
 
-             current: 1, // 当前显示图片的http链接
 
-             urls: urls
 
-         })
 
-     },
 
-     /* 提交 */
 
-     submit() {
 
-         this.closeTheDropDown()
 
-         /* 截流 */
 
-         if (!this.data.throttle) return;
 
-         this.setData({
 
-             throttle: false
 
-         });
 
-         /* 取消合作 */
 
-         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"
 
-             })
 
-             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);
 
-         }
 
-     },
 
-     /**
 
-      * 生命周期函数--监听页面初次渲染完成
 
-      */
 
-     onReady: function () {
 
-     },
 
-     /**
 
-      * 生命周期函数--监听页面显示
 
-      */
 
-     onShow: function () {
 
-     },
 
-     /**
 
-      * 生命周期函数--监听页面隐藏
 
-      */
 
-     onHide: function () {
 
-     },
 
-     /**
 
-      * 生命周期函数--监听页面卸载
 
-      */
 
-     onUnload: function () {
 
-     },
 
-     /**
 
-      * 页面相关事件处理函数--监听用户下拉动作
 
-      */
 
-     onPullDownRefresh: function () {
 
-     },
 
-     /**
 
-      * 页面上拉触底事件的处理函数
 
-      */
 
-     onReachBottom: function () {
 
-     },
 
-     /**
 
-      * 用户点击右上角分享
 
-      */
 
-     onShareAppMessage: function () {
 
-     }
 
- })
 
 
  |