UNIAPP教程
如果你不需要cps分销功能,不需要替换安装包的前端代码,如果需要就把前端文件直接覆盖到前端文件中进行打包处理
分销功能需要导入数据库表,在插件包内,如果你设置了标前缀需要自行修改后导入
分销功能需要在站点新增定时任务:
cd /www/wwwroot/修改为你的站点目录名称 && /www/server/php/74/bin/php think cps
如下图在系统后台下载uniapp前端源码包,HBuilder X打包工具,小程序开发者工具,三个内容,将源码文件解压至文件夹并导入至HBuilder X工具内,
修改config文件内的文件,并保存
复制下列代码替换uniapp端口的代码,如图所示,注意区分小程序h5的代码,如果你复制的是小程序的代码,那么就只能打包小程序使用,如果打包的是h5则只能打包h5使用
小程序代码
uni.redirectTo({
url
});
break;
default:
if (url == '/pages_tool/cps/kdkf' || url == '/pages_tool/cps/mtqb' ||//库迪咖啡/美团券包
url == '/pages_tool/cps/jtkMovie' || url =='/pages_tool/cps/dylm' || //电影票/抖音电商
url == '/pages_tool/cps/bdshPlugin' || url == '/pages_tool/cps/bsk' ||//联联周边/必胜客
url == '/pages_tool/cps/jtkjqmp' || url =='/pages_tool/cps/jtkDc' || //景区门票/聚合点餐
url == '/pages_tool/cps/jtkkfc' || url == '/pages_tool/cps/jtkmdl' ||//肯德基/麦当劳
url == '/pages_tool/cps/rxkf' || url == '/pages_tool/cps/wph' || //瑞幸咖啡/唯品会
url == '/pages_tool/cps/jtkjd' ||url == '/pages_tool/cps/jtkxbk' || //酒店预定/星巴克
url == '/pages_tool/cps/jtknx' || url == '/pages_tool/cps/elm' ||//奈雪/饿了么
url == '/pages_tool/cps/fzcps' || url == '/pages_tool/cps/fzfjp' || //飞猪聚合/飞猪飞机票
url =='/pages_tool/cps/fzhcp' || url == '/pages_tool/cps/mtwm' || //飞猪火车票/美团外卖
url == '/pages_tool/cps/dccx' || url =='/pages_tool/cps/jtkwmsy' || //打车出行/美团到店
url == '/pages_tool/cps/bpcz' || url == '/pages_tool/cps/bpjh' || //半屏充值/半屏聚合
url == '/pages_tool/cps/mydc' || url == '/pages_tool/cps/ych' || //蚂蚁点餐/演唱会
url == '/pages_tool/cps/mxbc' ||url == '/pages_tool/cps/dsjh' || //蜜雪冰城/电商聚合
url == '/pages_tool/cps/jdds' || url == '/pages_tool/cps/tb' ||//京东电商/淘宝
url == '/pages_tool/cps/pdd' || url == '/pages_tool/cps/dysc' || //拼多多/抖音商城
url == '/pages_tool/cps/dytg' ||url == '/pages_tool/cps/llk' || //抖音团购/流量卡
url == '/pages_tool/cps/ddjy' ||url == '/pages_tool/cps/cngg' || //滴滴加油/菜鸟裹裹
url == '/pages_tool/cps/mtbwc'||url == '/pages_tool/cps/jdjx'||
url == '/pages_tool/cps/bjj'||url == '/pages_tool/cps/elmbwc') {
Http.sendRequest({
url: '/cps/api/cps/config',
success: res => {
if (res.code == 0) {
return this.get_cps(url, res.data)
}else{
this.showToast({
title: res.message ? res.message : '请先登录'
});
}
}
})
return
}
// 保留当前页面,跳转到应用内的某个页面
uni.navigateTo({
url
});
}
},
get_cps(type, config) {
let url = ''
let sid = config.member_id
//奈雪
if (type == '/pages_tool/cps/jtknx') {
url = "plugin://jtkDc/nxindex?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//充值聚合
} else if (type == '/pages_tool/cps/czjh') {
url = "plugin-private://wx92eb6fb9f1218f37/pages/recharge/index?apikey=" + config.my_apikey + "&uid=" +
config.my_uid + "&index=/pages/index/index";
//蚂蚁点餐
} else if (type == '/pages_tool/cps/mydc') {
url = "plugin://mayi-ordering/welcome?type=bsk&apikey=" + config.my_apikey + "&uid=" + config.my_uid +
"&index=/pages/index/index";
//半屏充值
} else if (type == '/pages_tool/cps/bpcz') {
wx.openEmbeddedMiniProgram({
appId: 'wx5f482af87ff127ca',
path: 'pages/recharge/detail?cid=1&apikey=' + config.my_apikey + '&uid=' + config.my_uid
})
return;
//半屏聚合
} else if (type == '/pages_tool/cps/bpjh') {
wx.openEmbeddedMiniProgram({
appId: 'wx5f482af87ff127ca',
path: 'pages/recharge/index?cid=1&apikey=' + config.my_apikey + '&uid=' + config.my_uid
})
return;
//流量卡
} else if (type == '/pages_tool/cps/llk') {
wx.openEmbeddedMiniProgram({
appId: 'wxa90429c57325c4c5',
path: 'pages/index/index?apikey=' + config.my_apikey + '&uid=' + config.my_uid
})
return;
//话费电费
} else if (type == '/pages_tool/cps/hfdf') {
url = "plugin-private://wx92eb6fb9f1218f37/pages/index/index?apikey=" + config.my_apikey + "&uid=" +
config.my_uid + "&index=/pages/index/index";
//京东
} else if (type == '/pages_tool/cps/jd') {
url = "plugin-private://wx8440a8c8c378f869/pages/shop/index?apikey=" + config.my_apikey + "&uid=" + config
.my_uid + "&index=/pages/index/index&sharepath=/pages/index/index&hidejd=1&foot=";
//京东精选
} else if (type == '/pages_tool/cps/jdjx') {
url = "plugin://meishi/jingdong?pub_id=" + config.jutuike_pub_id +
"&eliteId=10";
//蚂蚁联联
} else if (type == '/pages_tool/cps/lianlian') {
url = "plugin-private://wx8440a8c8c378f869/pages/city/index?apikey=" + config.my_apikey + "&uid=" + config
.my_uid + "&index=/pages/index/index&sharepath=/pages/wusan/index";
//推客影票
} else if (type == '/pages_tool/cps/jtkMovie') {
url = "plugin-private://wx89752980e795bfde/pages/index/index?pub_id=" + config.jutuike_pub_id +
"&channel=plugin";
//酒店预定
} else if (type == '/pages_tool/cps/jtkjd') {
url = "plugin://meishi/shop?pub_id=" + config.jutuike_pub_id +
"&type=hotel&sid=plugin";
//景区门票
} else if (type == '/pages_tool/cps/jtkjqmp') {
url = "plugin://menpiao-plugin/home?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//比价寄
} else if (type == '/pages_tool/cps/bjj') {
url = "plugin://express-plugin/home?shareCode=615NBXBL3"
"&extra=4718jutuike";
//推客联联
} else if (type == '/pages_tool/cps/bdshPlugin') {
url = "plugin://bdshPlugin/index?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//聚合点餐
} else if (type == '/pages_tool/cps/jtkDc') {
url = "plugin://jtkDc/index?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//肯德基
} else if (type == '/pages_tool/cps/jtkkfc') {
url = "plugin://jtkDc/qzkfcindex?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//瑞幸咖啡
} else if (type == '/pages_tool/cps/rxkf') {
url = "plugin://jtkDc/rxindex?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//蜜雪冰城
} else if (type == '/pages_tool/cps/mxbc') {
url = "plugin://meishi/tuangou?pub_id=" + config.jutuike_pub_id +
"&type=mxbc&sid=" + sid;
//电商聚合
} else if (type == '/pages_tool/cps/dsjh') {
url = "plugin://meishi/dianshang?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//抖音团购
} else if (type == '/pages_tool/cps/dytg') {
url = "plugin://meishi/douyin?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//抖音商城
} else if (type == '/pages_tool/cps/dysc') {
url = "plugin://meishi/tiktok?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//抖音联盟
} else if (type == '/pages_tool/cps/dylm') {
url = "plugin://meishi/dianshang?pub_id=" + config.jutuike_pub_id +
"&source=douyin&sid=" + sid;
//拼多多
} else if (type == '/pages_tool/cps/pdd') {
url = "plugin://meishi/dianshang?pub_id=" + config.jutuike_pub_id +
"&source=pdd&sid=" + sid;
//京东
} else if (type == '/pages_tool/cps/jdds') {
url = "plugin://meishi/dianshang?pub_id=" + config.jutuike_pub_id +
"&source=jd&sid=" + sid;
//淘宝
} else if (type == '/pages_tool/cps/tb') {
url = "plugin://meishi/dianshang?pub_id=" + config.jutuike_pub_id +
"&source=taobao&sid=" + sid;
//唯品会
} else if (type == '/pages_tool/cps/wph') {
url = "plugin://meishi/dianshang?pub_id=" + config.jutuike_pub_id +
"&source=vip&sid=" + sid;
//必胜客
} else if (type == '/pages_tool/cps/bsk') {
url = "plugin://jtkDc/bskindex?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//麦当劳
} else if (type == '/pages_tool/cps/jtkmdl') {
url = "plugin://jtkDc/mcDonaldindex?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//星巴克
} else if (type == '/pages_tool/cps/jtkxbk') {
url = "plugin://jtkDc/xbkindex?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//库迪咖啡
} else if (type == '/pages_tool/cps/kdkf') {
url = "plugin://jtkDc/kudiindex?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//美团到店
} else if (type == '/pages_tool/cps/jtkwmsy') {
url = "plugin://meishi/home?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//美团券包
} else if (type == '/pages_tool/cps/mtqb') {
url = "plugin://meishi/coupon?pub_id=" + config.jutuike_pub_id +
"&sid=" + sid;
//美团外卖
} else if (type == '/pages_tool/cps/mtwm') {
url = "plugin://meishi/shop?pub_id=" + config.jutuike_pub_id +
"&type=meituan&sid=" + sid;
//饿了么
} else if (type == '/pages_tool/cps/elm') {
url = "plugin://meishi/shop?pub_id=" + config.jutuike_pub_id +
"&type=ele&sid=" + sid;
//出行
} else if (type == '/pages_tool/cps/dccx') {
url = "plugin://meishi/shop?pub_id=" + config.jutuike_pub_id +
"&type=didi&sid=" + sid;
//美团霸王餐
} else if (type == '/pages_tool/cps/mtbwc') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=138&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//饿了么霸王餐
} else if (type == '/pages_tool/cps/elmbwc') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=112&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//菜鸟裹裹
} else if (type == '/pages_tool/cps/cngg') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=154&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//飞猪火车票
} else if (type == '/pages_tool/cps/fzhcp') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=91&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//飞猪飞机票
} else if (type == '/pages_tool/cps/fzfjp') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=113&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//飞猪聚合
} else if (type == '/pages_tool/cps/fzcps') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=120&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//
} else if (type == '/pages_tool/cps/fzfjp') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=113&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//滴滴加油
} else if (type == '/pages_tool/cps/ddjy') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=67&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//演唱会
} else if (type == '/pages_tool/cps/ddjy') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=153&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
//特价快递
} else if (type == '/pages_tool/cps/jtktjkd') {
uni.request({
url: 'https://api.jutuike.com/union/act?apikey=' + config.jutuike_apikey +
'&act_id=52&sid=' + sid,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;application/json'
},
dataType: 'json',
responseType: 'text',
success: (ret) => {
if (ret.data.code == 0) {
return uni.showToast({
title: ret.data.msg,
duration: 2000
});
}
if (ret.data.data.we_app_info) {
uni.navigateToMiniProgram({
appId: ret.data.data.we_app_info.app_id,
path: ret.data.data.we_app_info.page_path,
success(res) {
// 打开成功
}
})
} else if (ret.data.data.h5) {
uni.navigateTo({
url: '/pages_tool/webview/webview?src=' + ret.data.data.h5
})
}
},
})
return;
}
uni.navigateTo({
url
});
},
H5代码
uni.reLaunch({ url }); break; default: if (url == '/pages_tool/cps/kdkf' || url == '/pages_tool/cps/mtqb' ||//库迪咖啡/美团券包 url == '/pages_tool/cps/jtkMovie' || url =='/pages_tool/cps/dylm' || //电影票/抖音电商 url == '/pages_tool/cps/bdshPlugin' || url == '/pages_tool/cps/bsk' ||//联联周边/必胜客 url == '/pages_tool/cps/jtkjqmp' || url =='/pages_tool/cps/jtkDc' || //景区门票/聚合点餐 url == '/pages_tool/cps/jtkkfc' || url == '/pages_tool/cps/jtkmdl' ||//肯德基/麦当劳 url == '/pages_tool/cps/rxkf' || url == '/pages_tool/cps/wph' || //瑞幸咖啡/唯品会 url == '/pages_tool/cps/jtkjd' ||url == '/pages_tool/cps/jtkxbk' || //酒店预定/星巴克 url == '/pages_tool/cps/jtknx' || url == '/pages_tool/cps/elm' ||//奈雪/饿了么 url == '/pages_tool/cps/fzcps' || url == '/pages_tool/cps/fzfjp' || //飞猪聚合/飞猪飞机票 url =='/pages_tool/cps/fzhcp' || url == '/pages_tool/cps/mtwm' || //飞猪火车票/美团外卖 url == '/pages_tool/cps/dccx' || url =='/pages_tool/cps/jtkwmsy' || //打车出行/美团到店 url == '/pages_tool/cps/bpcz' || url == '/pages_tool/cps/bpjh' || //半屏充值/半屏聚合 url == '/pages_tool/cps/mydc' || url == '/pages_tool/cps/ych' || //蚂蚁点餐/演唱会 url == '/pages_tool/cps/mxbc' ||url == '/pages_tool/cps/dsjh' || //蜜雪冰城/电商聚合 url == '/pages_tool/cps/jdds' || url == '/pages_tool/cps/tb' ||//京东电商/淘宝 url == '/pages_tool/cps/pdd' || url == '/pages_tool/cps/dysc' || //拼多多/抖音商城 url == '/pages_tool/cps/dytg' ||url == '/pages_tool/cps/llk' || //抖音团购/流量卡 url == '/pages_tool/cps/ddjy' ||url == '/pages_tool/cps/cngg' || //滴滴加油/菜鸟裹裹 url == '/pages_tool/cps/mtbwc'||url == '/pages_tool/cps/jdjx'|| url == '/pages_tool/cps/elmbwc'){ Http.sendRequest({ url: '/cps/api/cps/config', success: res => { if (res.code == 0) { return this.get_cps(url, res.data) } else { this.showToast({ title: res.message ? res.message : '请先登录' }); } } }) return } // 保留当前页面,跳转到应用内的某个页面 uni.navigateTo({ url }); } }, get_cps(type, config) { let url = '' //话费电费 if (type == '/pages_tool/cps/hfdf') { this.get_mayi_url(14, config) //电影票 } else if (type == '/pages_tool/cps/jtkMovie') { this.get_url(76, config) //景区门票 //唯品会 } else if (type == '/pages_tool/cps/wph') { this.get_url(124, config) } else if (type == '/pages_tool/cps/jtkjqmp') { this.get_url(105, config) //奈雪 } else if (type == '/pages_tool/cps/jtknx') { this.get_url(32, config) //美团到店 } else if (type == '/pages_tool/cps/jtkwmsy') { this.get_url(117, config) //联联 } else if (type == '/pages_tool/cps/bdshPlugin') { this.get_url(54, config) //点餐聚合 } else if (type == '/pages_tool/cps/jtkDc') { this.get_url(70, config) //抖音团购 } else if (type == '/pages_tool/cps/dytg') { this.get_url(152, config) //滴滴加油 } else if (type == '/pages_tool/cps/ddjy') { this.get_url(67, config) //演唱会 } else if (type == '/pages_tool/cps/ych') { this.get_url(153, config) //电商聚合 } else if (type == '/pages_tool/cps/dsjh') { this.get_url(13, config) //京东电商 } else if (type == '/pages_tool/cps/jdds') { this.get_url(114, config) //京东电商 } else if (type == '/pages_tool/cps/jdjx') { this.get_url(114, config) //充值聚合 } else if (type == '/pages_tool/cps/bpjh') { this.get_url(94, config) //肯德基 } else if (type == '/pages_tool/cps/jtkkfc') { this.get_url(16, config) //麦当劳 } else if (type == '/pages_tool/cps/jtkmdl') { this.get_url(26, config) //必胜客 } else if (type == '/pages_tool/cps/bsk') { this.get_url(64, config) //星巴克 } else if (type == '/pages_tool/cps/jtkxbk') { this.get_url(34, config) //瑞幸咖啡 } else if (type == '/pages_tool/cps/rxkf') { this.get_url(33, config) //库迪咖啡 } else if (type == '/pages_tool/cps/kdkf') { this.get_url(136, config) //拼多多 } else if (type == '/pages_tool/cps/pdd') { this.get_url(12, config) //美团酒店 } else if (type == '/pages_tool/cps/jtkjd') { this.get_url(75, config) //美团券包 } else if (type == '/pages_tool/cps/mtqb') { this.get_url(106, config) //打车出行 } else if (type == '/pages_tool/cps/dccx') { this.get_url(61, config) //饿了么 } else if (type == '/pages_tool/cps/elm') { this.get_url(3, config) //饿了么霸王餐 } else if (type == '/pages_tool/cps/elmbwc') { this.get_url(3, config) //飞猪聚合 } else if (type == '/pages_tool/cps/fzcps') { this.get_url(120, config) //飞猪火车票 } else if (type == '/pages_tool/cps/fzhcp') { this.get_url(120, config) //飞猪飞机票 } else if (type == '/pages_tool/cps/fzfjp') { this.get_url(113, config) //滴滴租车 } else if (type == '/pages_tool/cps/ddzc') { this.get_url(102, config) //高德打车 } else if (type == '/pages_tool/cps/jtkgddc') { this.get_url(47, config) //特价快递 } else if (type == '/pages_tool/cps/jtktjkd') { this.get_url(52, config) //拼多多代替京东 } else if (type == '/pages_tool/cps/jd') { this.get_url(13, config) //美团外卖 } else if (type == '/pages_tool/cps/mtwm') { this.get_url(117, config) //美团霸王餐 } else if (type == '/pages_tool/cps/mtbwc') { this.get_url(138, config) //菜鸟裹裹 } else if (type == '/pages_tool/cps/cngg') { this.get_url(154, config) //抖音联盟 } else if (type == '/pages_tool/cps/jtkdylm') { this.get_url(56, config) } uni.navigateTo({ url }); }, //act_id: //apikey: get_url(act_id, config) { let apikey = config.jutuike_apikey let sid = config.member_id uni.request({ url: 'https://api.jutuike.com/union/act?apikey=' + apikey + '&sid=' + sid + '&act_id=' + act_id, method: 'POST', header: { 'content-type': 'application/x-www-form-urlencoded;application/json' }, dataType: 'json', responseType: 'text', success: (ret) => { if (ret.data.code == 0) { return uni.showToast({ title: ret.data.msg, duration: 2000 }); } if (ret.data.data.h5) { // #ifdef H5 window.location.href = ret.data.data.h5 // #endif // #ifndef H5 uni.navigateTo({ url: '/pages_tool/webview/webview?src=' + ret.data.data.h5 }) // #endif } return }, }) }, get_mayi_url(actid, config) { let apikey = config.my_apikey let sid = config.member_id uni.request({ url: 'http://api-gw.haojingke.com/index.php/v2/api/index/actunionurl?apikey=' + apikey + '&extend_id=' + sid + '&actid=' + actid, method: 'POST', header: { 'content-type': 'application/x-www-form-urlencoded;application/json' }, dataType: 'json', responseType: 'text', success: (ret) => { if (ret.data.status_code == 200) { if (ret.data.data.url) { // #ifdef H5 window.location.href = ret.data.data.url // #endif // #ifndef H5 uni.navigateTo({ url: '/pages_tool/webview/webview?src=' + ret.data.data.url }) // #endif } } else { return uni.showToast({ title: ret.data.message, duration: 2000 }); } return }, }) },
pages.json增加代码参考下图(为了方便识别就参考我截图的样式复制)不需要cps分销功能无需配置此项
}
},
{
"path": "fenxiao/cpsorder",
"style": {
// #ifdef H5
"navigationStyle": "custom"
// #endif
}
},
{
"path": "fenxiao/cps_order_detail",
"style": {
// #ifdef H5
"navigationStyle": "custom"
// #endif
}
}
]
},
{
分销文件修改此项代码(参考图示内容)
CPS订单
订单分销明细
完成上述内容配置后,发布前端h5/小程序
H5说明
打包完成后,将打包后的代码上传到站点根目录的h5文件夹内,解压覆盖h5文件夹内的文件
小程序说明
打包完成小程序代码后,使用微信开发者工具,导入代码后请查看微信开发者工具配置教程,教程地址https://xuanloo.com/faq/41.html