|
@@ -1,246 +0,0 @@
|
|
|
-import {
|
|
|
- ApiModel
|
|
|
-} from "../../utils/api";
|
|
|
-const _Http = new ApiModel();
|
|
|
-Page({
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面的初始数据
|
|
|
- */
|
|
|
- data: {
|
|
|
- codeMsg: '', // type: partner-申请合作 shop-加入团队
|
|
|
- manner: "双向合作",
|
|
|
- selectType: 3,
|
|
|
- show: false
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- query */
|
|
|
- onLoad: function (query) {
|
|
|
- console.log(query)
|
|
|
- if (query.url) {
|
|
|
- const q = decodeURIComponent(query.url);
|
|
|
- return this.setDataUrl(q)
|
|
|
- } else if (query.q) { // 获取到二维码原始链接内容、
|
|
|
- const q = decodeURIComponent(query.q);
|
|
|
- return this.setDataUrl(q)
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- codeMsg: wx.getStorageSync('qrCodeMsg')
|
|
|
- })
|
|
|
- wx.setStorageSync('qrCodeMsg', "")
|
|
|
- console.log(wx.getStorageSync('qrCodeMsg'))
|
|
|
- }
|
|
|
- },
|
|
|
- setDataUrl(url) {
|
|
|
- let q = url;
|
|
|
- console.log("q", q)
|
|
|
- const data = {
|
|
|
- type: q.slice(q.indexOf("type=") + 5, q.indexOf('&')),
|
|
|
- id: q.slice(q.lastIndexOf('=') + 1),
|
|
|
- name: q.slice(q.lastIndexOf('fbrand=') + 7, q.lastIndexOf('&'))
|
|
|
- }
|
|
|
- if (!wx.getStorageSync('userData').token) {
|
|
|
- wx.setStorageSync('qrCodeMsg', data);
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '当前未登录,请登录后进入',
|
|
|
- showCancel: false,
|
|
|
- success: (res => {
|
|
|
- if (res.confirm) wx.navigateTo({
|
|
|
- url: '/pages/login/index',
|
|
|
- })
|
|
|
- })
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- codeMsg: data
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- /* 确定 */
|
|
|
- confirm() {
|
|
|
- const that = this;
|
|
|
- if (this.data.codeMsg.type == 'partner') {
|
|
|
- wx.showModal({
|
|
|
- title: "提示",
|
|
|
- content: "是否确定将“" + this.data.codeMsg.name + "”作为您的" + this.data.manner + "合作伙伴",
|
|
|
- success: (s => {
|
|
|
- if (s.confirm) {
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": wx.getStorageSync('userData').token,
|
|
|
- "classname": "customer.tagents.tagents",
|
|
|
- "method": "apply_cooperation",
|
|
|
- "content": {
|
|
|
- "tcooperationagentsid": that.data.codeMsg.id,
|
|
|
- "ftype": that.data.selectType
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- wx.showToast({
|
|
|
- title: "合作申请成功",
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/tabbar-pages/home/index',
|
|
|
- })
|
|
|
- }, 500)
|
|
|
- wx.removeStorageSync('qrCodeMsg');
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- } else if (this.data.codeMsg.type == 'shop') {
|
|
|
- wx.showModal({
|
|
|
- title: "提示",
|
|
|
- content: "是否确定加入“" + this.data.codeMsg.name + "”成为团队的一份子",
|
|
|
- success: (s => {
|
|
|
- if (s.confirm) {
|
|
|
- _Http.basic({
|
|
|
- "classname": "publicmethod.users.Users",
|
|
|
- "method": "entryTeamApply",
|
|
|
- "content": {
|
|
|
- "userid": wx.getStorageSync('userData').userid,
|
|
|
- "tagentsid": that.data.codeMsg.id
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.data != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- wx.showToast({
|
|
|
- title: "申请成功",
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/tabbar-pages/home/index',
|
|
|
- })
|
|
|
- }, 500)
|
|
|
- wx.removeStorageSync('qrCodeMsg');
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- /* 取消 */
|
|
|
- refuse() {
|
|
|
- if (this.data.codeMsg.type == 'partner') {
|
|
|
- wx.showModal({
|
|
|
- title: "提示",
|
|
|
- content: "是否确定取消与“" + this.data.codeMsg.name + "”建立合作关系",
|
|
|
- success: (res => {
|
|
|
- console.log(res)
|
|
|
- if (res.confirm) {
|
|
|
- wx.showToast({
|
|
|
- title: "取消成功",
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/tabbar-pages/home/index',
|
|
|
- })
|
|
|
- }, 500)
|
|
|
- wx.removeStorageSync('qrCodeMsg');
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- } else if (this.data.codeMsg.type == 'shop') {
|
|
|
- wx.showModal({
|
|
|
- title: "提示",
|
|
|
- content: "是否确定取消加入“" + this.data.codeMsg.name + "”",
|
|
|
- success: (res => {
|
|
|
- if (res.confirm) {
|
|
|
- wx.showToast({
|
|
|
- title: "取消成功",
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/tabbar-pages/home/index',
|
|
|
- })
|
|
|
- }, 500)
|
|
|
- wx.removeStorageSync('qrCodeMsg');
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- /* 选择合作方式 */
|
|
|
- selectManner() {
|
|
|
- this.setData({
|
|
|
- show: !this.data.show
|
|
|
- })
|
|
|
- },
|
|
|
- optionChange({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- let selectType = 3;
|
|
|
- switch (detail) {
|
|
|
- case "上游":
|
|
|
- selectType = 1;
|
|
|
- break;
|
|
|
- case "下游":
|
|
|
- selectType = 2;
|
|
|
- break;
|
|
|
- case "双向合作":
|
|
|
- selectType = 3;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- manner: detail,
|
|
|
- selectType,
|
|
|
- show: false
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady: function () {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow: function () {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide: function () {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload: function () {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh: function () {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom: function () {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage: function () {
|
|
|
-
|
|
|
- }
|
|
|
-})
|