diff --git a/app.js b/app.js index eca65c5..3165bc2 100644 --- a/app.js +++ b/app.js @@ -51,7 +51,7 @@ App({ config: null, //门店参数 config2: null, //门店配置 code: null, - user_id: null,//5682094,6520044,6520119 qa 4687 6519901 zs 10153869 + user_id:null,//5682094,6520044,6520119 qa 4687 6519901 zs 10153869 buy_now: null, picklist: null, //门店列表 wuliuprice: null, //物流价格表 @@ -73,15 +73,17 @@ App({ }, auth: o, request: a, - onLaunch: function () { + onLaunch: function (option) { //初始化美图测肤插件 // var plugin = requirePlugin('mtSkinSdk'); // params.login_id = wx.getStorageSync('login_id') || '' // 可将登录id缓存下来,方便下次进入小程序直接获取 // plugin.setConfig(pluginGD) - + if(option) this.globalData.scene=option.scene; wx.hideTabBar(); this.initExt(); + + //检查更新 this.checkUpdateVersion(); @@ -690,6 +692,7 @@ App({ th.globalData.dis_buy_obj = null; //等级卡的购买记录 th.globalData.storeFooter = null; //底部的导航 th.globalData.full_screen = null; //全屏 + th.globalData.scene=null } else { th.globalData.no_clear = 0; } @@ -851,21 +854,23 @@ App({ }); }, - con_wx(th) { - var url = th.data.sys_switch.weapp_customertype_url; - var id = th.data.sys_switch.weapp_customertype_appid; - this.globalData.no_clear = 1; + + + //联系客服的3个函数 + con_wx(th){ + var url=th.data.sys_switch.weapp_customertype_url; + var id=th.data.sys_switch.weapp_customertype_appid; + this.globalData.no_clear=1; wx.openCustomerServiceChat({ extInfo: { url: url }, corpId: id, success(res) { } }) }, - - con_Service() { - var th = this; - var oss = this.globalData.setting; - this.getConfig(function (t) { + con_Service(){ + var th=this; + var oss= this.globalData.setting; + this.getConfig(function(t) { if (t.store_tel == undefined) { th.request.get("/api/weshop/store/get/" + oss.stoid, { isShowLoading: 1, @@ -935,8 +940,28 @@ App({ check_can_share() { if (!this.globalData.user_id) wx.hideShareMenu(); else wx.showShareMenu(); - } + }, + //--- 判断是不是皮肤的商品的公共函数 --- + check_skin_face(options,type,goods_id){ + if(options.skinface_id){ + this.globalData.skinface_id=options.skinface_id; + var stoid=this.globalData.setting.stoid; + var user_id=this.globalData.user_id; + if(!user_id) return false; + //点击量的 + this.request.promisePost("/api/weshop/face/skinGoodsBrowse/save",{ + data:{ + store_id:stoid, + goods_id:goods_id, + user_id:user_id, + addtime:ut.gettimestamp(), + skinface_id:options.skinface_id, + goods_type:type + } + }).then(res=>{}) + } + } diff --git a/utils/pay.js b/utils/pay.js index ddd33e6..2c66988 100644 --- a/utils/pay.js +++ b/utils/pay.js @@ -32,6 +32,9 @@ module.exports = { }; if (type == 1) dd.type = 1; + if(getApp().globalData.scene) + dd.scene=getApp().globalData.scene; + wx.showLoading(); n.post(this.url, { data: dd, diff --git a/utils/pay2.js b/utils/pay2.js index 11562b3..1d753b9 100644 --- a/utils/pay2.js +++ b/utils/pay2.js @@ -7,6 +7,9 @@ module.exports = { if(wx_paying) return false; wx_paying=1; + if(getApp().globalData.scene) + dd.scene=getApp().globalData.scene; + wx.showLoading(); var i = this; n.post(this.url, { diff --git a/utils/request.js b/utils/request.js index 2ed01bb..95bb025 100644 --- a/utils/request.js +++ b/utils/request.js @@ -244,13 +244,19 @@ module.exports = { promisePut:function(url,data){ var th=this; if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; + var post_data=data.data; + var header={"content-type": "application/x-www-form-urlencoded" }; + if(data.is_json){ + header={ 'content-type': 'application/json'}; + post_data=JSON.stringify(post_data); + }; return new Promise((resolve, reject) => { data.isShowLoading && th.showLoading(); wx.request({ url, method: 'PUT', - header: {"content-type": "application/x-www-form-urlencoded" }, - data:data.data, + header: header, + data:post_data, success(res) { data.isShowLoading && th.hideLoading(); resolve(res);